Help with error "Returned output size is negative" and missing last file

Doubts, help and support about QuickBMS and other game research tools
Vuze
Posts: 16
Joined: Sun Dec 28, 2014 3:02 pm

Help with error "Returned output size is negative" and missing last file

Post by Vuze »

Hey,

I've tried to get my first QuickBMS script up and running today (I later found out that there is already a script for an older, slightly different version of the archive type I've been messing with... :roll: Good to gain some experience anyway) but neither mine nor an adapted version of the script I found fully work.

Issue a) the last file in an archive doesn't get extracted for some reason.
Issue b) for larger files, I get the "Returned output size is negative (-1)" error and I just don't know why. The structure looks just like the files that work fine (sans issue a).

Here is the script (adapted some stuff from the other one):

Code: Select all

idstring GFAC
get version long
get unknown1 long

get table_offset long
get table_size long
get data_offset long
get data_size long

goto data_offset
idstring GFCP
get unknown2 long
get unknown3 long
get extracted_size long
get compressed_size long

set compressed_offset data_offset
math compressed_offset + 0x14
comtype bpe

clog memory_file compressed_offset compressed_size extracted_size
goto table_offset
get file_count long
savepos read_offset

for i = 0 < file_count
goto read_offset
get unknown4 long
get name_offset long
get file_size long
get file_offset long
savepos read_offset

math file_offset - data_offset
goto name_offset
get file_name string
log file_name file_offset file_size memory_file
next i


Here are some example archives that work and some that don't. https://mega.co.nz/#!JYYXxb7Y!jYpbZa1tT ... ZMLKSpXWH0
I'd really appreciate your help :)
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Help with error "Returned output size is negative" and missing last file

Post by aluigi »

That's the kirby file format and my script works perfectly.
Are you sure you were not using an old version of that script?
The current one is 0.2: http://aluigi.org/papers/bms/others/kirby_epic_yarn.bms

Anyway, in reference to your script, the problem is simply that name_offset sometimes has the 0x80000000 flag used to tag some files.
"math name_offset & 0x00ffffff" solves the problem.
Vuze
Posts: 16
Joined: Sun Dec 28, 2014 3:02 pm

Re: Help with error "Returned output size is negative" and missing last file

Post by Vuze »

Ah fantastic!
No, I used a completely different script for some Wii game but everything except for the used compression seemed the same.
Thanks for the reply, everything works fine now

E: No, it doesn't -- all the example files that didn't work for me before still return output size is negative (-1) with your Kirby script. Or is something wrong with my QuickBMS setup?
E: Nevermind... I shouldn't have multiple versions of the same tool on my harddrive :oops: