GBA Memory: Add unlicensed cart write handling stub

This commit is contained in:
Vicki Pfau 2024-11-17 03:34:33 -08:00
parent 91cf829261
commit dc263295dd
3 changed files with 18 additions and 0 deletions

View File

@ -60,6 +60,7 @@ void GBAUnlCartReset(struct GBA*);
void GBAUnlCartUnload(struct GBA*);
void GBAUnlCartDetect(struct GBA*);
void GBAUnlCartWriteSRAM(struct GBA*, uint32_t address, uint8_t value);
void GBAUnlCartWriteROM(struct GBA*, uint32_t address, uint16_t value);
struct GBASerializedState;
void GBAUnlCartSerialize(const struct GBA* gba, struct GBASerializedState* state);

View File

@ -126,6 +126,19 @@ void GBAUnlCartWriteSRAM(struct GBA* gba, uint32_t address, uint8_t value) {
gba->memory.savedata.data[address & (GBA_SIZE_SRAM - 1)] = value;
}
void GBAUnlCartWriteROM(struct GBA* gba, uint32_t address, uint16_t value) {
struct GBAUnlCart* unl = &gba->memory.unl;
switch (unl->type) {
case GBA_UNL_CART_VFAME:
case GBA_UNL_CART_NONE:
break;
case GBA_UNL_CART_MULTICART:
mLOG(GBA_MEM, STUB, "Unimplemented writing to ROM %07X:%04X", address, value);
break;
}
}
static void _multicartSettle(struct mTiming* timing, void* context, uint32_t cyclesLate) {
UNUSED(timing);
UNUSED(cyclesLate);

View File

@ -963,6 +963,10 @@ void GBAStore16(struct ARMCore* cpu, uint32_t address, int16_t value, int* cycle
break;
}
}
if (memory->unl.type) {
GBAUnlCartWriteROM(gba, address & (GBA_SIZE_ROM0 - 1), value);
break;
}
mLOG(GBA_MEM, GAME_ERROR, "Bad cartridge Store16: 0x%08X", address);
break;
case GBA_REGION_ROM2_EX: