GBA: Add constant for invalid idle loop address

This commit is contained in:
Jeffrey Pfau 2015-01-29 00:25:15 -08:00
parent eb4f33e23a
commit 9992282b1c
4 changed files with 60 additions and 58 deletions

View File

@ -12,102 +12,102 @@
static const struct GBACartridgeOverride _overrides[] = { static const struct GBACartridgeOverride _overrides[] = {
// Boktai: The Sun is in Your Hand // Boktai: The Sun is in Your Hand
{ "U3IJ", SAVEDATA_EEPROM, GPIO_RTC | GPIO_LIGHT_SENSOR, -1 }, { "U3IJ", SAVEDATA_EEPROM, GPIO_RTC | GPIO_LIGHT_SENSOR, IDLE_LOOP_NONE },
{ "U3IE", SAVEDATA_EEPROM, GPIO_RTC | GPIO_LIGHT_SENSOR, -1 }, { "U3IE", SAVEDATA_EEPROM, GPIO_RTC | GPIO_LIGHT_SENSOR, IDLE_LOOP_NONE },
{ "U3IP", SAVEDATA_EEPROM, GPIO_RTC | GPIO_LIGHT_SENSOR, -1 }, { "U3IP", SAVEDATA_EEPROM, GPIO_RTC | GPIO_LIGHT_SENSOR, IDLE_LOOP_NONE },
// Boktai 2: Solar Boy Django // Boktai 2: Solar Boy Django
{ "U32J", SAVEDATA_EEPROM, GPIO_RTC | GPIO_LIGHT_SENSOR, -1 }, { "U32J", SAVEDATA_EEPROM, GPIO_RTC | GPIO_LIGHT_SENSOR, IDLE_LOOP_NONE },
{ "U32E", SAVEDATA_EEPROM, GPIO_RTC | GPIO_LIGHT_SENSOR, -1 }, { "U32E", SAVEDATA_EEPROM, GPIO_RTC | GPIO_LIGHT_SENSOR, IDLE_LOOP_NONE },
{ "U32P", SAVEDATA_EEPROM, GPIO_RTC | GPIO_LIGHT_SENSOR, -1 }, { "U32P", SAVEDATA_EEPROM, GPIO_RTC | GPIO_LIGHT_SENSOR, IDLE_LOOP_NONE },
// Drill Dozer // Drill Dozer
{ "V49J", SAVEDATA_SRAM, GPIO_RUMBLE, -1 }, { "V49J", SAVEDATA_SRAM, GPIO_RUMBLE, IDLE_LOOP_NONE },
{ "V49E", SAVEDATA_SRAM, GPIO_RUMBLE, -1 }, { "V49E", SAVEDATA_SRAM, GPIO_RUMBLE, IDLE_LOOP_NONE },
// Final Fantasy Tactics Advance // Final Fantasy Tactics Advance
{ "AFXE", SAVEDATA_FLASH512, GPIO_NONE, 0x8000428 }, { "AFXE", SAVEDATA_FLASH512, GPIO_NONE, 0x8000428 },
// Koro Koro Puzzle - Happy Panechu! // Koro Koro Puzzle - Happy Panechu!
{ "KHPJ", SAVEDATA_EEPROM, GPIO_TILT, -1 }, { "KHPJ", SAVEDATA_EEPROM, GPIO_TILT, IDLE_LOOP_NONE },
// Mega Man Battle Network // Mega Man Battle Network
{ "AREE", SAVEDATA_SRAM, GPIO_NONE, 0x800032E }, { "AREE", SAVEDATA_SRAM, GPIO_NONE, 0x800032E },
// Pokemon Ruby // Pokemon Ruby
{ "AXVJ", SAVEDATA_FLASH1M, GPIO_RTC, -1 }, { "AXVJ", SAVEDATA_FLASH1M, GPIO_RTC, IDLE_LOOP_NONE },
{ "AXVE", SAVEDATA_FLASH1M, GPIO_RTC, -1 }, { "AXVE", SAVEDATA_FLASH1M, GPIO_RTC, IDLE_LOOP_NONE },
{ "AXVP", SAVEDATA_FLASH1M, GPIO_RTC, -1 }, { "AXVP", SAVEDATA_FLASH1M, GPIO_RTC, IDLE_LOOP_NONE },
{ "AXVI", SAVEDATA_FLASH1M, GPIO_RTC, -1 }, { "AXVI", SAVEDATA_FLASH1M, GPIO_RTC, IDLE_LOOP_NONE },
{ "AXVS", SAVEDATA_FLASH1M, GPIO_RTC, -1 }, { "AXVS", SAVEDATA_FLASH1M, GPIO_RTC, IDLE_LOOP_NONE },
{ "AXVD", SAVEDATA_FLASH1M, GPIO_RTC, -1 }, { "AXVD", SAVEDATA_FLASH1M, GPIO_RTC, IDLE_LOOP_NONE },
{ "AXVF", SAVEDATA_FLASH1M, GPIO_RTC, -1 }, { "AXVF", SAVEDATA_FLASH1M, GPIO_RTC, IDLE_LOOP_NONE },
// Pokemon Sapphire // Pokemon Sapphire
{ "AXPJ", SAVEDATA_FLASH1M, GPIO_RTC, -1 }, { "AXPJ", SAVEDATA_FLASH1M, GPIO_RTC, IDLE_LOOP_NONE },
{ "AXPE", SAVEDATA_FLASH1M, GPIO_RTC, -1 }, { "AXPE", SAVEDATA_FLASH1M, GPIO_RTC, IDLE_LOOP_NONE },
{ "AXPP", SAVEDATA_FLASH1M, GPIO_RTC, -1 }, { "AXPP", SAVEDATA_FLASH1M, GPIO_RTC, IDLE_LOOP_NONE },
{ "AXPI", SAVEDATA_FLASH1M, GPIO_RTC, -1 }, { "AXPI", SAVEDATA_FLASH1M, GPIO_RTC, IDLE_LOOP_NONE },
{ "AXPS", SAVEDATA_FLASH1M, GPIO_RTC, -1 }, { "AXPS", SAVEDATA_FLASH1M, GPIO_RTC, IDLE_LOOP_NONE },
{ "AXPD", SAVEDATA_FLASH1M, GPIO_RTC, -1 }, { "AXPD", SAVEDATA_FLASH1M, GPIO_RTC, IDLE_LOOP_NONE },
{ "AXPF", SAVEDATA_FLASH1M, GPIO_RTC, -1 }, { "AXPF", SAVEDATA_FLASH1M, GPIO_RTC, IDLE_LOOP_NONE },
// Pokemon Emerald // Pokemon Emerald
{ "BPEJ", SAVEDATA_FLASH1M, GPIO_RTC, -1 }, { "BPEJ", SAVEDATA_FLASH1M, GPIO_RTC, IDLE_LOOP_NONE },
{ "BPEE", SAVEDATA_FLASH1M, GPIO_RTC, -1 }, { "BPEE", SAVEDATA_FLASH1M, GPIO_RTC, IDLE_LOOP_NONE },
{ "BPEP", SAVEDATA_FLASH1M, GPIO_RTC, -1 }, { "BPEP", SAVEDATA_FLASH1M, GPIO_RTC, IDLE_LOOP_NONE },
{ "BPEI", SAVEDATA_FLASH1M, GPIO_RTC, -1 }, { "BPEI", SAVEDATA_FLASH1M, GPIO_RTC, IDLE_LOOP_NONE },
{ "BPES", SAVEDATA_FLASH1M, GPIO_RTC, -1 }, { "BPES", SAVEDATA_FLASH1M, GPIO_RTC, IDLE_LOOP_NONE },
{ "BPED", SAVEDATA_FLASH1M, GPIO_RTC, -1 }, { "BPED", SAVEDATA_FLASH1M, GPIO_RTC, IDLE_LOOP_NONE },
{ "BPEF", SAVEDATA_FLASH1M, GPIO_RTC, -1 }, { "BPEF", SAVEDATA_FLASH1M, GPIO_RTC, IDLE_LOOP_NONE },
// Pokemon Mystery Dungeon // Pokemon Mystery Dungeon
{ "B24J", SAVEDATA_FLASH1M, GPIO_NONE, -1 }, { "B24J", SAVEDATA_FLASH1M, GPIO_NONE, IDLE_LOOP_NONE },
{ "B24E", SAVEDATA_FLASH1M, GPIO_NONE, -1 }, { "B24E", SAVEDATA_FLASH1M, GPIO_NONE, IDLE_LOOP_NONE },
{ "B24P", SAVEDATA_FLASH1M, GPIO_NONE, -1 }, { "B24P", SAVEDATA_FLASH1M, GPIO_NONE, IDLE_LOOP_NONE },
{ "B24U", SAVEDATA_FLASH1M, GPIO_NONE, -1 }, { "B24U", SAVEDATA_FLASH1M, GPIO_NONE, IDLE_LOOP_NONE },
// Pokemon FireRed // Pokemon FireRed
{ "BPRJ", SAVEDATA_FLASH1M, GPIO_NONE, -1 }, { "BPRJ", SAVEDATA_FLASH1M, GPIO_NONE, IDLE_LOOP_NONE },
{ "BPRE", SAVEDATA_FLASH1M, GPIO_NONE, -1 }, { "BPRE", SAVEDATA_FLASH1M, GPIO_NONE, IDLE_LOOP_NONE },
{ "BPRP", SAVEDATA_FLASH1M, GPIO_NONE, -1 }, { "BPRP", SAVEDATA_FLASH1M, GPIO_NONE, IDLE_LOOP_NONE },
// Pokemon LeafGreen // Pokemon LeafGreen
{ "BPGJ", SAVEDATA_FLASH1M, GPIO_NONE, -1 }, { "BPGJ", SAVEDATA_FLASH1M, GPIO_NONE, IDLE_LOOP_NONE },
{ "BPGE", SAVEDATA_FLASH1M, GPIO_NONE, -1 }, { "BPGE", SAVEDATA_FLASH1M, GPIO_NONE, IDLE_LOOP_NONE },
{ "BPGP", SAVEDATA_FLASH1M, GPIO_NONE, -1 }, { "BPGP", SAVEDATA_FLASH1M, GPIO_NONE, IDLE_LOOP_NONE },
// RockMan EXE 4.5 - Real Operation // RockMan EXE 4.5 - Real Operation
{ "BR4J", SAVEDATA_FLASH512, GPIO_RTC, -1 }, { "BR4J", SAVEDATA_FLASH512, GPIO_RTC, IDLE_LOOP_NONE },
// Shin Bokura no Taiyou: Gyakushuu no Sabata // Shin Bokura no Taiyou: Gyakushuu no Sabata
{ "U33J", SAVEDATA_EEPROM, GPIO_RTC | GPIO_LIGHT_SENSOR, -1 }, { "U33J", SAVEDATA_EEPROM, GPIO_RTC | GPIO_LIGHT_SENSOR, IDLE_LOOP_NONE },
// Super Mario Advance 4 // Super Mario Advance 4
{ "AX4J", SAVEDATA_FLASH1M, GPIO_NONE, -1 }, { "AX4J", SAVEDATA_FLASH1M, GPIO_NONE, IDLE_LOOP_NONE },
{ "AX4E", SAVEDATA_FLASH1M, GPIO_NONE, -1 }, { "AX4E", SAVEDATA_FLASH1M, GPIO_NONE, IDLE_LOOP_NONE },
{ "AX4P", SAVEDATA_FLASH1M, GPIO_NONE, -1 }, { "AX4P", SAVEDATA_FLASH1M, GPIO_NONE, IDLE_LOOP_NONE },
// Top Gun - Combat Zones // Top Gun - Combat Zones
{ "A2YE", SAVEDATA_FORCE_NONE, GPIO_NONE, -1 }, { "A2YE", SAVEDATA_FORCE_NONE, GPIO_NONE, IDLE_LOOP_NONE },
// Wario Ware Twisted // Wario Ware Twisted
{ "RZWJ", SAVEDATA_SRAM, GPIO_RUMBLE | GPIO_GYRO, -1 }, { "RZWJ", SAVEDATA_SRAM, GPIO_RUMBLE | GPIO_GYRO, IDLE_LOOP_NONE },
{ "RZWE", SAVEDATA_SRAM, GPIO_RUMBLE | GPIO_GYRO, -1 }, { "RZWE", SAVEDATA_SRAM, GPIO_RUMBLE | GPIO_GYRO, IDLE_LOOP_NONE },
{ "RZWP", SAVEDATA_SRAM, GPIO_RUMBLE | GPIO_GYRO, -1 }, { "RZWP", SAVEDATA_SRAM, GPIO_RUMBLE | GPIO_GYRO, IDLE_LOOP_NONE },
// Yoshi's Universal Gravitation // Yoshi's Universal Gravitation
{ "KYGJ", SAVEDATA_EEPROM, GPIO_TILT, -1 }, { "KYGJ", SAVEDATA_EEPROM, GPIO_TILT, IDLE_LOOP_NONE },
{ "KYGE", SAVEDATA_EEPROM, GPIO_TILT, -1 }, { "KYGE", SAVEDATA_EEPROM, GPIO_TILT, IDLE_LOOP_NONE },
{ "KYGP", SAVEDATA_EEPROM, GPIO_TILT, -1 }, { "KYGP", SAVEDATA_EEPROM, GPIO_TILT, IDLE_LOOP_NONE },
{ { 0, 0, 0, 0 }, 0, 0, -1 } { { 0, 0, 0, 0 }, 0, 0, IDLE_LOOP_NONE }
}; };
bool GBAOverrideFind(const struct Configuration* config, struct GBACartridgeOverride* override) { bool GBAOverrideFind(const struct Configuration* config, struct GBACartridgeOverride* override) {
override->savetype = SAVEDATA_AUTODETECT; override->savetype = SAVEDATA_AUTODETECT;
override->hardware = GPIO_NONE; override->hardware = GPIO_NONE;
override->idleLoop = -1; override->idleLoop = IDLE_LOOP_NONE;
bool found; bool found;
if (override->id[0] == 'F') { if (override->id[0] == 'F') {
@ -203,7 +203,7 @@ void GBAOverrideSave(struct Configuration* config, const struct GBACartridgeOver
ConfigurationClearValue(config, sectionName, "hardware"); ConfigurationClearValue(config, sectionName, "hardware");
} }
if (override->idleLoop != 0xFFFFFFFF) { if (override->idleLoop != IDLE_LOOP_NONE) {
ConfigurationSetUIntValue(config, sectionName, "idleLoop", override->idleLoop); ConfigurationSetUIntValue(config, sectionName, "idleLoop", override->idleLoop);
} else { } else {
ConfigurationClearValue(config, sectionName, "idleLoop"); ConfigurationClearValue(config, sectionName, "idleLoop");
@ -239,7 +239,7 @@ void GBAOverrideApply(struct GBA* gba, const struct GBACartridgeOverride* overri
} }
} }
if (override->idleLoop != 0xFFFFFFFF) { if (override->idleLoop != IDLE_LOOP_NONE) {
gba->idleLoop = override->idleLoop; gba->idleLoop = override->idleLoop;
if (gba->idleOptimization == IDLE_LOOP_DETECT) { if (gba->idleOptimization == IDLE_LOOP_DETECT) {
gba->idleOptimization = IDLE_LOOP_REMOVE; gba->idleOptimization = IDLE_LOOP_REMOVE;

View File

@ -10,6 +10,8 @@
#include "gba-savedata.h" #include "gba-savedata.h"
#define IDLE_LOOP_NONE 0xFFFFFFFF
struct GBACartridgeOverride { struct GBACartridgeOverride {
char id[4]; char id[4];
enum SavedataType savetype; enum SavedataType savetype;

View File

@ -77,7 +77,7 @@ static void GBAInit(struct ARMCore* cpu, struct ARMComponent* component) {
gba->biosChecksum = GBAChecksum(gba->memory.bios, SIZE_BIOS); gba->biosChecksum = GBAChecksum(gba->memory.bios, SIZE_BIOS);
gba->idleOptimization = IDLE_LOOP_REMOVE; gba->idleOptimization = IDLE_LOOP_REMOVE;
gba->idleLoop = -1; gba->idleLoop = IDLE_LOOP_NONE;
gba->lastJump = 0; gba->lastJump = 0;
gba->idleDetectionStep = 0; gba->idleDetectionStep = 0;
gba->idleDetectionFailures = 0; gba->idleDetectionFailures = 0;

View File

@ -59,7 +59,7 @@ void GamePakView::updateOverrides() {
"", "",
static_cast<SavedataType>(m_ui.savetype->currentIndex() - 1), static_cast<SavedataType>(m_ui.savetype->currentIndex() - 1),
GPIO_NO_OVERRIDE, GPIO_NO_OVERRIDE,
0xFFFFFFFF IDLE_LOOP_NONE
}; };
if (!m_ui.hwAutodetect->isChecked()) { if (!m_ui.hwAutodetect->isChecked()) {