* win32: fixed command line support for "-pal" (#547)

* added "(Europe)" and "(PAL)" strings to region detection
This commit is contained in:
ansstuff 2012-09-30 11:38:59 +00:00
parent cb579fa216
commit f346020de2
6 changed files with 45 additions and 24 deletions

View File

@ -110,17 +110,6 @@ int checkCondition(const char* condition, int num)
++b; ++b;
} }
// Remove the old breakpoint condition before
// adding a new condition.
if (watchpoint[num].cond)
{
freeTree(watchpoint[num].cond);
free(watchpoint[num].condText);
watchpoint[num].cond = 0;
watchpoint[num].condText = 0;
}
// If there's an actual condition create the BP condition object now // If there's an actual condition create the BP condition object now
@ -128,6 +117,15 @@ int checkCondition(const char* condition, int num)
{ {
Condition* c = generateCondition(condition); Condition* c = generateCondition(condition);
// Remove the old breakpoint condition before adding a new condition.
if (watchpoint[num].cond)
{
freeTree(watchpoint[num].cond);
free(watchpoint[num].condText);
watchpoint[num].cond = 0;
watchpoint[num].condText = 0;
}
// If the creation of the BP condition object was succesful // If the creation of the BP condition object was succesful
// the condition is apparently valid. It can be added to the // the condition is apparently valid. It can be added to the
// breakpoint now. // breakpoint now.
@ -149,6 +147,14 @@ int checkCondition(const char* condition, int num)
} }
else else
{ {
// Remove the old breakpoint condition
if (watchpoint[num].cond)
{
freeTree(watchpoint[num].cond);
free(watchpoint[num].condText);
watchpoint[num].cond = 0;
watchpoint[num].condText = 0;
}
return 0; return 0;
} }
} }

View File

@ -40,7 +40,7 @@ extern bool turbo;
char *ParseArgies(int argc, char *argv[]) char *ParseArgies(int argc, char *argv[])
{ {
static ARGPSTRUCT FCEUArgs[]={ static ARGPSTRUCT FCEUArgs[]={
{"-pal",0,&pal_emulation,0}, {"-pal",&pal_setting_specified,&pal_emulation,0},
{"-noicon",0,&status_icon,0}, {"-noicon",0,&status_icon,0},
{"-gg",0,&genie,0}, {"-gg",0,&genie,0},
{"-no8lim",0,&eoptions,0x8000|EO_NOSPRLIM}, {"-no8lim",0,&eoptions,0x8000|EO_NOSPRLIM},

View File

@ -144,6 +144,7 @@ double saspectw = 1, saspecth = 1;
double winsizemulx = 1, winsizemuly = 1; double winsizemulx = 1, winsizemuly = 1;
int genie = 0; int genie = 0;
int pal_emulation = 0; int pal_emulation = 0;
int pal_setting_specified = 0;
int ntsccol = 0, ntsctint, ntschue; int ntsccol = 0, ntsctint, ntschue;
std::string BaseDirectory; std::string BaseDirectory;
int PauseAfterLoad; int PauseAfterLoad;
@ -643,19 +644,19 @@ int main(int argc,char *argv[])
// Parse the commandline arguments // Parse the commandline arguments
t = ParseArgies(argc, argv); t = ParseArgies(argc, argv);
if (ConfigToLoad) cfgFile.assign(ConfigToLoad); int saved_pal_setting = !!pal_emulation;
//initDirectories(); if (ConfigToLoad)
{
// Load the config information cfgFile.assign(ConfigToLoad);
sprintf(TempArray,"%s\\%s",BaseDirectory.c_str(),cfgFile.c_str()); //initDirectories();
LoadConfig(TempArray); // Load the config information
sprintf(TempArray,"%s\\%s",BaseDirectory.c_str(),cfgFile.c_str());
LoadConfig(TempArray);
}
//Bleh, need to find a better place for this. //Bleh, need to find a better place for this.
{ {
pal_emulation = !!pal_emulation;
FCEUI_SetVidSystem(pal_emulation);
FCEUI_SetGameGenie(genie!=0); FCEUI_SetGameGenie(genie!=0);
fullscreen = !!fullscreen; fullscreen = !!fullscreen;
@ -678,6 +679,12 @@ int main(int argc,char *argv[])
FCEUI_SetPCMVolume(soundPCMvol); FCEUI_SetPCMVolume(soundPCMvol);
} }
if (!ConfigToLoad)
{
sprintf(TempArray,"%s\\%s",BaseDirectory.c_str(),cfgFile.c_str());
LoadConfig(TempArray);
}
//Since a game doesn't have to be loaded before the GUI can be used, make //Since a game doesn't have to be loaded before the GUI can be used, make
//sure the temporary input type variables are set. //sure the temporary input type variables are set.
ParseGIInput(NULL); ParseGIInput(NULL);
@ -751,6 +758,13 @@ int main(int argc,char *argv[])
LoadNewGamey(hAppWnd, 0); LoadNewGamey(hAppWnd, 0);
} }
if (pal_setting_specified)
{
// Force the PAL setting specified in the command line
pal_emulation = saved_pal_setting;
FCEUI_SetVidSystem(pal_emulation);
}
if(PaletteToLoad) if(PaletteToLoad)
{ {
SetPalette(PaletteToLoad); SetPalette(PaletteToLoad);

View File

@ -41,6 +41,7 @@ extern int genie;
// Flag that indicates whether PAL Emulation is enabled or not. // Flag that indicates whether PAL Emulation is enabled or not.
extern int pal_emulation; extern int pal_emulation;
extern int pal_setting_specified;
extern int status_icon; extern int status_icon;
extern int frame_display; extern int frame_display;
extern int rerecord_display; extern int rerecord_display;

View File

@ -281,7 +281,7 @@ int loadDebuggerPreferences(FILE* f)
// Read the flags of the BP // Read the flags of the BP
if (fread(&flags, sizeof(flags), 1, f) != 1) return 1; if (fread(&flags, sizeof(flags), 1, f) != 1) return 1;
// Read the length of the BP description // Read the length of the BP condition
if (fread(&len, sizeof(len), 1, f) != 1) return 1; if (fread(&len, sizeof(len), 1, f) != 1) return 1;
// Delete eventual older conditions // Delete eventual older conditions
@ -294,7 +294,6 @@ int loadDebuggerPreferences(FILE* f)
{ {
// Read the breakpoint condition // Read the breakpoint condition
if (fread(watchpoint[myNumWPs].condText, 1, len, f) != len) return 1; if (fread(watchpoint[myNumWPs].condText, 1, len, f) != len) return 1;
// TODO: Check return value // TODO: Check return value
checkCondition(watchpoint[myNumWPs].condText, myNumWPs); checkCondition(watchpoint[myNumWPs].condText, myNumWPs);
} }

View File

@ -867,6 +867,7 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
if(OverwriteVidMode) if(OverwriteVidMode)
{ {
if(strstr(name,"(E)") || strstr(name,"(e)") if(strstr(name,"(E)") || strstr(name,"(e)")
|| strstr(name,"(Europe)") || strstr(name,"(PAL)")
|| strstr(name,"(F)") || strstr(name,"(f)") || strstr(name,"(F)") || strstr(name,"(f)")
|| strstr(name,"(G)") || strstr(name,"(g)") || strstr(name,"(G)") || strstr(name,"(g)")
|| strstr(name,"(I)") || strstr(name,"(i)")) || strstr(name,"(I)") || strstr(name,"(i)"))