mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-20 00:41:12 +00:00
TEENAGENT: Add symbols for savestate region.
This commit is contained in:
parent
85cf79a57f
commit
9669b73ca8
@ -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();
|
||||
|
@ -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");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user