Advertisement
titooo7

karting-superstars.sh for Rocknix/Portmaster - 9th March 2025

Mar 9th, 2025
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.43 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Determine PortMaster control folder
  4. if [ -d "/opt/system/Tools/PortMaster/" ]; then
  5.   controlfolder="/opt/system/Tools/PortMaster"
  6. elif [ -d "/opt/tools/PortMaster/" ]; then
  7.   controlfolder="/opt/tools/PortMaster"
  8. else
  9.   controlfolder="/roms/ports/PortMaster"
  10. fi
  11.  
  12. # Source control files if available
  13. source "${controlfolder}/control.txt"
  14. [ -f "${controlfolder}/mod_${CFW_NAME}.txt" ] && source "${controlfolder}/mod_${CFW_NAME}.txt"
  15. get_controls
  16.  
  17. # Variables
  18. GAMEDIR="/storage/roms/ports/karting-superstars"
  19. WINEPREFIX="/storage/.wine64-shared"
  20.  
  21. # Ensure the game directory exists.
  22. if [ ! -d "$GAMEDIR" ]; then
  23.   echo "Error: Game directory missing ($GAMEDIR). Please check your installation."
  24.   exit 1
  25. fi
  26.  
  27. # Change to game directory and prepare logging.
  28. cd "$GAMEDIR"
  29. > "$GAMEDIR/log.txt" && exec > >(tee "$GAMEDIR/log.txt") 2>&1
  30. chmod +x -R "$GAMEDIR"/*
  31.  
  32. # Following section of box64 exporta added by titooo7
  33. # This definitely improves performance in Cocoon and probably some Unity games
  34. # It is basically the equivalent to a Performance present on Winlator 7.1.3 v11R2 from coffincolors with the only change of the Unity value changed from 0 to 1
  35.  
  36. export BOX64_DYNAREC_SAFEFLAGS=1
  37. export BOX64_DYNAREC_FASTNAN=1
  38. export BOX64_DYNAREC_FASTROUND=1
  39. export BOX64_DYNAREC_X87DOUBLE=0
  40. export BOX64_DYNAREC_BIGBLOCK=3
  41. export BOX64_DYNAREC_STRONGMEM=0
  42. export BOX64_DYNAREC_FORWARD=512
  43. export BOX64_DYNAREC_CALLRET=1
  44. export BOX64_DYNAREC_WAIT=1
  45. export BOX64_AVX=0
  46. export BOX64_MAXCPU=8
  47. export BOX64_UNITYPLAYER=1
  48.  
  49. # IMPORTANT - The following two lines were added by me, titooo7, but I got no clue if that actually works or helps
  50.  
  51. winetricks graphics=wayland
  52. export WINE_USE_XWAYLAND=1
  53.  
  54. # I wanted to use the next variable but I don't know if it should be export -force-gfx-direct or export force-gfx-direct so I am not using it
  55. #export -force-gfx-direct
  56.  
  57.  
  58. # Environment variable exports.
  59. export SDL_GAMECONTROLLERCONFIG="\$sdl_controllerconfig"
  60. export WINEPREFIX="/storage/.wine64-shared"
  61. export WINEDEBUG=-all
  62.  
  63. # Graphics and optimization options.
  64. export DXVK_HUD=devinfo,fps,gpuload,version
  65. export DXVK_ASYNC=1
  66. export STAGING_SHARED_MEMORY=1
  67. export STAGING_WRITECOPY=1
  68.  
  69.  
  70. # Check if pm_message exists.
  71. if ! type pm_message &>/dev/null; then
  72.     echo "Warning: pm_message function is missing. Skipping dependency message."
  73. else
  74.     pm_message "Checking for and installing dependencies..."
  75. fi
  76.  
  77. # Config Setup: create config directory and bind to the Wine save folder.
  78. mkdir -p "$GAMEDIR/config"
  79. if [ "$(type -t bind_directories)" = "function" ]; then
  80.     bind_directories "$WINEPREFIX/drive_c/users/root/AppData/LocalLow/Andrew Shouldice/Secret Legend" "$GAMEDIR/config"
  81. else
  82.     echo "Warning: bind_directories function is missing. Skipping config binding."
  83. fi
  84.  
  85. # Check that box64, wine64, and GPTOKEYB exist before launching.
  86. if ! command -v box64 &>/dev/null || ! command -v wine64 &>/dev/null; then
  87.   echo "Error: box64 or wine64 is missing. Install them before running the game."
  88.   exit 1
  89. fi
  90. if ! command -v /usr/bin/gptokeyb &>/dev/null; then
  91.   echo "Error: GPTOKEYB is missing. Install it before running the game."
  92.   exit 1
  93. fi
  94.  
  95. # Launch the game:
  96. # First, launch GPToKeyB for controller mapping.
  97. /usr/bin/gptokeyb "karting-superstars.exe" -c "./karting-superstars.gptk" &
  98. # Then launch the game executable from the data folder using box64/wine64.
  99. box64 wine64 "$GAMEDIR/data/"karting-superstars.exe""
  100.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement