From: Ben Pfaff Date: Sun, 28 Jun 2020 04:40:10 +0000 (+0000) Subject: progress! X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp;a=commitdiff_plain;h=3de0178afea2e6f4efd708b5a41db865955ac8ef progress! --- diff --git a/dump-spo2.c b/dump-spo2.c index 02acd3af6a..d59ab7ba63 100644 --- a/dump-spo2.c +++ b/dump-spo2.c @@ -112,7 +112,8 @@ match_u32_assert(uint32_t x, const char *where) unsigned int y = get_u32(); if (x != y) { - fprintf(stderr, "%s: 0x%x: expected i%u, got i%u\n", where, pos - 4, x, y); + fprintf(stderr, "%s: 0x%x: expected i%u, got i%u: ", where, pos - 4, x, y); + hex_dump(stderr, pos - 4, 64); exit(1); } } @@ -556,8 +557,9 @@ parse_weirdness(void) match_byte_assert(1); get_u32(); match_zeros_assert(12); - match_byte_assert(0x90); - match_byte_assert(1); + pos++; /* 90 or BC */ + if (!match_byte(2)) + match_byte_assert(1); match_zeros_assert(5); pos++; match_zeros_assert(3); @@ -736,7 +738,8 @@ parse_NavOleItem(void) match_byte_assert(1); match_zeros_assert(10); match_byte_assert(1); - match_zeros_assert(6); + match_zeros_assert(5); + get_string1(); match_byte_assert(1); parse_weirdness(); match_byte_assert(0); @@ -748,6 +751,14 @@ parse_NavOleItem(void) match_byte_assert(0); } +static void +match_NavOleItem(void) +{ /* 0e 80 */ + match_byte_assert(0x0e); + match_byte_assert(0x80); + parse_NavOleItem(); +} + static void parse_NavTitle(void) { @@ -756,10 +767,25 @@ parse_NavTitle(void) match_u32_assert(24); get_u32(); pos++; - match_byte_assert(4); + if (!match_byte(3)) + match_byte_assert(4); match_zeros_assert(2); get_u32(); match_u32_assert(2); + if (!match_u32(2)) + match_u32_assert(1); +} + +static void +parse_NavNote(void) +{ + match_byte_assert(2); + match_zeros_assert(8); + match_u32_assert(24); + if (!match_u32(0)) + match_u32_assert(-40); + pos += 8; + match_u32_assert(2); match_u32_assert(1); } @@ -786,6 +812,8 @@ parse_flexible(void) parse_NavOleItem(); else if (!strcmp(heading, "NavTitle")) parse_NavTitle(); + else if (!strcmp(heading, "NavNote")) + parse_NavNote(); else { fprintf(stderr, "don't know %s at offset 0x%x: ", heading, start); @@ -828,9 +856,11 @@ parse_flexible(void) { match_NavLog(); } + else if (data[pos] == 0xe) + match_NavOleItem(); else { - fprintf (stderr, "bad record 0x%02x at offset %x\n", + fprintf (stderr, "bad record 0x%02x at offset %x: ", data[pos], pos); hex_dump (stderr, pos, 64); assert(0); @@ -986,6 +1016,10 @@ main(int argc, char *argv[]) parse_flexible(); parse_flexible(); parse_flexible(); + parse_flexible(); + parse_flexible(); + parse_flexible(); + parse_flexible(); exit(0); puts(get_padded_string(32)); if (!match_u32(80))