mirror of https://github.com/mgba-emu/mgba.git
GB: Fix SGB controller selection initialization (fixes #1104)
This commit is contained in:
parent
178348d445
commit
74e09675ce
1
CHANGES
1
CHANGES
|
@ -55,6 +55,7 @@ Other fixes:
|
||||||
- GBA Cheats: Fix value incrementing in CB slide codes (fixes mgba.io/i/1501)
|
- GBA Cheats: Fix value incrementing in CB slide codes (fixes mgba.io/i/1501)
|
||||||
- Qt: Only show emulator restart warning once per settings saving
|
- Qt: Only show emulator restart warning once per settings saving
|
||||||
- Qt: Improve cheat view UX
|
- Qt: Improve cheat view UX
|
||||||
|
- GB: Fix SGB controller selection initialization (fixes mgba.io/i/1104)
|
||||||
Misc:
|
Misc:
|
||||||
- GBA Savedata: EEPROM performance fixes
|
- GBA Savedata: EEPROM performance fixes
|
||||||
- GBA Savedata: Automatically map 1Mbit Flash files as 1Mbit Flash
|
- GBA Savedata: Automatically map 1Mbit Flash files as 1Mbit Flash
|
||||||
|
|
|
@ -435,7 +435,7 @@ void GBReset(struct LR35902Core* cpu) {
|
||||||
|
|
||||||
gb->sgbBit = -1;
|
gb->sgbBit = -1;
|
||||||
gb->sgbControllers = 0;
|
gb->sgbControllers = 0;
|
||||||
gb->sgbCurrentController = 0;
|
gb->sgbCurrentController = 3;
|
||||||
gb->currentSgbBits = 0;
|
gb->currentSgbBits = 0;
|
||||||
memset(gb->sgbPacket, 0, sizeof(gb->sgbPacket));
|
memset(gb->sgbPacket, 0, sizeof(gb->sgbPacket));
|
||||||
|
|
||||||
|
|
|
@ -535,13 +535,13 @@ void GBIOWrite(struct GB* gb, unsigned address, uint8_t value) {
|
||||||
|
|
||||||
static uint8_t _readKeys(struct GB* gb) {
|
static uint8_t _readKeys(struct GB* gb) {
|
||||||
uint8_t keys = *gb->keySource;
|
uint8_t keys = *gb->keySource;
|
||||||
if (gb->sgbCurrentController != 0) {
|
if (gb->sgbCurrentController & gb->sgbControllers) {
|
||||||
keys = 0;
|
keys = 0;
|
||||||
}
|
}
|
||||||
uint8_t joyp = gb->memory.io[REG_JOYP];
|
uint8_t joyp = gb->memory.io[REG_JOYP];
|
||||||
switch (joyp & 0x30) {
|
switch (joyp & 0x30) {
|
||||||
case 0x30:
|
case 0x30:
|
||||||
keys = gb->sgbCurrentController;
|
keys = gb->sgbCurrentController & gb->sgbControllers;
|
||||||
break;
|
break;
|
||||||
case 0x20:
|
case 0x20:
|
||||||
keys >>= 4;
|
keys >>= 4;
|
||||||
|
|
|
@ -702,7 +702,7 @@ void GBVideoWriteSGBPacket(struct GBVideo* video, uint8_t* data) {
|
||||||
break;
|
break;
|
||||||
case SGB_MLT_REQ:
|
case SGB_MLT_REQ:
|
||||||
video->p->sgbControllers = video->sgbPacketBuffer[1] & 0x3;
|
video->p->sgbControllers = video->sgbPacketBuffer[1] & 0x3;
|
||||||
video->p->sgbCurrentController = 0;
|
video->p->sgbCurrentController &= video->p->sgbControllers;
|
||||||
return;
|
return;
|
||||||
case SGB_MASK_EN:
|
case SGB_MASK_EN:
|
||||||
video->renderer->sgbRenderMode = video->sgbPacketBuffer[1] & 0x3;
|
video->renderer->sgbRenderMode = video->sgbPacketBuffer[1] & 0x3;
|
||||||
|
|
Loading…
Reference in New Issue