/yyg_fix

A deep dive on the Raspberry Pi's GameMaker runner

Primary LanguageCOtherNOASSERTION

What is contained in this repository?

This is a set of fixes and shim libraries for the Raspberry Pi's GameMaker runner, allowing it to boot a number of different games like Spelunky, Nuclear Throne and others, and allowing for blacklisting unintended gamepads (such as sensors, unmapped generic controllers, etc).

  1. bcm_host: A shim half-implementing libbcm_host functions with SDL2.0 for OGA-like devices, forked from gamemaker-rpi-wrapper.
  2. yyg_fix: A series of fixes for the GameMaker runner, such as reimplementations of different GML functions, and joystick device blacklisting.
  3. patch.xdelta or patch.ips: A patch that removes a few unecessary sanity checks on the Raspberry Pi GameMaker runner, allowing you to boot games not specifically compiled for it.
  4. 16Or17To15: An experimental extension for downgrading .win and .unx GameMaker data files to v1.4.1084.

How did you do it?

Read my research document and find out!

Usage:

Either download a binary release from the releases page, or compile them with your favorite toolchain (you might need to edit the Makefile accordingly):

$ make

You'll also need a copy of the Raspberry Pi runners. You can find one freely available at the yoyogames server, (you might need to right click and select save as on some browsers). These are freeware and thus should not be redistributed, specially pre-patched.

Patch your runner. In this case, you can apply the ips patch with an online tool or the xdelta one with the following command on linux:

$ xdelta patch patch.xdelta TheyNeedToBeFed TheyNeedToBeFed_PATCHED

If the game is running Bytecode 16 or higher, you'll need to downgrade your .win or .unx file using the UndertaleModTool (UTMT) with the downgrader extension, the file must be renamed/saved as game.unx - regardless of version.

Copy the generated libcurl.so.4, libbcm_host.so and TheyNeedToBeFed_PATCHED to the root, and the game data on a folder named assets (including the .unx file) to your device, and then create the launch.sh script on your game folder, like this one (remember to uncomment the patchelf lines if necessary):

#!/bin/bash

cd "$(dirname "$0")"
export LD_LIBRARY_PATH=/usr/lib32:/usr/config/emuelec/lib32:$PWD
export LD_PRELOAD=$PWD/libbcm_host.so
export REMAPPER=rg351p-js2xbox

# Uncomment either of these lines depending on your OS of choice
# patchelf --set-interpreter /usr/lib32/ld-linux-armhf.so.3 TheyNeedToBeFed_PATCHED # For 351ELEC
# patchelf --set-interpreter /usr/config/emuelec/lib32/ld-linux-armhf.so.3 TheyNeedToBeFed_PATCHED # For EMUELEC

~/$REMAPPER &
./TheyNeedToBeFed_patched
killall -9 $REMAPPER

A good install, which will allow you to launch these games from EmulationStation, should look like this:

$ find /roms/ports/nthrone
/roms/ports/nthrone
/roms/ports/nthrone/assets
/roms/ports/nthrone/assets/<many ogg files>.ogg
/roms/ports/nthrone/assets/splash.png
/roms/ports/nthrone/assets/game.unx
/roms/ports/nthrone/libbcm_host.so
/roms/ports/nthrone/libcurl.so.4
/roms/ports/nthrone/TheyNeedToBeFed_PATCHED
/roms/ports/nthrone/launch.sh

You can also test it via SSH, using one of the two patchelf lines (if you're either on 351ELEC or EMUELEC):

$ patchelf --set-interpreter /usr/lib32/ld-linux-armhf.so.3 TheyNeedToBeFed_PATCHED # For 351ELEC
$ patchelf --set-interpreter /usr/config/emuelec/lib32/ld-linux-armhf.so.3 TheyNeedToBeFed_PATCHED # For EMUELEC
$ systemctl stop emustation.service
$ LD_LIBRARY_PATH=/usr/lib32:/usr/config/emuelec/lib32:$PWD LD_PRELOAD=libbcm_host.so ./TheyNeedToBeFed_PATCHED

Enjoy!

LICENSE:

This is free software. The source files in this repository are released under the Modified BSD License, see the license file for more information.