Hi,
I have finally found why FCEUX detects all of my NTSC roms as PAL. In iNES.cpp, it checks the opened ROM pathname for the typical PAL filename marks like (E), (F), etc.
Here's an example pathname from my system:
F:\Games\(e) NES\Blaster Master (U) [!].nes
I think you can now see the problem. I've created a patch which I hereby submit to improve the pal detection process by only examining the name portion of the path. Please review and integrate into the latest svn, or let me know where I can submit the patch officially. Thanks!
Index: fceu/src/ines.cpp
===================================================================
--- fceu/src/ines.cpp (revision 1644)
+++ fceu/src/ines.cpp (working copy)
@@ -733,13 +733,46 @@
// TODO: MD5 check against a list of all known PAL games instead?
if(OverwriteVidMode)
{
- if(strstr(name,"(E)") || strstr(name,"(e)")
- || strstr(name,"(F)") || strstr(name,"(f)")
- || strstr(name,"(G)") || strstr(name,"(g)")
- || strstr(name,"(I)") || strstr(name,"(i)"))
+ char *s, c, *p, *q;
+ int index = 0;
+
+ s = (char*)malloc((strlen(name)+1) * sizeof(char));
+ strcpy(s, name);
+
+ // Reverse the path string "name" and put in s
+ if (strlen(s))
+ {
+ q = s;
+ while (*(++q)) ; // points q at '\0' terminator
+ for (p=s; p < --q; p++) // ignores middle character when strlen is odd
+ {
+ c = *p;
+ *p = *q;
+ *q = c;
+ }
+ }
+
+ char *nameRev = strstr(s,"\\");
+ if(nameRev != NULL) {
+ index = s - nameRev; // pointer arithmetic
+ index = index<0 ? (index = -index) : index; // absolute value
+ }
+
+ char *nameOnly = (char*)calloc(index+1, sizeof(char));
+ strncpy(nameOnly, s, index);
+
+ // The parens are reversed because we're using a reversed string of
+ // the filename. No need to re-reverse it and allocate more memory
+ if(strstr(nameOnly,")E(") || strstr(nameOnly,")e(")
+ || strstr(nameOnly,")F(") || strstr(nameOnly,")f(")
+ || strstr(nameOnly,")G(") || strstr(nameOnly,")g(")
+ || strstr(nameOnly,")I(") || strstr(nameOnly,")i("))
FCEUI_SetVidSystem(1);
else
FCEUI_SetVidSystem(0);
+
+ free(nameOnly);
+ free(s);
}
return 1;
}