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

Support games in LZH archives #3033

Merged
merged 5 commits into from
Nov 11, 2023
Merged

Support games in LZH archives #3033

merged 5 commits into from
Nov 11, 2023

Conversation

Ghabry
Copy link
Member

@Ghabry Ghabry commented Jun 12, 2023

That is the archive format used by the "Create Game Disk" feature of the editor

This is totally not production ready. Needs code cleanup, (android support?), encoding detection etc.

Also new library needed (lhasa), so infrastructure work etcpp.

simplescreenrecorder-2023-06-12_15.52.34.mp4

@Ghabry
Copy link
Member Author

Ghabry commented Jun 12, 2023

it was mentioned that LZH files created through the game disk feature contain duplicates when the RTP is embedded.

Open source tools do not show the first entry in the archive (but Ark becomes confused with the stats and shows compressed size of first entry and decompressed size of second entry).

The rule appears to be "Latest File Wins".

The RTP assets are also the first things added to the archive so this could be even a feature of the format? Similiar to tar which was originally designed for archives on tape where seeking is hard to do. So instead of overwriting the file you just append it again...

@fdelapena fdelapena added UX For issues affecting the user experience, such annoyances, counter-intuitive or ugly design Enhancement labels Jul 5, 2023
@Ghabry Ghabry force-pushed the lzh branch 3 times, most recently from 9ae5043 to 2ac8dce Compare July 27, 2023 16:56
Encode converts to UTF-8 and Decode from UTF-8.

These functions in liblcf need a better name or a documentation comment.
@Ghabry Ghabry marked this pull request as ready for review October 25, 2023 21:28
@Ghabry Ghabry changed the title WIP: Support games in LZH archives Support games in LZH archives Oct 25, 2023
@jetrotal
Copy link
Contributor

Cool! Will test it right now!

Random question, Is possible to tell player.exe to autoload a lzh file, instead of displaying a list of games?

Someone asked me recently if it was possible to hide better the contents of their game, and I thought about something similar to the default game loading when using the webplayer.

That + allowing people to customize the extension of the file to be something other than .lzh could be cool for that.

@Ghabry
Copy link
Member Author

Ghabry commented Oct 25, 2023

There is currently no way to test it because our buildscripts lack the library (and vcpkg does not have the package merged yet but I got it approved this week).

Better readable with a non-whitespace diff: https://github.com/EasyRPG/Player/pull/3033/files?w=1


Random question, Is possible to tell player.exe to autoload a lzh file, instead of displaying a list of games?

Some silly approach (That will need a launch script) is: Append the ZIP to the EXE file, then use zip -A.

Linux code for this:

cat Player.exe game.zip > Player_with_game.exe
zip -A Player_with_game.exe

Then launch this through a start script:

./Player_with_game.exe --project-path Player_with_game.exe

Though you can still open the exe as a zip archive with any competent ZIP viewer so I don't know if this really helps ^^'

@fdelapena fdelapena added this to the 0.8.1 milestone Oct 27, 2023
Copy link
Contributor

@fdelapena fdelapena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely needs to update the README.md before merging. Thanks!

lhasa will need to be provided with enough time by downstream packagers if want to support this feature on existing distros that package easyrpg-player. Pinging earlier because this new package process usually takes some time as it is requested by a maintainer. It is required at least on Fedora. cc @suve

@Ghabry
Copy link
Member Author

Ghabry commented Oct 27, 2023

Oh and maybe an explanation why libarchive, which is packaged almost everywhere, is not used:

I implemented it for the Player but it always started to fail when there was anything non-Unicode involved.

It's heavy usage of C locales and charset conversion makes it unusable for us: C locales are badly supported on some platforms we support and the charset conversion is a problem.

We do not know the charset beforehand and have to guess it and libarchive has no option to get a raw filename back (and pass them to ICU for guessing the charset). It will always send the string through some conversion code. That API design makes it unfortunately unusable for us.

There is a longstanding issue from 2015 about this libarchive/libarchive#587

(also remove dirent from it as is not used anymore)
@fdelapena fdelapena merged commit a78768b into EasyRPG:master Nov 11, 2023
12 checks passed
@Ghabry Ghabry deleted the lzh branch September 2, 2024 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement UX For issues affecting the user experience, such annoyances, counter-intuitive or ugly design
Development

Successfully merging this pull request may close these issues.

3 participants