From 77a630d3e1911cc5162a65203a52fe0e6a4b7d7a Mon Sep 17 00:00:00 2001 From: D G Turner Date: Tue, 24 Jul 2012 05:09:48 +0100 Subject: 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. --- devtools/create_teenagent/create_teenagent.cpp | 70 ++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'devtools') 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; } -- cgit v1.2.3