Bumped prism version to 0.18.2 and overhauled native loader to avoid … - #3
Open
deathvelt wants to merge 1 commit into
Open
Bumped prism version to 0.18.2 and overhauled native loader to avoid …#3deathvelt wants to merge 1 commit into
deathvelt wants to merge 1 commit into
Conversation
…leaking the extracted directories in temp between runs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…leaking the extracted directories in temp between runs.
#1. Native loader.
The first thing that was refactored is native loader for a few reasons:
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.
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.
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.