RUN_GAME: working but looping - fix

This commit is contained in:
XargonWan 2024-09-10 22:22:30 +09:00
parent 38806dabc1
commit d0644c82e6

View file

@ -984,6 +984,7 @@ run_game() {
# Function to handle the %INJECT% placeholder # Function to handle the %INJECT% placeholder
handle_inject_placeholder() { handle_inject_placeholder() {
local cmd="$1" local cmd="$1"
local rom_dir=$(dirname "$game") # Define rom_dir based on the game path
# Find all occurrences of %INJECT%=something # Find all occurrences of %INJECT%=something
while [[ "$cmd" =~ %INJECT%=(.*) ]]; do while [[ "$cmd" =~ %INJECT%=(.*) ]]; do
@ -994,7 +995,7 @@ run_game() {
log d "Found %INJECT% pointing to file \"$inject_file_full_path\"" log d "Found %INJECT% pointing to file \"$inject_file_full_path\""
# Check if the file exists # Check if the file exists (no escaping needed, just quotes)
if [[ -f "$inject_file_full_path" ]]; then if [[ -f "$inject_file_full_path" ]]; then
# Read the content of the file # Read the content of the file
inject_content=$(cat "$inject_file_full_path") inject_content=$(cat "$inject_file_full_path")
@ -1013,6 +1014,10 @@ run_game() {
echo "$cmd" echo "$cmd"
} }
# Function to replace %EMULATOR_SOMETHING% with the actual path of the emulator # Function to replace %EMULATOR_SOMETHING% with the actual path of the emulator
replace_emulator_placeholder() { replace_emulator_placeholder() {
local placeholder=$1 local placeholder=$1