simple fix to -pal cmd setting turned into updating the whole infrastructure responsible for regions. now region change is also reported if it was specified in cmd.

fix #743
This commit is contained in:
feos-tas 2016-07-31 17:06:46 +00:00
parent 284d735bb9
commit 69752141c4
6 changed files with 69 additions and 58 deletions

View File

@ -122,7 +122,7 @@ void FCEUI_SetVidSystem(int a);
//Set variables for NTSC(0) / PAL(1) / Dendy(2) //Set variables for NTSC(0) / PAL(1) / Dendy(2)
//Dendy has PAL framerate and resolution, but ~NTSC timings, and has 50 dummy scanlines to force 50 fps //Dendy has PAL framerate and resolution, but ~NTSC timings, and has 50 dummy scanlines to force 50 fps
void FCEUI_SetRegion(int region); void FCEUI_SetRegion(int region, int from_menu = 1);
//Convenience function; returns currently emulated video system(0=NTSC, 1=PAL). //Convenience function; returns currently emulated video system(0=NTSC, 1=PAL).
int FCEUI_GetCurrentVidSystem(int *slstart, int *slend); int FCEUI_GetCurrentVidSystem(int *slstart, int *slend);

View File

@ -19,11 +19,11 @@
*/ */
/****************************************************************/ /****************************************************************/
/* FCE Ultra */ /* FCE Ultra */
/* */ /* */
/* This file contains code for parsing command-line */ /* This file contains code for parsing command-line */
/* options. */ /* options. */
/* */ /* */
/****************************************************************/ /****************************************************************/
#include <stdio.h> #include <stdio.h>

View File

@ -19,6 +19,7 @@
*/ */
#include "main.h" #include "main.h"
#include "fceu.h"
#include "args.h" #include "args.h"
#include "common.h" #include "common.h"
#include "../common/args.h" #include "../common/args.h"
@ -41,43 +42,43 @@ extern bool turbo;
//------------------------------------------------------------- //-------------------------------------------------------------
char *ParseArgies(int argc, char *argv[]) char *ParseArgies(int argc, char *argv[])
{ {
static ARGPSTRUCT FCEUArgs[]={ static ARGPSTRUCT FCEUArgs[]={
{"-pal",&pal_setting_specified,&pal_emulation,0}, {"-pal", &pal_setting_specified,&PAL, 0},
{"-dendy",0,&dendy,0}, {"-dendy", &pal_setting_specified,&dendy, 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},
//{"-nofs",0,&eoptions,0}, //{"-nofs", 0, &eoptions, 0},
{"-clipsides",0,&eoptions,0x8000|EO_CLIPSIDES}, {"-clipsides", 0, &eoptions, 0x8000|EO_CLIPSIDES},
{"-nothrottle",0,&eoptions,0x8000|EO_NOTHROTTLE}, {"-nothrottle", 0, &eoptions, 0x8000|EO_NOTHROTTLE},
{"-playmovie",0,&MovieToLoad,0x4001}, {"-playmovie", 0, &MovieToLoad, 0x4001},
{"-lua",0,&LuaToLoad,0x4001}, {"-lua", 0, &LuaToLoad, 0x4001},
{"-palette",0,&PaletteToLoad,0x4001}, {"-palette", 0, &PaletteToLoad, 0x4001},
{"-loadstate",0,&StateToLoad,0x4001}, {"-loadstate", 0, &StateToLoad, 0x4001},
{"-readonly",0,&replayReadOnlySetting,0}, {"-readonly", 0, &replayReadOnlySetting, 0},
{"-stopframe",0,&replayStopFrameSetting,0}, {"-stopframe", 0, &replayStopFrameSetting,0},
{"-framedisplay",0,&frame_display,0}, {"-framedisplay",0, &frame_display, 0},
{"-inputdisplay",0,&input_display,0}, {"-inputdisplay",0, &input_display, 0},
{"-allowUDLR",0,&allowUDLR,0}, {"-allowUDLR", 0, &allowUDLR, 0},
{"-stopmovie",0,&pauseAfterPlayback,0}, {"-stopmovie", 0, &pauseAfterPlayback, 0},
{"-shutmovie",0,&closeFinishedMovie,0}, {"-shutmovie", 0, &closeFinishedMovie, 0},
{"-bginput",0,&EnableBackgroundInput,0}, {"-bginput", 0, &EnableBackgroundInput, 0},
{"-turbo",0,&turbo,0}, {"-turbo", 0, &turbo, 0},
{"-pause",0,&PauseAfterLoad,0}, {"-pause", 0, &PauseAfterLoad, 0},
{"-cfg",0,&ConfigToLoad,0x4001}, {"-cfg", 0, &ConfigToLoad, 0x4001},
{"-avi",0,&AviToLoad,0x4001}, {"-avi", 0, &AviToLoad, 0x4001},
{"-avicapture",0,&AVICapture,0}, {"-avicapture", 0, &AVICapture, 0},
{"-dumpinput",0,&DumpInput,0x4001}, {"-dumpinput", 0, &DumpInput, 0x4001},
{"-playinput",0,&PlayInput,0x4001}, {"-playinput", 0, &PlayInput, 0x4001},
{0, 0, 0, 0}, {0, 0, 0, 0},
}; };
if(argc <= 1) if(argc <= 1)
{ {
return(0); return(0);
} }
int used = ParseArguments(argc-1, &argv[1], FCEUArgs); int used = ParseArguments(argc-1, &argv[1], FCEUArgs);
return(argv[used+1]); return(argv[used+1]);
} }

View File

@ -767,12 +767,12 @@ int main(int argc,char *argv[])
LoadNewGamey(hAppWnd, 0); LoadNewGamey(hAppWnd, 0);
} }
if (pal_setting_specified && !dendy) if (PAL && !dendy)
{ FCEUI_SetRegion(1, pal_setting_specified);
// Force the PAL setting specified in the command line, unless Dendy else if (dendy)
pal_emulation = saved_pal_setting; FCEUI_SetRegion(2, pal_setting_specified);
FCEUI_SetVidSystem(pal_emulation); else
} FCEUI_SetRegion(0, pal_setting_specified);
if(PaletteToLoad) if(PaletteToLoad)
{ {

View File

@ -1042,7 +1042,7 @@ bool ALoad(const char *nameo, char* innerFilename, bool silent)
if (GameInfo) FCEUI_CloseGame(); if (GameInfo) FCEUI_CloseGame();
if (FCEUI_LoadGameVirtual(nameo, 1, silent)) if (FCEUI_LoadGameVirtual(nameo, !pal_setting_specified, silent))
{ {
pal_emulation = FCEUI_GetCurrentVidSystem(0, 0); pal_emulation = FCEUI_GetCurrentVidSystem(0, 0);

View File

@ -502,7 +502,8 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen
// ################################## End of SP CODE ########################### // ################################## End of SP CODE ###########################
#endif #endif
FCEU_ResetVidSys(); if (OverwriteVidMode)
FCEU_ResetVidSys();
if (GameInfo->type != GIT_NSF) if (GameInfo->type != GIT_NSF)
{ {
@ -964,7 +965,7 @@ int FCEUI_GetCurrentVidSystem(int *slstart, int *slend) {
return(PAL); return(PAL);
} }
void FCEUI_SetRegion(int region) { void FCEUI_SetRegion(int region, int from_menu) {
switch (region) { switch (region) {
case 0: // NTSC case 0: // NTSC
normalscanlines = 240; normalscanlines = 240;
@ -972,8 +973,11 @@ void FCEUI_SetRegion(int region) {
dendy = 0; dendy = 0;
// until it's fixed on sdl. see issue #740 // until it's fixed on sdl. see issue #740
#ifdef WIN32 #ifdef WIN32
FCEU_DispMessage("NTSC mode set", 0); if (from_menu)
FCEUI_printf("NTSC mode set"); {
FCEU_DispMessage("NTSC mode set", 0);
FCEUI_printf("NTSC mode set");
}
#endif #endif
break; break;
case 1: // PAL case 1: // PAL
@ -981,8 +985,11 @@ void FCEUI_SetRegion(int region) {
pal_emulation = 1; pal_emulation = 1;
dendy = 0; dendy = 0;
#ifdef WIN32 #ifdef WIN32
FCEU_DispMessage("PAL mode set", 0); if (from_menu)
FCEUI_printf("PAL mode set"); {
FCEU_DispMessage("PAL mode set", 0);
FCEUI_printf("PAL mode set");
}
#endif #endif
break; break;
case 2: // Dendy case 2: // Dendy
@ -990,8 +997,11 @@ void FCEUI_SetRegion(int region) {
pal_emulation = 0; pal_emulation = 0;
dendy = 1; dendy = 1;
#ifdef WIN32 #ifdef WIN32
FCEU_DispMessage("Dendy mode set", 0); if (from_menu)
FCEUI_printf("Dendy mode set"); {
FCEU_DispMessage("Dendy mode set", 0);
FCEUI_printf("Dendy mode set");
}
#endif #endif
break; break;
} }