Skip to content

Bumped prism version to 0.18.2 and overhauled native loader to avoid … - #3

Open
deathvelt wants to merge 1 commit into
minecraft-access:devfrom
deathvelt:native-loader
Open

Bumped prism version to 0.18.2 and overhauled native loader to avoid …#3
deathvelt wants to merge 1 commit into
minecraft-access:devfrom
deathvelt:native-loader

Conversation

@deathvelt

Copy link
Copy Markdown

…leaking the extracted directories in temp between runs.

#1. Native loader.
The first thing that was refactored is native loader for a few reasons:

  1. It was possible to funnel loading into a singular loadInternal function. While usually this would be too much functionality in 1 method, the former load windows, mac, and linux functions repeatedly performed the same operations, so it was possible to merge the duplications.
    We also use System.mapLibraryName to assemble the fileName now, and Prism.java was extended to bind getLoadFailure so that if loading fails, the consumer can log it.

  2. The old implementation had a confirmed bug within it where with each invocation of the loader, that is when rerunning the game, it would fail to delete the old folder in temp and thus leave the 1 megabyte extracted library(s) undeleted. This is because the folder was being registered but not the library inside it. Even when registering the library anyway, it failed to delete the remnants on windows.
    To remedy this we now extract to a singular deterministic directory, this being either the system property 'org.mcaccess.prism.nativeDir', or the appropriate folder (%localappdata% on windows, home/library/caches on mac, and xdg cache on linux) with a subdirectory based off prism's current version.

  3. If there's an opportunity to load the library without extracting, for example locally in a development environment, it will do so.

There's also a new include for prism_version.h in 0.18.2, so jextract can resolve.

PS. the version of prism was bumped to 0.18.2 since this is now the latest. Everything has been tested and confirmed working on my end.

…leaking the extracted directories in temp between runs.
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

Successfully merging this pull request may close these issues.

1 participant