From d6de63eafdb806fd3c1e4cf9ae1a65105c0d0d8d Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 8 Oct 2014 10:41:41 -0400 Subject: generate the entire chr data --- lib/Games/NES/SpriteMaker.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Games/NES/SpriteMaker.pm b/lib/Games/NES/SpriteMaker.pm index 3b4168e..7582338 100644 --- a/lib/Games/NES/SpriteMaker.pm +++ b/lib/Games/NES/SpriteMaker.pm @@ -5,7 +5,9 @@ use warnings; use Image::PNM; sub image_to_sprite { - my ($data) = @_; + my ($data, %opts) = @_; + + $opts{rom_size} ||= 8192; my $image = Image::PNM->new($data); if ($image->width % 8 || $image->height % 8) { @@ -41,7 +43,7 @@ sub image_to_sprite { } } - return $bytes; + return $bytes . ("\x00" x ($opts{rom_size} - length($bytes))); } sub _get_palette_colors { -- cgit v1.2.3