Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restoring exe stub after repack #16

Closed
kennyfortune opened this issue Jul 2, 2021 · 2 comments
Closed

restoring exe stub after repack #16

kennyfortune opened this issue Jul 2, 2021 · 2 comments

Comments

@kennyfortune
Copy link

kennyfortune commented Jul 2, 2021

After packing ,i try to run the game and an Microsoft error message shows that it cannt run because of Version mismatch and contact the author

Readme mentions that
the new "exe" will miss the original windows exe stub, but is
compatible with the opensource AGS engine, as well as with scummvm ags port.
that way, a game is about 500 KB smaller after extract and repack as it originally was.

It is the reason why it cannt run correctly after packing?
How can i make it correctly?

@rofl0r
Copy link
Owner

rofl0r commented Jul 2, 2021

the directory you specified when unpacking contains a file called agspack.exestub which contains the exe that was prepended to the original game data.

so, assuming that you packed the modified data into a file called game.ags you can make the game redistributable using the command cat agspack.exestub game.ags > newgame.exe in a shell (either linux shell or cygwin shell).

the packer currently doesn't restore the exe stub automatically because the game.ags file can be loaded just fine into any standalone AGS engine version (and that's the only way to play the game on linux anyway, unless you use wine, so auto-prepending the stub would just make the game file larger without any benefit).
i'll look into adding an option that restores the exe stub automatically.

@rofl0r rofl0r changed the title how can i restoring exe stub after repack Jul 2, 2021
@rofl0r rofl0r closed this as completed in e4cd01a Jul 2, 2021
@rofl0r
Copy link
Owner

rofl0r commented Jul 2, 2021

actually i was wrong about being able to just cat the stub and the data into a combined file; as AGS tries to locate the start of the data via an "end signature" containing the offset, rather than just searching for the start signature, so doing it manually as i suggested would involve using a hex editor to change the offset 16 bytes before the end as a 4 byte little endian value to contain the size of the .exestub file.
since this is impractical for casual users, i now added the -e option to agspack which does everything automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants