GBA: Put in tilt sensor stubs
Jeffrey Pfau jeffrey@endrift.com
Wed, 31 Dec 2014 04:43:06 -0800
4 files changed,
24 insertions(+),
3 deletions(-)
M
src/gba/gba-gpio.c
→
src/gba/gba-gpio.c
@@ -360,6 +360,12 @@ _outputPins(gpio, sendBit << 3);
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 void GBAGPIOSerialize(struct GBACartridgeGPIO* gpio, struct GBASerializedState* state) {
M
src/gba/gba-gpio.h
→
src/gba/gba-gpio.h
@@ -113,12 +113,10 @@ void GBAGPIOInit(struct GBACartridgeGPIO* gpio, uint16_t* gpioBase);
void GBAGPIOWrite(struct GBACartridgeGPIO* gpio, uint32_t address, uint16_t value); void GBAGPIOInitRTC(struct GBACartridgeGPIO* gpio); - void GBAGPIOInitGyro(struct GBACartridgeGPIO* gpio); - void GBAGPIOInitRumble(struct GBACartridgeGPIO* gpio); - void GBAGPIOInitLightSensor(struct GBACartridgeGPIO* gpio); +void GBAGPIOInitTilt(struct GBACartridgeGPIO* gpio); struct GBASerializedState; void GBAGPIOSerialize(struct GBACartridgeGPIO* gpio, struct GBASerializedState* state);
M
src/gba/gba-memory.c
→
src/gba/gba-memory.c
@@ -448,6 +448,9 @@ if (memory->savedata.type == SAVEDATA_SRAM) {
value = memory->savedata.data[address & (SIZE_CART_SRAM - 1)]; } else if (memory->savedata.type == SAVEDATA_FLASH512 || memory->savedata.type == SAVEDATA_FLASH1M) { 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 { GBALog(gba, GBA_LOG_GAME_ERROR, "Reading from non-existent SRAM: 0x%08X", address); value = 0xFF;@@ -663,6 +666,8 @@ if (memory->savedata.type == SAVEDATA_FLASH512 || memory->savedata.type == SAVEDATA_FLASH1M) {
GBASavedataWriteFlash(&memory->savedata, address, value); } else if (memory->savedata.type == SAVEDATA_SRAM) { 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 { GBALog(gba, GBA_LOG_GAME_ERROR, "Writing to non-existent SRAM: 0x%08X", address); }
M
src/gba/gba.c
→
src/gba/gba.c
@@ -53,6 +53,9 @@
// Final Fantasy Tactics Advance { "AFXE", SAVEDATA_FLASH512, GPIO_NONE, 0x8000418 }, + // Koro Koro Puzzle - Happy Panechu! + { "KHPJ", SAVEDATA_EEPROM, GPIO_TILT, -1 }, + // Mega Man Battle Network { "AREE", SAVEDATA_SRAM, GPIO_NONE, 0x800032E },@@ -111,6 +114,11 @@ // Wario Ware Twisted
{ "RZWJ", SAVEDATA_SRAM, GPIO_RUMBLE | GPIO_GYRO, -1 }, { "RZWE", 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 } };@@ -722,6 +730,10 @@ }
if (_overrides[i].gpio & GPIO_LIGHT_SENSOR) { GBAGPIOInitLightSensor(&gba->memory.gpio); + } + + if (_overrides[i].gpio & GPIO_TILT) { + GBAGPIOInitTilt(&gba->memory.gpio); } gba->busyLoop = _overrides[i].busyLoop;