Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bash Script for Per-Game Configurations?
#1
I'm coming from a Windows config that used RocketLauncher with the PCSX2 AHK module that automatically created and utilized per-game configuration files.  I'd like to accomplish the same in Linux by having Attract Mode call a similar script, but I'm not much of a coder.  Anyone want to tackle this task, or has someone already created a solution for this?  I've attached the AHK script for reference.


Attached Files
.txt   PCSX2.ahk.txt (Size: 24,77 KB / Downloads: 21)
Reply

Sponsored links

#2
I've made a tool which allows you to create/manage multiple configurations on Linux. See here: https://github.com/XXXBold/PCSX2_MultiConfigTool
Tired of always changing your PCSX2 Configuration for different games?

Check this out: https://forums.pcsx2.net/Thread-PCSX2-MultiConfigTool
Reply
#3
Creating a new config only requires copying over the defaults to a game-specific folder and then sourcing --cfg-path when loading the game.  I want a script that will

- check Game Configs folder for folder matching the name of the input file
- load PCSX2 using that game's config by passing --cfg-path if it exists
- if it doesn't exist, automatically copy Default folder to new GameName folder
- load PCSX2 using the newly-created folder by passing --cfg-path
Reply
#4
The Tool won't create configuration on a per-Game base, imo that doesn't make too much sense, because some games can share their configuration. However, you can ofc create configurations per game if desired, and then generate a startscript.
Tired of always changing your PCSX2 Configuration for different games?

Check this out: https://forums.pcsx2.net/Thread-PCSX2-MultiConfigTool
Reply
#5
(02-25-2020, 07:46 PM)XXXBold Wrote: The Tool won't create configuration on a per-Game base, imo that doesn't make too much sense, because some games can share their configuration.

It's not the most space-efficient method, but I want something that will load the appropriate configuration transparently and only require being changed once if the game requires adjustments from the default profile.
Reply
#6
[deleted]
Reply
#7
[deleted]
Reply
#8
Added an exit trap so Attract Mode's 'Exit Emulator' hotkey works correctly.  attract must be launched via terminal to work correctly with this script.

Code:
#!/bin/bash
## This script makes it possible to user individual per game configuration files for PCSX2.
## Make sure your default PCSX2_ui.ini has Slot1_Filename set to default.ps2.
## This script only seems to work correctly with Attract Mode when attract is launched via terminal.
## Works with PCSX2 1.5.0.
## Credit to parasven for the RetroPie script that was the basis for this.

pcsx2_ini="$HOME/.config/PCSX2/PCSX2-reg.ini"
game_configpath="$HOME/.config/PCSX2/game_configs"
memcardpath="$HOME/.config/PCSX2/memcards"
pcsx2_config_default="$HOME/.config/PCSX2/inis"
fullfilename=$1
filename=$(basename "$fullfilename")
title_id="${filename%.*}"
memcard="$title_id.ps2"

## If no parameter was passed, set default path and exit.
if [[ ! $1 ]]
then
        ## Exchange the configpath
        sed -i [email protected]"^SettingsFolder=.*"@"SettingsFolder=\"$pcsx2_config_default\""@g "$pcsx2_ini"
        exit
fi

## When the config folder does not exist, create it and copy over the default inis from the default ini folder.
if [[ ! -e "$game_configpath/$title_id"  ]]
then
        ## Create folder based on the filename of the game.
        mkdir -p "$game_configpath/$title_id/"
        ## Copy over the default inis from default directory for a start.
        cp -a "$pcsx2_config_default"/*.ini "$game_configpath/$title_id/"
fi

## If game-specific memory card does not exist, then create it using blank default.
if [[ ! -e "$memcardpath/$memcard"  ]]
then
        ## Copy default memcard
        cp "$memcardpath"/default.ps2 "$memcardpath/$memcard"
fi

echo "memcard = $memcard"

# Load relevant memory card.
sed -i "s|default.ps2|$memcard|g" "$game_configpath/$title_id/"PCSX2_ui.ini

# Launch PCSX2 using the relevant config folder.
/usr/games/PCSX2 --fullscreen --fullboot --cfgpath="$game_configpath/$title_id" "$1" &

# Close PCSX2 when Attract Mode's 'Exit Emulator' hotkey is pressed. 
cleanup() {
        echo "Caugh Signal ... terminating PCSX2."
        pkill PCSX2
        exit
}
trap cleanup INT TERM
read var
cleanup
Reply




Users browsing this thread: 1 Guest(s)