diff options
author | Alyssa Milburn | 2013-08-01 22:49:53 +0200 |
---|---|---|
committer | Alyssa Milburn | 2013-08-02 00:01:10 +0200 |
commit | d1795a21bc26ae32e36bd0cf777fb05b556107fd (patch) | |
tree | 937fdfec02a2cab3d76329499ec5eed213790109 /engines/tony/mpal | |
parent | 275c65c2727db483b43819b0df91a93148229808 (diff) | |
download | scummvm-rg350-d1795a21bc26ae32e36bd0cf777fb05b556107fd.tar.gz scummvm-rg350-d1795a21bc26ae32e36bd0cf777fb05b556107fd.tar.bz2 scummvm-rg350-d1795a21bc26ae32e36bd0cf777fb05b556107fd.zip |
TONY: Fix savegames on BE (this breaks compatibility).
Diffstat (limited to 'engines/tony/mpal')
-rw-r--r-- | engines/tony/mpal/mpal.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp index fff8676a89..5e6d44f0a3 100644 --- a/engines/tony/mpal/mpal.cpp +++ b/engines/tony/mpal/mpal.cpp @@ -2035,7 +2035,13 @@ int mpalGetSaveStateSize() { void mpalSaveState(byte *buf) { lockVar(); WRITE_LE_UINT32(buf, GLOBALS._nVars); - memcpy(buf + 4, (byte *)GLOBALS._lpmvVars, GLOBALS._nVars * sizeof(MpalVar)); + buf += 4; + for (uint i = 0; i < GLOBALS._nVars; ++i) { + LpMpalVar var = &GLOBALS._lpmvVars[i]; + WRITE_LE_UINT32(buf, var->_dwVal); + memcpy(buf + 4, var->_lpszVarName, sizeof(var->_lpszVarName)); + buf += (4 + sizeof(var->_lpszVarName)); + } unlockVar(); } @@ -2050,10 +2056,16 @@ int mpalLoadState(byte *buf) { globalFree(GLOBALS._hVars); GLOBALS._nVars = READ_LE_UINT32(buf); + buf += 4; GLOBALS._hVars = globalAllocate(GMEM_ZEROINIT | GMEM_MOVEABLE, GLOBALS._nVars * sizeof(MpalVar)); lockVar(); - memcpy((byte *)GLOBALS._lpmvVars, buf + 4, GLOBALS._nVars * sizeof(MpalVar)); + for (uint i = 0; i < GLOBALS._nVars; ++i) { + LpMpalVar var = &GLOBALS._lpmvVars[i]; + var->_dwVal = READ_LE_UINT32(buf); + memcpy(var->_lpszVarName, buf + 4, sizeof(var->_lpszVarName)); + buf += (4 + sizeof(var->_lpszVarName)); + } unlockVar(); return GLOBALS._nVars * sizeof(MpalVar) + 4; |