diff --git a/desmume/src/saves.cpp b/desmume/src/saves.cpp index 2e06a4e4b..b57ea3867 100644 --- a/desmume/src/saves.cpp +++ b/desmume/src/saves.cpp @@ -998,10 +998,19 @@ static void loadstate() // This should regenerate the graphics configuration //zero 27-jul-09 : was formerly up to 7F but that wrote to dispfifo which is dumb (one of nitsuja's desynch bugs [that he found, not caused]) - for (int i = REG_BASE_DISPA; i<=REG_BASE_DISPA + 0x66; i+=2) - _MMU_write16(i, _MMU_read16(i)); - for (int i = REG_BASE_DISPB; i<=REG_BASE_DISPB + 0x7F; i+=2) - _MMU_write16(i, _MMU_read16(i)); + //so then i brought it down to 66 but this resulted in a conceptual bug with affine start registers, which shouldnt get regenerated + //so then i just made this exhaustive list + // for (int i = REG_BASE_DISPA; i<=REG_BASE_DISPA + 0x66; i+=2) + //_MMU_write16(i, _MMU_read16(i)); + // for (int i = REG_BASE_DISPB; i<=REG_BASE_DISPB + 0x7F; i+=2) + //_MMU_write16(i, _MMU_read16(i)); + static const u8 mainRegenAddr[] = {0x00,0x02,0x08,0x0a,0x0c,0x0e,0x40,0x42,0x44,0x46,0x48,0x4a,0x4c,0x50,0x52,0x54,0x60,0x64,0x66,0x6c}; + static const u8 subRegenAddr[] = {0x00,0x02,0x08,0x0a,0x0c,0x0e,0x40,0x42,0x44,0x46,0x48,0x4a,0x4c,0x50,0x52,0x54,0x6c}; + for(int i=0;i(REG_BASE_DISPA+mainRegenAddr[i], _MMU_read16(REG_BASE_DISPA+mainRegenAddr[i])); + for(int i=0;i(REG_BASE_DISPB+subRegenAddr[i], _MMU_read16(REG_BASE_DISPB+subRegenAddr[i])); + SetupMMU(nds.debugConsole); }