saves / restores GPU (less glitches when using savestates)

This commit is contained in:
damdoum 2007-01-26 09:33:42 +00:00
parent 4cbe98b94a
commit 92165da269
2 changed files with 12 additions and 2 deletions

View File

@ -30,7 +30,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#define SAVESTATE_VERSION 010 #define SAVESTATE_VERSION 011
#ifndef MAX_PATH #ifndef MAX_PATH
#define MAX_PATH 256 #define MAX_PATH 256
@ -278,8 +278,13 @@ int savestate_load (const char *file_name) {
// This should regenerate the graphics power control register // This should regenerate the graphics power control register
MMU_write16(ARMCPU_ARM9, 0x04000304, MMU_read16(ARMCPU_ARM9, 0x04000304)); 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(MainScreen.gpu, MMU_read32(ARMCPU_ARM9, 0x04000000));
GPU_setVideoProp(SubScreen.gpu, MMU_read32(ARMCPU_ARM9, 0x04000000)); GPU_setVideoProp(SubScreen.gpu, MMU_read32(ARMCPU_ARM9, 0x04000000));
#endif
gzclose (file); gzclose (file);
return 1; return 1;
@ -395,6 +400,11 @@ int savestate_save (const char *file_name) {
// Save shared memory // Save shared memory
gzwrite (file, MMU.SWIRAM, 0x8000); gzwrite (file, MMU.SWIRAM, 0x8000);
// Save gpu
gzwrite (file, MainScreen.gpu, sizeof(GPU));
gzwrite (file, SubScreen.gpu, sizeof(GPU));
gzclose (file); gzclose (file);
return 1; return 1;

View File

@ -28,7 +28,7 @@ extern "C" {
#include "types.h" #include "types.h"
#define SRAM_ADDRESS 0x0A000000 #define SRAM_ADDRESS 0x0A000000
#define SRAM_SIZE 0x10000 #define SRAM_SIZE 0x10000
#define NB_STATES 10 #define NB_STATES 10
typedef struct typedef struct