diff options
author | agc <agc@pkgsrc.org> | 2002-05-09 22:16:52 +0000 |
---|---|---|
committer | agc <agc@pkgsrc.org> | 2002-05-09 22:16:52 +0000 |
commit | ade1421093340e73432733dd90b7cc17d22d865e (patch) | |
tree | 090973e74494c95d33c72dac945cf30b15db9173 /emulators | |
parent | 101e29868301ca15d68e0f3545a58b9150198949 (diff) | |
download | pkgsrc-ade1421093340e73432733dd90b7cc17d22d865e.tar.gz |
Add patch from Michael Core's original mail to get the correct size of
the ROM.
Diffstat (limited to 'emulators')
-rw-r--r-- | emulators/generator/Makefile | 3 | ||||
-rw-r--r-- | emulators/generator/distinfo | 3 | ||||
-rw-r--r-- | emulators/generator/patches/patch-ab | 74 |
3 files changed, 78 insertions, 2 deletions
diff --git a/emulators/generator/Makefile b/emulators/generator/Makefile index d9f942442b3..ea57f650a79 100644 --- a/emulators/generator/Makefile +++ b/emulators/generator/Makefile @@ -1,7 +1,8 @@ -# $NetBSD: Makefile,v 1.1.1.1 2002/05/09 19:08:39 agc Exp $ +# $NetBSD: Makefile,v 1.2 2002/05/09 22:16:52 agc Exp $ # DISTNAME= generator-0.34 +PKGREVISION= 1 CATEGORIES= emulators MASTER_SITES= http://www.squish.net/generator/files/ diff --git a/emulators/generator/distinfo b/emulators/generator/distinfo index 1b47da76666..f6db6a363bf 100644 --- a/emulators/generator/distinfo +++ b/emulators/generator/distinfo @@ -1,5 +1,6 @@ -$NetBSD: distinfo,v 1.1.1.1 2002/05/09 19:08:39 agc Exp $ +$NetBSD: distinfo,v 1.2 2002/05/09 22:16:52 agc Exp $ SHA1 (generator-0.34.tar.gz) = abf57875c60f63c9ffb97894f4ce9c638f60054f Size (generator-0.34.tar.gz) = 442852 bytes SHA1 (patch-aa) = 0878709485d884c1e4956b5ac4659024e31ef3ac +SHA1 (patch-ab) = 4c03632abd9a02cc2a616c2de7601223886334e4 diff --git a/emulators/generator/patches/patch-ab b/emulators/generator/patches/patch-ab new file mode 100644 index 00000000000..4ae874110d4 --- /dev/null +++ b/emulators/generator/patches/patch-ab @@ -0,0 +1,74 @@ +$NetBSD: patch-ab,v 1.1 2002/05/09 22:16:53 agc Exp $ + +--- main/generator.c 2002/05/09 21:34:29 1.1 ++++ main/generator.c 2002/05/09 21:34:34 +@@ -3,9 +3,9 @@ + #include <stdlib.h> + #include <stdio.h> + #include <string.h> +-#include <sys/stat.h> + #include <unistd.h> + #include <sys/types.h> ++#include <sys/stat.h> + #include <fcntl.h> + #include <ctype.h> + #include <signal.h> +@@ -147,7 +147,7 @@ + char *gen_loadimage(const char *filename) + { + int file, imagetype, bytes, bytesleft; +- struct stat statbuf; ++ off_t filesize; + const char *extension; + uint8 *buffer; + unsigned int blocks, x, i; +@@ -162,20 +162,6 @@ + } + + /* Load file */ +- if (stat(filename, &statbuf) != 0) +- return ("Unable to stat file."); +- cpu68k_romlen = statbuf.st_size; +- if (cpu68k_romlen < 0x200) +- return ("File is too small"); +- +- /* allocate enough memory plus 16 bytes for disassembler to cope +- with the last instruction */ +- if ((cpu68k_rom = malloc(cpu68k_romlen + 16)) == NULL) { +- cpu68k_romlen = 0; +- return ("Out of memory!"); +- } +- gen_freerom = 1; +- memset(cpu68k_rom, 0, cpu68k_romlen + 16); + #ifdef ALLEGRO + if ((file = open(filename, O_RDONLY | O_BINARY, 0)) == -1) { + #else +@@ -186,6 +172,28 @@ + cpu68k_romlen = 0; + return ("Unable to open file."); + } ++ if ( (filesize = lseek(file, 0, SEEK_END)) == -1 || // get size ++ lseek(file, 0, SEEK_SET) == -1) // then seek to start ++ { ++ perror ("lseek failed"); ++ close (file); ++ return ("Error accessing file"); ++ } ++ ++ cpu68k_romlen = filesize; ++ if (cpu68k_romlen < 0x200) { ++ (void) close(file); ++ return ("File is too small"); ++ } ++ ++ /* allocate enough memory plus 16 bytes for disassembler to cope ++ with the last instruction */ ++ if ((cpu68k_rom = malloc(cpu68k_romlen + 16)) == NULL) { ++ cpu68k_romlen = 0; ++ return ("Out of memory!"); ++ } ++ gen_freerom = 1; ++ memset(cpu68k_rom, 0, cpu68k_romlen + 16); + buffer = cpu68k_rom; + bytesleft = cpu68k_romlen; + do { |