diff options
author | D G Turner | 2012-07-13 10:12:34 +0100 |
---|---|---|
committer | D G Turner | 2012-07-13 10:14:38 +0100 |
commit | 9669b73ca811af9672215748e92acb3f77805b75 (patch) | |
tree | db3906a30c308fa036cd9461ca67b4487346f32b /engines/teenagent | |
parent | 85cf79a57f52c15f9f214ba8ea924bc0b68b7c02 (diff) | |
download | scummvm-rg350-9669b73ca811af9672215748e92acb3f77805b75.tar.gz scummvm-rg350-9669b73ca811af9672215748e92acb3f77805b75.tar.bz2 scummvm-rg350-9669b73ca811af9672215748e92acb3f77805b75.zip |
TEENAGENT: Add symbols for savestate region.
Diffstat (limited to 'engines/teenagent')
-rw-r--r-- | engines/teenagent/resources.h | 4 | ||||
-rw-r--r-- | engines/teenagent/teenagent.cpp | 15 |
2 files changed, 11 insertions, 8 deletions
diff --git a/engines/teenagent/resources.h b/engines/teenagent/resources.h index cc0d1ebe79..e1540f8500 100644 --- a/engines/teenagent/resources.h +++ b/engines/teenagent/resources.h @@ -43,6 +43,10 @@ const uint16 csAddr_rejectMsg = 0xa4d6; // Reject Messages Address Pointers : (4 * 2-byte) = 0x339e to 0x33a5 const uint16 dsAddr_rejectMsg = 0x339e; +// Save State Region : 0x6478 to 0xdbf1 +const uint16 dsAddr_saveState = 0x6478; +const uint16 saveStateSize = 0x777a; + class Resources { public: void deinit(); diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp index ddcefb3607..bf626e2aff 100644 --- a/engines/teenagent/teenagent.cpp +++ b/engines/teenagent/teenagent.cpp @@ -228,20 +228,19 @@ Common::Error TeenAgentEngine::loadGameState(int slot) { if (!in) return Common::kReadPermissionDenied; - const uint dataSize = 0x777a; - assert(res->dseg.size() >= 0x6478 + dataSize); + assert(res->dseg.size() >= dsAddr_saveState + saveStateSize); - char *data = (char *)malloc(dataSize); + char *data = (char *)malloc(saveStateSize); if (!data) error("[TeenAgentEngine::loadGameState] Cannot allocate buffer"); in->seek(0); - if (in->read(data, dataSize) != dataSize) { + if (in->read(data, saveStateSize) != saveStateSize) { free(data); return Common::kReadingFailed; } - memcpy(res->dseg.ptr(0x6478), data, dataSize); + memcpy(res->dseg.ptr(dsAddr_saveState), data, saveStateSize); free(data); @@ -271,9 +270,9 @@ Common::Error TeenAgentEngine::saveGameState(int slot, const Common::String &des res->dseg.set_word(0x64af, pos.x); res->dseg.set_word(0x64b1, pos.y); - assert(res->dseg.size() >= 0x6478 + 0x777a); - strncpy((char *)res->dseg.ptr(0x6478), desc.c_str(), 0x16); - out->write(res->dseg.ptr(0x6478), 0x777a); + assert(res->dseg.size() >= dsAddr_saveState + saveStateSize); + strncpy((char *)res->dseg.ptr(dsAddr_saveState), desc.c_str(), 0x16); + out->write(res->dseg.ptr(dsAddr_saveState), saveStateSize); if (!Graphics::saveThumbnail(*out)) warning("saveThumbnail failed"); |