aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--devtools/create_teenagent/create_teenagent.cpp70
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;
}