Advertisement
titooo7

cocoon.sh for Rocknix/Portmaster - 9th March 2025

Mar 9th, 2025
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.39 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/cocoon"
  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. # Environment variable exports.
  58. export SDL_GAMECONTROLLERCONFIG="\$sdl_controllerconfig"
  59. export WINEPREFIX="/storage/.wine64-shared"
  60. export WINEDEBUG=-all
  61.  
  62. # Graphics and optimization options.
  63. export DXVK_HUD=devinfo,fps,gpuload,version,api
  64. export DXVK_ASYNC=1
  65. export STAGING_SHARED_MEMORY=1
  66. export STAGING_WRITECOPY=1
  67.  
  68. # Check if pm_message exists.
  69. if ! type pm_message &>/dev/null; then
  70.     echo "Warning: pm_message function is missing. Skipping dependency message."
  71. else
  72.     pm_message "Checking for and installing dependencies..."
  73. fi
  74.  
  75. # Config Setup: create config directory and bind to the Wine save folder.
  76. mkdir -p "$GAMEDIR/config"
  77. if [ "$(type -t bind_directories)" = "function" ]; then
  78.     bind_directories "$WINEPREFIX/drive_c/users/root/AppData/LocalLow/Andrew Shouldice/Secret Legend" "$GAMEDIR/config"
  79. else
  80.     echo "Warning: bind_directories function is missing. Skipping config binding."
  81. fi
  82.  
  83. # Check that box64, wine64, and GPTOKEYB exist before launching.
  84. if ! command -v box64 &>/dev/null || ! command -v wine64 &>/dev/null; then
  85.   echo "Error: box64 or wine64 is missing. Install them before running the game."
  86.   exit 1
  87. fi
  88. if ! command -v /usr/bin/gptokeyb &>/dev/null; then
  89.   echo "Error: GPTOKEYB is missing. Install it before running the game."
  90.   exit 1
  91. fi
  92.  
  93. # Launch the game:
  94. # First, launch GPToKeyB for controller mapping.
  95. /usr/bin/gptokeyb "universe.exe" -c "./cocoon.gptk" &
  96. # Then launch the game executable from the data folder using box64/wine64.
  97. box64 wine64 "$GAMEDIR/data/"universe.exe""
  98.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement