diff options
author | D G Turner | 2012-07-24 05:09:48 +0100 |
---|---|---|
committer | D G Turner | 2012-07-24 05:09:48 +0100 |
commit | 77a630d3e1911cc5162a65203a52fe0e6a4b7d7a (patch) | |
tree | 375428dc1b5766a2cae6e2264d0d666a44837451 /devtools | |
parent | 88a1989a79be31f862dee3b0278687ae674e1fae (diff) | |
download | scummvm-rg350-77a630d3e1911cc5162a65203a52fe0e6a4b7d7a.tar.gz scummvm-rg350-77a630d3e1911cc5162a65203a52fe0e6a4b7d7a.tar.bz2 scummvm-rg350-77a630d3e1911cc5162a65203a52fe0e6a4b7d7a.zip |
DEVTOOLS: Modify create_teenagent to output message string table.
This temporary hack code is used to convert the current dseg table into
two smaller byte tables and a list of the message strings, which is
output to stdout. This will likely require some manual postediting, but
does most of the work programmatically.
Diffstat (limited to 'devtools')
-rw-r--r-- | devtools/create_teenagent/create_teenagent.cpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/devtools/create_teenagent/create_teenagent.cpp b/devtools/create_teenagent/create_teenagent.cpp index e4d29d716e..f205af81fb 100644 --- a/devtools/create_teenagent/create_teenagent.cpp +++ b/devtools/create_teenagent/create_teenagent.cpp @@ -91,5 +91,75 @@ int main(int argc, char *argv[]) { fclose(fout); + // Generate dseg static tables for newer version + uint dsegFBSize = 0x339e; + + printf("const static uint8 dsegFirstBlock[%d] = {\n", dsegFBSize); + for (uint i = 0; i < dsegFBSize; i++) { + if ((i % 8) == 0) + printf("\t"); + else + printf(" "); + + printf("0x%02x", dseg[i]); + + if (i != dsegFBSize - 1) + printf(","); + + if (((i+1) % 8) == 0 || i == dsegFBSize - 1) + printf("\n"); + } + printf("};\n\n"); + + uint dsegMessageSize = 0x6034; + printf("const static char* messages[335] = {\n\t\""); + uint messageCount = 0; + char last = '\0'; + // (4 * 2) skips Reject Message Pointer Table + for (uint i = dsegFBSize + (4 * 2); i < dsegMessageSize; i++) { + // Skip Book Color Pointer Table + if (i == 0x5f3c) { + i += (6 * 2); + continue; + } + + if (dseg[i] != '\0') { + if (dseg[i] == 0xff) + printf("\\n"); + else if (dseg[i] == '\"') + printf("\\\""); + else + printf("%c", dseg[i]); + } else { // dseg[i] == '\0' + if (last == '\0') + printf("\", // %d\n\t\"", messageCount++); + else if (dseg[i+1] != '\0') + printf("\\n"); + } + + last = dseg[i]; + } + printf("\" // %d\n};\n\n", messageCount++); + + uint dsegFinalSize = 0xe790; + + printf("const static uint8 dsegFinalBlock[%d] = {\n", dsegFinalSize - dsegMessageSize - dsegFBSize); + uint j = 0; + for (uint i = dsegMessageSize; i < dsegFinalSize; i++, j++) { + if ((j % 8) == 0) + printf("\t"); + else + printf(" "); + + printf("0x%02x", dseg[i]); + + if (i != dsegFinalSize - 1) + printf(","); + + if (((j+1) % 8) == 0 || i == dsegFinalSize - 1) + printf("\n"); + } + printf("};\n\n"); + return 0; } |