aboutsummaryrefslogtreecommitdiff
path: root/devtools
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-07-02 11:38:53 +0200
committerThierry Crozat2019-07-28 15:09:14 +0100
commit16bad91f4b18427ebd210d6bebf826b364c3feba (patch)
treeb03d662f9a16533fa6dc60db05d15a01706844ba /devtools
parentbcd62c06699f3240aaa79eeb4bb31f23dbe2bd56 (diff)
downloadscummvm-rg350-16bad91f4b18427ebd210d6bebf826b364c3feba.tar.gz
scummvm-rg350-16bad91f4b18427ebd210d6bebf826b364c3feba.tar.bz2
scummvm-rg350-16bad91f4b18427ebd210d6bebf826b364c3feba.zip
SUPERNOVA: Add placeholder info files to .dat
Diffstat (limited to 'devtools')
-rw-r--r--devtools/create_supernova/create_supernova.cpp46
-rw-r--r--devtools/create_supernova/msn.doc-en1
-rw-r--r--devtools/create_supernova/msn.inf-en1
-rw-r--r--devtools/create_supernova2/create_supernova2.cpp51
-rw-r--r--devtools/create_supernova2/ms2.doc-en1
-rw-r--r--devtools/create_supernova2/ms2.inf-en1
6 files changed, 98 insertions, 3 deletions
diff --git a/devtools/create_supernova/create_supernova.cpp b/devtools/create_supernova/create_supernova.cpp
index 9ce202c58c..2022808303 100644
--- a/devtools/create_supernova/create_supernova.cpp
+++ b/devtools/create_supernova/create_supernova.cpp
@@ -20,6 +20,50 @@ const char *lang[] = {
NULL
};
+void writeDocFile(File& outputFile, const char *fileExtension, const char* language) {
+ File docFile;
+ char fileName[20];
+ sprintf(fileName, "msn.%s-%s", fileExtension, language);
+ if (!docFile.open(fileName, kFileReadMode)) {
+ printf("Cannot find file 'msn.%s' for language '%s'. This file will be skipped.\n", fileExtension, language);
+ return;
+ }
+
+ // Write block header in output file (4 bytes).
+ // We convert the file extension to upper case.
+ for (int i = 0 ; i < 3 ; ++i) {
+ if (fileExtension[i] >= 97 && fileExtension[i] <= 122)
+ outputFile.writeByte(fileExtension[i] - 32);
+ else
+ outputFile.writeByte(fileExtension[i]);
+ }
+ outputFile.writeByte('1');
+
+ // And write the language code on 4 bytes as well (padded with 0 if needed).
+ int languageLength = strlen(language);
+ for (int i = 0 ; i < 4 ; ++i) {
+ if (i < languageLength)
+ outputFile.writeByte(language[i]);
+ else
+ outputFile.writeByte(0);
+ }
+
+ // Write block size
+
+ docFile.seek(0, SEEK_END);
+ int length = docFile.pos();
+ docFile.seek(0, SEEK_SET);
+ outputFile.writeLong(length);
+
+ // Write all the bytes.
+ for (int i = 0 ; i < length; ++i) {
+ byte b = docFile.readByte();
+ outputFile.writeByte(b);
+ }
+
+ docFile.close();
+}
+
void writeImage(File& outputFile, const char *name, const char* language) {
File imgFile;
char fileName[16];
@@ -242,6 +286,8 @@ int main(int argc, char *argv[]) {
writeImage(outputFile, "img1", *l);
writeImage(outputFile, "img2", *l);
writeStrings(outputFile, *l);
+ writeDocFile(outputFile, "inf", *l);
+ writeDocFile(outputFile, "doc", *l);
++l;
}
diff --git a/devtools/create_supernova/msn.doc-en b/devtools/create_supernova/msn.doc-en
new file mode 100644
index 0000000000..6add950715
--- /dev/null
+++ b/devtools/create_supernova/msn.doc-en
@@ -0,0 +1 @@
+PLACEHOLDER MSN.DOC
diff --git a/devtools/create_supernova/msn.inf-en b/devtools/create_supernova/msn.inf-en
new file mode 100644
index 0000000000..b1f25f5172
--- /dev/null
+++ b/devtools/create_supernova/msn.inf-en
@@ -0,0 +1 @@
+PLACEHOLDER MSN.INF
diff --git a/devtools/create_supernova2/create_supernova2.cpp b/devtools/create_supernova2/create_supernova2.cpp
index 24d79f1d76..a6399b99cc 100644
--- a/devtools/create_supernova2/create_supernova2.cpp
+++ b/devtools/create_supernova2/create_supernova2.cpp
@@ -19,6 +19,51 @@ const char *lang[] = {
"en",
NULL
};
+
+void writeDocFile(File& outputFile, const char *fileExtension, const char* language) {
+ File docFile;
+ char fileName[20];
+ sprintf(fileName, "ms2.%s-%s", fileExtension, language);
+ if (!docFile.open(fileName, kFileReadMode)) {
+ printf("Cannot find file 'ms2.%s' for language '%s'. This file will be skipped.\n", fileExtension, language);
+ return;
+ }
+
+ // Write block header in output file (4 bytes).
+ // We convert the file extension to upper case.
+ for (int i = 0 ; i < 3 ; ++i) {
+ if (fileExtension[i] >= 97 && fileExtension[i] <= 122)
+ outputFile.writeByte(fileExtension[i] - 32);
+ else
+ outputFile.writeByte(fileExtension[i]);
+ }
+ outputFile.writeByte('2');
+
+ // And write the language code on 4 bytes as well (padded with 0 if needed).
+ int languageLength = strlen(language);
+ for (int i = 0 ; i < 4 ; ++i) {
+ if (i < languageLength)
+ outputFile.writeByte(language[i]);
+ else
+ outputFile.writeByte(0);
+ }
+
+ // Write block size
+
+ docFile.seek(0, SEEK_END);
+ int length = docFile.pos();
+ docFile.seek(0, SEEK_SET);
+ outputFile.writeLong(length);
+
+ // Write all the bytes.
+ for (int i = 0 ; i < length; ++i) {
+ byte b = docFile.readByte();
+ outputFile.writeByte(b);
+ }
+
+ docFile.close();
+}
+
void writeDatafile(File& outputFile, int fileNumber, const char* language) {
File dataFile;
char fileName[20];
@@ -167,9 +212,7 @@ void writeImage(File& outputFile, const char *name, const char* language) {
// Write block size
outputFile.writeLong(w * h / 8);
- // Write all the bytes. We should have w * h / 8 bytes
- // However we need to invert the bits has the engine expects 1 for the background and 0 for the text (black)
- // but pbm uses 0 for white and 1 for black.
+ // Write all the bytes.
for (i = 0 ; i < w * h / 8 ; ++i) {
byte b = imgFile.readByte();
outputFile.writeByte(~b);
@@ -286,6 +329,8 @@ int main(int argc, char *argv[]) {
writeDatafile(outputFile, 15, *l);
writeDatafile(outputFile, 28, *l);
writeStrings(outputFile, *l);
+ writeDocFile(outputFile, "inf", *l);
+ writeDocFile(outputFile, "doc", *l);
++l;
}
diff --git a/devtools/create_supernova2/ms2.doc-en b/devtools/create_supernova2/ms2.doc-en
new file mode 100644
index 0000000000..da6df8c4ed
--- /dev/null
+++ b/devtools/create_supernova2/ms2.doc-en
@@ -0,0 +1 @@
+PLACEHOLDER MS2.DOC
diff --git a/devtools/create_supernova2/ms2.inf-en b/devtools/create_supernova2/ms2.inf-en
new file mode 100644
index 0000000000..ed3da5067c
--- /dev/null
+++ b/devtools/create_supernova2/ms2.inf-en
@@ -0,0 +1 @@
+PLACEHOLDER MS2.INF