Clean-up ConfigManager options (#1067)

* Clean-up ConfigManager options

Many of the options in ConfigManager were not actually used.
* Some options are only used by wx, they have been moved to gopts. In
  addition, the type of the option has been changed to "bool" when
  applicable.
* Some options are only used by SDL and do not have a corresponding
  configuration option, they have been moved to the SDL implementation.
* Some options are not used at all, they have been removed.
This commit is contained in:
Fabrice de Gans 2023-02-04 21:39:13 -08:00 committed by GitHub
parent dc6659857c
commit 2cec46f825
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 497 additions and 1026 deletions

File diff suppressed because it is too large Load Diff

View File

@ -62,7 +62,6 @@ enum named_opts
OPT_AGB_PRINT = 1000,
OPT_AUTOFIRE,
OPT_AUTO_FRAME_SKIP,
OPT_AVI_RECORD_DIR,
OPT_BATTERY_DIR,
OPT_BIOS_FILE_NAME_GB,
OPT_BIOS_FILE_NAME_GBA,
@ -72,47 +71,18 @@ enum named_opts
OPT_CPU_SAVE_TYPE,
OPT_DOTCODE_FILE_NAME_LOAD,
OPT_DOTCODE_FILE_NAME_SAVE,
OPT_EMULATOR_TYPE,
OPT_FS_ADAPTER,
OPT_FS_COLOR_DEPTH,
OPT_FS_FREQUENCY,
OPT_FS_HEIGHT,
OPT_FS_WIDTH,
OPT_GB_EMULATOR_TYPE,
OPT_GB_FRAME_SKIP,
OPT_GB_PALETTE_OPTION,
OPT_GDB_PORT,
OPT_GL_FILTER,
OPT_IFB_TYPE,
OPT_JOYPAD_DEFAULT,
OPT_LANGUAGE_OPTION,
OPT_LINK_AUTO,
OPT_LINK_HACKS,
OPT_LINK_HOST_ADDR,
OPT_LINK_MODE,
OPT_LINK_NUM_PLAYERS,
OPT_LINK_TIMEOUT,
OPT_MAX_SCALE,
OPT_MOVIE_RECORD_DIR,
OPT_OPT_FLASH_SIZE,
OPT_REWIND_TIMER,
OPT_ROM_DIR_GB,
OPT_ROM_DIR_GBA,
OPT_ROM_DIR_GBC,
OPT_RTC_ENABLED,
OPT_SAVE_DIR,
OPT_SCREEN_SHOT_DIR,
OPT_SHOW_SPEED,
OPT_SHOW_SPEED_TRANSPARENT,
OPT_SOUND_FILTERING,
OPT_SOUND_RECORD_DIR,
OPT_SYNCHRONIZE,
OPT_THREAD_PRIORITY,
OPT_VIDEO_OPTION,
OPT_WINDOW_HEIGHT,
OPT_WINDOW_POSITION_X,
OPT_WINDOW_POSITION_Y,
OPT_WINDOW_WIDTH,
OPT_SPEEDUP_THROTTLE,
OPT_SPEEDUP_FRAME_SKIP,
OPT_NO_SPEEDUP_THROTTLE_FRAME_SKIP
@ -134,129 +104,45 @@ bool mirroringEnable = true;
bool parseDebug = true;
bool speedHack = false;
bool speedup = false;
bool gbaLcdFilter = false;
bool gbLcdFilter = false;
const char* aviRecordDir;
const char* batteryDir;
const char* biosFileNameGB;
const char* biosFileNameGBA;
const char* biosFileNameGBC;
const char* loadDotCodeFile;
const char* saveDotCodeFile;
const char* linkHostAddr;
const char* movieRecordDir;
char* rewindMemory = NULL;
const char* romDirGB;
const char* romDirGBA;
const char* romDirGBC;
const char* saveDir;
const char* screenShotDir;
const char* soundRecordDir;
int active = 1;
int agbPrint;
int autoFire;
int autoFireMaxCount = 1;
int autoFireToggle;
int autoFrameSkip = 0;
int autoLoadMostRecent;
int autoPatch;
int autoSaveLoadCheatList;
int aviRecording;
int captureFormat = 0;
int cheatsEnabled = true;
int colorizerHack = 0;
int cpuDisableSfx = false;
int cpuSaveType = 0;
int enableMMX;
int disableStatusMessages = 0;
int dsoundDisableHardwareAcceleration;
int filterHeight;
int filterMagnification;
int filterMT; // enable multi-threading for pixel filters
int filter = kStretch2x;
int filterWidth;
int frameSkip = 1;
int frameskipadjust;
int fsAdapter;
int fsColorDepth;
int fsForceChange;
int fsFrequency;
int fsHeight;
int fsWidth;
int fullScreen;
int fullScreenStretch;
int gdbBreakOnLoad;
int gdbPort;
int glFilter;
int ifbType = kIFBNone;
int joypadDefault;
int languageOption;
int layerEnable = 0xff00;
int layerSettings = 0xff00;
int linkAuto;
int linkHacks = 1;
int linkMode;
int linkNumPlayers;
int linkTimeout = 500;
int maxScale;
int mouseCounter = 0;
int movieFrame;
int moviePlayFrame;
int moviePlaying;
int movieRecording;
int openGL;
int optFlashSize;
int optPrintUsage;
int paused;
int pauseWhenInactive = 0;
int preparedCheats = 0;
int recentFreeze;
int renderedFrames;
int rewindCount;
int rewindCounter;
int rewindPos;
int rewindSaveNeeded = 0;
int rewindTimer = 0;
int rewindTopPos;
int rtcEnabled;
int saveType = GBA_SAVE_AUTO;
int screenMessage;
int sensorX;
int sensorY;
int showRenderedFrames;
int showSpeed;
int showSpeedTransparent;
int sizeX;
int sizeY;
int skipBios = 0;
int skipSaveGameBattery = true;
int skipSaveGameCheats = false;
int soundRecording;
int speedupToggle;
int sunBars;
int surfaceSizeX;
int surfaceSizeY;
int threadPriority;
int tripleBuffering;
int useBios = 0;
int useBiosFileGB;
int useBiosFileGBA;
int useBiosFileGBC;
int videoOption;
int vsync;
int wasPaused = 0;
uint32_t windowHeight;
int windowMaximized;
int windowPositionX = 0;
int windowPositionY = 0;
uint32_t windowWidth;
int winGbBorderOn;
int winGbPrinterEnabled;
int winPauseNextFrame;
int* rewindSerials = NULL;
uint32_t autoFrameSkipLastTime;
uint32_t movieLastJoypad;
uint32_t movieNextJoypad;
uint32_t throttle = 100;
uint32_t speedup_throttle = 100;
uint32_t speedup_frame_skip = 9;
@ -266,9 +152,6 @@ bool allowJoystickBackgroundInput = true;
const char* preparedCheatCodes[MAX_CHEATS];
FilterFunc filterFunction = 0;
IFBFilterFunc ifbFunction = 0;
// allow up to 100 IPS/UPS/PPF patches given on commandline
int patchNum = 0;
char *patchNames[PATCH_MAX_NUM] = { NULL }; // and so on
@ -279,19 +162,14 @@ void(*dbgSignal)(int, int) = remoteStubSignal;
void(*dbgOutput)(const char *, uint32_t) = debuggerOutput;
#endif
char* homeDir = NULL;
char* arg0 = NULL;
struct option argOptions[] = {
{ "agb-print", required_argument, 0, OPT_AGB_PRINT },
{ "auto-frame-skip", required_argument, 0, OPT_AUTO_FRAME_SKIP },
{ "auto-load-most-recent", no_argument, &autoLoadMostRecent, 1 },
{ "auto-patch", no_argument, &autoPatch, 1 },
{ "auto-save-load-cheat-list", no_argument, &autoSaveLoadCheatList, 1 },
{ "autofire", required_argument, 0, OPT_AUTOFIRE },
{ "avi-record-dir", required_argument, 0, OPT_AVI_RECORD_DIR },
{ "battery-dir", required_argument, 0, OPT_BATTERY_DIR },
{ "bios", required_argument, 0, 'b' },
{ "bios-file-name-gb", required_argument, 0, OPT_BIOS_FILE_NAME_GB },
@ -308,26 +186,16 @@ struct option argOptions[] = {
{ "cpu-disable-sfx", no_argument, &cpuDisableSfx, 1 },
{ "cpu-save-type", required_argument, 0, OPT_CPU_SAVE_TYPE },
{ "debug", no_argument, 0, 'd' },
{ "enable-mmx", no_argument, &enableMMX, 1 },
{ "disable-sfx", no_argument, &cpuDisableSfx, 1 },
{ "disable-status-messages", no_argument, &disableStatusMessages, 1 },
{ "dotcode-file-name-load", required_argument, 0, OPT_DOTCODE_FILE_NAME_LOAD },
{ "dotcode-file-name-save", required_argument, 0, OPT_DOTCODE_FILE_NAME_SAVE },
{ "emulator-type", required_argument, 0, OPT_EMULATOR_TYPE },
{ "filter", required_argument, 0, 'f' },
{ "filter-enable-multi-threading", no_argument, &filterMT, 1 },
{ "filter-mt", no_argument, &filterMT, 1 },
{ "flash-128k", no_argument, &optFlashSize, 1 },
{ "flash-64k", no_argument, &optFlashSize, 0 },
{ "flash-size", required_argument, 0, 'S' },
{ "frameskip", required_argument, 0, 's' },
{ "fs-adapter", required_argument, 0, OPT_FS_ADAPTER },
{ "fs-color-depth", required_argument, 0, OPT_FS_COLOR_DEPTH },
{ "fs-frequency", required_argument, 0, OPT_FS_FREQUENCY },
{ "fs-height", required_argument, 0, OPT_FS_HEIGHT },
{ "fs-width", required_argument, 0, OPT_FS_WIDTH },
{ "full-screen", no_argument, &fullScreen, 1 },
{ "full-screen-stretch", no_argument, &fullScreenStretch, 1 },
{ "gb-border-automatic", no_argument, &gbBorderAutomatic, 1 },
{ "gb-border-on", no_argument, &gbBorderOn, 1 },
{ "gb-color-option", no_argument, &gbColorOption, 1 },
@ -336,22 +204,9 @@ struct option argOptions[] = {
{ "gb-palette-option", required_argument, 0, OPT_GB_PALETTE_OPTION },
{ "gb-printer", no_argument, &winGbPrinterEnabled, 1 },
{ "gdb", required_argument, 0, 'G' },
{ "gdb-break-on-load", no_argument, &gdbBreakOnLoad, 1 },
{ "gdb-port", required_argument, 0, OPT_GDB_PORT },
{ "gl-filter", required_argument, 0, OPT_GL_FILTER },
{ "help", no_argument, &optPrintUsage, 1 },
{ "ifb-filter", required_argument, 0, 'I' },
{ "ifb-type", required_argument, 0, OPT_IFB_TYPE },
{ "joypad-default", required_argument, 0, OPT_JOYPAD_DEFAULT },
{ "language-option", required_argument, 0, OPT_LANGUAGE_OPTION },
{ "link-auto", required_argument, 0, OPT_LINK_AUTO },
{ "link-hacks", required_argument, 0, OPT_LINK_HACKS },
{ "link-host-addr", required_argument, 0, OPT_LINK_HOST_ADDR },
{ "link-mode", required_argument, 0, OPT_LINK_MODE },
{ "link-num-players", required_argument, 0, OPT_LINK_NUM_PLAYERS },
{ "link-timeout", required_argument, 0, OPT_LINK_TIMEOUT },
{ "max-scale", required_argument, 0, OPT_MAX_SCALE },
{ "movie-record-dir", required_argument, 0, OPT_MOVIE_RECORD_DIR },
{ "no-agb-print", no_argument, &agbPrint, 0 },
{ "no-auto-frameskip", no_argument, &autoFrameSkip, 0 },
{ "no-debug", no_argument, 0, 'N' },
@ -367,11 +222,7 @@ struct option argOptions[] = {
{ "patch", required_argument, 0, 'i' },
{ "pause-when-inactive", no_argument, &pauseWhenInactive, 1 },
{ "profile", optional_argument, 0, 'p' },
{ "recent-freeze", no_argument, &recentFreeze, 1 },
{ "rewind-timer", required_argument, 0, OPT_REWIND_TIMER },
{ "rom-dir-gb", required_argument, 0, OPT_ROM_DIR_GB },
{ "rom-dir-gba", required_argument, 0, OPT_ROM_DIR_GBA },
{ "rom-dir-gbc", required_argument, 0, OPT_ROM_DIR_GBC },
{ "rtc", no_argument, &rtcEnabled, 1 },
{ "rtc-enabled", required_argument, 0, OPT_RTC_ENABLED },
{ "save-auto", no_argument, &cpuSaveType, 0 },
@ -391,27 +242,13 @@ struct option argOptions[] = {
{ "skip-save-game-battery", no_argument, &skipSaveGameBattery, 1 },
{ "skip-save-game-cheats", no_argument, &skipSaveGameCheats, 1 },
{ "sound-filtering", required_argument, 0, OPT_SOUND_FILTERING },
{ "sound-record-dir", required_argument, 0, OPT_SOUND_RECORD_DIR },
{ "stretch", no_argument, &fullScreenStretch, 1 },
{ "synchronize", required_argument, 0, OPT_SYNCHRONIZE },
{ "thread-priority", required_argument, 0, OPT_THREAD_PRIORITY },
{ "throttle", required_argument, 0, 'T' },
{ "speedup-throttle", required_argument, 0, OPT_SPEEDUP_THROTTLE },
{ "speedup-frame-skip", required_argument, 0, OPT_SPEEDUP_FRAME_SKIP },
{ "no-speedup-throttle-frame-skip", no_argument, 0, OPT_NO_SPEEDUP_THROTTLE_FRAME_SKIP },
{ "triple-buffering", no_argument, &tripleBuffering, 1 },
{ "use-bios", no_argument, &useBios, 1 },
{ "use-bios-file-gb", no_argument, &useBiosFileGB, 1 },
{ "use-bios-file-gba", no_argument, &useBiosFileGBA, 1 },
{ "use-bios-file-gbc", no_argument, &useBiosFileGBC, 1 },
{ "verbose", required_argument, 0, 'v' },
{ "video-option", required_argument, 0, OPT_VIDEO_OPTION },
{ "vsync", no_argument, &vsync, 1 },
{ "win-gb-printer-enabled", no_argument, &winGbPrinterEnabled, 1 },
{ "window-height", required_argument, 0, OPT_WINDOW_HEIGHT },
{ "window-position-x", required_argument, 0, OPT_WINDOW_POSITION_X },
{ "window-position-y", required_argument, 0, OPT_WINDOW_POSITION_Y },
{ "window-width", required_argument, 0, OPT_WINDOW_WIDTH },
{ NULL, no_argument, NULL, 0 }
@ -470,11 +307,6 @@ void ValidateConfig()
rewindTimer = 0;
if (autoFireMaxCount < 1)
autoFireMaxCount = 1;
if (rewindTimer) {
rewindMemory = (char *)malloc(REWIND_NUM*REWIND_SIZE);
rewindSerials = (int *)calloc(REWIND_NUM, sizeof(int)); // init to zeroes
}
}
void LoadConfig()
@ -484,10 +316,7 @@ void LoadConfig()
allowJoystickBackgroundInput = ReadPref("allowJoystickBackgroundInput", true);
autoFireMaxCount = fromDec(ReadPrefString("autoFireMaxCount"));
autoFrameSkip = ReadPref("autoFrameSkip", 0);
autoLoadMostRecent = ReadPref("autoLoadMostRecent", 0);
autoPatch = ReadPref("autoPatch", 1);
autoSaveLoadCheatList = ReadPref("autoSaveLoadCheatList", 1);
aviRecordDir = ReadPrefString("aviRecordDir");
batteryDir = ReadPrefString("batteryDir");
biosFileNameGB = ReadPrefString("biosFileGB");
biosFileNameGBA = ReadPrefString("biosFileGBA");
@ -497,18 +326,10 @@ void LoadConfig()
colorizerHack = ReadPref("colorizerHack", 0);
cpuDisableSfx = ReadPref("disableSfx", 0);
cpuSaveType = ReadPrefHex("saveType");
enableMMX = ReadPref("enableMMX", 1);
disableStatusMessages = ReadPrefHex("disableStatus");
filterMT = ReadPref("filterEnableMultiThreading", 0);
filter = ReadPref("filter", 0);
frameSkip = ReadPref("frameSkip", 0);
fsAdapter = ReadPref("fsAdapter", 0);
fsColorDepth = ReadPref("fsColorDepth", 32);
fsFrequency = ReadPref("fsFrequency", 60);
fsHeight = ReadPref("fsHeight", 600);
fsWidth = ReadPref("fsWidth", 800);
fullScreen = ReadPrefHex("fullScreen");
fullScreenStretch = ReadPref("stretch", 0);
gbBorderAutomatic = ReadPref("borderAutomatic", 1);
gbBorderOn = ReadPrefHex("borderOn");
gbColorOption = ReadPref("colorOption", 0);
@ -520,35 +341,12 @@ void LoadConfig()
gb_effects_config.enabled = ReadPref("gbSoundEffectsEnabled", 0);
gb_effects_config.stereo = (float)ReadPref("gbSoundEffectsStereo", 15) / 100.0f;
gb_effects_config.surround = ReadPref("gbSoundEffectsSurround", 0);
gdbBreakOnLoad = ReadPref("gdbBreakOnLoad", 0);
gdbPort = ReadPref("gdbPort", 55555);
glFilter = ReadPref("glFilter", 1);
ifbType = ReadPref("ifbType", 0);
joypadDefault = ReadPref("joypadDefault", 0);
languageOption = ReadPref("language", 1);
linkAuto = ReadPref("LinkAuto", 1);
linkHacks = ReadPref("LinkHacks", 0);
linkHostAddr = ReadPrefString("LinkHost", "localhost");
linkMode = ReadPref("LinkMode", 0); // LINK_DISCONNECTED = 0
linkNumPlayers = ReadPref("LinkNumPlayers", 2);
linkTimeout = ReadPref("LinkTimeout", 500);
// Previous default was 1, which is very wrong.
if (linkTimeout <= 1)
linkTimeout = 500;
loadDotCodeFile = ReadPrefString("loadDotCodeFile");
maxScale = ReadPref("maxScale", 0);
movieRecordDir = ReadPrefString("movieRecordDir");
openGL = ReadPrefHex("openGL");
optFlashSize = ReadPref("flashSize", 0);
pauseWhenInactive = ReadPref("pauseWhenInactive", 1);
recentFreeze = ReadPref("recentFreeze", 0);
rewindTimer = ReadPref("rewindTimer", 0);
romDirGB = ReadPrefString("romDirGB");
romDirGBA = ReadPrefString("romDirGBA");
romDirGBC = ReadPrefString("romDirGBC");
rtcEnabled = ReadPref("rtcEnabled", 0);
saveDir = ReadPrefString("saveDir");
saveDotCodeFile = ReadPrefString("saveDotCodeFile");
@ -560,25 +358,11 @@ void LoadConfig()
skipSaveGameCheats = ReadPref("skipSaveGameCheats", 0);
soundFiltering = (float)ReadPref("gbaSoundFiltering", 50) / 100.0f;
soundInterpolation = ReadPref("gbaSoundInterpolation", 1);
soundRecordDir = ReadPrefString("soundRecordDir");
threadPriority = ReadPref("priority", 2);
throttle = ReadPref("throttle", 100);
speedup_throttle = ReadPref("speedupThrottle", 100);
speedup_frame_skip = ReadPref("speedupFrameSkip", 9);
speedup_throttle_frame_skip = ReadPref("speedupThrottleFrameSkip", 0);
tripleBuffering = ReadPref("tripleBuffering", 0);
useBios = ReadPrefHex("useBiosGBA");
useBiosFileGB = ReadPref("useBiosGB", 0);
useBiosFileGBA = ReadPref("useBiosGBA", 0);
useBiosFileGBC = ReadPref("useBiosGBC", 0);
videoOption = ReadPref("video", 2); // VIDEO_3X = 2
vsync = ReadPref("vsync", false);
windowHeight = ReadPref("windowHeight", 0);
windowMaximized = ReadPref("windowMaximized", 0);
windowPositionX = ReadPref("windowX", -1);
windowPositionY = ReadPref("windowY", -1);
windowWidth = ReadPref("windowWidth", 0);
winGbBorderOn = ReadPref("borderOn", 0);
winGbPrinterEnabled = ReadPref("gbPrinter", 0);
int soundQuality = (ReadPrefHex("soundQuality", 1));
@ -972,7 +756,6 @@ int ReadOpts(int argc, char ** argv)
break;
case 'F':
fullScreen = 1;
mouseCounter = 120;
break;
case 'f':
if (optarg) {
@ -1084,20 +867,6 @@ int ReadOpts(int argc, char ** argv)
}
break;
case OPT_VIDEO_OPTION:
// --video-option
if (optarg) {
videoOption = atoi(optarg);
}
break;
case OPT_LANGUAGE_OPTION:
// --language-option
if (optarg) {
languageOption = atoi(optarg);
}
break;
case OPT_GB_FRAME_SKIP:
// --gb-frame-skip
if (optarg) {
@ -1105,55 +874,6 @@ int ReadOpts(int argc, char ** argv)
}
break;
case OPT_FS_ADAPTER:
// --fs-adapter
if (optarg) {
fsAdapter = atoi(optarg);
}
break;
case OPT_FS_WIDTH:
// --fs-width
if (optarg) {
fsWidth = atoi(optarg);
}
break;
case OPT_FS_HEIGHT:
// --fs-height
if (optarg) {
fsHeight = atoi(optarg);
}
break;
case OPT_FS_COLOR_DEPTH:
// --fs-color-depth
if (optarg) {
fsColorDepth = atoi(optarg);
}
break;
case OPT_FS_FREQUENCY:
// --fs-frequency
if (optarg) {
fsFrequency = atoi(optarg);
}
break;
case OPT_WINDOW_POSITION_X:
// --window-position-x
if (optarg) {
windowPositionX = atoi(optarg);
}
break;
case OPT_WINDOW_POSITION_Y:
// --window-position-y
if (optarg) {
windowPositionY = atoi(optarg);
}
break;
case OPT_SOUND_FILTERING:
// --sound-filtering
if (optarg) {
@ -1161,13 +881,6 @@ int ReadOpts(int argc, char ** argv)
}
break;
case OPT_GL_FILTER:
// --gl-filter
if (optarg) {
glFilter = atoi(optarg);
}
break;
case OPT_SHOW_SPEED:
// --show-speed
if (optarg) {
@ -1189,13 +902,6 @@ int ReadOpts(int argc, char ** argv)
}
break;
case OPT_THREAD_PRIORITY:
// --thread-priority
if (optarg) {
threadPriority = atoi(optarg);
}
break;
case OPT_GB_PALETTE_OPTION:
// --gb-palette-option
if (optarg) {
@ -1210,62 +916,6 @@ int ReadOpts(int argc, char ** argv)
}
break;
case OPT_JOYPAD_DEFAULT:
// --joypad-default
if (optarg) {
joypadDefault = atoi(optarg);
}
break;
case OPT_MAX_SCALE:
// --max-scale
if (optarg) {
maxScale = atoi(optarg);
}
break;
case OPT_LINK_TIMEOUT:
// --link-timeout
if (optarg) {
linkTimeout = atoi(optarg);
}
break;
case OPT_LINK_MODE:
// --link-mode
if (optarg) {
linkMode = atoi(optarg);
}
break;
case OPT_LINK_AUTO:
// --link-auto
if (optarg) {
linkAuto = atoi(optarg);
}
break;
case OPT_LINK_HACKS:
// --link-hacks
if (optarg) {
linkHacks = atoi(optarg);
}
break;
case OPT_LINK_NUM_PLAYERS:
// --link-num-players
if (optarg) {
linkNumPlayers = atoi(optarg);
}
break;
case OPT_GDB_PORT:
// --gdb-port
if (optarg) {
gdbPort = atoi(optarg);
}
break;
case OPT_BIOS_FILE_NAME_GB:
// --bios-file-name-gb
biosFileNameGB = optarg;
@ -1281,21 +931,6 @@ int ReadOpts(int argc, char ** argv)
biosFileNameGBC = optarg;
break;
case OPT_AVI_RECORD_DIR:
// --avi-record-dir
aviRecordDir = optarg;
break;
case OPT_MOVIE_RECORD_DIR:
// --movie-record-dir
movieRecordDir = optarg;
break;
case OPT_SOUND_RECORD_DIR:
// --sound-record-dir
soundRecordDir = optarg;
break;
case OPT_SCREEN_SHOT_DIR:
// --screen-shot-dir
screenShotDir = optarg;
@ -1311,26 +946,6 @@ int ReadOpts(int argc, char ** argv)
batteryDir = optarg;
break;
case OPT_ROM_DIR_GBC:
// --rom-dir-gbc
romDirGBC = optarg;
break;
case OPT_ROM_DIR_GB:
// --rom-dir-gb
romDirGB = optarg;
break;
case OPT_ROM_DIR_GBA:
// --rom-dir-gba
romDirGBA = optarg;
break;
case OPT_LINK_HOST_ADDR:
// --link-host-addr
linkHostAddr = optarg;
break;
case OPT_CPU_SAVE_TYPE:
// --cpu-save-type
if (optarg) {
@ -1347,20 +962,6 @@ int ReadOpts(int argc, char ** argv)
}
break;
case OPT_WINDOW_HEIGHT:
// --window-height
if (optarg) {
windowHeight = atoi(optarg);
}
break;
case OPT_WINDOW_WIDTH:
// --window-width
if (optarg) {
windowWidth = atoi(optarg);
}
break;
case OPT_DOTCODE_FILE_NAME_LOAD:
// --dotcode-file-name-load
loadDotCodeFile = optarg;

View File

@ -25,127 +25,41 @@ extern bool mirroringEnable;
extern bool parseDebug;
extern bool speedHack;
extern bool speedup;
extern bool gbaLcdFilter;
extern bool gbLcdFilter;
extern char *rewindMemory;
extern const char *aviRecordDir;
extern const char *biosFileNameGB;
extern const char *biosFileNameGBA;
extern const char *biosFileNameGBC;
extern const char *loadDotCodeFile;
extern const char *saveDotCodeFile;
extern const char *linkHostAddr;
extern const char *movieRecordDir;
extern const char *romDirGB;
extern const char *romDirGBA;
extern const char *romDirGBC;
extern const char *soundRecordDir;
extern int *rewindSerials;
extern int active;
extern int agbPrint;
extern int autoFire;
extern int autoFireMaxCount;
extern int autoFireToggle;
extern int autoFrameSkip;
extern int autoLoadMostRecent;
extern int autoPatch;
extern int autoSaveLoadCheatList;
extern int aviRecording;
extern int captureFormat;
extern int cheatsEnabled;
extern int colorizerHack;
extern int cpuDisableSfx;
extern int cpuSaveType;
extern int dinputKeyFocus;
extern int enableMMX;
extern int disableStatusMessages;
extern int dsoundDisableHardwareAcceleration;
extern int filterHeight;
extern int filterMagnification;
extern int filterMT; // enable multi-threading for pixel filters
extern int filter;
extern int filterWidth;
extern int frameSkip;
extern int frameskipadjust;
extern int fsAdapter;
extern int fsColorDepth;
extern int fsForceChange;
extern int fsFrequency;
extern int fsHeight;
extern int fsWidth;
extern int fullScreen;
extern int fullScreenStretch;
extern int gdbBreakOnLoad;
extern int gdbPort;
extern int glFilter;
extern int ifbType;
extern int joypadDefault;
extern int languageOption;
extern int layerEnable;
extern int layerSettings;
extern int linkAuto;
extern int linkHacks;
extern int linkMode;
extern int linkNumPlayers;
extern int linkTimeout;
extern int maxScale;
extern int movieFrame;
extern int moviePlayFrame;
extern int moviePlaying;
extern int movieRecording;
extern int openGL;
extern int autoPatch;
extern int optFlashSize;
extern int optPrintUsage;
extern int paused;
extern int pauseWhenInactive;
extern int recentFreeze;
extern int renderedFrames;
extern int rewindCount;
extern int rewindCounter;
extern int rewindPos;
extern int rewindSaveNeeded;
extern int rewindTimer;
extern int rewindTopPos;
// extern int romSize;
extern int rtcEnabled;
extern int saveType;
extern int screenMessage;
extern int sensorX;
extern int sensorY;
extern int showRenderedFrames;
extern int showSpeed;
extern int showSpeedTransparent;
extern int sizeX;
extern int sizeY;
extern int skipBios;
extern int skipSaveGameBattery;
extern int skipSaveGameCheats;
extern int soundRecording;
extern int speedupToggle;
extern int sunBars;
extern int surfaceSizeX;
extern int surfaceSizeY;
extern int threadPriority;
extern int tripleBuffering;
extern int useBios;
extern int useBiosFileGB;
extern int useBiosFileGBA;
extern int useBiosFileGBC;
extern int videoOption;
extern int vsync;
extern int wasPaused;
extern uint32_t windowHeight;
extern int windowMaximized;
extern int windowPositionX;
extern int windowPositionY;
extern uint32_t windowWidth;
extern int winGbBorderOn;
extern int winGbPrinterEnabled;
extern int winPauseNextFrame;
extern uint32_t autoFrameSkipLastTime;
extern uint32_t movieLastJoypad;
extern uint32_t movieNextJoypad;
extern uint32_t throttle;
extern uint32_t speedup_throttle;
extern uint32_t speedup_frame_skip;
@ -161,12 +75,6 @@ extern const char *preparedCheatCodes[MAX_CHEATS];
extern int patchNum;
extern char *patchNames[PATCH_MAX_NUM]; // and so on
extern int mouseCounter;
extern FilterFunc filterFunction;
extern IFBFilterFunc ifbFunction;
extern char *homeDir;
extern const char *screenShotDir;
extern const char *saveDir;
extern const char *batteryDir;

View File

@ -139,13 +139,31 @@ int systemGreenShift = 0;
int systemColorDepth = 0;
int systemVerbose = 0;
int systemFrameSkip = 0;
int frameskipadjust = 0;
int systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
int renderedFrames = 0;
int showRenderedFrames = 0;
int mouseCounter = 0;
uint32_t autoFrameSkipLastTime = 0;
char* rewindMemory = NULL;
int rewindCount;
int rewindCounter;
int rewindPos;
int rewindSaveNeeded = 0;
int rewindTopPos;
int* rewindSerials = NULL;
int srcPitch = 0;
int destWidth = 0;
int destHeight = 0;
int desktopWidth = 0;
int desktopHeight = 0;
int sizeX = 240;
int sizeY = 160;
FilterFunc filterFunction = 0;
IFBFilterFunc ifbFunction = 0;
uint8_t* delta = NULL;
static const int delta_size = 322 * 242 * 4;
@ -207,6 +225,8 @@ enum VIDEO_SIZE {
uint32_t throttleLastTime = 0;
bool paused = false;
bool wasPaused = false;
bool pauseNextFrame = false;
int sdlMirroringEnable = 1;
@ -219,6 +239,7 @@ char* home;
char homeConfigDir[1024];
char homeDataDir[1024];
bool screenMessage = false;
char screenMessageBuffer[21];
uint32_t screenMessageTime = 0;
@ -1023,7 +1044,7 @@ void sdlPollEvents()
if (pauseWhenInactive)
if (paused) {
if (emulating) {
paused = 0;
paused = false;
soundResume();
}
}
@ -1032,7 +1053,7 @@ void sdlPollEvents()
if (pauseWhenInactive) {
wasPaused = true;
if (emulating) {
paused = 1;
paused = true;
soundPause();
}
@ -1548,6 +1569,14 @@ int main(int argc, char** argv)
gb_effects_config.enabled = false;
LoadConfig(); // Parse command line arguments (overrides ini)
// Additional configuration.
if (rewindTimer) {
rewindMemory = (char *)malloc(REWIND_NUM*REWIND_SIZE);
rewindSerials = (int *)calloc(REWIND_NUM, sizeof(int)); // init to zeroes
}
ReadOpts(argc, argv);
inputSetKeymap(PAD_1, KEY_LEFT, ReadPrefHex("Joy0_Left"));
@ -1858,7 +1887,7 @@ int main(int argc, char** argv)
}
while (emulating) {
if (!paused && active) {
if (!paused) {
if (debugger && emulator.emuHasDebugger)
remoteStubMain();
else {

View File

@ -48,7 +48,11 @@ static SDL_Joystick** sdlDevices = NULL;
static EPad sdlDefaultJoypad = PAD_MAIN;
static int autoFire = 0;
static int autoFireToggle = 0;
static int autoFireCountdown = 0;
static int sensorX = 0;
static int sensorY = 0;
static uint32_t joypad[5][SDLBUTTONS_NUM] = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },

View File

@ -234,7 +234,7 @@ EVT_HANDLER(wxID_FILE1, "Load recent ROM 1")
panel->LoadGame(gopts.recent->GetHistoryFile(0));
#ifndef NO_DEBUGGER
if (gdbBreakOnLoad)
if (gopts.gdb_break_on_load)
GDBBreak();
#endif
}
@ -244,7 +244,7 @@ EVT_HANDLER(wxID_FILE2, "Load recent ROM 2")
panel->LoadGame(gopts.recent->GetHistoryFile(1));
#ifndef NO_DEBUGGER
if (gdbBreakOnLoad)
if (gopts.gdb_break_on_load)
GDBBreak();
#endif
}
@ -254,7 +254,7 @@ EVT_HANDLER(wxID_FILE3, "Load recent ROM 3")
panel->LoadGame(gopts.recent->GetHistoryFile(2));
#ifndef NO_DEBUGGER
if (gdbBreakOnLoad)
if (gopts.gdb_break_on_load)
GDBBreak();
#endif
}
@ -264,7 +264,7 @@ EVT_HANDLER(wxID_FILE4, "Load recent ROM 4")
panel->LoadGame(gopts.recent->GetHistoryFile(3));
#ifndef NO_DEBUGGER
if (gdbBreakOnLoad)
if (gopts.gdb_break_on_load)
GDBBreak();
#endif
}
@ -274,7 +274,7 @@ EVT_HANDLER(wxID_FILE5, "Load recent ROM 5")
panel->LoadGame(gopts.recent->GetHistoryFile(4));
#ifndef NO_DEBUGGER
if (gdbBreakOnLoad)
if (gopts.gdb_break_on_load)
GDBBreak();
#endif
}
@ -284,7 +284,7 @@ EVT_HANDLER(wxID_FILE6, "Load recent ROM 6")
panel->LoadGame(gopts.recent->GetHistoryFile(5));
#ifndef NO_DEBUGGER
if (gdbBreakOnLoad)
if (gopts.gdb_break_on_load)
GDBBreak();
#endif
}
@ -294,7 +294,7 @@ EVT_HANDLER(wxID_FILE7, "Load recent ROM 7")
panel->LoadGame(gopts.recent->GetHistoryFile(6));
#ifndef NO_DEBUGGER
if (gdbBreakOnLoad)
if (gopts.gdb_break_on_load)
GDBBreak();
#endif
}
@ -304,7 +304,7 @@ EVT_HANDLER(wxID_FILE8, "Load recent ROM 8")
panel->LoadGame(gopts.recent->GetHistoryFile(7));
#ifndef NO_DEBUGGER
if (gdbBreakOnLoad)
if (gopts.gdb_break_on_load)
GDBBreak();
#endif
}
@ -314,7 +314,7 @@ EVT_HANDLER(wxID_FILE9, "Load recent ROM 9")
panel->LoadGame(gopts.recent->GetHistoryFile(8));
#ifndef NO_DEBUGGER
if (gdbBreakOnLoad)
if (gopts.gdb_break_on_load)
GDBBreak();
#endif
}
@ -324,7 +324,7 @@ EVT_HANDLER(wxID_FILE10, "Load recent ROM 10")
panel->LoadGame(gopts.recent->GetHistoryFile(9));
#ifndef NO_DEBUGGER
if (gdbBreakOnLoad)
if (gopts.gdb_break_on_load)
GDBBreak();
#endif
}
@ -1998,10 +1998,10 @@ EVT_HANDLER(CheatsEnable, "Enable cheats (toggle)")
EVT_HANDLER(ColorizerHack, "Enable Colorizer Hack (toggle)")
{
int val = 0;
GetMenuOptionInt("ColorizerHack", &val, 1);
bool val = false;
GetMenuOptionBool("ColorizerHack", &val);
if (val == 1 && useBiosFileGB == 1) {
if (val && gopts.use_bios_file_gb) {
wxLogError(_("Cannot use Colorizer Hack when GB BIOS File is enabled."));
val = 0;
SetMenuOption("ColorizerHack", 0);
@ -2322,7 +2322,7 @@ int GetGDBPort(MainFrame* mf)
_("Set to 0 for pseudo tty"),
#endif
_("Port to wait for connection:"),
_("GDB Connection"), gdbPort,
_("GDB Connection"), gopts.gdb_port,
#ifdef __WXMSW__
1025,
#else
@ -2338,7 +2338,7 @@ EVT_HANDLER(DebugGDBPort, "Configure port...")
int port_selected = GetGDBPort(this);
if (port_selected != -1) {
gdbPort = port_selected;
gopts.gdb_port = port_selected;
update_opts();
}
#endif
@ -2347,7 +2347,7 @@ EVT_HANDLER(DebugGDBPort, "Configure port...")
EVT_HANDLER(DebugGDBBreakOnLoad, "Break on load")
{
#ifndef NO_DEBUGGER
GetMenuOptionInt("DebugGDBBreakOnLoad", &gdbBreakOnLoad, 1);
GetMenuOptionBool("DebugGDBBreakOnLoad", &gopts.gdb_break_on_load);
update_opts();
#endif
}
@ -2357,21 +2357,21 @@ void MainFrame::GDBBreak()
{
ModalPause mp;
if (gdbPort == 0) {
if (gopts.gdb_port == 0) {
int port_selected = GetGDBPort(this);
if (port_selected != -1) {
gdbPort = port_selected;
gopts.gdb_port = port_selected;
update_opts();
}
}
if (gdbPort > 0) {
if (gopts.gdb_port > 0) {
if (!remotePort) {
wxString msg;
#ifndef __WXMSW__
if (!gdbPort) {
if (!gopts.gdb_port) {
if (!debugOpenPty())
return;
@ -2379,10 +2379,10 @@ void MainFrame::GDBBreak()
} else
#endif
{
if (!debugStartListen(gdbPort))
if (!debugStartListen(gopts.gdb_port))
return;
msg.Printf(_("Waiting for connection on port %d"), gdbPort);
msg.Printf(_("Waiting for connection on port %d"), gopts.gdb_port);
}
wxProgressDialog dlg(_("Waiting for GDB..."), msg, 100, this,
@ -2392,7 +2392,7 @@ void MainFrame::GDBBreak()
while (dlg.Pulse()) {
#ifndef __WXMSW__
if (!gdbPort)
if (!gopts.gdb_port)
connected = debugWaitPty();
else
#endif
@ -2406,7 +2406,7 @@ void MainFrame::GDBBreak()
}
if (connected) {
remotePort = gdbPort;
remotePort = gopts.gdb_port;
emulating = 1;
dbgMain = remoteStubMain;
dbgSignal = remoteStubSignal;
@ -3043,9 +3043,9 @@ EVT_HANDLER_MASK(GBALcdFilter, "Enable LCD filter", CMDEN_GBA)
{
bool menuPress = false;
GetMenuOptionBool("GBALcdFilter", &menuPress);
toggleBooleanVar(&menuPress, &gbaLcdFilter);
SetMenuOption("GBALcdFilter", gbaLcdFilter ? 1 : 0);
utilUpdateSystemColorMaps(gbaLcdFilter);
toggleBooleanVar(&menuPress, &gopts.gba_lcd_filter);
SetMenuOption("GBALcdFilter", gopts.gba_lcd_filter ? 1 : 0);
utilUpdateSystemColorMaps(gopts.gba_lcd_filter);
update_opts();
}
@ -3053,9 +3053,9 @@ EVT_HANDLER_MASK(GBLcdFilter, "Enable LCD filter", CMDEN_GB)
{
bool menuPress = false;
GetMenuOptionBool("GBLcdFilter", &menuPress);
toggleBooleanVar(&menuPress, &gbLcdFilter);
SetMenuOption("GBLcdFilter", gbLcdFilter ? 1 : 0);
utilUpdateSystemColorMaps(gbLcdFilter);
toggleBooleanVar(&menuPress, &gopts.gb_lcd_filter);
SetMenuOption("GBLcdFilter", gopts.gb_lcd_filter ? 1 : 0);
utilUpdateSystemColorMaps(gopts.gb_lcd_filter);
update_opts();
}
@ -3076,14 +3076,6 @@ EVT_HANDLER(ApplyPatches, "Apply IPS/UPS/IPF patches if found")
update_opts();
}
EVT_HANDLER(MMX, "Enable MMX")
{
#ifdef MMX
GetMenuOptionInt("MMX", &enableMMX, 1);
update_opts();
#endif
}
EVT_HANDLER(KeepOnTop, "Keep window on top")
{
GetMenuOptionBool("KeepOnTop", &gopts.keep_on_top);
@ -3099,7 +3091,7 @@ EVT_HANDLER(KeepOnTop, "Keep window on top")
EVT_HANDLER(StatusBar, "Enable status bar")
{
GetMenuOptionInt("StatusBar", &gopts.statusbar, 1);
GetMenuOptionBool("StatusBar", &gopts.statusbar);
update_opts();
MainFrame* mf = wxGetApp().frame;
@ -3125,11 +3117,6 @@ EVT_HANDLER(FrameSkipAuto, "Auto Skip frames.")
update_opts();
}
EVT_HANDLER(Fullscreen, "Enter fullscreen mode at startup")
{
GetMenuOptionConfig("Fullscreen", config::OptionID::kGeomFullScreen);
}
EVT_HANDLER(PauseWhenInactive, "Pause game when main window loses focus")
{
GetMenuOptionInt("PauseWhenInactive", &pauseWhenInactive, 1);
@ -3156,7 +3143,7 @@ EVT_HANDLER(SkipIntro, "Skip BIOS initialization")
EVT_HANDLER(BootRomEn, "Use the specified BIOS file for GBA")
{
GetMenuOptionInt("BootRomEn", &useBiosFileGBA, 1);
GetMenuOptionBool("BootRomEn", &gopts.use_bios_file_gba);
update_opts();
}
@ -3171,20 +3158,20 @@ EVT_HANDLER(BootRomGB, "Use the specified BIOS file for GB")
SetMenuOption("BootRomGB", 0);
}
useBiosFileGB = val;
gopts.use_bios_file_gb = val;
update_opts();
}
EVT_HANDLER(BootRomGBC, "Use the specified BIOS file for GBC")
{
GetMenuOptionInt("BootRomGBC", &useBiosFileGBC, 1);
GetMenuOptionBool("BootRomGBC", &gopts.use_bios_file_gbc);
update_opts();
}
EVT_HANDLER(VSync, "Wait for vertical sync")
{
GetMenuOptionInt("VSync", &vsync, 1);
GetMenuOptionBool("VSync", &gopts.vsync);
update_opts();
panel->ResetPanel();
}
@ -3276,13 +3263,13 @@ EVT_HANDLER(LinkAuto, "Enable link at boot")
EVT_HANDLER(SpeedOn, "Enable faster network protocol by default")
{
GetMenuOptionInt("SpeedOn", &linkHacks, 1);
GetMenuOptionBool("SpeedOn", &gopts.link_hacks);
update_opts();
}
EVT_HANDLER(LinkProto, "Local host IPC")
{
GetMenuOptionInt("LinkProto", &gopts.link_proto, 1);
GetMenuOptionBool("LinkProto", &gopts.link_proto);
update_opts();
enable_menus();
EnableNetworkMenu();
@ -3296,7 +3283,7 @@ EVT_HANDLER(LinkConfigure, "Link options...")
if (ShowModal(dlg) != wxID_OK)
return;
SetLinkTimeout(linkTimeout);
SetLinkTimeout(gopts.link_timeout);
update_opts();
EnableNetworkMenu();
#endif

View File

@ -152,6 +152,11 @@ std::array<Option, kNbOptions>& Option::All() {
#else
RenderMethod render_method = RenderMethod::kOpenGL;
#endif
bool window_maximized = false;
uint32_t window_height = 0;
uint32_t window_width = 0;
int window_pos_x = -1;
int window_pos_y = -1;
};
static OwnedOptions g_owned_opts;
@ -176,7 +181,7 @@ std::array<Option, kNbOptions>& Option::All() {
Option(OptionID::kGBBiosFile, &gopts.gb_bios),
Option(OptionID::kGBColorOption, &gbColorOption, 0, 1),
Option(OptionID::kGBColorizerHack, &colorizerHack, 0, 1),
Option(OptionID::kGBLCDFilter, &gbLcdFilter),
Option(OptionID::kGBLCDFilter, &gopts.gb_lcd_filter),
Option(OptionID::kGBGBCBiosFile, &gopts.gbc_bios),
Option(OptionID::kGBPalette0, systemGbPalette),
Option(OptionID::kGBPalette1, systemGbPalette + 8),
@ -188,15 +193,15 @@ std::array<Option, kNbOptions>& Option::All() {
/// GBA
Option(OptionID::kGBABiosFile, &gopts.gba_bios),
Option(OptionID::kGBALCDFilter, &gbaLcdFilter),
Option(OptionID::kGBALCDFilter, &gopts.gba_lcd_filter),
#ifndef NO_LINK
Option(OptionID::kGBALinkAuto, &gopts.link_auto),
Option(OptionID::kGBALinkFast, &linkHacks, 0, 1),
Option(OptionID::kGBALinkFast, &gopts.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, 0, 1),
Option(OptionID::kGBALinkTimeout, &linkTimeout, 0, 9999999),
Option(OptionID::kGBALinkProto, &gopts.link_proto),
Option(OptionID::kGBALinkTimeout, &gopts.link_timeout, 0, 9999999),
Option(OptionID::kGBALinkType, &gopts.gba_link_type, 0, 5),
#endif
Option(OptionID::kGBAROMDir, &gopts.gba_rom_dir),
@ -210,7 +215,7 @@ std::array<Option, kNbOptions>& Option::All() {
600),
Option(OptionID::kGenScreenshotDir, &gopts.scrshot_dir),
Option(OptionID::kGenStateDir, &gopts.state_dir),
Option(OptionID::kGenStatusBar, &gopts.statusbar, 0, 1),
Option(OptionID::kGenStatusBar, &gopts.statusbar),
/// Joypad
Option(OptionID::kJoy),
@ -225,32 +230,24 @@ std::array<Option, kNbOptions>& Option::All() {
Option(OptionID::kPrefAgbPrint, &agbPrint, 0, 1),
Option(OptionID::kPrefAutoFrameSkip, &autoFrameSkip, 0, 1),
Option(OptionID::kPrefAutoPatch, &autoPatch, 0, 1),
Option(OptionID::kPrefAutoSaveLoadCheatList,
&gopts.autoload_cheats),
Option(OptionID::kPrefAutoSaveLoadCheatList, &gopts.autoload_cheats),
Option(OptionID::kPrefBorderAutomatic, &gbBorderAutomatic, 0, 1),
Option(OptionID::kPrefBorderOn, &gbBorderOn, 0, 1),
Option(OptionID::kPrefCaptureFormat, &captureFormat, 0, 1),
Option(OptionID::kPrefCheatsEnabled, &cheatsEnabled, 0, 1),
#ifdef MMX
Option(OptionID::kPrefEnableMMX, &enableMMX, 0, 1),
#endif
Option(OptionID::kPrefDisableStatus, &disableStatusMessages, 0,
1),
Option(OptionID::kPrefEmulatorType, &gbEmulatorType, 0, 5),
Option(OptionID::kPrefFlashSize, &optFlashSize, 0, 1),
Option(OptionID::kPrefFrameSkip, &frameSkip, -1, 9),
Option(OptionID::kPrefFsColorDepth, &fsColorDepth, 0, 999),
Option(OptionID::kPrefFsFrequency, &fsFrequency, 0, 999),
Option(OptionID::kPrefFsHeight, &fsHeight, 0, 99999),
Option(OptionID::kPrefFsWidth, &fsWidth, 0, 99999),
Option(OptionID::kPrefGBPaletteOption, &gbPaletteOption, 0, 2),
Option(OptionID::kPrefGBPrinter, &winGbPrinterEnabled, 0, 1),
Option(OptionID::kPrefGDBBreakOnLoad, &gdbBreakOnLoad, 0, 1),
Option(OptionID::kPrefGDBPort, &gdbPort, 0, 65535),
Option(OptionID::kPrefGDBBreakOnLoad, &gopts.gdb_break_on_load),
Option(OptionID::kPrefGDBPort, &gopts.gdb_port, 0, 65535),
#ifndef NO_LINK
Option(OptionID::kPrefLinkNumPlayers, &linkNumPlayers, 2, 4),
Option(OptionID::kPrefLinkNumPlayers, &gopts.link_num_players, 2, 4),
#endif
Option(OptionID::kPrefMaxScale, &maxScale, 0, 100),
Option(OptionID::kPrefMaxScale, &gopts.max_scale, 0, 100),
Option(OptionID::kPrefPauseWhenInactive, &pauseWhenInactive, 0,
1),
Option(OptionID::kPrefRTCEnabled, &rtcEnabled, 0, 1),
@ -270,18 +267,18 @@ std::array<Option, kNbOptions>& Option::All() {
300),
Option(OptionID::kPrefSpeedupThrottleFrameSkip,
&speedup_throttle_frame_skip),
Option(OptionID::kPrefUseBiosGB, &useBiosFileGB, 0, 1),
Option(OptionID::kPrefUseBiosGBA, &useBiosFileGBA, 0, 1),
Option(OptionID::kPrefUseBiosGBC, &useBiosFileGBC, 0, 1),
Option(OptionID::kPrefVsync, &vsync, 0, 1),
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),
/// Geometry
Option(OptionID::kGeomFullScreen, &fullScreen, 0, 1),
Option(OptionID::kGeomIsMaximized, &windowMaximized, 0, 1),
Option(OptionID::kGeomWindowHeight, &windowHeight, 0, 99999),
Option(OptionID::kGeomWindowWidth, &windowWidth, 0, 99999),
Option(OptionID::kGeomWindowX, &windowPositionX, -1, 99999),
Option(OptionID::kGeomWindowY, &windowPositionY, -1, 99999),
Option(OptionID::kGeomIsMaximized, &g_owned_opts.window_maximized),
Option(OptionID::kGeomWindowHeight, &g_owned_opts.window_height, 0, 99999),
Option(OptionID::kGeomWindowWidth, &g_owned_opts.window_width, 0, 99999),
Option(OptionID::kGeomWindowX, &g_owned_opts.window_pos_x, -1, 99999),
Option(OptionID::kGeomWindowY, &g_owned_opts.window_pos_y, -1, 99999),
/// UI
Option(OptionID::kUIAllowKeyboardBackgroundInput,
@ -382,7 +379,7 @@ const std::array<OptionData, kNbOptions + 1> kAllOptionsData = {
Option::Type::kBool},
OptionData{"GBA/LinkFast", "SpeedOn",
_("Enable faster network protocol by default"),
Option::Type::kInt},
Option::Type::kBool},
OptionData{"GBA/LinkHost", "", _("Default network link client host"),
Option::Type::kString},
OptionData{"GBA/ServerIP", "", _("Default network link server IP to bind"),
@ -391,7 +388,7 @@ const std::array<OptionData, kNbOptions + 1> kAllOptionsData = {
_("Default network link port (server and client)"),
Option::Type::kUnsigned},
OptionData{"GBA/LinkProto", "LinkProto", _("Default network protocol"),
Option::Type::kInt},
Option::Type::kBool},
OptionData{"GBA/LinkTimeout", "LinkTimeout", _("Link timeout (ms)"),
Option::Type::kInt},
OptionData{"GBA/LinkType", "LinkType", _("Link cable type"),
@ -425,7 +422,7 @@ const std::array<OptionData, kNbOptions + 1> kAllOptionsData = {
"relative to BatteryDir)"),
Option::Type::kString},
OptionData{"General/StatusBar", "StatusBar", _("Enable status bar"),
Option::Type::kInt},
Option::Type::kBool},
/// Joypad
OptionData{"Joypad/*/*", "",
@ -468,10 +465,6 @@ const std::array<OptionData, kNbOptions + 1> kAllOptionsData = {
Option::Type::kInt},
OptionData{"preferences/cheatsEnabled", "", _("Enable cheats"),
Option::Type::kInt},
#ifdef MMX
OptionData{"preferences/enableMMX", "MMX", _("Enable MMX"),
Option::Type::kInt},
#endif
OptionData{"preferences/disableStatus", "NoStatusMsg",
_("Disable on-screen status messages"), Option::Type::kInt},
OptionData{"preferences/emulatorType", "", _("Type of system to emulate"),
@ -482,20 +475,12 @@ const std::array<OptionData, kNbOptions + 1> kAllOptionsData = {
_("Skip frames. Values are 0-9 or -1 to skip automatically "
"based on time."),
Option::Type::kInt},
OptionData{"preferences/fsColorDepth", "",
_("Fullscreen mode color depth (0 = any)"), Option::Type::kInt},
OptionData{"preferences/fsFrequency", "",
_("Fullscreen mode frequency (0 = any)"), Option::Type::kInt},
OptionData{"preferences/fsHeight", "",
_("Fullscreen mode height (0 = desktop)"), Option::Type::kInt},
OptionData{"preferences/fsWidth", "",
_("Fullscreen mode width (0 = desktop)"), Option::Type::kInt},
OptionData{"preferences/gbPaletteOption", "", _("The palette to use"),
Option::Type::kInt},
OptionData{"preferences/gbPrinter", "Printer",
_("Enable printer emulation"), Option::Type::kInt},
OptionData{"preferences/gdbBreakOnLoad", "DebugGDBBreakOnLoad",
_("Break into GDB after loading the game."), Option::Type::kInt},
_("Break into GDB after loading the game."), Option::Type::kBool},
OptionData{"preferences/gdbPort", "DebugGDBPort",
_("Port to connect GDB to."), Option::Type::kInt},
#ifndef NO_LINK
@ -539,19 +524,19 @@ const std::array<OptionData, kNbOptions + 1> kAllOptionsData = {
OptionData{"preferences/speedupThrottleFrameSkip", "",
_("Use frame skip for speedup throttle"), Option::Type::kBool},
OptionData{"preferences/useBiosGB", "BootRomGB",
_("Use the specified BIOS file for GB"), Option::Type::kInt},
_("Use the specified BIOS file for GB"), Option::Type::kBool},
OptionData{"preferences/useBiosGBA", "BootRomEn",
_("Use the specified BIOS file"), Option::Type::kInt},
_("Use the specified BIOS file"), Option::Type::kBool},
OptionData{"preferences/useBiosGBC", "BootRomGBC",
_("Use the specified BIOS file for GBC"), Option::Type::kInt},
_("Use the specified BIOS file for GBC"), Option::Type::kBool},
OptionData{"preferences/vsync", "VSync", _("Wait for vertical sync"),
Option::Type::kInt},
Option::Type::kBool},
/// Geometry
OptionData{"geometry/fullScreen", "Fullscreen",
_("Enter fullscreen mode at startup"), Option::Type::kInt},
OptionData{"geometry/isMaximized", "Maximized", _("Window maximized"),
Option::Type::kInt},
Option::Type::kBool},
OptionData{"geometry/windowHeight", "Height", _("Window height at startup"),
Option::Type::kUnsigned},
OptionData{"geometry/windowWidth", "Width", _("Window width at startup"),

View File

@ -72,17 +72,10 @@ enum class OptionID {
kPrefCaptureFormat,
kPrefCheatsEnabled,
#ifdef MMX
kPrefEnableMMX,
#endif
kPrefDisableStatus,
kPrefEmulatorType,
kPrefFlashSize,
kPrefFrameSkip,
kPrefFsColorDepth,
kPrefFsFrequency,
kPrefFsHeight,
kPrefFsWidth,
kPrefGBPaletteOption,
kPrefGBPrinter,
kPrefGDBBreakOnLoad,

View File

@ -279,7 +279,7 @@ DisplayConfig::DisplayConfig(wxWindow* parent)
// 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.
GetValidatedChild(this, "MaxScale")
->SetValidator(wxGenericValidator(&maxScale));
->SetValidator(wxGenericValidator(&gopts.max_scale));
// Basic
GetValidatedChild(this, "OutputSimple")

View File

@ -124,15 +124,15 @@ public:
}
}
linkNumPlayers = n_players;
gopts.link_num_players = n_players;
update_opts(); // save fast flag and client host
// Close any previous link
CloseLink();
wxString connmsg;
wxString title;
SetLinkTimeout(linkTimeout);
EnableSpeedHacks(linkHacks);
EnableLinkServer(server, linkNumPlayers - 1);
SetLinkTimeout(gopts.link_timeout);
EnableSpeedHacks(gopts.link_hacks);
EnableLinkServer(server, gopts.link_num_players - 1);
if (server) {
char host[length];
@ -2722,17 +2722,6 @@ bool MainFrame::BindControls()
continue;
}
#endif
#ifndef MMX
if (cmdtab[i].cmd_id == XRCID("MMX"))
{
if (mi)
mi->GetMenu()->Remove(mi);
cmdtab[i].cmd_id = XRCID("NOOP");
cmdtab[i].mi = NULL;
continue;
}
#endif
#if defined(NO_ONLINEUPDATES)
if (cmdtab[i].cmd_id == XRCID("UpdateEmu"))
{
@ -2908,7 +2897,6 @@ bool MainFrame::BindControls()
MenuOptionIntMask("JoypadAutoholdR", autohold, KEYM_R);
MenuOptionIntMask("JoypadAutoholdSelect", autohold, KEYM_SELECT);
MenuOptionIntMask("JoypadAutoholdStart", autohold, KEYM_START);
MenuOptionIntMask("MMX", enableMMX, 1);
MenuOptionBool("EmulatorSpeedupToggle", turbo);
MenuOptionIntRadioValue("LinkType0Nothing", gopts.gba_link_type, 0);
MenuOptionIntRadioValue("LinkType1Cable", gopts.gba_link_type, 1);
@ -3067,7 +3055,7 @@ bool MainFrame::BindControls()
#ifndef NO_LINK
{
net_link_handler.dlg = d;
net_link_handler.n_players = linkNumPlayers;
net_link_handler.n_players = gopts.link_num_players;
getrbbe("Server", net_link_handler.server);
getrbbd("Client", net_link_handler.server);
getlab("PlayersLab");
@ -3656,7 +3644,7 @@ bool MainFrame::BindControls()
{
getlab("LinkTimeoutLab");
addbe(lab);
getsc("LinkTimeout", linkTimeout);
getsc("LinkTimeout", gopts.link_timeout);
addbe(sc);
d->Fit();
}
@ -3803,9 +3791,9 @@ bool MainFrame::BindControls()
mf->SetWindowStyle(mf->GetWindowStyle() & ~wxSTAY_ON_TOP);
#ifndef NO_LINK
LinkMode linkMode = GetConfiguredLinkMode();
LinkMode link_mode = GetConfiguredLinkMode();
if (linkMode == LINK_GAMECUBE_DOLPHIN) {
if (link_mode == LINK_GAMECUBE_DOLPHIN) {
bool isv = !gopts.link_host.empty();
if (isv) {
@ -3815,11 +3803,11 @@ bool MainFrame::BindControls()
if (!isv) {
wxLogError(_("JoyBus host invalid; disabling"));
} else {
linkMode = LINK_DISCONNECTED;
link_mode = LINK_DISCONNECTED;
}
}
ConnectionState linkState = InitLink(linkMode);
ConnectionState linkState = InitLink(link_mode);
if (linkState != LINK_OK) {
CloseLink();
@ -3827,8 +3815,8 @@ bool MainFrame::BindControls()
if (GetLinkMode() != LINK_DISCONNECTED) {
cmd_enable |= CMDEN_LINK_ANY;
SetLinkTimeout(linkTimeout);
EnableSpeedHacks(linkHacks);
SetLinkTimeout(gopts.link_timeout);
EnableSpeedHacks(gopts.link_hacks);
}
EnableNetworkMenu();

View File

@ -309,44 +309,19 @@ wxAcceleratorEntry_v sys_accels;
// the default value of every non-object to be 0.
opts_t::opts_t()
{
frameSkip = -1;
audio_api = AUD_SDL;
retain_aspect = true;
max_threads = wxThread::GetCPUCount();
// handle erroneous thread count values appropriately
max_threads = wxThread::GetCPUCount();
if (max_threads > 256)
max_threads = 256;
if (max_threads < 1)
max_threads = 1;
// 10 fixes stuttering on mac with openal, as opposed to 5
// also should be better for modern hardware in general
audio_buffers = 10;
sound_en = 0x30f;
sound_vol = 100;
sound_qual = 1;
gb_echo = 20;
gb_stereo = 15;
gb_declick = true;
gba_sound_filter = 50;
bilinear = true;
default_stick = 1;
recent = new wxFileHistory(10);
autofire_rate = 1;
print_auto_page = true;
// These are globals being set here.
frameSkip = -1;
autoPatch = true;
// quick fix for issues #48 and #445
link_host = "127.0.0.1";
server_ip = "*";
link_port = 5738;
hide_menu_bar = true;
skipSaveGameBattery = true;
}
@ -571,9 +546,10 @@ void load_opts() {
}
}
// Make sure linkTimeout is not set to 1, which was the previous default.
if (linkTimeout <= 1)
linkTimeout = 500;
// Make sure link_timeout is not set to 1, which was the previous default.
if (gopts.link_timeout <= 1) {
gopts.link_timeout = 500;
}
// recent is special
// Recent does not get written with defaults

View File

@ -23,73 +23,92 @@ extern struct opts_t {
// I instead organized this by opts.cpp table order
/// Display
bool bilinear;
bool bilinear = true;
wxVideoMode fs_mode;
int max_threads;
bool retain_aspect;
bool keep_on_top;
int max_threads = 0;
bool retain_aspect = true;
bool keep_on_top = false;
/// GB
wxString gb_bios;
bool gb_colorizer_hack = false;
bool gb_lcd_filter = false;
wxString gbc_bios;
// uint16_t systemGbPalette[8*3];
bool print_auto_page, print_screen_cap;
bool print_auto_page = true;
bool print_screen_cap = false;
wxString gb_rom_dir;
wxString gbc_rom_dir;
/// 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;
wxString link_host;
wxString server_ip;
uint32_t link_port;
int link_proto;
bool link_auto;
wxString gba_rom_dir;
/// General
bool autoload_state, autoload_cheats;
bool autoload_state = false;
bool autoload_cheats = false;
wxString battery_dir;
long last_update;
wxString last_updated_filename;
bool recent_freeze;
bool recent_freeze = false;
wxString recording_dir;
int rewind_interval;
int rewind_interval = 0;
wxString scrshot_dir;
wxString state_dir;
int statusbar;
bool statusbar = false;
/// Joypad
std::map<config::GameControl, std::set<config::UserInput>>
game_control_bindings;
int autofire_rate;
int default_stick;
int autofire_rate = 1;
int default_stick = 1;
/// Keyboard
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;
int audio_buffers;
int audio_api = 0;
// 10 fixes stuttering on mac with openal, as opposed to 5
// also should be better for modern hardware in general
int audio_buffers = 10;
wxString audio_dev;
int sound_en; // soundSetEnable()
int gba_sound_filter;
int sound_en = 0x30f; // soundSetEnable()
int gba_sound_filter = 50;
bool soundInterpolation;
bool gb_declick;
int gb_echo;
bool gb_declick = true;
int gb_echo = 20;
bool gb_effects_config_enabled;
bool dsound_hw_accel;
int gb_stereo;
int gb_stereo = 15;
bool gb_effects_config_surround;
int sound_qual; // soundSetSampleRate() / gbSoundSetSampleRate()
int sound_vol; // soundSetVolume()
bool upmix; // xa2 only
int sound_qual = 1; // soundSetSampleRate() / gbSoundSetSampleRate()
int sound_vol = 100; // soundSetVolume()
bool upmix = false; // xa2 only
/// Recent
wxFileHistory* recent;
wxFileHistory* recent = nullptr;
/// UI Config
bool hide_menu_bar;
bool hide_menu_bar = true;
/// wxWindows
// wxWidgets-generated options (opaque)

View File

@ -258,16 +258,17 @@ void GameArea::LoadGame(const wxString& name)
// Disable bios loading when using colorizer hack.
if (useBiosFileGB && colorizerHack) {
if (gopts.use_bios_file_gb && colorizerHack) {
wxLogError(_("Cannot use GB BIOS file when Colorizer Hack is enabled, disabling GB BIOS file."));
useBiosFileGB = 0;
gopts.use_bios_file_gb = false;
update_opts();
}
// Set up the core for the colorizer hack.
setColorizerHack(colorizerHack);
bool use_bios = gbCgbMode ? useBiosFileGBC : useBiosFileGB;
bool use_bios =
gbCgbMode ? gopts.use_bios_file_gbc : gopts.use_bios_file_gb;
wxCharBuffer fnb(UTF8((gbCgbMode ? gopts.gbc_bios : gopts.gb_bios)));
const char* fn = fnb.data();
@ -372,9 +373,9 @@ void GameArea::LoadGame(const wxString& name)
rtcEnableRumble(true);
CPUInit(UTF8(gopts.gba_bios), useBiosFileGBA);
CPUInit(UTF8(gopts.gba_bios), gopts.use_bios_file_gba);
if (useBiosFileGBA && !useBios) {
if (gopts.use_bios_file_gba && !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
@ -512,8 +513,8 @@ void GameArea::LoadGame(const wxString& name)
#ifndef NO_LINK
if (gopts.link_auto) {
linkMode = mf->GetConfiguredLinkMode();
BootLink(linkMode, UTF8(gopts.link_host), linkTimeout, linkHacks, linkNumPlayers);
BootLink(mf->GetConfiguredLinkMode(), UTF8(gopts.link_host),
gopts.link_timeout, gopts.link_hacks, gopts.link_num_players);
}
#endif
@ -1067,7 +1068,7 @@ void GameArea::OnIdle(wxIdleEvent& event)
LoadGame(pl);
#ifndef NO_DEBUGGER
if (gdbBreakOnLoad)
if (gopts.gdb_break_on_load)
mf->GDBBreak();
if (debugger && loaded != IMAGE_GBA) {
@ -1148,9 +1149,9 @@ void GameArea::OnIdle(wxIdleEvent& event)
if (allowKeyboardBackgroundInput)
enableKeyboardBackgroundInput(w);
if (maxScale)
w->SetMaxSize(wxSize(basic_width * maxScale,
basic_height * maxScale));
if (gopts.max_scale)
w->SetMaxSize(wxSize(basic_width * gopts.max_scale,
basic_height * gopts.max_scale));
// if user changed Display/Scale config, this needs to run
AdjustMinSize();
@ -1190,8 +1191,10 @@ void GameArea::OnIdle(wxIdleEvent& event)
w->SetFocus();
// generate system color maps (after output module init)
if (loaded == IMAGE_GBA) utilUpdateSystemColorMaps(gbaLcdFilter);
else if (loaded == IMAGE_GB) utilUpdateSystemColorMaps(gbLcdFilter);
if (loaded == IMAGE_GBA)
utilUpdateSystemColorMaps(gopts.gba_lcd_filter);
else if (loaded == IMAGE_GB)
utilUpdateSystemColorMaps(gopts.gb_lcd_filter);
else utilUpdateSystemColorMaps(false);
}
@ -2265,16 +2268,16 @@ void GLDrawingPanel::DrawingPanelInit()
#if defined(__WXGTK__)
if (IsWayland()) {
#ifdef HAVE_EGL
if (vsync)
if (gopts.vsync)
wxLogDebug(_("Enabling EGL VSync."));
else
wxLogDebug(_("Disabling EGL VSync."));
eglSwapInterval(0, vsync);
eglSwapInterval(0, gopts.vsync);
#endif
}
else {
if (vsync)
if (gopts.vsync)
wxLogDebug(_("Enabling GLX VSync."));
else
wxLogDebug(_("Disabling GLX VSync."));
@ -2292,7 +2295,8 @@ void GLDrawingPanel::DrawingPanelInit()
{
glXSwapIntervalEXT = reinterpret_cast<PFNGLXSWAPINTERVALEXTPROC>(glXGetProcAddress((const GLubyte*)"glXSwapIntervalEXT"));
if (glXSwapIntervalEXT)
glXSwapIntervalEXT(glXGetCurrentDisplay(), glXGetCurrentDrawable(), vsync);
glXSwapIntervalEXT(glXGetCurrentDisplay(),
glXGetCurrentDrawable(), gopts.vsync);
else
systemScreenMessage(_("Failed to set glXSwapIntervalEXT"));
}
@ -2301,7 +2305,7 @@ void GLDrawingPanel::DrawingPanelInit()
glXSwapIntervalSGI = reinterpret_cast<PFNGLXSWAPINTERVALSGIPROC>(glXGetProcAddress((const GLubyte*)("glXSwapIntervalSGI")));
if (glXSwapIntervalSGI)
glXSwapIntervalSGI(vsync);
glXSwapIntervalSGI(gopts.vsync);
else
systemScreenMessage(_("Failed to set glXSwapIntervalSGI"));
}
@ -2310,7 +2314,7 @@ void GLDrawingPanel::DrawingPanelInit()
glXSwapIntervalMESA = reinterpret_cast<PFNGLXSWAPINTERVALMESAPROC>(glXGetProcAddress((const GLubyte*)("glXSwapIntervalMESA")));
if (glXSwapIntervalMESA)
glXSwapIntervalMESA(vsync);
glXSwapIntervalMESA(gopts.vsync);
else
systemScreenMessage(_("Failed to set glXSwapIntervalMESA"));
}
@ -2329,11 +2333,11 @@ void GLDrawingPanel::DrawingPanelInit()
static PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL;
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
if (wglSwapIntervalEXT)
wglSwapIntervalEXT(vsync);
wglSwapIntervalEXT(gopts.vsync);
else
systemScreenMessage(_("Failed to set wglSwapIntervalEXT"));
#elif defined(__WXMAC__)
int swap_interval = vsync ? 1 : 0;
int swap_interval = gopts.vsync ? 1 : 0;
CGLContextObj cgl_context = CGLGetCurrentContext();
CGLSetParameter(cgl_context, kCGLCPSwapInterval, &swap_interval);
#else

View File

@ -31,6 +31,7 @@ int RGB_LOW_BITS_MASK;
// these are local, though.
int autofire, autohold;
static int sensorx[4], sensory[4], sensorz[4];
int sunBars = 1;
bool pause_next;
bool turbo;

View File

@ -476,7 +476,7 @@ bool wxvbamApp::OnInit() {
int width = config::OptGeomWindowWidth()->GetUnsigned();
int height = config::OptGeomWindowHeight()->GetUnsigned();
bool isFullscreen = config::OptGeomFullScreen()->GetInt();
bool isMaximized = config::OptGeomIsMaximized()->GetInt();
bool isMaximized = config::OptGeomIsMaximized()->GetBool();
frame = wxDynamicCast(xr->LoadFrame(nullptr, "MainFrame"), MainFrame);
if (!frame) {
@ -865,7 +865,7 @@ void MainFrame::OnSize(wxSizeEvent& event)
}
}
config::OptGeomIsMaximized()->SetInt(IsMaximized());
config::OptGeomIsMaximized()->SetBool(IsMaximized());
config::OptGeomFullScreen()->SetInt(IsFullScreen());
}

View File

@ -351,10 +351,6 @@
<label>_Retain aspect ratio</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="MMX">
<label>Enable MMX</label>
<checkable>1</checkable>
</object>
<object class="separator"/>
<object class="wxMenuItem" name="Bilinear">
<label>_Bilinear filter</label>