From 8e9e59ea03e79471e1dfd42c9e7edb0826cedd67 Mon Sep 17 00:00:00 2001 From: skidau Date: Sun, 10 May 2015 06:46:29 +0000 Subject: [PATCH] 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 --- src/wx/cmdevents.cpp | 5 ++--- src/wx/opts.cpp | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wx/cmdevents.cpp b/src/wx/cmdevents.cpp index a2ce8506..a2fc7a3d 100644 --- a/src/wx/cmdevents.cpp +++ b/src/wx/cmdevents.cpp @@ -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; } diff --git a/src/wx/opts.cpp b/src/wx/opts.cpp index ca2e43b1..e0dd07e1 100644 --- a/src/wx/opts.cpp +++ b/src/wx/opts.cpp @@ -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