]> Shamusworld >> Repos - virtualjaguar/commitdiff
Fix crashing on certain files with no filename extension.
authorShamus Hammons <jlhamm@acm.org>
Thu, 11 Aug 2011 14:40:39 +0000 (14:40 +0000)
committerShamus Hammons <jlhamm@acm.org>
Thu, 11 Aug 2011 14:40:39 +0000 (14:40 +0000)
src/file.cpp
src/jaguar.cpp
src/joystick.cpp

index 4b389e653503f432df0524dd22017e91d5343768..22f3c8fee3d709645ffe7942fb71a2a74d296e12 100644 (file)
@@ -186,7 +186,7 @@ bool JaguarLoadFile(char * path)
 //
 // "Alpine" file loading
 // Since the developers were coming after us with torches and pitchforks, we decided to
-// allow this kind of thing. ;-) But ONLY FOR THE DEVS, DAMMIT! O_O
+// allow this kind of thing. ;-) But ONLY FOR THE DEVS, DAMMIT! >:-U O_O
 //
 bool AlpineLoadFile(char * path)
 {
@@ -252,7 +252,15 @@ static int gzfilelength(gzFile gd)
 //
 static bool CheckExtension(const char * filename, const char * ext)
 {
+       // Sanity checking...
+       if ((filename == NULL) || (ext == NULL))
+               return false;
+
        const char * filenameExt = strrchr(filename, '.');      // Get the file's extension (if any)
+
+       if (filenameExt == NULL)
+               return false;
+
        return (strcasecmp(filenameExt, ext) == 0 ? true : false);
 }
 
index 2cf99dbb09f5e23146858d75d5781cfc4a6c5894..aecebd36072736b57874551f41255731fb8b09e6 100644 (file)
@@ -1747,6 +1747,9 @@ void JaguarDone(void)
        JaguarDasm(0x89CA56, 0x200);
        WriteLog("-------------------------------------------\n");
        JaguarDasm(0x802B48, 0x200);
+       WriteLog("\n\nM68000 disassembly at $802000...\n");
+       JaguarDasm(0x802000, 6000);
+       WriteLog("\n");//*/
 #endif
 }
 
index 146c15d9e29c547ca5a77efecd58fad27abfb4d9..66be33097e6af28452a56a68e62b4b35cacedc34 100644 (file)
@@ -341,7 +341,10 @@ uint8 JoystickReadByte(uint32 offset)
 // This is bad--we're assuming that a bit is set in the last case. Might not be so!
 // NOTE: values $7, B, D, & E are only legal ones for pad 0, (rows 3 to 0, in both cases)
 //              $E, D, B, & 7 are only legal ones for pad 1
-//       So the following code is WRONG!
+//       So the following code is WRONG! (now fixed! ;-)
+// Also: we should explicitly check for those bit patterns, as other patterns
+// are legal and yield other controllers... !!! FIX !!!
+#warning "!!! Need to explicitly check for the proper bit combinations! !!!"
 
                if (!(pad0Index & 0x01))
                        pad0Index = 0;