From 69752141c46cd0a3c2bfe4df426977267e548013 Mon Sep 17 00:00:00 2001 From: feos-tas Date: Sun, 31 Jul 2016 17:06:46 +0000 Subject: [PATCH] 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 --- trunk/src/driver.h | 2 +- trunk/src/drivers/common/args.cpp | 10 ++--- trunk/src/drivers/win/args.cpp | 71 ++++++++++++++++--------------- trunk/src/drivers/win/main.cpp | 12 +++--- trunk/src/drivers/win/window.cpp | 2 +- trunk/src/fceu.cpp | 30 ++++++++----- 6 files changed, 69 insertions(+), 58 deletions(-) diff --git a/trunk/src/driver.h b/trunk/src/driver.h index 85ca097a..2aab62af 100644 --- a/trunk/src/driver.h +++ b/trunk/src/driver.h @@ -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); diff --git a/trunk/src/drivers/common/args.cpp b/trunk/src/drivers/common/args.cpp index 4167b8f5..d7d29c94 100644 --- a/trunk/src/drivers/common/args.cpp +++ b/trunk/src/drivers/common/args.cpp @@ -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 diff --git a/trunk/src/drivers/win/args.cpp b/trunk/src/drivers/win/args.cpp index 28b494df..2c43e0bc 100644 --- a/trunk/src/drivers/win/args.cpp +++ b/trunk/src/drivers/win/args.cpp @@ -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]); } diff --git a/trunk/src/drivers/win/main.cpp b/trunk/src/drivers/win/main.cpp index 8a6649c8..87b2f266 100644 --- a/trunk/src/drivers/win/main.cpp +++ b/trunk/src/drivers/win/main.cpp @@ -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) { diff --git a/trunk/src/drivers/win/window.cpp b/trunk/src/drivers/win/window.cpp index 05ec8aff..08c19479 100644 --- a/trunk/src/drivers/win/window.cpp +++ b/trunk/src/drivers/win/window.cpp @@ -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); diff --git a/trunk/src/fceu.cpp b/trunk/src/fceu.cpp index 8a570995..c5f7755f 100644 --- a/trunk/src/fceu.cpp +++ b/trunk/src/fceu.cpp @@ -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; }