Fixed white screen issues with save type none games. Fixes #48.

This commit is contained in:
profi200 2021-12-09 13:22:39 +01:00
parent 82d54b341c
commit 434f714ef1
No known key found for this signature in database
GPG Key ID: 17B42AE5911139F3
1 changed files with 3 additions and 5 deletions

View File

@ -80,11 +80,9 @@ static u32 setupSaveType(u16 saveType)
{
Lgy *const lgy = getLgyRegs();
lgy->gba_save_type = saveType;
// The last shift in the table is technically undefined behavior (C standard)
// but on ARM this will always result in 0.
// https://developer.arm.com/documentation/dui0489/h/arm-and-thumb-instructions/shift-operations
static const u8 saveSizeShiftLut[16] = {9, 9, 13, 13, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 15, 32};
const u32 saveSize = 1u<<saveSizeShiftLut[saveType & 0xFu];
static const u8 saveSizeShiftLut[16] = {9, 9, 13, 13, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 15, 0};
const u32 saveSize = (1u<<saveSizeShiftLut[saveType & 0xFu]) & ~1u;
g_saveSize = saveSize;
// Flash chip erase, flash sector erase, flash program, EEPROM write.