diff --git a/ports/roguelight/Roguelight.sh b/ports/roguelight/Roguelight.sh index 54007e5a56..9ab79820ad 100644 --- a/ports/roguelight/Roguelight.sh +++ b/ports/roguelight/Roguelight.sh @@ -11,36 +11,39 @@ elif [ -d "$XDG_DATA_HOME/PortMaster/" ]; then else controlfolder="/roms/ports/PortMaster" fi -source $controlfolder/control.txt -export PORT_32BIT="Y" -export controlfolder -get_controls +source $controlfolder/control.txt [ -f "${controlfolder}/mod_${CFW_NAME}.txt" ] && source "${controlfolder}/mod_${CFW_NAME}.txt" +get_controls +# Variables GAMEDIR="/$directory/ports/roguelight" +GMLOADER_JSON="$GAMEDIR/gmloader.json" +TOOLDIR="$GAMEDIR/tools" # CD and set permissions cd $GAMEDIR > "$GAMEDIR/log.txt" && exec > >(tee "$GAMEDIR/log.txt") 2>&1 -$ESUDO chmod +x $GAMEDIR/tools/patchscript -$ESUDO chmod +x $GAMEDIR/tools/SDL_swap_gpbuttons.py -$ESUDO chmod +x $GAMEDIR/tools/xdelta3 -$ESUDO chmod +x $GAMEDIR/tools/splash -$ESUDO chmod +x "$GAMEDIR/gmloadernext.armhf" -export LD_LIBRARY_PATH="/usr/lib32:$GAMEDIR/lib:$LD_LIBRARY_PATH" +# Exports +export LD_LIBRARY_PATH="/usr/lib:$GAMEDIR/lib:$LD_LIBRARY_PATH" export SDL_GAMECONTROLLERCONFIG="$sdl_controllerconfig" -export PATCHER_FILE="$GAMEDIR/tools/patchscript" -export PATCHER_GAME="Roguelight" -export PATCHER_TIME="1 minute" +export controlfolder +export DEVICE_ARCH + +# Ensure executable permissions +$ESUDO chmod +x "$GAMEDIR/gmloadernext.aarch64" +$ESUDO chmod +x "$GAMEDIR/tools/patchscript" +$ESUDO chmod +x "$GAMEDIR/tools/splash" -# dos2unix in case we need it -dos2unix "$GAMEDIR/tools/patchscript" -dos2unix "$GAMEDIR/tools/SDL_swap_gpbuttons.py" +# Create saves directory +mkdir -p "$GAMEDIR/saves" # Check if patchlog.txt to skip patching if [ ! -f patchlog.txt ]; then + export PATCHER_FILE="$GAMEDIR/tools/patchscript" + export PATCHER_GAME="Roguelight" + export PATCHER_TIME="1 minute" if [ -f "$controlfolder/utils/patcher.txt" ]; then source "$controlfolder/utils/patcher.txt" $ESUDO kill -9 $(pidof gptokeyb) @@ -51,21 +54,15 @@ else pm_message "Patching process already completed. Skipping." fi -# Swap buttons -"$GAMEDIR/tools/SDL_swap_gpbuttons.py" -i "$SDL_GAMECONTROLLERCONFIG_FILE" -o "$GAMEDIR/gamecontrollerdb_swapped.txt" -l "$GAMEDIR/SDL_swap_gpbuttons.txt" -export SDL_GAMECONTROLLERCONFIG_FILE="$GAMEDIR/gamecontrollerdb_swapped.txt" -export SDL_GAMECONTROLLERCONFIG="`echo "$SDL_GAMECONTROLLERCONFIG" | "$GAMEDIR/tools/SDL_swap_gpbuttons.py" -l "$GAMEDIR/SDL_swap_gpbuttons.txt"`" - # Display loading splash if [ -f "$GAMEDIR/patchlog.txt" ]; then - [ "$CFW_NAME" == "muOS" ] && $ESUDO ./tools/splash "splash.png" 1 - $ESUDO ./tools/splash "splash.png" 2000 & + $ESUDO ./tools/splash "splash.png" 4000 & fi -$GPTOKEYB "gmloadernext.armhf" -c ./roguelight.gptk & -pm_platform_helper "$GAMEDIR/gmloadernext.armhf" - -#gmloadernext will use config.json -./gmloadernext.armhf -c "$GAMEDIR/gmloader.json" +# Assign configs and load the game +$GPTOKEYB "gmloadernext.aarch64" -c ./roguelight.gptk & +pm_platform_helper "$GAMEDIR/gmloadernext.aarch64" +./gmloadernext.aarch64 -c "$GMLOADER_JSON" -pm_finish +# Cleanup +pm_finish \ No newline at end of file diff --git a/ports/roguelight/port.json b/ports/roguelight/port.json index 6a5ae77dd8..2fce088441 100644 --- a/ports/roguelight/port.json +++ b/ports/roguelight/port.json @@ -9,7 +9,8 @@ "attr": { "title": "Roguelight", "porter": [ - "mattyj513" + "mattyj513", + "Fraxinus88" ], "desc": "The deeper you travel the darker it gets, and you only have your arrows to light the way.", "inst": "Download Roguelight (windows) from https://managore.itch.io/roguelight. Place Roguelight.exe into ports/roguelight.", @@ -21,7 +22,7 @@ "runtime": null, "reqs": [], "arch": [ - "armhf" + "aarch64" ] } } \ No newline at end of file diff --git a/ports/roguelight/roguelight/SDL_swap_gpbuttons.txt b/ports/roguelight/roguelight/SDL_swap_gpbuttons.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ports/roguelight/roguelight/game.port b/ports/roguelight/roguelight/game.port index d5e04da719..f7c37f308c 100644 Binary files a/ports/roguelight/roguelight/game.port and b/ports/roguelight/roguelight/game.port differ diff --git a/ports/roguelight/roguelight/gmloader.json b/ports/roguelight/roguelight/gmloader.json index d662e658e3..d64f955b1e 100644 --- a/ports/roguelight/roguelight/gmloader.json +++ b/ports/roguelight/roguelight/gmloader.json @@ -1,8 +1,12 @@ { "save_dir" : "saves", "apk_path" : "game.port", - "disable_depth" : true, "show_cursor" : false, "disable_controller" : false, + "disable_depth" : false, + "disable_extensions" : false, + "disable_rumble" : false, + "disable_texhack" : false, + "rumble_scale" : 4.0, "force_platform" : "os_windows" -} +} \ No newline at end of file diff --git a/ports/roguelight/roguelight/gmloadernext.aarch64 b/ports/roguelight/roguelight/gmloadernext.aarch64 new file mode 100644 index 0000000000..4d3bb77d74 Binary files /dev/null and b/ports/roguelight/roguelight/gmloadernext.aarch64 differ diff --git a/ports/roguelight/roguelight/gmloadernext.armhf b/ports/roguelight/roguelight/gmloadernext.armhf deleted file mode 100644 index 2aa730738f..0000000000 Binary files a/ports/roguelight/roguelight/gmloadernext.armhf and /dev/null differ diff --git a/ports/roguelight/roguelight/lib/arm64-v8a/libc++_shared.so b/ports/roguelight/roguelight/lib/arm64-v8a/libc++_shared.so new file mode 100644 index 0000000000..268934f5b3 Binary files /dev/null and b/ports/roguelight/roguelight/lib/arm64-v8a/libc++_shared.so differ diff --git a/ports/roguelight/roguelight/lib/arm64-v8a/libcompiler_rt.so b/ports/roguelight/roguelight/lib/arm64-v8a/libcompiler_rt.so new file mode 100644 index 0000000000..f167a0d011 Binary files /dev/null and b/ports/roguelight/roguelight/lib/arm64-v8a/libcompiler_rt.so differ diff --git a/ports/roguelight/roguelight/lib/arm64-v8a/libm.so b/ports/roguelight/roguelight/lib/arm64-v8a/libm.so new file mode 100644 index 0000000000..2af51edd93 Binary files /dev/null and b/ports/roguelight/roguelight/lib/arm64-v8a/libm.so differ diff --git a/ports/roguelight/roguelight/lib/armeabi-v7a/libc++_shared.so b/ports/roguelight/roguelight/lib/armeabi-v7a/libc++_shared.so deleted file mode 100644 index ef2f3501e8..0000000000 Binary files a/ports/roguelight/roguelight/lib/armeabi-v7a/libc++_shared.so and /dev/null differ diff --git a/ports/roguelight/roguelight/lib/armeabi-v7a/libcompiler_rt.so b/ports/roguelight/roguelight/lib/armeabi-v7a/libcompiler_rt.so deleted file mode 100644 index 8747b729b8..0000000000 Binary files a/ports/roguelight/roguelight/lib/armeabi-v7a/libcompiler_rt.so and /dev/null differ diff --git a/ports/roguelight/roguelight/lib/armeabi-v7a/libm.so b/ports/roguelight/roguelight/lib/armeabi-v7a/libm.so deleted file mode 100644 index ad61d58bd6..0000000000 Binary files a/ports/roguelight/roguelight/lib/armeabi-v7a/libm.so and /dev/null differ diff --git a/ports/roguelight/roguelight/lib/libcrypto.so.1.1 b/ports/roguelight/roguelight/lib/libcrypto.so.1.1 deleted file mode 100644 index 0c2963a643..0000000000 Binary files a/ports/roguelight/roguelight/lib/libcrypto.so.1.1 and /dev/null differ diff --git a/ports/roguelight/roguelight/lib/libssl.so.1.1 b/ports/roguelight/roguelight/lib/libssl.so.1.1 deleted file mode 100644 index 942fc96f9f..0000000000 Binary files a/ports/roguelight/roguelight/lib/libssl.so.1.1 and /dev/null differ diff --git a/ports/roguelight/roguelight/lib/libzip.so.4 b/ports/roguelight/roguelight/lib/libzip.so.4 deleted file mode 100644 index bc3ef2300d..0000000000 Binary files a/ports/roguelight/roguelight/lib/libzip.so.4 and /dev/null differ diff --git a/ports/roguelight/roguelight/tools/7zzs b/ports/roguelight/roguelight/tools/7zzs deleted file mode 100644 index 2d206feb26..0000000000 Binary files a/ports/roguelight/roguelight/tools/7zzs and /dev/null differ diff --git a/ports/roguelight/roguelight/tools/SDL_swap_gpbuttons.py b/ports/roguelight/roguelight/tools/SDL_swap_gpbuttons.py deleted file mode 100644 index 317a2a0444..0000000000 --- a/ports/roguelight/roguelight/tools/SDL_swap_gpbuttons.py +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/env python3 -import sys -import argparse - -""" - name: swapabxy tool - description: swap buttons in SDL_GAMECONTROLLERCONFIG - author: kotzebuedog - usage: - export SDL_GAMECONTROLLERCONFIG="`echo "$SDL_GAMECONTROLLERCONFIG" | ./SDL_swap_gpbuttons.py -i - -o - -l swaplist.txt`" - - For example: - - # nintendo layout - 19009b4d4b4800000111000000010000,retrogame_joypad,a:b1,b:b0,dpdown:b14,dpleft:b15,+lefty:+a1,-leftx:-a0,+leftx:+a0,-lefty:-a1,leftshoulder:b4,leftstick:b11,lefttrigger:b6,dpright:b16,+righty:+a3,-rightx:-a2,+rightx:+a2,-righty:-a3,rightshoulder:b5,rightstick:b12,righttrigger:b7,back:b8,start:b9,dpup:b13,x:b2,y:b3,platform:Linux, - - becomes - - # nintendo layout - 19009b4d4b4800000111000000010000,retrogame_joypad,a:b0,b:b1,dpdown:b14,dpleft:b15,+lefty:+a1,-leftx:-a0,+leftx:+a0,-lefty:-a1,leftshoulder:b4,leftstick:b11,lefttrigger:b6,dpright:b16,+righty:+a3,-rightx:-a2,+rightx:+a2,-righty:-a3,rightshoulder:b5,rightstick:b12,righttrigger:b7,back:b8,start:b9,dpup:b13,x:b3,y:b2,platform:Linux, - - -""" - -def main(): - - parser = argparse.ArgumentParser(description='K-dog Gamepad button swapper tool: swap one or more pair of button in the SDL GAMECONTROLLER CONFIG') - parser.add_argument('-i', '--input', default="-",help='SDL GAMECONTROLLER CONFIG input file (by default stdin)') - parser.add_argument('-o', '--output', default="-",help='SDL GAMECONTROLLER CONFIG output file (by default stdout)') - parser.add_argument('-l', '--list-file',default="SDL_swap_gpbuttons.txt",help='Swap list file. 2-tuples of buttons to swap (eg. "a b" to swap a with b), one per line.') - - args = parser.parse_args() - - swaplist = [] - # Setup a list of swap 2-tuples - with open(args.list_file,'r') as list_file: - lines = list_file.readlines() - for _,line in enumerate(lines): - values = line.strip().split(' ') - if len(values) != 2: - # we skip this line - continue - else: - swaplist.append(values) - - if args.input != '-': - with open(args.input, 'r') as inputfile: - lines = inputfile.readlines() - else: - lines = sys.stdin - - if args.output != '-': - output = open(args.output, 'w') - else: - output = sys.stdout - - for line in lines: - # For each line we try to split the parameter with ',' as field delimiter - - splitted_line = line.rstrip().split(',') - - # For each pair of swap we try to find the two parameters and swap them in splitted_line - for _,swap in enumerate(swaplist): - # name for a,b fields - a_name = swap[0] - b_name = swap[1] - - # column index of the a,b fields - (a_idx, b_idx) = (-1, -1) - - # a,b gamepad configuration value (eg. "b1", "b2"...) - (a_val, b_val) = ("", "") - - # Look for a and b parameters in each field - for i,param in enumerate(splitted_line): - - # For each field split the parameter name (eg. "a") from its value (eg. "b1") - # delimiter is ":" - splitted_param = param.split(":") - - if splitted_param[0] == a_name: - # we have found parameter for a - a_val = splitted_param[1] - a_idx = i - elif splitted_param[0] == b_name: - # we have found parameter for b - b_val = splitted_param[1] - b_idx = i - - if a_idx > -1 and b_idx > -1: - # We have found a and b so we can swap them - splitted_line[a_idx] = f"{a_name}:{b_val}" - splitted_line[b_idx] = f"{b_name}:{a_val}" - - # Print the reconstitued line (even we haven't updated it) - output.write(','.join(splitted_line)) - output.write('\n') - -if __name__ == '__main__': - main() \ No newline at end of file diff --git a/ports/roguelight/roguelight/tools/patchscript b/ports/roguelight/roguelight/tools/patchscript index 37d0b65815..5b3c012d94 100644 --- a/ports/roguelight/roguelight/tools/patchscript +++ b/ports/roguelight/roguelight/tools/patchscript @@ -12,17 +12,19 @@ export DATADIR="$GAMEDIR/assets" export DATAFILE="game.port" export LD_LIBRARY_PATH="/usr/lib:$GAMEDIR/lib:$GAMEDIR/tools/libs:$LD_LIBRARY_PATH" export SDL_GAMECONTROLLERCONFIG="$sdl_controllerconfig" -export TOOLDIR="$GAMEDIR/tools" export TMPDIR="$GAMEDIR/tmp" -export PATH="$GAMEDIR/tools:$PATH" +export PATH="$controlfolder:$DOTNETDIR:$TOOLKIT/gmtools:$PATH" # Permissions chmod 666 /dev/uinput -chmod 777 "$TOOLDIR/7zzs" cd "$GAMEDIR" unzip_exe() { + if [ -f "$GAMEDIR/assets/Roguelight.exe" ]; then + mv "$GAMEDIR/assets/Roguelight.exe" "$GAMEDIR/Roguelight.exe" + fi + if [ -f "$GAMEDIR/Roguelight.exe" ]; then # Calculate the MD5 checksum of Mezzer.exe actual_checksum=$(md5sum "$GAMEDIR/Roguelight.exe" | awk '{print $1}') @@ -30,7 +32,7 @@ unzip_exe() { # Check if the file exists and the checksum matches if [ "$actual_checksum" = "63f6f3acb59133fb95e2ec88520289c4" ]; then # Use 7zip to extract the .exe file to the destination directory - "$TOOLDIR/7zzs" x "$GAMEDIR/Roguelight.exe" -o"$DATADIR" & pid=$! + "$controlfolder/7zzs.${DEVICE_ARCH}" x "$GAMEDIR/Roguelight.exe" -o"$DATADIR" & pid=$! # Wait for the extraction process to complete wait $pid @@ -52,7 +54,7 @@ fi apply_xdelta() { # Check if the data.win file exists and apply xdelta if [ -f "$DATADIR/data.win" ]; then - output=$($controlfolder/xdelta3 -d -s "$DATADIR/data.win" -f "./tools/patch/roguelight.xdelta" "$DATADIR/game.droid" 2>&1) + output=$(xdelta3 -d -s "$DATADIR/data.win" -f "./tools/patch/roguelight.xdelta" "$DATADIR/game.droid" 2>&1) if [ $? -eq 0 ]; then echo "Patch applied successfully" echo "$output" @@ -76,7 +78,7 @@ zip_archive() { process_game() { unzip_exe echo "Removed unnecessary files" - sleep1 + sleep 1 echo "Applying xdelta patch" apply_xdelta sleep 1