rofl0r / agsutils

contains utils for AGS: game extractor, repacker, disassembler and assembler
44 stars 14 forks source link

Executable footer changes in AGS 3.5.0 #15

Closed Tevo45 closed 3 years ago

Tevo45 commented 3 years ago

Hello, thanks for the tools! I've been trying to extract resources from a game compiled with AGS 3.5.0 without much success. The code seems to look for a small footer at the end of the file which contains the offset of the clib data followed by the string CLIB\x1\x2\x3\x4SIGE; on the AGS 3.5.0 game, the end string is there, but the offset are all 0s (Last'n'Furious used as the AGS 3.4.1 reference): AGS 3.4.1 game

            C  L  I  B              S  I  G  E
D1 0E 9A 00 43 4C 49 42 01 02 03 04 53 49 47 45
^^^^^^^^^^^

AGS 3.5.0 game

            C  L  I  B              S  I  G  E
00 00 00 00 43 4C 49 42 01 02 03 04 53 49 47 45
^^^^^^^^^^^
should be offset, it's 0s instead

If I hardcode the offset for the begginning of the clib block (which I found by searching for CLIB\x1A inside of the executable, in my case it was the 2nd occurence), extraction appears to work (though the extracted acsprset.spr does not extract with agsprite, and some of the music files do not play; that's probably a different issue though); I haven't yet looked at how the engine copes with those changes.

rofl0r commented 3 years ago

thanks for your report. i actually did some changes recently where i wished i had a 3.5 game around to test, but i couldn't find one. could you point me to the one you're using so i can see what's wrong ?

Tevo45 commented 3 years ago

Trying to extract https://1o111111.itch.io/noct191, although just building any of the AGS studio 3.5 templates as trying to extract it yields the same results.

rofl0r commented 3 years ago

although just building any of the AGS studio 3.5 templates

assuming one has windows with .net and can run the ags editor, indeed....

Trying to extract https://1o111111.itch.io/noct191

thanks, will look what's going wrong. my suspicion is that it has to do with the new 64bit file offset support...

rofl0r commented 3 years ago

fixed, please let me know whether the other mentioned issues persist. i will meanwhile look into whether my recent assumptions about 3.5 format hold true for the header extraction case....

Tevo45 commented 3 years ago

fixed, please let me know whether the other mentioned issues persist. i will meanwhile look into whether my recent assumptions about 3.5 format hold true for the header extraction case....

Thanks for the fixes! Extracting now works fine, and the music files all play without issues. acsprset.spr still doesn't extract with agsprite, but I'm going to do a little bit more digging and open another issue for that.

assuming one has windows with .net and can run the ags editor, indeed....

Hmm, AGS Studio 3.4.1 seems to at least load and build a project fine under wine, at least according to a report on WineHQ. Imagine it might be the same for 3.5.0 but don't have a UNIX box around to test right now. Either way, apologies for that.

rofl0r commented 3 years ago

Hmm, AGS Studio 3.4.1 seems to at least load and build a project fine under wine, at least according to a report on WineHQ.

well, i'm a bit of an odd-ball as i use my own linux distro based on musl libc, so it's not that easy. in particular, the only wine version i got to execute more or less correctly is about 7 years old but somehow fails to install .net properly, therefore the only ags editors i can use are < 3.0, i.e. 2.7.1, 2.6.2, etc.

Either way, apologies for that.

no worries.

rofl0r commented 3 years ago

pushed another fix, now it's also possible to disassemble the code of the game.

rofl0r commented 3 years ago

so agsprite not working is due to also a new spritecache format using 64 bit offsets introduced not too long ago. looking into adding support.

rofl0r commented 3 years ago

pushed some changes allowing the spritecache format 11 to be read. please let me know whether it works for you and if there are further issues.

Tevo45 commented 3 years ago

pushed some changes allowing the spritecache format 11 to be read. please let me know whether it works for you and if there are further issues.

Was about to open an issue on that; extracting sprites now works fine, disassembly also seems to work (I hadn't tried before), thanks!

well, i'm a bit of an odd-ball as i use my own linux distro based on musl libc, so it's not that easy.

The project does look pretty cool; I like some of the design decisions, like doing away with /usr and /sbin and having packages installed separately and symlinked in. Might check it out later, if I can get nouveau to cooperate with my GPU, but nice work.