X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=dump-spo2.c;h=9bef78c5668a6674a5567ca4c8d2e4cdeef36188;hb=825c6bde8038dcb024a25b89a3591fbc21b25d1d;hp=ff9e5300692260ae9f705fe3effb7171d683e544;hpb=4f21cc8b5c80d80d50d4599ab434f49bca9a830c;p=pspp diff --git a/dump-spo2.c b/dump-spo2.c index ff9e530069..9bef78c566 100644 --- a/dump-spo2.c +++ b/dump-spo2.c @@ -714,7 +714,7 @@ parse_category(int level, int j, int *n_leaves) match_u32_assert(0); if (get_u16() == 0xffff) match_u16_assert(0xffff); - else + else if (!match_u16(0)) match_u16_assert(0x0e74); match_byte_assert(0); match_DspSimpleText(); @@ -724,6 +724,14 @@ parse_category(int level, int j, int *n_leaves) data[pos], data[pos + 1], data[pos + 2]); pos += 3; } + if (match_u16(0x8011)) + { + printf("11 80("); + pos += 2; + for (size_t i = 0; i < 16; i++) + printf("%s%02x", i > 0 ? " " : "", data[pos++]); + printf(") "); + } match_DspString(); int n_subcategories = get_u32(); @@ -745,7 +753,6 @@ parse_dimension(int i) if (i == 0) { match_zeros_assert(5); - match_u32_assert(1); } else { @@ -768,9 +775,11 @@ parse_dimension(int i) get_u16(); match_byte_assert(0); get_u16(); match_byte_assert(0); match_u32_assert(0); - match_u32_assert(1); } + if (!match_u32(0)) + match_u32_assert(1); + get_u16(); if (!match_u16(0xffff)) match_u16_assert(0x0e74); @@ -784,13 +793,32 @@ parse_dimension(int i) parse_category(1, j, &n_leaves); } +static void skip_item(const char *name); + static void parse_PMModelItemInfo(void) { for (int i = 0; i < n_dims; i++) parse_dimension(i); printf("%#x: end of model\n", pos); - exit(0); + + int n_units16 = get_u32(); + match_u16_assert(0); + for (int j = 0; j < n_units16; j++) + get_u16(); + + n_units16 = get_u32(); + match_u16_assert(1); + for (int j = 0; j < n_units16; j++) + get_u16(); + + match_byte_assert(0); + int n_units32 = get_u32(); + match_u16_assert(0); + for (int j = 0; j < n_units32; j++) + match_u32_assert(j); + + skip_item("end of PMModelItemInfo"); } static void @@ -884,7 +912,8 @@ parse_NavNote(void) if (!match_u32(0) && !match_u32(0xffffff4b)) match_u32_assert(-40); pos += 8; - match_u32_assert(2); + if (!match_u32(1)) + match_u32_assert(2); if (!match_u32(2)) match_u32_assert(1); } @@ -986,17 +1015,38 @@ skip_item(const char *name) { int start_pos = pos; printf("%#x: skipping %s bytes...", pos, name); - while (data[pos + 1] != 0x80 + while (pos < n + && data[pos + 1] != 0x80 && !(data[pos] == 0xff && data[pos + 1] == 0xff && data[pos + 2] == 0 && data[pos + 3] == 0)) { - assert(pos < n); pos++; } printf("until %#x:", pos); hex_dump(stdout, start_pos, pos - start_pos); } +static void +parse_DspAnnotation(void) +{ + match_zeros_assert(10); + match_u32_assert(1); +} + +static void +parse_DspTextComponentHandle(void) +{ + match_byte_assert(0); + match_DspString(); + printf("after DspTextComponentHandle: "); + for (int i = 0; ; i++) + if (!memcmp(&data[pos + 6 + i], "PVView", 6)) + { + hex_dump(stdout, pos, i); + exit(0); + } +} + static void parse_flexible(void) { @@ -1065,6 +1115,10 @@ parse_flexible(void) parse_PVCellStyle(); else if (!strcmp(heading, "PVTextStyle")) exit(0); + else if (!strcmp(heading, "DspAnnotation")) + parse_DspAnnotation(); + else if (!strcmp(heading, "DspTextComponentHandle")) + parse_DspTextComponentHandle(); else { fprintf(stderr, "don't know %s at offset 0x%x: ", heading, start); @@ -1081,7 +1135,15 @@ parse_flexible(void) else if (data[pos] == 0x5 && data[pos + 1] == 0x80) match_DspString(); else if (data[pos] == 0x7 && data[pos + 1] == 0x80) - match_NavTreeViewItem(); + { + if (0) + match_NavTreeViewItem(); + else + { + pos += 2; + skip_item("NavTreeViewItem"); + } + } else if (data[pos] == 0x3 && data[pos + 1] == 0x80) match_DspSimpleText(); else if ((data[pos] == 0x3c || data[pos] == 0x39) @@ -1127,7 +1189,7 @@ parse_flexible(void) match_byte_assert(0); } } - else if (data[pos] == 0x17) + else if (data[pos] == 0x17 || data[pos] == 0x25) { printf("%02x %02x(%02x %02x %02x)\n", data[pos], data[pos + 1], @@ -1437,7 +1499,7 @@ main(int argc, char *argv[]) match_u32_assert(1); match_byte_assert(0x63); - for (;;) + while (pos < n) { if (data[pos] == 0) { @@ -1600,7 +1662,7 @@ main(int argc, char *argv[]) match_byte_assert(0); match_zeros_assert(7); - while (data[pos] != 1) + while (pos < n) { if (data[pos] == 0) {