DS GX: Properly reject invalid commands

This commit is contained in:
Vicki Pfau 2020-07-20 08:47:19 -07:00
parent 2b4a4b5ab6
commit 0b0739f567
2 changed files with 6 additions and 0 deletions

View File

@ -14,6 +14,7 @@ Bugfixes:
- DS Slot-1: Reply to IR 0x08 command properly (fixes mgba.io/i/666)
- GBA Video: Fix mode 2 out-of-bounds VRAM crash
- GBA Video: Fix regression adjusting brightness of backdrop
- DS GX: Properly reject invalid commands
Misc:
- DS GX: Clean up and unify texture mapping
- DS Core: Add symbol loading

View File

@ -1437,6 +1437,10 @@ static void DSGXWriteFIFO(struct DSGX* gx, struct DSGXEntry entry) {
gx->outstandingCommand[3] = 0;
}
} else {
if (entry.command >= DS_GX_CMD_MAX) {
mLOG(DS_GX, GAME_ERROR, "Wrote invalid command %02x to GX FIFO", entry.command);
return;
}
gx->outstandingParams[0] = _gxCommandParams[entry.command];
if (gx->outstandingParams[0]) {
--gx->outstandingParams[0];
@ -1447,6 +1451,7 @@ static void DSGXWriteFIFO(struct DSGX* gx, struct DSGXEntry entry) {
}
uint32_t cycles = _gxCommandCycleBase[entry.command];
if (!cycles) {
mLOG(DS_GX, GAME_ERROR, "Wrote invalid command %02x to GX FIFO", entry.command);
return;
}
if (CircleBufferSize(&gx->fifo) == 0 && CircleBufferSize(&gx->pipe) < (DS_GX_PIPE_SIZE * sizeof(entry))) {