DS Slot-1: Reply to IR 0x08 command properly (fixes #666)
Vicki Pfau vi@endrift.com
Mon, 31 Jul 2017 14:50:20 -0700
3 files changed,
15 insertions(+),
4 deletions(-)
M
CHANGES
→
CHANGES
@@ -12,6 +12,7 @@ - DS Video: Fix affine parameter advancing (fixes mgba.io/i/802)
- DS GX: Fix incorrect W values - DS Video: Fix 2D/3D blending alpha values - DS I/O: Enable POWCNT1 bit 1 at boot (fixes mgba.io/i/616) + - DS Slot-1: Reply to IR 0x08 command properly (fixes mgba.io/i/666) Misc: - DS GX: Clean up and unify texture mapping - DS Core: Add symbol loading@@ -23,11 +24,8 @@ - ELF support
Bugfixes: - GB Audio: Make audio unsigned with bias (fixes mgba.io/i/749) - Python: Fix importing .gb or .gba before .core -<<<<<<< HEAD -======= - GBA: Reset active region as needed when loading a ROM - Qt: Fix command line debugger closing second game ->>>>>>> feature/input-revamp Misc: - GBA Timer: Use global cycles for timers - GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722)
M
include/mgba/internal/ds/slot1.h
→
include/mgba/internal/ds/slot1.h
@@ -51,6 +51,7 @@
int dmaSource; enum DSSavedataType savedataType; + bool hasIR; struct mTimingEvent spiEvent; bool spiHoldEnabled; uint8_t spiCommand;
M
src/ds/slot1.c
→
src/ds/slot1.c
@@ -27,6 +27,7 @@ ds->memory.slot1.transferEvent.priority = 0x71;
ds->memory.slot1.transferEvent.context = ds; ds->memory.slot1.transferEvent.callback = _transferEvent; ds->memory.slot1.savedataType = DS_SAVEDATA_AUTODETECT; + ds->memory.slot1.hasIR = false; ds->memory.slot1.spiVf = vf; ds->memory.slot1.spiRealVf = vf; ds->memory.slot1.spiData = NULL;@@ -358,7 +359,11 @@ dscore->p->memory.slot1.spiAddress = 1;
} else { dscore->p->memory.slot1.spiAddress = 0; } - dscore->p->memory.slot1.spiAddressingRemaining = dscore->p->memory.slot1.spiAddressingBits; + if (oldValue == 0x08 && dscore->p->memory.slot1.hasIR) { + dscore->p->memory.slot1.spiCommand |= 0x80; // TODO: Move to a separate variable + } else { + dscore->p->memory.slot1.spiAddressingRemaining = dscore->p->memory.slot1.spiAddressingBits; + } } else { switch (dscore->p->memory.slot1.spiCommand) { case 0x04: // WRDI@@ -371,6 +376,10 @@ case 0x06: // WREN
dscore->p->memory.slot1.statusReg |= 2; break; default: + if (dscore->p->memory.slot1.hasIR && dscore->p->memory.slot1.spiCommand == 0x88) { + newValue = 0xAA; + break; + } switch (dscore->p->memory.slot1.savedataType) { case DS_SAVEDATA_AUTODETECT: newValue = _slot1SPIAutodetect(dscore, oldValue);@@ -448,6 +457,9 @@ ds->memory.slot1.spiAddressingBits = 8;
ds->memory.slot1.savedataType = DS_SAVEDATA_EEPROM512; } else { ds->memory.slot1.spiAddressingBits = 16; + } + if (saveParams & 0xFF0000) { + ds->memory.slot1.hasIR = true; } ds->memory.slot1.spiAddress = size - 1; ds->memory.slot1.spiSize = size;