made saves restore gpu state in a better way

(backward compatible with save version 010)
This commit is contained in:
damdoum 2007-01-26 10:01:17 +00:00
parent 92165da269
commit 13ceddc3b2
1 changed files with 7 additions and 12 deletions

View File

@ -30,7 +30,7 @@
#include <sys/stat.h>
#include <time.h>
#define SAVESTATE_VERSION 011
#define SAVESTATE_VERSION 010
#ifndef MAX_PATH
#define MAX_PATH 256
@ -278,13 +278,12 @@ int savestate_load (const char *file_name) {
// This should regenerate the graphics power control register
MMU_write16(ARMCPU_ARM9, 0x04000304, MMU_read16(ARMCPU_ARM9, 0x04000304));
#if SAVESTATE_VERSION > 010
gzread (file, MainScreen.gpu, sizeof(GPU));
gzread (file, SubScreen.gpu, sizeof(GPU));
#else
GPU_setVideoProp(MainScreen.gpu, MMU_read32(ARMCPU_ARM9, 0x04000000));
GPU_setVideoProp(SubScreen.gpu, MMU_read32(ARMCPU_ARM9, 0x04000000));
#endif
// This should regenerate the graphics configuration
for (i = REG_DISPA_DISPCNT; i<=REG_DISPA_MASTERBRIGHT; i+=2)
MMU_write16(ARMCPU_ARM9, i, MMU_read16(ARMCPU_ARM9, i));
for (i = REG_DISPB_DISPCNT; i<=REG_DISPB_MASTERBRIGHT; i+=2)
MMU_write16(ARMCPU_ARM9, i, MMU_read16(ARMCPU_ARM9, i));
gzclose (file);
return 1;
@ -401,10 +400,6 @@ int savestate_save (const char *file_name) {
// Save shared memory
gzwrite (file, MMU.SWIRAM, 0x8000);
// Save gpu
gzwrite (file, MainScreen.gpu, sizeof(GPU));
gzwrite (file, SubScreen.gpu, sizeof(GPU));
gzclose (file);
return 1;