Skip to content

Instantly share code, notes, and snippets.

@ablakely
Created June 16, 2023 02:08
Show Gist options
  • Save ablakely/c008cf614f9d499d2579a8fca500c8f7 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/perl
# conv2mapbin.pl - Convert Advance Map exports to map.bin for use
# with decompiled Pokemon games.
#
# Written by Aaron Blakely <aaron@ephasic.org>
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