GBA BIOS: Implement Diff8bitUnFilterVram

This commit is contained in:
Jeffrey Pfau 2015-01-07 21:43:21 -08:00
parent fb35a8b3f7
commit 600080ba0c
2 changed files with 18 additions and 12 deletions

View File

@ -14,7 +14,7 @@ Features:
- Support for games using the tilt sensor - Support for games using the tilt sensor
- Remappable shortcuts for keyboard and gamepad - Remappable shortcuts for keyboard and gamepad
- Rewinding of emulation - Rewinding of emulation
- Implemented BIOS routines Diff8bitUnFilterWram, and Diff16bitUnFilter - Implemented BIOS routines Diff8bitUnFilterWram, Diff8bitUnFilterVram, and Diff16bitUnFilter
Bugfixes: Bugfixes:
- Qt: Fix issue with set frame sizes being the wrong height - Qt: Fix issue with set frame sizes being the wrong height
- Qt: Fix emulator crashing when full screen if a game is not running - Qt: Fix emulator crashing when full screen if a game is not running

View File

@ -477,26 +477,32 @@ static void _unFilter(struct GBA* gba, int inwidth, int outwidth) {
uint16_t old = 0; uint16_t old = 0;
source += 4; source += 4;
while (remaining > 0) { while (remaining > 0) {
uint16_t new;
if (inwidth == 1) { if (inwidth == 1) {
halfword = cpu->memory.loadU8(cpu, source, 0); new = cpu->memory.loadU8(cpu, source, 0);
} else { } else {
halfword = cpu->memory.loadU16(cpu, source, 0); new = cpu->memory.loadU16(cpu, source, 0);
} }
halfword += old; new += old;
if (outwidth > inwidth) { if (outwidth > inwidth) {
GBALog(gba, GBA_LOG_STUB, "Unimplemented Diff8bitUnFilterVram"); halfword >>= 8;
} else { halfword |= (new << 8);
if (outwidth == 1) { if (source & 1) {
halfword &= 0xFF;
cpu->memory.store8(cpu, dest, halfword, 0);
} else {
cpu->memory.store16(cpu, dest, halfword, 0); cpu->memory.store16(cpu, dest, halfword, 0);
dest += outwidth;
remaining -= outwidth;
} }
old = halfword; } else if (outwidth == 1) {
cpu->memory.store8(cpu, dest, new, 0);
dest += outwidth; dest += outwidth;
remaining -= outwidth;
} else {
cpu->memory.store16(cpu, dest, new, 0);
dest += outwidth;
remaining -= outwidth;
} }
old = new;
source += inwidth; source += inwidth;
remaining -= outwidth;
} }
cpu->gprs[0] = source; cpu->gprs[0] = source;
cpu->gprs[1] = dest; cpu->gprs[1] = dest;