From 16bad91f4b18427ebd210d6bebf826b364c3feba Mon Sep 17 00:00:00 2001 From: Jaromir Wysoglad Date: Tue, 2 Jul 2019 11:38:53 +0200 Subject: SUPERNOVA: Add placeholder info files to .dat --- devtools/create_supernova/create_supernova.cpp | 46 ++++++++++++++++++++++++++ devtools/create_supernova/msn.doc-en | 1 + devtools/create_supernova/msn.inf-en | 1 + 3 files changed, 48 insertions(+) create mode 100644 devtools/create_supernova/msn.doc-en create mode 100644 devtools/create_supernova/msn.inf-en (limited to 'devtools/create_supernova') 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 -- cgit v1.2.3