Hi Gerd Patch attached to fix MdrSummary readHeaderLen, cope with different hdr lengths more clearly and improve output.
I've found I can now split my old "City Navigator Europe NT" map and look at the MDR, which includes sections 30/31, 32/33, 34, 37 & 38 codePage=1252 id1=18 id2=1 unk=0x0011 hdrLen=708 Compressed strings flag=0x0000 MDR 1 NR=265 (000109) RS=4 magic=0x00000002 2 NR=0 (000000) RS=2 magic=0x00000000 3 NR=0 (000000) RS=2 magic=0x00000000 4 NR=0 (000000) RS=3 magic=0x00000000 MDR 5 NR=633075 (09a8f3) RS=15 magic=0x00003e51 MDR 6 NR=181613 (02c56d) RS=4 magic=0x00000001 7 NR=0 (000000) RS=9 magic=0x00001ae2 8 DS=0 (00000000) magic=0x00000000 MDR 9 NR=1 (000001) RS=4 magic=0x00000000 MDR 10 DS=1607528 (00188768) magic=0x00000000 MDR 11 NR=401882 (0621da) RS=13 magic=0x00000575 12 DS=0 (00000000) magic=0x00000000 13 DS=0 (00000000) magic=0x00000000 14 DS=0 (00000000) magic=0x00000000 15 DS=0 (00000000) magic=0x00000000 16 DS=0 (00000000) magic=0x00000000 MDR 17 DS=2868654 (002bc5ae) magic=0x00000000 18 DS=0 (00000000) magic=0x00000000 19 DS=0 (00000000) magic=0x00000000 MDR 20 DS=65810719 (03ec311f) magic=0x00060000 21 DS=0 (00000000) magic=0x00000000 MDR 22 NR=8006434(7a2b22) RS=9 magic=0x0004035e 23 NR=0 (000000) RS=9 magic=0x00000000 MDR 24 NR=15516 (003c9c) RS=7 magic=0x00000000 MDR 25 NR=649642 (09e9aa) RS=3 magic=0x00000000 26 DS=0 (00000000) magic=0x00000000 27 DS=0 (00000000) magic=0x00000000 28 NR=0 (000000) RS=13 magic=0x00000000 MDR 29 NR=1452 (0005ac) RS=20 magic=0x000003f6 MDR 30 NR=637 (00027d) RS=4 magic=0x00000000 MDR 31 DS=3983 (00000f8f) magic=0x00000000 MDR 32 NR=566 (000236) RS=4 magic=0x00000000 MDR 33 DS=3039 (00000bdf) magic=0x00000000 MDR 34 NR=12 (00000c) RS=3 magic=0x00000000 35 NR=0 (000000) RS=3 magic=0x00000000 36 NR=0 (000000) RS=4 magic=0x00000000 MDR 37 NR=2194204(217b1c) RS=23 magic=0x00000000 MDR 38 NR=17120 (0042e0) RS=40 magic=0x00000033 39 NR=0 (000000) RS=22 magic=0x00000000 40 DS=0 (00000000) magic=0x00000000 Ticker
Index: src/test/display/MdrSummary.java =================================================================== --- src/test/display/MdrSummary.java (revision 611) +++ src/test/display/MdrSummary.java (working copy) @@ -33,8 +33,8 @@ private final boolean[] wanted = new boolean[NSECT]; protected void print() { - reader.position(21); - + readHeaderLen(); + readHeader(); Section end = new Section("END OF FILE", filelen, 0); @@ -93,15 +93,18 @@ private void printDetails() { int number = 0; for (Section s : sections) { - if (s != null && s.getLen() > 0) { - System.out.printf("MDR %-2d ", number); + if (s != null) { + if (s.getLen() > 0) + System.out.printf("MDR %-2d ", number); + else + System.out.printf(" %-2d ", number); if (s.getRecordSize() > 0) - System.out.printf("NR=%-6d(%06x) RS=%-2d ", + System.out.printf("NR=%-7d(%06x) RS=%-2d ", s.getNumberOfRecords(), s.getNumberOfRecords(), s.getRecordSize()); else - System.out.printf("DS=%-9d(%08x) ", s.getLen(), s.getLen()); + System.out.printf("DS=%-10d(%08x) ", s.getLen(), s.getLen()); System.out.printf("magic=0x%08x\n", s.getMagic()); } @@ -114,7 +117,7 @@ int id1 = reader.get2u(); int id2 = reader.get2u(); int unk3 = reader.get2u(); - System.out.printf("codePage=%d id1=%d id2=%d unk=0x%04x\n", codePage, id1, id2, unk3); + System.out.printf("codePage=%d id1=%d id2=%d unk=0x%04x hdrLen=%d\n", codePage, id1, id2, unk3, getHeaderLen()); addSection(1, true, true); addSection(2, true, true); @@ -137,8 +140,7 @@ addSection(17, false, true); addSection(18, true, true); addSection(19, true, true); - if (getHeaderLen() <= 286) // 0x011e - return; + // seen headers stop here: 286 / 0x011e addSection(20, true, true); addSection(21, true, true); addSection(22, true, true); @@ -149,8 +151,7 @@ addSection(27, true, true); addSection(28, true, true); addSection(29, true, true); - if (getHeaderLen() <= 426) // 0x01aa - return; + // seen headers stop here: 426 / 0x01aa addSection(30, true, true); addSection(31, false, false); addSection(32, true, true); @@ -162,22 +163,21 @@ addSection(38, true, true); addSection(39, true, true); addSection(40, true, true); - //if (getHeaderLen() <= 568) // 0x0238 - // return; + // seen headers stop here: 568 / 0x0238 // looks like three sections, two with 4 ints, one with 5 ints - //if (getHeaderLen() <= 620) // 0x26c - // return; + // seen headers stop here: 620 / 0x26c // mostly zeros - //if (getHeaderLen() <= 668) // 0x029c - // return; + // seen headers stop here: 668 / 0x029c // possibly some sections, but mostly zeros so difficult to tell - //if (getHeaderLen() <= 700) // 0x02bc - // return; + // seen headers stop here: 700 / 0x02bc + // seen headers stop here: 708 / 0x02c4 // at 0x02dc, maybe 5 sections without magic or recsize - // haven't seen anything after 772 0x0304 + // not seen anything after 772 / 0x0304 } private Section addSection(int n, boolean withReclen, boolean withMagic) { + if (reader.position() >= getHeaderLen()) + return null; long start = reader.get4(); int len = reader.get4();
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev