MovingBlocks / DestinationSol

Official continuation of Destination Sol, the great fun little arcade space shooter from http://sourceforge.net/projects/destinationsol/ Modules live at https://github.com/DestinationSol/
Apache License 2.0
326 stars 123 forks source link

Game crashes on startup on M2 mac #687

Closed hesselink closed 10 months ago

hesselink commented 1 year ago

What you were trying to do

I downloaded the game using Steam on macos 13.5.2 (M2 mac). Then I clicked Play.

What actually happened

After starting, nothing happens. Looking in the game directory, I found a crash log (see below).

How to reproduce

No response

Game version

2.1.0

Log details

com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'libgdx-box2d64.dylib' for target: Mac OS X, 64-bit
        at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:120)
        at com.badlogic.gdx.physics.box2d.Box2D.init(Box2D.java:32)
        at org.destinationsol.SolApplication.<init>(SolApplication.java:132)
        at org.destinationsol.desktop.SolDesktop.main(SolDesktop.java:135)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: java.lang.UnsatisfiedLinkError: Can't load library: /var/folders/lw/33dwv_5s409dw0y3xy6_s71n0828yj/T/libgdx<MY_USER>/d01668c7/libgdx-box2d64.dylib
        at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:316)
        at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:116)
        ... 3 more
Caused by: java.lang.UnsatisfiedLinkError: Can't load library: /var/folders/lw/33dwv_5s409dw0y3xy6_s71n0828yj/T/libgdx<MY_USER>/d01668c7/libgdx-box2d64.dylib
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2408)
        at java.base/java.lang.Runtime.load0(Runtime.java:785)
        at java.base/java.lang.System.load(System.java:2011)
        at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:322)
        at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:291)
        ... 4 more

Operating System

MacOS

Additional Info

No response

Cervator commented 1 year ago

That's unfortunately due to being on an M2 (or M1 really) Mac :-( Thank you for including that information, that makes it very clear.

I'm not sure if there's a native lib ready for that OS flavor quite yet, but if there is then we might be able to fix it. @BenjaminAmos may be able to find out at some point 👍

BenjaminAmos commented 1 year ago

We'll need to use at least libGDX 1.11 for macOS ARM support (changelog). We're currently on 1.9.14. Upgrades in the past have been fairly trouble-free, so it shouldn't be too difficult.

BenjaminAmos commented 1 year ago

I've attempted to fix this with #689.

@hesselink If you've got time then I'd appreciate if you could test the changes and let me know if they work. You can get a build of the game with the M1/M2 changes here. To start the game, run the solOSX.sh script.

hesselink commented 1 year ago

@BenjaminAmos Thanks, that was quick! I've just tested it. There's a small typo in the shell script (an X missing from the jre directory name, I've commented on the relevant line). After fixing that, the game starts for me!

lectricas commented 10 months ago

any progress on this?

BenjaminAmos commented 10 months ago

The changes I proposed apparently work, so I'll try and give #689 another test this week and see if I can merge them in. I can't test that it works personally but it should work after that. The project is very slowly maintained on my part at the moment, unfortunately.

lectricas commented 10 months ago

@BenjaminAmos I've copypasted everything from this into my project and it compiled and started.

But now the buttons are messed up and I can't press them. Can you move me into the right directinon where to dig in?

Screenshot 2023-11-30 at 02 05 51
BenjaminAmos commented 10 months ago

I think you've just resized the game window to be too small. Can you make it a bit larger by dragging the window corners around?

Not being able to press the buttons at all is a bit concerning. Is the display using any sort of DPI scaling? There's some code that checks the display density on Android but I'm not sure if that code is used in the desktop build. https://github.com/MovingBlocks/DestinationSol/blob/0263edf91d32f00fead8ae7ca2e660c098a9ce18/engine/src/main/java/org/destinationsol/ui/nui/NUIManager.java#L174-L182

If all else fails, you can try to manually adjust the window size and scale by editing engine/src/main/resources/settings.ini. The x value is width and the y value is height. nuiUiScale is the UI scaling factor. I've previously found that 800x600 is the smallest playable resolution.