Created
June 16, 2023 02:08
-
-
Save ablakely/c008cf614f9d499d2579a8fca500c8f7 to your computer and use it in GitHub Desktop.
Script for converting Advance Map .map files to map.bin for use with decompiled Pokemon games
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# conv2mapbin.pl - Convert Advance Map exports to map.bin for use | |
# with decompiled Pokemon games. | |
# | |
# Written by Aaron Blakely <[email protected]> | |
use strict; | |
use warnings; | |
my $mapfile = $ARGV[0]; | |
my $mapbin = $ARGV[1]; | |
if (not defined $mapfile or not defined $mapbin) { | |
print "Usage: $0 <advancemap.map> <map.bin>\n\n"; | |
print "This program converts Advance Map exports to map.bin for use with decompiled Pokemon games.\n"; | |
print "Written by Aaron Blakely <aaron\@ephasic.org>\n"; | |
exit; | |
} | |
open (my $map, '<:raw', $mapfile) or die "Can't open $mapfile: $!"; | |
open (my $bin, '>:raw', $mapbin) or die "Can't open $mapbin: $!"; | |
my $buf; | |
read $map, $buf, 20; | |
while(read($map, $buf, 1024)) { | |
print $bin $buf; | |
} | |
close $map; | |
close $bin; | |
print "Done!\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment