Post by paulwratt on Nov 16, 2016 6:30:57 GMT
Some of you (6) may have noticed I deleted a post from a week ago, on Devuan Pi that stuff still holds true, but..
To get OpenTyrian running on a Pi console, the only real issue is the selected Video mode/size. HDMI and AV-out on rpi support 640x480 (not OT default 640x400) so you just need to add a line into src/video_scale.c. I added the following:
In the end I did not use either the official OT source packages, or an OT repo download. I grabbed the .zip from DietPi site, in dietpi.com/downloads/binaries/rpi/, which is where I found out about OT.
Their source has a hyper-clean Makefile, and the src itself is much cleaner, with only 2x warnings, which are also easily cleaned up. It also already comes with the data dir, and unpacks to /usr/local/games/opentyrian (including src).
Their supplied binary is arm6, which will run on Pi Zero, Pi, Pi 2 (and may run on Pi 3). But I want more speed so I re-compiled for arm7 for Pi 2 (and Pi 3), using CFLAGS from RetroPie setup scripts (sdl1.sh):
To run OpenTyrian, you need to be in the same directory, so I added (works ootb for Devuan too) /usr/local/games/opentyrian/run :
OK, that was for most OS's (Jessie, and Wheezy too). What happens if you have issues, like I did with Devuan Pi.
Errors with sound sub systems in SDL are usually cause when only 1024 "samples" (or less) are allocated (thats a sound buffer) instead of 2048 "samples". There are various files that set the default "samples", one in /etc, and one in /lib or /usr/lib. The fix is always bumping "samples" to at least 2048 (sometimes on x86, 4096). On Devuan Pi, X (any window size for OT) using Pulseaudio (the default sound driver) only ever allocated 1024 "samples". But forcing the ALSA sound driver in SDL will get the required 2048 "samples".
On Raspberry Pi there is a better SDL1.2 build option (from source) for console use, RetroPie sdl1 repo with --enable-video-dispmanx driver: github.com/RetroPie/sdl1
Build SDL with plain "./configure" then edit CFLAGS (from this page) and prefix dir (to /usr) in Makefile, then run "make -j 4". You may need to move /usr/lib/libSDL* to /usr/lib/arm-linux-gnueabihf/ like I did on Devuan Pi.
You can now run (faster) from the console with:
Pi (and Pi Zero) gcc CFLAGS build (make):
Pi 3 gcc CFLAGS build (make -j 4):
Cheers
Paul
To get OpenTyrian running on a Pi console, the only real issue is the selected Video mode/size. HDMI and AV-out on rpi support 640x480 (not OT default 640x400) so you just need to add a line into src/video_scale.c. I added the following:
{ 640, 480, NULL, nn_16, nn_32, "PiCon2x" },
{ 640, 480, NULL, scale2x_16, scale2x_32, "ScalePiCon2x" },
{ 640, 480, no_scale, nn_16, nn_32, "PiConsole" },
In the end I did not use either the official OT source packages, or an OT repo download. I grabbed the .zip from DietPi site, in dietpi.com/downloads/binaries/rpi/, which is where I found out about OT.
Their source has a hyper-clean Makefile, and the src itself is much cleaner, with only 2x warnings, which are also easily cleaned up. It also already comes with the data dir, and unpacks to /usr/local/games/opentyrian (including src).
Their supplied binary is arm6, which will run on Pi Zero, Pi, Pi 2 (and may run on Pi 3). But I want more speed so I re-compiled for arm7 for Pi 2 (and Pi 3), using CFLAGS from RetroPie setup scripts (sdl1.sh):
CFLAGS = -O2 -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
you will also need to use "make -j 4 release" otherwise it will fail (-j 4 is gcc use 4 cores) due to -Werrors (without cmdline option release)To run OpenTyrian, you need to be in the same directory, so I added (works ootb for Devuan too) /usr/local/games/opentyrian/run :
# echo "cd /usr/local/games/opentyrian && ./opentyrian &" > run
# chmod a+x run
That will also work from a menu item too. This may also work in dash (default bash on Devuan) if there is a /usr/local/share/man/man6/opentyrian.6 file.OK, that was for most OS's (Jessie, and Wheezy too). What happens if you have issues, like I did with Devuan Pi.
cd /usr/local/games/opentyrian && SDL_AUDIODRIVER=alsa ./opentyrian &
There is an issue with Pulseaudio crashing on the way out on some OS's, Devuan Pi uses Debian 8 armhf (arm7) SDL1.2 binaries. Other OS's may work fine with "SDL_AUDIODRIVER=pulse". Pulseaudio is auto-detected before all others, so you may need "unset SDL_AUDIODRIVER" instead.Errors with sound sub systems in SDL are usually cause when only 1024 "samples" (or less) are allocated (thats a sound buffer) instead of 2048 "samples". There are various files that set the default "samples", one in /etc, and one in /lib or /usr/lib. The fix is always bumping "samples" to at least 2048 (sometimes on x86, 4096). On Devuan Pi, X (any window size for OT) using Pulseaudio (the default sound driver) only ever allocated 1024 "samples". But forcing the ALSA sound driver in SDL will get the required 2048 "samples".
On Raspberry Pi there is a better SDL1.2 build option (from source) for console use, RetroPie sdl1 repo with --enable-video-dispmanx driver: github.com/RetroPie/sdl1
Build SDL with plain "./configure" then edit CFLAGS (from this page) and prefix dir (to /usr) in Makefile, then run "make -j 4". You may need to move /usr/lib/libSDL* to /usr/lib/arm-linux-gnueabihf/ like I did on Devuan Pi.
You can now run (faster) from the console with:
cd /usr/local/games/opentyrian && SDL_VIDEODRIVER=dispmanx SDL_AUDIODRIVER=alsa ./opentyrian
Pi (and Pi Zero) gcc CFLAGS build (make):
CFLAGS = -O2 -mfpu=vfp -march=armv6j -mfloat-abi=hard
Pi 3 gcc CFLAGS build (make -j 4):
CFLAGS = -O2 -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard
Cheers
Paul