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

@ -981,9 +981,10 @@ run_game() {
log d "Game: \"$game\""
log d "System: \"$system\""
# Function to handle the %INJECT% placeholder
handle_inject_placeholder() {
# Function to handle the %INJECT% placeholder
handle_inject_placeholder() {
local cmd="$1"
local rom_dir=$(dirname "$game") # Define rom_dir based on the game path
# Find all occurrences of %INJECT%=something
while [[ "$cmd" =~ %INJECT%=(.*) ]]; do
@ -994,7 +995,7 @@ run_game() {
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
# Read the content of the file
inject_content=$(cat "$inject_file_full_path")
@ -1011,7 +1012,11 @@ run_game() {
log d "Returning the command with injected content: $cmd"
echo "$cmd"
}
}
# Function to replace %EMULATOR_SOMETHING% with the actual path of the emulator
replace_emulator_placeholder() {