rofl0r / agsutils

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

Scripts extraction and injection #29

Closed ghylard closed 2 years ago

ghylard commented 2 years ago

Hello

I use AGSUtils to solve some problems in the translation of AGS games but I found some problems in the use of the tools agscriptxtract.exe and agsinject.exe

agscriptxtract: Sometimes the tool works perfectly to extract the scripts like for the game Resonance and other times no extraction is done like for Old Skies Demo.

agsinject: I have never been able to get this tool to work despite the appearance of a message like this: injecting OBJ/room1.o into FILES/room1.crm as 0'th script ...OK The verification of the target file allows me to see that despite this message it has not been modified.

The problems with these 2 tools force me to extract and reinsert the scripts manually with a hexadecimal editor using the SCOM and FE CA EF BE pointers to delimit the script. For the reinsertion, I must also modify the size of the script located just before SCOM.

rofl0r commented 2 years ago

no extraction is done like for Old Skies Demo

do you have link to this game ? also what is output you get ?

The verification of the target file allows me to see that despite this message it has not been modified.

is this on windows using the provided binaries ?

ghylard commented 2 years ago

Old Skies demo can be downloaded from Steam When I run the command agscriptxtract FILES OBJ, I have no message. This command creates only the OBJ directory. This same command works perfectly with the Resonance game. For the injection of the scripts in the rooms or the dta file, I actually use the binaries provided for Windows.

rofl0r commented 2 years ago

i dont have steam account, would you mind attaching the download to this issue ?

i have to check if something is wrong with agsinject.exe on m$ winblows.

ghylard commented 2 years ago

Here is the link to get Old Skie Demo: Demo I also found the same problem of extracting scripts with Unavowed, another game from Wadjet Eye.

rofl0r commented 2 years ago

old sky demo is made using a very recent AGS engine, and they did doctor around at their data formats again :/ they're using overly long gui event names, which uses a restriction removal that was done in 3.4 engine which i didn't notice. i now added better error reporting to agscriptxtract and made it so the process goes on when some inessential parts cant be properly processed, this should make the tool somewhat future proof. i'll still need to look into what exactly they changed this time, and why agsinject for you isnt working. if you already want to enjoy the changes i did, git pull the repo, and use cygwin to compile it. this might also fix the agsibject issue for you, as cygwin has a proper implementation of mmap(), which is used by the tool.

rofl0r commented 2 years ago

i think i fixed all issues. please try attached binaries. winup.zip

ghylard commented 2 years ago

Script extraction on Old Skies and Unavowed works correctly.

Script injection does not work and causes the following message:

agsinject 0 OBJ/room1.o FILES/room1.crm injecting OBJ/room1.o into FILES/room1.crm as 0'th script ...rename failed from C:\Users\XXXXXX\AppData\Local\Temp\ctm00001.tmpagsinjec00000d4872844e36 to FILES/room1.crm FAIL error: File exists

rofl0r commented 2 years ago

error: File exists

sad, i hoped it's wine bug. well, i spent 2 hours debugging this on my side and couldnt fix it. at least now you can manually copy the temp file to its destination without resorting to hex editor.

ghylard commented 2 years ago

Getting the temp file and renaming it to roomxx.crm makes things a bit more complicated, but it's still much easier than working with a hex editor to reinsert the script. Thank you for these updates.

rofl0r commented 2 years ago

i managed to finally fix the rename stuff on windows, see https://github.com/rofl0r/agsutils/releases/tag/v0.9.9