Lower memory usage.

This commit is contained in:
n-a-c-h
2005-05-13 15:15:40 +00:00
parent 7ec7bba8f2
commit 3099ada6d4

View File

@@ -309,11 +309,23 @@ void InitRewindVars()
}
//This is used to preserve system load state between loads
static unsigned char BackupSystemBuffer[0x800000]; //Half a megabyte, should be enough for a while
static unsigned char *BackupSystemBuffer = 0;
void BackupSystemVars()
{
unsigned char *buffer = BackupSystemBuffer;
unsigned char *buffer;
if (!BackupSystemBuffer)
{
void *doMemAlloc(size_t);
state_size = 0;
copy_snes_data(&buffer, state_size_tally);
copy_spc_data(&buffer, state_size_tally);
copy_extra_data(&buffer, state_size_tally);
BackupSystemBuffer = doMemAlloc(state_size);
}
buffer = BackupSystemBuffer;
copy_snes_data(&buffer, memcpyinc);
copy_spc_data(&buffer, memcpyinc);
copy_extra_data(&buffer, memcpyinc);