Changeset 1747 for trunk/tools
- Timestamp:
- Feb 2, 2023, 1:50:37 PM (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/fix-cmc-patterns.pl
r1746 r1747 7 7 if (/^TYPE C\r\nMUSIC (\w{4})\r\n/m) { 8 8 my $music = hex($1); 9 my $ff = index $_, "\xff\xff"; 10 my ($start, $end) = unpack("x${ff}xxvv", $_); 11 if ($start == $music) { 12 # printf "MUSIC %04X START %04X END %04X %s\n", $music, $start, $end, $f; 13 my $o = $_; 14 for my $p (0 .. 63) { 15 my ($l, $h) = unpack("x${ff}x26x${p}Cx63C", $_); 16 if ($h == 0xff && $l != 0xff) { 17 printf "pattern %02x at %02x%02x %s\n", $p, $h, $l, $f; 18 die if substr($_, $ff + 26 + $p, 1) ne chr($l); 19 substr($_, $ff + 26 + $p, 1, "\xff"); 9 my $i = 2 + index $_, "\xff\xff"; 10 while ($i < length) { 11 my ($start, $end) = unpack("x${i}vv", $_); 12 # printf "MUSIC %04X START %04X END %04X %s\n", $music, $start, $end, $f; 13 if ($start == $music) { 14 my $o = $_; 15 for my $p (0 .. 63) { 16 my ($l, $h) = unpack("x${i}x24x${p}Cx63C", $_); 17 if ($h == 0xff && $l != 0xff) { 18 printf "pattern %02x at %02x%02x %s\n", $p, $h, $l, $f; 19 die if substr($_, $i + 24 + $p, 1) ne chr($l); 20 substr($_, $i + 24 + $p, 1, "\xff"); 21 } 20 22 } 23 if ($_ ne $o) { 24 open F, ">../$f" and binmode F and print F $_ or die; 25 } 26 last; 21 27 } 22 if ($_ ne $o) {23 open F, ">../aasma/$f" and binmode F and print F $_;24 }25 }26 else {27 28 printf "MUSIC %04X START %04X END %04X %s\n", $music, $start, $end, $f; 29 $i += 5 + $end - $start; 30 print "MUSIC block not found in $f\n" if $i >= length; 28 31 } 29 32 }
Note: See TracChangeset
for help on using the changeset viewer.