From cf3758ff3f62c3749728ff57fb36716f25721e56 Mon Sep 17 00:00:00 2001 From: rogerman Date: Sat, 10 Dec 2016 13:39:29 -0800 Subject: [PATCH] Command Line: Allow --disable-sound and --disable-limiter options on Windows. These two options are, in fact, supported on Windows, so make them universally available. --- desmume/src/commandline.cpp | 14 ++++++-------- desmume/src/commandline.h | 2 -- desmume/src/frontend/windows/main.cpp | 15 ++++++++------- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/desmume/src/commandline.cpp b/desmume/src/commandline.cpp index 9b1fbdda5..0318dcf91 100644 --- a/desmume/src/commandline.cpp +++ b/desmume/src/commandline.cpp @@ -72,11 +72,9 @@ CommandLine::CommandLine() , texture_upscale(-1) , gpu_resolution_multiplier(-1) , language(1) //english by default +, disable_sound(0) +, disable_limiter(0) { -#ifndef HOST_WINDOWS - disable_sound = 0; - disable_limiter = 0; -#endif } CommandLine::~CommandLine() @@ -114,10 +112,10 @@ static const char* help_string = \ " multipler; 1:256x192 (default), 2:512x384," ENDL " 3:768x576, 4:1024x768, 5:1280x960" ENDL #else -" --disable-sound Disables the sound output" ENDL -" --disable-limiter Disables the 60fps limiter" ENDL " --nojoy Disables joystick support" ENDL #endif +" --disable-sound Disables the sound output" ENDL +" --disable-limiter Disables the 60fps limiter" ENDL ENDL "Arguments affecting overall emulation parameters (`sync settings`): " ENDL #ifdef HAVE_JIT @@ -234,10 +232,10 @@ bool CommandLine::parse(int argc,char **argv) #ifdef HOST_WINDOWS { "gpu-resolution-multiplier", required_argument, NULL, OPT_GPU_RESOLUTION_MULTIPLIER }, #else - { "disable-sound", no_argument, &disable_sound, 1}, - { "disable-limiter", no_argument, &disable_limiter, 1}, { "nojoy", no_argument, &_commandline_linux_nojoy, 1}, #endif + { "disable-sound", no_argument, &disable_sound, 1}, + { "disable-limiter", no_argument, &disable_limiter, 1}, //sync settings #ifdef HAVE_JIT diff --git a/desmume/src/commandline.h b/desmume/src/commandline.h index e7cf38237..8a9d90de0 100644 --- a/desmume/src/commandline.h +++ b/desmume/src/commandline.h @@ -62,10 +62,8 @@ public: std::string console_type; std::string slot1_fat_dir; bool _slot1_fat_dir_type; -#ifndef HOST_WINDOWS int disable_sound; int disable_limiter; -#endif bool parse(int argc,char **argv); diff --git a/desmume/src/frontend/windows/main.cpp b/desmume/src/frontend/windows/main.cpp index 9ea01baab..6865d3706 100644 --- a/desmume/src/frontend/windows/main.cpp +++ b/desmume/src/frontend/windows/main.cpp @@ -2958,7 +2958,6 @@ int _main() video.screengap = GetPrivateProfileInt("Display", "ScreenGap", 0, IniName); SeparationBorderDrag = GetPrivateProfileBool("Display", "Window Split Border Drag", true, IniName); ScreenGapColor = GetPrivateProfileInt("Display", "ScreenGapColor", 0xFFFFFF, IniName); - FrameLimit = GetPrivateProfileBool("FrameLimit", "FrameLimit", true, IniName); CommonSettings.showGpu.main = GetPrivateProfileInt("Display", "MainGpu", 1, IniName) != 0; CommonSettings.showGpu.sub = GetPrivateProfileInt("Display", "SubGpu", 1, IniName) != 0; CommonSettings.spu_advanced = GetPrivateProfileBool("Sound", "SpuAdvanced", false, IniName); @@ -3015,6 +3014,8 @@ int _main() cmdline.validate(); start_paused = cmdline.start_paused!=0; + FrameLimit = (cmdline.disable_limiter == 1) ? false : GetPrivateProfileBool("FrameLimit", "FrameLimit", true, IniName); + // Temporary scanline parameter setting for Windows. // TODO: When videofilter.cpp becomes Windows-friendly, replace the direct setting of // variables with SetFilterParameteri() . @@ -3316,10 +3317,15 @@ int _main() EnableMenuItem (mainMenu, IDM_SUBMITBUGREPORT, MF_GRAYED); #endif LOG("Init sound core\n"); - sndcoretype = GetPrivateProfileInt("Sound","SoundCore2", SNDCORE_DIRECTX, IniName); + sndcoretype = (cmdline.disable_sound == 1) ? SNDCORE_DUMMY : GetPrivateProfileInt("Sound","SoundCore2", SNDCORE_DIRECTX, IniName); sndbuffersize = GetPrivateProfileInt("Sound","SoundBufferSize2", DESMUME_SAMPLE_RATE*8/60, IniName); CommonSettings.spuInterpolationMode = (SPUInterpolationMode)GetPrivateProfileInt("Sound","SPUInterpolation", 1, IniName); + if (cmdline._spu_sync_mode == -1) + CommonSettings.SPU_sync_mode = GetPrivateProfileInt("Sound","SynchMode",0,IniName); + if (cmdline._spu_sync_method == -1) + CommonSettings.SPU_sync_method = GetPrivateProfileInt("Sound","SynchMethod",0,IniName); + EnterCriticalSection(&win_execute_sync); int spu_ret = SPU_ChangeSoundCore(sndcoretype, sndbuffersize); LeaveCriticalSection(&win_execute_sync); @@ -3331,11 +3337,6 @@ int _main() sndvolume = GetPrivateProfileInt("Sound","Volume",100, IniName); SPU_SetVolume(sndvolume); - - if (cmdline._spu_sync_mode == -1) - CommonSettings.SPU_sync_mode = GetPrivateProfileInt("Sound","SynchMode",0,IniName); - if (cmdline._spu_sync_method == -1) - CommonSettings.SPU_sync_method = GetPrivateProfileInt("Sound","SynchMethod",0,IniName); CommonSettings.DebugConsole = GetPrivateProfileBool("Emulation", "DebugConsole", false, IniName); CommonSettings.EnsataEmulation = GetPrivateProfileBool("Emulation", "EnsataEmulation", false, IniName);