Sorted the array of opts so that none of the options get invalidated by the option loader. Fixes the audio volume option which was not getting loaded from the ini.

git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@1415 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
skidau 2015-05-10 06:46:29 +00:00
parent f96937ad12
commit 8e9e59ea03
2 changed files with 4 additions and 4 deletions

View File

@ -2086,8 +2086,6 @@ EVT_HANDLER_MASK(SoundConfigure, "Sound options...", CMDEN_NREC_ANY)
if(ShowModal(dlg) != wxID_OK)
return;
switch(panel->game_type()) {
case IMAGE_UNKNOWN:
return;
case IMAGE_GB:
gb_effects_config.echo = (float)gopts.gb_echo / 100.0;
gb_effects_config.stereo = (float)gopts.gb_stereo / 100.0;
@ -2097,7 +2095,8 @@ EVT_HANDLER_MASK(SoundConfigure, "Sound options...", CMDEN_NREC_ANY)
44100 / (1 << (gopts.sound_qual - 1)));
break;
case IMAGE_GBA:
soundSetSampleRate(!gopts.sound_qual ? 48000 :
case IMAGE_UNKNOWN:
soundSetSampleRate(!gopts.sound_qual ? 48000 :
44100 / (1 << (gopts.sound_qual - 1)));
break;
}

View File

@ -248,7 +248,7 @@ opt_desc opts[] = {
INTOPT ("Sound/GBStereo", "", wxTRANSLATE("GB stereo effect (%)"), gopts.gb_stereo, 0, 100),
BOOLOPT("Sound/GBSurround", "GBSurround", wxTRANSLATE("GB surround sound effect (%)"), gopts.gb_effects_config_surround),
ENUMOPT("Sound/Quality", "", wxTRANSLATE("Sound sample rate (kHz)"), gopts.sound_qual, wxTRANSLATE("48|44|22|11")),
INTOPT ("Sound/Volume", "", wxTRANSLATE("Sound volume (%)"), gopts.sound_vol, 0, 200)
INTOPT ("Sound/Volume", "", wxTRANSLATE("Sound volume (%)"), gopts.sound_vol, 0, 400)
};
const int num_opts = sizeof(opts)/sizeof(opts[0]);
@ -340,6 +340,7 @@ void load_opts()
int poff = s.size();
long entry_idx;
wxString e;
std::sort(&opts[0], &opts[num_opts], opt_lt);
for(cont = cfg->GetFirstGroup(e, entry_idx); cont;
cont = cfg->GetNextGroup(e, entry_idx)) {
// the only one with subgroups