Page 1 of 1

pixel dungeon on raspberry?

Posted: Sat Apr 18, 2020 3:14 am
by darrensu
I am confuse that is raspberry can run pixel dungeon? If it can.How to do that?

Re: pixel dungeon on raspberry?

Posted: Sat Apr 18, 2020 1:57 pm
by bfready
Hi, darrensu.

The desktop version of pixel dungeon is a java game, so I tried running it on Java 1.8.0_250, but it errored out, complaining about libgdxarm.so:

Code: Select all

pi@raspberrypi:~/Java/jdk1.8.0_251/bin $ java -jar desktop-1.7.2a-1.jar
Exception in thread "main" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'libgdxarm.so' for target: Linux, 32-bit
	at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:117)
	at com.badlogic.gdx.utils.GdxNativesLoader.load(GdxNativesLoader.java:34)
	at com.badlogic.gdx.backends.lwjgl.LwjglNativesLoader.load(LwjglNativesLoader.java:47)
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication.<init>(LwjglApplication.java:76)
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication.<init>(LwjglApplication.java:64)
	at com.watabou.pd.desktop.DesktopLauncher.main(DesktopLauncher.java:47)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Unable to read file for extraction: libgdxarm.so
	at com.badlogic.gdx.utils.SharedLibraryLoader.readFile(SharedLibraryLoader.java:126)
	at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:261)
	at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:115)
	... 5 more
So I tried search for libgdxarm.so using sudo apt-get install libgdx[tab] to see if it populates the rest of the library name. It didn't, so I then search this forum for libgdxarm and found several posts.. talking about workarounds and installing other programs. To be honest, I got kind of lost after this.

I'm guessing if you install Java 1.8.0_250 and get that libgdxarm.so library working, Pixel Dungeon should work...

This is a guess though. I'm still fairly new to all this myself. If you do get it working, please share how you did it.

I hope this helps.

Re: pixel dungeon on raspberry?

Posted: Sat Apr 18, 2020 4:02 pm
by darrensu
Well,I try to download this game on snap.But when i run the game ,it says:

Code: Select all

ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
/snap/shattered-pixel-dungeon/180/bin/padsp: 84: exec: /snap/shattered-pixel-dungeon/180/usr/lib/jvm/java-8-openjdk-amd64/jre//bin/java: not found
And I think that the problem is on last line:java-8-openjdk-amd64/jre//bin/java: not found.Is this game really need java-8-openjdk-amd64?Or can I use another way to open it.

Re: pixel dungeon on raspberry?

Posted: Sat Apr 18, 2020 4:25 pm
by ptitSeb
You need to install/build libgdx, then take your libgdx.so binary, rename it to libgdxarm.so, and insert it in the .jar (it's a zip file). You may need to also add libgdx-freetype.so renamed as libgdx-reetypearm.so and libjinput-linux.so and libjwjgl.so in the JAR.
(This is how I have done it on Pandora, it should work the same way on the Pi)

Re: pixel dungeon on raspberry?

Posted: Sat Apr 18, 2020 4:45 pm
by darrensu
bfready wrote:
Sat Apr 18, 2020 1:57 pm
Hi, darrensu.

The desktop version of pixel dungeon is a java game, so I tried running it on Java 1.8.0_250, but it errored out, complaining about libgdxarm.so:

Code: Select all

pi@raspberrypi:~/Java/jdk1.8.0_251/bin $ java -jar desktop-1.7.2a-1.jar
Exception in thread "main" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'libgdxarm.so' for target: Linux, 32-bit
	at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:117)
	at com.badlogic.gdx.utils.GdxNativesLoader.load(GdxNativesLoader.java:34)
	at com.badlogic.gdx.backends.lwjgl.LwjglNativesLoader.load(LwjglNativesLoader.java:47)
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication.<init>(LwjglApplication.java:76)
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication.<init>(LwjglApplication.java:64)
	at com.watabou.pd.desktop.DesktopLauncher.main(DesktopLauncher.java:47)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Unable to read file for extraction: libgdxarm.so
	at com.badlogic.gdx.utils.SharedLibraryLoader.readFile(SharedLibraryLoader.java:126)
	at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:261)
	at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:115)
	... 5 more
So I tried search for libgdxarm.so using sudo apt-get install libgdx[tab] to see if it populates the rest of the library name. It didn't, so I then search this forum for libgdxarm and found several posts.. talking about workarounds and installing other programs. To be honest, I got kind of lost after this.

I'm guessing if you install Java 1.8.0_250 and get that libgdxarm.so library working, Pixel Dungeon should work...

This is a guess though. I'm still fairly new to all this myself. If you do get it working, please share how you did it.

I hope this helps.
How can I run it on java1.8.0?I use the code

Code: Select all

pi@raspberrypi:~ $  java -jar ShatteredPD.Desktop.v0.7.5f.jar
Error: Unable to access jarfile desktop-1.7.2a-1.jar

Re: pixel dungeon on raspberry?

Posted: Sat Apr 18, 2020 5:07 pm
by bfready
Is shatterpd an add on or something?

Maybe you need the original?

http://pixeldungeon.watabou.ru/desktop/ ... 7.2a-1.jar

Since it's looking for that file, put it in the same directory as your ShatteredPD file and run it again?
After that, try running java -jar desktop-1.7.2a-1.jar to run that file by itself.

Re: pixel dungeon on raspberry?

Posted: Sat Apr 18, 2020 5:19 pm
by ptitSeb
shattered pixel dungeon is a fork of pixel dungeon. It's a separate JAR (that will need the same JAR injection as pixel dungeon)

Re: pixel dungeon on raspberry?

Posted: Sat Apr 18, 2020 7:05 pm
by bfready
ptitSeb wrote:
Sat Apr 18, 2020 4:25 pm
You need to install/build libgdx, then take your libgdx.so binary, rename it to libgdxarm.so, and insert it in the .jar (it's a zip file). You may need to also add libgdx-freetype.so renamed as libgdx-reetypearm.so and libjinput-linux.so and libjwjgl.so in the JAR.
(This is how I have done it on Pandora, it should work the same way on the Pi)
Hi, ptitSeb. Thanks for your help! Again!

I have added the following to the desktop-1.7.2a-1.jar file:
  • libgdxarm.so
    libgdx-freetypearm.so
    libjinput-linux.so
    libjwjgl.so
    libopenal.so
Which gets rid of the libgdxarm errors. It complains about the openal backend now. This is why I added the libopenal.so in there.

Code: Select all

pi@raspberrypi:~/Java/jdk1.8.0_251/bin $ java -jar desktop-1.7.2a-1.jar 
Exception in thread "main" java.lang.UnsatisfiedLinkError: 'int org.lwjgl.DefaultSysImplementation.getPointerSize()'
	at org.lwjgl.DefaultSysImplementation.getPointerSize(Native Method)
	at org.lwjgl.Sys.<clinit>(Sys.java:113)
	at org.lwjgl.openal.AL.<clinit>(AL.java:59)
	at com.badlogic.gdx.backends.lwjgl.audio.OpenALAudio.<init>(OpenALAudio.java:72)
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication.<init>(LwjglApplication.java:82)
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication.<init>(LwjglApplication.java:64)
Is there another lwjgl libopenal file that should be in there? I've also put all these SO files in the JAVAHOMEPATH/lib directory (just in case).

Re: pixel dungeon on raspberry?

Posted: Sat Apr 18, 2020 7:08 pm
by bfready
I was using lwjgl-3.2.3... Perhaps I need a different version?

There is no pre-compiled lwjgl-2.9.3 (next rev down) that I can find..

I tried compiling the source, but I am not sure I am doing it right because it uses "ant" rather than cmake and make.

If anyone get's any further, please share.

Re: pixel dungeon on raspberry?

Posted: Sat Apr 18, 2020 7:38 pm
by bfready
Ok, I downloaded an arm version of lwjgl from the web. I didn't realize there was a raspbian version in the repository. I found the lwjgl.so and openal.so in my /usr/lib/ directory, copied both into the pixel dungeon jar, ran it again and now it I see the pixel dungeon start screen! I haven't tried playing it yet...

Re: pixel dungeon on raspberry?

Posted: Sat Apr 18, 2020 7:42 pm
by bfready
Yep, it works. Works good too (so far). Sound, music, etc.

I'll do a step by step guide in a little bit if you still can't get it working, darrensu.

Really appreciate the help, ptitSeb!

Re: pixel dungeon on raspberry?

Posted: Sun Apr 19, 2020 12:30 am
by bfready
Here's a step by step tutorial on how I got Pixel Dungeon to work...
I'm new to this stuff, so if any of the resident "smart guys/gals" see anything wrong, feel free to chime in and I'll correct it.

Make the game directory:
Create a directory to place pixel dungeon and all the dependancies in:

open a terminal (it can be whatever name you want, but I chose PixelDungeon... because the game is PixelDungeon):

Code: Select all

mkdir PixelDungeon
Download PixelDungeon from:
http://pixeldungeon.watabou.ru/desktop/ ... 7.2a-1.jar

Java Runtime:
You need the Java JRE.. I thought I read somewhere that Raspbian Buster did not come with this preinstalled, so make sure you check.

This is the location and version of the Java I'm using:

Code: Select all

pi@raspberrypi:/usr/lib/jvm/java-11-openjdk-armhf/bin $ java -version
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Raspbian-1deb10u1)
OpenJDK Server VM (build 11.0.6+10-post-Raspbian-1deb10u1, mixed mode)
If you don't, it's easy enough to instal:

Code: Select all

sudo apt update
sudo apt install default-jdk
Dependancies:

You will need the following libraries to get this game to work...

libgdx.so
libgdx-freetype.so
libjinput.so
libjwjgl.so
libopenal.so


You will be adding these to the pixel dungeon jar file, so copy all the library files mentioned into one directory for easy access (~/PixelDungeon, for example).


libgdx - This is not in the Raspbian Repository, so you have to download this:
https://libgdx.badlogicgames.com/old-si ... -1.6.1.zip
Unzip this file somewhere and pull out 2 files:

/armeabi/libgdx.so <-- rename this to libgdxarm.so and copy it into one directory for easy access (~/PixelDungeon, for example).

/extensions/gdx-freetype/armeabi/libgdx-freetype.so <-- rename this to libgdx-freetypearm.so and put into one directory for easy access (~/PixelDungeon, for example)

The libjinput.so and liblwjgl.so library files are in the liblwjgl-java dependancy.

Code: Select all

sudo apt install liblwjgl-java
I found mine using the find command:

Code: Select all

pi@raspberrypi:/usr $ sudo find /usr/ -name liblwjgl.so
/usr/lib/jni/liblwjgl.so
pi@raspberrypi:/usr $ sudo find /usr/ -name libjinput.so
/usr/lib/jni/libjinput.so
pi@raspberrypi:/usr $ 
<-- rename libjinput.so to libjinput-linux.so and put both of these files into that easy access directory (~/PixelDungeon, for example)

The last file you need is libopenal.so:

Code: Select all

pi@raspberrypi:/usr $ sudo find /usr/ -name libopenal.so
/usr/lib/arm-linux-gnueabihf/libopenal.so
pi@raspberrypi:/usr $
<-- Put this file in with the rest of the files for easy access (~/PixelDungeon, for example).

Insert library files into JAR file:

Take all the .so [library file] files and ADD them to the desktop-1.7.2a-1.jar file in your easy access directory (~/PixelDungeon, for example).

If you are using xarchiver, you just double click on the desktop-1.7.2a-1.jar file and select ADD in the action menu.
Select 1 file at a time (xarchiver closes after each add for some reason):

libgdxarm.so <-- this was renamed from libgdx.so
libgdx-freetypearm.so <-- this was renamed from libgdx-freetype.so
libjinput-linux.so <-- this was renamed from libjinput.so
libjwjgl.so
libopenal.so


Run the game:

Goto ~/PixelDungeon/ (or wherever you put the jar and so files in)

Code: Select all

java -jar desktop-1.7.2a-1.jar
...and cross your fingers...

java should be a "global" command (don't need to goto the JRE binary directory to run it).

I hope this helps. There's a good chance I messed something up in this step by step.
Feel free to ask questions and I'll try to answer, and edit the procedure if needed.

Re: pixel dungeon on raspberry?

Posted: Sun Apr 19, 2020 7:18 am
by darrensu
I cannot find libjinput-linux.so and liblwjgl.so,where can I find?

Re: pixel dungeon on raspberry?

Posted: Sun Apr 19, 2020 3:50 pm
by bfready
You need the liblwjgl-java package installed to get the liblwjgl.so and libjinput.so files.
A note about the libjinput-linux.so file, I forgot to mention that this was libjinput.so renamed to libjinput-linux.so.
I will update my step-step reflecting this. Sorry for the confusion.

So, first install or confirm you have installed the liblwjgl-java package:

Code: Select all

pi@raspberrypi:~/Java/jdk1.8.0_251/bin $ sudo apt-get install liblwjgl-java
Reading package lists... Done
Building dependency tree       
Reading state information... Done
liblwjgl-java is already the newest version (2.9.3+dfsg-5).
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
After this, you need to find the 2 files you're looking for.

There are several places where library files go:

Code: Select all

/usr/lib/
/usr/lib/arm-linux-gnueabihf
/usr/local/lib/
I found mine here:

Code: Select all

pi@raspberrypi:~ $ cd /usr/lib/jni/
pi@raspberrypi:/usr/lib/jni $ ls -lrt
total 344
-rw-r--r-- 1 root root  13532 May  8  2018 libjinput.so
-rw-r--r-- 1 root root 333016 Dec 28  2018 liblwjgl.so
pi@raspberrypi:/usr/lib/jni $ 
Just in case you didn't know, there's a command you can use to find files. This is how I found them:

Code: Select all

pi@raspberrypi:/usr $ sudo find /usr/ -name libjinput.so
/usr/lib/jni/libjinput.so
pi@raspberrypi:/usr $ sudo find /usr/ -name liblwjgl.so
/usr/lib/jni/liblwjgl.so
pi@raspberrypi:/usr $ 
Keep in mind, the further away you are from the file you are looking for, recursively, the longer this command takes.

Don't forget, before adding those 2 files in the JAR, you need to rename that libjinput.so file to libjinput-linux.so

I hope this helps. Let me know what happens.

Re: pixel dungeon on raspberry?

Posted: Sun Apr 19, 2020 10:20 pm
by Phoenixbyrd
I keep getting this error, followed directions though. Not sure if I missed something?

java.lang.UnsatisfiedLinkError: /tmp/libgdxpi/1d358ec4/libgdxarm.so: /tmp/libgdxpi/1d358ec4/libgdxarm.so: cannot open shared object file: No such file or directory
at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2430)
at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2487)
at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2684)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2617)
at java.base/java.lang.Runtime.load0(Runtime.java:767)
at java.base/java.lang.System.load(System.java:1834)
at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:299)

Re: pixel dungeon on raspberry?

Posted: Sun Apr 19, 2020 10:59 pm
by DougieLawson
Everything in /tmp gets trashed at every reboot. So you need to re-install that libgdxarm library.

Re: pixel dungeon on raspberry?

Posted: Sun Apr 19, 2020 11:12 pm
by Phoenixbyrd
I'm sorry, I don't really understand this stuff. So delete everything out of the .jar file and put it back in again?

Re: pixel dungeon on raspberry?

Posted: Sun Apr 19, 2020 11:14 pm
by DougieLawson
No, it's simple. DON'T INSTALL in /tmp.

Re: pixel dungeon on raspberry?

Posted: Sun Apr 19, 2020 11:18 pm
by Phoenixbyrd
I'm not so sure it's that simple, I just dumped it into the .jar file with xarchiver using the add files tool, I see all the added files in with the other ones. I didn't put them into a tmp folder. At least not intentionally, maybe it was xarchiver? IDK.

Re: pixel dungeon on raspberry?

Posted: Sun Apr 19, 2020 11:28 pm
by Phoenixbyrd
Just deleted everything, redownloaded the two files, grabbed copies of the other three files and placed everything into the new .jar file and same results. I'm doing the directions correctly as written.

Anyone else having trouble or is this just an issue on my end?

Re: pixel dungeon on raspberry?

Posted: Sun Apr 19, 2020 11:39 pm
by DougieLawson
Dump the jar file in /usr/local and work from there.