Moved the core parameters from the wx gui to ConfigManager

git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@1363 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
skidau 2015-04-27 08:32:03 +00:00
parent 0689069f71
commit 21ce6616ba
16 changed files with 193 additions and 198 deletions

View File

@ -241,7 +241,7 @@ int* rewindSerials = NULL;
u32 autoFrameSkipLastTime; u32 autoFrameSkipLastTime;
u32 movieLastJoypad; u32 movieLastJoypad;
u32 movieNextJoypad; u32 movieNextJoypad;
unsigned short throttle; int throttle;
const char* preparedCheatCodes[MAX_CHEATS]; const char* preparedCheatCodes[MAX_CHEATS];

View File

@ -136,7 +136,7 @@ extern int winPauseNextFrame;
extern u32 autoFrameSkipLastTime; extern u32 autoFrameSkipLastTime;
extern u32 movieLastJoypad; extern u32 movieLastJoypad;
extern u32 movieNextJoypad; extern u32 movieNextJoypad;
extern unsigned short throttle; extern int throttle;
#define MAX_CHEATS 100 #define MAX_CHEATS 100
extern int preparedCheats; extern int preparedCheats;

View File

@ -107,7 +107,7 @@ EVT_HANDLER(RecentReset, "Reset recent ROM list")
if(gopts.recent->GetCount()) { if(gopts.recent->GetCount()) {
while(gopts.recent->GetCount()) while(gopts.recent->GetCount())
gopts.recent->RemoveFileFromHistory(0); gopts.recent->RemoveFileFromHistory(0);
wxConfig *cfg = wxGetApp().cfg; wxFileConfig *cfg = wxGetApp().cfg;
cfg->SetPath(wxT("/Recent")); cfg->SetPath(wxT("/Recent"));
gopts.recent->Save(*cfg); gopts.recent->Save(*cfg);
cfg->SetPath(wxT("/")); cfg->SetPath(wxT("/"));
@ -863,13 +863,13 @@ EVT_HANDLER_MASK(ScreenCapture, "Screen capture...", CMDEN_GB|CMDEN_GBA)
} }
} }
wxString def_name = panel->game_name(); wxString def_name = panel->game_name();
if(gopts.cap_format == 0) if(captureFormat == 0)
def_name.append(wxT(".png")); def_name.append(wxT(".png"));
else else
def_name.append(wxT(".bmp")); def_name.append(wxT(".bmp"));
wxFileDialog dlg(this, _("Select output file"), scap_path, def_name, wxFileDialog dlg(this, _("Select output file"), scap_path, def_name,
_("PNG images|*.png|BMP images|*.bmp"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT); _("PNG images|*.png|BMP images|*.bmp"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
dlg.SetFilterIndex(gopts.cap_format); dlg.SetFilterIndex(captureFormat);
int ret = ShowModal(&dlg); int ret = ShowModal(&dlg);
scap_path = dlg.GetDirectory(); scap_path = dlg.GetDirectory();
if(ret != wxID_OK) if(ret != wxID_OK)
@ -1119,7 +1119,7 @@ EVT_HANDLER(Pause, "Pause (toggle)")
else if(!IsPaused()) else if(!IsPaused())
panel->Resume(); panel->Resume();
// undo next-frame's zeroing of frameskip // undo next-frame's zeroing of frameskip
int fs = panel->game_type() == IMAGE_GB ? gopts.gb_frameskip : gopts.gba_frameskip; int fs = panel->game_type() == IMAGE_GB ? gbFrameSkip : frameSkip;
if(fs > 0) if(fs > 0)
systemFrameSkip = fs; systemFrameSkip = fs;
} }
@ -1751,7 +1751,7 @@ EVT_HANDLER(GeneralConfigure, "General options...")
if(ShowModal(dlg) == wxID_OK) if(ShowModal(dlg) == wxID_OK)
update_opts(); update_opts();
if(panel->game_type() != IMAGE_UNKNOWN) if(panel->game_type() != IMAGE_UNKNOWN)
soundSetThrottle(gopts.throttle); soundSetThrottle(throttle);
if(rew != gopts.rewind_interval) { if(rew != gopts.rewind_interval) {
if(!gopts.rewind_interval) { if(!gopts.rewind_interval) {
if(panel->num_rewind_states) { if(panel->num_rewind_states) {
@ -1796,7 +1796,7 @@ EVT_HANDLER(GameBoyConfigure, "Game Boy options...")
} }
// this value might have been overwritten by FrameSkip // this value might have been overwritten by FrameSkip
if(XRCCTRL(*dlg, "FrameSkipAuto", wxCheckBox)->GetValue()) if(XRCCTRL(*dlg, "FrameSkipAuto", wxCheckBox)->GetValue())
gopts.gb_frameskip = -1; gbFrameSkip = -1;
update_opts(); update_opts();
if(panel->game_type() == IMAGE_GB) { if(panel->game_type() == IMAGE_GB) {
if(borderon != gbBorderOn) { if(borderon != gbBorderOn) {
@ -1807,8 +1807,8 @@ EVT_HANDLER(GameBoyConfigure, "Game Boy options...")
panel->DelBorder(); panel->DelBorder();
} }
// autoskip will self-adjust // autoskip will self-adjust
if(gopts.gb_frameskip >= 0) if(gbFrameSkip >= 0)
systemFrameSkip = gopts.gb_frameskip; systemFrameSkip = gbFrameSkip;
// don't want to have to reset to change colors // don't want to have to reset to change colors
memcpy(gbPalette, &systemGbPalette[gbPaletteOption * 8], 8 * sizeof(systemGbPalette[0])); memcpy(gbPalette, &systemGbPalette[gbPaletteOption * 8], 8 * sizeof(systemGbPalette[0]));
} }
@ -1862,13 +1862,13 @@ EVT_HANDLER(GameBoyAdvanceConfigure, "Game Boy Advance options...")
return; return;
// this value might have been overwritten by FrameSkip // this value might have been overwritten by FrameSkip
if(XRCCTRL(*dlg, "FrameSkipAuto", wxCheckBox)->GetValue()) if(XRCCTRL(*dlg, "FrameSkipAuto", wxCheckBox)->GetValue())
gopts.gba_frameskip = -1; frameSkip = -1;
update_opts(); update_opts();
if(panel->game_type() == IMAGE_GBA) { if(panel->game_type() == IMAGE_GBA) {
// autoskip will self-adjust // autoskip will self-adjust
if(gopts.gba_frameskip >= 0) if(frameSkip >= 0)
systemFrameSkip = gopts.gba_frameskip; systemFrameSkip = frameSkip;
agbPrintEnable(gopts.agbprint); agbPrintEnable(agbPrint);
#if 0 // disabled in win32 version for undocumented "problems" #if 0 // disabled in win32 version for undocumented "problems"
if(gopts.skip_intro) if(gopts.skip_intro)
*((u32 *)rom) = 0xea00002e; *((u32 *)rom) = 0xea00002e;
@ -1971,7 +1971,7 @@ EVT_HANDLER(GameBoyAdvanceConfigure, "Game Boy Advance options...")
EVT_HANDLER_MASK(DisplayConfigure, "Display options...", CMDEN_NREC_ANY) EVT_HANDLER_MASK(DisplayConfigure, "Display options...", CMDEN_NREC_ANY)
{ {
bool fs = gopts.fullscreen; bool fs = fullScreen;
wxVideoMode dm = gopts.fs_mode; wxVideoMode dm = gopts.fs_mode;
if(gopts.max_threads != 1) if(gopts.max_threads != 1)
@ -1987,9 +1987,9 @@ EVT_HANDLER_MASK(DisplayConfigure, "Display options...", CMDEN_NREC_ANY)
return; return;
update_opts(); update_opts();
if(fs != gopts.fullscreen) if(fs != fullScreen)
{ {
panel->ShowFullScreen(gopts.fullscreen); panel->ShowFullScreen(fullScreen);
} }
else if(panel->IsFullScreen() && dm != gopts.fs_mode) else if(panel->IsFullScreen() && dm != gopts.fs_mode)
{ {

View File

@ -239,7 +239,7 @@ void DirectSound::write(u16 * finalWave, int length)
LPVOID lpvPtr2; LPVOID lpvPtr2;
DWORD dwBytes2 = 0; DWORD dwBytes2 = 0;
if (!speedup && synchronize && !gopts.throttle && !gba_joybus_active) { if (!speedup && synchronize && !throttle && !gba_joybus_active) {
hr = dsbSecondary->GetStatus(&status); hr = dsbSecondary->GetStatus(&status);
if( status & DSBSTATUS_PLAYING ) { if( status & DSBSTATUS_PLAYING ) {
if( !soundPaused ) { if( !soundPaused ) {

View File

@ -1373,7 +1373,7 @@ public:
void JoypadConfigButtons(wxCommandEvent &ev) { void JoypadConfigButtons(wxCommandEvent &ev) {
bool clear = ev.GetId() == XRCID("Clear"); bool clear = ev.GetId() == XRCID("Clear");
for(int i = 0; i < NUM_KEYS; i++) { for(int i = 0; i < NUM_KEYS; i++) {
wxJoyKeyTextCtrl *tc = XRCCTRL_D(*p, joynames[i], wxJoyKeyTextCtrl); wxJoyKeyTextCtrl *tc = XRCCTRL_D(*p, wxString::FromUTF8(joynames[i]), wxJoyKeyTextCtrl);
if(clear) if(clear)
tc->SetValue(wxEmptyString); tc->SetValue(wxEmptyString);
else { else {
@ -1957,7 +1957,7 @@ public:
void Init(wxShowEvent &ev) void Init(wxShowEvent &ev)
{ {
ev.Skip(); ev.Skip();
DoSetThrottleSel(gopts.throttle); DoSetThrottleSel(throttle);
} }
} throttle_ctrl; } throttle_ctrl;
@ -1987,8 +1987,8 @@ wxDialog * MainFrame::LoadXRCDialog(const char * name)
#if (wxMAJOR_VERSION < 3) #if (wxMAJOR_VERSION < 3)
if(!dialog->GetParent()) if(!dialog->GetParent())
dialog->Reparent(this); dialog->Reparent(this);
mark_recursive(dialog);
#endif #endif
mark_recursive(dialog);
return dialog; return dialog;
} }
@ -2006,8 +2006,8 @@ wxPropertySheetDialog * MainFrame::LoadXRCropertySheetDialog(const char * name)
#if (wxMAJOR_VERSION < 3) #if (wxMAJOR_VERSION < 3)
if(!dialog->GetParent()) if(!dialog->GetParent())
dialog->Reparent(this); dialog->Reparent(this);
mark_recursive(dialog);
#endif #endif
mark_recursive(dialog);
return dialog; return dialog;
} }
@ -2627,18 +2627,23 @@ bool MainFrame::InitMore(void)
cb=SafeXRCCTRL<wxCheckBox>(d, n); \ cb=SafeXRCCTRL<wxCheckBox>(d, n); \
cb->SetValidator(wxGenericValidator(&o)); \ cb->SetValidator(wxGenericValidator(&o)); \
} while(0) } while(0)
#define getcbi(n, o) do { \
cb=SafeXRCCTRL<wxCheckBox>(d, n); \
cb->SetValidator(wxBoolIntValidator(&o, 1)); \
} while(0)
wxSpinCtrl *sc; wxSpinCtrl *sc;
#define getsc(n, o) do { \ #define getsc(n, o) do { \
sc=SafeXRCCTRL<wxSpinCtrl>(d, n); \ sc=SafeXRCCTRL<wxSpinCtrl>(d, n); \
sc->SetValidator(wxGenericValidator(&o)); \ sc->SetValidator(wxGenericValidator(&o)); \
} while(0) } while(0)
{ {
getcbb("PauseWhenInactive", gopts.defocus_pause); getcbi("PauseWhenInactive", pauseWhenInactive);
getcbb("ApplyPatches", gopts.apply_patches); getcbi("ApplyPatches", autoPatch);
getrbi("PNG", gopts.cap_format, 0); getrbi("PNG", captureFormat, 0);
getrbi("BMP", gopts.cap_format, 1); getrbi("BMP", captureFormat, 1);
getsc("RewindInterval", gopts.rewind_interval); getsc("RewindInterval", gopts.rewind_interval);
getsc("Throttle", gopts.throttle); getsc("Throttle", throttle);
throttle_ctrl.thr = sc; throttle_ctrl.thr = sc;
throttle_ctrl.thrsel=SafeXRCCTRL<wxChoice>(d, "ThrottleSel"); throttle_ctrl.thrsel=SafeXRCCTRL<wxChoice>(d, "ThrottleSel");
throttle_ctrl.thr-> throttle_ctrl.thr->
@ -2696,24 +2701,24 @@ bool MainFrame::InitMore(void)
/// Speed /// Speed
// AutoSkip/FrameSkip are 2 controls for 1 value. Needs post-process // AutoSkip/FrameSkip are 2 controls for 1 value. Needs post-process
// to ensure checkbox not ignored // to ensure checkbox not ignored
getcbie("FrameSkipAuto", gopts.gb_frameskip, -1); getcbie("FrameSkipAuto", gbFrameSkip, -1);
getsc("FrameSkip", gopts.gb_frameskip); getsc("FrameSkip", gbFrameSkip);
addbier(sc, true); addbier(sc, true);
getlab("FrameSkipLab"); getlab("FrameSkipLab");
addbier(lab, true); addbier(lab, true);
/// Boot ROM /// Boot ROM
getcbbe("BootRomEn", gopts.gb_use_bios); getcbie("BootRomEn", useBiosFileGB, 1);
getfp("BootRom", gopts.gb_bios); getfp("BootRom", gopts.gb_bios);
addbe(fp); addbe(fp);
getlab("BootRomLab"); getlab("BootRomLab");
addbe(lab); addbe(lab);
getcbbe("CBootRomEn", gopts.gbc_use_bios); getcbie("CBootRomEn", useBiosFileGBC, 1);
getfp("CBootRom", gopts.gbc_bios); getfp("CBootRom", gopts.gbc_bios);
addbe(fp); addbe(fp);
getlab("CBootRomLab"); getlab("CBootRomLab");
addbe(lab); addbe(lab);
/// Custom Colors /// Custom Colors
getcbb("Color", gbColorOption); getcbi("Color", gbColorOption);
wxFarRadio *r = NULL; wxFarRadio *r = NULL;
for(int i = 0; i < 3; i++) { for(int i = 0; i < 3; i++) {
wxString pn; wxString pn;
@ -2758,9 +2763,9 @@ bool MainFrame::InitMore(void)
d=LoadXRCropertySheetDialog("GameBoyAdvanceConfig"); d=LoadXRCropertySheetDialog("GameBoyAdvanceConfig");
{ {
/// System and peripherals /// System and peripherals
ch=GetValidatedChild<wxChoice,wxGenericValidator>(d, "SaveType",wxGenericValidator(& gopts.save_type)); ch=GetValidatedChild<wxChoice,wxGenericValidator>(d, "SaveType",wxGenericValidator(& cpuSaveType));
BatConfigHandler.type = ch; BatConfigHandler.type = ch;
ch=GetValidatedChild<wxChoice,wxGenericValidator>(d, "FlashSize",wxGenericValidator(& gopts.flash_size)); ch=GetValidatedChild<wxChoice,wxGenericValidator>(d, "FlashSize",wxGenericValidator(& winFlashSize));
BatConfigHandler.size = ch; BatConfigHandler.size = ch;
d->Connect(XRCID("SaveType"), wxEVT_COMMAND_CHOICE_SELECTED, d->Connect(XRCID("SaveType"), wxEVT_COMMAND_CHOICE_SELECTED,
wxCommandEventHandler(BatConfig_t::ChangeType), wxCommandEventHandler(BatConfig_t::ChangeType),
@ -2774,28 +2779,24 @@ bool MainFrame::InitMore(void)
d->Connect(XRCID("Detect"), wxEVT_COMMAND_BUTTON_CLICKED, d->Connect(XRCID("Detect"), wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler(BatConfig_t::Detect), wxCommandEventHandler(BatConfig_t::Detect),
NULL, &BatConfigHandler); NULL, &BatConfigHandler);
getcbb("RTC", gopts.rtc); getcbi("RTC", rtcEnabled);
getcbb("AGBPrinter", gopts.agbprint); getcbi("AGBPrinter", agbPrint);
/// Speed /// Speed
// AutoSkip/FrameSkip are 2 controls for 1 value. Needs post-process // AutoSkip/FrameSkip are 2 controls for 1 value. Needs post-process
// to ensure checkbox not ignored // to ensure checkbox not ignored
getcbie("FrameSkipAuto", gopts.gba_frameskip, -1); getcbie("FrameSkipAuto", autoFrameSkip, -1);
getsc("FrameSkip", gopts.gba_frameskip); getsc("FrameSkip", frameSkip);
addbier(sc, true); addbier(sc, true);
getlab("FrameSkipLab"); getlab("FrameSkipLab");
addbier(lab, true); addbier(lab, true);
/// Boot ROM /// Boot ROM
getcbbe("BootRomEn", gopts.gba_use_bios); getcbie("BootRomEn", useBiosFileGBA, 1);
getfp("BootRom", gopts.gba_bios); getfp("BootRom", gopts.gba_bios);
addbe(fp); addbe(fp);
getlab("BootRomLab"); getlab("BootRomLab");
addbe(lab); addbe(lab);
getcbb("SkipIntro", gopts.skip_intro);
addbe(cb);
// doesn't work right now
cb->Hide();
/// Game Overrides /// Game Overrides
getgbaw("GameSettings"); getgbaw("GameSettings");
@ -2812,19 +2813,19 @@ bool MainFrame::InitMore(void)
{ {
/// On-Screen Display /// On-Screen Display
ch=GetValidatedChild<wxChoice,wxGenericValidator>(d, "SpeedIndicator",wxGenericValidator(& gopts.osd_speed)); ch=GetValidatedChild<wxChoice,wxGenericValidator>(d, "SpeedIndicator",wxGenericValidator(& gopts.osd_speed));
getcbb("NoStatusMsg", gopts.no_osd_status); getcbi("NoStatusMsg", disableStatusMessages);
getcbb("Transparent", gopts.osd_transparent); getcbi("Transparent", showSpeedTransparent);
/// Zoom /// Zoom
// this was a choice, but I'd rather not have to make an off-by-one // this was a choice, but I'd rather not have to make an off-by-one
// validator just for this, and spinctrl is good enough. // validator just for this, and spinctrl is good enough.
getsc("DefaultScale", gopts.video_scale); getsc("DefaultScale", gopts.video_scale);
getcbb("RetainAspect", gopts.retain_aspect); getcbb("RetainAspect", gopts.retain_aspect);
getsc("MaxScale", gopts.max_scale); getsc("MaxScale", maxScale);
// fs modes should be filled in at popup time // fs modes should be filled in at popup time
// since they may change based on what screen is current // since they may change based on what screen is current
SafeXRCCTRL<wxChoice>(d, "FullscreenMode"); SafeXRCCTRL<wxChoice>(d, "FullscreenMode");
getcbb("Fullscreen", gopts.fullscreen); getcbi("Fullscreen", fullScreen);
/// Advanced /// Advanced
getrbi("OutputSimple", gopts.render_method, RND_SIMPLE); getrbi("OutputSimple", gopts.render_method, RND_SIMPLE);
@ -2841,7 +2842,7 @@ bool MainFrame::InitMore(void)
rb->Hide(); rb->Hide();
#endif #endif
getcbb("Bilinear", gopts.bilinear); getcbb("Bilinear", gopts.bilinear);
getcbb("VSync", gopts.vsync); getcbi("VSync", vsync);
// FIXME: make cb disabled when not GL or d3d // FIXME: make cb disabled when not GL or d3d
int mthr = wxThread::GetCPUCount(); int mthr = wxThread::GetCPUCount();
if(mthr > 8) if(mthr > 8)
@ -2871,7 +2872,7 @@ bool MainFrame::InitMore(void)
d->Fit(); d->Fit();
} }
d=LoadXRCropertySheetDialog("SoundConfig"); d = LoadXRCropertySheetDialog("SoundConfig");
wxSlider *sl; wxSlider *sl;
#define getsl(n, o) do { \ #define getsl(n, o) do { \
sl=SafeXRCCTRL<wxSlider>(d, n); \ sl=SafeXRCCTRL<wxSlider>(d, n); \
@ -2918,7 +2919,7 @@ bool MainFrame::InitMore(void)
#ifndef __WXMSW__ #ifndef __WXMSW__
cb->Hide(); cb->Hide();
#endif #endif
getcbb("SyncGameAudio", synchronize); getcbi("SyncGameAudio", synchronize);
getsl("Buffers", gopts.audio_buffers); getsl("Buffers", gopts.audio_buffers);
sound_config_handler.bufs = sl; sound_config_handler.bufs = sl;
getlab("BuffersInfo"); getlab("BuffersInfo");
@ -2984,7 +2985,7 @@ bool MainFrame::InitMore(void)
cb->SetValidator(wxBoolIntValidator(&gopts.default_stick, i + 1)); cb->SetValidator(wxBoolIntValidator(&gopts.default_stick, i + 1));
wxWindow *prev = NULL, *prevp = NULL; wxWindow *prev = NULL, *prevp = NULL;
for(int j = 0; j < NUM_KEYS; j++) { for(int j = 0; j < NUM_KEYS; j++) {
wxJoyKeyTextCtrl *tc = XRCCTRL_D(*w, joynames[j], wxJoyKeyTextCtrl); wxJoyKeyTextCtrl *tc = XRCCTRL_D(*w, wxString::FromUTF8(joynames[j]), wxJoyKeyTextCtrl);
CheckThrowXRCError(tc,ToString(joynames[j])); CheckThrowXRCError(tc,ToString(joynames[j]));
wxWindow *p = tc->GetParent(); wxWindow *p = tc->GetParent();
if(p == prevp) if(p == prevp)
@ -3140,7 +3141,7 @@ bool MainFrame::InitMore(void)
#endif #endif
// delayed fullscreen // delayed fullscreen
if(wxGetApp().pending_fullscreen || gopts.fullscreen) if(wxGetApp().pending_fullscreen || fullScreen)
panel->ShowFullScreen(true); panel->ShowFullScreen(true);
#ifndef NO_LINK #ifndef NO_LINK

View File

@ -282,7 +282,7 @@ void OpenAL::write(u16 * finalWave, int length)
if( nBuffersProcessed == gopts.audio_buffers ) { if( nBuffersProcessed == gopts.audio_buffers ) {
// we only want to know about it when we are emulating at full speed or faster: // we only want to know about it when we are emulating at full speed or faster:
if( ( gopts.throttle >= 100 ) || ( gopts.throttle == 0 ) ) { if( ( throttle >= 100 ) || ( throttle == 0 ) ) {
if( systemVerbose & VERBOSE_SOUNDOUTPUT ) { if( systemVerbose & VERBOSE_SOUNDOUTPUT ) {
static unsigned int i = 0; static unsigned int i = 0;
log( "OpenAL: Buffers were not refilled fast enough (i=%i)\n", i++ ); log( "OpenAL: Buffers were not refilled fast enough (i=%i)\n", i++ );
@ -290,7 +290,7 @@ void OpenAL::write(u16 * finalWave, int length)
} }
} }
if (!speedup && synchronize && !gopts.throttle && !gba_joybus_active) { if (!speedup && synchronize && !throttle && !gba_joybus_active) {
// wait until at least one buffer has finished // wait until at least one buffer has finished
while( nBuffersProcessed == 0 ) { while( nBuffersProcessed == 0 ) {
winlog( " waiting...\n" ); winlog( " waiting...\n" );

View File

@ -1,6 +1,8 @@
#include "wxvbam.h" #include "wxvbam.h"
#include <algorithm> #include <algorithm>
#include <wx/display.h> #include <wx/display.h>
#include "../common/ConfigManager.h"
/* /*
* disableSfx(F) -> cpuDisableSfx * disableSfx(F) -> cpuDisableSfx
* priority(2) -> threadPriority * priority(2) -> threadPriority
@ -99,13 +101,13 @@ const int num_def_accels = sizeof(default_accels)/sizeof(default_accels[0]);
// Note: this must match GUI widget names or GUI won't work // Note: this must match GUI widget names or GUI won't work
// This table's order determines tab order as well // This table's order determines tab order as well
const wxChar * const joynames[NUM_KEYS] = { const char * const joynames[NUM_KEYS] = {
wxT("Up"), wxT("Down"), wxT("Left"), wxT("Right"), ("Up"), ("Down"), ("Left"), ("Right"),
wxT("A"), wxT("B"), wxT("L"), wxT("R"), ("A"), ("B"), ("L"), ("R"),
wxT("Select"), wxT("Start"), ("Select"), ("Start"),
wxT("MotionUp"), wxT("MotionDown"), wxT("MotionLeft"), wxT("MotionRight"), ("MotionUp"), ("MotionDown"), ("MotionLeft"), ("MotionRight"),
wxT("AutoA"), wxT("AutoB"), ("AutoA"), ("AutoB"),
wxT("Speed"), wxT("Capture"), wxT("GS") ("Speed"), ("Capture"), ("GS")
}; };
wxJoyKeyBinding defkeys[NUM_KEYS * 2] = { wxJoyKeyBinding defkeys[NUM_KEYS * 2] = {
@ -126,25 +128,61 @@ wxAcceleratorEntry_v sys_accels;
// Note: this table must be sorted in option name order // Note: this table must be sorted in option name order
// Both for better user display and for (fast) searching by name // Both for better user display and for (fast) searching by name
opt_desc opts[] = { opt_desc opts[] = {
// Core
#ifdef MMX
INTOPT("preferences/disableMMX", wxTRANSLATE("Enable MMX"), disableMMX, 0, 1),
#endif
INTOPT("preferences/disableStatus", wxTRANSLATE("Disable on-screen status messages"), disableStatusMessages, 0, 1),
INTOPT("preferences/fullScreen", wxTRANSLATE("Enter fullscreen mode at startup"), fullScreen, 0, 1),
INTOPT("preferences/maxScale", wxTRANSLATE("Maximum scale factor (0 = no limit)"), maxScale, 0, 100),
INTOPT("preferences/showSpeedTransparent", wxTRANSLATE("Draw on-screen messages transparently"), showSpeedTransparent, 0, 1),
INTOPT("preferences/vsync", wxTRANSLATE("Wait for vertical sync"), vsync, 0, 1),
INTOPT("preferences/agbPrint", wxTRANSLATE("Enable AGB printer"), agbPrint, 0, 1),
INTOPT("preferences/rtcEnabled", wxTRANSLATE("Enable RTC (vba-over.ini override is rtcEnabled"), rtcEnabled, 0, 1),
ENUMOPT("preferences/saveType", wxTRANSLATE("Native save (\"battery\") hardware type (vba-over.ini override is saveType integer 0-5)"), cpuSaveType, wxTRANSLATE("auto|eeprom|sram|flash|eeprom+sensor|none")),
INTOPT("preferences/useBiosGBA", wxTRANSLATE("Use the specified BIOS file"), useBiosFileGBA, 0, 1),
INTOPT("preferences/pauseWhenInactive", wxTRANSLATE("Pause game when main window loses focus"), pauseWhenInactive, 0, 1),
INTOPT("preferences/synchronize", wxTRANSLATE("Synchronize game to audio"), synchronize, 0, 1),
INTOPT("preferences/fsColorDepth", wxTRANSLATE("Fullscreen mode color depth (0 = any)"), fsColorDepth, 0, 999),
INTOPT("preferences/fsFrequency", wxTRANSLATE("Fullscreen mode frequency (0 = any)"), fsFrequency, 0, 999),
INTOPT("preferences/fsHeight", wxTRANSLATE("Fullscreen mode height (0 = desktop)"), fsHeight, 0, 99999),
INTOPT("preferences/fsWidth", wxTRANSLATE("Fullscreen mode width (0 = desktop)"), fsWidth, 0, 99999),
ENUMOPT("preferences/showSpeed", wxTRANSLATE("Show speed indicator"), showSpeed, wxTRANSLATE("no|percent|detailed")),
INTOPT("preferences/borderAutomatic", wxTRANSLATE("Automatically enable border for Super GameBoy games"), gbBorderAutomatic, 0, 1),
//STROPT("preferences/biosFileGB", wxTRANSLATE("BIOS file to use for GB, if enabled"), wxString::FromUTF8(biosFileNameGB)),
INTOPT("preferences/borderOn", wxTRANSLATE("Always enable border"), gbBorderOn, 0, 1),
ENUMOPT("preferences/emulatorType", wxTRANSLATE("Type of system to emulate"), gbEmulatorType, wxTRANSLATE("auto|gba|gbc|sgb|sgb2|gb")),
INTOPT("preferences/gbFrameSkip", wxTRANSLATE("Skip frames. Values are 0-9 or -1 to skip automatically based on time."), gbFrameSkip, -1, 9),
ENUMOPT("preferences/gbPaletteOption", wxTRANSLATE("The palette to use"), gbPaletteOption, wxTRANSLATE("default|user1|user2")),
//STROPT("preferences/romDirGB", wxTRANSLATE("Directory to look for ROM files"), wxString::FromUTF8(romDirGB)),
INTOPT("preferences/useBiosFileGB", wxTRANSLATE("Use the specified BIOS file for GB"), useBiosFileGB, 0, 1),
//STROPT("preferences/biosFileGBA", wxTRANSLATE("BIOS file to use, if enabled"), wxString::FromUTF8(biosFileNameGBA)),
ENUMOPT("preferences/flashSize", wxTRANSLATE("Flash size (kb) (vba-over.ini override is flashSize in bytes)"), optFlashSize, wxTRANSLATE("64|128")),
INTOPT("preferences/frameSkip", wxTRANSLATE("Skip frames. Values are 0-9 or -1 to skip automatically based on time."), frameSkip, -1, 9),
//STROPT("preferences/romDirGBA", wxTRANSLATE("Directory to look for ROM files"), wxString::FromUTF8(romDirGBA)),
INTOPT("preferences/autoPatch", wxTRANSLATE("Apply IPS/UPS/IPF patches if found"), autoPatch, 0, 1),
//STROPT("preferences/batteryDir", wxTRANSLATE("Directory to store game save files (relative paths are relative to ROM; blank is config dir)"), wxString::FromUTF8(batteryDir)),
INTOPT("preferences/autoSaveCheatList", wxTRANSLATE("Automatically save and load cheat list"), autoSaveLoadCheatList, 0, 1),
ENUMOPT("preferences/captureFormat", wxTRANSLATE("Screen capture file format"), captureFormat, wxTRANSLATE("png|bmp")),
INTOPT("preferences/cheatsEnabled", wxTRANSLATE("Enable cheats"), cheatsEnabled, 0, 1),
//STROPT("preferences/aviRecordDir", wxTRANSLATE("Directory to store A/V and game recordings (relative paths are relative to ROM)"), wxString::FromUTF8(aviRecordDir)),
//STROPT("preferences/screenShotDir", wxTRANSLATE("Directory to store screenshots (relative paths are relative to ROM)"), wxString::FromUTF8(screenShotDir)),
INTOPT("preferences/skipBios", wxTRANSLATE("Skip BIOS initialization"), skipBios, 0, 1),
INTOPT("preferences/throttle", wxTRANSLATE("Throttle game speed, even when accelerated (0-1000%, 0 = disabled)"), throttle, 0, 1000),
INTOPT("preferences/skipSaveGameBattery", wxTRANSLATE("Do not overwrite native (battery) save when loading state"), skipSaveGameBattery, 0, 1),
INTOPT("preferences/useBiosGBC", wxTRANSLATE("Use the specified BIOS file for GBC"), useBiosFileGBC, 0, 1),
//STROPT("preferences/saveDir", wxTRANSLATE("Directory to store saved state files (relative paths are relative to BatteryDir)"), wxString::FromUTF8(saveDir)),
//STROPT("preferences/biosFileGBC", wxTRANSLATE("BIOS file to use for GBC, if enabled"), wxString::FromUTF8(biosFileNameGBC)),
/// Display /// Display
BOOLOPT("Display/Bilinear", wxTRANSLATE("Use bilinear filter with 3d renderer"), gopts.bilinear), BOOLOPT("Display/Bilinear", wxTRANSLATE("Use bilinear filter with 3d renderer"), gopts.bilinear),
BOOLOPT("Display/DisableStatus", wxTRANSLATE("Disable on-screen status messages"), gopts.no_osd_status),
#ifdef MMX
BOOLOPT("Display/EnableMMX", wxTRANSLATE("Enable MMX"), gopts.cpu_mmx),
#endif
ENUMOPT("Display/Filter", wxTRANSLATE("Full-screen filter to apply"), gopts.filter, ENUMOPT("Display/Filter", wxTRANSLATE("Full-screen filter to apply"), gopts.filter,
wxTRANSLATE("none|2xsai|super2xsai|supereagle|pixelate|advmame|" wxTRANSLATE("none|2xsai|super2xsai|supereagle|pixelate|advmame|"
L"bilinear|bilinearplus|scanlines|tvmode|hq2x|lq2x|" L"bilinear|bilinearplus|scanlines|tvmode|hq2x|lq2x|"
L"simple2x|simple3x|hq3x|simple4x|hq4x|xbrz|plugin")), L"simple2x|simple3x|hq3x|simple4x|hq4x|xbrz|plugin")),
STROPT ("Display/FilterPlugin", wxTRANSLATE("Filter plugin library"), gopts.filter_plugin), STROPT ("Display/FilterPlugin", wxTRANSLATE("Filter plugin library"), gopts.filter_plugin),
BOOLOPT("Display/Fullscreen", wxTRANSLATE("Enter fullscreen mode at startup"), gopts.fullscreen),
INTOPT ("Display/FullscreenDepth", wxTRANSLATE("Fullscreen mode color depth (0 = any)"), gopts.fs_mode.bpp, 0, 999),
INTOPT ("Display/FullscreenFreq", wxTRANSLATE("Fullscreen mode frequency (0 = any)"), gopts.fs_mode.refresh, 0, 999),
INTOPT ("Display/FullscreenHeight", wxTRANSLATE("Fullscreen mode height (0 = desktop)"), gopts.fs_mode.h, 0, 99999),
INTOPT ("Display/FullscreenWidth", wxTRANSLATE("Fullscreen mode width (0 = desktop)"), gopts.fs_mode.w, 0, 99999),
ENUMOPT("Display/IFB", wxTRANSLATE("Interframe blending function"), gopts.ifb, wxTRANSLATE("none|smart|motionblur")), ENUMOPT("Display/IFB", wxTRANSLATE("Interframe blending function"), gopts.ifb, wxTRANSLATE("none|smart|motionblur")),
INTOPT ("Display/MaxScale", wxTRANSLATE("Maximum scale factor (0 = no limit)"), gopts.max_scale, 0, 100),
INTOPT ("Display/MaxThreads", wxTRANSLATE("Maximum number of threads to run filters in"), gopts.max_threads, 1, 8), INTOPT ("Display/MaxThreads", wxTRANSLATE("Maximum number of threads to run filters in"), gopts.max_threads, 1, 8),
#ifdef __WXMSW__ #ifdef __WXMSW__
ENUMOPT("Display/RenderMethod", wxTRANSLATE("Render method; if unsupported, simple method will be used"), gopts.render_method, wxTRANSLATE("simple|opengl|cairo|direct3d")), ENUMOPT("Display/RenderMethod", wxTRANSLATE("Render method; if unsupported, simple method will be used"), gopts.render_method, wxTRANSLATE("simple|opengl|cairo|direct3d")),
@ -152,36 +190,22 @@ opt_desc opts[] = {
ENUMOPT("Display/RenderMethod", wxTRANSLATE("Render method; if unsupported, simple method will be used"), gopts.render_method, wxTRANSLATE("simple|opengl|cairo")), ENUMOPT("Display/RenderMethod", wxTRANSLATE("Render method; if unsupported, simple method will be used"), gopts.render_method, wxTRANSLATE("simple|opengl|cairo")),
#endif #endif
INTOPT ("Display/Scale", wxTRANSLATE("Default scale factor"), gopts.video_scale, 1, 6), INTOPT ("Display/Scale", wxTRANSLATE("Default scale factor"), gopts.video_scale, 1, 6),
ENUMOPT("Display/ShowSpeed", wxTRANSLATE("Show speed indicator"), gopts.osd_speed, wxTRANSLATE("no|percent|detailed")),
BOOLOPT("Display/Stretch", wxTRANSLATE("Retain aspect ratio when resizing"), gopts.retain_aspect), BOOLOPT("Display/Stretch", wxTRANSLATE("Retain aspect ratio when resizing"), gopts.retain_aspect),
BOOLOPT("Display/Transparent", wxTRANSLATE("Draw on-screen messages transparently"), gopts.osd_transparent),
BOOLOPT("Display/Vsync", wxTRANSLATE("Wait for vertical sync"), gopts.vsync),
/// GB /// GB
BOOLOPT("GB/AutomaticBorder", wxTRANSLATE("Automatically enable border for Super GameBoy games"), gopts.gbBorderAutomatic),
STROPT ("GB/BiosFile", wxTRANSLATE("BIOS file to use for GB, if enabled"), gopts.gb_bios), STROPT ("GB/BiosFile", wxTRANSLATE("BIOS file to use for GB, if enabled"), gopts.gb_bios),
BOOLOPT("GB/Border", wxTRANSLATE("Always enable border"), gopts.gbBorderOn),
ENUMOPT("GB/EmulatorType", wxTRANSLATE("Type of system to emulate"), gopts.gbEmulatorType, wxTRANSLATE("auto|gba|gbc|sgb|sgb2|gb")),
BOOLOPT("GB/EnablePrinter", wxTRANSLATE("Enable printer emulation"), gopts.gbprint), BOOLOPT("GB/EnablePrinter", wxTRANSLATE("Enable printer emulation"), gopts.gbprint),
INTOPT ("GB/FrameSkip", wxTRANSLATE("Skip frames. Values are 0-9 or -1 to skip automatically based on time."), gopts.gb_frameskip, -1, 9),
STROPT ("GB/GBCBiosFile", wxTRANSLATE("BIOS file to use for GBC, if enabled"), gopts.gbc_bios), STROPT ("GB/GBCBiosFile", wxTRANSLATE("BIOS file to use for GBC, if enabled"), gopts.gbc_bios),
BOOLOPT("GB/GBCUseBiosFile", wxTRANSLATE("Use the specified BIOS file for GBC"), gopts.gbc_use_bios),
BOOLOPT("GB/LCDColor", wxTRANSLATE("Emulate washed colors of LCD"), gopts.gbcColorOption), BOOLOPT("GB/LCDColor", wxTRANSLATE("Emulate washed colors of LCD"), gopts.gbcColorOption),
ENUMOPT("GB/Palette", wxTRANSLATE("The palette to use"), gopts.gbPaletteOption, wxTRANSLATE("default|user1|user2")),
{ wxT("GB/Palette0"), wxTRANSLATE("The default palette, as 8 comma-separated 4-digit hex integers (rgb555).") }, { wxT("GB/Palette0"), wxTRANSLATE("The default palette, as 8 comma-separated 4-digit hex integers (rgb555).") },
{ wxT("GB/Palette1"), wxTRANSLATE("The first user palette, as 8 comma-separated 4-digit hex integers (rgb555).") }, { wxT("GB/Palette1"), wxTRANSLATE("The first user palette, as 8 comma-separated 4-digit hex integers (rgb555).") },
{ wxT("GB/Palette2"), wxTRANSLATE("The second user palette, as 8 comma-separated 4-digit hex integers (rgb555).") }, { wxT("GB/Palette2"), wxTRANSLATE("The second user palette, as 8 comma-separated 4-digit hex integers (rgb555).") },
BOOLOPT("GB/PrintAutoPage", wxTRANSLATE("Automatically gather a full page before printing"), gopts.print_auto_page), BOOLOPT("GB/PrintAutoPage", wxTRANSLATE("Automatically gather a full page before printing"), gopts.print_auto_page),
BOOLOPT("GB/PrintScreenCap", wxTRANSLATE("Automatically save printouts as screen captures with -print suffix"), gopts.print_screen_cap), BOOLOPT("GB/PrintScreenCap", wxTRANSLATE("Automatically save printouts as screen captures with -print suffix"), gopts.print_screen_cap),
STROPT ("GB/ROMDir", wxTRANSLATE("Directory to look for ROM files"), gopts.gb_rom_dir), STROPT ("GB/ROMDir", wxTRANSLATE("Directory to look for ROM files"), gopts.gb_rom_dir),
BOOLOPT("GB/UseBiosFile", wxTRANSLATE("Use the specified BIOS file for GB"), gopts.gb_use_bios),
/// GBA /// GBA
BOOLOPT("GBA/AGBPrinter", wxTRANSLATE("Enable AGB printer"), gopts.agbprint),
STROPT ("GBA/BiosFile", wxTRANSLATE("BIOS file to use, if enabled"), gopts.gba_bios), STROPT ("GBA/BiosFile", wxTRANSLATE("BIOS file to use, if enabled"), gopts.gba_bios),
BOOLOPT("GBA/EnableRTC", wxTRANSLATE("Enable RTC (vba-over.ini override is rtcEnabled"), gopts.rtc),
ENUMOPT("GBA/FlashSize", wxTRANSLATE("Flash size (kb) (vba-over.ini override is flashSize in bytes)"), gopts.flash_size, wxTRANSLATE("64|128")),
INTOPT ("GBA/FrameSkip", wxTRANSLATE("Skip frames. Values are 0-9 or -1 to skip automatically based on time."), gopts.gba_frameskip, -1, 9),
#ifndef NO_LINK #ifndef NO_LINK
BOOLOPT("GBA/Joybus", wxTRANSLATE("Enable joybus"), gopts.gba_joybus_enabled), BOOLOPT("GBA/Joybus", wxTRANSLATE("Enable joybus"), gopts.gba_joybus_enabled),
STROPT ("GBA/JoybusHost", wxTRANSLATE("Joybus host address"), gopts.joybus_host), STROPT ("GBA/JoybusHost", wxTRANSLATE("Joybus host address"), gopts.joybus_host),
@ -193,26 +217,16 @@ opt_desc opts[] = {
INTOPT ("GBA/LinkTimeout", wxTRANSLATE("Link timeout (ms)"), gopts.linktimeout, 0, 9999999), INTOPT ("GBA/LinkTimeout", wxTRANSLATE("Link timeout (ms)"), gopts.linktimeout, 0, 9999999),
#endif #endif
STROPT ("GBA/ROMDir", wxTRANSLATE("Directory to look for ROM files"), gopts.gba_rom_dir), STROPT ("GBA/ROMDir", wxTRANSLATE("Directory to look for ROM files"), gopts.gba_rom_dir),
ENUMOPT("GBA/SaveType", wxTRANSLATE("Native save (\"battery\") hardware type (vba-over.ini override is saveType integer 0-5)"), gopts.save_type, wxTRANSLATE("auto|eeprom|sram|flash|eeprom+sensor|none")),
BOOLOPT("GBA/UseBiosFile", wxTRANSLATE("Use the specified BIOS file"), gopts.gba_use_bios),
/// General /// General
BOOLOPT("General/ApplyPatches", wxTRANSLATE("Apply IPS/UPS/IPF patches if found"), gopts.apply_patches),
BOOLOPT("General/AutoLoadLastState", wxTRANSLATE("Automatically load last saved state"), gopts.autoload_state), BOOLOPT("General/AutoLoadLastState", wxTRANSLATE("Automatically load last saved state"), gopts.autoload_state),
BOOLOPT("General/AutoSaveCheatList", wxTRANSLATE("Automatically save and load cheat list"), gopts.autoload_cheats),
STROPT ("General/BatteryDir", wxTRANSLATE("Directory to store game save files (relative paths are relative to ROM; blank is config dir)"), gopts.battery_dir), STROPT ("General/BatteryDir", wxTRANSLATE("Directory to store game save files (relative paths are relative to ROM; blank is config dir)"), gopts.battery_dir),
ENUMOPT("General/CaptureFormat", wxTRANSLATE("Screen capture file format"), gopts.cap_format, wxTRANSLATE("png|bmp")),
BOOLOPT("General/EnableCheats", wxTRANSLATE("Enable cheats"), gopts.cheatsEnabled),
BOOLOPT("General/FreezeRecent", wxTRANSLATE("Freeze recent load list"), gopts.recent_freeze), BOOLOPT("General/FreezeRecent", wxTRANSLATE("Freeze recent load list"), gopts.recent_freeze),
BOOLOPT("General/PauseWhenInactive", wxTRANSLATE("Pause game when main window loses focus"), gopts.defocus_pause),
STROPT ("General/RecordingDir", wxTRANSLATE("Directory to store A/V and game recordings (relative paths are relative to ROM)"), gopts.recording_dir), STROPT ("General/RecordingDir", wxTRANSLATE("Directory to store A/V and game recordings (relative paths are relative to ROM)"), gopts.recording_dir),
INTOPT ("General/RewindInterval", wxTRANSLATE("Number of seconds between rewind snapshots (0 to disable)"), gopts.rewind_interval, 0, 600), INTOPT ("General/RewindInterval", wxTRANSLATE("Number of seconds between rewind snapshots (0 to disable)"), gopts.rewind_interval, 0, 600),
STROPT ("General/ScreenshotDir", wxTRANSLATE("Directory to store screenshots (relative paths are relative to ROM)"), gopts.scrshot_dir), STROPT ("General/ScreenshotDir", wxTRANSLATE("Directory to store screenshots (relative paths are relative to ROM)"), gopts.scrshot_dir),
BOOLOPT("General/SkipBios", wxTRANSLATE("Skip BIOS initialization"), gopts.skipBios),
STROPT ("General/StateDir", wxTRANSLATE("Directory to store saved state files (relative paths are relative to BatteryDir)"), gopts.state_dir), STROPT ("General/StateDir", wxTRANSLATE("Directory to store saved state files (relative paths are relative to BatteryDir)"), gopts.state_dir),
BOOLOPT("General/StateLoadNoBattery", wxTRANSLATE("Do not overwrite native (battery) save when loading state"), gopts.skipSaveGameBattery),
BOOLOPT("General/StateLoadNoCheat", wxTRANSLATE("Do not overwrite cheat list when loading state"), gopts.skipSaveGameCheats), BOOLOPT("General/StateLoadNoCheat", wxTRANSLATE("Do not overwrite cheat list when loading state"), gopts.skipSaveGameCheats),
INTOPT ("General/Throttle", wxTRANSLATE("Throttle game speed, even when accelerated (0-1000%, 0 = disabled)"), gopts.throttle, 0, 1000),
/// Joypad /// Joypad
{ wxT("Joypad/*/*"), wxTRANSLATE("The parameter Joypad/<n>/<button> contains a comma-separated list of key names which map to joypad #<n> button <button>. Button is one of Up, Down, Left, Right, A, B, L, R, Select, Start, MotionUp, MotionDown, MotionLeft, MotionRight, AutoA, AutoB, Speed, Capture, GS") }, { wxT("Joypad/*/*"), wxTRANSLATE("The parameter Joypad/<n>/<button> contains a comma-separated list of key names which map to joypad #<n> button <button>. Button is one of Up, Down, Left, Right, A, B, L, R, Select, Start, MotionUp, MotionDown, MotionLeft, MotionRight, AutoA, AutoB, Speed, Capture, GS") },
@ -240,7 +254,6 @@ opt_desc opts[] = {
INTOPT ("Sound/GBStereo", wxTRANSLATE("GB stereo effect (%)"), gopts.gb_stereo, 0, 100), INTOPT ("Sound/GBStereo", wxTRANSLATE("GB stereo effect (%)"), gopts.gb_stereo, 0, 100),
BOOLOPT("Sound/GBSurround", wxTRANSLATE("GB surround sound effect (%)"), gopts.gb_effects_config_surround), BOOLOPT("Sound/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")), ENUMOPT("Sound/Quality", wxTRANSLATE("Sound sample rate (kHz)"), gopts.sound_qual, wxTRANSLATE("48|44|22|11")),
BOOLOPT("Sound/Synchronize", wxTRANSLATE("Synchronize game to audio"), gopts.synchronize),
INTOPT ("Sound/Volume", wxTRANSLATE("Sound volume (%)"), gopts.sound_vol, 0, 200) INTOPT ("Sound/Volume", wxTRANSLATE("Sound volume (%)"), gopts.sound_vol, 0, 200)
}; };
const int num_opts = sizeof(opts)/sizeof(opts[0]); const int num_opts = sizeof(opts)/sizeof(opts[0]);
@ -250,8 +263,8 @@ const int num_opts = sizeof(opts)/sizeof(opts[0]);
// the default value of every non-object to be 0. // the default value of every non-object to be 0.
opts_t::opts_t() opts_t::opts_t()
{ {
gba_frameskip = -1; frameSkip = -1;
gb_frameskip = -1; gbFrameSkip = -1;
#ifdef __WXMSW__ #ifdef __WXMSW__
audio_api = AUD_DIRECTSOUND; audio_api = AUD_DIRECTSOUND;
#endif #endif
@ -281,7 +294,7 @@ opts_t::opts_t()
recent = new wxFileHistory(10); recent = new wxFileHistory(10);
autofire_rate = 1; autofire_rate = 1;
gbprint = print_auto_page = true; gbprint = print_auto_page = true;
apply_patches = true; autoPatch = true;
} }
// for binary_search() and friends // for binary_search() and friends
@ -308,7 +321,7 @@ void load_opts()
// change after lang change // change after lang change
// instead, translate when presented to user // instead, translate when presented to user
wxConfig *cfg = wxGetApp().cfg; wxFileConfig *cfg = wxGetApp().cfg;
cfg->SetPath(wxT("/")); cfg->SetPath(wxT("/"));
// enure there are no unknown options present // enure there are no unknown options present
@ -319,7 +332,7 @@ void load_opts()
bool cont; bool cont;
for(cont = cfg->GetFirstEntry(s, grp_idx); cont; for(cont = cfg->GetFirstEntry(s, grp_idx); cont;
cont = cfg->GetNextEntry(s, grp_idx)) { cont = cfg->GetNextEntry(s, grp_idx)) {
wxLogWarning(_("Invalid option %s present; removing if possible"), s.c_str()); //wxLogWarning(_("Invalid option %s present; removing if possible"), s.c_str());
item_del.push_back(s); item_del.push_back(s);
} }
for(cont = cfg->GetFirstGroup(s, grp_idx); cont; for(cont = cfg->GetFirstGroup(s, grp_idx); cont;
@ -347,7 +360,7 @@ void load_opts()
for(cont = cfg->GetFirstGroup(e, key_idx); cont; for(cont = cfg->GetFirstGroup(e, key_idx); cont;
cont = cfg->GetNextGroup(e, key_idx)) { cont = cfg->GetNextGroup(e, key_idx)) {
s.append(e); s.append(e);
wxLogWarning(_("Invalid option group %s present; removing if possible"), s.c_str()); //wxLogWarning(_("Invalid option group %s present; removing if possible"), s.c_str());
grp_del.push_back(s); grp_del.push_back(s);
s.resize(poff2); s.resize(poff2);
} }
@ -355,11 +368,11 @@ void load_opts()
cont = cfg->GetNextEntry(e, key_idx)) { cont = cfg->GetNextEntry(e, key_idx)) {
int i; int i;
for(i = 0; i < NUM_KEYS; i++) for(i = 0; i < NUM_KEYS; i++)
if(e == joynames[i]) if (e == wxString::FromUTF8(joynames[i]))
break; break;
if(i == NUM_KEYS) { if(i == NUM_KEYS) {
s.append(e); s.append(e);
wxLogWarning(_("Invalid option %s present; removing if possible"), s.c_str()); //wxLogWarning(_("Invalid option %s present; removing if possible"), s.c_str());
item_del.push_back(s); item_del.push_back(s);
s.resize(poff2); s.resize(poff2);
} }
@ -370,7 +383,7 @@ void load_opts()
} else { } else {
s.append(wxT('/')); s.append(wxT('/'));
s.append(e); s.append(e);
wxLogWarning(_("Invalid option group %s present; removing if possible"), s.c_str()); //wxLogWarning(_("Invalid option group %s present; removing if possible"), s.c_str());
grp_del.push_back(s); grp_del.push_back(s);
s.resize(poff); s.resize(poff);
} }
@ -383,7 +396,7 @@ void load_opts()
if(!std::binary_search(&cmdtab[0], &cmdtab[ncmds], dummy, cmditem_lt)) { if(!std::binary_search(&cmdtab[0], &cmdtab[ncmds], dummy, cmditem_lt)) {
s.append(wxT('/')); s.append(wxT('/'));
s.append(e); s.append(e);
wxLogWarning(_("Invalid option %s present; removing if possible"), s.c_str()); //wxLogWarning(_("Invalid option %s present; removing if possible"), s.c_str());
item_del.push_back(s); item_del.push_back(s);
s.resize(poff); s.resize(poff);
} }
@ -392,7 +405,7 @@ void load_opts()
s.append(e); s.append(e);
const opt_desc dummy = { s.c_str() }; const opt_desc dummy = { s.c_str() };
if(!std::binary_search(&opts[0], &opts[num_opts], dummy, opt_lt)) { if(!std::binary_search(&opts[0], &opts[num_opts], dummy, opt_lt)) {
wxLogWarning(_("Invalid option %s present; removing if possible"), s.c_str()); //wxLogWarning(_("Invalid option %s present; removing if possible"), s.c_str());
item_del.push_back(s); item_del.push_back(s);
} }
s.resize(poff); s.resize(poff);
@ -542,7 +555,7 @@ void load_opts()
// Note: run load_opts() first to guarantee all config opts exist // Note: run load_opts() first to guarantee all config opts exist
void update_opts() void update_opts()
{ {
wxConfig *cfg = wxGetApp().cfg; wxFileConfig *cfg = wxGetApp().cfg;
for(int i = 0; i < num_opts; i++) { for(int i = 0; i < num_opts; i++) {
opt_desc &opt = opts[i]; opt_desc &opt = opts[i];
if(opt.stropt) { if(opt.stropt) {
@ -757,8 +770,8 @@ bool opt_set(const wxChar *name, const wxChar *val)
int jno = slat[1] - wxT('1'); int jno = slat[1] - wxT('1');
int kno; int kno;
for(kno = 0; kno < NUM_KEYS; kno++) for(kno = 0; kno < NUM_KEYS; kno++)
if(!wxStrcmp(joynames[kno], slat + 3)) if (!wxStrcmp(wxString::FromUTF8(joynames[kno]), slat + 3))
break; break;
if(kno == NUM_KEYS) if(kno == NUM_KEYS)
return false; return false;
if(!*val) if(!*val)

View File

@ -2,7 +2,7 @@
#define WX_OPTS_H #define WX_OPTS_H
#define NUM_KEYS 19 #define NUM_KEYS 19
extern const wxChar * const joynames[NUM_KEYS]; extern const char * const joynames[NUM_KEYS];
extern wxJoyKeyBinding defkeys[NUM_KEYS * 2]; // keyboard + joystick defaults extern wxJoyKeyBinding defkeys[NUM_KEYS * 2]; // keyboard + joystick defaults
extern struct opts_t { extern struct opts_t {
@ -12,44 +12,27 @@ extern struct opts_t {
/// Display /// Display
bool bilinear; bool bilinear;
bool cpu_mmx;
bool no_osd_status;
int filter; int filter;
wxString filter_plugin; wxString filter_plugin;
int ifb; int ifb;
bool fullscreen;
wxVideoMode fs_mode; wxVideoMode fs_mode;
int max_scale;
int max_threads; int max_threads;
int render_method; int render_method;
int video_scale; int video_scale;
int osd_speed; int osd_speed;
bool retain_aspect; bool retain_aspect;
bool osd_transparent;
bool vsync;
/// GB /// GB
bool gbBorderAutomatic;
wxString gb_bios; wxString gb_bios;
bool gbBorderOn;
int gbEmulatorType;
bool gbprint; // gbSerialFunction bool gbprint; // gbSerialFunction
int gb_frameskip; // systemFrameSkip
wxString gbc_bios; wxString gbc_bios;
bool gbc_use_bios;
bool gbcColorOption; bool gbcColorOption;
int gbPaletteOption;
// u16 systemGbPalette[8*3]; // u16 systemGbPalette[8*3];
bool print_auto_page, print_screen_cap; bool print_auto_page, print_screen_cap;
wxString gb_rom_dir; wxString gb_rom_dir;
bool gb_use_bios;
/// GBA /// GBA
bool agbprint; // AGBPrintEnable()
wxString gba_bios; wxString gba_bios;
bool rtc; // rtcEnable // has per-game override
int flash_size; // flashSetSize // has per-game override
int gba_frameskip; // systemFrameSkip
bool gba_joybus_enabled; bool gba_joybus_enabled;
wxString joybus_host; wxString joybus_host;
bool gba_link_enabled; bool gba_link_enabled;
@ -59,25 +42,16 @@ extern struct opts_t {
bool rfu_enabled; bool rfu_enabled;
int linktimeout; int linktimeout;
wxString gba_rom_dir; wxString gba_rom_dir;
bool skip_intro;
int save_type; // cpuSaveType
bool gba_use_bios;
/// General /// General
bool apply_patches;
bool autoload_state, autoload_cheats; bool autoload_state, autoload_cheats;
wxString battery_dir; wxString battery_dir;
int cap_format;
bool cheatsEnabled;
bool recent_freeze; bool recent_freeze;
bool defocus_pause;
wxString recording_dir; wxString recording_dir;
int rewind_interval; int rewind_interval;
wxString scrshot_dir; wxString scrshot_dir;
bool skipBios;
wxString state_dir; wxString state_dir;
bool skipSaveGameBattery, skipSaveGameCheats; bool skipSaveGameBattery, skipSaveGameCheats;
int throttle; // updateThrottle()
/// Joypad /// Joypad
wxJoyKeyBinding_v joykey_bindings[4][NUM_KEYS]; wxJoyKeyBinding_v joykey_bindings[4][NUM_KEYS];
@ -101,7 +75,6 @@ extern struct opts_t {
int gb_stereo; int gb_stereo;
bool gb_effects_config_surround; bool gb_effects_config_surround;
int sound_qual; // soundSetSampleRate() / gbSoundSetSampleRate() int sound_qual; // soundSetSampleRate() / gbSoundSetSampleRate()
bool synchronize;
int sound_vol; // soundSetVolume() int sound_vol; // soundSetVolume()
bool upmix; // xa2 only bool upmix; // xa2 only

View File

@ -59,7 +59,7 @@ void GameArea::LoadGame(const wxString &name)
return; return;
} }
{ {
wxConfig *cfg = wxGetApp().cfg; wxFileConfig *cfg = wxGetApp().cfg;
if(!gopts.recent_freeze) { if(!gopts.recent_freeze) {
gopts.recent->AddFileToHistory(name); gopts.recent->AddFileToHistory(name);
wxGetApp().frame->SetRecentAccels(); wxGetApp().frame->SetRecentAccels();
@ -87,7 +87,7 @@ void GameArea::LoadGame(const wxString &name)
// out to a temporary file and load it (and can't just use // out to a temporary file and load it (and can't just use
// AssignTempFileName because it needs correct extension) // AssignTempFileName because it needs correct extension)
// too much trouble for now, though // too much trouble for now, though
bool loadpatch = gopts.apply_patches; bool loadpatch = autoPatch;
wxFileName pfn = loaded_game; wxFileName pfn = loaded_game;
if(loadpatch) { if(loadpatch) {
// SetExt may strip something off by accident, so append to text instead // SetExt may strip something off by accident, so append to text instead
@ -127,7 +127,7 @@ void GameArea::LoadGame(const wxString &name)
gb_effects_config.stereo = (float)gopts.gb_stereo / 100.0; gb_effects_config.stereo = (float)gopts.gb_stereo / 100.0;
gbSoundSetDeclicking(gopts.gb_declick); gbSoundSetDeclicking(gopts.gb_declick);
soundInit(); soundInit();
soundSetThrottle(gopts.throttle); soundSetThrottle(throttle);
soundSetEnable(gopts.sound_en); soundSetEnable(gopts.sound_en);
gbSoundSetSampleRate(!gopts.sound_qual ? 48000 : gbSoundSetSampleRate(!gopts.sound_qual ? 48000 :
44100 / (1 << (gopts.sound_qual - 1))); 44100 / (1 << (gopts.sound_qual - 1)));
@ -140,11 +140,11 @@ void GameArea::LoadGame(const wxString &name)
const char *fn = NULL; const char *fn = NULL;
wxCharBuffer fnb; wxCharBuffer fnb;
if(gbCgbMode) { if(gbCgbMode) {
use_bios = gopts.gbc_use_bios; use_bios = useBiosFileGBC;
fnb = gopts.gbc_bios.mb_fn_str(); fnb = biosFileNameGBC;
} else { } else {
use_bios = gopts.gb_use_bios; use_bios = useBiosFileGB;
fnb = gopts.gb_bios.mb_fn_str(); fnb = biosFileNameGB;
} }
fn = fnb.data(); fn = fnb.data();
gbCPUInit(fn, use_bios); gbCPUInit(fn, use_bios);
@ -195,14 +195,14 @@ void GameArea::LoadGame(const wxString &name)
if(cfg->HasGroup(id)) { if(cfg->HasGroup(id)) {
cfg->SetPath(id); cfg->SetPath(id);
rtcEnable(cfg->Read(wxT("rtcEnabled"), gopts.rtc)); rtcEnable(cfg->Read(wxT("rtcEnabled"), rtcEnabled));
int fsz = cfg->Read(wxT("flashSize"), (long)0); int fsz = cfg->Read(wxT("flashSize"), (long)0);
if(fsz != 0x10000 && fsz != 0x20000) if(fsz != 0x10000 && fsz != 0x20000)
fsz = 0x10000 << gopts.flash_size; fsz = 0x10000 << winFlashSize;
flashSetSize(fsz); flashSetSize(fsz);
cpuSaveType = cfg->Read(wxT("saveType"), gopts.save_type); cpuSaveType = cfg->Read(wxT("saveType"), cpuSaveType);
if(cpuSaveType < 0 || cpuSaveType > 5) if(cpuSaveType < 0 || cpuSaveType > 5)
cpuSaveType = gopts.save_type; cpuSaveType = cpuSaveType;
if (cpuSaveType == 0) if (cpuSaveType == 0)
utilGBAFindSave(rom_size); utilGBAFindSave(rom_size);
@ -213,9 +213,9 @@ void GameArea::LoadGame(const wxString &name)
cfg->SetPath(wxT("/")); cfg->SetPath(wxT("/"));
} else { } else {
rtcEnable(gopts.rtc); rtcEnable(rtcEnabled);
flashSetSize(0x10000 << gopts.flash_size); flashSetSize(0x10000 << winFlashSize);
cpuSaveType = gopts.save_type; cpuSaveType = cpuSaveType;
if (cpuSaveType == 0) if (cpuSaveType == 0)
utilGBAFindSave(rom_size); utilGBAFindSave(rom_size);
else else
@ -232,14 +232,14 @@ void GameArea::LoadGame(const wxString &name)
// start sound; this must happen before CPU stuff // start sound; this must happen before CPU stuff
soundInit(); soundInit();
soundSetThrottle(gopts.throttle); soundSetThrottle(throttle);
soundSetEnable(gopts.sound_en); soundSetEnable(gopts.sound_en);
soundSetSampleRate(!gopts.sound_qual ? 48000 : soundSetSampleRate(!gopts.sound_qual ? 48000 :
44100 / (1 << (gopts.sound_qual - 1))); 44100 / (1 << (gopts.sound_qual - 1)));
soundSetVolume((float)gopts.sound_vol / 100.0); soundSetVolume((float)gopts.sound_vol / 100.0);
CPUInit(gopts.gba_bios.mb_fn_str(), gopts.gba_use_bios); CPUInit(gopts.gba_bios.mb_fn_str(), useBiosFileGBA);
if(gopts.gba_use_bios && !useBios) { if(useBiosFileGBA && !useBios) {
wxLogError(_("Could not load BIOS %s"), gopts.gba_bios.c_str()); wxLogError(_("Could not load BIOS %s"), gopts.gba_bios.c_str());
// could clear use flag & file name now, but better to force // could clear use flag & file name now, but better to force
// user to do it // user to do it
@ -272,10 +272,10 @@ void GameArea::LoadGame(const wxString &name)
gbSerialFunction = NULL; gbSerialFunction = NULL;
// probably only need to do this for GBA carts // probably only need to do this for GBA carts
agbPrintEnable(gopts.agbprint); agbPrintEnable(agbPrint);
// set frame skip based on ROM type // set frame skip based on ROM type
systemFrameSkip = loaded == IMAGE_GB ? gopts.gb_frameskip : gopts.gba_frameskip; systemFrameSkip = loaded == IMAGE_GB ? gbFrameSkip : frameSkip;
if(systemFrameSkip < 0) if(systemFrameSkip < 0)
systemFrameSkip = 0; systemFrameSkip = 0;
@ -825,16 +825,16 @@ void GameArea::OnIdle(wxIdleEvent &event)
w->SetBackgroundStyle(wxBG_STYLE_CUSTOM); w->SetBackgroundStyle(wxBG_STYLE_CUSTOM);
w->Enable(false); // never give it the keyboard focus w->Enable(false); // never give it the keyboard focus
w->SetSize(wxSize(basic_width, basic_height)); w->SetSize(wxSize(basic_width, basic_height));
if(gopts.max_scale) if(maxScale)
w->SetMaxSize(wxSize(basic_width * gopts.max_scale, w->SetMaxSize(wxSize(basic_width * maxScale,
basic_height * gopts.max_scale)); basic_height * maxScale));
GetSizer()->Add(w, 1, gopts.retain_aspect ? GetSizer()->Add(w, 1, gopts.retain_aspect ?
(wxSHAPED|wxALIGN_CENTER) : wxEXPAND); (wxSHAPED|wxALIGN_CENTER) : wxEXPAND);
Layout(); Layout();
if(pointer_blanked) if(pointer_blanked)
w->SetCursor(wxCursor(wxCURSOR_BLANK)); w->SetCursor(wxCursor(wxCURSOR_BLANK));
} }
if(!paused && (!gopts.defocus_pause || wxGetApp().frame->HasFocus())) { if(!paused && (!pauseWhenInactive || wxGetApp().frame->HasFocus())) {
HidePointer(); HidePointer();
event.RequestMore(); event.RequestMore();
if(debugger) { if(debugger) {
@ -1378,8 +1378,8 @@ void DrawingPanel::DrawArea(u8 **data)
GameArea *panel = wxGetApp().frame->GetPanel(); GameArea *panel = wxGetApp().frame->GetPanel();
if(panel->osdstat.size()) if(panel->osdstat.size())
drawText(todraw + outstride * (systemColorDepth != 24), outstride, drawText(todraw + outstride * (systemColorDepth != 24), outstride,
10, 20, panel->osdstat.utf8_str(), gopts.osd_transparent); 10, 20, panel->osdstat.utf8_str(), showSpeedTransparent);
if(!gopts.no_osd_status && !panel->osdtext.empty()) { if(!disableStatusMessages && !panel->osdtext.empty()) {
if(systemGetClock() - panel->osdtime < OSD_TIME) { if(systemGetClock() - panel->osdtime < OSD_TIME) {
std::string message = ToString(panel->osdtext); std::string message = ToString(panel->osdtext);
int linelen = (width * scale - 20) / 8; int linelen = (width * scale - 20) / 8;
@ -1391,7 +1391,7 @@ void DrawingPanel::DrawArea(u8 **data)
ptr[linelen] = 0; ptr[linelen] = 0;
drawText(todraw + outstride * (systemColorDepth != 24), drawText(todraw + outstride * (systemColorDepth != 24),
outstride, 10, cury, ptr, outstride, 10, cury, ptr,
gopts.osd_transparent); showSpeedTransparent);
cury += 10; cury += 10;
nlines--; nlines--;
ptr += linelen; ptr += linelen;
@ -1399,7 +1399,7 @@ void DrawingPanel::DrawArea(u8 **data)
} }
drawText(todraw + outstride * (systemColorDepth != 24), drawText(todraw + outstride * (systemColorDepth != 24),
outstride, 10, cury, ptr, outstride, 10, cury, ptr,
gopts.osd_transparent); showSpeedTransparent);
} else } else
panel->osdtext.clear(); panel->osdtext.clear();
} }
@ -1429,7 +1429,7 @@ void DrawingPanel::DrawOSD(wxWindowDC &dc)
// directly into the output like DrawText, this is only enabled for // directly into the output like DrawText, this is only enabled for
// non-3d renderers. // non-3d renderers.
GameArea *panel = wxGetApp().frame->GetPanel(); GameArea *panel = wxGetApp().frame->GetPanel();
dc.SetTextForeground(wxColour(255, 0, 0, gopts.osd_transparent ? 128 : 255)); dc.SetTextForeground(wxColour(255, 0, 0, showSpeedTransparent ? 128 : 255));
dc.SetTextBackground(wxColour(0, 0, 0, 0)); dc.SetTextBackground(wxColour(0, 0, 0, 0));
dc.SetUserScale(1.0, 1.0); dc.SetUserScale(1.0, 1.0);
if(panel->osdstat.size()) if(panel->osdstat.size())
@ -1440,7 +1440,7 @@ void DrawingPanel::DrawOSD(wxWindowDC &dc)
wxGetApp().frame->PopStatusText(); wxGetApp().frame->PopStatusText();
} }
} }
if(!gopts.no_osd_status && !panel->osdtext.empty()) { if(!disableStatusMessages && !panel->osdtext.empty()) {
wxSize asz = dc.GetSize(); wxSize asz = dc.GetSize();
wxString msg = panel->osdtext; wxString msg = panel->osdtext;
int lw, lh; int lw, lh;
@ -1695,17 +1695,17 @@ void GLDrawingPanel::Init()
if(!si) if(!si)
si = (PFNGLXSWAPINTERVALSGIPROC)glXGetProcAddress((const GLubyte *)"glxSwapIntervalSGI"); si = (PFNGLXSWAPINTERVALSGIPROC)glXGetProcAddress((const GLubyte *)"glxSwapIntervalSGI");
if(si) if(si)
si(gopts.vsync); si(vsync);
#else #else
#if defined(__WXMSW__) && defined(WGL_EXT_swap_control) #if defined(__WXMSW__) && defined(WGL_EXT_swap_control)
static PFNWGLSWAPINTERVALEXTPROC si = NULL; static PFNWGLSWAPINTERVALEXTPROC si = NULL;
if(!si) if(!si)
si = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT"); si = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
if(si) if(si)
si(gopts.vsync); si(vsync);
#else #else
#ifdef __WXMAC__ #ifdef __WXMAC__
int swap_interval = gopts.vsync ? 1 : 0; int swap_interval = vsync ? 1 : 0;
CGLContextObj cgl_context = CGLGetCurrentContext(); CGLContextObj cgl_context = CGLGetCurrentContext();
CGLSetParameter(cgl_context, kCGLCPSwapInterval, &swap_interval); CGLSetParameter(cgl_context, kCGLCPSwapInterval, &swap_interval);
#else #else

View File

@ -316,7 +316,7 @@ int systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
void system10Frames(int rate) void system10Frames(int rate)
{ {
GameArea *panel = wxGetApp().frame->GetPanel(); GameArea *panel = wxGetApp().frame->GetPanel();
int fs = panel->game_type() == IMAGE_GB ? gopts.gb_frameskip : gopts.gba_frameskip; int fs = panel->game_type() == IMAGE_GB ? gbFrameSkip : frameSkip;
if(fs < 0) { if(fs < 0) {
// I don't know why this algorithm isn't in common somewhere // I don't know why this algorithm isn't in common somewhere
// as is, I copied it from SDL // as is, I copied it from SDL
@ -384,7 +384,7 @@ void systemScreenCapture(int num)
wxString bfn; wxString bfn;
bfn.Printf(wxT("%s%02d"), panel->game_name().c_str(), bfn.Printf(wxT("%s%02d"), panel->game_name().c_str(),
num++); num++);
if(gopts.cap_format == 0) if(captureFormat == 0)
bfn.append(wxT(".png")); bfn.append(wxT(".png"));
else // if(gopts.cap_format == 1) else // if(gopts.cap_format == 1)
bfn.append(wxT(".bmp")); bfn.append(wxT(".bmp"));
@ -393,7 +393,7 @@ void systemScreenCapture(int num)
fn.Mkdir(0777, wxPATH_MKDIR_FULL); fn.Mkdir(0777, wxPATH_MKDIR_FULL);
if(gopts.cap_format == 0) if(captureFormat == 0)
panel->emusys->emuWritePNG(fn.GetFullPath().mb_fn_str()); panel->emusys->emuWritePNG(fn.GetFullPath().mb_fn_str());
else // if(gopts.cap_format == 1) else // if(gopts.cap_format == 1)
panel->emusys->emuWriteBMP(fn.GetFullPath().mb_fn_str()); panel->emusys->emuWriteBMP(fn.GetFullPath().mb_fn_str());
@ -672,7 +672,7 @@ void PrintDialog::DoSave(wxCommandEvent&)
wxString pats = _("Image files (*.bmp;*.jpg;*.png)|*.bmp;*.jpg;*.png|"); wxString pats = _("Image files (*.bmp;*.jpg;*.png)|*.bmp;*.jpg;*.png|");
pats.append(wxALL_FILES); pats.append(wxALL_FILES);
wxString dn = wxGetApp().frame->GetPanel()->game_name(); wxString dn = wxGetApp().frame->GetPanel()->game_name();
if(gopts.cap_format == 0) if(captureFormat == 0)
dn.append(wxT(".png")); dn.append(wxT(".png"));
else // if(gopts.cap_format == 1) else // if(gopts.cap_format == 1)
dn.append(wxT(".bmp")); dn.append(wxT(".bmp"));
@ -836,7 +836,7 @@ void systemGbPrint(u8 *data,int len, int pages,int feed,int pal,int cont)
wxString bfn; wxString bfn;
bfn.Printf(wxT("%s-print%02d"), panel->game_name().c_str(), bfn.Printf(wxT("%s-print%02d"), panel->game_name().c_str(),
num++); num++);
if(gopts.cap_format == 0) if(captureFormat == 0)
bfn.append(wxT(".png")); bfn.append(wxT(".png"));
else // if(gopts.cap_format == 1) else // if(gopts.cap_format == 1)
bfn.append(wxT(".bmp")); bfn.append(wxT(".bmp"));
@ -852,7 +852,7 @@ void systemGbPrint(u8 *data,int len, int pages,int feed,int pal,int cont)
systemGreenShift = 5; systemGreenShift = 5;
systemBlueShift = 0; systemBlueShift = 0;
wxString of = fn.GetFullPath(); wxString of = fn.GetFullPath();
bool ret = gopts.cap_format == 0 ? bool ret = captureFormat == 0 ?
utilWritePNGFile(of.mb_fn_str(), 160, lines, (u8 *)to_print) : utilWritePNGFile(of.mb_fn_str(), 160, lines, (u8 *)to_print) :
utilWriteBMPFile(of.mb_fn_str(), 160, lines, (u8 *)to_print); utilWriteBMPFile(of.mb_fn_str(), 160, lines, (u8 *)to_print);
if(ret) { if(ret) {

View File

@ -1,5 +1,6 @@
#include "wxvbam.h" #include "wxvbam.h"
#include "viewsupt.h" #include "viewsupt.h"
#include "..\common\ConfigManager.h"
namespace Viewers namespace Viewers
{ {
@ -1016,13 +1017,13 @@ namespace Viewers
// it's just a suggested name, anyway // it's just a suggested name, anyway
wxString def_name = panel->game_name() + wxT('-') + dname; wxString def_name = panel->game_name() + wxT('-') + dname;
def_name.resize(def_name.size() - 6); // strlen("Viewer") def_name.resize(def_name.size() - 6); // strlen("Viewer")
if(gopts.cap_format) if(captureFormat)
def_name += wxT(".bmp"); def_name += wxT(".bmp");
else else
def_name += wxT(".png"); def_name += wxT(".png");
wxFileDialog dlg(GetGrandParent(), _("Select output file"), bmp_save_dir, def_name, wxFileDialog dlg(GetGrandParent(), _("Select output file"), bmp_save_dir, def_name,
_("PNG images|*.png|BMP images|*.bmp"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT); _("PNG images|*.png|BMP images|*.bmp"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
dlg.SetFilterIndex(gopts.cap_format); dlg.SetFilterIndex(captureFormat);
int ret = dlg.ShowModal(); int ret = dlg.ShowModal();
bmp_save_dir = dlg.GetDirectory(); bmp_save_dir = dlg.GetDirectory();
if(ret != wxID_OK) if(ret != wxID_OK)

View File

@ -109,7 +109,7 @@ class wxBoolEnValidator : public wxGenericValidator
{ {
public: public:
wxBoolEnValidator(bool *vptr) : wxGenericValidator(vptr) {} wxBoolEnValidator(bool *vptr) : wxGenericValidator(vptr) {}
wxBoolEnValidator(bool *vptr, wxWindow_v &cnt, std::vector<bool>rev = std::vector<bool>()) : wxBoolEnValidator(bool *vptr, wxWindow_v &cnt, std::vector<int>rev = std::vector<int>()) :
wxGenericValidator(vptr), controls(cnt), reverse(rev) {} wxGenericValidator(vptr), controls(cnt), reverse(rev) {}
wxBoolEnValidator(const wxBoolEnValidator &v) : wxGenericValidator(v), wxBoolEnValidator(const wxBoolEnValidator &v) : wxGenericValidator(v),
controls(v.controls), reverse(v.reverse) {} controls(v.controls), reverse(v.reverse) {}
@ -118,7 +118,7 @@ public:
wxWindow_v controls; wxWindow_v controls;
// set reverse entries to true if disabled when checkbox checked // set reverse entries to true if disabled when checkbox checked
// controls past the end of the reverse array are not reversed // controls past the end of the reverse array are not reversed
std::vector<bool> reverse; std::vector<int> reverse;
// inherit validate, xferfrom from parent // inherit validate, xferfrom from parent
bool TransferToWindow(); bool TransferToWindow();
}; };
@ -129,7 +129,7 @@ public:
wxBoolIntEnValidator(int *vptr, int val, int mask = ~0) : wxBoolIntEnValidator(int *vptr, int val, int mask = ~0) :
wxBoolIntValidator(vptr, val, mask) {} wxBoolIntValidator(vptr, val, mask) {}
wxBoolIntEnValidator(int *vptr, int val, int mask, wxWindow_v &cnt, wxBoolIntEnValidator(int *vptr, int val, int mask, wxWindow_v &cnt,
std::vector<bool>rev = std::vector<bool>()) : std::vector<int>rev = std::vector<int>()) :
wxBoolIntValidator(vptr, val, mask), controls(cnt), reverse(rev) {} wxBoolIntValidator(vptr, val, mask), controls(cnt), reverse(rev) {}
wxBoolIntEnValidator(const wxBoolIntEnValidator &v) : wxBoolIntEnValidator(const wxBoolIntEnValidator &v) :
wxBoolIntValidator(v), controls(v.controls), reverse(v.reverse) {} wxBoolIntValidator(v), controls(v.controls), reverse(v.reverse) {}
@ -138,7 +138,7 @@ public:
wxWindow_v controls; wxWindow_v controls;
// set reverse entries to true if disabled when checkbox checked // set reverse entries to true if disabled when checkbox checked
// controls past the end of the reverse array are not reversed // controls past the end of the reverse array are not reversed
std::vector<bool> reverse; std::vector<int> reverse;
// inherit validate, xferfrom from parent // inherit validate, xferfrom from parent
bool TransferToWindow(); bool TransferToWindow();
}; };
@ -147,7 +147,7 @@ class wxBoolRevEnValidator : public wxBoolRevValidator
{ {
public: public:
wxBoolRevEnValidator(bool *vptr) : wxBoolRevValidator(vptr) {} wxBoolRevEnValidator(bool *vptr) : wxBoolRevValidator(vptr) {}
wxBoolRevEnValidator(bool *vptr, wxWindow_v &cnt, std::vector<bool>rev = std::vector<bool>()) : wxBoolRevEnValidator(bool *vptr, wxWindow_v &cnt, std::vector<int>rev = std::vector<int>()) :
wxBoolRevValidator(vptr), controls(cnt), reverse(rev) {} wxBoolRevValidator(vptr), controls(cnt), reverse(rev) {}
wxBoolRevEnValidator(const wxBoolRevEnValidator &v) : wxBoolRevValidator(v), wxBoolRevEnValidator(const wxBoolRevEnValidator &v) : wxBoolRevValidator(v),
controls(v.controls), reverse(v.reverse) {} controls(v.controls), reverse(v.reverse) {}
@ -156,7 +156,7 @@ public:
wxWindow_v controls; wxWindow_v controls;
// set reverse entries to true if disabled when checkbox checked // set reverse entries to true if disabled when checkbox checked
// controls past the end of the reverse array are not reversed // controls past the end of the reverse array are not reversed
std::vector<bool> reverse; std::vector<int> reverse;
// inherit validate, xferfrom from parent // inherit validate, xferfrom from parent
bool TransferToWindow(); bool TransferToWindow();
}; };
@ -169,7 +169,7 @@ class wxBoolEnHandler : public wxEvtHandler
{ {
public: public:
wxWindow_v controls; wxWindow_v controls;
std::vector<bool> reverse; std::vector<int> reverse;
void ToggleCheck(wxCommandEvent &ev); void ToggleCheck(wxCommandEvent &ev);
void Enable(wxCommandEvent &ev); void Enable(wxCommandEvent &ev);
void Disable(wxCommandEvent &ev); void Disable(wxCommandEvent &ev);

View File

@ -235,14 +235,14 @@ bool wxColorValidator::TransferFromWindow()
return true; return true;
} }
static void enable(wxWindow_v controls, std::vector<bool>reverse, bool en) static void enable(wxWindow_v controls, std::vector<int>reverse, bool en)
{ {
for(int i = 0; i < controls.size(); i++) for(int i = 0; i < controls.size(); i++)
controls[i]->Enable(reverse.size() <= i || !reverse[i] ? en : !en); controls[i]->Enable(reverse.size() <= i || !reverse[i] ? en : !en);
} }
#define boolen(r) do { \ #define boolen(r) do { \
bool en; \ int en; \
wxCheckBox *cb = wxDynamicCast(GetWindow(), wxCheckBox); \ wxCheckBox *cb = wxDynamicCast(GetWindow(), wxCheckBox); \
if(cb) \ if(cb) \
en = cb->GetValue(); \ en = cb->GetValue(); \

View File

@ -20,7 +20,7 @@
// The built-in vba-over.ini // The built-in vba-over.ini
#include "builtin-over.h" #include "builtin-over.h"
#include "common/ConfigManager.h" #include "../common/ConfigManager.h"
IMPLEMENT_APP(wxvbamApp) IMPLEMENT_APP(wxvbamApp)
IMPLEMENT_DYNAMIC_CLASS(MainFrame, wxFrame) IMPLEMENT_DYNAMIC_CLASS(MainFrame, wxFrame)
@ -43,6 +43,7 @@ static void get_config_path(wxPathList &path, bool exists = true)
add_path(GetResourcesDir()); add_path(GetResourcesDir());
add_path(GetDataDir()); add_path(GetDataDir());
add_path(GetLocalDataDir()); add_path(GetLocalDataDir());
add_path(GetPluginsDir());
} }
static void tack_full_path(wxString &s, const wxString &app = wxEmptyString) static void tack_full_path(wxString &s, const wxString &app = wxEmptyString)
@ -90,7 +91,7 @@ bool wxvbamApp::OnInit()
// *.xr[cs] doesn't work (double the number of scans) // *.xr[cs] doesn't work (double the number of scans)
// 2.9 gives errors for no files found, so manual precheck needed // 2.9 gives errors for no files found, so manual precheck needed
// (yet another double the number of scans) // (yet another double the number of scans)
if(!wxFindFirstFile(wxT("*.xrc")).empty()) if (!wxFindFirstFile(wxT("*.xrc")).empty())
xr->Load(wxT("*.xrc")); xr->Load(wxT("*.xrc"));
if(!wxFindFirstFile(wxT("*.xrs")).empty()) if(!wxFindFirstFile(wxT("*.xrs")).empty())
xr->Load(wxT("*.xrs")); xr->Load(wxT("*.xrs"));
@ -104,13 +105,19 @@ bool wxvbamApp::OnInit()
// this needs to be in a subdir to support other config as well // this needs to be in a subdir to support other config as well
// but subdir flag behaves differently 2.8 vs. 2.9. Oh well. // but subdir flag behaves differently 2.8 vs. 2.9. Oh well.
// NOTE: this does not support XDG (freedesktop.org) paths // NOTE: this does not support XDG (freedesktop.org) paths
cfg = new wxConfig(wxEmptyString, wxEmptyString, wxEmptyString, #ifdef __WXMSW__
cfg = new wxFileConfig(wxT("vbam"), wxEmptyString,
wxStandardPaths::Get().GetPluginsDir() + _T("\\vbam.ini"),
wxEmptyString, wxCONFIG_USE_LOCAL_FILE);
#else
cfg = new wxFileConfig(wxEmptyString, wxEmptyString, wxEmptyString,
wxEmptyString, wxEmptyString,
// style = // style =
wxCONFIG_USE_GLOBAL_FILE|wxCONFIG_USE_LOCAL_FILE| wxCONFIG_USE_GLOBAL_FILE|wxCONFIG_USE_LOCAL_FILE|
wxCONFIG_USE_SUBDIR); wxCONFIG_USE_SUBDIR);
#endif
// set global config for e.g. Windows font mapping // set global config for e.g. Windows font mapping
wxConfig::Set(cfg); wxFileConfig::Set(cfg);
// yet another bug/deficiency in wxConfig: dirs are not created if needed // yet another bug/deficiency in wxConfig: dirs are not created if needed
// since a default config is always written, dirs are always needed // since a default config is always written, dirs are always needed
// Can't figure out statically if using wxFileConfig w/o duplicating wx's // Can't figure out statically if using wxFileConfig w/o duplicating wx's
@ -390,10 +397,10 @@ bool wxvbamApp::OnCmdLineParsed(wxCmdLineParser &cl)
} }
} }
home = strdup((const char*)argv[0].mb_str(wxConvUTF8)); home = strdup((const char*)wxApp::argv[0]);
SetHome(home); SetHome(home);
LoadConfig(); // Parse command line arguments (overrides ini) LoadConfig(); // Parse command line arguments (overrides ini)
ReadOpts(argc, argv); ReadOpts(argc, (char**)argv);
return true; return true;
} }

View File

@ -75,7 +75,7 @@ public:
wxAcceleratorEntry_v accels; wxAcceleratorEntry_v accels;
// the main configuration // the main configuration
wxConfig *cfg; wxFileConfig *cfg;
// vba-over.ini // vba-over.ini
wxFileConfig *overrides; wxFileConfig *overrides;
MainFrame *frame; MainFrame *frame;
@ -285,7 +285,7 @@ private:
// Load a named wxDialog from the XRC file // Load a named wxDialog from the XRC file
wxDialog * LoadXRCDialog(const char * name); wxDialog * LoadXRCDialog(const char * name);
// Load a named wxPropertySheetDialog from the XRC file // Load a named wxPropertySheetDialog from the XRC file
wxPropertySheetDialog * LoadXRCropertySheetDialog(const char * name); wxPropertySheetDialog * LoadXRCropertySheetDialog(const char * name);
// Returns the link mode to set according to the options // Returns the link mode to set according to the options
LinkMode getOptionsLinkMode(); LinkMode getOptionsLinkMode();
#include "cmdhandlers.h" #include "cmdhandlers.h"

View File

@ -506,7 +506,7 @@ void XAudio2_Output::write(u16 * finalWave, int length)
break; break;
} else { } else {
// the maximum number of buffers is currently queued // the maximum number of buffers is currently queued
if( synchronize && !speedup && !gopts.throttle && !gba_joybus_active ) { if( synchronize && !speedup && !throttle && !gba_joybus_active ) {
// wait for one buffer to finish playing // wait for one buffer to finish playing
if (WaitForSingleObject( notify.hBufferEndEvent, 10000 ) == WAIT_TIMEOUT) { if (WaitForSingleObject( notify.hBufferEndEvent, 10000 ) == WAIT_TIMEOUT) {
device_changed = true; device_changed = true;