Skip to content

Commit

Permalink
Fixed white screen issues with save type none games. Fixes #48.
Browse files Browse the repository at this point in the history
  • Loading branch information
profi200 committed Dec 9, 2021
1 parent 82d54b3 commit 434f714
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions libn3ds/source/arm9/drivers/lgy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 434f714

Please sign in to comment.