diff options
author | B. Watson <yalhcru@gmail.com> | 2015-05-08 04:41:20 -0400 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2015-05-10 07:04:51 +0700 |
commit | acc32ca66ddc058d645a89d672953f71a800eec1 (patch) | |
tree | bbb465a3d564f89d710cf7e22852f7fa088dbbe8 /games/colem/rom_path.diff | |
parent | 791b93fab7659739b9c35e618c4ab4be42977fcf (diff) |
games/colem: Updated for version 3.3.
Diffstat (limited to 'games/colem/rom_path.diff')
-rw-r--r-- | games/colem/rom_path.diff | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/games/colem/rom_path.diff b/games/colem/rom_path.diff index b2353f2190de..e788b8272d07 100644 --- a/games/colem/rom_path.diff +++ b/games/colem/rom_path.diff @@ -2,86 +2,86 @@ diff -Naur a/ColEm/Coleco.c b/ColEm/Coleco.c --- a/ColEm/Coleco.c 2008-03-30 12:53:24.000000000 -0400 +++ b/ColEm/Coleco.c 2009-09-29 17:49:32.000000000 -0400 @@ -19,6 +19,9 @@ - #include <stdlib.h>
- #include <ctype.h>
- #include <unistd.h>
-+#include <sys/types.h>
-+#include <limits.h>
-+#include <pwd.h>
-
- #ifdef __WATCOMC__
- #include <direct.h>
+ #include <stdlib.h> + #include <ctype.h> + #include <unistd.h> ++#include <sys/types.h> ++#include <limits.h> ++#include <pwd.h> + + #ifdef __WATCOMC__ + #include <direct.h> @@ -69,6 +72,46 @@ - #define fwrite(B,N,L,F) gzwrite(F,B,(L)*(N))
- #endif
-
-+/* 20090929 bkw: smart_fopen() searches for ROMs in various places
-+ you might expect them to live, on a UNIXey system. Also searches
-+ for both upper- and lower-case filenames. */
-+static FILE *smart_fopen(const char *path, const char *mode) {
-+ FILE *fp;
-+ char lowercase_path[20], filename[PATH_MAX + 1];
-+ const char *p = path;
-+ char *lp = lowercase_path;
-+ struct passwd *ent;
-+
-+ while(*p) *lp++ = tolower(*p++);
-+ *lp = '\0';
-+
-+ if( (fp = fopen(path, mode)) )
-+ return fp;
-+
-+ if( (fp = fopen(lowercase_path, mode)) )
-+ return fp;
-+
-+ sprintf(filename, "/usr/share/colem/%s", path);
-+ if( (fp = fopen(filename, mode)) )
-+ return fp;
-+
-+ sprintf(filename, "/usr/share/colem/%s", lowercase_path);
-+ if( (fp = fopen(filename, mode)) )
-+ return fp;
-+
-+ if( (ent = getpwuid(getuid())) && (ent->pw_dir) ) {
-+ sprintf(filename, "%s/.colem/%s", ent->pw_dir, path);
-+ if( (fp = fopen(filename, mode)) )
-+ return fp;
-+
-+ sprintf(filename, "%s/.colem/%s", ent->pw_dir, lowercase_path);
-+ if( (fp = fopen(filename, mode)) )
-+ return fp;
-+ }
-+
-+ return NULL;
-+}
-+
- /** StartColeco() ********************************************/
- /** Allocate memory, load ROM image, initialize hardware, **/
- /** CPU and start the emulation. This function returns 0 in **/
+ #define fwrite(B,N,L,F) gzwrite(F,B,(L)*(N)) + #endif + ++/* 20090929 bkw: smart_fopen() searches for ROMs in various places ++ you might expect them to live, on a UNIXey system. Also searches ++ for both upper- and lower-case filenames. */ ++static FILE *smart_fopen(const char *path, const char *mode) { ++ FILE *fp; ++ char lowercase_path[20], filename[PATH_MAX + 1]; ++ const char *p = path; ++ char *lp = lowercase_path; ++ struct passwd *ent; ++ ++ while(*p) *lp++ = tolower(*p++); ++ *lp = '\0'; ++ ++ if( (fp = fopen(path, mode)) ) ++ return fp; ++ ++ if( (fp = fopen(lowercase_path, mode)) ) ++ return fp; ++ ++ sprintf(filename, "/usr/share/colem/%s", path); ++ if( (fp = fopen(filename, mode)) ) ++ return fp; ++ ++ sprintf(filename, "/usr/share/colem/%s", lowercase_path); ++ if( (fp = fopen(filename, mode)) ) ++ return fp; ++ ++ if( (ent = getpwuid(getuid())) && (ent->pw_dir) ) { ++ sprintf(filename, "%s/.colem/%s", ent->pw_dir, path); ++ if( (fp = fopen(filename, mode)) ) ++ return fp; ++ ++ sprintf(filename, "%s/.colem/%s", ent->pw_dir, lowercase_path); ++ if( (fp = fopen(filename, mode)) ) ++ return fp; ++ } ++ ++ return NULL; ++} ++ + /** StartColeco() ********************************************/ + /** Allocate memory, load ROM image, initialize hardware, **/ + /** CPU and start the emulation. This function returns 0 in **/ @@ -134,7 +177,7 @@ -
- /* COLECO.ROM: OS7 (ColecoVision BIOS) */
- if(Verbose) printf(" Opening COLECO.ROM...");
-- if(!(F=fopen("COLECO.ROM","rb"))) P="NOT FOUND";
-+ if(!(F=smart_fopen("COLECO.ROM","rb"))) P="NOT FOUND";
- else
- {
- if(fread(ROM_BIOS,1,0x2000,F)!=0x2000) P="SHORT FILE";
+ + /* COLECO.ROM: OS7 (ColecoVision BIOS) */ + if(Verbose) printf(" Opening COLECO.ROM..."); +- if(!(F=fopen("COLECO.ROM","rb"))) P="NOT FOUND"; ++ if(!(F=smart_fopen("COLECO.ROM","rb"))) P="NOT FOUND"; + else + { + if(fread(ROM_BIOS,1,0x2000,F)!=0x2000) P="SHORT FILE"; @@ -145,7 +188,7 @@ - if(!P)
- {
- if(Verbose) printf("OK\n Opening WRITER.ROM...");
-- if(F=fopen("WRITER.ROM","rb"))
-+ if(F=smart_fopen("WRITER.ROM","rb"))
- {
- if(fread(ROM_WRITER,1,0x8000,F)==0x8000) ++AdamROMs;
- fclose(F);
+ if(!P) + { + if(Verbose) printf("OK\n Opening WRITER.ROM..."); +- if(F=fopen("WRITER.ROM","rb")) ++ if(F=smart_fopen("WRITER.ROM","rb")) + { + if(fread(ROM_WRITER,1,0x8000,F)==0x8000) ++AdamROMs; + fclose(F); @@ -157,7 +200,7 @@ - if(!P&&AdamROMs)
- {
- if(Verbose) printf(" Opening EOS.ROM...");
-- if(F=fopen("EOS.ROM","rb"))
-+ if(F=smart_fopen("EOS.ROM","rb"))
- {
- if(fread(ROM_EOS,1,0x2000,F)==0x2000) ++AdamROMs;
- fclose(F);
+ if(!P&&AdamROMs) + { + if(Verbose) printf(" Opening EOS.ROM..."); +- if(F=fopen("EOS.ROM","rb")) ++ if(F=smart_fopen("EOS.ROM","rb")) + { + if(fread(ROM_EOS,1,0x2000,F)==0x2000) ++AdamROMs; + fclose(F); |