From efc0249958a2a74fe40b6a251cb2b45647a8b8ce Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Fri, 29 Nov 2019 09:56:21 +0800 Subject: [PATCH] Add ability to have multiple offset/size pairs for prefix 0xff style images (currently unused) --- scripts/FL2_copyIMG | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/FL2_copyIMG b/scripts/FL2_copyIMG index fa5caa2..d9e5338 100755 --- a/scripts/FL2_copyIMG +++ b/scripts/FL2_copyIMG @@ -183,8 +183,20 @@ sub _check { $self->{flag}{encrypted}="yes"; # All current examples of this format were encrypted - $self->set_offset_size(@{$known->{$self->{filesize}}}); - return $self->_check_copyright(); + # Loop through the known offset,size pairs for this filesize, + # looking for one that has a matching copyright + my $try_data = $known->{$self->{filesize}}; + while (scalar(@{$try_data})) { + my $try_offset = shift @{$try_data}; + my $try_size = shift @{$try_data}; + $self->set_offset_size($try_offset, $try_size); + + my $match = $self->_check_copyright(); + if ($match) { + return $match; + } + } + return undef; } sub extract {