Skip to content

Commit

Permalink
Merge pull request #1264 from JeodC/portfix
Browse files Browse the repository at this point in the history
Update some launchscripts, fix Yolk Heroes
  • Loading branch information
kloptops authored Feb 6, 2025
2 parents b652cef + 32d3ec9 commit 59e34a5
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 79 deletions.
36 changes: 17 additions & 19 deletions ports/carmageddon/Carmageddon.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#!/bin/bash
# Ported by Maciej Suminski <orson at orson dot net dot pl>
# Built from https://github.com/orsonmmz/dethrace (branch gles)

PORTNAME="Carmageddon"

XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}

Expand All @@ -17,19 +13,24 @@ else
fi

source $controlfolder/control.txt

[ -f "${controlfolder}/mod_${CFW_NAME}.txt" ] && source "${controlfolder}/mod_${CFW_NAME}.txt"
get_controls

CUR_TTY=/dev/tty0
$ESUDO chmod 666 $CUR_TTY

# Variables
GAMEDIR="/$directory/ports/carmageddon"
cd "$GAMEDIR"

# CD and set permissions
cd $GAMEDIR
> "$GAMEDIR/log.txt" && exec > >(tee "$GAMEDIR/log.txt") 2>&1
$ESUDO chmod +x $GAMEDIR/dethrace

# Exports
export SDL_GAMECONTROLLERCONFIG="$sdl_controllerconfig"

# Check for gamedata
if [[ ! -d "DATA" ]]; then
echo Missing game files. Unzip the game files to $GAMEDIR. > $CUR_TTY
pm_message "Missing game files. Unzip the game files to $GAMEDIR."
sleep 5
printf "\033c" >> $CUR_TTY
exit 1
fi

Expand All @@ -38,14 +39,11 @@ if [[ ! -e ".init_done" && -e "DATA/KEYMAP_0.TXT" ]]; then
mv init/* DATA && rm -r init && touch .init_done
fi

$ESUDO chmod 666 /dev/uinput
export SDL_GAMECONTROLLERCONFIG="$sdl_controllerconfig"
# Run the game
$GPTOKEYB "dethrace" -c "./dethrace.gptk" &
pm_platform_helper "$GAMEDIR/dethrace"
./dethrace --full-screen -hires

./dethrace 2>&1 | tee -a ./log.txt

$ESUDO kill -9 $(pidof gptokeyb)
unset SDL_GAMECONTROLLERCONFIG
$ESUDO systemctl restart oga_events &
printf "\033c" >> $CUR_TTY
# Cleanup
pm_finish

65 changes: 25 additions & 40 deletions ports/openrct2/OpenRCT2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,70 +13,55 @@ else
fi

source $controlfolder/control.txt
[ -f "${controlfolder}/mod_${CFW_NAME}.txt" ] && source "${controlfolder}/mod_${CFW_NAME}.txt"
if [ -z ${TASKSET+x} ]; then
source $controlfolder/tasksetter
fi

get_controls

## TODO: Change to PortMaster/tty when Johnnyonflame merges the changes in,
CUR_TTY=/dev/tty0
# Variables
GAMEDIR="$directory/ports/openrct2"
ARGS="--user-data-path=save --openrct2-data-path=engine/share/openrct2 --rct2-data-path=RCT2/ --rct1-data-path=RCT1/"

PORTDIR="/$directory/ports"
GAMEDIR="$PORTDIR/openrct2"
# CD and set permissions
cd $GAMEDIR
> "$GAMEDIR/log.txt" && exec > >(tee "$GAMEDIR/log.txt") 2>&1
$ESUDO chmod +x -R $GAMEDIR/*

$ESUDO chmod 666 $CUR_TTY
$ESUDO touch log.txt
$ESUDO chmod 666 log.txt
export TERM=linux
printf "\033c" > $CUR_TTY

printf "\033c" > $CUR_TTY
## RUN SCRIPT HERE
# Exports
export TEXTINPUTPRESET="Name"
export TEXTINPUTINTERACTIVE="Y"
export TEXTINPUTNOAUTOCAPITALS="Y"
export SDL_GAMECONTROLLERCONFIG="$sdl_controllerconfig"
export LD_LIBRARY_PATH="$GAMEDIR/libs:$LD_LIBRARY_PATH"

if [ ! -f "RCT2/Data/g1.dat" ]; then
echo "Missing game files, see README for more info." > $CUR_TTY
## Check for game files
if [ ! -f "$GAMEDIR/RCT2/Data/g1.dat" ]; then
pm_message "Missing game files, see README for more info."
sleep 5
printf "\033c" > $CUR_TTY
exit 1
fi

# Extract the game if it exists
if [ -f "$GAMEDIR/engine.zip" ]; then
if [ -d "$GAMEDIR/engine" ]; then
echo "Removing old engine. One moment." > $CUR_TTY
pm_message "Removing old engine. One moment."
$ESUDO rm -fRv "$GAMEDIR/engine"
fi

echo "Extracting engine files. Please wait." > $CUR_TTY
# Extract the engine from the build zip.
pm_message "Extracting engine files. Please wait."
$ESUDO unzip "$GAMEDIR/engine.zip"
$ESUDO mv -fv "$GAMEDIR/engine/bin/openrct2" "$GAMEDIR/openrct2"
$ESUDO rm -f "$GAMEDIR/engine.zip"
fi

export TEXTINPUTPRESET="Name"
export TEXTINPUTINTERACTIVE="Y"
export TEXTINPUTNOAUTOCAPITALS="Y"
export SDL_GAMECONTROLLERCONFIG="$sdl_controllerconfig"

export LD_LIBRARY_PATH="$GAMEDIR/libs:$LD_LIBRARY_PATH"

echo "Starting game." > $CUR_TTY

$GPTOKEYB "openrct2" -c openrct2.gptk textinput &
$TASKSET ./openrct2 $DEBUGCMDS \
--user-data-path=save/ \
--openrct2-data-path=engine/share/openrct2 \
--rct2-data-path=RCT2/ \
--rct1-data-path=RCT1/ 2>&1 | $ESUDO tee -a ./log.txt

$ESUDO kill -9 $(pidof gptokeyb)
unset LD_LIBRARY_PATH
unset SDL_GAMECONTROLLERCONFIG
$ESUDO systemctl restart oga_events &
# Run the game
pm_message "Starting game."
$GPTOKEYB "openrct2" -c openrct2.gptk &
pm_platform_helper "$GAMEDIR/openrct2"
$TASKSET ./openrct2 $ARGS

# Disable console
printf "\033c" > $CUR_TTY
# Cleanup
pm_finish

9 changes: 5 additions & 4 deletions ports/yolkheroes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The Gameboy-style art and screen scaling make it a good candidate for a portable
Text input info from gptokeyb documentation::

Interactive Input Mode Controls:

```
START+D-PAD DOWN to activate
Once activated:
D-PAD UP = previous letter
Expand All @@ -32,12 +32,13 @@ R1 = jump forward 13 letters for current character
A = send ENTER key and exit mode
SELECT/HOTKEY = cancel and exit mode (deletes all characters)
START = confirm and exit mode (also sends ENTER key)
```

Capitals
### Capitals
By default Interactive Text Entry mode will start with A as the first letter and immediately after a space, and a otherwise, unless environment variable TEXTINPUTNOAUTOCAPITALS="Y" is set, whereby all letters will start as a.

Symbols
### Symbols
By default Interactive Text Entry mode includes only a limited number of symbols "[space] . , - _ ( )", and a full set of symbols is included with environment variable TEXTINPUTADDEXTRASYMBOLS="Y".

Exiting mode
### Exiting mode
Interactive Text Entry relies on the game providing a text prompt and sends key strokes to add and change characters, so it is only useful in these situations. Interactive Text Entry is automatically exited when either SELECT, HOTKEY, START or A are pressed, to minimise issues by accidentally triggering this mode.
30 changes: 15 additions & 15 deletions ports/yolkheroes/Yolk Heroes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,38 @@ else
fi

source $controlfolder/control.txt

[ -f "${controlfolder}/mod_${CFW_NAME}.txt" ] && source "${controlfolder}/mod_${CFW_NAME}.txt"

get_controls

# Variables
GAMEDIR="/$directory/ports/yolkheroes/"
CONFDIR="$GAMEDIR/conf/"

# CD and set permissions
cd $GAMEDIR
> "$GAMEDIR/log.txt" && exec > >(tee "$GAMEDIR/log.txt") 2>&1
$ESUDO chmod +x -R $GAMEDIR/*

# Ensure the conf directory exists
mkdir -p "$GAMEDIR/conf"

# Set the XDG environment variables for config & savefiles
export XDG_CONFIG_HOME="$CONFDIR"
export XDG_DATA_HOME="$CONFDIR"
export SDL_GAMECONTROLLERCONFIG="$sdl_controllerconfig"
export FRT_NO_EXIT_SHORTCUTS=FRT_NO_EXIT_SHORTCUTS

# Keyboard Entry; edit name here
export TEXTINPUTPRESET="NAME" # defines preset text to insert
export TEXTINPUTINTERACTIVE="Y" # enables interactive text input mode
export TEXTINPUTNOAUTOCAPITALS="Y" # disables automatic capitalisation of first letter of words in interactive text input mode
export TEXTINPUTADDEXTRASYMBOLS="Y" # enables additional symbols for interactive text input

cd $GAMEDIR

runtime="frt_3.5.2"
runtime="frt_3.6"
if [ ! -f "$controlfolder/libs/${runtime}.squashfs" ]; then
# Check for runtime if not downloaded via PM
if [ ! -f "$controlfolder/harbourmaster" ]; then
echo "This port requires the latest PortMaster to run, please go to https://portmaster.games/ for more info." > /dev/tty0
pm_message "This port requires the latest PortMaster to run, please go to https://portmaster.games/ for more info."
sleep 5
exit 1
fi
Expand All @@ -55,14 +60,9 @@ $ESUDO umount "$godot_file" || true
$ESUDO mount "$godot_file" "$godot_dir"
PATH="$godot_dir:$PATH"

export FRT_NO_EXIT_SHORTCUTS=FRT_NO_EXIT_SHORTCUTS

$GPTOKEYB "$runtime" -c "./yolkheroes.gptk" &
pm_platform_helper "$runtime"
SDL_GAMECONTROLLERCONFIG="$sdl_controllerconfig" "$runtime" $GODOT_OPTS --main-pack "gamedata/yolkheroes.pck"

if [[ "$PM_CAN_MOUNT" != "N" ]]; then
$ESUDO umount "$godot_dir"
fi
pm_platform_helper "$runtime" >/dev/null
"$runtime" $GODOT_OPTS --main-pack "gamedata/yolkheroes.pck"

pm_finish
# Cleanup
pm_finish
2 changes: 1 addition & 1 deletion ports/yolkheroes/port.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"image": null,
"rtr": false,
"exp": false,
"runtime": "frt_3.5.2.squashfs",
"runtime": "frt_3.6.squashfs",
"reqs": [
],
"arch": [
Expand Down

0 comments on commit 59e34a5

Please sign in to comment.