first try at decoding errors from binary
[vrDialog] / errors / dump.pl
diff --git a/errors/dump.pl b/errors/dump.pl
new file mode 100755 (executable)
index 0000000..c93f77c
--- /dev/null
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+
+use File::Slurp;
+use Data::Dump qw(dump);
+
+my $file = read_file 'vrDIALOG.EN';
+warn "# ", length($file), " bytes\n";
+
+my $offset = 0x13B68;
+#$offset = 0x00013C90;
+#$offset = 0x014024;
+#$offset = 0x0141da + 2; # possible errors?
+#$offset = 0x014502 + 2;
+#$offset = 0x014190;
+
+my $len = 1;
+my $page = 0;
+
+while ( $page < 20 ) {
+
+again:
+printf "%02x ", ord(substr($file, $offset + $_, 1 )) foreach ( -2 .. 2 );
+$len = ord(substr($file, $offset, 1));
+
+if ( $len == 0 ) {
+       $page++;
+       $offset += 2;
+       printf "0x%06x %-5d %s\n", $offset, $len, '?';
+       goto again;
+
+}
+
+my $string = substr($file,$offset + 1, $len * 2);
+$string =~ s/\x00//g;
+printf "0x%06x %-5d %s\n", $offset, $len, $string;
+
+$offset += ( $len + 1 ) * 2;
+
+}