aboutsummaryrefslogtreecommitdiff
path: root/sword2/save_rest.cpp
diff options
context:
space:
mode:
authorMax Horn2003-09-13 18:18:02 +0000
committerMax Horn2003-09-13 18:18:02 +0000
commit2afc2c0ca98ab759e5d39a620abd1002fe1c4d0b (patch)
treea367a19a94fc5bb2c515be16e51f8f54360ecc85 /sword2/save_rest.cpp
parent42bf2a855caf986b26c2ad572ae857c25d0296d3 (diff)
downloadscummvm-rg350-2afc2c0ca98ab759e5d39a620abd1002fe1c4d0b.tar.gz
scummvm-rg350-2afc2c0ca98ab759e5d39a620abd1002fe1c4d0b.tar.bz2
scummvm-rg350-2afc2c0ca98ab759e5d39a620abd1002fe1c4d0b.zip
fix global vars storing
svn-id: r10237
Diffstat (limited to 'sword2/save_rest.cpp')
-rw-r--r--sword2/save_rest.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/sword2/save_rest.cpp b/sword2/save_rest.cpp
index e6ba630050..01adb0f499 100644
--- a/sword2/save_rest.cpp
+++ b/sword2/save_rest.cpp
@@ -215,8 +215,8 @@ void FillSaveBuffer(mem *buffer, uint32 size, uint8 *desc)
varsRes = res_man.Res_open(1); // open variables resource
memcpy(buffer->ad + sizeof(g_header), varsRes, FROM_LE_32(g_header.varLength)); // copy that to the buffer, following the header
#ifdef SCUMM_BIG_ENDIAN
- uint32 *globalVars = (uint32 *)(buffer->ad + sizeof(g_header));
- const uint numVars = FROM_LE_32(g_header.varLength)/4;
+ uint32 *globalVars = (uint32 *)(buffer->ad + sizeof(g_header) + sizeof(_standardHeader));
+ const uint numVars = (FROM_LE_32(g_header.varLength) - sizeof(_standardHeader))/4;
for (uint i = 0; i < numVars; i++) {
globalVars[i] = SWAP_BYTES_32(globalVars[i]);
}
@@ -389,8 +389,8 @@ uint32 RestoreFromBuffer(mem *buffer, uint32 size)
varsRes = res_man.Res_open(1); // open variables resource
memcpy( varsRes, buffer->ad + sizeof(g_header), g_header.varLength );// copy that to the buffer, following the header
#ifdef SCUMM_BIG_ENDIAN
- uint32 *globalVars = (uint32 *)varsRes;
- const uint numVars = g_header.varLength/4;
+ uint32 *globalVars = (uint32 *)(varsRes + sizeof(_standardHeader));
+ const uint numVars = (g_header.varLength - sizeof(_standardHeader))/4;
for (uint i = 0; i < numVars; i++) {
globalVars[i] = SWAP_BYTES_32(globalVars[i]);
}