Move core options to a struct
Options used by the core emulator were set with global variables. This moves all of the options used by the core emulator into a new struct, shared by all 3 frontends.
This commit is contained in:
parent
64921c6535
commit
60568d26e0
|
@ -428,11 +428,9 @@ bool utilWriteBMPFile(const char *fileName, int w, int h, uint8_t *pix)
|
||||||
}
|
}
|
||||||
#endif /* !__LIBRETRO__ */
|
#endif /* !__LIBRETRO__ */
|
||||||
|
|
||||||
extern bool cpuIsMultiBoot;
|
|
||||||
|
|
||||||
bool utilIsGBAImage(const char *file)
|
bool utilIsGBAImage(const char *file)
|
||||||
{
|
{
|
||||||
cpuIsMultiBoot = false;
|
coreOptions.cpuIsMultiBoot = false;
|
||||||
if (strlen(file) > 4) {
|
if (strlen(file) > 4) {
|
||||||
const char *p = strrchr(file, '.');
|
const char *p = strrchr(file, '.');
|
||||||
|
|
||||||
|
@ -441,7 +439,7 @@ bool utilIsGBAImage(const char *file)
|
||||||
(_stricmp(p, ".bin") == 0) || (_stricmp(p, ".elf") == 0))
|
(_stricmp(p, ".bin") == 0) || (_stricmp(p, ".elf") == 0))
|
||||||
return true;
|
return true;
|
||||||
if (_stricmp(p, ".mb") == 0) {
|
if (_stricmp(p, ".mb") == 0) {
|
||||||
cpuIsMultiBoot = true;
|
coreOptions.cpuIsMultiBoot = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -870,7 +868,7 @@ void utilGBAFindSave(const int size)
|
||||||
}
|
}
|
||||||
rtcEnable(rtcFound);
|
rtcEnable(rtcFound);
|
||||||
rtcEnableRumble(!rtcFound);
|
rtcEnableRumble(!rtcFound);
|
||||||
saveType = detectedSaveType;
|
coreOptions.saveType = detectedSaveType;
|
||||||
flashSetSize(flashSize);
|
flashSetSize(flashSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,11 +99,6 @@ char path[2048];
|
||||||
|
|
||||||
dictionary* preferences;
|
dictionary* preferences;
|
||||||
|
|
||||||
bool cpuIsMultiBoot = false;
|
|
||||||
bool mirroringEnable = true;
|
|
||||||
bool parseDebug = true;
|
|
||||||
bool speedHack = false;
|
|
||||||
bool speedup = false;
|
|
||||||
const char* batteryDir;
|
const char* batteryDir;
|
||||||
const char* biosFileNameGB;
|
const char* biosFileNameGB;
|
||||||
const char* biosFileNameGBA;
|
const char* biosFileNameGBA;
|
||||||
|
@ -117,36 +112,23 @@ int autoFireMaxCount = 1;
|
||||||
int autoFrameSkip = 0;
|
int autoFrameSkip = 0;
|
||||||
int autoPatch;
|
int autoPatch;
|
||||||
int captureFormat = 0;
|
int captureFormat = 0;
|
||||||
int cheatsEnabled = true;
|
|
||||||
int colorizerHack = 0;
|
int colorizerHack = 0;
|
||||||
int cpuDisableSfx = false;
|
|
||||||
int cpuSaveType = 0;
|
|
||||||
int disableStatusMessages = 0;
|
int disableStatusMessages = 0;
|
||||||
int filter = kStretch2x;
|
int filter = kStretch2x;
|
||||||
int frameSkip = 1;
|
int frameSkip = 1;
|
||||||
int fullScreen;
|
int fullScreen;
|
||||||
int ifbType = kIFBNone;
|
int ifbType = kIFBNone;
|
||||||
int layerEnable = 0xff00;
|
|
||||||
int layerSettings = 0xff00;
|
|
||||||
int openGL;
|
int openGL;
|
||||||
int optFlashSize;
|
int optFlashSize;
|
||||||
int optPrintUsage;
|
int optPrintUsage;
|
||||||
int pauseWhenInactive = 0;
|
int pauseWhenInactive = 0;
|
||||||
int preparedCheats = 0;
|
int preparedCheats = 0;
|
||||||
int rewindTimer = 0;
|
int rewindTimer = 0;
|
||||||
int rtcEnabled;
|
|
||||||
int saveType = GBA_SAVE_AUTO;
|
|
||||||
int showSpeed;
|
int showSpeed;
|
||||||
int showSpeedTransparent;
|
int showSpeedTransparent;
|
||||||
int skipBios = 0;
|
|
||||||
int skipSaveGameBattery = true;
|
|
||||||
int skipSaveGameCheats = false;
|
|
||||||
int useBios = 0;
|
|
||||||
int winGbPrinterEnabled;
|
|
||||||
uint32_t throttle = 100;
|
uint32_t throttle = 100;
|
||||||
uint32_t speedup_throttle = 100;
|
uint32_t speedup_throttle = 100;
|
||||||
uint32_t speedup_frame_skip = 9;
|
uint32_t speedup_frame_skip = 9;
|
||||||
bool speedup_throttle_frame_skip = false;
|
|
||||||
bool allowKeyboardBackgroundInput = false;
|
bool allowKeyboardBackgroundInput = false;
|
||||||
bool allowJoystickBackgroundInput = true;
|
bool allowJoystickBackgroundInput = true;
|
||||||
|
|
||||||
|
@ -179,14 +161,14 @@ struct option argOptions[] = {
|
||||||
{ "border-on", no_argument, &gbBorderOn, 1 },
|
{ "border-on", no_argument, &gbBorderOn, 1 },
|
||||||
{ "capture-format", required_argument, 0, OPT_CAPTURE_FORMAT },
|
{ "capture-format", required_argument, 0, OPT_CAPTURE_FORMAT },
|
||||||
{ "cheat", required_argument, 0, OPT_CHEAT },
|
{ "cheat", required_argument, 0, OPT_CHEAT },
|
||||||
{ "cheats-enabled", no_argument, &cheatsEnabled, 1 },
|
{ "cheats-enabled", no_argument, &coreOptions.cheatsEnabled, 1 },
|
||||||
{ "color-option", no_argument, &gbColorOption, 1 },
|
{ "color-option", no_argument, &gbColorOption, 1 },
|
||||||
{ "colorizer-hack", no_argument, &colorizerHack, 1 },
|
{ "colorizer-hack", no_argument, &colorizerHack, 1 },
|
||||||
{ "config", required_argument, 0, 'c' },
|
{ "config", required_argument, 0, 'c' },
|
||||||
{ "cpu-disable-sfx", no_argument, &cpuDisableSfx, 1 },
|
{ "cpu-disable-sfx", no_argument, &coreOptions.cpuDisableSfx, 1 },
|
||||||
{ "cpu-save-type", required_argument, 0, OPT_CPU_SAVE_TYPE },
|
{ "cpu-save-type", required_argument, 0, OPT_CPU_SAVE_TYPE },
|
||||||
{ "debug", no_argument, 0, 'd' },
|
{ "debug", no_argument, 0, 'd' },
|
||||||
{ "disable-sfx", no_argument, &cpuDisableSfx, 1 },
|
{ "disable-sfx", no_argument, &coreOptions.cpuDisableSfx, 1 },
|
||||||
{ "disable-status-messages", no_argument, &disableStatusMessages, 1 },
|
{ "disable-status-messages", no_argument, &disableStatusMessages, 1 },
|
||||||
{ "dotcode-file-name-load", required_argument, 0, OPT_DOTCODE_FILE_NAME_LOAD },
|
{ "dotcode-file-name-load", required_argument, 0, OPT_DOTCODE_FILE_NAME_LOAD },
|
||||||
{ "dotcode-file-name-save", required_argument, 0, OPT_DOTCODE_FILE_NAME_SAVE },
|
{ "dotcode-file-name-save", required_argument, 0, OPT_DOTCODE_FILE_NAME_SAVE },
|
||||||
|
@ -202,7 +184,7 @@ struct option argOptions[] = {
|
||||||
{ "gb-emulator-type", required_argument, 0, OPT_GB_EMULATOR_TYPE },
|
{ "gb-emulator-type", required_argument, 0, OPT_GB_EMULATOR_TYPE },
|
||||||
{ "gb-frame-skip", required_argument, 0, OPT_GB_FRAME_SKIP },
|
{ "gb-frame-skip", required_argument, 0, OPT_GB_FRAME_SKIP },
|
||||||
{ "gb-palette-option", required_argument, 0, OPT_GB_PALETTE_OPTION },
|
{ "gb-palette-option", required_argument, 0, OPT_GB_PALETTE_OPTION },
|
||||||
{ "gb-printer", no_argument, &winGbPrinterEnabled, 1 },
|
{ "gb-printer", no_argument, &coreOptions.winGbPrinterEnabled, 1 },
|
||||||
{ "gdb", required_argument, 0, 'G' },
|
{ "gdb", required_argument, 0, 'G' },
|
||||||
{ "help", no_argument, &optPrintUsage, 1 },
|
{ "help", no_argument, &optPrintUsage, 1 },
|
||||||
{ "ifb-filter", required_argument, 0, 'I' },
|
{ "ifb-filter", required_argument, 0, 'I' },
|
||||||
|
@ -213,7 +195,7 @@ struct option argOptions[] = {
|
||||||
{ "no-opengl", no_argument, &openGL, 0 },
|
{ "no-opengl", no_argument, &openGL, 0 },
|
||||||
{ "no-patch", no_argument, &autoPatch, 0 },
|
{ "no-patch", no_argument, &autoPatch, 0 },
|
||||||
{ "no-pause-when-inactive", no_argument, &pauseWhenInactive, 0 },
|
{ "no-pause-when-inactive", no_argument, &pauseWhenInactive, 0 },
|
||||||
{ "no-rtc", no_argument, &rtcEnabled, 0 },
|
{ "no-rtc", no_argument, &coreOptions.rtcEnabled, 0 },
|
||||||
{ "no-show-speed", no_argument, &showSpeed, 0 },
|
{ "no-show-speed", no_argument, &showSpeed, 0 },
|
||||||
{ "opengl", required_argument, 0, 'O' },
|
{ "opengl", required_argument, 0, 'O' },
|
||||||
{ "opengl-bilinear", no_argument, &openGL, 2 },
|
{ "opengl-bilinear", no_argument, &openGL, 2 },
|
||||||
|
@ -223,32 +205,32 @@ struct option argOptions[] = {
|
||||||
{ "pause-when-inactive", no_argument, &pauseWhenInactive, 1 },
|
{ "pause-when-inactive", no_argument, &pauseWhenInactive, 1 },
|
||||||
{ "profile", optional_argument, 0, 'p' },
|
{ "profile", optional_argument, 0, 'p' },
|
||||||
{ "rewind-timer", required_argument, 0, OPT_REWIND_TIMER },
|
{ "rewind-timer", required_argument, 0, OPT_REWIND_TIMER },
|
||||||
{ "rtc", no_argument, &rtcEnabled, 1 },
|
{ "rtc", no_argument, &coreOptions.rtcEnabled, 1 },
|
||||||
{ "rtc-enabled", required_argument, 0, OPT_RTC_ENABLED },
|
{ "rtc-enabled", required_argument, 0, OPT_RTC_ENABLED },
|
||||||
{ "save-auto", no_argument, &cpuSaveType, 0 },
|
{ "save-auto", no_argument, &coreOptions.cpuSaveType, 0 },
|
||||||
{ "save-dir", required_argument, 0, OPT_SAVE_DIR },
|
{ "save-dir", required_argument, 0, OPT_SAVE_DIR },
|
||||||
{ "save-eeprom", no_argument, &cpuSaveType, 1 },
|
{ "save-eeprom", no_argument, &coreOptions.cpuSaveType, 1 },
|
||||||
{ "save-flash", no_argument, &cpuSaveType, 3 },
|
{ "save-flash", no_argument, &coreOptions.cpuSaveType, 3 },
|
||||||
{ "save-none", no_argument, &cpuSaveType, 5 },
|
{ "save-none", no_argument, &coreOptions.cpuSaveType, 5 },
|
||||||
{ "save-sensor", no_argument, &cpuSaveType, 4 },
|
{ "save-sensor", no_argument, &coreOptions.cpuSaveType, 4 },
|
||||||
{ "save-sram", no_argument, &cpuSaveType, 2 },
|
{ "save-sram", no_argument, &coreOptions.cpuSaveType, 2 },
|
||||||
{ "save-type", required_argument, 0, 't' },
|
{ "save-type", required_argument, 0, 't' },
|
||||||
{ "screen-shot-dir", required_argument, 0, OPT_SCREEN_SHOT_DIR },
|
{ "screen-shot-dir", required_argument, 0, OPT_SCREEN_SHOT_DIR },
|
||||||
{ "show-speed", required_argument, 0, OPT_SHOW_SPEED },
|
{ "show-speed", required_argument, 0, OPT_SHOW_SPEED },
|
||||||
{ "show-speed-detailed", no_argument, &showSpeed, 2 },
|
{ "show-speed-detailed", no_argument, &showSpeed, 2 },
|
||||||
{ "show-speed-normal", no_argument, &showSpeed, 1 },
|
{ "show-speed-normal", no_argument, &showSpeed, 1 },
|
||||||
{ "show-speed-transparent", required_argument, 0, OPT_SHOW_SPEED_TRANSPARENT },
|
{ "show-speed-transparent", required_argument, 0, OPT_SHOW_SPEED_TRANSPARENT },
|
||||||
{ "skip-bios", no_argument, &skipBios, 1 },
|
{ "skip-bios", no_argument, &coreOptions.skipBios, 1 },
|
||||||
{ "skip-save-game-battery", no_argument, &skipSaveGameBattery, 1 },
|
{ "skip-save-game-battery", no_argument, &coreOptions.skipSaveGameBattery, 1 },
|
||||||
{ "skip-save-game-cheats", no_argument, &skipSaveGameCheats, 1 },
|
{ "skip-save-game-cheats", no_argument, &coreOptions.skipSaveGameCheats, 1 },
|
||||||
{ "sound-filtering", required_argument, 0, OPT_SOUND_FILTERING },
|
{ "sound-filtering", required_argument, 0, OPT_SOUND_FILTERING },
|
||||||
{ "throttle", required_argument, 0, 'T' },
|
{ "throttle", required_argument, 0, 'T' },
|
||||||
{ "speedup-throttle", required_argument, 0, OPT_SPEEDUP_THROTTLE },
|
{ "speedup-throttle", required_argument, 0, OPT_SPEEDUP_THROTTLE },
|
||||||
{ "speedup-frame-skip", required_argument, 0, OPT_SPEEDUP_FRAME_SKIP },
|
{ "speedup-frame-skip", required_argument, 0, OPT_SPEEDUP_FRAME_SKIP },
|
||||||
{ "no-speedup-throttle-frame-skip", no_argument, 0, OPT_NO_SPEEDUP_THROTTLE_FRAME_SKIP },
|
{ "no-speedup-throttle-frame-skip", no_argument, 0, OPT_NO_SPEEDUP_THROTTLE_FRAME_SKIP },
|
||||||
{ "use-bios", no_argument, &useBios, 1 },
|
{ "use-bios", no_argument, &coreOptions.useBios, 1 },
|
||||||
{ "verbose", required_argument, 0, 'v' },
|
{ "verbose", required_argument, 0, 'v' },
|
||||||
{ "win-gb-printer-enabled", no_argument, &winGbPrinterEnabled, 1 },
|
{ "win-gb-printer-enabled", no_argument, &coreOptions.winGbPrinterEnabled, 1 },
|
||||||
|
|
||||||
|
|
||||||
{ NULL, no_argument, NULL, 0 }
|
{ NULL, no_argument, NULL, 0 }
|
||||||
|
@ -295,8 +277,8 @@ void ValidateConfig()
|
||||||
if (filter < kStretch1x || filter >= kInvalidFilter)
|
if (filter < kStretch1x || filter >= kInvalidFilter)
|
||||||
filter = kStretch2x;
|
filter = kStretch2x;
|
||||||
|
|
||||||
if (cpuSaveType < 0 || cpuSaveType > 5)
|
if (coreOptions.cpuSaveType < 0 || coreOptions.cpuSaveType > 5)
|
||||||
cpuSaveType = 0;
|
coreOptions.cpuSaveType = 0;
|
||||||
if (optFlashSize != 0 && optFlashSize != 1)
|
if (optFlashSize != 0 && optFlashSize != 1)
|
||||||
optFlashSize = 0;
|
optFlashSize = 0;
|
||||||
if (ifbType < kIFBNone || ifbType >= kInvalidIFBFilter)
|
if (ifbType < kIFBNone || ifbType >= kInvalidIFBFilter)
|
||||||
|
@ -322,10 +304,10 @@ void LoadConfig()
|
||||||
biosFileNameGBA = ReadPrefString("biosFileGBA");
|
biosFileNameGBA = ReadPrefString("biosFileGBA");
|
||||||
biosFileNameGBC = ReadPrefString("biosFileGBC");
|
biosFileNameGBC = ReadPrefString("biosFileGBC");
|
||||||
captureFormat = ReadPref("captureFormat", 0);
|
captureFormat = ReadPref("captureFormat", 0);
|
||||||
cheatsEnabled = ReadPref("cheatsEnabled", 0);
|
coreOptions.cheatsEnabled = ReadPref("cheatsEnabled", 0);
|
||||||
colorizerHack = ReadPref("colorizerHack", 0);
|
colorizerHack = ReadPref("colorizerHack", 0);
|
||||||
cpuDisableSfx = ReadPref("disableSfx", 0);
|
coreOptions.cpuDisableSfx = ReadPref("disableSfx", 0);
|
||||||
cpuSaveType = ReadPrefHex("saveType");
|
coreOptions.cpuSaveType = ReadPrefHex("saveType");
|
||||||
disableStatusMessages = ReadPrefHex("disableStatus");
|
disableStatusMessages = ReadPrefHex("disableStatus");
|
||||||
filter = ReadPref("filter", 0);
|
filter = ReadPref("filter", 0);
|
||||||
frameSkip = ReadPref("frameSkip", 0);
|
frameSkip = ReadPref("frameSkip", 0);
|
||||||
|
@ -347,23 +329,23 @@ void LoadConfig()
|
||||||
optFlashSize = ReadPref("flashSize", 0);
|
optFlashSize = ReadPref("flashSize", 0);
|
||||||
pauseWhenInactive = ReadPref("pauseWhenInactive", 1);
|
pauseWhenInactive = ReadPref("pauseWhenInactive", 1);
|
||||||
rewindTimer = ReadPref("rewindTimer", 0);
|
rewindTimer = ReadPref("rewindTimer", 0);
|
||||||
rtcEnabled = ReadPref("rtcEnabled", 0);
|
coreOptions.rtcEnabled = ReadPref("rtcEnabled", 0);
|
||||||
saveDir = ReadPrefString("saveDir");
|
saveDir = ReadPrefString("saveDir");
|
||||||
saveDotCodeFile = ReadPrefString("saveDotCodeFile");
|
saveDotCodeFile = ReadPrefString("saveDotCodeFile");
|
||||||
screenShotDir = ReadPrefString("screenShotDir");
|
screenShotDir = ReadPrefString("screenShotDir");
|
||||||
showSpeed = ReadPref("showSpeed", 0);
|
showSpeed = ReadPref("showSpeed", 0);
|
||||||
showSpeedTransparent = ReadPref("showSpeedTransparent", 1);
|
showSpeedTransparent = ReadPref("showSpeedTransparent", 1);
|
||||||
skipBios = ReadPref("skipBios", 0);
|
coreOptions.skipBios = ReadPref("skipBios", 0);
|
||||||
skipSaveGameBattery = ReadPref("skipSaveGameBattery", 1);
|
coreOptions.skipSaveGameBattery = ReadPref("skipSaveGameBattery", 1);
|
||||||
skipSaveGameCheats = ReadPref("skipSaveGameCheats", 0);
|
coreOptions.skipSaveGameCheats = ReadPref("skipSaveGameCheats", 0);
|
||||||
soundFiltering = (float)ReadPref("gbaSoundFiltering", 50) / 100.0f;
|
soundFiltering = (float)ReadPref("gbaSoundFiltering", 50) / 100.0f;
|
||||||
soundInterpolation = ReadPref("gbaSoundInterpolation", 1);
|
soundInterpolation = ReadPref("gbaSoundInterpolation", 1);
|
||||||
throttle = ReadPref("throttle", 100);
|
throttle = ReadPref("throttle", 100);
|
||||||
speedup_throttle = ReadPref("speedupThrottle", 100);
|
speedup_throttle = ReadPref("speedupThrottle", 100);
|
||||||
speedup_frame_skip = ReadPref("speedupFrameSkip", 9);
|
speedup_frame_skip = ReadPref("speedupFrameSkip", 9);
|
||||||
speedup_throttle_frame_skip = ReadPref("speedupThrottleFrameSkip", 0);
|
coreOptions.speedup_throttle_frame_skip = ReadPref("speedupThrottleFrameSkip", 0);
|
||||||
useBios = ReadPrefHex("useBiosGBA");
|
coreOptions.useBios = ReadPrefHex("useBiosGBA");
|
||||||
winGbPrinterEnabled = ReadPref("gbPrinter", 0);
|
coreOptions.winGbPrinterEnabled = ReadPref("gbPrinter", 0);
|
||||||
|
|
||||||
int soundQuality = (ReadPrefHex("soundQuality", 1));
|
int soundQuality = (ReadPrefHex("soundQuality", 1));
|
||||||
switch (soundQuality) {
|
switch (soundQuality) {
|
||||||
|
@ -400,7 +382,7 @@ void LoadConfig()
|
||||||
else
|
else
|
||||||
flashSetSize(0x20000);
|
flashSetSize(0x20000);
|
||||||
|
|
||||||
rtcEnable(rtcEnabled ? true : false);
|
rtcEnable(coreOptions.rtcEnabled ? true : false);
|
||||||
agbPrintEnable(agbPrint ? true : false);
|
agbPrintEnable(agbPrint ? true : false);
|
||||||
|
|
||||||
for (int i = 0; i < 24;) {
|
for (int i = 0; i < 24;) {
|
||||||
|
@ -677,7 +659,7 @@ int ReadOpts(int argc, char ** argv)
|
||||||
autoFireMaxCount = 1;
|
autoFireMaxCount = 1;
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
useBios = true;
|
coreOptions.useBios = true;
|
||||||
if (optarg == NULL) {
|
if (optarg == NULL) {
|
||||||
log("Missing BIOS file name\n");
|
log("Missing BIOS file name\n");
|
||||||
break;
|
break;
|
||||||
|
@ -752,7 +734,7 @@ int ReadOpts(int argc, char ** argv)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 'N':
|
case 'N':
|
||||||
parseDebug = false;
|
coreOptions.parseDebug = false;
|
||||||
break;
|
break;
|
||||||
case 'F':
|
case 'F':
|
||||||
fullScreen = 1;
|
fullScreen = 1;
|
||||||
|
@ -809,7 +791,7 @@ int ReadOpts(int argc, char ** argv)
|
||||||
int a = atoi(optarg);
|
int a = atoi(optarg);
|
||||||
if (a < 0 || a > 5)
|
if (a < 0 || a > 5)
|
||||||
a = 0;
|
a = 0;
|
||||||
cpuSaveType = a;
|
coreOptions.cpuSaveType = a;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
|
@ -863,7 +845,7 @@ int ReadOpts(int argc, char ** argv)
|
||||||
case OPT_RTC_ENABLED:
|
case OPT_RTC_ENABLED:
|
||||||
// --rtc-enabled
|
// --rtc-enabled
|
||||||
if (optarg) {
|
if (optarg) {
|
||||||
rtcEnabled = atoi(optarg);
|
coreOptions.rtcEnabled = atoi(optarg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -949,7 +931,7 @@ int ReadOpts(int argc, char ** argv)
|
||||||
case OPT_CPU_SAVE_TYPE:
|
case OPT_CPU_SAVE_TYPE:
|
||||||
// --cpu-save-type
|
// --cpu-save-type
|
||||||
if (optarg) {
|
if (optarg) {
|
||||||
cpuSaveType = atoi(optarg);
|
coreOptions.cpuSaveType = atoi(optarg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -957,8 +939,8 @@ int ReadOpts(int argc, char ** argv)
|
||||||
// --opt-flash-size
|
// --opt-flash-size
|
||||||
if (optarg) {
|
if (optarg) {
|
||||||
optFlashSize = atoi(optarg);
|
optFlashSize = atoi(optarg);
|
||||||
if (optFlashSize < 0 || optFlashSize > 1)
|
if (optFlashSize < 0 || optFlashSize > 1)
|
||||||
optFlashSize = 0;
|
optFlashSize = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -971,17 +953,17 @@ int ReadOpts(int argc, char ** argv)
|
||||||
// --dotcode-file-name-save
|
// --dotcode-file-name-save
|
||||||
saveDotCodeFile = optarg;
|
saveDotCodeFile = optarg;
|
||||||
break;
|
break;
|
||||||
case OPT_SPEEDUP_THROTTLE:
|
case OPT_SPEEDUP_THROTTLE:
|
||||||
if (optarg)
|
if (optarg)
|
||||||
speedup_throttle = atoi(optarg);
|
speedup_throttle = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
case OPT_SPEEDUP_FRAME_SKIP:
|
case OPT_SPEEDUP_FRAME_SKIP:
|
||||||
if (optarg)
|
if (optarg)
|
||||||
speedup_frame_skip = atoi(optarg);
|
speedup_frame_skip = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
case OPT_NO_SPEEDUP_THROTTLE_FRAME_SKIP:
|
case OPT_NO_SPEEDUP_THROTTLE_FRAME_SKIP:
|
||||||
speedup_throttle_frame_skip = false;
|
coreOptions.speedup_throttle_frame_skip = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return op;
|
return op;
|
||||||
|
|
|
@ -20,11 +20,27 @@
|
||||||
|
|
||||||
#define MAX_CHEATS 16384
|
#define MAX_CHEATS 16384
|
||||||
|
|
||||||
extern bool cpuIsMultiBoot;
|
extern struct CoreOptions {
|
||||||
extern bool mirroringEnable;
|
bool cpuIsMultiBoot = false;
|
||||||
extern bool parseDebug;
|
bool mirroringEnable = true;
|
||||||
extern bool speedHack;
|
bool parseDebug = true;
|
||||||
extern bool speedup;
|
bool speedHack = false;
|
||||||
|
bool speedup = false;
|
||||||
|
bool speedup_throttle_frame_skip = false;
|
||||||
|
int cheatsEnabled = 1;
|
||||||
|
int cpuDisableSfx = 0;
|
||||||
|
int cpuSaveType = 0;
|
||||||
|
int layerSettings = 0xff00;
|
||||||
|
int layerEnable = 0xff00;
|
||||||
|
int rtcEnabled = 0;
|
||||||
|
int saveType = 0;
|
||||||
|
int skipBios = 0;
|
||||||
|
int skipSaveGameBattery = 1;
|
||||||
|
int skipSaveGameCheats = 0;
|
||||||
|
int useBios = 0;
|
||||||
|
int winGbPrinterEnabled = 1;
|
||||||
|
} coreOptions;
|
||||||
|
|
||||||
extern const char *biosFileNameGB;
|
extern const char *biosFileNameGB;
|
||||||
extern const char *biosFileNameGBA;
|
extern const char *biosFileNameGBA;
|
||||||
extern const char *biosFileNameGBC;
|
extern const char *biosFileNameGBC;
|
||||||
|
@ -35,35 +51,22 @@ extern int autoFireMaxCount;
|
||||||
extern int autoFrameSkip;
|
extern int autoFrameSkip;
|
||||||
extern int autoPatch;
|
extern int autoPatch;
|
||||||
extern int captureFormat;
|
extern int captureFormat;
|
||||||
extern int cheatsEnabled;
|
|
||||||
extern int colorizerHack;
|
extern int colorizerHack;
|
||||||
extern int cpuDisableSfx;
|
|
||||||
extern int cpuSaveType;
|
|
||||||
extern int disableStatusMessages;
|
extern int disableStatusMessages;
|
||||||
extern int filter;
|
extern int filter;
|
||||||
extern int frameSkip;
|
extern int frameSkip;
|
||||||
extern int fullScreen;
|
extern int fullScreen;
|
||||||
extern int ifbType;
|
extern int ifbType;
|
||||||
extern int layerEnable;
|
|
||||||
extern int layerSettings;
|
|
||||||
extern int openGL;
|
extern int openGL;
|
||||||
extern int optFlashSize;
|
extern int optFlashSize;
|
||||||
extern int optPrintUsage;
|
extern int optPrintUsage;
|
||||||
extern int pauseWhenInactive;
|
extern int pauseWhenInactive;
|
||||||
extern int rewindTimer;
|
extern int rewindTimer;
|
||||||
extern int rtcEnabled;
|
|
||||||
extern int saveType;
|
|
||||||
extern int showSpeed;
|
extern int showSpeed;
|
||||||
extern int showSpeedTransparent;
|
extern int showSpeedTransparent;
|
||||||
extern int skipBios;
|
|
||||||
extern int skipSaveGameBattery;
|
|
||||||
extern int skipSaveGameCheats;
|
|
||||||
extern int useBios;
|
|
||||||
extern int winGbPrinterEnabled;
|
|
||||||
extern uint32_t throttle;
|
extern uint32_t throttle;
|
||||||
extern uint32_t speedup_throttle;
|
extern uint32_t speedup_throttle;
|
||||||
extern uint32_t speedup_frame_skip;
|
extern uint32_t speedup_frame_skip;
|
||||||
extern bool speedup_throttle_frame_skip;
|
|
||||||
extern bool allowKeyboardBackgroundInput;
|
extern bool allowKeyboardBackgroundInput;
|
||||||
extern bool allowJoystickBackgroundInput;
|
extern bool allowJoystickBackgroundInput;
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ void SoundSDL::soundCallback(void* data, uint8_t* stream, int len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SoundSDL::should_wait() {
|
bool SoundSDL::should_wait() {
|
||||||
return emulating && !speedup && current_rate && !gba_joybus_active;
|
return emulating && !coreOptions.speedup && current_rate && !gba_joybus_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t SoundSDL::buffer_size() {
|
std::size_t SoundSDL::buffer_size() {
|
||||||
|
|
|
@ -1067,7 +1067,7 @@ void gbWriteMemory(uint16_t address, uint8_t value)
|
||||||
EmuReseted = false;
|
EmuReseted = false;
|
||||||
gbMemory[0xff02] = value;
|
gbMemory[0xff02] = value;
|
||||||
if (gbSerialOn && (GetLinkMode() == LINK_GAMEBOY_IPC || GetLinkMode() == LINK_GAMEBOY_SOCKET
|
if (gbSerialOn && (GetLinkMode() == LINK_GAMEBOY_IPC || GetLinkMode() == LINK_GAMEBOY_SOCKET
|
||||||
|| GetLinkMode() == LINK_DISCONNECTED || winGbPrinterEnabled)) {
|
|| GetLinkMode() == LINK_DISCONNECTED || coreOptions.winGbPrinterEnabled)) {
|
||||||
|
|
||||||
gbSerialTicks = GBSERIAL_CLOCK_TICKS;
|
gbSerialTicks = GBSERIAL_CLOCK_TICKS;
|
||||||
|
|
||||||
|
@ -2205,7 +2205,7 @@ void gbCPUInit(const char* biosFileName, bool useBiosFile)
|
||||||
if (!(gbHardware & 7))
|
if (!(gbHardware & 7))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
useBios = false;
|
coreOptions.useBios = false;
|
||||||
if (useBiosFile) {
|
if (useBiosFile) {
|
||||||
int expectedSize = (gbHardware & 2) ? 0x900 : 0x100;
|
int expectedSize = (gbHardware & 2) ? 0x900 : 0x100;
|
||||||
int size = expectedSize;
|
int size = expectedSize;
|
||||||
|
@ -2214,7 +2214,7 @@ void gbCPUInit(const char* biosFileName, bool useBiosFile)
|
||||||
bios,
|
bios,
|
||||||
size)) {
|
size)) {
|
||||||
if (size == expectedSize)
|
if (size == expectedSize)
|
||||||
useBios = true;
|
coreOptions.useBios = true;
|
||||||
else
|
else
|
||||||
systemMessage(MSG_INVALID_BIOS_FILE_SIZE, N_("Invalid BOOTROM file size"));
|
systemMessage(MSG_INVALID_BIOS_FILE_SIZE, N_("Invalid BOOTROM file size"));
|
||||||
}
|
}
|
||||||
|
@ -2565,7 +2565,7 @@ void gbReset()
|
||||||
}
|
}
|
||||||
|
|
||||||
// used for the handling of the gb Boot Rom
|
// used for the handling of the gb Boot Rom
|
||||||
if ((gbHardware & 7) && (bios != NULL) && useBios && !skipBios) {
|
if ((gbHardware & 7) && (bios != NULL) && coreOptions.useBios && !coreOptions.skipBios) {
|
||||||
if (gbHardware & 5) {
|
if (gbHardware & 5) {
|
||||||
memcpy((uint8_t*)(gbMemory), (uint8_t*)(gbRom), 0x1000);
|
memcpy((uint8_t*)(gbMemory), (uint8_t*)(gbRom), 0x1000);
|
||||||
memcpy((uint8_t*)(gbMemory), (uint8_t*)(bios), 0x100);
|
memcpy((uint8_t*)(gbMemory), (uint8_t*)(bios), 0x100);
|
||||||
|
@ -3632,7 +3632,7 @@ static bool gbWriteSaveState(gzFile gzFile)
|
||||||
|
|
||||||
utilGzWrite(gzFile, &gbRom[0x134], 15);
|
utilGzWrite(gzFile, &gbRom[0x134], 15);
|
||||||
|
|
||||||
utilWriteInt(gzFile, useBios);
|
utilWriteInt(gzFile, coreOptions.useBios);
|
||||||
utilWriteInt(gzFile, inBios);
|
utilWriteInt(gzFile, inBios);
|
||||||
|
|
||||||
utilWriteData(gzFile, gbSaveGameStruct);
|
utilWriteData(gzFile, gbSaveGameStruct);
|
||||||
|
@ -3749,8 +3749,8 @@ static bool gbReadSaveState(gzFile gzFile)
|
||||||
ub = utilReadInt(gzFile) ? true : false;
|
ub = utilReadInt(gzFile) ? true : false;
|
||||||
ib = utilReadInt(gzFile) ? true : false;
|
ib = utilReadInt(gzFile) ? true : false;
|
||||||
|
|
||||||
if ((ub != useBios) && (ib)) {
|
if ((ub != coreOptions.useBios) && (ib)) {
|
||||||
if (useBios)
|
if (coreOptions.useBios)
|
||||||
systemMessage(MSG_SAVE_GAME_NOT_USING_BIOS,
|
systemMessage(MSG_SAVE_GAME_NOT_USING_BIOS,
|
||||||
N_("Save game is not using the BIOS files"));
|
N_("Save game is not using the BIOS files"));
|
||||||
else
|
else
|
||||||
|
@ -3806,7 +3806,7 @@ static bool gbReadSaveState(gzFile gzFile)
|
||||||
if (version >= 11) {
|
if (version >= 11) {
|
||||||
utilGzRead(gzFile, &gbDataTAMA5, sizeof(gbDataTAMA5));
|
utilGzRead(gzFile, &gbDataTAMA5, sizeof(gbDataTAMA5));
|
||||||
if (gbTAMA5ram != NULL) {
|
if (gbTAMA5ram != NULL) {
|
||||||
if (skipSaveGameBattery) {
|
if (coreOptions.skipSaveGameBattery) {
|
||||||
utilGzSeek(gzFile, gbTAMA5ramSize, SEEK_CUR);
|
utilGzSeek(gzFile, gbTAMA5ramSize, SEEK_CUR);
|
||||||
} else {
|
} else {
|
||||||
utilGzRead(gzFile, gbTAMA5ram, gbTAMA5ramSize);
|
utilGzRead(gzFile, gbTAMA5ram, gbTAMA5ramSize);
|
||||||
|
@ -3839,14 +3839,14 @@ static bool gbReadSaveState(gzFile gzFile)
|
||||||
|
|
||||||
if (gbRamSize && gbRam) {
|
if (gbRamSize && gbRam) {
|
||||||
if (version < 11)
|
if (version < 11)
|
||||||
if (skipSaveGameBattery) {
|
if (coreOptions.skipSaveGameBattery) {
|
||||||
utilGzSeek(gzFile, gbRamSize, SEEK_CUR); //skip
|
utilGzSeek(gzFile, gbRamSize, SEEK_CUR); //skip
|
||||||
} else {
|
} else {
|
||||||
utilGzRead(gzFile, gbRam, gbRamSize); //read
|
utilGzRead(gzFile, gbRam, gbRamSize); //read
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int ramSize = utilReadInt(gzFile);
|
int ramSize = utilReadInt(gzFile);
|
||||||
if (skipSaveGameBattery) {
|
if (coreOptions.skipSaveGameBattery) {
|
||||||
utilGzSeek(gzFile, (gbRamSize > ramSize) ? ramSize : gbRamSize, SEEK_CUR); //skip
|
utilGzSeek(gzFile, (gbRamSize > ramSize) ? ramSize : gbRamSize, SEEK_CUR); //skip
|
||||||
} else {
|
} else {
|
||||||
utilGzRead(gzFile, gbRam, (gbRamSize > ramSize) ? ramSize : gbRamSize); //read
|
utilGzRead(gzFile, gbRam, (gbRamSize > ramSize) ? ramSize : gbRamSize); //read
|
||||||
|
@ -3978,7 +3978,7 @@ static bool gbReadSaveState(gzFile gzFile)
|
||||||
systemDrawScreen();
|
systemDrawScreen();
|
||||||
|
|
||||||
if (version > GBSAVE_GAME_VERSION_1) {
|
if (version > GBSAVE_GAME_VERSION_1) {
|
||||||
if (skipSaveGameCheats) {
|
if (coreOptions.skipSaveGameCheats) {
|
||||||
gbCheatsReadGameSkip(gzFile, version);
|
gbCheatsReadGameSkip(gzFile, version);
|
||||||
} else {
|
} else {
|
||||||
gbCheatsReadGame(gzFile, version);
|
gbCheatsReadGame(gzFile, version);
|
||||||
|
@ -4967,7 +4967,7 @@ void gbEmulate(int ticksToStop)
|
||||||
speedup_throttle_set = true;
|
speedup_throttle_set = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (speedup_throttle_frame_skip)
|
if (coreOptions.speedup_throttle_frame_skip)
|
||||||
framesToSkip += std::ceil(double(speedup_throttle) / 100.0) - 1;
|
framesToSkip += std::ceil(double(speedup_throttle) / 100.0) - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5036,10 +5036,10 @@ void gbEmulate(int ticksToStop)
|
||||||
|
|
||||||
newmask = (gbJoymask[0] >> 10);
|
newmask = (gbJoymask[0] >> 10);
|
||||||
|
|
||||||
speedup = false;
|
coreOptions.speedup = false;
|
||||||
|
|
||||||
if (newmask & 1 && !speedup_throttle_set)
|
if (newmask & 1 && !speedup_throttle_set)
|
||||||
speedup = true;
|
coreOptions.speedup = true;
|
||||||
|
|
||||||
gbCapture = (newmask & 2) ? true : false;
|
gbCapture = (newmask & 2) ? true : false;
|
||||||
|
|
||||||
|
@ -5201,7 +5201,7 @@ void gbEmulate(int ticksToStop)
|
||||||
gbDrawLine();
|
gbDrawLine();
|
||||||
} else if ((register_LY == 144) && (!systemFrameSkip)) {
|
} else if ((register_LY == 144) && (!systemFrameSkip)) {
|
||||||
int framesToSkip = systemFrameSkip;
|
int framesToSkip = systemFrameSkip;
|
||||||
//if (speedup)
|
//if (coreOptions.speedup)
|
||||||
// framesToSkip = 9; // try 6 FPS during speedup
|
// framesToSkip = 9; // try 6 FPS during speedup
|
||||||
if ((gbFrameSkipCount >= framesToSkip) || (gbWhiteScreen == 1)) {
|
if ((gbFrameSkipCount >= framesToSkip) || (gbWhiteScreen == 1)) {
|
||||||
gbWhiteScreen = 2;
|
gbWhiteScreen = 2;
|
||||||
|
@ -5529,7 +5529,7 @@ unsigned int gbWriteSaveState(uint8_t* data)
|
||||||
|
|
||||||
utilWriteMem(data, &gbRom[0x134], 15);
|
utilWriteMem(data, &gbRom[0x134], 15);
|
||||||
|
|
||||||
utilWriteIntMem(data, useBios);
|
utilWriteIntMem(data, coreOptions.useBios);
|
||||||
utilWriteIntMem(data, inBios);
|
utilWriteIntMem(data, inBios);
|
||||||
|
|
||||||
utilWriteDataMem(data, gbSaveGameStruct);
|
utilWriteDataMem(data, gbSaveGameStruct);
|
||||||
|
@ -5616,8 +5616,8 @@ bool gbReadSaveState(const uint8_t* data)
|
||||||
ub = utilReadIntMem(data) ? true : false;
|
ub = utilReadIntMem(data) ? true : false;
|
||||||
ib = utilReadIntMem(data) ? true : false;
|
ib = utilReadIntMem(data) ? true : false;
|
||||||
|
|
||||||
if ((ub != useBios) && (ib)) {
|
if ((ub != coreOptions.useBios) && (ib)) {
|
||||||
if (useBios)
|
if (coreOptions.useBios)
|
||||||
systemMessage(MSG_SAVE_GAME_NOT_USING_BIOS,
|
systemMessage(MSG_SAVE_GAME_NOT_USING_BIOS,
|
||||||
N_("Save game is not using the BIOS files"));
|
N_("Save game is not using the BIOS files"));
|
||||||
else
|
else
|
||||||
|
|
|
@ -434,7 +434,7 @@ bool gbCheatReadGSCodeFile(const char* fileName)
|
||||||
// Used to emulated GG codes
|
// Used to emulated GG codes
|
||||||
uint8_t gbCheatRead(uint16_t address)
|
uint8_t gbCheatRead(uint16_t address)
|
||||||
{
|
{
|
||||||
if (!cheatsEnabled)
|
if (!coreOptions.cheatsEnabled)
|
||||||
return gbMemoryMap[address >> 12][address & 0xFFF];
|
return gbMemoryMap[address >> 12][address & 0xFFF];
|
||||||
|
|
||||||
for (int i = 0; i < gbCheatNumber; i++) {
|
for (int i = 0; i < gbCheatNumber; i++) {
|
||||||
|
@ -456,7 +456,7 @@ uint8_t gbCheatRead(uint16_t address)
|
||||||
// Used to emulate GS codes.
|
// Used to emulate GS codes.
|
||||||
void gbCheatWrite(bool reboot)
|
void gbCheatWrite(bool reboot)
|
||||||
{
|
{
|
||||||
if (cheatsEnabled) {
|
if (coreOptions.cheatsEnabled) {
|
||||||
uint16_t address = 0;
|
uint16_t address = 0;
|
||||||
|
|
||||||
if (gbNextCheat >= gbCheatNumber)
|
if (gbNextCheat >= gbCheatNumber)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
|
|
||||||
#include "../Util.h"
|
#include "../Util.h"
|
||||||
|
#include "../common/ConfigManager.h"
|
||||||
#include "gbGlobals.h"
|
#include "gbGlobals.h"
|
||||||
#include "gbSGB.h"
|
#include "gbSGB.h"
|
||||||
|
|
||||||
|
@ -42,7 +43,6 @@ uint8_t gbInvertTab[256] = {
|
||||||
uint16_t gbLineMix[160];
|
uint16_t gbLineMix[160];
|
||||||
uint16_t gbWindowColor[160];
|
uint16_t gbWindowColor[160];
|
||||||
extern int inUseRegister_WY;
|
extern int inUseRegister_WY;
|
||||||
extern int layerSettings;
|
|
||||||
|
|
||||||
void gbRenderLine()
|
void gbRenderLine()
|
||||||
{
|
{
|
||||||
|
@ -104,7 +104,7 @@ void gbRenderLine()
|
||||||
int tile_pattern_address = tile_pattern + tile * 16 + by * 2;
|
int tile_pattern_address = tile_pattern + tile * 16 + by * 2;
|
||||||
|
|
||||||
if (register_LCDC & 0x80) {
|
if (register_LCDC & 0x80) {
|
||||||
if ((register_LCDC & 0x01 || gbCgbMode) && (layerSettings & 0x0100)) {
|
if ((register_LCDC & 0x01 || gbCgbMode) && (coreOptions.layerSettings & 0x0100)) {
|
||||||
while (x < 160) {
|
while (x < 160) {
|
||||||
|
|
||||||
uint8_t tile_a = 0;
|
uint8_t tile_a = 0;
|
||||||
|
@ -215,7 +215,7 @@ void gbRenderLine()
|
||||||
// LCDC.0 also enables/disables the window in !gbCgbMode ?!?!
|
// LCDC.0 also enables/disables the window in !gbCgbMode ?!?!
|
||||||
// (tested on real hardware)
|
// (tested on real hardware)
|
||||||
// This fixes Last Bible II & Zankurou Musouken
|
// This fixes Last Bible II & Zankurou Musouken
|
||||||
if ((register_LCDC & 0x01 || gbCgbMode) && (register_LCDC & 0x20) && (layerSettings & 0x2000) && (gbWindowLine != -2)) {
|
if ((register_LCDC & 0x01 || gbCgbMode) && (register_LCDC & 0x20) && (coreOptions.layerSettings & 0x2000) && (gbWindowLine != -2)) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
// Fix (accurate emulation) for most of the window display problems
|
// Fix (accurate emulation) for most of the window display problems
|
||||||
// (ie. Zen - Intergalactic Ninja, Urusei Yatsura...).
|
// (ie. Zen - Intergalactic Ninja, Urusei Yatsura...).
|
||||||
|
@ -536,7 +536,7 @@ void gbDrawSprites(bool draw)
|
||||||
if (!(register_LCDC & 0x80))
|
if (!(register_LCDC & 0x80))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((register_LCDC & 2) && (layerSettings & 0x1000)) {
|
if ((register_LCDC & 2) && (coreOptions.layerSettings & 0x1000)) {
|
||||||
int yc = register_LY;
|
int yc = register_LY;
|
||||||
|
|
||||||
int address = 0xfe00;
|
int address = 0xfe00;
|
||||||
|
|
|
@ -85,16 +85,16 @@ uint8_t flashRead(uint32_t address)
|
||||||
|
|
||||||
void flashSaveDecide(uint32_t address, uint8_t byte)
|
void flashSaveDecide(uint32_t address, uint8_t byte)
|
||||||
{
|
{
|
||||||
if (saveType == GBA_SAVE_EEPROM)
|
if (coreOptions.saveType == GBA_SAVE_EEPROM)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (cpuSramEnabled && cpuFlashEnabled) {
|
if (cpuSramEnabled && cpuFlashEnabled) {
|
||||||
if (address == 0x0e005555) {
|
if (address == 0x0e005555) {
|
||||||
saveType = GBA_SAVE_FLASH;
|
coreOptions.saveType = GBA_SAVE_FLASH;
|
||||||
cpuSramEnabled = false;
|
cpuSramEnabled = false;
|
||||||
cpuSaveGameFunc = flashWrite;
|
cpuSaveGameFunc = flashWrite;
|
||||||
} else {
|
} else {
|
||||||
saveType = GBA_SAVE_SRAM;
|
coreOptions.saveType = GBA_SAVE_SRAM;
|
||||||
cpuFlashEnabled = false;
|
cpuFlashEnabled = false;
|
||||||
cpuSaveGameFunc = sramWrite;
|
cpuSaveGameFunc = sramWrite;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ void flashSaveDecide(uint32_t address, uint8_t byte)
|
||||||
|
|
||||||
void flashDelayedWrite(uint32_t address, uint8_t byte)
|
void flashDelayedWrite(uint32_t address, uint8_t byte)
|
||||||
{
|
{
|
||||||
saveType = GBA_SAVE_FLASH;
|
coreOptions.saveType = GBA_SAVE_FLASH;
|
||||||
cpuSaveGameFunc = flashWrite;
|
cpuSaveGameFunc = flashWrite;
|
||||||
flashWrite(address, byte);
|
flashWrite(address, byte);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2830,7 +2830,7 @@ static void tester(void) {
|
||||||
int armExecute()
|
int armExecute()
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
if (cheatsEnabled) {
|
if (coreOptions.cheatsEnabled) {
|
||||||
cpuMasterCodeCheck();
|
cpuMasterCodeCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2000,7 +2000,7 @@ static insnfunc_t thumbInsnTable[1024] = {
|
||||||
int thumbExecute()
|
int thumbExecute()
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
if (cheatsEnabled) {
|
if (coreOptions.cheatsEnabled) {
|
||||||
cpuMasterCodeCheck();
|
cpuMasterCodeCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
116
src/gba/GBA.cpp
116
src/gba/GBA.cpp
|
@ -85,7 +85,7 @@ uint8_t freezeOAM[SIZE_OAM];
|
||||||
bool debugger_last;
|
bool debugger_last;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int lcdTicks = (useBios && !skipBios) ? 1008 : 208;
|
int lcdTicks = (coreOptions.useBios && !coreOptions.skipBios) ? 1008 : 208;
|
||||||
uint8_t timerOnOffDelay = 0;
|
uint8_t timerOnOffDelay = 0;
|
||||||
uint16_t timer0Value = 0;
|
uint16_t timer0Value = 0;
|
||||||
bool timer0On = false;
|
bool timer0On = false;
|
||||||
|
@ -454,7 +454,7 @@ variable_desc saveGameStruct[] = {
|
||||||
{ &armIrqEnable, sizeof(bool) },
|
{ &armIrqEnable, sizeof(bool) },
|
||||||
{ &armNextPC, sizeof(uint32_t) },
|
{ &armNextPC, sizeof(uint32_t) },
|
||||||
{ &armMode, sizeof(int) },
|
{ &armMode, sizeof(int) },
|
||||||
{ &saveType, sizeof(int) },
|
{ &coreOptions.saveType, sizeof(int) },
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -579,16 +579,16 @@ extern uint32_t line3[240];
|
||||||
|
|
||||||
void CPUUpdateRenderBuffers(bool force)
|
void CPUUpdateRenderBuffers(bool force)
|
||||||
{
|
{
|
||||||
if (!(layerEnable & 0x0100) || force) {
|
if (!(coreOptions.layerEnable & 0x0100) || force) {
|
||||||
CLEAR_ARRAY(line0);
|
CLEAR_ARRAY(line0);
|
||||||
}
|
}
|
||||||
if (!(layerEnable & 0x0200) || force) {
|
if (!(coreOptions.layerEnable & 0x0200) || force) {
|
||||||
CLEAR_ARRAY(line1);
|
CLEAR_ARRAY(line1);
|
||||||
}
|
}
|
||||||
if (!(layerEnable & 0x0400) || force) {
|
if (!(coreOptions.layerEnable & 0x0400) || force) {
|
||||||
CLEAR_ARRAY(line2);
|
CLEAR_ARRAY(line2);
|
||||||
}
|
}
|
||||||
if (!(layerEnable & 0x0800) || force) {
|
if (!(coreOptions.layerEnable & 0x0800) || force) {
|
||||||
CLEAR_ARRAY(line3);
|
CLEAR_ARRAY(line3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -602,7 +602,7 @@ unsigned int CPUWriteState(uint8_t* data)
|
||||||
|
|
||||||
utilWriteIntMem(data, SAVE_GAME_VERSION);
|
utilWriteIntMem(data, SAVE_GAME_VERSION);
|
||||||
utilWriteMem(data, &rom[0xa0], 16);
|
utilWriteMem(data, &rom[0xa0], 16);
|
||||||
utilWriteIntMem(data, useBios);
|
utilWriteIntMem(data, coreOptions.useBios);
|
||||||
utilWriteMem(data, ®[0], sizeof(reg));
|
utilWriteMem(data, ®[0], sizeof(reg));
|
||||||
|
|
||||||
utilWriteDataMem(data, saveGameStruct);
|
utilWriteDataMem(data, saveGameStruct);
|
||||||
|
@ -670,7 +670,7 @@ bool CPUReadState(const uint8_t* data)
|
||||||
|
|
||||||
//// Copypasta stuff ...
|
//// Copypasta stuff ...
|
||||||
// set pointers!
|
// set pointers!
|
||||||
layerEnable = layerSettings & DISPCNT;
|
coreOptions.layerEnable = coreOptions.layerSettings & DISPCNT;
|
||||||
|
|
||||||
CPUUpdateRender();
|
CPUUpdateRender();
|
||||||
|
|
||||||
|
@ -684,7 +684,7 @@ bool CPUReadState(const uint8_t* data)
|
||||||
CPUUpdateWindow0();
|
CPUUpdateWindow0();
|
||||||
CPUUpdateWindow1();
|
CPUUpdateWindow1();
|
||||||
|
|
||||||
SetSaveType(saveType);
|
SetSaveType(coreOptions.saveType);
|
||||||
|
|
||||||
systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
|
systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
|
||||||
if (armState) {
|
if (armState) {
|
||||||
|
@ -706,7 +706,7 @@ static bool CPUWriteState(gzFile gzFile)
|
||||||
|
|
||||||
utilGzWrite(gzFile, &rom[0xa0], 16);
|
utilGzWrite(gzFile, &rom[0xa0], 16);
|
||||||
|
|
||||||
utilWriteInt(gzFile, useBios);
|
utilWriteInt(gzFile, coreOptions.useBios);
|
||||||
|
|
||||||
utilGzWrite(gzFile, ®[0], sizeof(reg));
|
utilGzWrite(gzFile, ®[0], sizeof(reg));
|
||||||
|
|
||||||
|
@ -799,8 +799,8 @@ static bool CPUReadState(gzFile gzFile)
|
||||||
|
|
||||||
bool ub = utilReadInt(gzFile) ? true : false;
|
bool ub = utilReadInt(gzFile) ? true : false;
|
||||||
|
|
||||||
if (ub != useBios) {
|
if (ub != coreOptions.useBios) {
|
||||||
if (useBios)
|
if (coreOptions.useBios)
|
||||||
systemMessage(MSG_SAVE_GAME_NOT_USING_BIOS,
|
systemMessage(MSG_SAVE_GAME_NOT_USING_BIOS,
|
||||||
N_("Save game is not using the BIOS files"));
|
N_("Save game is not using the BIOS files"));
|
||||||
else
|
else
|
||||||
|
@ -842,7 +842,7 @@ static bool CPUReadState(gzFile gzFile)
|
||||||
utilGzRead(gzFile, pix, SIZE_PIX);
|
utilGzRead(gzFile, pix, SIZE_PIX);
|
||||||
utilGzRead(gzFile, ioMem, SIZE_IOMEM);
|
utilGzRead(gzFile, ioMem, SIZE_IOMEM);
|
||||||
|
|
||||||
if (skipSaveGameBattery) {
|
if (coreOptions.skipSaveGameBattery) {
|
||||||
// skip eeprom data
|
// skip eeprom data
|
||||||
eepromReadGameSkip(gzFile, version);
|
eepromReadGameSkip(gzFile, version);
|
||||||
// skip flash data
|
// skip flash data
|
||||||
|
@ -854,7 +854,7 @@ static bool CPUReadState(gzFile gzFile)
|
||||||
soundReadGame(gzFile, version);
|
soundReadGame(gzFile, version);
|
||||||
|
|
||||||
if (version > SAVE_GAME_VERSION_1) {
|
if (version > SAVE_GAME_VERSION_1) {
|
||||||
if (skipSaveGameCheats) {
|
if (coreOptions.skipSaveGameCheats) {
|
||||||
// skip cheats list data
|
// skip cheats list data
|
||||||
cheatsReadGameSkip(gzFile, version);
|
cheatsReadGameSkip(gzFile, version);
|
||||||
} else {
|
} else {
|
||||||
|
@ -897,14 +897,14 @@ static bool CPUReadState(gzFile gzFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
// set pointers!
|
// set pointers!
|
||||||
layerEnable = layerSettings & DISPCNT;
|
coreOptions.layerEnable = coreOptions.layerSettings & DISPCNT;
|
||||||
|
|
||||||
CPUUpdateRender();
|
CPUUpdateRender();
|
||||||
CPUUpdateRenderBuffers(true);
|
CPUUpdateRenderBuffers(true);
|
||||||
CPUUpdateWindow0();
|
CPUUpdateWindow0();
|
||||||
CPUUpdateWindow1();
|
CPUUpdateWindow1();
|
||||||
|
|
||||||
SetSaveType(saveType);
|
SetSaveType(coreOptions.saveType);
|
||||||
|
|
||||||
systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
|
systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
|
||||||
if (armState) {
|
if (armState) {
|
||||||
|
@ -971,7 +971,7 @@ bool CPUExportEepromFile(const char* fileName)
|
||||||
|
|
||||||
bool CPUWriteBatteryFile(const char* fileName)
|
bool CPUWriteBatteryFile(const char* fileName)
|
||||||
{
|
{
|
||||||
if ((saveType) && (saveType != GBA_SAVE_NONE)) {
|
if ((coreOptions.saveType) && (coreOptions.saveType != GBA_SAVE_NONE)) {
|
||||||
FILE* file = utilOpenFile(fileName, "wb");
|
FILE* file = utilOpenFile(fileName, "wb");
|
||||||
|
|
||||||
if (!file) {
|
if (!file) {
|
||||||
|
@ -982,12 +982,12 @@ bool CPUWriteBatteryFile(const char* fileName)
|
||||||
|
|
||||||
// only save if Flash/Sram in use or EEprom in use
|
// only save if Flash/Sram in use or EEprom in use
|
||||||
if (!eepromInUse) {
|
if (!eepromInUse) {
|
||||||
if (saveType == GBA_SAVE_FLASH) { // save flash type
|
if (coreOptions.saveType == GBA_SAVE_FLASH) { // save flash type
|
||||||
if (fwrite(flashSaveMemory, 1, flashSize, file) != (size_t)flashSize) {
|
if (fwrite(flashSaveMemory, 1, flashSize, file) != (size_t)flashSize) {
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (saveType == GBA_SAVE_SRAM) { // save sram type
|
} else if (coreOptions.saveType == GBA_SAVE_SRAM) { // save sram type
|
||||||
if (fwrite(flashSaveMemory, 1, 0x8000, file) != 0x8000) {
|
if (fwrite(flashSaveMemory, 1, 0x8000, file) != 0x8000) {
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return false;
|
return false;
|
||||||
|
@ -1154,7 +1154,7 @@ bool CPUWriteGSASnapshot(const char* fileName,
|
||||||
fwrite(buffer, 1, 4, file); // notes length
|
fwrite(buffer, 1, 4, file); // notes length
|
||||||
fwrite(notes, 1, strlen(notes), file);
|
fwrite(notes, 1, strlen(notes), file);
|
||||||
int saveSize = 0x10000;
|
int saveSize = 0x10000;
|
||||||
if (saveType == GBA_SAVE_FLASH)
|
if (coreOptions.saveType == GBA_SAVE_FLASH)
|
||||||
saveSize = flashSize;
|
saveSize = flashSize;
|
||||||
int totalSize = saveSize + 0x1c;
|
int totalSize = saveSize + 0x1c;
|
||||||
|
|
||||||
|
@ -1300,7 +1300,7 @@ bool CPUIsZipFile(const char* file)
|
||||||
|
|
||||||
bool CPUIsGBAImage(const char* file)
|
bool CPUIsGBAImage(const char* file)
|
||||||
{
|
{
|
||||||
cpuIsMultiBoot = false;
|
coreOptions.cpuIsMultiBoot = false;
|
||||||
if (strlen(file) > 4) {
|
if (strlen(file) > 4) {
|
||||||
const char* p = strrchr(file, '.');
|
const char* p = strrchr(file, '.');
|
||||||
|
|
||||||
|
@ -1314,7 +1314,7 @@ bool CPUIsGBAImage(const char* file)
|
||||||
if (_stricmp(p, ".elf") == 0)
|
if (_stricmp(p, ".elf") == 0)
|
||||||
return true;
|
return true;
|
||||||
if (_stricmp(p, ".mb") == 0) {
|
if (_stricmp(p, ".mb") == 0) {
|
||||||
cpuIsMultiBoot = true;
|
coreOptions.cpuIsMultiBoot = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1486,7 +1486,7 @@ int CPULoadRom(const char* szFile)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t* whereToLoad = cpuIsMultiBoot ? workRAM : rom;
|
uint8_t* whereToLoad = coreOptions.cpuIsMultiBoot ? workRAM : rom;
|
||||||
|
|
||||||
#ifndef NO_DEBUGGER
|
#ifndef NO_DEBUGGER
|
||||||
if (CPUIsELF(szFile)) {
|
if (CPUIsELF(szFile)) {
|
||||||
|
@ -1612,7 +1612,7 @@ int CPULoadRomData(const char* data, int size)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t* whereToLoad = cpuIsMultiBoot ? workRAM : rom;
|
uint8_t* whereToLoad = coreOptions.cpuIsMultiBoot ? workRAM : rom;
|
||||||
|
|
||||||
romSize = size % 2 == 0 ? size : size + 1;
|
romSize = size % 2 == 0 ? size : size + 1;
|
||||||
memcpy(whereToLoad, data, size);
|
memcpy(whereToLoad, data, size);
|
||||||
|
@ -1747,49 +1747,49 @@ void CPUUpdateRender()
|
||||||
{
|
{
|
||||||
switch (DISPCNT & 7) {
|
switch (DISPCNT & 7) {
|
||||||
case 0:
|
case 0:
|
||||||
if ((!fxOn && !windowOn && !(layerEnable & 0x8000)) || cpuDisableSfx)
|
if ((!fxOn && !windowOn && !(coreOptions.layerEnable & 0x8000)) || coreOptions.cpuDisableSfx)
|
||||||
renderLine = mode0RenderLine;
|
renderLine = mode0RenderLine;
|
||||||
else if (fxOn && !windowOn && !(layerEnable & 0x8000))
|
else if (fxOn && !windowOn && !(coreOptions.layerEnable & 0x8000))
|
||||||
renderLine = mode0RenderLineNoWindow;
|
renderLine = mode0RenderLineNoWindow;
|
||||||
else
|
else
|
||||||
renderLine = mode0RenderLineAll;
|
renderLine = mode0RenderLineAll;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if ((!fxOn && !windowOn && !(layerEnable & 0x8000)) || cpuDisableSfx)
|
if ((!fxOn && !windowOn && !(coreOptions.layerEnable & 0x8000)) || coreOptions.cpuDisableSfx)
|
||||||
renderLine = mode1RenderLine;
|
renderLine = mode1RenderLine;
|
||||||
else if (fxOn && !windowOn && !(layerEnable & 0x8000))
|
else if (fxOn && !windowOn && !(coreOptions.layerEnable & 0x8000))
|
||||||
renderLine = mode1RenderLineNoWindow;
|
renderLine = mode1RenderLineNoWindow;
|
||||||
else
|
else
|
||||||
renderLine = mode1RenderLineAll;
|
renderLine = mode1RenderLineAll;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if ((!fxOn && !windowOn && !(layerEnable & 0x8000)) || cpuDisableSfx)
|
if ((!fxOn && !windowOn && !(coreOptions.layerEnable & 0x8000)) || coreOptions.cpuDisableSfx)
|
||||||
renderLine = mode2RenderLine;
|
renderLine = mode2RenderLine;
|
||||||
else if (fxOn && !windowOn && !(layerEnable & 0x8000))
|
else if (fxOn && !windowOn && !(coreOptions.layerEnable & 0x8000))
|
||||||
renderLine = mode2RenderLineNoWindow;
|
renderLine = mode2RenderLineNoWindow;
|
||||||
else
|
else
|
||||||
renderLine = mode2RenderLineAll;
|
renderLine = mode2RenderLineAll;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if ((!fxOn && !windowOn && !(layerEnable & 0x8000)) || cpuDisableSfx)
|
if ((!fxOn && !windowOn && !(coreOptions.layerEnable & 0x8000)) || coreOptions.cpuDisableSfx)
|
||||||
renderLine = mode3RenderLine;
|
renderLine = mode3RenderLine;
|
||||||
else if (fxOn && !windowOn && !(layerEnable & 0x8000))
|
else if (fxOn && !windowOn && !(coreOptions.layerEnable & 0x8000))
|
||||||
renderLine = mode3RenderLineNoWindow;
|
renderLine = mode3RenderLineNoWindow;
|
||||||
else
|
else
|
||||||
renderLine = mode3RenderLineAll;
|
renderLine = mode3RenderLineAll;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if ((!fxOn && !windowOn && !(layerEnable & 0x8000)) || cpuDisableSfx)
|
if ((!fxOn && !windowOn && !(coreOptions.layerEnable & 0x8000)) || coreOptions.cpuDisableSfx)
|
||||||
renderLine = mode4RenderLine;
|
renderLine = mode4RenderLine;
|
||||||
else if (fxOn && !windowOn && !(layerEnable & 0x8000))
|
else if (fxOn && !windowOn && !(coreOptions.layerEnable & 0x8000))
|
||||||
renderLine = mode4RenderLineNoWindow;
|
renderLine = mode4RenderLineNoWindow;
|
||||||
else
|
else
|
||||||
renderLine = mode4RenderLineAll;
|
renderLine = mode4RenderLineAll;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
if ((!fxOn && !windowOn && !(layerEnable & 0x8000)) || cpuDisableSfx)
|
if ((!fxOn && !windowOn && !(coreOptions.layerEnable & 0x8000)) || coreOptions.cpuDisableSfx)
|
||||||
renderLine = mode5RenderLine;
|
renderLine = mode5RenderLine;
|
||||||
else if (fxOn && !windowOn && !(layerEnable & 0x8000))
|
else if (fxOn && !windowOn && !(coreOptions.layerEnable & 0x8000))
|
||||||
renderLine = mode5RenderLineNoWindow;
|
renderLine = mode5RenderLineNoWindow;
|
||||||
else
|
else
|
||||||
renderLine = mode5RenderLineAll;
|
renderLine = mode5RenderLineAll;
|
||||||
|
@ -2042,7 +2042,7 @@ void CPUSoftwareInterrupt(int comment)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (useBios) {
|
if (coreOptions.useBios) {
|
||||||
#ifdef GBA_LOGGING
|
#ifdef GBA_LOGGING
|
||||||
if (systemVerbose & VERBOSE_SWI) {
|
if (systemVerbose & VERBOSE_SWI) {
|
||||||
log("SWI: %08x at %08x (0x%08x,0x%08x,0x%08x,VCOUNT = %2d)\n", comment,
|
log("SWI: %08x at %08x (0x%08x,0x%08x,0x%08x,VCOUNT = %2d)\n", comment,
|
||||||
|
@ -2329,7 +2329,7 @@ void CPUCompareVCOUNT()
|
||||||
if (layerEnableDelay > 0) {
|
if (layerEnableDelay > 0) {
|
||||||
layerEnableDelay--;
|
layerEnableDelay--;
|
||||||
if (layerEnableDelay == 1)
|
if (layerEnableDelay == 1)
|
||||||
layerEnable = layerSettings & DISPCNT;
|
coreOptions.layerEnable = coreOptions.layerSettings & DISPCNT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2679,13 +2679,13 @@ void CPUUpdateRegister(uint32_t address, uint16_t value)
|
||||||
|
|
||||||
if (changeBGon) {
|
if (changeBGon) {
|
||||||
layerEnableDelay = 4;
|
layerEnableDelay = 4;
|
||||||
layerEnable = layerSettings & value & (~changeBGon);
|
coreOptions.layerEnable = coreOptions.layerSettings & value & (~changeBGon);
|
||||||
} else {
|
} else {
|
||||||
layerEnable = layerSettings & value;
|
coreOptions.layerEnable = coreOptions.layerSettings & value;
|
||||||
// CPUUpdateTicks();
|
// CPUUpdateTicks();
|
||||||
}
|
}
|
||||||
|
|
||||||
windowOn = (layerEnable & 0x6000) ? true : false;
|
windowOn = (coreOptions.layerEnable & 0x6000) ? true : false;
|
||||||
if (change && !((value & 0x80))) {
|
if (change && !((value & 0x80))) {
|
||||||
if (!(DISPSTAT & 1)) {
|
if (!(DISPSTAT & 1)) {
|
||||||
//lcdTicks = 1008;
|
//lcdTicks = 1008;
|
||||||
|
@ -3173,7 +3173,7 @@ void CPUUpdateRegister(uint32_t address, uint16_t value)
|
||||||
case 0x204: {
|
case 0x204: {
|
||||||
memoryWait[0x0e] = memoryWaitSeq[0x0e] = gamepakRamWaitState[value & 3];
|
memoryWait[0x0e] = memoryWaitSeq[0x0e] = gamepakRamWaitState[value & 3];
|
||||||
|
|
||||||
if (!speedHack) {
|
if (!coreOptions.speedHack) {
|
||||||
memoryWait[0x08] = memoryWait[0x09] = gamepakWaitState[(value >> 2) & 3];
|
memoryWait[0x08] = memoryWait[0x09] = gamepakWaitState[(value >> 2) & 3];
|
||||||
memoryWaitSeq[0x08] = memoryWaitSeq[0x09] = gamepakWaitState0[(value >> 4) & 1];
|
memoryWaitSeq[0x08] = memoryWaitSeq[0x09] = gamepakWaitState0[(value >> 4) & 1];
|
||||||
|
|
||||||
|
@ -3298,7 +3298,7 @@ void CPUInit(const char* biosFileName, bool useBiosFile)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
eepromInUse = 0;
|
eepromInUse = 0;
|
||||||
useBios = false;
|
coreOptions.useBios = false;
|
||||||
|
|
||||||
if (useBiosFile && strlen(biosFileName) > 0) {
|
if (useBiosFile && strlen(biosFileName) > 0) {
|
||||||
int size = 0x4000;
|
int size = 0x4000;
|
||||||
|
@ -3307,13 +3307,13 @@ void CPUInit(const char* biosFileName, bool useBiosFile)
|
||||||
bios,
|
bios,
|
||||||
size)) {
|
size)) {
|
||||||
if (size == 0x4000)
|
if (size == 0x4000)
|
||||||
useBios = true;
|
coreOptions.useBios = true;
|
||||||
else
|
else
|
||||||
systemMessage(MSG_INVALID_BIOS_FILE_SIZE, N_("Invalid BIOS file size"));
|
systemMessage(MSG_INVALID_BIOS_FILE_SIZE, N_("Invalid BIOS file size"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!useBios) {
|
if (!coreOptions.useBios) {
|
||||||
memcpy(bios, myROM, sizeof(myROM));
|
memcpy(bios, myROM, sizeof(myROM));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3455,7 +3455,7 @@ void CPUReset()
|
||||||
|
|
||||||
DISPCNT = 0x0080;
|
DISPCNT = 0x0080;
|
||||||
DISPSTAT = 0x0000;
|
DISPSTAT = 0x0000;
|
||||||
VCOUNT = (useBios && !skipBios) ? 0 : 0x007E;
|
VCOUNT = (coreOptions.useBios && !coreOptions.skipBios) ? 0 : 0x007E;
|
||||||
BG0CNT = 0x0000;
|
BG0CNT = 0x0000;
|
||||||
BG1CNT = 0x0000;
|
BG1CNT = 0x0000;
|
||||||
BG2CNT = 0x0000;
|
BG2CNT = 0x0000;
|
||||||
|
@ -3533,7 +3533,7 @@ void CPUReset()
|
||||||
|
|
||||||
armMode = 0x1F;
|
armMode = 0x1F;
|
||||||
|
|
||||||
if (cpuIsMultiBoot) {
|
if (coreOptions.cpuIsMultiBoot) {
|
||||||
reg[13].I = 0x03007F00;
|
reg[13].I = 0x03007F00;
|
||||||
reg[15].I = 0x02000000;
|
reg[15].I = 0x02000000;
|
||||||
reg[16].I = 0x00000000;
|
reg[16].I = 0x00000000;
|
||||||
|
@ -3541,7 +3541,7 @@ void CPUReset()
|
||||||
reg[R13_SVC].I = 0x03007FE0;
|
reg[R13_SVC].I = 0x03007FE0;
|
||||||
armIrqEnable = true;
|
armIrqEnable = true;
|
||||||
} else {
|
} else {
|
||||||
if (useBios && !skipBios) {
|
if (coreOptions.useBios && !coreOptions.skipBios) {
|
||||||
reg[15].I = 0x00000000;
|
reg[15].I = 0x00000000;
|
||||||
armMode = 0x13;
|
armMode = 0x13;
|
||||||
armIrqEnable = false;
|
armIrqEnable = false;
|
||||||
|
@ -3582,7 +3582,7 @@ void CPUReset()
|
||||||
biosProtected[2] = 0x29;
|
biosProtected[2] = 0x29;
|
||||||
biosProtected[3] = 0xe1;
|
biosProtected[3] = 0xe1;
|
||||||
|
|
||||||
lcdTicks = (useBios && !skipBios) ? 1008 : 208;
|
lcdTicks = (coreOptions.useBios && !coreOptions.skipBios) ? 1008 : 208;
|
||||||
timer0On = false;
|
timer0On = false;
|
||||||
timer0Ticks = 0;
|
timer0Ticks = 0;
|
||||||
timer0Reload = 0;
|
timer0Reload = 0;
|
||||||
|
@ -3611,7 +3611,7 @@ void CPUReset()
|
||||||
fxOn = false;
|
fxOn = false;
|
||||||
windowOn = false;
|
windowOn = false;
|
||||||
frameCount = 0;
|
frameCount = 0;
|
||||||
layerEnable = DISPCNT & layerSettings;
|
coreOptions.layerEnable = DISPCNT & coreOptions.layerSettings;
|
||||||
|
|
||||||
CPUUpdateRenderBuffers(true);
|
CPUUpdateRenderBuffers(true);
|
||||||
|
|
||||||
|
@ -3641,19 +3641,19 @@ void CPUReset()
|
||||||
CPUUpdateWindow1();
|
CPUUpdateWindow1();
|
||||||
|
|
||||||
// make sure registers are correctly initialized if not using BIOS
|
// make sure registers are correctly initialized if not using BIOS
|
||||||
if (!useBios) {
|
if (!coreOptions.useBios) {
|
||||||
if (cpuIsMultiBoot)
|
if (coreOptions.cpuIsMultiBoot)
|
||||||
BIOS_RegisterRamReset(0xfe);
|
BIOS_RegisterRamReset(0xfe);
|
||||||
else
|
else
|
||||||
BIOS_RegisterRamReset(0xff);
|
BIOS_RegisterRamReset(0xff);
|
||||||
} else {
|
} else {
|
||||||
if (cpuIsMultiBoot)
|
if (coreOptions.cpuIsMultiBoot)
|
||||||
BIOS_RegisterRamReset(0xfe);
|
BIOS_RegisterRamReset(0xfe);
|
||||||
}
|
}
|
||||||
|
|
||||||
flashReset();
|
flashReset();
|
||||||
eepromReset();
|
eepromReset();
|
||||||
SetSaveType(saveType);
|
SetSaveType(coreOptions.saveType);
|
||||||
|
|
||||||
ARM_PREFETCH;
|
ARM_PREFETCH;
|
||||||
|
|
||||||
|
@ -3834,7 +3834,7 @@ void CPULoop(int ticks)
|
||||||
speedup_throttle_set = true;
|
speedup_throttle_set = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (speedup_throttle_frame_skip)
|
if (coreOptions.speedup_throttle_frame_skip)
|
||||||
framesToSkip += std::ceil(double(speedup_throttle) / 100.0) - 1;
|
framesToSkip += std::ceil(double(speedup_throttle) / 100.0) - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3874,13 +3874,13 @@ void CPULoop(int ticks)
|
||||||
|
|
||||||
uint32_t ext = (joy >> 10);
|
uint32_t ext = (joy >> 10);
|
||||||
// If no (m) code is enabled, apply the cheats at each LCDline
|
// If no (m) code is enabled, apply the cheats at each LCDline
|
||||||
if ((cheatsEnabled) && (mastercode == 0))
|
if ((coreOptions.cheatsEnabled) && (mastercode == 0))
|
||||||
remainingTicks += cheatsCheckKeys(P1 ^ 0x3FF, ext);
|
remainingTicks += cheatsCheckKeys(P1 ^ 0x3FF, ext);
|
||||||
|
|
||||||
speedup = false;
|
coreOptions.speedup = false;
|
||||||
|
|
||||||
if (ext & 1 && !speedup_throttle_set)
|
if (ext & 1 && !speedup_throttle_set)
|
||||||
speedup = true;
|
coreOptions.speedup = true;
|
||||||
|
|
||||||
capture = (ext & 2) ? true : false;
|
capture = (ext & 2) ? true : false;
|
||||||
|
|
||||||
|
|
|
@ -625,7 +625,7 @@ static inline void gfxDrawSprites(uint32_t* lineOBJ)
|
||||||
int lineOBJpix = (DISPCNT & 0x20) ? 954 : 1226;
|
int lineOBJpix = (DISPCNT & 0x20) ? 954 : 1226;
|
||||||
int m = 0;
|
int m = 0;
|
||||||
gfxClearArray(lineOBJ);
|
gfxClearArray(lineOBJ);
|
||||||
if (layerEnable & 0x1000) {
|
if (coreOptions.layerEnable & 0x1000) {
|
||||||
uint16_t* sprites = (uint16_t*)oam;
|
uint16_t* sprites = (uint16_t*)oam;
|
||||||
uint16_t* spritePalette = &((uint16_t*)paletteRAM)[256];
|
uint16_t* spritePalette = &((uint16_t*)paletteRAM)[256];
|
||||||
int mosaicY = ((MOSAIC & 0xF000) >> 12) + 1;
|
int mosaicY = ((MOSAIC & 0xF000) >> 12) + 1;
|
||||||
|
@ -674,7 +674,7 @@ static inline void gfxDrawSprites(uint32_t* lineOBJ)
|
||||||
int sx = (a1 & 0x1FF);
|
int sx = (a1 & 0x1FF);
|
||||||
|
|
||||||
// computes ticks used by OBJ-WIN if OBJWIN is enabled
|
// computes ticks used by OBJ-WIN if OBJWIN is enabled
|
||||||
if (((a0 & 0x0c00) == 0x0800) && (layerEnable & 0x8000)) {
|
if (((a0 & 0x0c00) == 0x0800) && (coreOptions.layerEnable & 0x8000)) {
|
||||||
if ((a0 & 0x0300) == 0x0300) {
|
if ((a0 & 0x0300) == 0x0300) {
|
||||||
sizeX <<= 1;
|
sizeX <<= 1;
|
||||||
sizeY <<= 1;
|
sizeY <<= 1;
|
||||||
|
@ -1142,7 +1142,7 @@ static inline void gfxDrawSprites(uint32_t* lineOBJ)
|
||||||
static inline void gfxDrawOBJWin(uint32_t* lineOBJWin)
|
static inline void gfxDrawOBJWin(uint32_t* lineOBJWin)
|
||||||
{
|
{
|
||||||
gfxClearArray(lineOBJWin);
|
gfxClearArray(lineOBJWin);
|
||||||
if ((layerEnable & 0x9000) == 0x9000) {
|
if ((coreOptions.layerEnable & 0x9000) == 0x9000) {
|
||||||
uint16_t* sprites = (uint16_t*)oam;
|
uint16_t* sprites = (uint16_t*)oam;
|
||||||
// uint16_t *spritePalette = &((uint16_t *)paletteRAM)[256];
|
// uint16_t *spritePalette = &((uint16_t *)paletteRAM)[256];
|
||||||
for (int x = 0; x < 128; x++) {
|
for (int x = 0; x < 128; x++) {
|
||||||
|
|
|
@ -796,7 +796,7 @@ static inline void CPUWriteByte(uint32_t address, uint8_t b)
|
||||||
goto unwritable;
|
goto unwritable;
|
||||||
case 14:
|
case 14:
|
||||||
case 15:
|
case 15:
|
||||||
if ((saveType != 5) && ((!eepromInUse) | cpuSramEnabled | cpuFlashEnabled)) {
|
if ((coreOptions.saveType != 5) && ((!eepromInUse) | cpuSramEnabled | cpuFlashEnabled)) {
|
||||||
// if(!cpuEEPROMEnabled && (cpuSramEnabled | cpuFlashEnabled)) {
|
// if(!cpuEEPROMEnabled && (cpuSramEnabled | cpuFlashEnabled)) {
|
||||||
|
|
||||||
(*cpuSaveGameFunc)(address, b);
|
(*cpuSaveGameFunc)(address, b);
|
||||||
|
|
|
@ -26,13 +26,8 @@ extern bool armIrqEnable;
|
||||||
extern uint32_t armNextPC;
|
extern uint32_t armNextPC;
|
||||||
extern int armMode;
|
extern int armMode;
|
||||||
extern uint32_t stop;
|
extern uint32_t stop;
|
||||||
extern int saveType;
|
|
||||||
extern int frameSkip;
|
|
||||||
extern bool gba_joybus_enabled;
|
extern bool gba_joybus_enabled;
|
||||||
extern bool gba_joybus_active;
|
extern bool gba_joybus_active;
|
||||||
extern int layerSettings;
|
|
||||||
extern int layerEnable;
|
|
||||||
extern int cpuSaveType;
|
|
||||||
extern int customBackdropColor;
|
extern int customBackdropColor;
|
||||||
|
|
||||||
extern uint8_t* bios;
|
extern uint8_t* bios;
|
||||||
|
|
|
@ -13,19 +13,19 @@ void mode0RenderLine()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0100) {
|
if (coreOptions.layerEnable & 0x0100) {
|
||||||
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
|
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0200) {
|
if (coreOptions.layerEnable & 0x0200) {
|
||||||
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
|
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0400) {
|
if (coreOptions.layerEnable & 0x0400) {
|
||||||
gfxDrawTextScreen(BG2CNT, BG2HOFS, BG2VOFS, line2);
|
gfxDrawTextScreen(BG2CNT, BG2HOFS, BG2VOFS, line2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0800) {
|
if (coreOptions.layerEnable & 0x0800) {
|
||||||
gfxDrawTextScreen(BG3CNT, BG3HOFS, BG3VOFS, line3);
|
gfxDrawTextScreen(BG3CNT, BG3HOFS, BG3VOFS, line3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,19 +125,19 @@ void mode0RenderLineNoWindow()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0100) {
|
if (coreOptions.layerEnable & 0x0100) {
|
||||||
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
|
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0200) {
|
if (coreOptions.layerEnable & 0x0200) {
|
||||||
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
|
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0400) {
|
if (coreOptions.layerEnable & 0x0400) {
|
||||||
gfxDrawTextScreen(BG2CNT, BG2HOFS, BG2VOFS, line2);
|
gfxDrawTextScreen(BG2CNT, BG2HOFS, BG2VOFS, line2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0800) {
|
if (coreOptions.layerEnable & 0x0800) {
|
||||||
gfxDrawTextScreen(BG3CNT, BG3HOFS, BG3VOFS, line3);
|
gfxDrawTextScreen(BG3CNT, BG3HOFS, BG3VOFS, line3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ void mode0RenderLineAll()
|
||||||
bool inWindow0 = false;
|
bool inWindow0 = false;
|
||||||
bool inWindow1 = false;
|
bool inWindow1 = false;
|
||||||
|
|
||||||
if (layerEnable & 0x2000) {
|
if (coreOptions.layerEnable & 0x2000) {
|
||||||
uint8_t v0 = WIN0V >> 8;
|
uint8_t v0 = WIN0V >> 8;
|
||||||
uint8_t v1 = WIN0V & 255;
|
uint8_t v1 = WIN0V & 255;
|
||||||
inWindow0 = ((v0 == v1) && (v0 >= 0xe8));
|
inWindow0 = ((v0 == v1) && (v0 >= 0xe8));
|
||||||
|
@ -309,7 +309,7 @@ void mode0RenderLineAll()
|
||||||
else
|
else
|
||||||
inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1);
|
inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1);
|
||||||
}
|
}
|
||||||
if (layerEnable & 0x4000) {
|
if (coreOptions.layerEnable & 0x4000) {
|
||||||
uint8_t v0 = WIN1V >> 8;
|
uint8_t v0 = WIN1V >> 8;
|
||||||
uint8_t v1 = WIN1V & 255;
|
uint8_t v1 = WIN1V & 255;
|
||||||
inWindow1 = ((v0 == v1) && (v0 >= 0xe8));
|
inWindow1 = ((v0 == v1) && (v0 >= 0xe8));
|
||||||
|
@ -319,19 +319,19 @@ void mode0RenderLineAll()
|
||||||
inWindow1 |= (VCOUNT >= v0 || VCOUNT < v1);
|
inWindow1 |= (VCOUNT >= v0 || VCOUNT < v1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((layerEnable & 0x0100)) {
|
if ((coreOptions.layerEnable & 0x0100)) {
|
||||||
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
|
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((layerEnable & 0x0200)) {
|
if ((coreOptions.layerEnable & 0x0200)) {
|
||||||
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
|
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((layerEnable & 0x0400)) {
|
if ((coreOptions.layerEnable & 0x0400)) {
|
||||||
gfxDrawTextScreen(BG2CNT, BG2HOFS, BG2VOFS, line2);
|
gfxDrawTextScreen(BG2CNT, BG2HOFS, BG2VOFS, line2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((layerEnable & 0x0800)) {
|
if ((coreOptions.layerEnable & 0x0800)) {
|
||||||
gfxDrawTextScreen(BG3CNT, BG3HOFS, BG3VOFS, line3);
|
gfxDrawTextScreen(BG3CNT, BG3HOFS, BG3VOFS, line3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,15 +14,15 @@ void mode1RenderLine()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0100) {
|
if (coreOptions.layerEnable & 0x0100) {
|
||||||
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
|
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0200) {
|
if (coreOptions.layerEnable & 0x0200) {
|
||||||
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
|
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0400) {
|
if (coreOptions.layerEnable & 0x0400) {
|
||||||
int changed = gfxBG2Changed;
|
int changed = gfxBG2Changed;
|
||||||
if (gfxLastVCOUNT > VCOUNT)
|
if (gfxLastVCOUNT > VCOUNT)
|
||||||
changed = 3;
|
changed = 3;
|
||||||
|
@ -120,15 +120,15 @@ void mode1RenderLineNoWindow()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0100) {
|
if (coreOptions.layerEnable & 0x0100) {
|
||||||
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
|
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0200) {
|
if (coreOptions.layerEnable & 0x0200) {
|
||||||
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
|
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0400) {
|
if (coreOptions.layerEnable & 0x0400) {
|
||||||
int changed = gfxBG2Changed;
|
int changed = gfxBG2Changed;
|
||||||
if (gfxLastVCOUNT > VCOUNT)
|
if (gfxLastVCOUNT > VCOUNT)
|
||||||
changed = 3;
|
changed = 3;
|
||||||
|
@ -280,7 +280,7 @@ void mode1RenderLineAll()
|
||||||
bool inWindow0 = false;
|
bool inWindow0 = false;
|
||||||
bool inWindow1 = false;
|
bool inWindow1 = false;
|
||||||
|
|
||||||
if (layerEnable & 0x2000) {
|
if (coreOptions.layerEnable & 0x2000) {
|
||||||
uint8_t v0 = WIN0V >> 8;
|
uint8_t v0 = WIN0V >> 8;
|
||||||
uint8_t v1 = WIN0V & 255;
|
uint8_t v1 = WIN0V & 255;
|
||||||
inWindow0 = ((v0 == v1) && (v0 >= 0xe8));
|
inWindow0 = ((v0 == v1) && (v0 >= 0xe8));
|
||||||
|
@ -289,7 +289,7 @@ void mode1RenderLineAll()
|
||||||
else
|
else
|
||||||
inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1);
|
inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1);
|
||||||
}
|
}
|
||||||
if (layerEnable & 0x4000) {
|
if (coreOptions.layerEnable & 0x4000) {
|
||||||
uint8_t v0 = WIN1V >> 8;
|
uint8_t v0 = WIN1V >> 8;
|
||||||
uint8_t v1 = WIN1V & 255;
|
uint8_t v1 = WIN1V & 255;
|
||||||
inWindow1 = ((v0 == v1) && (v0 >= 0xe8));
|
inWindow1 = ((v0 == v1) && (v0 >= 0xe8));
|
||||||
|
@ -299,15 +299,15 @@ void mode1RenderLineAll()
|
||||||
inWindow1 |= (VCOUNT >= v0 || VCOUNT < v1);
|
inWindow1 |= (VCOUNT >= v0 || VCOUNT < v1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0100) {
|
if (coreOptions.layerEnable & 0x0100) {
|
||||||
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
|
gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0200) {
|
if (coreOptions.layerEnable & 0x0200) {
|
||||||
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
|
gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0400) {
|
if (coreOptions.layerEnable & 0x0400) {
|
||||||
int changed = gfxBG2Changed;
|
int changed = gfxBG2Changed;
|
||||||
if (gfxLastVCOUNT > VCOUNT)
|
if (gfxLastVCOUNT > VCOUNT)
|
||||||
changed = 3;
|
changed = 3;
|
||||||
|
|
|
@ -14,7 +14,7 @@ void mode2RenderLine()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0400) {
|
if (coreOptions.layerEnable & 0x0400) {
|
||||||
int changed = gfxBG2Changed;
|
int changed = gfxBG2Changed;
|
||||||
if (gfxLastVCOUNT > VCOUNT)
|
if (gfxLastVCOUNT > VCOUNT)
|
||||||
changed = 3;
|
changed = 3;
|
||||||
|
@ -24,7 +24,7 @@ void mode2RenderLine()
|
||||||
changed, line2);
|
changed, line2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0800) {
|
if (coreOptions.layerEnable & 0x0800) {
|
||||||
int changed = gfxBG3Changed;
|
int changed = gfxBG3Changed;
|
||||||
if (gfxLastVCOUNT > VCOUNT)
|
if (gfxLastVCOUNT > VCOUNT)
|
||||||
changed = 3;
|
changed = 3;
|
||||||
|
@ -114,7 +114,7 @@ void mode2RenderLineNoWindow()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0400) {
|
if (coreOptions.layerEnable & 0x0400) {
|
||||||
int changed = gfxBG2Changed;
|
int changed = gfxBG2Changed;
|
||||||
if (gfxLastVCOUNT > VCOUNT)
|
if (gfxLastVCOUNT > VCOUNT)
|
||||||
changed = 3;
|
changed = 3;
|
||||||
|
@ -124,7 +124,7 @@ void mode2RenderLineNoWindow()
|
||||||
changed, line2);
|
changed, line2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0800) {
|
if (coreOptions.layerEnable & 0x0800) {
|
||||||
int changed = gfxBG3Changed;
|
int changed = gfxBG3Changed;
|
||||||
if (gfxLastVCOUNT > VCOUNT)
|
if (gfxLastVCOUNT > VCOUNT)
|
||||||
changed = 3;
|
changed = 3;
|
||||||
|
@ -262,7 +262,7 @@ void mode2RenderLineAll()
|
||||||
bool inWindow0 = false;
|
bool inWindow0 = false;
|
||||||
bool inWindow1 = false;
|
bool inWindow1 = false;
|
||||||
|
|
||||||
if (layerEnable & 0x2000) {
|
if (coreOptions.layerEnable & 0x2000) {
|
||||||
uint8_t v0 = WIN0V >> 8;
|
uint8_t v0 = WIN0V >> 8;
|
||||||
uint8_t v1 = WIN0V & 255;
|
uint8_t v1 = WIN0V & 255;
|
||||||
inWindow0 = ((v0 == v1) && (v0 >= 0xe8));
|
inWindow0 = ((v0 == v1) && (v0 >= 0xe8));
|
||||||
|
@ -271,7 +271,7 @@ void mode2RenderLineAll()
|
||||||
else
|
else
|
||||||
inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1);
|
inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1);
|
||||||
}
|
}
|
||||||
if (layerEnable & 0x4000) {
|
if (coreOptions.layerEnable & 0x4000) {
|
||||||
uint8_t v0 = WIN1V >> 8;
|
uint8_t v0 = WIN1V >> 8;
|
||||||
uint8_t v1 = WIN1V & 255;
|
uint8_t v1 = WIN1V & 255;
|
||||||
inWindow1 = ((v0 == v1) && (v0 >= 0xe8));
|
inWindow1 = ((v0 == v1) && (v0 >= 0xe8));
|
||||||
|
@ -281,7 +281,7 @@ void mode2RenderLineAll()
|
||||||
inWindow1 |= (VCOUNT >= v0 || VCOUNT < v1);
|
inWindow1 |= (VCOUNT >= v0 || VCOUNT < v1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0400) {
|
if (coreOptions.layerEnable & 0x0400) {
|
||||||
int changed = gfxBG2Changed;
|
int changed = gfxBG2Changed;
|
||||||
if (gfxLastVCOUNT > VCOUNT)
|
if (gfxLastVCOUNT > VCOUNT)
|
||||||
changed = 3;
|
changed = 3;
|
||||||
|
@ -291,7 +291,7 @@ void mode2RenderLineAll()
|
||||||
changed, line2);
|
changed, line2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0800) {
|
if (coreOptions.layerEnable & 0x0800) {
|
||||||
int changed = gfxBG3Changed;
|
int changed = gfxBG3Changed;
|
||||||
if (gfxLastVCOUNT > VCOUNT)
|
if (gfxLastVCOUNT > VCOUNT)
|
||||||
changed = 3;
|
changed = 3;
|
||||||
|
|
|
@ -14,7 +14,7 @@ void mode3RenderLine()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0400) {
|
if (coreOptions.layerEnable & 0x0400) {
|
||||||
int changed = gfxBG2Changed;
|
int changed = gfxBG2Changed;
|
||||||
|
|
||||||
if (gfxLastVCOUNT > VCOUNT)
|
if (gfxLastVCOUNT > VCOUNT)
|
||||||
|
@ -96,7 +96,7 @@ void mode3RenderLineNoWindow()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0400) {
|
if (coreOptions.layerEnable & 0x0400) {
|
||||||
int changed = gfxBG2Changed;
|
int changed = gfxBG2Changed;
|
||||||
|
|
||||||
if (gfxLastVCOUNT > VCOUNT)
|
if (gfxLastVCOUNT > VCOUNT)
|
||||||
|
@ -219,7 +219,7 @@ void mode3RenderLineAll()
|
||||||
bool inWindow0 = false;
|
bool inWindow0 = false;
|
||||||
bool inWindow1 = false;
|
bool inWindow1 = false;
|
||||||
|
|
||||||
if (layerEnable & 0x2000) {
|
if (coreOptions.layerEnable & 0x2000) {
|
||||||
uint8_t v0 = WIN0V >> 8;
|
uint8_t v0 = WIN0V >> 8;
|
||||||
uint8_t v1 = WIN0V & 255;
|
uint8_t v1 = WIN0V & 255;
|
||||||
inWindow0 = ((v0 == v1) && (v0 >= 0xe8));
|
inWindow0 = ((v0 == v1) && (v0 >= 0xe8));
|
||||||
|
@ -228,7 +228,7 @@ void mode3RenderLineAll()
|
||||||
else
|
else
|
||||||
inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1);
|
inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1);
|
||||||
}
|
}
|
||||||
if (layerEnable & 0x4000) {
|
if (coreOptions.layerEnable & 0x4000) {
|
||||||
uint8_t v0 = WIN1V >> 8;
|
uint8_t v0 = WIN1V >> 8;
|
||||||
uint8_t v1 = WIN1V & 255;
|
uint8_t v1 = WIN1V & 255;
|
||||||
inWindow1 = ((v0 == v1) && (v0 >= 0xe8));
|
inWindow1 = ((v0 == v1) && (v0 >= 0xe8));
|
||||||
|
@ -238,7 +238,7 @@ void mode3RenderLineAll()
|
||||||
inWindow1 |= (VCOUNT >= v0 || VCOUNT < v1);
|
inWindow1 |= (VCOUNT >= v0 || VCOUNT < v1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x0400) {
|
if (coreOptions.layerEnable & 0x0400) {
|
||||||
int changed = gfxBG2Changed;
|
int changed = gfxBG2Changed;
|
||||||
|
|
||||||
if (gfxLastVCOUNT > VCOUNT)
|
if (gfxLastVCOUNT > VCOUNT)
|
||||||
|
|
|
@ -14,7 +14,7 @@ void mode4RenderLine()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x400) {
|
if (coreOptions.layerEnable & 0x400) {
|
||||||
int changed = gfxBG2Changed;
|
int changed = gfxBG2Changed;
|
||||||
|
|
||||||
if (gfxLastVCOUNT > VCOUNT)
|
if (gfxLastVCOUNT > VCOUNT)
|
||||||
|
@ -95,7 +95,7 @@ void mode4RenderLineNoWindow()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x400) {
|
if (coreOptions.layerEnable & 0x400) {
|
||||||
int changed = gfxBG2Changed;
|
int changed = gfxBG2Changed;
|
||||||
|
|
||||||
if (gfxLastVCOUNT > VCOUNT)
|
if (gfxLastVCOUNT > VCOUNT)
|
||||||
|
@ -217,7 +217,7 @@ void mode4RenderLineAll()
|
||||||
bool inWindow0 = false;
|
bool inWindow0 = false;
|
||||||
bool inWindow1 = false;
|
bool inWindow1 = false;
|
||||||
|
|
||||||
if (layerEnable & 0x2000) {
|
if (coreOptions.layerEnable & 0x2000) {
|
||||||
uint8_t v0 = WIN0V >> 8;
|
uint8_t v0 = WIN0V >> 8;
|
||||||
uint8_t v1 = WIN0V & 255;
|
uint8_t v1 = WIN0V & 255;
|
||||||
inWindow0 = ((v0 == v1) && (v0 >= 0xe8));
|
inWindow0 = ((v0 == v1) && (v0 >= 0xe8));
|
||||||
|
@ -226,7 +226,7 @@ void mode4RenderLineAll()
|
||||||
else
|
else
|
||||||
inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1);
|
inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1);
|
||||||
}
|
}
|
||||||
if (layerEnable & 0x4000) {
|
if (coreOptions.layerEnable & 0x4000) {
|
||||||
uint8_t v0 = WIN1V >> 8;
|
uint8_t v0 = WIN1V >> 8;
|
||||||
uint8_t v1 = WIN1V & 255;
|
uint8_t v1 = WIN1V & 255;
|
||||||
inWindow1 = ((v0 == v1) && (v0 >= 0xe8));
|
inWindow1 = ((v0 == v1) && (v0 >= 0xe8));
|
||||||
|
@ -236,7 +236,7 @@ void mode4RenderLineAll()
|
||||||
inWindow1 |= (VCOUNT >= v0 || VCOUNT < v1);
|
inWindow1 |= (VCOUNT >= v0 || VCOUNT < v1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerEnable & 0x400) {
|
if (coreOptions.layerEnable & 0x400) {
|
||||||
int changed = gfxBG2Changed;
|
int changed = gfxBG2Changed;
|
||||||
|
|
||||||
if (gfxLastVCOUNT > VCOUNT)
|
if (gfxLastVCOUNT > VCOUNT)
|
||||||
|
|
|
@ -14,7 +14,7 @@ void mode5RenderLine()
|
||||||
|
|
||||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||||
|
|
||||||
if (layerEnable & 0x0400) {
|
if (coreOptions.layerEnable & 0x0400) {
|
||||||
int changed = gfxBG2Changed;
|
int changed = gfxBG2Changed;
|
||||||
|
|
||||||
if (gfxLastVCOUNT > VCOUNT)
|
if (gfxLastVCOUNT > VCOUNT)
|
||||||
|
@ -96,7 +96,7 @@ void mode5RenderLineNoWindow()
|
||||||
|
|
||||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||||
|
|
||||||
if (layerEnable & 0x0400) {
|
if (coreOptions.layerEnable & 0x0400) {
|
||||||
int changed = gfxBG2Changed;
|
int changed = gfxBG2Changed;
|
||||||
|
|
||||||
if (gfxLastVCOUNT > VCOUNT)
|
if (gfxLastVCOUNT > VCOUNT)
|
||||||
|
@ -216,7 +216,7 @@ void mode5RenderLineAll()
|
||||||
|
|
||||||
uint16_t* palette = (uint16_t*)paletteRAM;
|
uint16_t* palette = (uint16_t*)paletteRAM;
|
||||||
|
|
||||||
if (layerEnable & 0x0400) {
|
if (coreOptions.layerEnable & 0x0400) {
|
||||||
int changed = gfxBG2Changed;
|
int changed = gfxBG2Changed;
|
||||||
|
|
||||||
if (gfxLastVCOUNT > VCOUNT)
|
if (gfxLastVCOUNT > VCOUNT)
|
||||||
|
@ -235,7 +235,7 @@ void mode5RenderLineAll()
|
||||||
bool inWindow0 = false;
|
bool inWindow0 = false;
|
||||||
bool inWindow1 = false;
|
bool inWindow1 = false;
|
||||||
|
|
||||||
if (layerEnable & 0x2000) {
|
if (coreOptions.layerEnable & 0x2000) {
|
||||||
uint8_t v0 = WIN0V >> 8;
|
uint8_t v0 = WIN0V >> 8;
|
||||||
uint8_t v1 = WIN0V & 255;
|
uint8_t v1 = WIN0V & 255;
|
||||||
inWindow0 = ((v0 == v1) && (v0 >= 0xe8));
|
inWindow0 = ((v0 == v1) && (v0 >= 0xe8));
|
||||||
|
@ -244,7 +244,7 @@ void mode5RenderLineAll()
|
||||||
else
|
else
|
||||||
inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1);
|
inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1);
|
||||||
}
|
}
|
||||||
if (layerEnable & 0x4000) {
|
if (coreOptions.layerEnable & 0x4000) {
|
||||||
uint8_t v0 = WIN1V >> 8;
|
uint8_t v0 = WIN1V >> 8;
|
||||||
uint8_t v1 = WIN1V & 255;
|
uint8_t v1 = WIN1V & 255;
|
||||||
inWindow1 = ((v0 == v1) && (v0 >= 0xe8));
|
inWindow1 = ((v0 == v1) && (v0 >= 0xe8));
|
||||||
|
|
|
@ -217,7 +217,7 @@ bool rtcWrite(uint32_t address, uint16_t value)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x65: {
|
case 0x65: {
|
||||||
if (rtcEnabled)
|
if (coreOptions.rtcEnabled)
|
||||||
SetGBATime();
|
SetGBATime();
|
||||||
|
|
||||||
rtcClockData.dataLen = 7;
|
rtcClockData.dataLen = 7;
|
||||||
|
@ -232,7 +232,7 @@ bool rtcWrite(uint32_t address, uint16_t value)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case 0x67: {
|
case 0x67: {
|
||||||
if (rtcEnabled)
|
if (coreOptions.rtcEnabled)
|
||||||
SetGBATime();
|
SetGBATime();
|
||||||
|
|
||||||
rtcClockData.dataLen = 3;
|
rtcClockData.dataLen = 3;
|
||||||
|
|
|
@ -9,7 +9,7 @@ uint8_t sramRead(uint32_t address)
|
||||||
}
|
}
|
||||||
void sramDelayedWrite(uint32_t address, uint8_t byte)
|
void sramDelayedWrite(uint32_t address, uint8_t byte)
|
||||||
{
|
{
|
||||||
saveType = GBA_SAVE_SRAM;
|
coreOptions.saveType = GBA_SAVE_SRAM;
|
||||||
cpuSaveGameFunc = sramWrite;
|
cpuSaveGameFunc = sramWrite;
|
||||||
sramWrite(address, byte);
|
sramWrite(address, byte);
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,8 +215,6 @@ struct ELFFrameState {
|
||||||
int returnAddress;
|
int returnAddress;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern bool cpuIsMultiBoot;
|
|
||||||
|
|
||||||
Symbol* elfSymbols = NULL;
|
Symbol* elfSymbols = NULL;
|
||||||
char* elfSymbolsStrTab = NULL;
|
char* elfSymbolsStrTab = NULL;
|
||||||
int elfSymbolsCount = 0;
|
int elfSymbolsCount = 0;
|
||||||
|
@ -2547,7 +2545,7 @@ bool elfReadProgram(ELFHeader* eh, uint8_t* data, unsigned long data_size, int&
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (READ32LE(&eh->e_entry) == 0x2000000)
|
if (READ32LE(&eh->e_entry) == 0x2000000)
|
||||||
cpuIsMultiBoot = true;
|
coreOptions.cpuIsMultiBoot = true;
|
||||||
|
|
||||||
// read program headers... should probably move this code down
|
// read program headers... should probably move this code down
|
||||||
uint8_t* p = data + READ32LE(&eh->e_phoff);
|
uint8_t* p = data + READ32LE(&eh->e_phoff);
|
||||||
|
@ -2572,7 +2570,7 @@ bool elfReadProgram(ELFHeader* eh, uint8_t* data, unsigned long data_size, int&
|
||||||
|
|
||||||
uint8_t* source = data + offset;
|
uint8_t* source = data + offset;
|
||||||
|
|
||||||
if (cpuIsMultiBoot) {
|
if (coreOptions.cpuIsMultiBoot) {
|
||||||
unsigned effective_address = address - 0x2000000;
|
unsigned effective_address = address - 0x2000000;
|
||||||
|
|
||||||
if (effective_address + section_size < SIZE_WRAM) {
|
if (effective_address + section_size < SIZE_WRAM) {
|
||||||
|
@ -2623,7 +2621,7 @@ bool elfReadProgram(ELFHeader* eh, uint8_t* data, unsigned long data_size, int&
|
||||||
// sh[i]->flags, sh[i]->addr, sh[i]->offset, sh[i]->size,
|
// sh[i]->flags, sh[i]->addr, sh[i]->offset, sh[i]->size,
|
||||||
// sh[i]->link, sh[i]->info);
|
// sh[i]->link, sh[i]->info);
|
||||||
if (READ32LE(&sh[i]->flags) & 2) { // load section
|
if (READ32LE(&sh[i]->flags) & 2) { // load section
|
||||||
if (cpuIsMultiBoot) {
|
if (coreOptions.cpuIsMultiBoot) {
|
||||||
if (READ32LE(&sh[i]->addr) >= 0x2000000 && READ32LE(&sh[i]->addr) <= 0x203ffff) {
|
if (READ32LE(&sh[i]->addr) >= 0x2000000 && READ32LE(&sh[i]->addr) <= 0x203ffff) {
|
||||||
memcpy(&workRAM[READ32LE(&sh[i]->addr) & 0x3ffff], data + READ32LE(&sh[i]->offset),
|
memcpy(&workRAM[READ32LE(&sh[i]->addr) & 0x3ffff], data + READ32LE(&sh[i]->offset),
|
||||||
READ32LE(&sh[i]->size));
|
READ32LE(&sh[i]->size));
|
||||||
|
@ -2714,8 +2712,6 @@ end:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern bool parseDebug;
|
|
||||||
|
|
||||||
bool elfRead(const char* name, int& siz, FILE* f)
|
bool elfRead(const char* name, int& siz, FILE* f)
|
||||||
{
|
{
|
||||||
fseek(f, 0, SEEK_END);
|
fseek(f, 0, SEEK_END);
|
||||||
|
@ -2740,7 +2736,7 @@ bool elfRead(const char* name, int& siz, FILE* f)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!elfReadProgram(header, elfFileData, size, siz, parseDebug)) {
|
if (!elfReadProgram(header, elfFileData, size, siz, coreOptions.parseDebug)) {
|
||||||
free(elfFileData);
|
free(elfFileData);
|
||||||
elfFileData = NULL;
|
elfFileData = NULL;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -22,24 +22,6 @@
|
||||||
#define _stricmp strcasecmp
|
#define _stricmp strcasecmp
|
||||||
#endif // ! _MSC_VER
|
#endif // ! _MSC_VER
|
||||||
|
|
||||||
// Because Configmanager was introduced, this has to be done.
|
|
||||||
int rtcEnabled = 0;
|
|
||||||
int cpuDisableSfx = 0;
|
|
||||||
int skipBios = 0;
|
|
||||||
int saveType = 0;
|
|
||||||
int cpuSaveType = 0;
|
|
||||||
int skipSaveGameBattery = 0;
|
|
||||||
int skipSaveGameCheats = 0;
|
|
||||||
int useBios = 0;
|
|
||||||
int cheatsEnabled = 0;
|
|
||||||
int layerSettings = 0xff00;
|
|
||||||
int layerEnable = 0xff00;
|
|
||||||
bool speedup = false;
|
|
||||||
bool parseDebug = false;
|
|
||||||
bool speedHack = false;
|
|
||||||
bool mirroringEnable = false;
|
|
||||||
bool cpuIsMultiBoot = false;
|
|
||||||
|
|
||||||
const char* loadDotCodeFile;
|
const char* loadDotCodeFile;
|
||||||
const char* saveDotCodeFile;
|
const char* saveDotCodeFile;
|
||||||
|
|
||||||
|
@ -57,11 +39,9 @@ void utilPutWord(uint8_t* p, uint16_t value)
|
||||||
*p = (value >> 8) & 255;
|
*p = (value >> 8) & 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern bool cpuIsMultiBoot;
|
|
||||||
|
|
||||||
bool utilIsGBAImage(const char* file)
|
bool utilIsGBAImage(const char* file)
|
||||||
{
|
{
|
||||||
cpuIsMultiBoot = false;
|
coreOptions.cpuIsMultiBoot = false;
|
||||||
if (strlen(file) > 4) {
|
if (strlen(file) > 4) {
|
||||||
const char* p = strrchr(file, '.');
|
const char* p = strrchr(file, '.');
|
||||||
|
|
||||||
|
@ -69,7 +49,7 @@ bool utilIsGBAImage(const char* file)
|
||||||
if ((_stricmp(p, ".agb") == 0) || (_stricmp(p, ".gba") == 0) || (_stricmp(p, ".bin") == 0) || (_stricmp(p, ".elf") == 0))
|
if ((_stricmp(p, ".agb") == 0) || (_stricmp(p, ".gba") == 0) || (_stricmp(p, ".bin") == 0) || (_stricmp(p, ".elf") == 0))
|
||||||
return true;
|
return true;
|
||||||
if (_stricmp(p, ".mb") == 0) {
|
if (_stricmp(p, ".mb") == 0) {
|
||||||
cpuIsMultiBoot = true;
|
coreOptions.cpuIsMultiBoot = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,8 +185,8 @@ void utilGBAFindSave(const int size)
|
||||||
if (detectedSaveType == 4)
|
if (detectedSaveType == 4)
|
||||||
detectedSaveType = 3;
|
detectedSaveType = 3;
|
||||||
|
|
||||||
cpuSaveType = detectedSaveType;
|
coreOptions.cpuSaveType = detectedSaveType;
|
||||||
rtcEnabled = rtcFound_;
|
coreOptions.rtcEnabled = rtcFound_;
|
||||||
flashSize = flashSize_;
|
flashSize = flashSize_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,8 @@ int systemFrameSkip = 0;
|
||||||
int systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
|
int systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
|
||||||
int emulating = 0;
|
int emulating = 0;
|
||||||
|
|
||||||
|
struct CoreOptions coreOptions;
|
||||||
|
|
||||||
#ifdef BKPT_SUPPORT
|
#ifdef BKPT_SUPPORT
|
||||||
void (*dbgOutput)(const char* s, uint32_t addr);
|
void (*dbgOutput)(const char* s, uint32_t addr);
|
||||||
void (*dbgSignal)(int sig, int number);
|
void (*dbgSignal)(int sig, int number);
|
||||||
|
@ -278,9 +280,9 @@ void* retro_get_memory_data(unsigned id)
|
||||||
case IMAGE_GBA:
|
case IMAGE_GBA:
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case RETRO_MEMORY_SAVE_RAM:
|
case RETRO_MEMORY_SAVE_RAM:
|
||||||
if ((saveType == GBA_SAVE_EEPROM) | (saveType == GBA_SAVE_EEPROM_SENSOR))
|
if ((coreOptions.saveType == GBA_SAVE_EEPROM) | (coreOptions.saveType == GBA_SAVE_EEPROM_SENSOR))
|
||||||
data = eepromData;
|
data = eepromData;
|
||||||
else if ((saveType == GBA_SAVE_SRAM) | (saveType == GBA_SAVE_FLASH))
|
else if ((coreOptions.saveType == GBA_SAVE_SRAM) | (coreOptions.saveType == GBA_SAVE_FLASH))
|
||||||
data = flashSaveMemory;
|
data = flashSaveMemory;
|
||||||
break;
|
break;
|
||||||
case RETRO_MEMORY_SYSTEM_RAM:
|
case RETRO_MEMORY_SYSTEM_RAM:
|
||||||
|
@ -324,11 +326,11 @@ size_t retro_get_memory_size(unsigned id)
|
||||||
case IMAGE_GBA:
|
case IMAGE_GBA:
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case RETRO_MEMORY_SAVE_RAM:
|
case RETRO_MEMORY_SAVE_RAM:
|
||||||
if ((saveType == GBA_SAVE_EEPROM) | (saveType == GBA_SAVE_EEPROM_SENSOR))
|
if ((coreOptions.saveType == GBA_SAVE_EEPROM) | (coreOptions.saveType == GBA_SAVE_EEPROM_SENSOR))
|
||||||
size = eepromSize;
|
size = eepromSize;
|
||||||
else if (saveType == GBA_SAVE_FLASH)
|
else if (coreOptions.saveType == GBA_SAVE_FLASH)
|
||||||
size = flashSize;
|
size = flashSize;
|
||||||
else if (saveType == GBA_SAVE_SRAM)
|
else if (coreOptions.saveType == GBA_SAVE_SRAM)
|
||||||
size = SIZE_SRAM;
|
size = SIZE_SRAM;
|
||||||
break;
|
break;
|
||||||
case RETRO_MEMORY_SYSTEM_RAM:
|
case RETRO_MEMORY_SYSTEM_RAM:
|
||||||
|
@ -551,18 +553,25 @@ void retro_get_system_av_info(struct retro_system_av_info *info)
|
||||||
|
|
||||||
void retro_init(void)
|
void retro_init(void)
|
||||||
{
|
{
|
||||||
struct retro_log_callback log;
|
// The libretro core uses a few different defaults.
|
||||||
struct retro_rumble_interface rumble;
|
coreOptions.mirroringEnable = false;
|
||||||
|
coreOptions.parseDebug = true;
|
||||||
|
coreOptions.cheatsEnabled = 0;
|
||||||
|
coreOptions.skipSaveGameBattery = 0;
|
||||||
|
coreOptions.winGbPrinterEnabled = 0;
|
||||||
|
|
||||||
environ_cb(RETRO_ENVIRONMENT_GET_CAN_DUPE, &can_dupe);
|
struct retro_log_callback log;
|
||||||
if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log))
|
struct retro_rumble_interface rumble;
|
||||||
log_cb = log.log;
|
|
||||||
else
|
|
||||||
log_cb = NULL;
|
|
||||||
|
|
||||||
const char* dir = NULL;
|
environ_cb(RETRO_ENVIRONMENT_GET_CAN_DUPE, &can_dupe);
|
||||||
if (environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &dir) && dir)
|
if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log))
|
||||||
snprintf(retro_system_directory, sizeof(retro_system_directory), "%s", dir);
|
log_cb = log.log;
|
||||||
|
else
|
||||||
|
log_cb = NULL;
|
||||||
|
|
||||||
|
const char* dir = NULL;
|
||||||
|
if (environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &dir) && dir)
|
||||||
|
snprintf(retro_system_directory, sizeof(retro_system_directory), "%s", dir);
|
||||||
|
|
||||||
#ifdef FRONTEND_SUPPORTS_RGB565
|
#ifdef FRONTEND_SUPPORTS_RGB565
|
||||||
systemColorDepth = 16;
|
systemColorDepth = 16;
|
||||||
|
@ -723,7 +732,7 @@ typedef struct {
|
||||||
int saveType; // 0auto 1eeprom 2sram 3flash 4sensor+eeprom 5none
|
int saveType; // 0auto 1eeprom 2sram 3flash 4sensor+eeprom 5none
|
||||||
int rtcEnabled;
|
int rtcEnabled;
|
||||||
int mirroringEnabled;
|
int mirroringEnabled;
|
||||||
int useBios;
|
int useBios; // unused?
|
||||||
} ini_t;
|
} ini_t;
|
||||||
|
|
||||||
static const ini_t gbaover[512] = {
|
static const ini_t gbaover[512] = {
|
||||||
|
@ -749,11 +758,11 @@ static void load_image_preferences(void)
|
||||||
unsigned i = 0, found_no = 0;
|
unsigned i = 0, found_no = 0;
|
||||||
unsigned long romCrc32 = crc32(0, rom, romSize);
|
unsigned long romCrc32 = crc32(0, rom, romSize);
|
||||||
|
|
||||||
cpuSaveType = GBA_SAVE_AUTO;
|
coreOptions.cpuSaveType = GBA_SAVE_AUTO;
|
||||||
flashSize = SIZE_FLASH512;
|
flashSize = SIZE_FLASH512;
|
||||||
eepromSize = SIZE_EEPROM_512;
|
eepromSize = SIZE_EEPROM_512;
|
||||||
rtcEnabled = false;
|
coreOptions.rtcEnabled = false;
|
||||||
mirroringEnable = false;
|
coreOptions.mirroringEnable = false;
|
||||||
|
|
||||||
log("File CRC32 : 0x%08X\n", romCrc32);
|
log("File CRC32 : 0x%08X\n", romCrc32);
|
||||||
|
|
||||||
|
@ -785,50 +794,50 @@ static void load_image_preferences(void)
|
||||||
if (found) {
|
if (found) {
|
||||||
log("Name : %s\n", gbaover[found_no].romtitle);
|
log("Name : %s\n", gbaover[found_no].romtitle);
|
||||||
|
|
||||||
rtcEnabled = gbaover[found_no].rtcEnabled;
|
coreOptions.rtcEnabled = gbaover[found_no].rtcEnabled;
|
||||||
cpuSaveType = gbaover[found_no].saveType;
|
coreOptions.cpuSaveType = gbaover[found_no].saveType;
|
||||||
|
|
||||||
unsigned size = gbaover[found_no].saveSize;
|
unsigned size = gbaover[found_no].saveSize;
|
||||||
if (cpuSaveType == GBA_SAVE_SRAM)
|
if (coreOptions.cpuSaveType == GBA_SAVE_SRAM)
|
||||||
flashSize = SIZE_SRAM;
|
flashSize = SIZE_SRAM;
|
||||||
else if (cpuSaveType == GBA_SAVE_FLASH)
|
else if (coreOptions.cpuSaveType == GBA_SAVE_FLASH)
|
||||||
flashSize = (size == SIZE_FLASH1M) ? SIZE_FLASH1M : SIZE_FLASH512;
|
flashSize = (size == SIZE_FLASH1M) ? SIZE_FLASH1M : SIZE_FLASH512;
|
||||||
else if ((cpuSaveType == GBA_SAVE_EEPROM) || (cpuSaveType == GBA_SAVE_EEPROM_SENSOR))
|
else if ((coreOptions.cpuSaveType == GBA_SAVE_EEPROM) || (coreOptions.cpuSaveType == GBA_SAVE_EEPROM_SENSOR))
|
||||||
eepromSize = (size == SIZE_EEPROM_8K) ? SIZE_EEPROM_8K : SIZE_EEPROM_512;
|
eepromSize = (size == SIZE_EEPROM_8K) ? SIZE_EEPROM_8K : SIZE_EEPROM_512;
|
||||||
}
|
}
|
||||||
|
|
||||||
// gameID that starts with 'F' are classic/famicom games
|
// gameID that starts with 'F' are classic/famicom games
|
||||||
mirroringEnable = (buffer[0] == 'F') ? true : false;
|
coreOptions.mirroringEnable = (buffer[0] == 'F') ? true : false;
|
||||||
|
|
||||||
if (!cpuSaveType)
|
if (!coreOptions.cpuSaveType)
|
||||||
utilGBAFindSave(romSize);
|
utilGBAFindSave(romSize);
|
||||||
|
|
||||||
saveType = cpuSaveType;
|
coreOptions.saveType = coreOptions.cpuSaveType;
|
||||||
|
|
||||||
if (flashSize == SIZE_FLASH512 || flashSize == SIZE_FLASH1M)
|
if (flashSize == SIZE_FLASH512 || flashSize == SIZE_FLASH1M)
|
||||||
flashSetSize(flashSize);
|
flashSetSize(flashSize);
|
||||||
|
|
||||||
if (option_forceRTCenable)
|
if (option_forceRTCenable)
|
||||||
rtcEnabled = true;
|
coreOptions.rtcEnabled = true;
|
||||||
|
|
||||||
rtcEnable(rtcEnabled);
|
rtcEnable(coreOptions.rtcEnabled);
|
||||||
|
|
||||||
// game code starting with 'R' or 'V' has rumble support
|
// game code starting with 'R' or 'V' has rumble support
|
||||||
if ((buffer[0] == 'R') || (buffer[0] == 'V'))
|
if ((buffer[0] == 'R') || (buffer[0] == 'V'))
|
||||||
hasRumble = true;
|
hasRumble = true;
|
||||||
|
|
||||||
rtcEnableRumble(!rtcEnabled && hasRumble);
|
rtcEnableRumble(!coreOptions.rtcEnabled && hasRumble);
|
||||||
|
|
||||||
doMirroring(mirroringEnable);
|
doMirroring(coreOptions.mirroringEnable);
|
||||||
|
|
||||||
log("romSize : %dKB\n", (romSize + 1023) / 1024);
|
log("romSize : %dKB\n", (romSize + 1023) / 1024);
|
||||||
log("has RTC : %s.\n", rtcEnabled ? "Yes" : "No");
|
log("has RTC : %s.\n", coreOptions.rtcEnabled ? "Yes" : "No");
|
||||||
log("cpuSaveType : %s.\n", savetype[cpuSaveType]);
|
log("cpuSaveType : %s.\n", savetype[coreOptions.cpuSaveType]);
|
||||||
if (cpuSaveType == 3)
|
if (coreOptions.cpuSaveType == 3)
|
||||||
log("flashSize : %d.\n", flashSize);
|
log("flashSize : %d.\n", flashSize);
|
||||||
else if (cpuSaveType == 1)
|
else if (coreOptions.cpuSaveType == 1)
|
||||||
log("eepromSize : %d.\n", eepromSize);
|
log("eepromSize : %d.\n", eepromSize);
|
||||||
log("mirroringEnable : %s.\n", mirroringEnable ? "Yes" : "No");
|
log("mirroringEnable : %s.\n", coreOptions.mirroringEnable ? "Yes" : "No");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -987,8 +996,8 @@ static void update_variables(bool startup)
|
||||||
disabled_layers |= 0x100 << i;
|
disabled_layers |= 0x100 << i;
|
||||||
}
|
}
|
||||||
|
|
||||||
layerSettings = 0xFF00 ^ disabled_layers;
|
coreOptions.layerSettings = 0xFF00 ^ disabled_layers;
|
||||||
layerEnable = DISPCNT & layerSettings;
|
coreOptions.layerEnable = DISPCNT & coreOptions.layerSettings;
|
||||||
CPUUpdateRenderBuffers(false);
|
CPUUpdateRenderBuffers(false);
|
||||||
|
|
||||||
strcpy(key, "vbam_sound_x");
|
strcpy(key, "vbam_sound_x");
|
||||||
|
@ -1451,7 +1460,7 @@ bool retro_unserialize(const void* data, size_t size)
|
||||||
|
|
||||||
void retro_cheat_reset(void)
|
void retro_cheat_reset(void)
|
||||||
{
|
{
|
||||||
cheatsEnabled = 1;
|
coreOptions.cheatsEnabled = 1;
|
||||||
if (type == IMAGE_GBA)
|
if (type == IMAGE_GBA)
|
||||||
cheatsDeleteAll(false);
|
cheatsDeleteAll(false);
|
||||||
else if (type == IMAGE_GB)
|
else if (type == IMAGE_GB)
|
||||||
|
|
|
@ -109,6 +109,8 @@ extern void remoteOutput(const char*, uint32_t);
|
||||||
extern void remoteSetProtocol(int);
|
extern void remoteSetProtocol(int);
|
||||||
extern void remoteSetPort(int);
|
extern void remoteSetPort(int);
|
||||||
|
|
||||||
|
struct CoreOptions coreOptions;
|
||||||
|
|
||||||
struct EmulatedSystem emulator = {
|
struct EmulatedSystem emulator = {
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -616,9 +618,9 @@ static void sdlApplyPerImagePreferences()
|
||||||
} else if (!strcmp(token, "saveType")) {
|
} else if (!strcmp(token, "saveType")) {
|
||||||
int save = atoi(value);
|
int save = atoi(value);
|
||||||
if (save >= 0 && save <= 5)
|
if (save >= 0 && save <= 5)
|
||||||
cpuSaveType = save;
|
coreOptions.cpuSaveType = save;
|
||||||
} else if (!strcmp(token, "mirroringEnabled")) {
|
} else if (!strcmp(token, "mirroringEnabled")) {
|
||||||
mirroringEnable = (atoi(value) == 0 ? false : true);
|
coreOptions.mirroringEnable = (atoi(value) == 0 ? false : true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1110,8 +1112,8 @@ void sdlPollEvents()
|
||||||
break;
|
break;
|
||||||
case SDLK_e:
|
case SDLK_e:
|
||||||
if (!(event.key.keysym.mod & MOD_NOCTRL) && (event.key.keysym.mod & KMOD_CTRL)) {
|
if (!(event.key.keysym.mod & MOD_NOCTRL) && (event.key.keysym.mod & KMOD_CTRL)) {
|
||||||
cheatsEnabled = !cheatsEnabled;
|
coreOptions.cheatsEnabled = !coreOptions.cheatsEnabled;
|
||||||
systemConsoleMessage(cheatsEnabled ? "Cheats on" : "Cheats off");
|
systemConsoleMessage(coreOptions.cheatsEnabled ? "Cheats on" : "Cheats off");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1291,8 +1293,8 @@ void sdlPollEvents()
|
||||||
}
|
}
|
||||||
} else if (!(event.key.keysym.mod & MOD_NOCTRL) && (event.key.keysym.mod & KMOD_CTRL)) {
|
} else if (!(event.key.keysym.mod & MOD_NOCTRL) && (event.key.keysym.mod & KMOD_CTRL)) {
|
||||||
int mask = 0x0100 << (event.key.keysym.sym - SDLK_1);
|
int mask = 0x0100 << (event.key.keysym.sym - SDLK_1);
|
||||||
layerSettings ^= mask;
|
coreOptions.layerSettings ^= mask;
|
||||||
layerEnable = DISPCNT & layerSettings;
|
coreOptions.layerEnable = DISPCNT & coreOptions.layerSettings;
|
||||||
CPUUpdateRenderBuffers(false);
|
CPUUpdateRenderBuffers(false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1302,8 +1304,8 @@ void sdlPollEvents()
|
||||||
case SDLK_8:
|
case SDLK_8:
|
||||||
if (!(event.key.keysym.mod & MOD_NOCTRL) && (event.key.keysym.mod & KMOD_CTRL)) {
|
if (!(event.key.keysym.mod & MOD_NOCTRL) && (event.key.keysym.mod & KMOD_CTRL)) {
|
||||||
int mask = 0x0100 << (event.key.keysym.sym - SDLK_1);
|
int mask = 0x0100 << (event.key.keysym.sym - SDLK_1);
|
||||||
layerSettings ^= mask;
|
coreOptions.layerSettings ^= mask;
|
||||||
layerEnable = DISPCNT & layerSettings;
|
coreOptions.layerEnable = DISPCNT & coreOptions.layerSettings;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDLK_n:
|
case SDLK_n:
|
||||||
|
@ -1561,7 +1563,7 @@ int main(int argc, char** argv)
|
||||||
frameSkip = 2;
|
frameSkip = 2;
|
||||||
gbBorderOn = 0;
|
gbBorderOn = 0;
|
||||||
|
|
||||||
parseDebug = true;
|
coreOptions.parseDebug = true;
|
||||||
|
|
||||||
gb_effects_config.stereo = 0.0;
|
gb_effects_config.stereo = 0.0;
|
||||||
gb_effects_config.echo = 0.0;
|
gb_effects_config.echo = 0.0;
|
||||||
|
@ -1718,7 +1720,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
// used for the handling of the gb Boot Rom
|
// used for the handling of the gb Boot Rom
|
||||||
if (gbHardware & 7)
|
if (gbHardware & 7)
|
||||||
gbCPUInit(biosFileNameGB, useBios);
|
gbCPUInit(biosFileNameGB, coreOptions.useBios);
|
||||||
|
|
||||||
cartridgeType = IMAGE_GB;
|
cartridgeType = IMAGE_GB;
|
||||||
emulator = GBSystem;
|
emulator = GBSystem;
|
||||||
|
@ -1738,19 +1740,19 @@ int main(int argc, char** argv)
|
||||||
int size = CPULoadRom(szFile);
|
int size = CPULoadRom(szFile);
|
||||||
failed = (size == 0);
|
failed = (size == 0);
|
||||||
if (!failed) {
|
if (!failed) {
|
||||||
if (cpuSaveType == 0)
|
if (coreOptions.cpuSaveType == 0)
|
||||||
utilGBAFindSave(size);
|
utilGBAFindSave(size);
|
||||||
else
|
else
|
||||||
saveType = cpuSaveType;
|
coreOptions.saveType = coreOptions.cpuSaveType;
|
||||||
|
|
||||||
sdlApplyPerImagePreferences();
|
sdlApplyPerImagePreferences();
|
||||||
|
|
||||||
doMirroring(mirroringEnable);
|
doMirroring(coreOptions.mirroringEnable);
|
||||||
|
|
||||||
cartridgeType = 0;
|
cartridgeType = 0;
|
||||||
emulator = GBASystem;
|
emulator = GBASystem;
|
||||||
|
|
||||||
CPUInit(biosFileNameGBA, useBios);
|
CPUInit(biosFileNameGBA, coreOptions.useBios);
|
||||||
int patchnum;
|
int patchnum;
|
||||||
for (patchnum = 0; patchnum < patchNum; patchnum++) {
|
for (patchnum = 0; patchnum < patchNum; patchnum++) {
|
||||||
fprintf(stdout, "Trying patch %s%s\n", patchNames[patchnum],
|
fprintf(stdout, "Trying patch %s%s\n", patchNames[patchnum],
|
||||||
|
@ -1780,7 +1782,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
emulator = GBASystem;
|
emulator = GBASystem;
|
||||||
|
|
||||||
CPUInit(biosFileNameGBA, useBios);
|
CPUInit(biosFileNameGBA, coreOptions.useBios);
|
||||||
CPUReset();
|
CPUReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1800,9 +1800,9 @@ EVT_HANDLER(KeepSaves, "Do not load battery saves (toggle)")
|
||||||
{
|
{
|
||||||
bool menuPress = false;
|
bool menuPress = false;
|
||||||
GetMenuOptionBool("KeepSaves", &menuPress);
|
GetMenuOptionBool("KeepSaves", &menuPress);
|
||||||
toggleBitVar(&menuPress, &skipSaveGameBattery, 1);
|
toggleBitVar(&menuPress, &coreOptions.skipSaveGameBattery, 1);
|
||||||
SetMenuOption("KeepSaves", menuPress ? 1 : 0);
|
SetMenuOption("KeepSaves", menuPress ? 1 : 0);
|
||||||
GetMenuOptionInt("KeepSaves", &skipSaveGameBattery, 1);
|
GetMenuOptionInt("KeepSaves", &coreOptions.skipSaveGameBattery, 1);
|
||||||
update_opts();
|
update_opts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1811,9 +1811,9 @@ EVT_HANDLER(KeepCheats, "Do not change cheat list (toggle)")
|
||||||
{
|
{
|
||||||
bool menuPress = false;
|
bool menuPress = false;
|
||||||
GetMenuOptionBool("KeepCheats", &menuPress);
|
GetMenuOptionBool("KeepCheats", &menuPress);
|
||||||
toggleBitVar(&menuPress, &skipSaveGameCheats, 1);
|
toggleBitVar(&menuPress, &coreOptions.skipSaveGameCheats, 1);
|
||||||
SetMenuOption("KeepCheats", menuPress ? 1 : 0);
|
SetMenuOption("KeepCheats", menuPress ? 1 : 0);
|
||||||
GetMenuOptionInt("KeepCheats", &skipSaveGameCheats, 1);
|
GetMenuOptionInt("KeepCheats", &coreOptions.skipSaveGameCheats, 1);
|
||||||
update_opts();
|
update_opts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1987,9 +1987,9 @@ EVT_HANDLER(CheatsEnable, "Enable cheats (toggle)")
|
||||||
{
|
{
|
||||||
bool menuPress = false;
|
bool menuPress = false;
|
||||||
GetMenuOptionBool("CheatsEnable", &menuPress);
|
GetMenuOptionBool("CheatsEnable", &menuPress);
|
||||||
toggleBitVar(&menuPress, &cheatsEnabled, 1);
|
toggleBitVar(&menuPress, &coreOptions.cheatsEnabled, 1);
|
||||||
SetMenuOption("CheatsEnable", menuPress ? 1 : 0);
|
SetMenuOption("CheatsEnable", menuPress ? 1 : 0);
|
||||||
GetMenuOptionInt("CheatsEnable", &cheatsEnabled, 1);
|
GetMenuOptionInt("CheatsEnable", &coreOptions.cheatsEnabled, 1);
|
||||||
update_opts();
|
update_opts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2015,10 +2015,10 @@ EVT_HANDLER_MASK(VideoLayersBG0, "Video layer BG0 (toggle)", CMDEN_GB | CMDEN_GB
|
||||||
bool menuPress = false;
|
bool menuPress = false;
|
||||||
char keyName[] = "VideoLayersBG0";
|
char keyName[] = "VideoLayersBG0";
|
||||||
GetMenuOptionBool(keyName, &menuPress);
|
GetMenuOptionBool(keyName, &menuPress);
|
||||||
toggleBitVar(&menuPress, &layerSettings, (1 << 8));
|
toggleBitVar(&menuPress, &coreOptions.layerSettings, (1 << 8));
|
||||||
SetMenuOption(keyName, menuPress ? 1 : 0);
|
SetMenuOption(keyName, menuPress ? 1 : 0);
|
||||||
GetMenuOptionInt(keyName, &layerSettings, (1 << 8));
|
GetMenuOptionInt(keyName, &coreOptions.layerSettings, (1 << 8));
|
||||||
layerEnable = DISPCNT & layerSettings;
|
coreOptions.layerEnable = DISPCNT & coreOptions.layerSettings;
|
||||||
CPUUpdateRenderBuffers(false);
|
CPUUpdateRenderBuffers(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2027,10 +2027,10 @@ EVT_HANDLER_MASK(VideoLayersBG1, "Video layer BG1 (toggle)", CMDEN_GB | CMDEN_GB
|
||||||
bool menuPress = false;
|
bool menuPress = false;
|
||||||
char keyName[] = "VideoLayersBG1";
|
char keyName[] = "VideoLayersBG1";
|
||||||
GetMenuOptionBool(keyName, &menuPress);
|
GetMenuOptionBool(keyName, &menuPress);
|
||||||
toggleBitVar(&menuPress, &layerSettings, (1 << 9));
|
toggleBitVar(&menuPress, &coreOptions.layerSettings, (1 << 9));
|
||||||
SetMenuOption(keyName, menuPress ? 1 : 0);
|
SetMenuOption(keyName, menuPress ? 1 : 0);
|
||||||
GetMenuOptionInt(keyName, &layerSettings, (1 << 9));
|
GetMenuOptionInt(keyName, &coreOptions.layerSettings, (1 << 9));
|
||||||
layerEnable = DISPCNT & layerSettings;
|
coreOptions.layerEnable = DISPCNT & coreOptions.layerSettings;
|
||||||
CPUUpdateRenderBuffers(false);
|
CPUUpdateRenderBuffers(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2039,10 +2039,10 @@ EVT_HANDLER_MASK(VideoLayersBG2, "Video layer BG2 (toggle)", CMDEN_GB | CMDEN_GB
|
||||||
bool menuPress = false;
|
bool menuPress = false;
|
||||||
char keyName[] = "VideoLayersBG2";
|
char keyName[] = "VideoLayersBG2";
|
||||||
GetMenuOptionBool(keyName, &menuPress);
|
GetMenuOptionBool(keyName, &menuPress);
|
||||||
toggleBitVar(&menuPress, &layerSettings, (1 << 10));
|
toggleBitVar(&menuPress, &coreOptions.layerSettings, (1 << 10));
|
||||||
SetMenuOption(keyName, menuPress ? 1 : 0);
|
SetMenuOption(keyName, menuPress ? 1 : 0);
|
||||||
GetMenuOptionInt(keyName, &layerSettings, (1 << 10));
|
GetMenuOptionInt(keyName, &coreOptions.layerSettings, (1 << 10));
|
||||||
layerEnable = DISPCNT & layerSettings;
|
coreOptions.layerEnable = DISPCNT & coreOptions.layerSettings;
|
||||||
CPUUpdateRenderBuffers(false);
|
CPUUpdateRenderBuffers(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2051,10 +2051,10 @@ EVT_HANDLER_MASK(VideoLayersBG3, "Video layer BG3 (toggle)", CMDEN_GB | CMDEN_GB
|
||||||
bool menuPress = false;
|
bool menuPress = false;
|
||||||
char keyName[] = "VideoLayersBG3";
|
char keyName[] = "VideoLayersBG3";
|
||||||
GetMenuOptionBool(keyName, &menuPress);
|
GetMenuOptionBool(keyName, &menuPress);
|
||||||
toggleBitVar(&menuPress, &layerSettings, (1 << 11));
|
toggleBitVar(&menuPress, &coreOptions.layerSettings, (1 << 11));
|
||||||
SetMenuOption(keyName, menuPress ? 1 : 0);
|
SetMenuOption(keyName, menuPress ? 1 : 0);
|
||||||
GetMenuOptionInt(keyName, &layerSettings, (1 << 11));
|
GetMenuOptionInt(keyName, &coreOptions.layerSettings, (1 << 11));
|
||||||
layerEnable = DISPCNT & layerSettings;
|
coreOptions.layerEnable = DISPCNT & coreOptions.layerSettings;
|
||||||
CPUUpdateRenderBuffers(false);
|
CPUUpdateRenderBuffers(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2063,10 +2063,10 @@ EVT_HANDLER_MASK(VideoLayersOBJ, "Video layer OBJ (toggle)", CMDEN_GB | CMDEN_GB
|
||||||
bool menuPress = false;
|
bool menuPress = false;
|
||||||
char keyName[] = "VideoLayersOBJ";
|
char keyName[] = "VideoLayersOBJ";
|
||||||
GetMenuOptionBool(keyName, &menuPress);
|
GetMenuOptionBool(keyName, &menuPress);
|
||||||
toggleBitVar(&menuPress, &layerSettings, (1 << 12));
|
toggleBitVar(&menuPress, &coreOptions.layerSettings, (1 << 12));
|
||||||
SetMenuOption(keyName, menuPress ? 1 : 0);
|
SetMenuOption(keyName, menuPress ? 1 : 0);
|
||||||
GetMenuOptionInt(keyName, &layerSettings, (1 << 12));
|
GetMenuOptionInt(keyName, &coreOptions.layerSettings, (1 << 12));
|
||||||
layerEnable = DISPCNT & layerSettings;
|
coreOptions.layerEnable = DISPCNT & coreOptions.layerSettings;
|
||||||
CPUUpdateRenderBuffers(false);
|
CPUUpdateRenderBuffers(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2075,10 +2075,10 @@ EVT_HANDLER_MASK(VideoLayersWIN0, "Video layer WIN0 (toggle)", CMDEN_GB | CMDEN_
|
||||||
bool menuPress = false;
|
bool menuPress = false;
|
||||||
char keyName[] = "VideoLayersWIN0";
|
char keyName[] = "VideoLayersWIN0";
|
||||||
GetMenuOptionBool(keyName, &menuPress);
|
GetMenuOptionBool(keyName, &menuPress);
|
||||||
toggleBitVar(&menuPress, &layerSettings, (1 << 13));
|
toggleBitVar(&menuPress, &coreOptions.layerSettings, (1 << 13));
|
||||||
SetMenuOption(keyName, menuPress ? 1 : 0);
|
SetMenuOption(keyName, menuPress ? 1 : 0);
|
||||||
GetMenuOptionInt(keyName, &layerSettings, (1 << 13));
|
GetMenuOptionInt(keyName, &coreOptions.layerSettings, (1 << 13));
|
||||||
layerEnable = DISPCNT & layerSettings;
|
coreOptions.layerEnable = DISPCNT & coreOptions.layerSettings;
|
||||||
CPUUpdateRenderBuffers(false);
|
CPUUpdateRenderBuffers(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2087,10 +2087,10 @@ EVT_HANDLER_MASK(VideoLayersWIN1, "Video layer WIN1 (toggle)", CMDEN_GB | CMDEN_
|
||||||
bool menuPress = false;
|
bool menuPress = false;
|
||||||
char keyName[] = "VideoLayersWIN1";
|
char keyName[] = "VideoLayersWIN1";
|
||||||
GetMenuOptionBool(keyName, &menuPress);
|
GetMenuOptionBool(keyName, &menuPress);
|
||||||
toggleBitVar(&menuPress, &layerSettings, (1 << 14));
|
toggleBitVar(&menuPress, &coreOptions.layerSettings, (1 << 14));
|
||||||
SetMenuOption(keyName, menuPress ? 1 : 0);
|
SetMenuOption(keyName, menuPress ? 1 : 0);
|
||||||
GetMenuOptionInt(keyName, &layerSettings, (1 << 14));
|
GetMenuOptionInt(keyName, &coreOptions.layerSettings, (1 << 14));
|
||||||
layerEnable = DISPCNT & layerSettings;
|
coreOptions.layerEnable = DISPCNT & coreOptions.layerSettings;
|
||||||
CPUUpdateRenderBuffers(false);
|
CPUUpdateRenderBuffers(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2099,10 +2099,10 @@ EVT_HANDLER_MASK(VideoLayersOBJWIN, "Video layer OBJWIN (toggle)", CMDEN_GB | CM
|
||||||
bool menuPress = false;
|
bool menuPress = false;
|
||||||
char keyName[] = "VideoLayersOBJWIN";
|
char keyName[] = "VideoLayersOBJWIN";
|
||||||
GetMenuOptionBool(keyName, &menuPress);
|
GetMenuOptionBool(keyName, &menuPress);
|
||||||
toggleBitVar(&menuPress, &layerSettings, (1 << 15));
|
toggleBitVar(&menuPress, &coreOptions.layerSettings, (1 << 15));
|
||||||
SetMenuOption(keyName, menuPress ? 1 : 0);
|
SetMenuOption(keyName, menuPress ? 1 : 0);
|
||||||
GetMenuOptionInt(keyName, &layerSettings, (1 << 15));
|
GetMenuOptionInt(keyName, &coreOptions.layerSettings, (1 << 15));
|
||||||
layerEnable = DISPCNT & layerSettings;
|
coreOptions.layerEnable = DISPCNT & coreOptions.layerSettings;
|
||||||
CPUUpdateRenderBuffers(false);
|
CPUUpdateRenderBuffers(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2117,8 +2117,8 @@ EVT_HANDLER_MASK(VideoLayersReset, "Show all video layers", CMDEN_GB | CMDEN_GBA
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
layerSettings = 0x7f00;
|
coreOptions.layerSettings = 0x7f00;
|
||||||
layerEnable = DISPCNT & layerSettings;
|
coreOptions.layerEnable = DISPCNT & coreOptions.layerSettings;
|
||||||
set_vl("VideoLayersBG0");
|
set_vl("VideoLayersBG0");
|
||||||
set_vl("VideoLayersBG1");
|
set_vl("VideoLayersBG1");
|
||||||
set_vl("VideoLayersBG2");
|
set_vl("VideoLayersBG2");
|
||||||
|
@ -2488,7 +2488,7 @@ EVT_HANDLER(SpeedupConfigure, "Speedup / Turbo options...")
|
||||||
|
|
||||||
unsigned save_speedup_throttle = speedup_throttle;
|
unsigned save_speedup_throttle = speedup_throttle;
|
||||||
unsigned save_speedup_frame_skip = speedup_frame_skip;
|
unsigned save_speedup_frame_skip = speedup_frame_skip;
|
||||||
bool save_speedup_throttle_frame_skip = speedup_throttle_frame_skip;
|
bool save_speedup_throttle_frame_skip = coreOptions.speedup_throttle_frame_skip;
|
||||||
|
|
||||||
if (ShowModal(dlg) == wxID_OK)
|
if (ShowModal(dlg) == wxID_OK)
|
||||||
update_opts();
|
update_opts();
|
||||||
|
@ -2496,7 +2496,7 @@ EVT_HANDLER(SpeedupConfigure, "Speedup / Turbo options...")
|
||||||
// Restore values if cancel pressed.
|
// Restore values if cancel pressed.
|
||||||
speedup_throttle = save_speedup_throttle;
|
speedup_throttle = save_speedup_throttle;
|
||||||
speedup_frame_skip = save_speedup_frame_skip;
|
speedup_frame_skip = save_speedup_frame_skip;
|
||||||
speedup_throttle_frame_skip = save_speedup_throttle_frame_skip;
|
coreOptions.speedup_throttle_frame_skip = save_speedup_throttle_frame_skip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2980,7 +2980,7 @@ EVT_HANDLER(RetainAspect, "Retain aspect ratio when resizing")
|
||||||
|
|
||||||
EVT_HANDLER(Printer, "Enable printer emulation")
|
EVT_HANDLER(Printer, "Enable printer emulation")
|
||||||
{
|
{
|
||||||
GetMenuOptionInt("Printer", &winGbPrinterEnabled, 1);
|
GetMenuOptionInt("Printer", &coreOptions.winGbPrinterEnabled, 1);
|
||||||
#if (defined __WIN32__ || defined _WIN32)
|
#if (defined __WIN32__ || defined _WIN32)
|
||||||
#ifndef NO_LINK
|
#ifndef NO_LINK
|
||||||
gbSerialFunction = gbStartLink;
|
gbSerialFunction = gbStartLink;
|
||||||
|
@ -2988,7 +2988,7 @@ EVT_HANDLER(Printer, "Enable printer emulation")
|
||||||
gbSerialFunction = NULL;
|
gbSerialFunction = NULL;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
if (winGbPrinterEnabled)
|
if (coreOptions.winGbPrinterEnabled)
|
||||||
gbSerialFunction = gbPrinterSend;
|
gbSerialFunction = gbPrinterSend;
|
||||||
|
|
||||||
update_opts();
|
update_opts();
|
||||||
|
@ -3126,7 +3126,7 @@ EVT_HANDLER(PauseWhenInactive, "Pause game when main window loses focus")
|
||||||
|
|
||||||
EVT_HANDLER(RTC, "Enable RTC (vba-over.ini override is rtcEnabled")
|
EVT_HANDLER(RTC, "Enable RTC (vba-over.ini override is rtcEnabled")
|
||||||
{
|
{
|
||||||
GetMenuOptionInt("RTC", &rtcEnabled, 1);
|
GetMenuOptionInt("RTC", &coreOptions.rtcEnabled, 1);
|
||||||
update_opts();
|
update_opts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3138,7 +3138,7 @@ EVT_HANDLER(Transparent, "Draw on-screen messages transparently")
|
||||||
|
|
||||||
EVT_HANDLER(SkipIntro, "Skip BIOS initialization")
|
EVT_HANDLER(SkipIntro, "Skip BIOS initialization")
|
||||||
{
|
{
|
||||||
GetMenuOptionInt("SkipIntro", &skipBios, 1);
|
GetMenuOptionInt("SkipIntro", &coreOptions.skipBios, 1);
|
||||||
update_opts();
|
update_opts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
#include "config/internal/option-internal.h"
|
#include "config/internal/option-internal.h"
|
||||||
#undef VBAM_OPTION_INTERNAL_INCLUDE
|
#undef VBAM_OPTION_INTERNAL_INCLUDE
|
||||||
|
|
||||||
|
struct CoreOptions coreOptions;
|
||||||
|
|
||||||
namespace config {
|
namespace config {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -234,14 +236,14 @@ std::array<Option, kNbOptions>& Option::All() {
|
||||||
Option(OptionID::kPrefBorderAutomatic, &gbBorderAutomatic, 0, 1),
|
Option(OptionID::kPrefBorderAutomatic, &gbBorderAutomatic, 0, 1),
|
||||||
Option(OptionID::kPrefBorderOn, &gbBorderOn, 0, 1),
|
Option(OptionID::kPrefBorderOn, &gbBorderOn, 0, 1),
|
||||||
Option(OptionID::kPrefCaptureFormat, &captureFormat, 0, 1),
|
Option(OptionID::kPrefCaptureFormat, &captureFormat, 0, 1),
|
||||||
Option(OptionID::kPrefCheatsEnabled, &cheatsEnabled, 0, 1),
|
Option(OptionID::kPrefCheatsEnabled, &coreOptions.cheatsEnabled, 0, 1),
|
||||||
Option(OptionID::kPrefDisableStatus, &disableStatusMessages, 0,
|
Option(OptionID::kPrefDisableStatus, &disableStatusMessages, 0,
|
||||||
1),
|
1),
|
||||||
Option(OptionID::kPrefEmulatorType, &gbEmulatorType, 0, 5),
|
Option(OptionID::kPrefEmulatorType, &gbEmulatorType, 0, 5),
|
||||||
Option(OptionID::kPrefFlashSize, &optFlashSize, 0, 1),
|
Option(OptionID::kPrefFlashSize, &optFlashSize, 0, 1),
|
||||||
Option(OptionID::kPrefFrameSkip, &frameSkip, -1, 9),
|
Option(OptionID::kPrefFrameSkip, &frameSkip, -1, 9),
|
||||||
Option(OptionID::kPrefGBPaletteOption, &gbPaletteOption, 0, 2),
|
Option(OptionID::kPrefGBPaletteOption, &gbPaletteOption, 0, 2),
|
||||||
Option(OptionID::kPrefGBPrinter, &winGbPrinterEnabled, 0, 1),
|
Option(OptionID::kPrefGBPrinter, &coreOptions.winGbPrinterEnabled, 0, 1),
|
||||||
Option(OptionID::kPrefGDBBreakOnLoad, &gopts.gdb_break_on_load),
|
Option(OptionID::kPrefGDBBreakOnLoad, &gopts.gdb_break_on_load),
|
||||||
Option(OptionID::kPrefGDBPort, &gopts.gdb_port, 0, 65535),
|
Option(OptionID::kPrefGDBPort, &gopts.gdb_port, 0, 65535),
|
||||||
#ifndef NO_LINK
|
#ifndef NO_LINK
|
||||||
|
@ -250,15 +252,15 @@ std::array<Option, kNbOptions>& Option::All() {
|
||||||
Option(OptionID::kPrefMaxScale, &gopts.max_scale, 0, 100),
|
Option(OptionID::kPrefMaxScale, &gopts.max_scale, 0, 100),
|
||||||
Option(OptionID::kPrefPauseWhenInactive, &pauseWhenInactive, 0,
|
Option(OptionID::kPrefPauseWhenInactive, &pauseWhenInactive, 0,
|
||||||
1),
|
1),
|
||||||
Option(OptionID::kPrefRTCEnabled, &rtcEnabled, 0, 1),
|
Option(OptionID::kPrefRTCEnabled, &coreOptions.rtcEnabled, 0, 1),
|
||||||
Option(OptionID::kPrefSaveType, &cpuSaveType, 0, 5),
|
Option(OptionID::kPrefSaveType, &coreOptions.cpuSaveType, 0, 5),
|
||||||
Option(OptionID::kPrefShowSpeed, &showSpeed, 0, 2),
|
Option(OptionID::kPrefShowSpeed, &showSpeed, 0, 2),
|
||||||
Option(OptionID::kPrefShowSpeedTransparent,
|
Option(OptionID::kPrefShowSpeedTransparent,
|
||||||
&showSpeedTransparent, 0, 1),
|
&showSpeedTransparent, 0, 1),
|
||||||
Option(OptionID::kPrefSkipBios, &skipBios, 0, 1),
|
Option(OptionID::kPrefSkipBios, &coreOptions.skipBios, 0, 1),
|
||||||
Option(OptionID::kPrefSkipSaveGameCheats, &skipSaveGameCheats, 0,
|
Option(OptionID::kPrefSkipSaveGameCheats, &coreOptions.skipSaveGameCheats, 0,
|
||||||
1),
|
1),
|
||||||
Option(OptionID::kPrefSkipSaveGameBattery, &skipSaveGameBattery,
|
Option(OptionID::kPrefSkipSaveGameBattery, &coreOptions.skipSaveGameBattery,
|
||||||
0, 1),
|
0, 1),
|
||||||
Option(OptionID::kPrefThrottle, &throttle, 0, 450),
|
Option(OptionID::kPrefThrottle, &throttle, 0, 450),
|
||||||
Option(OptionID::kPrefSpeedupThrottle, &speedup_throttle, 0,
|
Option(OptionID::kPrefSpeedupThrottle, &speedup_throttle, 0,
|
||||||
|
@ -266,7 +268,7 @@ std::array<Option, kNbOptions>& Option::All() {
|
||||||
Option(OptionID::kPrefSpeedupFrameSkip, &speedup_frame_skip, 0,
|
Option(OptionID::kPrefSpeedupFrameSkip, &speedup_frame_skip, 0,
|
||||||
300),
|
300),
|
||||||
Option(OptionID::kPrefSpeedupThrottleFrameSkip,
|
Option(OptionID::kPrefSpeedupThrottleFrameSkip,
|
||||||
&speedup_throttle_frame_skip),
|
&coreOptions.speedup_throttle_frame_skip),
|
||||||
Option(OptionID::kPrefUseBiosGB, &gopts.use_bios_file_gb),
|
Option(OptionID::kPrefUseBiosGB, &gopts.use_bios_file_gb),
|
||||||
Option(OptionID::kPrefUseBiosGBA, &gopts.use_bios_file_gba),
|
Option(OptionID::kPrefUseBiosGBA, &gopts.use_bios_file_gba),
|
||||||
Option(OptionID::kPrefUseBiosGBC, &gopts.use_bios_file_gbc),
|
Option(OptionID::kPrefUseBiosGBC, &gopts.use_bios_file_gbc),
|
||||||
|
|
|
@ -252,7 +252,7 @@ void DirectSound::write(uint16_t* finalWave, int length)
|
||||||
LPVOID lpvPtr2;
|
LPVOID lpvPtr2;
|
||||||
DWORD dwBytes2 = 0;
|
DWORD dwBytes2 = 0;
|
||||||
|
|
||||||
if (!speedup && throttle && !gba_joybus_active) {
|
if (!coreOptions.speedup && throttle && !gba_joybus_active) {
|
||||||
hr = dsbSecondary->GetStatus(&status);
|
hr = dsbSecondary->GetStatus(&status);
|
||||||
|
|
||||||
if (status & DSBSTATUS_PLAYING) {
|
if (status & DSBSTATUS_PLAYING) {
|
||||||
|
|
|
@ -544,7 +544,7 @@ void FAudio_Output::write(uint16_t* finalWave, int length)
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
// the maximum number of buffers is currently queued
|
// the maximum number of buffers is currently queued
|
||||||
if (!speedup && throttle && !gba_joybus_active) {
|
if (!coreOptions.speedup && throttle && !gba_joybus_active) {
|
||||||
// wait for one buffer to finish playing
|
// wait for one buffer to finish playing
|
||||||
if (WaitForSingleObject(notify.hBufferEndEvent, 10000) == WAIT_TIMEOUT) {
|
if (WaitForSingleObject(notify.hBufferEndEvent, 10000) == WAIT_TIMEOUT) {
|
||||||
device_changed = true;
|
device_changed = true;
|
||||||
|
|
|
@ -1513,9 +1513,9 @@ public:
|
||||||
(void)ev; // unused params
|
(void)ev; // unused params
|
||||||
uint32_t sz = wxGetApp().frame->GetPanel()->game_size();
|
uint32_t sz = wxGetApp().frame->GetPanel()->game_size();
|
||||||
utilGBAFindSave(sz);
|
utilGBAFindSave(sz);
|
||||||
type->SetSelection(saveType);
|
type->SetSelection(coreOptions.saveType);
|
||||||
|
|
||||||
if (saveType == GBA_SAVE_FLASH) {
|
if (coreOptions.saveType == GBA_SAVE_FLASH) {
|
||||||
size->SetSelection(flashSize == 0x20000 ? 1 : 0);
|
size->SetSelection(flashSize == 0x20000 ? 1 : 0);
|
||||||
size->Enable();
|
size->Enable();
|
||||||
} else {
|
} else {
|
||||||
|
@ -2206,7 +2206,7 @@ public:
|
||||||
if (val == 0) {
|
if (val == 0) {
|
||||||
speedup_throttle = 0;
|
speedup_throttle = 0;
|
||||||
speedup_frame_skip = 0;
|
speedup_frame_skip = 0;
|
||||||
speedup_throttle_frame_skip = false;
|
coreOptions.speedup_throttle_frame_skip = false;
|
||||||
|
|
||||||
frame_skip_cb->SetValue(false);
|
frame_skip_cb->SetValue(false);
|
||||||
frame_skip_cb->Disable();
|
frame_skip_cb->Disable();
|
||||||
|
@ -2223,7 +2223,7 @@ public:
|
||||||
}
|
}
|
||||||
else { // val > 450
|
else { // val > 450
|
||||||
speedup_throttle = 100;
|
speedup_throttle = 100;
|
||||||
speedup_throttle_frame_skip = false;
|
coreOptions.speedup_throttle_frame_skip = false;
|
||||||
|
|
||||||
unsigned rounded = std::round((double)val / 100) * 100;
|
unsigned rounded = std::round((double)val / 100) * 100;
|
||||||
|
|
||||||
|
@ -2252,7 +2252,7 @@ public:
|
||||||
|
|
||||||
bool checked = frame_skip_cb->GetValue();
|
bool checked = frame_skip_cb->GetValue();
|
||||||
|
|
||||||
speedup_throttle_frame_skip = prev_frame_skip_cb = checked;
|
coreOptions.speedup_throttle_frame_skip = prev_frame_skip_cb = checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init(wxShowEvent& ev)
|
void Init(wxShowEvent& ev)
|
||||||
|
@ -2264,7 +2264,7 @@ public:
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
speedup_throttle_spin->SetValue(speedup_throttle);
|
speedup_throttle_spin->SetValue(speedup_throttle);
|
||||||
frame_skip_cb->SetValue(speedup_throttle_frame_skip);
|
frame_skip_cb->SetValue(coreOptions.speedup_throttle_frame_skip);
|
||||||
|
|
||||||
if (speedup_throttle != 0)
|
if (speedup_throttle != 0)
|
||||||
frame_skip_cb->Enable();
|
frame_skip_cb->Enable();
|
||||||
|
@ -2275,7 +2275,7 @@ public:
|
||||||
ev.Skip();
|
ev.Skip();
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
bool prev_frame_skip_cb = speedup_throttle_frame_skip;
|
bool prev_frame_skip_cb = coreOptions.speedup_throttle_frame_skip;
|
||||||
} speedup_throttle_ctrl;
|
} speedup_throttle_ctrl;
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
|
@ -2869,19 +2869,19 @@ bool MainFrame::BindControls()
|
||||||
MenuOptionIntMask("SoundChannel4", gopts.sound_en, (1 << 3));
|
MenuOptionIntMask("SoundChannel4", gopts.sound_en, (1 << 3));
|
||||||
MenuOptionIntMask("DirectSoundA", gopts.sound_en, (1 << 8));
|
MenuOptionIntMask("DirectSoundA", gopts.sound_en, (1 << 8));
|
||||||
MenuOptionIntMask("DirectSoundB", gopts.sound_en, (1 << 9));
|
MenuOptionIntMask("DirectSoundB", gopts.sound_en, (1 << 9));
|
||||||
MenuOptionIntMask("VideoLayersBG0", layerSettings, (1 << 8));
|
MenuOptionIntMask("VideoLayersBG0", coreOptions.layerSettings, (1 << 8));
|
||||||
MenuOptionIntMask("VideoLayersBG1", layerSettings, (1 << 9));
|
MenuOptionIntMask("VideoLayersBG1", coreOptions.layerSettings, (1 << 9));
|
||||||
MenuOptionIntMask("VideoLayersBG2", layerSettings, (1 << 10));
|
MenuOptionIntMask("VideoLayersBG2", coreOptions.layerSettings, (1 << 10));
|
||||||
MenuOptionIntMask("VideoLayersBG3", layerSettings, (1 << 11));
|
MenuOptionIntMask("VideoLayersBG3", coreOptions.layerSettings, (1 << 11));
|
||||||
MenuOptionIntMask("VideoLayersOBJ", layerSettings, (1 << 12));
|
MenuOptionIntMask("VideoLayersOBJ", coreOptions.layerSettings, (1 << 12));
|
||||||
MenuOptionIntMask("VideoLayersWIN0", layerSettings, (1 << 13));
|
MenuOptionIntMask("VideoLayersWIN0", coreOptions.layerSettings, (1 << 13));
|
||||||
MenuOptionIntMask("VideoLayersWIN1", layerSettings, (1 << 14));
|
MenuOptionIntMask("VideoLayersWIN1", coreOptions.layerSettings, (1 << 14));
|
||||||
MenuOptionIntMask("VideoLayersOBJWIN", layerSettings, (1 << 15));
|
MenuOptionIntMask("VideoLayersOBJWIN", coreOptions.layerSettings, (1 << 15));
|
||||||
MenuOptionBool("CheatsAutoSaveLoad", gopts.autoload_cheats);
|
MenuOptionBool("CheatsAutoSaveLoad", gopts.autoload_cheats);
|
||||||
MenuOptionIntMask("CheatsEnable", cheatsEnabled, 1);
|
MenuOptionIntMask("CheatsEnable", coreOptions.cheatsEnabled, 1);
|
||||||
SetMenuOption("ColorizerHack", colorizerHack ? 1 : 0);
|
SetMenuOption("ColorizerHack", colorizerHack ? 1 : 0);
|
||||||
MenuOptionIntMask("KeepSaves", skipSaveGameBattery, 1);
|
MenuOptionIntMask("KeepSaves", coreOptions.skipSaveGameBattery, 1);
|
||||||
MenuOptionIntMask("KeepCheats", skipSaveGameCheats, 1);
|
MenuOptionIntMask("KeepCheats", coreOptions.skipSaveGameCheats, 1);
|
||||||
MenuOptionBool("LoadGameAutoLoad", gopts.autoload_state);
|
MenuOptionBool("LoadGameAutoLoad", gopts.autoload_state);
|
||||||
MenuOptionIntMask("JoypadAutofireA", autofire, KEYM_A);
|
MenuOptionIntMask("JoypadAutofireA", autofire, KEYM_A);
|
||||||
MenuOptionIntMask("JoypadAutofireB", autofire, KEYM_B);
|
MenuOptionIntMask("JoypadAutofireB", autofire, KEYM_B);
|
||||||
|
@ -3452,7 +3452,7 @@ bool MainFrame::BindControls()
|
||||||
d = LoadXRCropertySheetDialog("GameBoyAdvanceConfig");
|
d = LoadXRCropertySheetDialog("GameBoyAdvanceConfig");
|
||||||
{
|
{
|
||||||
/// System and peripherals
|
/// System and peripherals
|
||||||
ch = GetValidatedChild<wxChoice, wxGenericValidator>(d, "SaveType", wxGenericValidator(&cpuSaveType));
|
ch = GetValidatedChild<wxChoice, wxGenericValidator>(d, "SaveType", wxGenericValidator(&coreOptions.cpuSaveType));
|
||||||
BatConfigHandler.type = ch;
|
BatConfigHandler.type = ch;
|
||||||
ch = GetValidatedChild<wxChoice, wxGenericValidator>(d, "FlashSize", wxGenericValidator(&optFlashSize));
|
ch = GetValidatedChild<wxChoice, wxGenericValidator>(d, "FlashSize", wxGenericValidator(&optFlashSize));
|
||||||
BatConfigHandler.size = ch;
|
BatConfigHandler.size = ch;
|
||||||
|
|
|
@ -292,7 +292,7 @@ void OpenAL::write(uint16_t* finalWave, int length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!speedup && throttle && !gba_joybus_active) {
|
if (!coreOptions.speedup && throttle && !gba_joybus_active) {
|
||||||
// wait until at least one buffer has finished
|
// wait until at least one buffer has finished
|
||||||
while (nBuffersProcessed == 0) {
|
while (nBuffersProcessed == 0) {
|
||||||
winlog(" waiting...\n");
|
winlog(" waiting...\n");
|
||||||
|
|
|
@ -305,8 +305,7 @@ const std::map<config::GameControl, std::set<config::UserInput>> kDefaultBinding
|
||||||
|
|
||||||
wxAcceleratorEntry_v sys_accels;
|
wxAcceleratorEntry_v sys_accels;
|
||||||
|
|
||||||
// This constructor only works with globally allocated gopts. It relies on
|
// This constructor only works with globally allocated gopts.
|
||||||
// the default value of every non-object to be 0.
|
|
||||||
opts_t::opts_t()
|
opts_t::opts_t()
|
||||||
{
|
{
|
||||||
// handle erroneous thread count values appropriately
|
// handle erroneous thread count values appropriately
|
||||||
|
@ -322,7 +321,6 @@ opts_t::opts_t()
|
||||||
// These are globals being set here.
|
// These are globals being set here.
|
||||||
frameSkip = -1;
|
frameSkip = -1;
|
||||||
autoPatch = true;
|
autoPatch = true;
|
||||||
skipSaveGameBattery = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: simulate MakeInstanceFilename(vbam.ini) using subkeys (Slave%d/*)
|
// FIXME: simulate MakeInstanceFilename(vbam.ini) using subkeys (Slave%d/*)
|
||||||
|
|
|
@ -275,7 +275,7 @@ void GameArea::LoadGame(const wxString& name)
|
||||||
|
|
||||||
gbCPUInit(fn, use_bios);
|
gbCPUInit(fn, use_bios);
|
||||||
|
|
||||||
if (use_bios && !useBios) {
|
if (use_bios && !coreOptions.useBios) {
|
||||||
wxLogError(_("Could not load BIOS %s"), (gbCgbMode ? gopts.gbc_bios : gopts.gb_bios).mb_str());
|
wxLogError(_("Could not load BIOS %s"), (gbCgbMode ? gopts.gbc_bios : gopts.gb_bios).mb_str());
|
||||||
// could clear use flag & file name now, but better to force
|
// could clear use flag & file name now, but better to force
|
||||||
// user to do it
|
// user to do it
|
||||||
|
@ -322,7 +322,7 @@ void GameArea::LoadGame(const wxString& name)
|
||||||
|
|
||||||
if (cfg->HasGroup(id)) {
|
if (cfg->HasGroup(id)) {
|
||||||
cfg->SetPath(id);
|
cfg->SetPath(id);
|
||||||
bool enable_rtc = cfg->Read(wxT("rtcEnabled"), rtcEnabled);
|
bool enable_rtc = cfg->Read(wxT("rtcEnabled"), coreOptions.rtcEnabled);
|
||||||
|
|
||||||
rtcEnable(enable_rtc);
|
rtcEnable(enable_rtc);
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ void GameArea::LoadGame(const wxString& name)
|
||||||
fsz = 0x10000 << optFlashSize;
|
fsz = 0x10000 << optFlashSize;
|
||||||
|
|
||||||
flashSetSize(fsz);
|
flashSetSize(fsz);
|
||||||
ovSaveType = cfg->Read(wxT("saveType"), cpuSaveType);
|
ovSaveType = cfg->Read(wxT("coreOptions.saveType"), coreOptions.cpuSaveType);
|
||||||
|
|
||||||
if (ovSaveType < 0 || ovSaveType > 5)
|
if (ovSaveType < 0 || ovSaveType > 5)
|
||||||
ovSaveType = 0;
|
ovSaveType = 0;
|
||||||
|
@ -340,26 +340,26 @@ void GameArea::LoadGame(const wxString& name)
|
||||||
if (ovSaveType == 0)
|
if (ovSaveType == 0)
|
||||||
utilGBAFindSave(rom_size);
|
utilGBAFindSave(rom_size);
|
||||||
else
|
else
|
||||||
saveType = ovSaveType;
|
coreOptions.saveType = ovSaveType;
|
||||||
|
|
||||||
mirroringEnable = cfg->Read(wxT("mirroringEnabled"), (long)1);
|
coreOptions.mirroringEnable = cfg->Read(wxT("mirroringEnabled"), (long)1);
|
||||||
cfg->SetPath(wxT("/"));
|
cfg->SetPath(wxT("/"));
|
||||||
} else {
|
} else {
|
||||||
rtcEnable(rtcEnabled);
|
rtcEnable(coreOptions.rtcEnabled);
|
||||||
flashSetSize(0x10000 << optFlashSize);
|
flashSetSize(0x10000 << optFlashSize);
|
||||||
|
|
||||||
if (cpuSaveType < 0 || cpuSaveType > 5)
|
if (coreOptions.cpuSaveType < 0 || coreOptions.cpuSaveType > 5)
|
||||||
cpuSaveType = 0;
|
coreOptions.cpuSaveType = 0;
|
||||||
|
|
||||||
if (cpuSaveType == 0)
|
if (coreOptions.cpuSaveType == 0)
|
||||||
utilGBAFindSave(rom_size);
|
utilGBAFindSave(rom_size);
|
||||||
else
|
else
|
||||||
saveType = cpuSaveType;
|
coreOptions.saveType = coreOptions.cpuSaveType;
|
||||||
|
|
||||||
mirroringEnable = false;
|
coreOptions.mirroringEnable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
doMirroring(mirroringEnable);
|
doMirroring(coreOptions.mirroringEnable);
|
||||||
// start sound; this must happen before CPU stuff
|
// start sound; this must happen before CPU stuff
|
||||||
if (!soundInit()) {
|
if (!soundInit()) {
|
||||||
wxLogError(_("Could not initialize the sound driver!"));
|
wxLogError(_("Could not initialize the sound driver!"));
|
||||||
|
@ -375,7 +375,7 @@ void GameArea::LoadGame(const wxString& name)
|
||||||
|
|
||||||
CPUInit(UTF8(gopts.gba_bios), gopts.use_bios_file_gba);
|
CPUInit(UTF8(gopts.gba_bios), gopts.use_bios_file_gba);
|
||||||
|
|
||||||
if (gopts.use_bios_file_gba && !useBios) {
|
if (gopts.use_bios_file_gba && !coreOptions.useBios) {
|
||||||
wxLogError(_("Could not load BIOS %s"), gopts.gba_bios.mb_str());
|
wxLogError(_("Could not load BIOS %s"), gopts.gba_bios.mb_str());
|
||||||
// could clear use flag & file name now, but better to force
|
// could clear use flag & file name now, but better to force
|
||||||
// user to do it
|
// user to do it
|
||||||
|
@ -414,7 +414,7 @@ void GameArea::LoadGame(const wxString& name)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// probably only need to do this for GB carts
|
// probably only need to do this for GB carts
|
||||||
if (winGbPrinterEnabled)
|
if (coreOptions.winGbPrinterEnabled)
|
||||||
gbSerialFunction = gbPrinterSend;
|
gbSerialFunction = gbPrinterSend;
|
||||||
|
|
||||||
// probably only need to do this for GBA carts
|
// probably only need to do this for GBA carts
|
||||||
|
@ -430,7 +430,7 @@ void GameArea::LoadGame(const wxString& name)
|
||||||
mf->update_state_ts(true);
|
mf->update_state_ts(true);
|
||||||
bool did_autoload = gopts.autoload_state ? LoadState() : false;
|
bool did_autoload = gopts.autoload_state ? LoadState() : false;
|
||||||
|
|
||||||
if (!did_autoload || skipSaveGameBattery) {
|
if (!did_autoload || coreOptions.skipSaveGameBattery) {
|
||||||
wxString bname = loaded_game.GetFullName();
|
wxString bname = loaded_game.GetFullName();
|
||||||
#ifndef NO_LINK
|
#ifndef NO_LINK
|
||||||
// MakeInstanceFilename doesn't do wxString, so just add slave ID here
|
// MakeInstanceFilename doesn't do wxString, so just add slave ID here
|
||||||
|
@ -450,24 +450,24 @@ void GameArea::LoadGame(const wxString& name)
|
||||||
msg.Printf(_("Loaded battery %s"), bat.GetFullPath().wc_str());
|
msg.Printf(_("Loaded battery %s"), bat.GetFullPath().wc_str());
|
||||||
systemScreenMessage(msg);
|
systemScreenMessage(msg);
|
||||||
|
|
||||||
if (cpuSaveType == 0 && ovSaveType == 0 && t == IMAGE_GBA) {
|
if (coreOptions.cpuSaveType == 0 && ovSaveType == 0 && t == IMAGE_GBA) {
|
||||||
switch (bat.GetSize().GetValue()) {
|
switch (bat.GetSize().GetValue()) {
|
||||||
case 0x200:
|
case 0x200:
|
||||||
case 0x2000:
|
case 0x2000:
|
||||||
saveType = GBA_SAVE_EEPROM;
|
coreOptions.saveType = GBA_SAVE_EEPROM;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x8000:
|
case 0x8000:
|
||||||
saveType = GBA_SAVE_SRAM;
|
coreOptions.saveType = GBA_SAVE_SRAM;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x10000:
|
case 0x10000:
|
||||||
if (saveType == GBA_SAVE_EEPROM || saveType == GBA_SAVE_SRAM)
|
if (coreOptions.saveType == GBA_SAVE_EEPROM || coreOptions.saveType == GBA_SAVE_SRAM)
|
||||||
break;
|
break;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x20000:
|
case 0x20000:
|
||||||
saveType = GBA_SAVE_FLASH;
|
coreOptions.saveType = GBA_SAVE_FLASH;
|
||||||
flashSetSize(bat.GetSize().GetValue());
|
flashSetSize(bat.GetSize().GetValue());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ void GameArea::LoadGame(const wxString& name)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetSaveType(saveType);
|
SetSaveType(coreOptions.saveType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,9 +488,9 @@ void GameArea::LoadGame(const wxString& name)
|
||||||
// do a reset or load from state file when # rewinds == 0
|
// do a reset or load from state file when # rewinds == 0
|
||||||
do_rewind = gopts.rewind_interval > 0;
|
do_rewind = gopts.rewind_interval > 0;
|
||||||
// FIXME: backup battery file (useful if game name conflict)
|
// FIXME: backup battery file (useful if game name conflict)
|
||||||
cheats_dirty = (did_autoload && !skipSaveGameCheats) || (loaded == IMAGE_GB ? gbCheatNumber > 0 : cheatsNumber > 0);
|
cheats_dirty = (did_autoload && !coreOptions.skipSaveGameCheats) || (loaded == IMAGE_GB ? gbCheatNumber > 0 : cheatsNumber > 0);
|
||||||
|
|
||||||
if (gopts.autoload_cheats && (!did_autoload || skipSaveGameCheats)) {
|
if (gopts.autoload_cheats && (!did_autoload || coreOptions.skipSaveGameCheats)) {
|
||||||
wxFileName cfn = loaded_game;
|
wxFileName cfn = loaded_game;
|
||||||
// SetExt may strip something off by accident, so append to text instead
|
// SetExt may strip something off by accident, so append to text instead
|
||||||
cfn.SetFullName(cfn.GetFullName() + wxT(".clt"));
|
cfn.SetFullName(cfn.GetFullName() + wxT(".clt"));
|
||||||
|
|
|
@ -541,7 +541,7 @@ void XAudio2_Output::write(uint16_t* finalWave, int length)
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
// the maximum number of buffers is currently queued
|
// the maximum number of buffers is currently queued
|
||||||
if (!speedup && throttle && !gba_joybus_active) {
|
if (!coreOptions.speedup && throttle && !gba_joybus_active) {
|
||||||
// wait for one buffer to finish playing
|
// wait for one buffer to finish playing
|
||||||
if (WaitForSingleObject(notify.hBufferEndEvent, 10000) == WAIT_TIMEOUT) {
|
if (WaitForSingleObject(notify.hBufferEndEvent, 10000) == WAIT_TIMEOUT) {
|
||||||
device_changed = true;
|
device_changed = true;
|
||||||
|
|
Loading…
Reference in New Issue