rofl0r / agsutils

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

applications only work in current directory of the game #26

Closed i30817 closed 2 years ago

i30817 commented 2 years ago

Long story short, i tried to invoke agsex from a parent dir containing the scripts to a game dir and extraction dir children.

It broke a lot.

First the script agsex, where I changed BINDIR=$(dirname $(readlink -f "$0")) -> BINDIR="$(dirname "$(readlink -f "$0")")" and

$BINDIR/agstract "$GAME" "$FILES"
$BINDIR/agscriptxtract "$FILES" "$OBJS"

->

"$BINDIR"/agstract "$GAME" "$FILES"
"$BINDIR"/agscriptxtract "$FILES" "$OBJS"

Then it broken in agsextract and i gave up and tried to execute in the same directory as the executable (of the game). Behold, it worked. Maybe it's best to detect this case and warn it's not supported before exiting.

rofl0r commented 2 years ago

the changes you made suggest you were using a directory name with spaces in it, which seems unrelated to "current directory". but if you can be more specific to what exactly the breakage was, we can look into fixing it. (and yes, i never use directory names with spaces in it, because it breaks all sorts of tooling)

i30817 commented 2 years ago

Yes, it had spaces, like the game has. Personally i don't think it's a step too far to request that scripts don't break with spaces, but that was a easy fix, the main 'problem' manifested if i tried to pass the game executable argument as a file not on the current directory, which broke on agsextract, spaces or not.

When i tried it on the current directory of the executable, still with spaces, it worked.

rofl0r commented 2 years ago
$ agstract  artoftheft/artoftheft.exe ~/shm/TMP
:::AGStract 0.9.8 by rofl0r:::
artoftheft/artoftheft.exe: mfl version 15, containing 87 files.
music1.mid -> /home/user/shm/TMP/music1.mid
music10.mid -> /home/user/shm/TMP/music10.mid
music11.mid -> /home/user/shm/TMP/music11.mid
...

works for me

i30817 commented 2 years ago

Maybe i shouldn't have said 'spaces or not' the first time.

Here:

i3@sleipnir:~/Downloads/Ashina the Red Witch/wtf$ ./agsex "game/ATRW.exe" game/ script/
:::AGStract 0.9.8 by rofl0r:::
error opening mfl datafile ATRW.001
error opening game/ATRW.exe

I just find it strange that it would break with a space on relative paths when if i then 'cd game' and tried again with ../agsex "./ATRW.exe" . ../script/ it would work

rofl0r commented 2 years ago

ok so the issue seems to be with multifile lib split into .exe, .001, etc parts. i'll look around if i can find such a game in my collection to reproduce.

i30817 commented 2 years ago

There is a demo of the game on the dev itch.io page if you haven't found one. 180 mb though - the demo is not smaller than the game, in fact i bet they're the same data with the executable with a 'demo' flag turned on and baked in statically.

Also you need a recent AGS to run it, i reported a thing that was bugfixed (AGS 3.6.0 beta had a api in testing that was removed that this game uses because it was made with it).

rofl0r commented 2 years ago

thanks. i pushed a commit fixing this on the agstract side, let me know whether there are further issues, and feel free to open a PR with your changes to support filenames with spaces in them.

i30817 commented 2 years ago

No problems afaik, will open a PR.