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)
//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).
int FCEUI_GetCurrentVidSystem(int *slstart, int *slend);

View File

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

View File

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

View File

@ -1042,7 +1042,7 @@ bool ALoad(const char *nameo, char* innerFilename, bool silent)
if (GameInfo) FCEUI_CloseGame();
if (FCEUI_LoadGameVirtual(nameo, 1, silent))
if (FCEUI_LoadGameVirtual(nameo, !pal_setting_specified, silent))
{
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 ###########################
#endif
FCEU_ResetVidSys();
if (OverwriteVidMode)
FCEU_ResetVidSys();
if (GameInfo->type != GIT_NSF)
{
@ -964,7 +965,7 @@ int FCEUI_GetCurrentVidSystem(int *slstart, int *slend) {
return(PAL);
}
void FCEUI_SetRegion(int region) {
void FCEUI_SetRegion(int region, int from_menu) {
switch (region) {
case 0: // NTSC
normalscanlines = 240;
@ -972,26 +973,35 @@ void FCEUI_SetRegion(int region) {
dendy = 0;
// until it's fixed on sdl. see issue #740
#ifdef WIN32
FCEU_DispMessage("NTSC mode set", 0);
FCEUI_printf("NTSC mode set");
if (from_menu)
{
FCEU_DispMessage("NTSC mode set", 0);
FCEUI_printf("NTSC mode set");
}
#endif
break;
case 1: // PAL
normalscanlines = 240;
pal_emulation = 1;
dendy = 0;
#ifdef WIN32
FCEU_DispMessage("PAL mode set", 0);
FCEUI_printf("PAL mode set");
#ifdef WIN32
if (from_menu)
{
FCEU_DispMessage("PAL mode set", 0);
FCEUI_printf("PAL mode set");
}
#endif
break;
case 2: // Dendy
normalscanlines = 290;
pal_emulation = 0;
dendy = 1;
#ifdef WIN32
FCEU_DispMessage("Dendy mode set", 0);
FCEUI_printf("Dendy mode set");
#ifdef WIN32
if (from_menu)
{
FCEU_DispMessage("Dendy mode set", 0);
FCEUI_printf("Dendy mode set");
}
#endif
break;
}