- add SPU synchronization mode and method to command line;

This commit is contained in:
mtabachenko 2013-11-16 15:04:32 +00:00
parent c6d959ea53
commit ebfe8a312c
5 changed files with 43 additions and 22 deletions

View File

@ -522,6 +522,8 @@ extern struct TCommonSettings {
, ConsoleType(NDS_CONSOLE_TYPE_FAT) , ConsoleType(NDS_CONSOLE_TYPE_FAT)
, StylusJitter(false) , StylusJitter(false)
, backupSave(false) , backupSave(false)
, SPU_sync_mode(0)
, SPU_sync_method(0)
{ {
strcpy(ARM9BIOS, "biosnds9.bin"); strcpy(ARM9BIOS, "biosnds9.bin");
strcpy(ARM7BIOS, "biosnds7.bin"); strcpy(ARM7BIOS, "biosnds7.bin");
@ -614,6 +616,9 @@ extern struct TCommonSettings {
int manualBackupType; int manualBackupType;
bool backupSave; bool backupSave;
int SPU_sync_mode;
int SPU_sync_method;
bool spu_muteChannels[16]; bool spu_muteChannels[16];
bool spu_captureMuted; bool spu_captureMuted;
bool spu_advanced; bool spu_advanced;

View File

@ -217,6 +217,8 @@ int SPU_Init(int coreid, int buffersize)
} }
} }
SPU_SetSynchMode(CommonSettings.SPU_sync_mode, CommonSettings.SPU_sync_method);
return SPU_ChangeSoundCore(coreid, buffersize); return SPU_ChangeSoundCore(coreid, buffersize);
} }

View File

@ -44,6 +44,8 @@ CommandLine::CommandLine()
, _bios_arm9(NULL) , _bios_arm9(NULL)
, _bios_arm7(NULL) , _bios_arm7(NULL)
, _bios_swi(0) , _bios_swi(0)
, _spu_sync_mode(-1)
, _spu_sync_method(-1)
, _spu_advanced(0) , _spu_advanced(0)
, _num_cores(-1) , _num_cores(-1)
, _rigorous_timing(0) , _rigorous_timing(0)
@ -93,6 +95,8 @@ void CommandLine::loadCommonOptions()
{ "bios-arm9", 0, 0, G_OPTION_ARG_FILENAME, &_bios_arm9, "Uses the arm9 bios provided at the specified path", "BIOS_ARM9_PATH"}, { "bios-arm9", 0, 0, G_OPTION_ARG_FILENAME, &_bios_arm9, "Uses the arm9 bios provided at the specified path", "BIOS_ARM9_PATH"},
{ "bios-arm7", 0, 0, G_OPTION_ARG_FILENAME, &_bios_arm7, "Uses the arm7 bios provided at the specified path", "BIOS_ARM7_PATH"}, { "bios-arm7", 0, 0, G_OPTION_ARG_FILENAME, &_bios_arm7, "Uses the arm7 bios provided at the specified path", "BIOS_ARM7_PATH"},
{ "bios-swi", 0, 0, G_OPTION_ARG_INT, &_bios_swi, "Uses SWI from the provided bios files", "BIOS_SWI"}, { "bios-swi", 0, 0, G_OPTION_ARG_INT, &_bios_swi, "Uses SWI from the provided bios files", "BIOS_SWI"},
{ "spu-mode", 0, 0, G_OPTION_ARG_INT, &_spu_sync_mode, "Select SPU Synchronization Mode. 0 - Dual SPU Synch/Asynch (traditional), 1 - Synchronous (sometimes needed for streams) (default 0)", "SPU_MODE"},
{ "spu-method", 0, 0, G_OPTION_ARG_INT, &_spu_sync_method, "Select SPU Synchronizer Method. 0 - N, 1 - Z, 2 - P (default 0)", "SPU_SYNC_METHOD"},
{ "spu-advanced", 0, 0, G_OPTION_ARG_INT, &_spu_advanced, "Uses advanced SPU capture functions", "SPU_ADVANCED"}, { "spu-advanced", 0, 0, G_OPTION_ARG_INT, &_spu_advanced, "Uses advanced SPU capture functions", "SPU_ADVANCED"},
{ "num-cores", 0, 0, G_OPTION_ARG_INT, &_num_cores, "Override numcores detection and use this many", "NUM_CORES"}, { "num-cores", 0, 0, G_OPTION_ARG_INT, &_num_cores, "Override numcores detection and use this many", "NUM_CORES"},
{ "scanline-filter-a", 0, 0, G_OPTION_ARG_INT, &_scanline_filter_a, "Intensity of fadeout for scanlines filter (topleft) (default 0)", "SCANLINE_FILTER_A"}, { "scanline-filter-a", 0, 0, G_OPTION_ARG_INT, &_scanline_filter_a, "Intensity of fadeout for scanlines filter (topleft) (default 0)", "SCANLINE_FILTER_A"},
@ -192,6 +196,8 @@ bool CommandLine::parse(int argc,char **argv)
if(_bios_arm9) { CommonSettings.UseExtBIOS = true; strcpy(CommonSettings.ARM9BIOS,_bios_arm9); } if(_bios_arm9) { CommonSettings.UseExtBIOS = true; strcpy(CommonSettings.ARM9BIOS,_bios_arm9); }
if(_bios_arm7) { CommonSettings.UseExtBIOS = true; strcpy(CommonSettings.ARM7BIOS,_bios_arm7); } if(_bios_arm7) { CommonSettings.UseExtBIOS = true; strcpy(CommonSettings.ARM7BIOS,_bios_arm7); }
if(_bios_swi) CommonSettings.SWIFromBIOS = true; if(_bios_swi) CommonSettings.SWIFromBIOS = true;
if(_spu_sync_mode != -1) CommonSettings.SPU_sync_mode = _spu_sync_mode;
if(_spu_sync_method != -1) CommonSettings.SPU_sync_method = _spu_sync_method;
if(_spu_advanced) CommonSettings.spu_advanced = true; if(_spu_advanced) CommonSettings.spu_advanced = true;
if (argc == 2) if (argc == 2)
@ -219,6 +225,16 @@ bool CommandLine::validate()
return false; return false;
} }
if (_spu_sync_mode < -1 || _spu_sync_mode > 1) {
g_printerr("Invalid parameter\n");
return false;
}
if (_spu_sync_method < -1 || _spu_sync_method > 2) {
g_printerr("Invalid parameter\n");
return false;
}
if (load_slot < -1 || load_slot > 10) { if (load_slot < -1 || load_slot > 10) {
g_printerr("I only know how to load from slots 0-10; -1 means 'do not load savegame' and is default\n"); g_printerr("I only know how to load from slots 0-10; -1 means 'do not load savegame' and is default\n");
return false; return false;

View File

@ -79,6 +79,8 @@ public:
GError *error; GError *error;
GOptionContext *ctx; GOptionContext *ctx;
int _spu_sync_mode;
int _spu_sync_method;
private: private:
char* _play_movie_file; char* _play_movie_file;
char* _record_movie_file; char* _record_movie_file;

View File

@ -482,8 +482,6 @@ extern bool userTouchesScreen;
static int sndcoretype=SNDCORE_DIRECTX; static int sndcoretype=SNDCORE_DIRECTX;
static int sndbuffersize=DESMUME_SAMPLE_RATE*8/60; static int sndbuffersize=DESMUME_SAMPLE_RATE*8/60;
static int snd_synchmode=0;
static int snd_synchmethod=0;
int sndvolume=100; int sndvolume=100;
SoundInterface_struct *SNDCoreList[] = { SoundInterface_struct *SNDCoreList[] = {
@ -3352,13 +3350,11 @@ int _main()
sndvolume = GetPrivateProfileInt("Sound","Volume",100, IniName); sndvolume = GetPrivateProfileInt("Sound","Volume",100, IniName);
SPU_SetVolume(sndvolume); SPU_SetVolume(sndvolume);
snd_synchmode = GetPrivateProfileInt("Sound","SynchMode",0,IniName); if (cmdline._spu_sync_mode == -1)
snd_synchmethod = GetPrivateProfileInt("Sound","SynchMethod",0,IniName); CommonSettings.SPU_sync_mode = GetPrivateProfileInt("Sound","SynchMode",0,IniName);
{ if (cmdline._spu_sync_method == -1)
Lock lock; CommonSettings.SPU_sync_method = GetPrivateProfileInt("Sound","SynchMethod",0,IniName);
SPU_SetSynchMode(snd_synchmode,snd_synchmethod);
}
CommonSettings.DebugConsole = GetPrivateProfileBool("Emulation", "DebugConsole", false, IniName); CommonSettings.DebugConsole = GetPrivateProfileBool("Emulation", "DebugConsole", false, IniName);
CommonSettings.EnsataEmulation = GetPrivateProfileBool("Emulation", "EnsataEmulation", false, IniName); CommonSettings.EnsataEmulation = GetPrivateProfileBool("Emulation", "EnsataEmulation", false, IniName);
CommonSettings.UseExtBIOS = GetPrivateProfileBool("BIOS", "UseExtBIOS", false, IniName); CommonSettings.UseExtBIOS = GetPrivateProfileBool("BIOS", "UseExtBIOS", false, IniName);
@ -6818,14 +6814,14 @@ static LRESULT CALLBACK SoundSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam
} }
//update the synch mode //update the synch mode
CheckDlgItem(hDlg,IDC_SYNCHMODE_DUAL,snd_synchmode==0); CheckDlgItem(hDlg,IDC_SYNCHMODE_DUAL, CommonSettings.SPU_sync_mode==0);
CheckDlgItem(hDlg,IDC_SYNCHMODE_SYNCH,snd_synchmode==1); CheckDlgItem(hDlg,IDC_SYNCHMODE_SYNCH,CommonSettings.SPU_sync_mode==1);
SoundSettings_updateSynchMode(hDlg); SoundSettings_updateSynchMode(hDlg);
//update the synch method //update the synch method
CheckDlgItem(hDlg,IDC_SYNCHMETHOD_N,snd_synchmethod==0); CheckDlgItem(hDlg,IDC_SYNCHMETHOD_N, CommonSettings.SPU_sync_method==0);
CheckDlgItem(hDlg,IDC_SYNCHMETHOD_Z,snd_synchmethod==1); CheckDlgItem(hDlg,IDC_SYNCHMETHOD_Z, CommonSettings.SPU_sync_method==1);
CheckDlgItem(hDlg,IDC_SYNCHMETHOD_P,snd_synchmethod==2); CheckDlgItem(hDlg,IDC_SYNCHMETHOD_P, CommonSettings.SPU_sync_method==2);
//setup interpolation combobox //setup interpolation combobox
SendDlgItemMessage(hDlg, IDC_SPU_INTERPOLATION_CB, CB_RESETCONTENT, 0, 0); SendDlgItemMessage(hDlg, IDC_SPU_INTERPOLATION_CB, CB_RESETCONTENT, 0, 0);
@ -6905,19 +6901,19 @@ static LRESULT CALLBACK SoundSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam
SPU_SetVolume(sndvolume); SPU_SetVolume(sndvolume);
//save the synch mode //save the synch mode
if(IsDlgCheckboxChecked(hDlg,IDC_SYNCHMODE_DUAL)) snd_synchmode = 0; if(IsDlgCheckboxChecked(hDlg,IDC_SYNCHMODE_DUAL)) CommonSettings.SPU_sync_mode = 0;
if(IsDlgCheckboxChecked(hDlg,IDC_SYNCHMODE_SYNCH)) snd_synchmode = 1; if(IsDlgCheckboxChecked(hDlg,IDC_SYNCHMODE_SYNCH)) CommonSettings.SPU_sync_mode = 1;
WritePrivateProfileInt("Sound", "SynchMode", snd_synchmode, IniName); WritePrivateProfileInt("Sound", "SynchMode", CommonSettings.SPU_sync_mode, IniName);
//save the synch method //save the synch method
if(IsDlgCheckboxChecked(hDlg,IDC_SYNCHMETHOD_N)) snd_synchmethod = 0; if(IsDlgCheckboxChecked(hDlg,IDC_SYNCHMETHOD_N)) CommonSettings.SPU_sync_method = 0;
if(IsDlgCheckboxChecked(hDlg,IDC_SYNCHMETHOD_Z)) snd_synchmethod = 1; if(IsDlgCheckboxChecked(hDlg,IDC_SYNCHMETHOD_Z)) CommonSettings.SPU_sync_method = 1;
if(IsDlgCheckboxChecked(hDlg,IDC_SYNCHMETHOD_P)) snd_synchmethod = 2; if(IsDlgCheckboxChecked(hDlg,IDC_SYNCHMETHOD_P)) CommonSettings.SPU_sync_method = 2;
WritePrivateProfileInt("Sound", "SynchMethod", snd_synchmethod, IniName); WritePrivateProfileInt("Sound", "SynchMethod", CommonSettings.SPU_sync_method, IniName);
{ {
Lock lock; Lock lock;
SPU_SetSynchMode(snd_synchmode, snd_synchmethod); SPU_SetSynchMode(CommonSettings.SPU_sync_mode, CommonSettings.SPU_sync_method);
} }
//write interpolation type //write interpolation type