From 05a08d61c738472c9a49d973b62e10be3d6b1118 Mon Sep 17 00:00:00 2001
From: David Turner
Date: Wed, 29 Sep 2010 02:57:11 +0000
Subject: TOOLS : Fixes for skycpt use, particularly on case-sensitive OS
In order to allow for work on bug #1507756 "BASS: Officer Blunt wrong animation (?)",
the skycpt tool needs to be run, but this was only previously used on case-insensitive
OS i.e. Win32. To get this to work normally on case-sensitive OS i.e. Unix, a number of
corrections were made to the hardcoded filenames to ensure the same case as the
input files.
Minor corrections :
The README was also amended to deal with the pitfall of decompressing savefiles.
Added output of each RESET.* file as processed so offending file can be seen on assertion.
Corrected segfault on missing COMPACT.TXT, so exit is more graceful.
svn-id: r52941
---
tools/skycpt/AsciiCptCompile.cpp | 8 ++------
tools/skycpt/AsciiCptCompile.vcproj | 2 +-
tools/skycpt/README | 10 +++++++---
tools/skycpt/TextFile.cpp | 7 ++++---
tools/skycpt/cptcompiler.cpp | 5 +++--
5 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/tools/skycpt/AsciiCptCompile.cpp b/tools/skycpt/AsciiCptCompile.cpp
index 22711bf061..1169de5aea 100644
--- a/tools/skycpt/AsciiCptCompile.cpp
+++ b/tools/skycpt/AsciiCptCompile.cpp
@@ -56,8 +56,8 @@ int main(int argc, char* argv[])
printf("Sorry, this program only works on little endian systems.\nGoodbye.\n");
return 0;
}
- TextFile *cptDef = new TextFile("compact.txt");
- FILE *inf = fopen("compact.txt", "r");
+ TextFile *cptDef = new TextFile("COMPACT.TXT");
+ FILE *inf = fopen("COMPACT.TXT", "r");
FILE *dbg = fopen("compact.dbg", "wb");
FILE *out = fopen("compact.bin", "wb");
FILE *sve = fopen("savedata.txt", "r");
@@ -70,7 +70,3 @@ int main(int argc, char* argv[])
printf("done\n");
return 0;
}
-
-
-
-
diff --git a/tools/skycpt/AsciiCptCompile.vcproj b/tools/skycpt/AsciiCptCompile.vcproj
index 99a2524cc9..e6a5def316 100644
--- a/tools/skycpt/AsciiCptCompile.vcproj
+++ b/tools/skycpt/AsciiCptCompile.vcproj
@@ -387,7 +387,7 @@
RelativePath=".\asmSrc\9compact.inc">
+ RelativePath=".\COMPACT.TXT">
diff --git a/tools/skycpt/README b/tools/skycpt/README
index f6d5f2a45b..8b9705033d 100644
--- a/tools/skycpt/README
+++ b/tools/skycpt/README
@@ -39,10 +39,14 @@ If you still want to waste your time by creating this file:
Afterwards, it'll automatically show the load/save dialog where you save the game.
7) Rename the Savegame files you created to "RESET.*", depending on the version.
e.g. RESET.288 for v.0.00288
-8) Copy the files into the skycpt tool directory, execute the tool again.
+8) Rename each file with a ".gz" suffix and run gunzip on it.
+ This removes the ScummVM gzip savefile compression.
+ Failing to do this will cause skycpt to abort at a filesize assert
+ when reading the "RESET.*" files.
+9) Copy the files into the skycpt tool directory, execute the tool again.
It'll create a new COMPACT.DBG.
-9) Rename this file to SKY.CPT.
-10) DELETE IT BECAUSE IT'S PROBABLY BROKEN, NOT WORTH BOTHERING WITH ANYWAYS
+10) Rename this file to SKY.CPT.
+11) DELETE IT BECAUSE IT'S PROBABLY BROKEN, NOT WORTH BOTHERING WITH ANYWAYS
AND DOWNLOAD THE SKY.CPT FILE FROM THE URL ABOVE!!
Oh, I almost forgot.
diff --git a/tools/skycpt/TextFile.cpp b/tools/skycpt/TextFile.cpp
index 92d747f955..ee64d22f5f 100644
--- a/tools/skycpt/TextFile.cpp
+++ b/tools/skycpt/TextFile.cpp
@@ -28,13 +28,14 @@
TextFile::TextFile(const char *name) {
FILE *inf = fopen(name, "r");
+ _lines = NULL;
if (!inf) {
printf("Unable to open file %s\n", name);
getchar();
+ } else {
+ read(inf);
+ fclose(inf);
}
- _lines = NULL;
- read(inf);
- fclose(inf);
}
uint32 crop(char *line) {
diff --git a/tools/skycpt/cptcompiler.cpp b/tools/skycpt/cptcompiler.cpp
index 75434a4618..956f575d7d 100644
--- a/tools/skycpt/cptcompiler.cpp
+++ b/tools/skycpt/cptcompiler.cpp
@@ -475,7 +475,7 @@ void doCompile(FILE *inf, FILE *debOutf, FILE *resOutf, TextFile *cptDef, FILE *
bool filesExist = true;
char inName[32];
for (int i = 0; i < 7; i++) {
- sprintf(inName, "reset.%03d", gameVers[i]);
+ sprintf(inName, "RESET.%03d", gameVers[i]);
FILE *test = fopen(inName, "rb");
if (test)
fclose(test);
@@ -505,8 +505,9 @@ void doCompile(FILE *inf, FILE *debOutf, FILE *resOutf, TextFile *cptDef, FILE *
fwrite(&tmp, 2, 1, debOutf);
printf("reset destination: %ld\n", ftell(debOutf));
for (int cnt = 0; cnt < 6; cnt++) {
+ printf("Processing diff v0.0%03d\n", gameVers[cnt]);
uint16 diffPos = 0;
- sprintf(inName, "reset.%03d", gameVers[cnt]);
+ sprintf(inName, "RESET.%03d", gameVers[cnt]);
FILE *resDiff = fopen(inName, "rb");
fseek(resDiff, 0, SEEK_END);
assert(ftell(resDiff) == (resSize * 2));
--
cgit v1.2.3