From 27664a5634d04167b3a5a700a45131f0ffbf162a Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sun, 3 May 2015 01:13:51 +0200 Subject: Fix amount of chunks passed to decompressor in first page --- src/export/extract_version_2.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/export') diff --git a/src/export/extract_version_2.c b/src/export/extract_version_2.c index 68b05af..f39bf5d 100644 --- a/src/export/extract_version_2.c +++ b/src/export/extract_version_2.c @@ -346,7 +346,7 @@ static void decompress_subchunk( uint8_t * subchunk, size_t subchunk_size, int c err = decomp(&s); if( err ) { for( i=0; i<32; ++i ) fprintf( stderr, "%02X ", s.in[i] ); - fprintf( stderr, "\nError: %d\n", err ); + fprintf( stderr, "\nError: %d (%d chunks left at %08x)\n", err, chunks, (unsigned int)(subchunk) ); return; } @@ -384,7 +384,6 @@ int main( int args, char **argv ) { file = map_file( argv[1], 1 ); if( !file ) exit( 1 ); - fp = file->addr; num_subchunks = *(uint16_t*)(fp+0x14); subchunk_rest_count = *(uint16_t*)(fp+0x1c); @@ -394,7 +393,7 @@ int main( int args, char **argv ) { decode_19bit_address ( fp + 0x20, offsets, num_subchunks ); offsets[num_subchunks] = file->size; - decompress_subchunk( subchunk, offsets[i], subchunk_one_count, MAXWIN ); + decompress_subchunk( subchunk, offsets[0], subchunk_one_count + 1, MAXWIN ); for( i=0; i< num_subchunks; ++i ) if( offsets[i] + 0x800 < file->size ) -- cgit v1.2.3