GB, GBA: Move override structs to public API

This commit is contained in:
Vicki Pfau 2024-03-24 23:03:59 -07:00
parent ea5339304a
commit e48acb6b97
8 changed files with 133 additions and 132 deletions

View File

@ -58,6 +58,13 @@ enum GBVideoLayer {
GB_LAYER_OBJ GB_LAYER_OBJ
}; };
enum GBColorLookup {
GB_COLORS_NONE = 0,
GB_COLORS_CGB = 1,
GB_COLORS_SGB = 2,
GB_COLORS_SGB_CGB_FALLBACK = GB_COLORS_CGB | GB_COLORS_SGB
};
struct GBSIODriver { struct GBSIODriver {
struct GBSIO* p; struct GBSIO* p;
@ -67,6 +74,14 @@ struct GBSIODriver {
uint8_t (*writeSC)(struct GBSIODriver* driver, uint8_t value); uint8_t (*writeSC)(struct GBSIODriver* driver, uint8_t value);
}; };
struct GBCartridgeOverride {
int headerCrc32;
enum GBModel model;
enum GBMemoryBankControllerType mbc;
uint32_t gbColors[12];
};
struct VFile; struct VFile;
bool GBIsROM(struct VFile* vf); bool GBIsROM(struct VFile* vf);

View File

@ -13,6 +13,8 @@ CXX_GUARD_START
#include <mgba/core/interface.h> #include <mgba/core/interface.h>
#include <mgba/core/timing.h> #include <mgba/core/timing.h>
#define GBA_IDLE_LOOP_NONE 0xFFFFFFFF
enum { enum {
GBA_VIDEO_HORIZONTAL_PIXELS = 240, GBA_VIDEO_HORIZONTAL_PIXELS = 240,
GBA_VIDEO_VERTICAL_PIXELS = 160, GBA_VIDEO_VERTICAL_PIXELS = 160,
@ -45,6 +47,17 @@ enum GBAVideoLayer {
GBA_LAYER_OBJWIN, GBA_LAYER_OBJWIN,
}; };
enum GBASavedataType {
GBA_SAVEDATA_AUTODETECT = -1,
GBA_SAVEDATA_FORCE_NONE = 0,
GBA_SAVEDATA_SRAM = 1,
GBA_SAVEDATA_FLASH512 = 2,
GBA_SAVEDATA_FLASH1M = 3,
GBA_SAVEDATA_EEPROM = 4,
GBA_SAVEDATA_EEPROM512 = 5,
GBA_SAVEDATA_SRAM512 = 6,
};
struct GBA; struct GBA;
struct GBAAudio; struct GBAAudio;
struct GBASIO; struct GBASIO;
@ -78,6 +91,15 @@ struct GBASIODriver {
uint16_t (*writeRegister)(struct GBASIODriver* driver, uint32_t address, uint16_t value); uint16_t (*writeRegister)(struct GBASIODriver* driver, uint32_t address, uint16_t value);
}; };
struct GBACartridgeOverride {
char id[4];
enum GBASavedataType savetype;
int hardware;
uint32_t idleLoop;
bool mirroring;
bool vbaBugCompat;
};
void GBASIOJOYCreate(struct GBASIODriver* sio); void GBASIOJOYCreate(struct GBASIODriver* sio);
enum GBASIOBattleChipGateFlavor { enum GBASIOBattleChipGateFlavor {

View File

@ -12,21 +12,6 @@ CXX_GUARD_START
#include <mgba/gb/interface.h> #include <mgba/gb/interface.h>
enum GBColorLookup {
GB_COLORS_NONE = 0,
GB_COLORS_CGB = 1,
GB_COLORS_SGB = 2,
GB_COLORS_SGB_CGB_FALLBACK = GB_COLORS_CGB | GB_COLORS_SGB
};
struct GBCartridgeOverride {
int headerCrc32;
enum GBModel model;
enum GBMemoryBankControllerType mbc;
uint32_t gbColors[12];
};
struct GBColorPreset { struct GBColorPreset {
const char* name; const char* name;
uint32_t colors[12]; uint32_t colors[12];

View File

@ -10,18 +10,7 @@
CXX_GUARD_START CXX_GUARD_START
#include <mgba/internal/gba/savedata.h> #include <mgba/gba/interface.h>
#define IDLE_LOOP_NONE 0xFFFFFFFF
struct GBACartridgeOverride {
char id[4];
enum GBASavedataType savetype;
int hardware;
uint32_t idleLoop;
bool mirroring;
bool vbaBugCompat;
};
struct Configuration; struct Configuration;
bool GBAOverrideFind(const struct Configuration*, struct GBACartridgeOverride* override); bool GBAOverrideFind(const struct Configuration*, struct GBACartridgeOverride* override);

View File

@ -12,22 +12,12 @@ CXX_GUARD_START
#include <mgba/core/log.h> #include <mgba/core/log.h>
#include <mgba/core/timing.h> #include <mgba/core/timing.h>
#include <mgba/gba/interface.h>
mLOG_DECLARE_CATEGORY(GBA_SAVE); mLOG_DECLARE_CATEGORY(GBA_SAVE);
struct VFile; struct VFile;
enum GBASavedataType {
GBA_SAVEDATA_AUTODETECT = -1,
GBA_SAVEDATA_FORCE_NONE = 0,
GBA_SAVEDATA_SRAM = 1,
GBA_SAVEDATA_FLASH512 = 2,
GBA_SAVEDATA_FLASH1M = 3,
GBA_SAVEDATA_EEPROM = 4,
GBA_SAVEDATA_EEPROM512 = 5,
GBA_SAVEDATA_SRAM512 = 6,
};
enum SavedataCommand { enum SavedataCommand {
EEPROM_COMMAND_NULL = 0, EEPROM_COMMAND_NULL = 0,
EEPROM_COMMAND_PENDING = 1, EEPROM_COMMAND_PENDING = 1,

View File

@ -374,7 +374,7 @@ static void _GBACoreLoadConfig(struct mCore* core, const struct mCoreConfig* con
} else if (strcasecmp(idleOptimization, "remove") == 0) { } else if (strcasecmp(idleOptimization, "remove") == 0) {
gba->idleOptimization = IDLE_LOOP_REMOVE; gba->idleOptimization = IDLE_LOOP_REMOVE;
} else if (strcasecmp(idleOptimization, "detect") == 0) { } else if (strcasecmp(idleOptimization, "detect") == 0) {
if (gba->idleLoop == IDLE_LOOP_NONE) { if (gba->idleLoop == GBA_IDLE_LOOP_NONE) {
gba->idleOptimization = IDLE_LOOP_DETECT; gba->idleOptimization = IDLE_LOOP_DETECT;
} else { } else {
gba->idleOptimization = IDLE_LOOP_REMOVE; gba->idleOptimization = IDLE_LOOP_REMOVE;

View File

@ -21,73 +21,73 @@ static const struct GBACartridgeOverride _overrides[] = {
{ "AW2P", GBA_SAVEDATA_FLASH512, HW_NONE, 0x803719C, false }, { "AW2P", GBA_SAVEDATA_FLASH512, HW_NONE, 0x803719C, false },
// Boktai: The Sun is in Your Hand // Boktai: The Sun is in Your Hand
{ "U3IJ", GBA_SAVEDATA_EEPROM, HW_RTC | HW_LIGHT_SENSOR, IDLE_LOOP_NONE, false }, { "U3IJ", GBA_SAVEDATA_EEPROM, HW_RTC | HW_LIGHT_SENSOR, GBA_IDLE_LOOP_NONE, false },
{ "U3IE", GBA_SAVEDATA_EEPROM, HW_RTC | HW_LIGHT_SENSOR, IDLE_LOOP_NONE, false }, { "U3IE", GBA_SAVEDATA_EEPROM, HW_RTC | HW_LIGHT_SENSOR, GBA_IDLE_LOOP_NONE, false },
{ "U3IP", GBA_SAVEDATA_EEPROM, HW_RTC | HW_LIGHT_SENSOR, IDLE_LOOP_NONE, false }, { "U3IP", GBA_SAVEDATA_EEPROM, HW_RTC | HW_LIGHT_SENSOR, GBA_IDLE_LOOP_NONE, false },
// Boktai 2: Solar Boy Django // Boktai 2: Solar Boy Django
{ "U32J", GBA_SAVEDATA_EEPROM, HW_RTC | HW_LIGHT_SENSOR, IDLE_LOOP_NONE, false }, { "U32J", GBA_SAVEDATA_EEPROM, HW_RTC | HW_LIGHT_SENSOR, GBA_IDLE_LOOP_NONE, false },
{ "U32E", GBA_SAVEDATA_EEPROM, HW_RTC | HW_LIGHT_SENSOR, IDLE_LOOP_NONE, false }, { "U32E", GBA_SAVEDATA_EEPROM, HW_RTC | HW_LIGHT_SENSOR, GBA_IDLE_LOOP_NONE, false },
{ "U32P", GBA_SAVEDATA_EEPROM, HW_RTC | HW_LIGHT_SENSOR, IDLE_LOOP_NONE, false }, { "U32P", GBA_SAVEDATA_EEPROM, HW_RTC | HW_LIGHT_SENSOR, GBA_IDLE_LOOP_NONE, false },
// Crash Bandicoot 2 - N-Tranced // Crash Bandicoot 2 - N-Tranced
{ "AC8J", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "AC8J", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "AC8E", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "AC8E", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "AC8P", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "AC8P", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
// DigiCommunication Nyo - Datou! Black Gemagema Dan // DigiCommunication Nyo - Datou! Black Gemagema Dan
{ "BDKJ", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "BDKJ", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
// Dragon Ball Z - The Legacy of Goku // Dragon Ball Z - The Legacy of Goku
{ "ALGP", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "ALGP", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
// Dragon Ball Z - The Legacy of Goku II // Dragon Ball Z - The Legacy of Goku II
{ "ALFJ", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "ALFJ", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "ALFE", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "ALFE", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "ALFP", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "ALFP", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
// Dragon Ball Z - Taiketsu // Dragon Ball Z - Taiketsu
{ "BDBE", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "BDBE", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "BDBP", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "BDBP", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
// Drill Dozer // Drill Dozer
{ "V49J", GBA_SAVEDATA_SRAM, HW_RUMBLE, IDLE_LOOP_NONE, false }, { "V49J", GBA_SAVEDATA_SRAM, HW_RUMBLE, GBA_IDLE_LOOP_NONE, false },
{ "V49E", GBA_SAVEDATA_SRAM, HW_RUMBLE, IDLE_LOOP_NONE, false }, { "V49E", GBA_SAVEDATA_SRAM, HW_RUMBLE, GBA_IDLE_LOOP_NONE, false },
{ "V49P", GBA_SAVEDATA_SRAM, HW_RUMBLE, IDLE_LOOP_NONE, false }, { "V49P", GBA_SAVEDATA_SRAM, HW_RUMBLE, GBA_IDLE_LOOP_NONE, false },
// e-Reader // e-Reader
{ "PEAJ", GBA_SAVEDATA_FLASH1M, HW_EREADER, IDLE_LOOP_NONE }, { "PEAJ", GBA_SAVEDATA_FLASH1M, HW_EREADER, GBA_IDLE_LOOP_NONE },
{ "PSAJ", GBA_SAVEDATA_FLASH1M, HW_EREADER, IDLE_LOOP_NONE }, { "PSAJ", GBA_SAVEDATA_FLASH1M, HW_EREADER, GBA_IDLE_LOOP_NONE },
{ "PSAE", GBA_SAVEDATA_FLASH1M, HW_EREADER, IDLE_LOOP_NONE }, { "PSAE", GBA_SAVEDATA_FLASH1M, HW_EREADER, GBA_IDLE_LOOP_NONE },
// Final Fantasy Tactics Advance // Final Fantasy Tactics Advance
{ "AFXE", GBA_SAVEDATA_FLASH512, HW_NONE, 0x8000428, false }, { "AFXE", GBA_SAVEDATA_FLASH512, HW_NONE, 0x8000428, false },
// F-Zero - Climax // F-Zero - Climax
{ "BFTJ", GBA_SAVEDATA_FLASH1M, HW_NONE, IDLE_LOOP_NONE, false }, { "BFTJ", GBA_SAVEDATA_FLASH1M, HW_NONE, GBA_IDLE_LOOP_NONE, false },
// Goodboy Galaxy // Goodboy Galaxy
{ "2GBP", GBA_SAVEDATA_SRAM, HW_RUMBLE, IDLE_LOOP_NONE, false }, { "2GBP", GBA_SAVEDATA_SRAM, HW_RUMBLE, GBA_IDLE_LOOP_NONE, false },
// Iridion II // Iridion II
{ "AI2E", GBA_SAVEDATA_FORCE_NONE, HW_NONE, IDLE_LOOP_NONE, false }, { "AI2E", GBA_SAVEDATA_FORCE_NONE, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "AI2P", GBA_SAVEDATA_FORCE_NONE, HW_NONE, IDLE_LOOP_NONE, false }, { "AI2P", GBA_SAVEDATA_FORCE_NONE, HW_NONE, GBA_IDLE_LOOP_NONE, false },
// Game Boy Wars Advance 1+2 // Game Boy Wars Advance 1+2
{ "BGWJ", GBA_SAVEDATA_FLASH1M, HW_NONE, IDLE_LOOP_NONE, false }, { "BGWJ", GBA_SAVEDATA_FLASH1M, HW_NONE, GBA_IDLE_LOOP_NONE, false },
// Golden Sun: The Lost Age // Golden Sun: The Lost Age
{ "AGFE", GBA_SAVEDATA_FLASH512, HW_NONE, 0x801353A, false }, { "AGFE", GBA_SAVEDATA_FLASH512, HW_NONE, 0x801353A, false },
// Koro Koro Puzzle - Happy Panechu! // Koro Koro Puzzle - Happy Panechu!
{ "KHPJ", GBA_SAVEDATA_EEPROM, HW_TILT, IDLE_LOOP_NONE, false }, { "KHPJ", GBA_SAVEDATA_EEPROM, HW_TILT, GBA_IDLE_LOOP_NONE, false },
// Legendz - Yomigaeru Shiren no Shima // Legendz - Yomigaeru Shiren no Shima
{ "BLJJ", GBA_SAVEDATA_FLASH512, HW_RTC, IDLE_LOOP_NONE, false }, { "BLJJ", GBA_SAVEDATA_FLASH512, HW_RTC, GBA_IDLE_LOOP_NONE, false },
{ "BLJK", GBA_SAVEDATA_FLASH512, HW_RTC, IDLE_LOOP_NONE, false }, { "BLJK", GBA_SAVEDATA_FLASH512, HW_RTC, GBA_IDLE_LOOP_NONE, false },
// Legendz - Sign of Nekuromu // Legendz - Sign of Nekuromu
{ "BLVJ", GBA_SAVEDATA_FLASH512, HW_RTC, IDLE_LOOP_NONE, false }, { "BLVJ", GBA_SAVEDATA_FLASH512, HW_RTC, GBA_IDLE_LOOP_NONE, false },
// Mega Man Battle Network // Mega Man Battle Network
{ "AREE", GBA_SAVEDATA_SRAM, HW_NONE, 0x800032E, false }, { "AREE", GBA_SAVEDATA_SRAM, HW_NONE, 0x800032E, false },
@ -99,22 +99,22 @@ static const struct GBACartridgeOverride _overrides[] = {
{ "BSME", GBA_SAVEDATA_EEPROM, HW_NONE, 0x8000290, false }, { "BSME", GBA_SAVEDATA_EEPROM, HW_NONE, 0x8000290, false },
// Pokemon Ruby // Pokemon Ruby
{ "AXVJ", GBA_SAVEDATA_FLASH1M, HW_RTC, IDLE_LOOP_NONE, false }, { "AXVJ", GBA_SAVEDATA_FLASH1M, HW_RTC, GBA_IDLE_LOOP_NONE, false },
{ "AXVE", GBA_SAVEDATA_FLASH1M, HW_RTC, IDLE_LOOP_NONE, false }, { "AXVE", GBA_SAVEDATA_FLASH1M, HW_RTC, GBA_IDLE_LOOP_NONE, false },
{ "AXVP", GBA_SAVEDATA_FLASH1M, HW_RTC, IDLE_LOOP_NONE, false }, { "AXVP", GBA_SAVEDATA_FLASH1M, HW_RTC, GBA_IDLE_LOOP_NONE, false },
{ "AXVI", GBA_SAVEDATA_FLASH1M, HW_RTC, IDLE_LOOP_NONE, false }, { "AXVI", GBA_SAVEDATA_FLASH1M, HW_RTC, GBA_IDLE_LOOP_NONE, false },
{ "AXVS", GBA_SAVEDATA_FLASH1M, HW_RTC, IDLE_LOOP_NONE, false }, { "AXVS", GBA_SAVEDATA_FLASH1M, HW_RTC, GBA_IDLE_LOOP_NONE, false },
{ "AXVD", GBA_SAVEDATA_FLASH1M, HW_RTC, IDLE_LOOP_NONE, false }, { "AXVD", GBA_SAVEDATA_FLASH1M, HW_RTC, GBA_IDLE_LOOP_NONE, false },
{ "AXVF", GBA_SAVEDATA_FLASH1M, HW_RTC, IDLE_LOOP_NONE, false }, { "AXVF", GBA_SAVEDATA_FLASH1M, HW_RTC, GBA_IDLE_LOOP_NONE, false },
// Pokemon Sapphire // Pokemon Sapphire
{ "AXPJ", GBA_SAVEDATA_FLASH1M, HW_RTC, IDLE_LOOP_NONE, false }, { "AXPJ", GBA_SAVEDATA_FLASH1M, HW_RTC, GBA_IDLE_LOOP_NONE, false },
{ "AXPE", GBA_SAVEDATA_FLASH1M, HW_RTC, IDLE_LOOP_NONE, false }, { "AXPE", GBA_SAVEDATA_FLASH1M, HW_RTC, GBA_IDLE_LOOP_NONE, false },
{ "AXPP", GBA_SAVEDATA_FLASH1M, HW_RTC, IDLE_LOOP_NONE, false }, { "AXPP", GBA_SAVEDATA_FLASH1M, HW_RTC, GBA_IDLE_LOOP_NONE, false },
{ "AXPI", GBA_SAVEDATA_FLASH1M, HW_RTC, IDLE_LOOP_NONE, false }, { "AXPI", GBA_SAVEDATA_FLASH1M, HW_RTC, GBA_IDLE_LOOP_NONE, false },
{ "AXPS", GBA_SAVEDATA_FLASH1M, HW_RTC, IDLE_LOOP_NONE, false }, { "AXPS", GBA_SAVEDATA_FLASH1M, HW_RTC, GBA_IDLE_LOOP_NONE, false },
{ "AXPD", GBA_SAVEDATA_FLASH1M, HW_RTC, IDLE_LOOP_NONE, false }, { "AXPD", GBA_SAVEDATA_FLASH1M, HW_RTC, GBA_IDLE_LOOP_NONE, false },
{ "AXPF", GBA_SAVEDATA_FLASH1M, HW_RTC, IDLE_LOOP_NONE, false }, { "AXPF", GBA_SAVEDATA_FLASH1M, HW_RTC, GBA_IDLE_LOOP_NONE, false },
// Pokemon Emerald // Pokemon Emerald
{ "BPEJ", GBA_SAVEDATA_FLASH1M, HW_RTC, 0x80008C6, false }, { "BPEJ", GBA_SAVEDATA_FLASH1M, HW_RTC, 0x80008C6, false },
@ -126,43 +126,43 @@ static const struct GBACartridgeOverride _overrides[] = {
{ "BPEF", GBA_SAVEDATA_FLASH1M, HW_RTC, 0x80008C6, false }, { "BPEF", GBA_SAVEDATA_FLASH1M, HW_RTC, 0x80008C6, false },
// Pokemon Mystery Dungeon // Pokemon Mystery Dungeon
{ "B24E", GBA_SAVEDATA_FLASH1M, HW_NONE, IDLE_LOOP_NONE, false }, { "B24E", GBA_SAVEDATA_FLASH1M, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "B24P", GBA_SAVEDATA_FLASH1M, HW_NONE, IDLE_LOOP_NONE, false }, { "B24P", GBA_SAVEDATA_FLASH1M, HW_NONE, GBA_IDLE_LOOP_NONE, false },
// Pokemon FireRed // Pokemon FireRed
{ "BPRJ", GBA_SAVEDATA_FLASH1M, HW_NONE, IDLE_LOOP_NONE, false }, { "BPRJ", GBA_SAVEDATA_FLASH1M, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "BPRE", GBA_SAVEDATA_FLASH1M, HW_NONE, IDLE_LOOP_NONE, false }, { "BPRE", GBA_SAVEDATA_FLASH1M, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "BPRP", GBA_SAVEDATA_FLASH1M, HW_NONE, IDLE_LOOP_NONE, false }, { "BPRP", GBA_SAVEDATA_FLASH1M, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "BPRI", GBA_SAVEDATA_FLASH1M, HW_NONE, IDLE_LOOP_NONE, false }, { "BPRI", GBA_SAVEDATA_FLASH1M, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "BPRS", GBA_SAVEDATA_FLASH1M, HW_NONE, IDLE_LOOP_NONE, false }, { "BPRS", GBA_SAVEDATA_FLASH1M, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "BPRD", GBA_SAVEDATA_FLASH1M, HW_NONE, IDLE_LOOP_NONE, false }, { "BPRD", GBA_SAVEDATA_FLASH1M, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "BPRF", GBA_SAVEDATA_FLASH1M, HW_NONE, IDLE_LOOP_NONE, false }, { "BPRF", GBA_SAVEDATA_FLASH1M, HW_NONE, GBA_IDLE_LOOP_NONE, false },
// Pokemon LeafGreen // Pokemon LeafGreen
{ "BPGJ", GBA_SAVEDATA_FLASH1M, HW_NONE, IDLE_LOOP_NONE, false }, { "BPGJ", GBA_SAVEDATA_FLASH1M, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "BPGE", GBA_SAVEDATA_FLASH1M, HW_NONE, IDLE_LOOP_NONE, false }, { "BPGE", GBA_SAVEDATA_FLASH1M, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "BPGP", GBA_SAVEDATA_FLASH1M, HW_NONE, IDLE_LOOP_NONE, false }, { "BPGP", GBA_SAVEDATA_FLASH1M, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "BPGI", GBA_SAVEDATA_FLASH1M, HW_NONE, IDLE_LOOP_NONE, false }, { "BPGI", GBA_SAVEDATA_FLASH1M, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "BPGS", GBA_SAVEDATA_FLASH1M, HW_NONE, IDLE_LOOP_NONE, false }, { "BPGS", GBA_SAVEDATA_FLASH1M, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "BPGD", GBA_SAVEDATA_FLASH1M, HW_NONE, IDLE_LOOP_NONE, false }, { "BPGD", GBA_SAVEDATA_FLASH1M, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "BPGF", GBA_SAVEDATA_FLASH1M, HW_NONE, IDLE_LOOP_NONE, false }, { "BPGF", GBA_SAVEDATA_FLASH1M, HW_NONE, GBA_IDLE_LOOP_NONE, false },
// RockMan EXE 4.5 - Real Operation // RockMan EXE 4.5 - Real Operation
{ "BR4J", GBA_SAVEDATA_FLASH512, HW_RTC, IDLE_LOOP_NONE, false }, { "BR4J", GBA_SAVEDATA_FLASH512, HW_RTC, GBA_IDLE_LOOP_NONE, false },
// Rocky // Rocky
{ "AR8E", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "AR8E", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "AROP", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "AROP", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
// Sennen Kazoku // Sennen Kazoku
{ "BKAJ", GBA_SAVEDATA_FLASH1M, HW_RTC, IDLE_LOOP_NONE, false }, { "BKAJ", GBA_SAVEDATA_FLASH1M, HW_RTC, GBA_IDLE_LOOP_NONE, false },
// Shin Bokura no Taiyou: Gyakushuu no Sabata // Shin Bokura no Taiyou: Gyakushuu no Sabata
{ "U33J", GBA_SAVEDATA_EEPROM, HW_RTC | HW_LIGHT_SENSOR, IDLE_LOOP_NONE, false }, { "U33J", GBA_SAVEDATA_EEPROM, HW_RTC | HW_LIGHT_SENSOR, GBA_IDLE_LOOP_NONE, false },
// Stuart Little 2 // Stuart Little 2
{ "ASLE", GBA_SAVEDATA_FORCE_NONE, HW_NONE, IDLE_LOOP_NONE, false }, { "ASLE", GBA_SAVEDATA_FORCE_NONE, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "ASLF", GBA_SAVEDATA_FORCE_NONE, HW_NONE, IDLE_LOOP_NONE, false }, { "ASLF", GBA_SAVEDATA_FORCE_NONE, HW_NONE, GBA_IDLE_LOOP_NONE, false },
// Super Mario Advance 2 // Super Mario Advance 2
{ "AA2J", GBA_SAVEDATA_EEPROM, HW_NONE, 0x800052E, false }, { "AA2J", GBA_SAVEDATA_EEPROM, HW_NONE, 0x800052E, false },
@ -180,45 +180,45 @@ static const struct GBACartridgeOverride _overrides[] = {
{ "AX4P", GBA_SAVEDATA_FLASH1M, HW_NONE, 0x800072A, false }, { "AX4P", GBA_SAVEDATA_FLASH1M, HW_NONE, 0x800072A, false },
// Super Monkey Ball Jr. // Super Monkey Ball Jr.
{ "ALUE", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "ALUE", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "ALUP", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "ALUP", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
// Top Gun - Combat Zones // Top Gun - Combat Zones
{ "A2YE", GBA_SAVEDATA_FORCE_NONE, HW_NONE, IDLE_LOOP_NONE, false }, { "A2YE", GBA_SAVEDATA_FORCE_NONE, HW_NONE, GBA_IDLE_LOOP_NONE, false },
// Ueki no Housoku - Jingi Sakuretsu! Nouryokusha Battle // Ueki no Housoku - Jingi Sakuretsu! Nouryokusha Battle
{ "BUHJ", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "BUHJ", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
// Wario Ware Twisted // Wario Ware Twisted
{ "RZWJ", GBA_SAVEDATA_SRAM, HW_RUMBLE | HW_GYRO, IDLE_LOOP_NONE, false }, { "RZWJ", GBA_SAVEDATA_SRAM, HW_RUMBLE | HW_GYRO, GBA_IDLE_LOOP_NONE, false },
{ "RZWE", GBA_SAVEDATA_SRAM, HW_RUMBLE | HW_GYRO, IDLE_LOOP_NONE, false }, { "RZWE", GBA_SAVEDATA_SRAM, HW_RUMBLE | HW_GYRO, GBA_IDLE_LOOP_NONE, false },
{ "RZWP", GBA_SAVEDATA_SRAM, HW_RUMBLE | HW_GYRO, IDLE_LOOP_NONE, false }, { "RZWP", GBA_SAVEDATA_SRAM, HW_RUMBLE | HW_GYRO, GBA_IDLE_LOOP_NONE, false },
// Yoshi's Universal Gravitation // Yoshi's Universal Gravitation
{ "KYGJ", GBA_SAVEDATA_EEPROM, HW_TILT, IDLE_LOOP_NONE, false }, { "KYGJ", GBA_SAVEDATA_EEPROM, HW_TILT, GBA_IDLE_LOOP_NONE, false },
{ "KYGE", GBA_SAVEDATA_EEPROM, HW_TILT, IDLE_LOOP_NONE, false }, { "KYGE", GBA_SAVEDATA_EEPROM, HW_TILT, GBA_IDLE_LOOP_NONE, false },
{ "KYGP", GBA_SAVEDATA_EEPROM, HW_TILT, IDLE_LOOP_NONE, false }, { "KYGP", GBA_SAVEDATA_EEPROM, HW_TILT, GBA_IDLE_LOOP_NONE, false },
// Aging cartridge // Aging cartridge
{ "TCHK", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "TCHK", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
// Famicom Mini series 3 (FDS), some aren't mirrored (22 - 28) // Famicom Mini series 3 (FDS), some aren't mirrored (22 - 28)
// See https://forum.no-intro.org/viewtopic.php?f=2&t=4221 for discussion // See https://forum.no-intro.org/viewtopic.php?f=2&t=4221 for discussion
{ "FNMJ", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "FNMJ", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "FMRJ", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "FMRJ", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "FPTJ", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "FPTJ", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "FLBJ", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "FLBJ", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "FFMJ", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "FFMJ", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "FTKJ", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "FTKJ", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ "FTUJ", GBA_SAVEDATA_EEPROM, HW_NONE, IDLE_LOOP_NONE, false }, { "FTUJ", GBA_SAVEDATA_EEPROM, HW_NONE, GBA_IDLE_LOOP_NONE, false },
{ { 0, 0, 0, 0 }, 0, 0, IDLE_LOOP_NONE, false } { { 0, 0, 0, 0 }, 0, 0, GBA_IDLE_LOOP_NONE, false }
}; };
bool GBAOverrideFind(const struct Configuration* config, struct GBACartridgeOverride* override) { bool GBAOverrideFind(const struct Configuration* config, struct GBACartridgeOverride* override) {
override->savetype = GBA_SAVEDATA_AUTODETECT; override->savetype = GBA_SAVEDATA_AUTODETECT;
override->hardware = HW_NONE; override->hardware = HW_NONE;
override->idleLoop = IDLE_LOOP_NONE; override->idleLoop = GBA_IDLE_LOOP_NONE;
override->mirroring = false; override->mirroring = false;
override->vbaBugCompat = false; override->vbaBugCompat = false;
bool found = false; bool found = false;
@ -327,7 +327,7 @@ void GBAOverrideSave(struct Configuration* config, const struct GBACartridgeOver
ConfigurationClearValue(config, sectionName, "hardware"); ConfigurationClearValue(config, sectionName, "hardware");
} }
if (override->idleLoop != IDLE_LOOP_NONE) { if (override->idleLoop != GBA_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");
@ -376,7 +376,7 @@ void GBAOverrideApply(struct GBA* gba, const struct GBACartridgeOverride* overri
} }
} }
if (override->idleLoop != IDLE_LOOP_NONE) { if (override->idleLoop != GBA_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;
@ -385,7 +385,7 @@ void GBAOverrideApply(struct GBA* gba, const struct GBACartridgeOverride* overri
} }
void GBAOverrideApplyDefaults(struct GBA* gba, const struct Configuration* overrides) { void GBAOverrideApplyDefaults(struct GBA* gba, const struct Configuration* overrides) {
struct GBACartridgeOverride override = { .idleLoop = IDLE_LOOP_NONE }; struct GBACartridgeOverride override = { .idleLoop = GBA_IDLE_LOOP_NONE };
const struct GBACartridge* cart = (const struct GBACartridge*) gba->memory.rom; const struct GBACartridge* cart = (const struct GBACartridge*) gba->memory.rom;
if (cart) { if (cart) {
memcpy(override.id, &cart->id, sizeof(override.id)); memcpy(override.id, &cart->id, sizeof(override.id));

View File

@ -155,7 +155,7 @@ void OverrideView::updateOverrides() {
memset(gba->override.id, 0, 4); memset(gba->override.id, 0, 4);
gba->override.savetype = static_cast<GBASavedataType>(m_ui.savetype->currentIndex() - 1); gba->override.savetype = static_cast<GBASavedataType>(m_ui.savetype->currentIndex() - 1);
gba->override.hardware = HW_NO_OVERRIDE; gba->override.hardware = HW_NO_OVERRIDE;
gba->override.idleLoop = IDLE_LOOP_NONE; gba->override.idleLoop = GBA_IDLE_LOOP_NONE;
gba->override.mirroring = false; gba->override.mirroring = false;
gba->override.vbaBugCompat = false; gba->override.vbaBugCompat = false;
gba->vbaBugCompatSet = false; gba->vbaBugCompatSet = false;
@ -246,7 +246,7 @@ void OverrideView::gameStarted() {
m_ui.hwGBPlayer->setChecked(gba->memory.hw.devices & HW_GB_PLAYER_DETECTION); m_ui.hwGBPlayer->setChecked(gba->memory.hw.devices & HW_GB_PLAYER_DETECTION);
m_ui.vbaBugCompat->setChecked(gba->vbaBugCompat); m_ui.vbaBugCompat->setChecked(gba->vbaBugCompat);
if (gba->idleLoop != IDLE_LOOP_NONE) { if (gba->idleLoop != GBA_IDLE_LOOP_NONE) {
m_ui.idleLoop->setText(QString::number(gba->idleLoop, 16)); m_ui.idleLoop->setText(QString::number(gba->idleLoop, 16));
} else { } else {
m_ui.idleLoop->clear(); m_ui.idleLoop->clear();