Move more options to g_owned_opts
* Moves most remaining options toggled by menu items to g_owned_opts and modifies associated usage. * Adds more obervers to handle option changes.
This commit is contained in:
parent
928a61704f
commit
86bef62faf
|
@ -52,6 +52,7 @@ struct EmulatedSystem {
|
|||
extern struct CoreOptions {
|
||||
bool cpuIsMultiBoot = false;
|
||||
bool mirroringEnable = true;
|
||||
bool skipBios = false;
|
||||
bool parseDebug = true;
|
||||
bool speedHack = false;
|
||||
bool speedup = false;
|
||||
|
@ -63,7 +64,6 @@ extern struct CoreOptions {
|
|||
int layerEnable = 0xff00;
|
||||
int rtcEnabled = 0;
|
||||
int saveType = 0;
|
||||
int skipBios = 0;
|
||||
int skipSaveGameBattery = 1;
|
||||
int skipSaveGameCheats = 0;
|
||||
int useBios = 0;
|
||||
|
|
|
@ -42,7 +42,7 @@ int const SOUND_CLOCK_TICKS_ = 280896; // ~1074 samples per frame
|
|||
|
||||
static uint16_t soundFinalWave[1600];
|
||||
long soundSampleRate = 44100;
|
||||
bool soundInterpolation = true;
|
||||
bool g_gbaSoundInterpolation = true;
|
||||
bool soundPaused = true;
|
||||
float soundFiltering = 0.5f;
|
||||
int SOUND_CLOCK_TICKS = SOUND_CLOCK_TICKS_;
|
||||
|
@ -156,7 +156,7 @@ void Gba_Pcm::update(int dac)
|
|||
last_amp = dac;
|
||||
|
||||
int filter = 0;
|
||||
if (soundInterpolation) {
|
||||
if (g_gbaSoundInterpolation) {
|
||||
// base filtering on how long since last sample was output
|
||||
int period = time - last_time;
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ long soundGetSampleRate();
|
|||
void soundSetSampleRate(long sampleRate);
|
||||
|
||||
// Sound settings
|
||||
extern bool soundInterpolation; // 1 if PCM should have low-pass filtering
|
||||
extern bool g_gbaSoundInterpolation; // 1 if PCM should have low-pass filtering
|
||||
extern float soundFiltering; // 0.0 = none, 1.0 = max
|
||||
|
||||
//// GBA sound emulation
|
||||
|
|
|
@ -1036,7 +1036,7 @@ static void update_variables(bool startup)
|
|||
}
|
||||
|
||||
if (sound_changed) {
|
||||
soundInterpolation = option_sndInterpolation;
|
||||
g_gbaSoundInterpolation = option_sndInterpolation;
|
||||
soundFiltering = option_sndFiltering;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@ enum named_opts
|
|||
OPT_SCREEN_SHOT_DIR,
|
||||
OPT_SHOW_SPEED,
|
||||
OPT_SHOW_SPEED_TRANSPARENT,
|
||||
OPT_SKIP_BIOS,
|
||||
OPT_SOUND_FILTERING,
|
||||
OPT_SPEEDUP_THROTTLE,
|
||||
OPT_SPEEDUP_FRAME_SKIP,
|
||||
|
@ -212,7 +213,7 @@ struct option argOptions[] = {
|
|||
{ "show-speed-detailed", no_argument, &showSpeed, 2 },
|
||||
{ "show-speed-normal", no_argument, &showSpeed, 1 },
|
||||
{ "show-speed-transparent", required_argument, 0, OPT_SHOW_SPEED_TRANSPARENT },
|
||||
{ "skip-bios", no_argument, &coreOptions.skipBios, 1 },
|
||||
{ "skip-bios", no_argument, 0, OPT_SKIP_BIOS},
|
||||
{ "skip-save-game-battery", no_argument, &coreOptions.skipSaveGameBattery, 1 },
|
||||
{ "skip-save-game-cheats", no_argument, &coreOptions.skipSaveGameCheats, 1 },
|
||||
{ "sound-filtering", required_argument, 0, OPT_SOUND_FILTERING },
|
||||
|
@ -330,7 +331,7 @@ void LoadConfig()
|
|||
coreOptions.skipSaveGameBattery = ReadPref("skipSaveGameBattery", 1);
|
||||
coreOptions.skipSaveGameCheats = ReadPref("skipSaveGameCheats", 0);
|
||||
soundFiltering = (float)ReadPref("gbaSoundFiltering", 50) / 100.0f;
|
||||
soundInterpolation = ReadPref("gbaSoundInterpolation", 1);
|
||||
g_gbaSoundInterpolation = ReadPref("gbaSoundInterpolation", 1);
|
||||
coreOptions.throttle = ReadPref("throttle", 100);
|
||||
coreOptions.speedup_throttle = ReadPref("speedupThrottle", 100);
|
||||
coreOptions.speedup_frame_skip = ReadPref("speedupFrameSkip", 9);
|
||||
|
@ -819,6 +820,11 @@ int ReadOpts(int argc, char ** argv)
|
|||
}
|
||||
break;
|
||||
|
||||
case OPT_SKIP_BIOS:
|
||||
// --skip-bios
|
||||
coreOptions.skipBios = true;
|
||||
break;
|
||||
|
||||
case OPT_AUTO_FRAME_SKIP:
|
||||
// --auto-frame-skip
|
||||
if (optarg) {
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
wxStaticCast(wxGetApp().frame->FindWindowByName(n), wxDialog)
|
||||
#endif
|
||||
|
||||
void GDBBreak(MainFrame* mf);
|
||||
|
||||
bool cmditem_lt(const struct cmditem& cmd1, const struct cmditem& cmd2)
|
||||
{
|
||||
return wxStrcmp(cmd1.cmd, cmd2.cmd) < 0;
|
||||
|
@ -227,11 +225,7 @@ EVT_HANDLER(RecentReset, "Reset recent ROM list")
|
|||
|
||||
EVT_HANDLER(RecentFreeze, "Freeze recent ROM list (toggle)")
|
||||
{
|
||||
bool menuPress = false;
|
||||
GetMenuOptionBool("RecentFreeze", &menuPress);
|
||||
toggleBooleanVar(&menuPress, &gopts.recent_freeze);
|
||||
SetMenuOption("RecentFreeze", gopts.recent_freeze ? 1 : 0);
|
||||
update_opts();
|
||||
GetMenuOptionConfig("RecentFreeze", config::OptionID::kGenFreezeRecent);
|
||||
}
|
||||
|
||||
// following 10 should really be a single ranged handler
|
||||
|
@ -239,101 +233,51 @@ EVT_HANDLER(RecentFreeze, "Freeze recent ROM list (toggle)")
|
|||
EVT_HANDLER(wxID_FILE1, "Load recent ROM 1")
|
||||
{
|
||||
panel->LoadGame(gopts.recent->GetHistoryFile(0));
|
||||
|
||||
#ifndef NO_DEBUGGER
|
||||
if (gopts.gdb_break_on_load)
|
||||
GDBBreak();
|
||||
#endif
|
||||
}
|
||||
|
||||
EVT_HANDLER(wxID_FILE2, "Load recent ROM 2")
|
||||
{
|
||||
panel->LoadGame(gopts.recent->GetHistoryFile(1));
|
||||
|
||||
#ifndef NO_DEBUGGER
|
||||
if (gopts.gdb_break_on_load)
|
||||
GDBBreak();
|
||||
#endif
|
||||
}
|
||||
|
||||
EVT_HANDLER(wxID_FILE3, "Load recent ROM 3")
|
||||
{
|
||||
panel->LoadGame(gopts.recent->GetHistoryFile(2));
|
||||
|
||||
#ifndef NO_DEBUGGER
|
||||
if (gopts.gdb_break_on_load)
|
||||
GDBBreak();
|
||||
#endif
|
||||
}
|
||||
|
||||
EVT_HANDLER(wxID_FILE4, "Load recent ROM 4")
|
||||
{
|
||||
panel->LoadGame(gopts.recent->GetHistoryFile(3));
|
||||
|
||||
#ifndef NO_DEBUGGER
|
||||
if (gopts.gdb_break_on_load)
|
||||
GDBBreak();
|
||||
#endif
|
||||
}
|
||||
|
||||
EVT_HANDLER(wxID_FILE5, "Load recent ROM 5")
|
||||
{
|
||||
panel->LoadGame(gopts.recent->GetHistoryFile(4));
|
||||
|
||||
#ifndef NO_DEBUGGER
|
||||
if (gopts.gdb_break_on_load)
|
||||
GDBBreak();
|
||||
#endif
|
||||
}
|
||||
|
||||
EVT_HANDLER(wxID_FILE6, "Load recent ROM 6")
|
||||
{
|
||||
panel->LoadGame(gopts.recent->GetHistoryFile(5));
|
||||
|
||||
#ifndef NO_DEBUGGER
|
||||
if (gopts.gdb_break_on_load)
|
||||
GDBBreak();
|
||||
#endif
|
||||
}
|
||||
|
||||
EVT_HANDLER(wxID_FILE7, "Load recent ROM 7")
|
||||
{
|
||||
panel->LoadGame(gopts.recent->GetHistoryFile(6));
|
||||
|
||||
#ifndef NO_DEBUGGER
|
||||
if (gopts.gdb_break_on_load)
|
||||
GDBBreak();
|
||||
#endif
|
||||
}
|
||||
|
||||
EVT_HANDLER(wxID_FILE8, "Load recent ROM 8")
|
||||
{
|
||||
panel->LoadGame(gopts.recent->GetHistoryFile(7));
|
||||
|
||||
#ifndef NO_DEBUGGER
|
||||
if (gopts.gdb_break_on_load)
|
||||
GDBBreak();
|
||||
#endif
|
||||
}
|
||||
|
||||
EVT_HANDLER(wxID_FILE9, "Load recent ROM 9")
|
||||
{
|
||||
panel->LoadGame(gopts.recent->GetHistoryFile(8));
|
||||
|
||||
#ifndef NO_DEBUGGER
|
||||
if (gopts.gdb_break_on_load)
|
||||
GDBBreak();
|
||||
#endif
|
||||
}
|
||||
|
||||
EVT_HANDLER(wxID_FILE10, "Load recent ROM 10")
|
||||
{
|
||||
panel->LoadGame(gopts.recent->GetHistoryFile(9));
|
||||
|
||||
#ifndef NO_DEBUGGER
|
||||
if (gopts.gdb_break_on_load)
|
||||
GDBBreak();
|
||||
#endif
|
||||
}
|
||||
|
||||
static const struct rom_maker {
|
||||
|
@ -1722,11 +1666,7 @@ EVT_HANDLER_MASK(LoadGameRecent, "Load most recent save", CMDEN_SAVST)
|
|||
|
||||
EVT_HANDLER(LoadGameAutoLoad, "Auto load most recent save (toggle)")
|
||||
{
|
||||
bool menuPress = false;
|
||||
GetMenuOptionBool("LoadGameAutoLoad", &menuPress);
|
||||
toggleBooleanVar(&menuPress, &gopts.autoload_state);
|
||||
SetMenuOption("LoadGameAutoLoad", gopts.autoload_state ? 1 : 0);
|
||||
update_opts();
|
||||
GetMenuOptionConfig("LoadGameAutoLoad", config::OptionID::kGenAutoLoadLastState);
|
||||
}
|
||||
|
||||
EVT_HANDLER_MASK(LoadGame01, "Load saved state 1", CMDEN_SAVST)
|
||||
|
@ -1976,11 +1916,7 @@ EVT_HANDLER_MASK(CheatsSearch, "Create cheat...", CMDEN_GB | CMDEN_GBA)
|
|||
// new
|
||||
EVT_HANDLER(CheatsAutoSaveLoad, "Auto save/load cheats (toggle)")
|
||||
{
|
||||
bool menuPress = false;
|
||||
GetMenuOptionBool("CheatsAutoSaveLoad", &menuPress);
|
||||
toggleBooleanVar(&menuPress, &gopts.autoload_cheats);
|
||||
SetMenuOption("CheatsAutoSaveLoad", gopts.autoload_cheats ? 1 : 0);
|
||||
update_opts();
|
||||
GetMenuOptionConfig("CheatsAutoSaveLoad", config::OptionID::kPrefAutoSaveLoadCheatList);
|
||||
}
|
||||
|
||||
// was CheatsDisable
|
||||
|
@ -1998,7 +1934,7 @@ EVT_HANDLER(CheatsEnable, "Enable cheats (toggle)")
|
|||
EVT_HANDLER(ColorizerHack, "Enable Colorizer Hack (toggle)")
|
||||
{
|
||||
GetMenuOptionConfig("ColorizerHack", config::OptionID::kGBColorizerHack);
|
||||
if (OPTION(kGBColorizerHack) && gopts.use_bios_file_gb) {
|
||||
if (OPTION(kGBColorizerHack) && OPTION(kPrefUseBiosGB)) {
|
||||
wxLogError(
|
||||
_("Cannot use Colorizer Hack when Game Boy BIOS File is enabled."));
|
||||
SetMenuOption("ColorizerHack", 0);
|
||||
|
@ -2335,8 +2271,7 @@ EVT_HANDLER(DebugGDBPort, "Configure port...")
|
|||
EVT_HANDLER(DebugGDBBreakOnLoad, "Break on load")
|
||||
{
|
||||
#ifndef NO_DEBUGGER
|
||||
GetMenuOptionBool("DebugGDBBreakOnLoad", &gopts.gdb_break_on_load);
|
||||
update_opts();
|
||||
GetMenuOptionConfig("DebugGDBBreakOnLoad", config::OptionID::kPrefGDBBreakOnLoad);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2925,42 +2860,32 @@ EVT_HANDLER(Printer, "Enable printer emulation")
|
|||
|
||||
EVT_HANDLER(PrintGather, "Automatically gather a full page before printing")
|
||||
{
|
||||
GetMenuOptionBool("PrintGather", &gopts.print_auto_page);
|
||||
update_opts();
|
||||
GetMenuOptionConfig("PrintGather", config::OptionID::kGBPrintAutoPage);
|
||||
}
|
||||
|
||||
EVT_HANDLER(PrintSnap, "Automatically save printouts as screen captures with -print suffix")
|
||||
{
|
||||
GetMenuOptionBool("PrintSnap", &gopts.print_screen_cap);
|
||||
update_opts();
|
||||
GetMenuOptionConfig("PrintSnap", config::OptionID::kGBPrintScreenCap);
|
||||
}
|
||||
|
||||
EVT_HANDLER(GBASoundInterpolation, "GBA sound interpolation")
|
||||
{
|
||||
GetMenuOptionBool("GBASoundInterpolation", &soundInterpolation);
|
||||
update_opts();
|
||||
GetMenuOptionConfig("GBASoundInterpolation", config::OptionID::kSoundGBAInterpolation);
|
||||
}
|
||||
|
||||
EVT_HANDLER(GBDeclicking, "GB sound declicking")
|
||||
{
|
||||
GetMenuOptionBool("GBDeclicking", &gopts.gb_declick);
|
||||
// note that setting declick may reset gb sound engine
|
||||
gbSoundSetDeclicking(gopts.gb_declick);
|
||||
update_opts();
|
||||
GetMenuOptionConfig("GBDeclicking", config::OptionID::kSoundGBDeclicking);
|
||||
}
|
||||
|
||||
EVT_HANDLER(GBEnhanceSound, "Enable GB sound effects")
|
||||
{
|
||||
GetMenuOptionBool("GBEnhanceSound", &gopts.gb_effects_config_enabled);
|
||||
gb_effects_config.enabled = gopts.gb_effects_config_enabled;
|
||||
update_opts();
|
||||
GetMenuOptionConfig("GBEnhanceSound", config::OptionID::kSoundGBEnableEffects);
|
||||
}
|
||||
|
||||
EVT_HANDLER(GBSurround, "GB surround sound effect (%)")
|
||||
{
|
||||
GetMenuOptionBool("GBSurround",&gopts.gb_effects_config_surround);
|
||||
gb_effects_config.surround = gopts.gb_effects_config_surround;
|
||||
update_opts();
|
||||
GetMenuOptionConfig("GBSurround",config::OptionID::kSoundGBSurround);
|
||||
}
|
||||
|
||||
EVT_HANDLER(AGBPrinter, "Enable AGB printer")
|
||||
|
@ -2970,22 +2895,12 @@ EVT_HANDLER(AGBPrinter, "Enable AGB printer")
|
|||
|
||||
EVT_HANDLER_MASK(GBALcdFilter, "Enable LCD filter", CMDEN_GBA)
|
||||
{
|
||||
bool menuPress = false;
|
||||
GetMenuOptionBool("GBALcdFilter", &menuPress);
|
||||
toggleBooleanVar(&menuPress, &gopts.gba_lcd_filter);
|
||||
SetMenuOption("GBALcdFilter", gopts.gba_lcd_filter ? 1 : 0);
|
||||
utilUpdateSystemColorMaps(gopts.gba_lcd_filter);
|
||||
update_opts();
|
||||
GetMenuOptionConfig("GBALcdFilter", config::OptionID::kGBALCDFilter);
|
||||
}
|
||||
|
||||
EVT_HANDLER_MASK(GBLcdFilter, "Enable LCD filter", CMDEN_GB)
|
||||
{
|
||||
bool menuPress = false;
|
||||
GetMenuOptionBool("GBLcdFilter", &menuPress);
|
||||
toggleBooleanVar(&menuPress, &gopts.gb_lcd_filter);
|
||||
SetMenuOption("GBLcdFilter", gopts.gb_lcd_filter ? 1 : 0);
|
||||
utilUpdateSystemColorMaps(gopts.gb_lcd_filter);
|
||||
update_opts();
|
||||
GetMenuOptionConfig("GBLcdFilter", config::OptionID::kGBLCDFilter);
|
||||
}
|
||||
|
||||
EVT_HANDLER(GBColorOption, "Enable GB color option")
|
||||
|
@ -3005,18 +2920,7 @@ EVT_HANDLER(KeepOnTop, "Keep window on top")
|
|||
|
||||
EVT_HANDLER(StatusBar, "Enable status bar")
|
||||
{
|
||||
GetMenuOptionBool("StatusBar", &gopts.statusbar);
|
||||
update_opts();
|
||||
MainFrame* mf = wxGetApp().frame;
|
||||
|
||||
if (gopts.statusbar)
|
||||
mf->GetStatusBar()->Show();
|
||||
else
|
||||
mf->GetStatusBar()->Hide();
|
||||
|
||||
mf->SendSizeEvent();
|
||||
panel->AdjustSize(false);
|
||||
mf->SendSizeEvent();
|
||||
GetMenuOptionConfig("StatusBar", config::OptionID::kGenStatusBar);
|
||||
}
|
||||
|
||||
EVT_HANDLER(NoStatusMsg, "Disable on-screen status messages")
|
||||
|
@ -3052,43 +2956,32 @@ EVT_HANDLER(Transparent, "Draw on-screen messages transparently")
|
|||
|
||||
EVT_HANDLER(SkipIntro, "Skip BIOS initialization")
|
||||
{
|
||||
GetMenuOptionInt("SkipIntro", &coreOptions.skipBios, 1);
|
||||
update_opts();
|
||||
GetMenuOptionConfig("SkipIntro", config::OptionID::kPrefSkipBios);
|
||||
}
|
||||
|
||||
EVT_HANDLER(BootRomEn, "Use the specified BIOS file for GBA")
|
||||
{
|
||||
GetMenuOptionBool("BootRomEn", &gopts.use_bios_file_gba);
|
||||
update_opts();
|
||||
GetMenuOptionConfig("BootRomEn", config::OptionID::kPrefUseBiosGBA);
|
||||
}
|
||||
|
||||
EVT_HANDLER(BootRomGB, "Use the specified BIOS file for GB")
|
||||
{
|
||||
int val = 0;
|
||||
GetMenuOptionInt("BootRomGB", &val, 1);
|
||||
|
||||
if (val == 1 && OPTION(kGBColorizerHack)) {
|
||||
GetMenuOptionConfig("BootRomGB", config::OptionID::kPrefUseBiosGB);
|
||||
if (OPTION(kPrefUseBiosGB) && OPTION(kGBColorizerHack)) {
|
||||
wxLogError(_("Cannot use Game Boy BIOS when Colorizer Hack is enabled."));
|
||||
val = 0;
|
||||
SetMenuOption("BootRomGB", 0);
|
||||
OPTION(kPrefUseBiosGB) = false;
|
||||
}
|
||||
|
||||
gopts.use_bios_file_gb = val;
|
||||
|
||||
update_opts();
|
||||
}
|
||||
|
||||
EVT_HANDLER(BootRomGBC, "Use the specified BIOS file for GBC")
|
||||
{
|
||||
GetMenuOptionBool("BootRomGBC", &gopts.use_bios_file_gbc);
|
||||
update_opts();
|
||||
GetMenuOptionConfig("BootRomGBC", config::OptionID::kPrefUseBiosGBC);
|
||||
}
|
||||
|
||||
EVT_HANDLER(VSync, "Wait for vertical sync")
|
||||
{
|
||||
GetMenuOptionBool("VSync", &gopts.vsync);
|
||||
update_opts();
|
||||
panel->ResetPanel();
|
||||
GetMenuOptionConfig("VSync", config::OptionID::kPrefVsync);
|
||||
}
|
||||
|
||||
void MainFrame::EnableNetworkMenu()
|
||||
|
@ -3098,7 +2991,7 @@ void MainFrame::EnableNetworkMenu()
|
|||
if (gopts.gba_link_type != 0)
|
||||
cmd_enable |= CMDEN_LINK_ANY;
|
||||
|
||||
if (gopts.link_proto)
|
||||
if (OPTION(kGBALinkProto))
|
||||
cmd_enable &= ~CMDEN_LINK_ANY;
|
||||
|
||||
enable_menus();
|
||||
|
@ -3133,7 +3026,7 @@ EVT_HANDLER_MASK(LanLink, "Start Network link", CMDEN_LINK_ANY)
|
|||
return;
|
||||
}
|
||||
|
||||
if (gopts.link_proto) {
|
||||
if (OPTION(kGBALinkProto)) {
|
||||
// see above comment
|
||||
wxLogError(_("Network is not supported in local mode."));
|
||||
return;
|
||||
|
@ -3172,22 +3065,17 @@ EVT_HANDLER(LinkType4Gameboy, "Link Gameboy")
|
|||
|
||||
EVT_HANDLER(LinkAuto, "Enable link at boot")
|
||||
{
|
||||
GetMenuOptionBool("LinkAuto", &gopts.link_auto);
|
||||
update_opts();
|
||||
GetMenuOptionConfig("LinkAuto", config::OptionID::kGBALinkAuto);
|
||||
}
|
||||
|
||||
EVT_HANDLER(SpeedOn, "Enable faster network protocol by default")
|
||||
{
|
||||
GetMenuOptionBool("SpeedOn", &gopts.link_hacks);
|
||||
update_opts();
|
||||
GetMenuOptionConfig("SpeedOn", config::OptionID::kGBALinkFast);
|
||||
}
|
||||
|
||||
EVT_HANDLER(LinkProto, "Local host IPC")
|
||||
{
|
||||
GetMenuOptionBool("LinkProto", &gopts.link_proto);
|
||||
update_opts();
|
||||
enable_menus();
|
||||
EnableNetworkMenu();
|
||||
GetMenuOptionConfig("LinkProto", config::OptionID::kGBALinkHost);
|
||||
}
|
||||
|
||||
EVT_HANDLER(LinkConfigure, "Link options...")
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <wx/log.h>
|
||||
|
||||
#include "../System.h"
|
||||
#include "../gba/Sound.h"
|
||||
#include "../gb/gbGlobals.h"
|
||||
#include "opts.h"
|
||||
|
||||
|
@ -165,30 +166,46 @@ std::array<Option, kNbOptions>& Option::All() {
|
|||
/// GB
|
||||
wxString gb_bios = wxEmptyString;
|
||||
bool colorizer_hack = false;
|
||||
bool gb_lcd_filter = false;
|
||||
wxString gbc_bios = wxEmptyString;
|
||||
bool print_auto_page = true;
|
||||
bool print_screen_cap = false;
|
||||
wxString gb_rom_dir = wxEmptyString;
|
||||
wxString gbc_rom_dir = wxEmptyString;
|
||||
|
||||
/// GBA
|
||||
bool gba_lcd_filter = false;
|
||||
bool link_auto = false;
|
||||
bool link_hacks = true;
|
||||
bool link_proto = false;
|
||||
wxString gba_rom_dir;
|
||||
|
||||
/// Core
|
||||
bool agb_print = false;
|
||||
bool auto_frame_skip = false;
|
||||
bool auto_patch = true;
|
||||
bool autoload_cheats = false;
|
||||
uint32_t capture_format = 0;
|
||||
bool disable_status_messages = false;
|
||||
uint32_t flash_size = 0;
|
||||
int32_t frame_skip = 0;
|
||||
bool gdb_break_on_load = false;
|
||||
bool pause_when_inactive = false;
|
||||
uint32_t show_speed = 0;
|
||||
bool show_speed_transparent = false;
|
||||
bool use_bios_file_gb = false;
|
||||
bool use_bios_file_gba = false;
|
||||
bool use_bios_file_gbc = false;
|
||||
bool vsync = false;
|
||||
|
||||
/// General
|
||||
bool autoload_state = false;
|
||||
wxString battery_dir = wxEmptyString;
|
||||
bool recent_freeze = false;
|
||||
wxString recording_dir = wxEmptyString;
|
||||
wxString screenshot_dir = wxEmptyString;
|
||||
wxString state_dir = wxEmptyString;
|
||||
bool statusbar = false;
|
||||
uint32_t ini_version = kIniLatestVersion;
|
||||
|
||||
/// Geometry
|
||||
|
@ -202,6 +219,11 @@ std::array<Option, kNbOptions>& Option::All() {
|
|||
/// UI
|
||||
bool allow_keyboard_background_input = false;
|
||||
bool allow_joystick_background_input = true;
|
||||
|
||||
/// Sound
|
||||
bool gb_declicking = true;
|
||||
bool gb_effects_config_enabled = false;
|
||||
bool gb_effects_config_surround = false;
|
||||
};
|
||||
static OwnedOptions g_owned_opts;
|
||||
|
||||
|
@ -227,40 +249,40 @@ std::array<Option, kNbOptions>& Option::All() {
|
|||
Option(OptionID::kGBBiosFile, &g_owned_opts.gb_bios),
|
||||
Option(OptionID::kGBColorOption, &gbColorOption),
|
||||
Option(OptionID::kGBColorizerHack, &g_owned_opts.colorizer_hack),
|
||||
Option(OptionID::kGBLCDFilter, &gopts.gb_lcd_filter),
|
||||
Option(OptionID::kGBLCDFilter, &g_owned_opts.gb_lcd_filter),
|
||||
Option(OptionID::kGBGBCBiosFile, &g_owned_opts.gbc_bios),
|
||||
Option(OptionID::kGBPalette0, systemGbPalette),
|
||||
Option(OptionID::kGBPalette1, systemGbPalette + 8),
|
||||
Option(OptionID::kGBPalette2, systemGbPalette + 16),
|
||||
Option(OptionID::kGBPrintAutoPage, &gopts.print_auto_page),
|
||||
Option(OptionID::kGBPrintScreenCap, &gopts.print_screen_cap),
|
||||
Option(OptionID::kGBPrintAutoPage, &g_owned_opts.print_auto_page),
|
||||
Option(OptionID::kGBPrintScreenCap, &g_owned_opts.print_screen_cap),
|
||||
Option(OptionID::kGBROMDir, &g_owned_opts.gb_rom_dir),
|
||||
Option(OptionID::kGBGBCROMDir, &g_owned_opts.gbc_rom_dir),
|
||||
|
||||
/// GBA
|
||||
Option(OptionID::kGBABiosFile, &gopts.gba_bios),
|
||||
Option(OptionID::kGBALCDFilter, &gopts.gba_lcd_filter),
|
||||
Option(OptionID::kGBALCDFilter, &g_owned_opts.gba_lcd_filter),
|
||||
#ifndef NO_LINK
|
||||
Option(OptionID::kGBALinkAuto, &gopts.link_auto),
|
||||
Option(OptionID::kGBALinkFast, &gopts.link_hacks),
|
||||
Option(OptionID::kGBALinkAuto, &g_owned_opts.link_auto),
|
||||
Option(OptionID::kGBALinkFast, &g_owned_opts.link_hacks),
|
||||
Option(OptionID::kGBALinkHost, &gopts.link_host),
|
||||
Option(OptionID::kGBAServerIP, &gopts.server_ip),
|
||||
Option(OptionID::kGBALinkPort, &gopts.link_port, 0, 65535),
|
||||
Option(OptionID::kGBALinkProto, &gopts.link_proto),
|
||||
Option(OptionID::kGBALinkProto, &g_owned_opts.link_proto),
|
||||
Option(OptionID::kGBALinkTimeout, &gopts.link_timeout, 0, 9999999),
|
||||
Option(OptionID::kGBALinkType, &gopts.gba_link_type, 0, 5),
|
||||
#endif
|
||||
Option(OptionID::kGBAROMDir, &g_owned_opts.gba_rom_dir),
|
||||
|
||||
/// General
|
||||
Option(OptionID::kGenAutoLoadLastState, &gopts.autoload_state),
|
||||
Option(OptionID::kGenAutoLoadLastState, &g_owned_opts.autoload_state),
|
||||
Option(OptionID::kGenBatteryDir, &g_owned_opts.battery_dir),
|
||||
Option(OptionID::kGenFreezeRecent, &gopts.recent_freeze),
|
||||
Option(OptionID::kGenFreezeRecent, &g_owned_opts.recent_freeze),
|
||||
Option(OptionID::kGenRecordingDir, &g_owned_opts.recording_dir),
|
||||
Option(OptionID::kGenRewindInterval, &gopts.rewind_interval, 0, 600),
|
||||
Option(OptionID::kGenScreenshotDir, &g_owned_opts.screenshot_dir),
|
||||
Option(OptionID::kGenStateDir, &g_owned_opts.state_dir),
|
||||
Option(OptionID::kGenStatusBar, &gopts.statusbar),
|
||||
Option(OptionID::kGenStatusBar, &g_owned_opts.statusbar),
|
||||
Option(OptionID::kGenIniVersion, &g_owned_opts.ini_version, 0, std::numeric_limits<uint32_t>::max()),
|
||||
|
||||
/// Joypad
|
||||
|
@ -275,7 +297,7 @@ std::array<Option, kNbOptions>& Option::All() {
|
|||
Option(OptionID::kPrefAgbPrint, &g_owned_opts.agb_print),
|
||||
Option(OptionID::kPrefAutoFrameSkip, &g_owned_opts.auto_frame_skip),
|
||||
Option(OptionID::kPrefAutoPatch, &g_owned_opts.auto_patch),
|
||||
Option(OptionID::kPrefAutoSaveLoadCheatList, &gopts.autoload_cheats),
|
||||
Option(OptionID::kPrefAutoSaveLoadCheatList, &g_owned_opts.autoload_cheats),
|
||||
Option(OptionID::kPrefBorderAutomatic, &gbBorderAutomatic),
|
||||
Option(OptionID::kPrefBorderOn, &gbBorderOn),
|
||||
Option(OptionID::kPrefCaptureFormat, &g_owned_opts.capture_format, 0, 1),
|
||||
|
@ -286,7 +308,7 @@ std::array<Option, kNbOptions>& Option::All() {
|
|||
Option(OptionID::kPrefFrameSkip, &g_owned_opts.frame_skip, -1, 9),
|
||||
Option(OptionID::kPrefGBPaletteOption, &gbPaletteOption, 0, 2),
|
||||
Option(OptionID::kPrefGBPrinter, &coreOptions.winGbPrinterEnabled, 0, 1),
|
||||
Option(OptionID::kPrefGDBBreakOnLoad, &gopts.gdb_break_on_load),
|
||||
Option(OptionID::kPrefGDBBreakOnLoad, &g_owned_opts.gdb_break_on_load),
|
||||
Option(OptionID::kPrefGDBPort, &gopts.gdb_port, 0, 65535),
|
||||
#ifndef NO_LINK
|
||||
Option(OptionID::kPrefLinkNumPlayers, &gopts.link_num_players, 2, 4),
|
||||
|
@ -297,17 +319,17 @@ std::array<Option, kNbOptions>& Option::All() {
|
|||
Option(OptionID::kPrefSaveType, &coreOptions.cpuSaveType, 0, 5),
|
||||
Option(OptionID::kPrefShowSpeed, &g_owned_opts.show_speed, 0, 2),
|
||||
Option(OptionID::kPrefShowSpeedTransparent, &g_owned_opts.show_speed_transparent),
|
||||
Option(OptionID::kPrefSkipBios, &coreOptions.skipBios, 0, 1),
|
||||
Option(OptionID::kPrefSkipBios, &coreOptions.skipBios),
|
||||
Option(OptionID::kPrefSkipSaveGameCheats, &coreOptions.skipSaveGameCheats, 0, 1),
|
||||
Option(OptionID::kPrefSkipSaveGameBattery, &coreOptions.skipSaveGameBattery, 0, 1),
|
||||
Option(OptionID::kPrefThrottle, &coreOptions.throttle, 0, 450),
|
||||
Option(OptionID::kPrefSpeedupThrottle, &coreOptions.speedup_throttle, 0, 3000),
|
||||
Option(OptionID::kPrefSpeedupFrameSkip, &coreOptions.speedup_frame_skip, 0, 300),
|
||||
Option(OptionID::kPrefSpeedupThrottleFrameSkip, &coreOptions.speedup_throttle_frame_skip),
|
||||
Option(OptionID::kPrefUseBiosGB, &gopts.use_bios_file_gb),
|
||||
Option(OptionID::kPrefUseBiosGBA, &gopts.use_bios_file_gba),
|
||||
Option(OptionID::kPrefUseBiosGBC, &gopts.use_bios_file_gbc),
|
||||
Option(OptionID::kPrefVsync, &gopts.vsync),
|
||||
Option(OptionID::kPrefUseBiosGB, &g_owned_opts.use_bios_file_gb),
|
||||
Option(OptionID::kPrefUseBiosGBA, &g_owned_opts.use_bios_file_gba),
|
||||
Option(OptionID::kPrefUseBiosGBC, &g_owned_opts.use_bios_file_gbc),
|
||||
Option(OptionID::kPrefVsync, &g_owned_opts.vsync),
|
||||
|
||||
/// Geometry
|
||||
Option(OptionID::kGeomFullScreen, &g_owned_opts.fullscreen),
|
||||
|
@ -329,12 +351,12 @@ std::array<Option, kNbOptions>& Option::All() {
|
|||
Option(OptionID::kSoundBuffers, &gopts.audio_buffers, 2, 10),
|
||||
Option(OptionID::kSoundEnable, &gopts.sound_en, 0, 0x30f),
|
||||
Option(OptionID::kSoundGBAFiltering, &gopts.gba_sound_filter, 0, 100),
|
||||
Option(OptionID::kSoundGBAInterpolation, &gopts.soundInterpolation),
|
||||
Option(OptionID::kSoundGBDeclicking, &gopts.gb_declick),
|
||||
Option(OptionID::kSoundGBAInterpolation, &g_gbaSoundInterpolation),
|
||||
Option(OptionID::kSoundGBDeclicking, &g_owned_opts.gb_declicking),
|
||||
Option(OptionID::kSoundGBEcho, &gopts.gb_echo, 0, 100),
|
||||
Option(OptionID::kSoundGBEnableEffects, &gopts.gb_effects_config_enabled),
|
||||
Option(OptionID::kSoundGBEnableEffects, &g_owned_opts.gb_effects_config_enabled),
|
||||
Option(OptionID::kSoundGBStereo, &gopts.gb_stereo, 0, 100),
|
||||
Option(OptionID::kSoundGBSurround, &gopts.gb_effects_config_surround),
|
||||
Option(OptionID::kSoundGBSurround, &g_owned_opts.gb_effects_config_surround),
|
||||
Option(OptionID::kSoundQuality, &gopts.sound_qual),
|
||||
Option(OptionID::kSoundVolume, &gopts.sound_vol, 0, 200),
|
||||
};
|
||||
|
|
|
@ -95,7 +95,7 @@ static constexpr std::array<Option::Type, kNbOptions> kOptionsTypes = {
|
|||
/*kPrefSaveType*/ Option::Type::kInt,
|
||||
/*kPrefShowSpeed*/ Option::Type::kUnsigned,
|
||||
/*kPrefShowSpeedTransparent*/ Option::Type::kBool,
|
||||
/*kPrefSkipBios*/ Option::Type::kInt,
|
||||
/*kPrefSkipBios*/ Option::Type::kBool,
|
||||
/*kPrefSkipSaveGameCheats*/ Option::Type::kInt,
|
||||
/*kPrefSkipSaveGameBattery*/ Option::Type::kInt,
|
||||
/*kPrefThrottle*/ Option::Type::kUnsigned,
|
||||
|
|
|
@ -135,7 +135,7 @@ public:
|
|||
wxString connmsg;
|
||||
wxString title;
|
||||
SetLinkTimeout(gopts.link_timeout);
|
||||
EnableSpeedHacks(gopts.link_hacks);
|
||||
EnableSpeedHacks(OPTION(kGBALinkFast));
|
||||
EnableLinkServer(server, gopts.link_num_players - 1);
|
||||
|
||||
if (server) {
|
||||
|
@ -2703,7 +2703,7 @@ bool MainFrame::BindControls()
|
|||
// set pointers for checkable menu items
|
||||
// and set initial checked status
|
||||
if (checkable_mi.size()) {
|
||||
MenuOptionBool("RecentFreeze", gopts.recent_freeze);
|
||||
MenuOptionBool("RecentFreeze", OPTION(kGenFreezeRecent));
|
||||
MenuOptionBool("Pause", paused);
|
||||
MenuOptionIntMask("SoundChannel1", gopts.sound_en, (1 << 0));
|
||||
MenuOptionIntMask("SoundChannel2", gopts.sound_en, (1 << 1));
|
||||
|
@ -2719,12 +2719,12 @@ bool MainFrame::BindControls()
|
|||
MenuOptionIntMask("VideoLayersWIN0", coreOptions.layerSettings, (1 << 13));
|
||||
MenuOptionIntMask("VideoLayersWIN1", coreOptions.layerSettings, (1 << 14));
|
||||
MenuOptionIntMask("VideoLayersOBJWIN", coreOptions.layerSettings, (1 << 15));
|
||||
MenuOptionBool("CheatsAutoSaveLoad", gopts.autoload_cheats);
|
||||
MenuOptionBool("CheatsAutoSaveLoad", OPTION(kPrefAutoSaveLoadCheatList));
|
||||
MenuOptionIntMask("CheatsEnable", coreOptions.cheatsEnabled, 1);
|
||||
SetMenuOption("ColorizerHack", OPTION(kGBColorizerHack));
|
||||
MenuOptionIntMask("KeepSaves", coreOptions.skipSaveGameBattery, 1);
|
||||
MenuOptionIntMask("KeepCheats", coreOptions.skipSaveGameCheats, 1);
|
||||
MenuOptionBool("LoadGameAutoLoad", gopts.autoload_state);
|
||||
MenuOptionBool("LoadGameAutoLoad", OPTION(kGenAutoLoadLastState));
|
||||
MenuOptionIntMask("JoypadAutofireA", autofire, KEYM_A);
|
||||
MenuOptionIntMask("JoypadAutofireB", autofire, KEYM_B);
|
||||
MenuOptionIntMask("JoypadAutofireL", autofire, KEYM_L);
|
||||
|
@ -3499,20 +3499,9 @@ bool MainFrame::BindControls()
|
|||
#endif
|
||||
|
||||
// delayed fullscreen
|
||||
if (wxGetApp().pending_fullscreen)
|
||||
if (wxGetApp().pending_fullscreen) {
|
||||
panel->ShowFullScreen(true);
|
||||
|
||||
MainFrame* mf = wxGetApp().frame;
|
||||
|
||||
if (gopts.statusbar)
|
||||
mf->GetStatusBar()->Show();
|
||||
else
|
||||
mf->GetStatusBar()->Hide();
|
||||
|
||||
if (OPTION(kDispKeepOnTop))
|
||||
mf->SetWindowStyle(mf->GetWindowStyle() | wxSTAY_ON_TOP);
|
||||
else
|
||||
mf->SetWindowStyle(mf->GetWindowStyle() & ~wxSTAY_ON_TOP);
|
||||
}
|
||||
|
||||
#ifndef NO_LINK
|
||||
LinkMode link_mode = GetConfiguredLinkMode();
|
||||
|
@ -3540,7 +3529,7 @@ bool MainFrame::BindControls()
|
|||
if (GetLinkMode() != LINK_DISCONNECTED) {
|
||||
cmd_enable |= CMDEN_LINK_ANY;
|
||||
SetLinkTimeout(gopts.link_timeout);
|
||||
EnableSpeedHacks(gopts.link_hacks);
|
||||
EnableSpeedHacks(OPTION(kGBALinkFast));
|
||||
}
|
||||
|
||||
EnableNetworkMenu();
|
||||
|
|
|
@ -25,30 +25,17 @@ extern struct opts_t {
|
|||
/// Display
|
||||
wxVideoMode fs_mode;
|
||||
|
||||
/// GB
|
||||
bool gb_lcd_filter = false;
|
||||
bool print_auto_page = true;
|
||||
bool print_screen_cap = false;
|
||||
|
||||
/// GBA
|
||||
wxString gba_bios;
|
||||
bool gba_lcd_filter = false;
|
||||
bool link_auto = false;
|
||||
bool link_hacks = true;
|
||||
// quick fix for issues #48 and #445
|
||||
wxString link_host = "127.0.0.1";
|
||||
wxString server_ip = "*";
|
||||
uint32_t link_port = 5738;
|
||||
bool link_proto = false;
|
||||
int link_timeout = 500;
|
||||
int gba_link_type;
|
||||
|
||||
/// General
|
||||
bool autoload_state = false;
|
||||
bool autoload_cheats = false;
|
||||
bool recent_freeze = false;
|
||||
int rewind_interval = 0;
|
||||
bool statusbar = false;
|
||||
|
||||
/// Joypad
|
||||
std::map<config::GameControl, std::set<config::UserInput>>
|
||||
|
@ -60,14 +47,9 @@ extern struct opts_t {
|
|||
wxAcceleratorEntry_v accels;
|
||||
|
||||
/// Core
|
||||
bool gdb_break_on_load = false;
|
||||
int gdb_port = 55555;
|
||||
int link_num_players = 2;
|
||||
int max_scale = 0;
|
||||
bool use_bios_file_gb = false;
|
||||
bool use_bios_file_gba = false;
|
||||
bool use_bios_file_gbc = false;
|
||||
bool vsync = false;
|
||||
|
||||
/// Sound
|
||||
int audio_api = 0;
|
||||
|
@ -77,13 +59,9 @@ extern struct opts_t {
|
|||
wxString audio_dev;
|
||||
int sound_en = 0x30f; // soundSetEnable()
|
||||
int gba_sound_filter = 50;
|
||||
bool soundInterpolation;
|
||||
bool gb_declick = true;
|
||||
int gb_echo = 20;
|
||||
bool gb_effects_config_enabled;
|
||||
bool dsound_hw_accel;
|
||||
int gb_stereo = 15;
|
||||
bool gb_effects_config_surround;
|
||||
int sound_qual = 1; // soundSetSampleRate() / gbSoundSetSampleRate()
|
||||
int sound_vol = 100; // soundSetVolume()
|
||||
bool upmix = false; // xa2 only
|
||||
|
|
|
@ -112,7 +112,7 @@ GameArea::GameArea()
|
|||
render_observer_(
|
||||
{config::OptionID::kDispBilinear, config::OptionID::kDispFilter,
|
||||
config::OptionID::kDispRenderMethod, config::OptionID::kDispIFB,
|
||||
config::OptionID::kDispStretch},
|
||||
config::OptionID::kDispStretch, config::OptionID::kPrefVsync},
|
||||
std::bind(&GameArea::ResetPanel, this)),
|
||||
scale_observer_(config::OptionID::kDispScale,
|
||||
std::bind(&GameArea::AdjustSize, this, true)),
|
||||
|
@ -123,7 +123,14 @@ GameArea::GameArea()
|
|||
{config::OptionID::kGBPalette0, config::OptionID::kGBPalette1,
|
||||
config::OptionID::kGBPalette2,
|
||||
config::OptionID::kPrefGBPaletteOption},
|
||||
std::bind(&gbResetPalette)) {
|
||||
std::bind(&gbResetPalette)),
|
||||
gb_declick_observer_(config::OptionID::kSoundGBDeclicking,
|
||||
[&](config::Option* option) {
|
||||
gbSoundSetDeclicking(option->GetBool());
|
||||
}),
|
||||
lcd_filters_observer_(
|
||||
{config::OptionID::kGBLCDFilter, config::OptionID::kGBALCDFilter},
|
||||
std::bind(&GameArea::UpdateLcdFilter, this)) {
|
||||
SetSizer(new wxBoxSizer(wxVERTICAL));
|
||||
// all renderers prefer 32-bit
|
||||
// well, "simple" prefers 24-bit, but that's not available for filters
|
||||
|
@ -183,7 +190,7 @@ void GameArea::LoadGame(const wxString& name)
|
|||
{
|
||||
wxConfigBase* cfg = wxConfigBase::Get();
|
||||
|
||||
if (!gopts.recent_freeze) {
|
||||
if (!OPTION(kGenFreezeRecent)) {
|
||||
gopts.recent->AddFileToHistory(name);
|
||||
wxGetApp().frame->SetRecentAccels();
|
||||
cfg->SetPath("/Recent");
|
||||
|
@ -246,11 +253,10 @@ void GameArea::LoadGame(const wxString& name)
|
|||
}
|
||||
|
||||
// start sound; this must happen before CPU stuff
|
||||
gb_effects_config.enabled = gopts.gb_effects_config_enabled;
|
||||
gb_effects_config.surround = gopts.gb_effects_config_surround;
|
||||
gb_effects_config.enabled = OPTION(kSoundGBEnableEffects);
|
||||
gb_effects_config.surround = OPTION(kSoundGBSurround);
|
||||
gb_effects_config.echo = (float)gopts.gb_echo / 100.0;
|
||||
gb_effects_config.stereo = (float)gopts.gb_stereo / 100.0;
|
||||
gbSoundSetDeclicking(gopts.gb_declick);
|
||||
if (!soundInit()) {
|
||||
wxLogError(_("Could not initialize the sound driver!"));
|
||||
}
|
||||
|
@ -263,17 +269,16 @@ void GameArea::LoadGame(const wxString& name)
|
|||
|
||||
|
||||
// Disable bios loading when using colorizer hack.
|
||||
if (gopts.use_bios_file_gb && OPTION(kGBColorizerHack)) {
|
||||
if (OPTION(kPrefUseBiosGB) && OPTION(kGBColorizerHack)) {
|
||||
wxLogError(_("Cannot use Game Boy BIOS file when Colorizer Hack is enabled, disabling Game Boy BIOS file."));
|
||||
gopts.use_bios_file_gb = false;
|
||||
update_opts();
|
||||
OPTION(kPrefUseBiosGB) = false;
|
||||
}
|
||||
|
||||
// Set up the core for the colorizer hack.
|
||||
setColorizerHack(OPTION(kGBColorizerHack));
|
||||
|
||||
const bool use_bios =
|
||||
gbCgbMode ? gopts.use_bios_file_gbc : gopts.use_bios_file_gb;
|
||||
const bool use_bios = gbCgbMode ? OPTION(kPrefUseBiosGBC).Get()
|
||||
: OPTION(kPrefUseBiosGB).Get();
|
||||
|
||||
const wxString bios_file = gbCgbMode ? OPTION(kGBGBCBiosFile).Get() : OPTION(kGBBiosFile).Get();
|
||||
gbCPUInit(bios_file.To8BitData().data(), use_bios);
|
||||
|
@ -376,9 +381,9 @@ void GameArea::LoadGame(const wxString& name)
|
|||
|
||||
rtcEnableRumble(true);
|
||||
|
||||
CPUInit(UTF8(gopts.gba_bios), gopts.use_bios_file_gba);
|
||||
CPUInit(UTF8(gopts.gba_bios), OPTION(kPrefUseBiosGBA));
|
||||
|
||||
if (gopts.use_bios_file_gba && !coreOptions.useBios) {
|
||||
if (OPTION(kPrefUseBiosGBA) && !coreOptions.useBios) {
|
||||
wxLogError(_("Could not load BIOS %s"), gopts.gba_bios.mb_str());
|
||||
// could clear use flag & file name now, but better to force
|
||||
// user to do it
|
||||
|
@ -434,7 +439,7 @@ void GameArea::LoadGame(const wxString& name)
|
|||
// load battery and/or saved state
|
||||
recompute_dirs();
|
||||
mf->update_state_ts(true);
|
||||
bool did_autoload = gopts.autoload_state ? LoadState() : false;
|
||||
bool did_autoload = OPTION(kGenAutoLoadLastState) ? LoadState() : false;
|
||||
|
||||
if (!did_autoload || coreOptions.skipSaveGameBattery) {
|
||||
wxString bname = loaded_game.GetFullName();
|
||||
|
@ -496,7 +501,7 @@ void GameArea::LoadGame(const wxString& name)
|
|||
// FIXME: backup battery file (useful if game name conflict)
|
||||
cheats_dirty = (did_autoload && !coreOptions.skipSaveGameCheats) || (loaded == IMAGE_GB ? gbCheatNumber > 0 : cheatsNumber > 0);
|
||||
|
||||
if (gopts.autoload_cheats && (!did_autoload || coreOptions.skipSaveGameCheats)) {
|
||||
if (OPTION(kPrefAutoSaveLoadCheatList) && (!did_autoload || coreOptions.skipSaveGameCheats)) {
|
||||
wxFileName cfn = loaded_game;
|
||||
// SetExt may strip something off by accident, so append to text instead
|
||||
cfn.SetFullName(cfn.GetFullName() + wxT(".clt"));
|
||||
|
@ -517,12 +522,17 @@ void GameArea::LoadGame(const wxString& name)
|
|||
}
|
||||
|
||||
#ifndef NO_LINK
|
||||
|
||||
if (gopts.link_auto) {
|
||||
if (OPTION(kGBALinkAuto)) {
|
||||
BootLink(mf->GetConfiguredLinkMode(), UTF8(gopts.link_host),
|
||||
gopts.link_timeout, gopts.link_hacks, gopts.link_num_players);
|
||||
gopts.link_timeout, OPTION(kGBALinkFast),
|
||||
gopts.link_num_players);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NO_DEBUGGER
|
||||
if (OPTION(kPrefGDBBreakOnLoad)) {
|
||||
mf->GDBBreak();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -583,7 +593,7 @@ void GameArea::UnloadGame(bool destruct)
|
|||
return;
|
||||
|
||||
// last opportunity to autosave cheats
|
||||
if (gopts.autoload_cheats && cheats_dirty) {
|
||||
if (OPTION(kPrefAutoSaveLoadCheatList) && cheats_dirty) {
|
||||
wxFileName cfn = loaded_game;
|
||||
// SetExt may strip something off by accident, so append to text instead
|
||||
cfn.SetFullName(cfn.GetFullName() + wxT(".clt"));
|
||||
|
@ -1077,8 +1087,9 @@ void GameArea::OnIdle(wxIdleEvent& event)
|
|||
LoadGame(pl);
|
||||
|
||||
#ifndef NO_DEBUGGER
|
||||
if (gopts.gdb_break_on_load)
|
||||
if (OPTION(kPrefGDBBreakOnLoad)) {
|
||||
mf->GDBBreak();
|
||||
}
|
||||
|
||||
if (debugger && loaded != IMAGE_GBA) {
|
||||
wxLogError(_("Not a valid Game Boy Advance cartridge"));
|
||||
|
@ -1196,12 +1207,7 @@ void GameArea::OnIdle(wxIdleEvent& event)
|
|||
w->SetFocus();
|
||||
|
||||
// generate system color maps (after output module init)
|
||||
if (loaded == IMAGE_GBA)
|
||||
utilUpdateSystemColorMaps(gopts.gba_lcd_filter);
|
||||
else if (loaded == IMAGE_GB)
|
||||
utilUpdateSystemColorMaps(gopts.gb_lcd_filter);
|
||||
else
|
||||
utilUpdateSystemColorMaps(false);
|
||||
UpdateLcdFilter();
|
||||
}
|
||||
|
||||
mf->PollJoysticks();
|
||||
|
@ -1895,7 +1901,7 @@ void DrawingPanelBase::DrawArea(uint8_t** data)
|
|||
|
||||
// draw OSD text old-style (directly into output buffer), if needed
|
||||
// new style flickers too much, so we'll stick to this for now
|
||||
if (wxGetApp().frame->IsFullScreen() || !gopts.statusbar) {
|
||||
if (wxGetApp().frame->IsFullScreen() || !OPTION(kGenStatusBar)) {
|
||||
GameArea* panel = wxGetApp().frame->GetPanel();
|
||||
|
||||
if (panel->osdstat.size())
|
||||
|
@ -2276,16 +2282,16 @@ void GLDrawingPanel::DrawingPanelInit()
|
|||
#if defined(__WXGTK__)
|
||||
if (IsWayland()) {
|
||||
#ifdef HAVE_EGL
|
||||
if (gopts.vsync)
|
||||
if (OPTION(kPrefVsync))
|
||||
wxLogDebug(_("Enabling EGL VSync."));
|
||||
else
|
||||
wxLogDebug(_("Disabling EGL VSync."));
|
||||
|
||||
eglSwapInterval(0, gopts.vsync);
|
||||
eglSwapInterval(0, OPTION(kPrefVsync));
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
if (gopts.vsync)
|
||||
if (OPTION(kPrefVsync))
|
||||
wxLogDebug(_("Enabling GLX VSync."));
|
||||
else
|
||||
wxLogDebug(_("Disabling GLX VSync."));
|
||||
|
@ -2304,7 +2310,7 @@ void GLDrawingPanel::DrawingPanelInit()
|
|||
glXSwapIntervalEXT = reinterpret_cast<PFNGLXSWAPINTERVALEXTPROC>(glXGetProcAddress((const GLubyte*)"glXSwapIntervalEXT"));
|
||||
if (glXSwapIntervalEXT)
|
||||
glXSwapIntervalEXT(glXGetCurrentDisplay(),
|
||||
glXGetCurrentDrawable(), gopts.vsync);
|
||||
glXGetCurrentDrawable(), OPTION(kPrefVsync));
|
||||
else
|
||||
systemScreenMessage(_("Failed to set glXSwapIntervalEXT"));
|
||||
}
|
||||
|
@ -2313,7 +2319,7 @@ void GLDrawingPanel::DrawingPanelInit()
|
|||
glXSwapIntervalSGI = reinterpret_cast<PFNGLXSWAPINTERVALSGIPROC>(glXGetProcAddress((const GLubyte*)("glXSwapIntervalSGI")));
|
||||
|
||||
if (glXSwapIntervalSGI)
|
||||
glXSwapIntervalSGI(gopts.vsync);
|
||||
glXSwapIntervalSGI(OPTION(kPrefVsync));
|
||||
else
|
||||
systemScreenMessage(_("Failed to set glXSwapIntervalSGI"));
|
||||
}
|
||||
|
@ -2322,7 +2328,7 @@ void GLDrawingPanel::DrawingPanelInit()
|
|||
glXSwapIntervalMESA = reinterpret_cast<PFNGLXSWAPINTERVALMESAPROC>(glXGetProcAddress((const GLubyte*)("glXSwapIntervalMESA")));
|
||||
|
||||
if (glXSwapIntervalMESA)
|
||||
glXSwapIntervalMESA(gopts.vsync);
|
||||
glXSwapIntervalMESA(OPTION(kPrefVsync));
|
||||
else
|
||||
systemScreenMessage(_("Failed to set glXSwapIntervalMESA"));
|
||||
}
|
||||
|
@ -2341,11 +2347,11 @@ void GLDrawingPanel::DrawingPanelInit()
|
|||
static PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL;
|
||||
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
|
||||
if (wglSwapIntervalEXT)
|
||||
wglSwapIntervalEXT(gopts.vsync);
|
||||
wglSwapIntervalEXT(OPTION(kPrefVsync));
|
||||
else
|
||||
systemScreenMessage(_("Failed to set wglSwapIntervalEXT"));
|
||||
#elif defined(__WXMAC__)
|
||||
int swap_interval = gopts.vsync ? 1 : 0;
|
||||
int swap_interval = OPTION(kPrefVsync) ? 1 : 0;
|
||||
CGLContextObj cgl_context = CGLGetCurrentContext();
|
||||
CGLSetParameter(cgl_context, kCGLCPSwapInterval, &swap_interval);
|
||||
#else
|
||||
|
@ -2648,6 +2654,15 @@ void GameArea::OnGBBorderChanged(config::Option* option) {
|
|||
}
|
||||
}
|
||||
|
||||
void GameArea::UpdateLcdFilter() {
|
||||
if (loaded == IMAGE_GBA)
|
||||
utilUpdateSystemColorMaps(OPTION(kGBALCDFilter));
|
||||
else if (loaded == IMAGE_GB)
|
||||
utilUpdateSystemColorMaps(OPTION(kGBLCDFilter));
|
||||
else
|
||||
utilUpdateSystemColorMaps(false);
|
||||
}
|
||||
|
||||
void GameArea::SuspendScreenSaver() {
|
||||
#ifdef HAVE_XSS
|
||||
if (xscreensaver_suspended || !gopts.suspend_screensaver)
|
||||
|
|
|
@ -1077,7 +1077,7 @@ void systemGbPrint(uint8_t* data, int len, int pages, int feed, int pal, int con
|
|||
// or at the very least dump when the game state changes
|
||||
uint16_t* to_print = prdata;
|
||||
|
||||
if ((gopts.print_auto_page && !(feed & 15)) || accum_prdata_len) {
|
||||
if ((OPTION(kGBPrintAutoPage) && !(feed & 15)) || accum_prdata_len) {
|
||||
if (!accum_prdata_len)
|
||||
accum_prdata_len = 162; // top border
|
||||
|
||||
|
@ -1095,7 +1095,7 @@ void systemGbPrint(uint8_t* data, int len, int pages, int feed, int pal, int con
|
|||
memcpy(accum_prdata + accum_prdata_len - lines * 162, prdata + 162,
|
||||
lines * 162 * 2);
|
||||
|
||||
if (gopts.print_auto_page && !(feed & 15))
|
||||
if (OPTION(kGBPrintAutoPage) && !(feed & 15))
|
||||
return;
|
||||
|
||||
to_print = accum_prdata;
|
||||
|
@ -1103,7 +1103,7 @@ void systemGbPrint(uint8_t* data, int len, int pages, int feed, int pal, int con
|
|||
accum_prdata_len = 0;
|
||||
}
|
||||
|
||||
if (gopts.print_screen_cap) {
|
||||
if (OPTION(kGBPrintScreenCap)) {
|
||||
wxFileName fn = wxFileName(wxGetApp().frame->GetGamePath(OPTION(kGenScreenshotDir)), wxEmptyString);
|
||||
int num = 1;
|
||||
const int capture_format = OPTION(kPrefCaptureFormat);
|
||||
|
|
|
@ -786,18 +786,34 @@ MainFrame::MainFrame()
|
|||
menus_opened(0),
|
||||
dialog_opened(0),
|
||||
focused(false),
|
||||
keep_on_top_styler_(this) {
|
||||
keep_on_top_styler_(this),
|
||||
status_bar_observer_(config::OptionID::kGenStatusBar,
|
||||
std::bind(&MainFrame::OnStatusBarChanged,
|
||||
this,
|
||||
std::placeholders::_1)),
|
||||
gba_link_observer_(config::OptionID::kGBALinkHost,
|
||||
std::bind(&MainFrame::EnableNetworkMenu, this)) {
|
||||
jpoll = new JoystickPoller();
|
||||
this->Connect(wxID_ANY, wxEVT_SHOW, wxShowEventHandler(JoystickPoller::ShowDialog), jpoll, jpoll);
|
||||
}
|
||||
|
||||
MainFrame::~MainFrame()
|
||||
{
|
||||
MainFrame::~MainFrame() {
|
||||
#ifndef NO_LINK
|
||||
CloseLink();
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainFrame::OnStatusBarChanged(config::Option* option) {
|
||||
if (option->GetBool())
|
||||
GetStatusBar()->Show();
|
||||
else
|
||||
GetStatusBar()->Hide();
|
||||
|
||||
SendSizeEvent();
|
||||
panel->AdjustSize(false);
|
||||
SendSizeEvent();
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(MainFrame, wxFrame)
|
||||
#include "cmd-evtable.h"
|
||||
EVT_CONTEXT_MENU(MainFrame::OnMenu)
|
||||
|
@ -1204,7 +1220,7 @@ LinkMode MainFrame::GetConfiguredLinkMode()
|
|||
break;
|
||||
|
||||
case 1:
|
||||
if (gopts.link_proto)
|
||||
if (OPTION(kGBALinkProto))
|
||||
return LINK_CABLE_IPC;
|
||||
else
|
||||
return LINK_CABLE_SOCKET;
|
||||
|
@ -1212,7 +1228,7 @@ LinkMode MainFrame::GetConfiguredLinkMode()
|
|||
break;
|
||||
|
||||
case 2:
|
||||
if (gopts.link_proto)
|
||||
if (OPTION(kGBALinkProto))
|
||||
return LINK_RFU_IPC;
|
||||
else
|
||||
return LINK_RFU_SOCKET;
|
||||
|
@ -1224,7 +1240,7 @@ LinkMode MainFrame::GetConfiguredLinkMode()
|
|||
break;
|
||||
|
||||
case 4:
|
||||
if (gopts.link_proto)
|
||||
if (OPTION(kGBALinkProto))
|
||||
return LINK_GAMEBOY_IPC;
|
||||
else
|
||||
return LINK_GAMEBOY_SOCKET;
|
||||
|
|
|
@ -366,10 +366,14 @@ private:
|
|||
// quicker & more accurate than FindFocus() != NULL
|
||||
bool focused;
|
||||
const widgets::KeepOnTopStyler keep_on_top_styler_;
|
||||
const config::OptionsObserver status_bar_observer_;
|
||||
const config::OptionsObserver gba_link_observer_;
|
||||
|
||||
// helper function for adding menu to accel editor
|
||||
void add_menu_accels(wxTreeCtrl* tc, wxTreeItemId& parent, wxMenu* menu);
|
||||
|
||||
// For enabling / disabling the status bar.
|
||||
void OnStatusBarChanged(config::Option* option);
|
||||
// for detecting window focus
|
||||
void OnActivate(wxActivateEvent&);
|
||||
// may work, may not... if so, load dropped file
|
||||
|
@ -606,6 +610,7 @@ public:
|
|||
void HideMenuBar();
|
||||
void ShowMenuBar();
|
||||
void OnGBBorderChanged(config::Option* option);
|
||||
void UpdateLcdFilter();
|
||||
void SuspendScreenSaver();
|
||||
void UnsuspendScreenSaver();
|
||||
|
||||
|
@ -622,10 +627,12 @@ protected:
|
|||
DECLARE_EVENT_TABLE()
|
||||
|
||||
private:
|
||||
config::OptionsObserver render_observer_;
|
||||
config::OptionsObserver scale_observer_;
|
||||
config::OptionsObserver gb_border_observer_;
|
||||
config::OptionsObserver gb_palette_observer_;
|
||||
const config::OptionsObserver render_observer_;
|
||||
const config::OptionsObserver scale_observer_;
|
||||
const config::OptionsObserver gb_border_observer_;
|
||||
const config::OptionsObserver gb_palette_observer_;
|
||||
const config::OptionsObserver gb_declick_observer_;
|
||||
const config::OptionsObserver lcd_filters_observer_;
|
||||
};
|
||||
|
||||
// wxString version of OSD message
|
||||
|
|
Loading…
Reference in New Issue