Moved the core parameters from the wx gui to ConfigManager

This commit is contained in:
skidau 2015-04-27 08:32:03 +00:00
parent b729a75012
commit 103d90d3f3
16 changed files with 193 additions and 198 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -282,7 +282,7 @@ void OpenAL::write(u16 * finalWave, int length)
if( nBuffersProcessed == gopts.audio_buffers ) {
// 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 ) {
static unsigned int i = 0;
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
while( nBuffersProcessed == 0 ) {
winlog( " waiting...\n" );

View File

@ -1,6 +1,8 @@
#include "wxvbam.h"
#include <algorithm>
#include <wx/display.h>
#include "../common/ConfigManager.h"
/*
* disableSfx(F) -> cpuDisableSfx
* 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
// This table's order determines tab order as well
const wxChar * const joynames[NUM_KEYS] = {
wxT("Up"), wxT("Down"), wxT("Left"), wxT("Right"),
wxT("A"), wxT("B"), wxT("L"), wxT("R"),
wxT("Select"), wxT("Start"),
wxT("MotionUp"), wxT("MotionDown"), wxT("MotionLeft"), wxT("MotionRight"),
wxT("AutoA"), wxT("AutoB"),
wxT("Speed"), wxT("Capture"), wxT("GS")
const char * const joynames[NUM_KEYS] = {
("Up"), ("Down"), ("Left"), ("Right"),
("A"), ("B"), ("L"), ("R"),
("Select"), ("Start"),
("MotionUp"), ("MotionDown"), ("MotionLeft"), ("MotionRight"),
("AutoA"), ("AutoB"),
("Speed"), ("Capture"), ("GS")
};
wxJoyKeyBinding defkeys[NUM_KEYS * 2] = {
@ -126,25 +128,61 @@ wxAcceleratorEntry_v sys_accels;
// Note: this table must be sorted in option name order
// Both for better user display and for (fast) searching by name
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
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,
wxTRANSLATE("none|2xsai|super2xsai|supereagle|pixelate|advmame|"
L"bilinear|bilinearplus|scanlines|tvmode|hq2x|lq2x|"
L"simple2x|simple3x|hq3x|simple4x|hq4x|xbrz|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")),
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),
#ifdef __WXMSW__
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")),
#endif
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/Transparent", wxTRANSLATE("Draw on-screen messages transparently"), gopts.osd_transparent),
BOOLOPT("Display/Vsync", wxTRANSLATE("Wait for vertical sync"), gopts.vsync),
/// 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),
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),
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),
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),
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/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).") },
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),
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
BOOLOPT("GBA/AGBPrinter", wxTRANSLATE("Enable AGB printer"), gopts.agbprint),
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
BOOLOPT("GBA/Joybus", wxTRANSLATE("Enable joybus"), gopts.gba_joybus_enabled),
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),
#endif
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
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/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),
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/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),
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),
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),
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),
INTOPT ("General/Throttle", wxTRANSLATE("Throttle game speed, even when accelerated (0-1000%, 0 = disabled)"), gopts.throttle, 0, 1000),
/// 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") },
@ -240,7 +254,6 @@ opt_desc opts[] = {
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),
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)
};
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.
opts_t::opts_t()
{
gba_frameskip = -1;
gb_frameskip = -1;
frameSkip = -1;
gbFrameSkip = -1;
#ifdef __WXMSW__
audio_api = AUD_DIRECTSOUND;
#endif
@ -281,7 +294,7 @@ opts_t::opts_t()
recent = new wxFileHistory(10);
autofire_rate = 1;
gbprint = print_auto_page = true;
apply_patches = true;
autoPatch = true;
}
// for binary_search() and friends
@ -308,7 +321,7 @@ void load_opts()
// change after lang change
// instead, translate when presented to user
wxConfig *cfg = wxGetApp().cfg;
wxFileConfig *cfg = wxGetApp().cfg;
cfg->SetPath(wxT("/"));
// enure there are no unknown options present
@ -319,7 +332,7 @@ void load_opts()
bool cont;
for(cont = cfg->GetFirstEntry(s, grp_idx); cont;
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);
}
for(cont = cfg->GetFirstGroup(s, grp_idx); cont;
@ -347,7 +360,7 @@ void load_opts()
for(cont = cfg->GetFirstGroup(e, key_idx); cont;
cont = cfg->GetNextGroup(e, key_idx)) {
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);
s.resize(poff2);
}
@ -355,11 +368,11 @@ void load_opts()
cont = cfg->GetNextEntry(e, key_idx)) {
int i;
for(i = 0; i < NUM_KEYS; i++)
if(e == joynames[i])
break;
if (e == wxString::FromUTF8(joynames[i]))
break;
if(i == NUM_KEYS) {
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);
s.resize(poff2);
}
@ -370,7 +383,7 @@ void load_opts()
} else {
s.append(wxT('/'));
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);
s.resize(poff);
}
@ -383,7 +396,7 @@ void load_opts()
if(!std::binary_search(&cmdtab[0], &cmdtab[ncmds], dummy, cmditem_lt)) {
s.append(wxT('/'));
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);
s.resize(poff);
}
@ -392,7 +405,7 @@ void load_opts()
s.append(e);
const opt_desc dummy = { s.c_str() };
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);
}
s.resize(poff);
@ -542,7 +555,7 @@ void load_opts()
// Note: run load_opts() first to guarantee all config opts exist
void update_opts()
{
wxConfig *cfg = wxGetApp().cfg;
wxFileConfig *cfg = wxGetApp().cfg;
for(int i = 0; i < num_opts; i++) {
opt_desc &opt = opts[i];
if(opt.stropt) {
@ -757,8 +770,8 @@ bool opt_set(const wxChar *name, const wxChar *val)
int jno = slat[1] - wxT('1');
int kno;
for(kno = 0; kno < NUM_KEYS; kno++)
if(!wxStrcmp(joynames[kno], slat + 3))
break;
if (!wxStrcmp(wxString::FromUTF8(joynames[kno]), slat + 3))
break;
if(kno == NUM_KEYS)
return false;
if(!*val)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -235,14 +235,14 @@ bool wxColorValidator::TransferFromWindow()
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++)
controls[i]->Enable(reverse.size() <= i || !reverse[i] ? en : !en);
}
#define boolen(r) do { \
bool en; \
int en; \
wxCheckBox *cb = wxDynamicCast(GetWindow(), wxCheckBox); \
if(cb) \
en = cb->GetValue(); \

View File

@ -20,7 +20,7 @@
// The built-in vba-over.ini
#include "builtin-over.h"
#include "common/ConfigManager.h"
#include "../common/ConfigManager.h"
IMPLEMENT_APP(wxvbamApp)
IMPLEMENT_DYNAMIC_CLASS(MainFrame, wxFrame)
@ -43,6 +43,7 @@ static void get_config_path(wxPathList &path, bool exists = true)
add_path(GetResourcesDir());
add_path(GetDataDir());
add_path(GetLocalDataDir());
add_path(GetPluginsDir());
}
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)
// 2.9 gives errors for no files found, so manual precheck needed
// (yet another double the number of scans)
if(!wxFindFirstFile(wxT("*.xrc")).empty())
if (!wxFindFirstFile(wxT("*.xrc")).empty())
xr->Load(wxT("*.xrc"));
if(!wxFindFirstFile(wxT("*.xrs")).empty())
xr->Load(wxT("*.xrs"));
@ -104,13 +105,19 @@ bool wxvbamApp::OnInit()
// 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.
// 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,
// style =
wxCONFIG_USE_GLOBAL_FILE|wxCONFIG_USE_LOCAL_FILE|
wxCONFIG_USE_SUBDIR);
#endif
// 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
// since a default config is always written, dirs are always needed
// 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);
LoadConfig(); // Parse command line arguments (overrides ini)
ReadOpts(argc, argv);
ReadOpts(argc, (char**)argv);
return true;
}

View File

@ -75,7 +75,7 @@ public:
wxAcceleratorEntry_v accels;
// the main configuration
wxConfig *cfg;
wxFileConfig *cfg;
// vba-over.ini
wxFileConfig *overrides;
MainFrame *frame;
@ -285,7 +285,7 @@ private:
// Load a named wxDialog from the XRC file
wxDialog * LoadXRCDialog(const char * name);
// 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
LinkMode getOptionsLinkMode();
#include "cmdhandlers.h"

View File

@ -506,7 +506,7 @@ void XAudio2_Output::write(u16 * finalWave, int length)
break;
} else {
// 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
if (WaitForSingleObject( notify.hBufferEndEvent, 10000 ) == WAIT_TIMEOUT) {
device_changed = true;