mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-05 01:00:48 +00:00
WINTERMUTE: Fix a savegame-regression
This commit is contained in:
parent
8ecb9d937d
commit
dde2d92c69
@ -319,6 +319,7 @@ HRESULT CBPersistMgr::initLoad(const char *filename) {
|
|||||||
(_savedVerMajor == DCGF_VER_MAJOR && _savedVerMinor == DCGF_VER_MINOR && _savedVerBuild > DCGF_VER_BUILD)
|
(_savedVerMajor == DCGF_VER_MAJOR && _savedVerMinor == DCGF_VER_MINOR && _savedVerBuild > DCGF_VER_BUILD)
|
||||||
) {
|
) {
|
||||||
Game->LOG(0, "ERROR: Saved game version is newer than current game");
|
Game->LOG(0, "ERROR: Saved game version is newer than current game");
|
||||||
|
Game->LOG(0, "ERROR: Expected %d.%d.%d got %d.%d.%d", DCGF_VER_MAJOR, DCGF_VER_MINOR, DCGF_VER_BUILD, _savedVerMajor, _savedVerMinor, _savedVerBuild);
|
||||||
cleanup();
|
cleanup();
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
@ -329,6 +330,7 @@ HRESULT CBPersistMgr::initLoad(const char *filename) {
|
|||||||
(_savedVerMajor == SAVEGAME_VER_MAJOR && _savedVerMinor == SAVEGAME_VER_MINOR && _savedVerBuild < SAVEGAME_VER_BUILD)
|
(_savedVerMajor == SAVEGAME_VER_MAJOR && _savedVerMinor == SAVEGAME_VER_MINOR && _savedVerBuild < SAVEGAME_VER_BUILD)
|
||||||
) {
|
) {
|
||||||
Game->LOG(0, "ERROR: Saved game is too old and cannot be used by this version of game engine");
|
Game->LOG(0, "ERROR: Saved game is too old and cannot be used by this version of game engine");
|
||||||
|
Game->LOG(0, "ERROR: Expected %d.%d.%d got %d.%d.%d", DCGF_VER_MAJOR, DCGF_VER_MINOR, DCGF_VER_BUILD, _savedVerMajor, _savedVerMinor, _savedVerBuild);
|
||||||
cleanup();
|
cleanup();
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ HRESULT CScEngine::Tick() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
warning("CScEngine::Tick - Unhandled enum");
|
//warning("CScEngine::Tick - Unhandled enum");
|
||||||
break;
|
break;
|
||||||
} // switch
|
} // switch
|
||||||
} // for each script
|
} // for each script
|
||||||
|
@ -102,13 +102,9 @@ CScScript::~CScScript() {
|
|||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CScScript::readHeader() {
|
||||||
|
uint32 oldPos = _scriptStream->pos();
|
||||||
//////////////////////////////////////////////////////////////////////////
|
_scriptStream->seek(0);
|
||||||
HRESULT CScScript::InitScript() {
|
|
||||||
if (!_scriptStream) {
|
|
||||||
_scriptStream = new Common::MemoryReadStream(_buffer, _bufferSize);
|
|
||||||
}
|
|
||||||
_header.magic = _scriptStream->readUint32LE();
|
_header.magic = _scriptStream->readUint32LE();
|
||||||
_header.version = _scriptStream->readUint32LE();
|
_header.version = _scriptStream->readUint32LE();
|
||||||
_header.code_start = _scriptStream->readUint32LE();
|
_header.code_start = _scriptStream->readUint32LE();
|
||||||
@ -117,6 +113,16 @@ HRESULT CScScript::InitScript() {
|
|||||||
_header.event_table = _scriptStream->readUint32LE();
|
_header.event_table = _scriptStream->readUint32LE();
|
||||||
_header.externals_table = _scriptStream->readUint32LE();
|
_header.externals_table = _scriptStream->readUint32LE();
|
||||||
_header.method_table = _scriptStream->readUint32LE();
|
_header.method_table = _scriptStream->readUint32LE();
|
||||||
|
_scriptStream->seek(oldPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
HRESULT CScScript::InitScript() {
|
||||||
|
if (!_scriptStream) {
|
||||||
|
_scriptStream = new Common::MemoryReadStream(_buffer, _bufferSize);
|
||||||
|
}
|
||||||
|
readHeader();
|
||||||
|
|
||||||
if (_header.magic != SCRIPT_MAGIC) {
|
if (_header.magic != SCRIPT_MAGIC) {
|
||||||
Game->LOG(0, "File '%s' is not a valid compiled script", _filename);
|
Game->LOG(0, "File '%s' is not a valid compiled script", _filename);
|
||||||
@ -162,6 +168,7 @@ HRESULT CScScript::InitScript() {
|
|||||||
HRESULT CScScript::InitTables() {
|
HRESULT CScScript::InitTables() {
|
||||||
uint32 OrigIP = _iP;
|
uint32 OrigIP = _iP;
|
||||||
|
|
||||||
|
readHeader();
|
||||||
// load symbol table
|
// load symbol table
|
||||||
_iP = _header.symbol_table;
|
_iP = _header.symbol_table;
|
||||||
|
|
||||||
@ -1197,7 +1204,10 @@ HRESULT CScScript::persist(CBPersistMgr *persistMgr) {
|
|||||||
persistMgr->getBytes(_buffer, _bufferSize);
|
persistMgr->getBytes(_buffer, _bufferSize);
|
||||||
_scriptStream = new Common::MemoryReadStream(_buffer, _bufferSize);
|
_scriptStream = new Common::MemoryReadStream(_buffer, _bufferSize);
|
||||||
InitTables();
|
InitTables();
|
||||||
} else _buffer = NULL;
|
} else {
|
||||||
|
_buffer = NULL;
|
||||||
|
_scriptStream = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
persistMgr->transfer(TMEMBER(_callStack));
|
persistMgr->transfer(TMEMBER(_callStack));
|
||||||
@ -1617,6 +1627,9 @@ void CScScript::afterLoad() {
|
|||||||
_buffer = new byte [_bufferSize];
|
_buffer = new byte [_bufferSize];
|
||||||
memcpy(_buffer, buffer, _bufferSize);
|
memcpy(_buffer, buffer, _bufferSize);
|
||||||
|
|
||||||
|
delete _scriptStream;
|
||||||
|
_scriptStream = new Common::MemoryReadStream(_buffer, _bufferSize);
|
||||||
|
|
||||||
InitTables();
|
InitTables();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,6 +144,7 @@ public:
|
|||||||
HRESULT Create(const char *Filename, byte *Buffer, uint32 Size, CBScriptHolder *Owner);
|
HRESULT Create(const char *Filename, byte *Buffer, uint32 Size, CBScriptHolder *Owner);
|
||||||
uint32 _iP;
|
uint32 _iP;
|
||||||
private:
|
private:
|
||||||
|
void readHeader();
|
||||||
uint32 _bufferSize;
|
uint32 _bufferSize;
|
||||||
byte *_buffer;
|
byte *_buffer;
|
||||||
public:
|
public:
|
||||||
|
@ -37,6 +37,7 @@ namespace WinterMute {
|
|||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
CSysClassRegistry::CSysClassRegistry() {
|
CSysClassRegistry::CSysClassRegistry() {
|
||||||
|
_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
#define DCGF_VER_MAJOR 1
|
#define DCGF_VER_MAJOR 1
|
||||||
#define DCGF_VER_MINOR 0
|
#define DCGF_VER_MINOR 1
|
||||||
#define DCGF_VER_BUILD 1
|
#define DCGF_VER_BUILD 1
|
||||||
#define DCGF_VER_SUFFIX "beta"
|
#define DCGF_VER_SUFFIX "beta"
|
||||||
#define DCGF_VER_BETA true
|
#define DCGF_VER_BETA true
|
||||||
|
Loading…
Reference in New Issue
Block a user