aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2011-12-11 15:57:03 +0100
committerWillem Jan Palenstijn2011-12-11 15:57:03 +0100
commitfcf2aa8e2f29b8b4c3718afb49243eac024787d9 (patch)
tree3e4c02e91c0c1f3b2a2822b1e6d30173517424ce
parent05a27138744e3d5fe80602c2c97b6bea547863d9 (diff)
downloadscummvm-rg350-fcf2aa8e2f29b8b4c3718afb49243eac024787d9.tar.gz
scummvm-rg350-fcf2aa8e2f29b8b4c3718afb49243eac024787d9.tar.bz2
scummvm-rg350-fcf2aa8e2f29b8b4c3718afb49243eac024787d9.zip
DREAMWEB: Move Savenames out of opaque data blob
-rwxr-xr-xdevtools/tasmrecover/tasm-recover1
-rw-r--r--engines/dreamweb/dreambase.h2
-rw-r--r--engines/dreamweb/dreamgen.cpp16
-rw-r--r--engines/dreamweb/dreamgen.h7
-rw-r--r--engines/dreamweb/saveload.cpp31
-rw-r--r--engines/dreamweb/stubs.h2
6 files changed, 26 insertions, 33 deletions
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 41dca53a12..074d34e43f 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -46,6 +46,7 @@ p = parser(skip_binary_data = [
'spritename1',
'icongraphics0',
'icongraphics1',
+ 'savenames',
# keypad.asm
'keypadlist',
'symbollist',
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
index d0bcc9150a..38665a04ab 100644
--- a/engines/dreamweb/dreambase.h
+++ b/engines/dreamweb/dreambase.h
@@ -91,6 +91,8 @@ public:
void delCurs();
// from saveload.cpp
+ char _saveNames[17*7];
+ char _saveNamesOld[17*7];
void showNames();
// from sound.cpp
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 8975c26991..b4e73a268a 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -6287,21 +6287,7 @@ void DreamGenContext::__start() {
//0x05d0: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x05e0: .... .... .... ....
- 0xff, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- //0x05f0: .... .... .... ....
- 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- //0x0600: .... .... .... ....
- 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- //0x0610: .... .... .... ....
- 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- //0x0620: .... .... .... ....
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- //0x0630: .... .... .... ....
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- //0x0640: .... .... .... ....
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- //0x0650: .... .... .... ....
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, };
+ 0xff, 0x00, 0x00, 0x00, };
ds.assign(src, src + sizeof(src));
dreamweb();
}
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 1df283c997..761dde80a7 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -420,10 +420,9 @@ static const uint16 kRoompics = 1369;
static const uint16 kOplist = 1384;
static const uint16 kInputline = 1387;
static const uint16 kPresslist = 1515;
-static const uint16 kSavenames = 1521;
-static const uint16 kQuitrequested = 1640;
-static const uint16 kSubtitles = 1641;
-static const uint16 kForeignrelease = 1642;
+static const uint16 kQuitrequested = 1521;
+static const uint16 kSubtitles = 1522;
+static const uint16 kForeignrelease = 1523;
static const uint16 kBlocktextdat = (0);
static const uint16 kPersonframes = (0);
static const uint16 kDebuglevel1 = (0);
diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp
index 2a8b8bec3d..f0fd477ec1 100644
--- a/engines/dreamweb/saveload.cpp
+++ b/engines/dreamweb/saveload.cpp
@@ -190,8 +190,7 @@ void DreamGenContext::saveGame() {
return;
}
- // TODO: Check if this 2 is a constant
- uint8 descbuf[17] = { 2, 0 };
+ char descbuf[17] = { 2, 0 };
strncpy((char*)descbuf+1, game_description.c_str(), 16);
unsigned int desclen = game_description.size();
if (desclen > 15)
@@ -201,7 +200,7 @@ void DreamGenContext::saveGame() {
while (desclen < 17)
descbuf[++desclen] = 1;
if (savegameId < 7)
- memcpy(data.ptr(kSavenames + 17*savegameId, 17), descbuf, 17);
+ memcpy(&_saveNames[17*savegameId], descbuf, 17);
savePosition(savegameId, descbuf);
@@ -218,11 +217,11 @@ void DreamGenContext::saveGame() {
}
void DreamGenContext::namesToOld() {
- memcpy(getSegment(data.word(kBuffers)).ptr(kZoomspace, 0), data.ptr(kSavenames, 0), 17*7);
+ memcpy(_saveNamesOld, _saveNames, 17*7);
}
void DreamGenContext::oldToNames() {
- memcpy(data.ptr(kSavenames, 0), getSegment(data.word(kBuffers)).ptr(kZoomspace, 0), 17*7);
+ memcpy(_saveNames, _saveNamesOld, 17*7);
}
void DreamGenContext::saveLoad() {
@@ -262,7 +261,7 @@ void DreamGenContext::actualSave() {
unsigned int slot = data.byte(kCurrentslot);
- const uint8 *desc = data.ptr(kSavenames + 17*slot, 16);
+ const char *desc = &_saveNames[17*slot];
if (desc[1] == 0) // The actual description string starts at desc[1]
return;
@@ -289,7 +288,7 @@ void DreamGenContext::actualLoad() {
unsigned int slot = data.byte(kCurrentslot);
- const uint8 *desc = data.ptr(kSavenames + 17*slot, 16);
+ const char *desc = &_saveNames[17*slot];
if (desc[1] == 0) // The actual description string starts at desc[1]
return;
@@ -297,7 +296,7 @@ void DreamGenContext::actualLoad() {
data.byte(kGetback) = 1;
}
-void DreamGenContext::savePosition(unsigned int slot, const uint8 *descbuf) {
+void DreamGenContext::savePosition(unsigned int slot, const char *descbuf) {
const Room &currentRoom = g_roomData[data.byte(kLocation)];
@@ -378,7 +377,7 @@ void DreamGenContext::loadPosition(unsigned int slot) {
::error("Error loading save: description buffer isn't 17 bytes");
if (slot < 7) {
- inSaveFile->read(data.ptr(kSavenames + 17*slot, len[0]), len[0]);
+ inSaveFile->read(&_saveNames[17*slot], len[0]);
} else {
// The savenames buffer only has room for 7 descriptions
uint8 namebuf[17];
@@ -399,7 +398,7 @@ void DreamGenContext::loadPosition(unsigned int slot) {
delete inSaveFile;
}
-// Count number of save files, and load their descriptions into kSavenames
+// Count number of save files, and load their descriptions into _saveNames
unsigned int DreamGenContext::scanForNames() {
unsigned int count = 0;
@@ -407,6 +406,11 @@ unsigned int DreamGenContext::scanForNames() {
// TODO: Change this to use SaveFileManager::listSavefiles()
for (unsigned int slot = 0; slot < 7; ++slot) {
+ _saveNames[17*slot+0] = 2;
+ _saveNames[17*slot+1] = 0;
+ for (int i = 2; i < 17; ++i)
+ _saveNames[17*slot+i] = 1;
+
// Try opening savegame with the given slot id
Common::String filename = engine->getSavegameFilename(slot);
Common::InSaveFile *inSaveFile = engine->getSaveFileManager()->openForLoading(filename);
@@ -424,7 +428,7 @@ unsigned int DreamGenContext::scanForNames() {
}
// NB: Only possible if slot < 7
- inSaveFile->read(data.ptr(kSavenames + 17*slot, 17), 17);
+ inSaveFile->read(&_saveNames[17*slot], 17);
delete inSaveFile;
}
@@ -461,7 +465,7 @@ void DreamGenContext::loadSaveBox() {
void DreamBase::showNames() {
for (int slot = 0; slot < 7; ++slot) {
// The first character of the savegame name is unused
- Common::String name((char *)data.ptr(kSavenames + 17*slot + 1, 16));
+ Common::String name(&_saveNames[17*slot + 1]);
if (slot != data.byte(kCurrentslot)) {
printDirect((const uint8 *)name.c_str(), kOpsx + 21, kOpsy + 10*slot + 10, 200, false);
@@ -487,7 +491,8 @@ void DreamGenContext::checkInput() {
readKey();
- char *name = (char *)data.ptr(kSavenames + 17*data.byte(kCurrentslot) + 1, 16);
+ // The first character of the savegame name is unused
+ char *name = &_saveNames[17*data.byte(kCurrentslot) + 1];
if (data.byte(kCurrentkey) == 0) {
return;
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index c63b2449d8..5225878c9a 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -305,7 +305,7 @@
void actualSave();
void actualLoad();
void loadPosition(unsigned int slot);
- void savePosition(unsigned int slot, const uint8 *descbuf);
+ void savePosition(unsigned int slot, const char *descbuf);
uint16 allocateAndLoad(unsigned int size);
void clearAndLoad(uint8 *buf, uint8 c, unsigned int size, unsigned int maxSize);
void clearAndLoad(uint16 seg, uint8 c, unsigned int size, unsigned int maxSize);