- if (argc != 2)
- {
- fprintf (stderr, "usage: %s TYPE < .bin", argv[0]);
- exit (1);
- }
-
- if (!strcmp(argv[1], "title0"))
- {
- pos = 0x27;
- if (match_byte (0x03)
- || (match_byte (0x05) && match_byte (0x58)))
- printf ("%s\n", get_string());
- else
- printf ("<unknown>\n");
- return 0;
- }
- else if (!strcmp(argv[1], "title"))
- {
- pos = 0x27;
- dump_title();
- exit(0);
- }
- else if (!strcmp(argv[1], "titleraw"))
- {
- const char fonts[] = "\x01\x31\x09\0\0\0SansSerif";
- start = 0x27;
- n = find(fonts, sizeof fonts - 1);
- }
- else if (!strcmp(argv[1], "fonts"))
- {
- const char fonts[] = "\x01\x31\x09\0\0\0SansSerif";
- const char styles[] = "\xf0\0\0\0";
- start = find(fonts, sizeof fonts - 1);
- n = find(styles, sizeof styles - 1);
- }
- else if (!strcmp(argv[1], "styles"))
- {
- const char styles[] = "\xf0\0\0\0";
- const char dimensions[] = "-,,,.\0";
- start = find(styles, sizeof styles - 1);
- n = find(dimensions, sizeof dimensions - 1) + sizeof dimensions - 1;
- }
- else if (!strcmp(argv[1], "dimensions") || !strcmp(argv[1], "all"))
- {
- pos = 0;
- match_byte_assert(1);
- match_byte_assert(0);
-
- /* This might be a version number of some kind, because value 1 seems
- to only appear in an SPV file that also required its own weird
- special cases in dump_value_modifier(). */
- version = get_u32();
- pos -= 4;
- if (!match_u32(1))
- match_u32_assert(3);
-
- match_byte_assert(1);
- if (!match_byte(0))
- match_byte_assert(1);
-
- /* Offset 8. */
- match_byte_assert(0);
- if (!match_byte(0))
- match_byte_assert(1);
- if (!match_byte(0))
- match_byte_assert(1);
-
- /* Offset 11. */
- pos++;
- match_byte_assert(0);
- match_byte_assert(0);
- match_byte_assert(0);
-
- /* Offset 15. */
- pos++;
- if (!match_byte(0))
- match_byte_assert(1);
- match_byte_assert(0);
- match_byte_assert(0);
-
- /* Offset 19. */
- pos++;
- if (!match_byte(0))
- match_byte_assert(1);
- match_byte_assert(0);
- match_byte_assert(0);
-
- /* Offset 23. */
- pos++;
- if (!match_byte(0))
- match_byte_assert(1);
- match_byte_assert(0);
- match_byte_assert(0);
-
- /* Offset 27. */
-#if 1
- pos++;
- pos++;
- pos++;
- pos++;
-#else
- printf("\nheader:");
- for (int i = 0; i < 4; i++)
- printf(" %02x", data[pos++]);
- printf("\n");
-#endif
-
- /* Offset 31. */
- printf("<tableid>%lld</tableid>", get_u64());