[Scummvm-cvs-logs] CVS: scummvm/simon simon.cpp,1.29,1.30
James Brown
ender at users.sourceforge.net
Wed May 29 06:05:03 CEST 2002
Update of /cvsroot/scummvm/scummvm/simon
In directory usw-pr-cvs1:/tmp/cvs-serv24457
Modified Files:
simon.cpp
Log Message:
Rewrite Simon filename parser.
Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- simon.cpp 29 May 2002 12:30:22 -0000 1.29
+++ simon.cpp 29 May 2002 13:04:56 -0000 1.30
@@ -121,28 +121,35 @@
}
FILE *SimonState::fopen_maybe_lowercase(const char *filename) {
- char buf[256], *e;
-
+ FILE *in;
+ char buf[256], dotbuf[256], *e;
const char *s = _game_path;
- strcpy(buf, s);
- e = strchr(buf, 0);
- strcpy(e, filename);
-
-#if defined(WIN32) || defined(__MORPHOS__)
- /* win32 is not case sensitive */
- return fopen(buf, "rb");
-#else
- /* first try with the original filename */
- FILE *in = fopen(buf, "rb");
+ strcpy(buf, s); strcat(buf, filename);
+ strcpy(dotbuf, buf); strcat(dotbuf, "."); // '.' appended version
+ // for dumb vfat drivers
+
+ /* original filename */
+ in = fopen(buf, "rb");
+ if (in) return in;
+ /* lowercase original filename */
+ e = buf; do *e = tolower(*e); while(*e++);
+ in = fopen(buf, "rb");
if (in) return in;
- /* if that fails, convert the filename into lowercase and retry */
- do *e = tolower(*e); while(*e++);
+ if (strchr(buf, '.'))
+ return NULL;
- return fopen(buf, "rb");
-#endif
+ /* dot appended original filename */
+ in = fopen(dotbuf, "rb");
+ if (in) return in;
+
+ /* lowercase dot appended */
+ e = dotbuf; do *e = tolower(*e); while(*e++);
+ in = fopen(dotbuf, "rb");
+ warning("loading %s\n", dotbuf);
+ return in;
}
@@ -2098,7 +2105,7 @@
while (*p) {
for(i=0;*p;p++,i++)
filename[i] = *p;
- filename[i] = 0;
+ filename[i] = 0;
p++;
base_max = (p[0]<<8) | p[1];
More information about the Scummvm-git-logs
mailing list