Commit b4292f30 authored by Tobi's avatar Tobi

Fixed an issue with detecting size of single partition in multipartition binaries

parent ddbe632c
......@@ -48,7 +48,7 @@ int main(int argc, char *argv[]) {
ret = compress_pc_cmd(infile, outfile, optional, optional_val);
break;
case DECOMPRESS_FC_CMD:
printf("Decompressing '%s' to '%s' (FullComp)...\n", inname, outname);
printf("Decompressing '%s'@%08x to '%s' (FullComp)...\n", inname, optional ? optional_val : 0, outname);
ret = decompress_fc_cmd(infile, outfile, optional, optional_val);
break;
case DECOMPRESS_PC_CMD:
......@@ -61,7 +61,7 @@ int main(int argc, char *argv[]) {
break;
default: ret = help_cmd(this);
}
printf("Done.\n");
fclose(infile);
fclose(outfile);
return ret;
......
......@@ -184,24 +184,27 @@ unsigned char *uncompress_file_at(FILE *infile, int insize, long offset, int *ou
printf("Error: Unsupported algorithm: %04x\n", algo);
return 0;
}
*outsize = read_dword(infile);
insize_stored = read_dword(infile);
if((insize < insize_stored + HEADER_LEN)) {
printf("Error: File size is abnormal (is:%08x issh:%08x)\n", insize, insize_stored + HEADER_LEN);
printf("Error: File size is abnormal (filesize:%08x size_from_header:%08x)\n", insize, insize_stored + HEADER_LEN);
return 0;
}
/* read file to buffer*/
if(!prepare_char_buf(&inbuf, insize))
if(!prepare_char_buf(&inbuf, insize_stored))
return 0;
fread(inbuf, insize, 1, infile);
fread(inbuf, 1, insize_stored, infile);
/* Allocate memory for output buffer */
if(!prepare_char_buf(&outbuf, *outsize))
return 0;
/* uncompress via bfc lib */
LZ_Uncompress(inbuf, outbuf, insize);
LZ_Uncompress(inbuf, outbuf, insize_stored);
free(inbuf);
return outbuf;
......
......@@ -3,7 +3,7 @@
/* Application constants */
#define NAME "bfc4ntk"
#define VERSION "3.2"
#define VERSION "3.3"
#define BUILD_DATE __DATE__
#define AUTHOR "Tobi@s"
#define RELEASED_FOR " http://dc.p-mc.eu/\n http://www.goprawn.com/\n http://dashcamtalk.com/"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment