mirror of https://github.com/mgba-emu/mgba.git
GBA: Put in tilt sensor stubs
This commit is contained in:
parent
c9b7f450aa
commit
d83b00e4fa
|
@ -360,6 +360,12 @@ void _lightReadPins(struct GBACartridgeGPIO* gpio) {
|
||||||
GBALog(0, GBA_LOG_DEBUG, "[SOLAR] Output %u with pins %u", gpio->lightCounter, gpio->pinState);
|
GBALog(0, GBA_LOG_DEBUG, "[SOLAR] Output %u with pins %u", gpio->lightCounter, gpio->pinState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// == Tilt (not technically GPIO)
|
||||||
|
|
||||||
|
void GBAGPIOInitTilt(struct GBACartridgeGPIO* gpio) {
|
||||||
|
gpio->gpioDevices |= GPIO_TILT;
|
||||||
|
}
|
||||||
|
|
||||||
// == Serialization
|
// == Serialization
|
||||||
|
|
||||||
void GBAGPIOSerialize(struct GBACartridgeGPIO* gpio, struct GBASerializedState* state) {
|
void GBAGPIOSerialize(struct GBACartridgeGPIO* gpio, struct GBASerializedState* state) {
|
||||||
|
|
|
@ -113,12 +113,10 @@ void GBAGPIOInit(struct GBACartridgeGPIO* gpio, uint16_t* gpioBase);
|
||||||
void GBAGPIOWrite(struct GBACartridgeGPIO* gpio, uint32_t address, uint16_t value);
|
void GBAGPIOWrite(struct GBACartridgeGPIO* gpio, uint32_t address, uint16_t value);
|
||||||
|
|
||||||
void GBAGPIOInitRTC(struct GBACartridgeGPIO* gpio);
|
void GBAGPIOInitRTC(struct GBACartridgeGPIO* gpio);
|
||||||
|
|
||||||
void GBAGPIOInitGyro(struct GBACartridgeGPIO* gpio);
|
void GBAGPIOInitGyro(struct GBACartridgeGPIO* gpio);
|
||||||
|
|
||||||
void GBAGPIOInitRumble(struct GBACartridgeGPIO* gpio);
|
void GBAGPIOInitRumble(struct GBACartridgeGPIO* gpio);
|
||||||
|
|
||||||
void GBAGPIOInitLightSensor(struct GBACartridgeGPIO* gpio);
|
void GBAGPIOInitLightSensor(struct GBACartridgeGPIO* gpio);
|
||||||
|
void GBAGPIOInitTilt(struct GBACartridgeGPIO* gpio);
|
||||||
|
|
||||||
struct GBASerializedState;
|
struct GBASerializedState;
|
||||||
void GBAGPIOSerialize(struct GBACartridgeGPIO* gpio, struct GBASerializedState* state);
|
void GBAGPIOSerialize(struct GBACartridgeGPIO* gpio, struct GBASerializedState* state);
|
||||||
|
|
|
@ -448,6 +448,9 @@ int8_t GBALoad8(struct ARMCore* cpu, uint32_t address, int* cycleCounter) {
|
||||||
value = memory->savedata.data[address & (SIZE_CART_SRAM - 1)];
|
value = memory->savedata.data[address & (SIZE_CART_SRAM - 1)];
|
||||||
} else if (memory->savedata.type == SAVEDATA_FLASH512 || memory->savedata.type == SAVEDATA_FLASH1M) {
|
} else if (memory->savedata.type == SAVEDATA_FLASH512 || memory->savedata.type == SAVEDATA_FLASH1M) {
|
||||||
value = GBASavedataReadFlash(&memory->savedata, address);
|
value = GBASavedataReadFlash(&memory->savedata, address);
|
||||||
|
} else if (memory->gpio.gpioDevices & GPIO_TILT) {
|
||||||
|
GBALog(gba, GBA_LOG_STUB, "Unimplemented tilt sensor read: 0x%08X", address);
|
||||||
|
value = 0xFF;
|
||||||
} else {
|
} else {
|
||||||
GBALog(gba, GBA_LOG_GAME_ERROR, "Reading from non-existent SRAM: 0x%08X", address);
|
GBALog(gba, GBA_LOG_GAME_ERROR, "Reading from non-existent SRAM: 0x%08X", address);
|
||||||
value = 0xFF;
|
value = 0xFF;
|
||||||
|
@ -663,6 +666,8 @@ void GBAStore8(struct ARMCore* cpu, uint32_t address, int8_t value, int* cycleCo
|
||||||
GBASavedataWriteFlash(&memory->savedata, address, value);
|
GBASavedataWriteFlash(&memory->savedata, address, value);
|
||||||
} else if (memory->savedata.type == SAVEDATA_SRAM) {
|
} else if (memory->savedata.type == SAVEDATA_SRAM) {
|
||||||
memory->savedata.data[address & (SIZE_CART_SRAM - 1)] = value;
|
memory->savedata.data[address & (SIZE_CART_SRAM - 1)] = value;
|
||||||
|
} else if (memory->gpio.gpioDevices & GPIO_TILT) {
|
||||||
|
GBALog(gba, GBA_LOG_STUB, "Unimplemented tilt sensor write: 0x%08X", address);
|
||||||
} else {
|
} else {
|
||||||
GBALog(gba, GBA_LOG_GAME_ERROR, "Writing to non-existent SRAM: 0x%08X", address);
|
GBALog(gba, GBA_LOG_GAME_ERROR, "Writing to non-existent SRAM: 0x%08X", address);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,9 @@ static const struct GBACartridgeOverride _overrides[] = {
|
||||||
// Final Fantasy Tactics Advance
|
// Final Fantasy Tactics Advance
|
||||||
{ "AFXE", SAVEDATA_FLASH512, GPIO_NONE, 0x8000418 },
|
{ "AFXE", SAVEDATA_FLASH512, GPIO_NONE, 0x8000418 },
|
||||||
|
|
||||||
|
// Koro Koro Puzzle - Happy Panechu!
|
||||||
|
{ "KHPJ", SAVEDATA_EEPROM, GPIO_TILT, -1 },
|
||||||
|
|
||||||
// Mega Man Battle Network
|
// Mega Man Battle Network
|
||||||
{ "AREE", SAVEDATA_SRAM, GPIO_NONE, 0x800032E },
|
{ "AREE", SAVEDATA_SRAM, GPIO_NONE, 0x800032E },
|
||||||
|
|
||||||
|
@ -112,6 +115,11 @@ static const struct GBACartridgeOverride _overrides[] = {
|
||||||
{ "RZWE", SAVEDATA_SRAM, GPIO_RUMBLE | GPIO_GYRO, -1 },
|
{ "RZWE", SAVEDATA_SRAM, GPIO_RUMBLE | GPIO_GYRO, -1 },
|
||||||
{ "RZWP", SAVEDATA_SRAM, GPIO_RUMBLE | GPIO_GYRO, -1 },
|
{ "RZWP", SAVEDATA_SRAM, GPIO_RUMBLE | GPIO_GYRO, -1 },
|
||||||
|
|
||||||
|
// Yoshi's Universal Gravitation
|
||||||
|
{ "KYGJ", SAVEDATA_EEPROM, GPIO_TILT, -1 },
|
||||||
|
{ "KYGE", SAVEDATA_EEPROM, GPIO_TILT, -1 },
|
||||||
|
{ "KYGP", SAVEDATA_EEPROM, GPIO_TILT, -1 },
|
||||||
|
|
||||||
{ { 0, 0, 0, 0 }, 0, 0, -1 }
|
{ { 0, 0, 0, 0 }, 0, 0, -1 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -724,6 +732,10 @@ void _checkOverrides(struct GBA* gba, uint32_t id) {
|
||||||
GBAGPIOInitLightSensor(&gba->memory.gpio);
|
GBAGPIOInitLightSensor(&gba->memory.gpio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_overrides[i].gpio & GPIO_TILT) {
|
||||||
|
GBAGPIOInitTilt(&gba->memory.gpio);
|
||||||
|
}
|
||||||
|
|
||||||
gba->busyLoop = _overrides[i].busyLoop;
|
gba->busyLoop = _overrides[i].busyLoop;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue