code-disaster / steamworks4j

A thin Java wrapper to access the Steamworks API
https://code-disaster.github.io/steamworks4j/
MIT License
468 stars 64 forks source link

Fix SteamLibraryLoaderGdx on macOS #133

Closed Rizato closed 6 months ago

Rizato commented 11 months ago

Behind the scenes, the libgdx loader extracts libsteam_api.dylib and libsteamworks4j.dylib into separate directories based on the CRC checksum of their contents. Unfortunately, libsteam_api.dylib has an install name of @loader_path/libsteam_api.dylib. When loading libsteamworks4j.dylib it expects libsteam_api.dylib to be in the same directory.

This patch hardcodes the result of crc() to 00000000. As a result, both libraries will be extracted inside <libgdx-path>/00000000/ and libsteamworks4j.dylib loads successfully.

Fixes #117

Rizato commented 11 months ago

Closing #130 as this solves the problem it tried to workaround.

Rizato commented 11 months ago

Tested on Windows, Intel Mac, and Steam Deck

Rizato commented 11 months ago

@noblemaster Could you try this out for me on an apple silicon mac? I still don't have access to one sadly, but I suspect this will work for you since the previous loader did.

noblemaster commented 11 months ago

Yes, it works on M2! Just merge it when you are ready. 😄

Rizato commented 11 months ago

Yes, it works on M2! Just merge it when you are ready. 😄

Awesome! Thanks.

Rizato commented 11 months ago

@code-disaster Any thoughts?

kr05 commented 7 months ago

This seems to be the solution I need. How can I test this as well?

code-disaster commented 6 months ago

I cherry-picked your change in f0cc286 and made a small adjustment in cb972c9 to remember and reuse the CRC of the first library extracted.