diff --git a/services/wolf.sh b/services/wolf.sh index 3bda79f..8007e79 100644 --- a/services/wolf.sh +++ b/services/wolf.sh @@ -972,6 +972,27 @@ UDEV # line in place across a real fix to it, since existing # was already "present" and the check never looked at whether its # content matched the current template. + # + # The below does NOT use a literal "/bin/bash -c ..." + # string — confirmed against ES-DE's own source (FileData::findEmulator()) + # and every real %INJECT%=...esprefix example in ES-DE's own shipped + # es_systems.xml (Dolphin/PrimeHack/Triforce/Supermodel): findEmulator() + # always runs against the string's emulator token to decide + # "found" vs "not found", and %INJECT%=file is only ever paired with + # an %EMULATOR_X%/%CORE_X% placeholder in every real example — never + # with a literal path. Confirmed live: a literal "/bin/bash -c ..." + # after %INJECT%=%BASENAME%.esprefix made ES-DE log "Couldn't launch + # game, emulator not found" even though /bin/bash obviously exists — + # findEmulator() isn't falling back to a plain existence check on the + # next token there, it requires the %EMULATOR_X% resolution path. + # Fixed by giving ti99sim-sdl a real es_find_rules.xml entry (written + # below) and using %EMULATOR_TI99SIM%, matching the pattern every + # built-in standalone emulator uses. %STARTDIR%=%EMUDIR% (ES-DE's own + # "directory containing the resolved emulator binary" variable) + # replaces the old "cd /home/retro/Applications &&" shell prefix — + # ti99sim-sdl still needs its cwd to be its own install dir to find + # the console ROM (TI-994A.ctg) via a plain relative lookup, same as + # RetroPie's own ti99sim.sh does with its "pushd $md_inst" launch. python3 - "$_TI99_XML" << 'TI99XMLPY' import re, sys path = sys.argv[1] @@ -986,7 +1007,7 @@ block = ''' Texas Instruments TI-99/4A %ROMPATH%/ti994a .ctg .rpk .bin - %INJECT%=%BASENAME%.esprefix /bin/bash -c "cd /home/retro/Applications && ./ti99sim-sdl --joystick1=1 '%ROM%'" + %INJECT%=%BASENAME%.esprefix %STARTDIR%=%EMUDIR% %EMULATOR_TI99SIM% --joystick1=1 %ROM% ti99 ti99 @@ -997,6 +1018,39 @@ with open(path, 'w') as f: TI99XMLPY chown "$ACTUAL_USER:$ACTUAL_USER" "$_TI99_XML" log_success "TI-99/4A ES-DE system definition written/refreshed (roms/ti994a/, custom_systems/es_systems.xml)" + + # es_find_rules.xml lives alongside custom es_systems.xml in the same + # custom_systems/ directory (confirmed against ES-DE's own + # USERGUIDE.md — "customize the find rules via the es_find_rules.xml + # file", same complement-not-replace logic as custom es_systems.xml). + # This is what makes %EMULATOR_TI99SIM% above resolvable at all — + # without it, ES-DE has no rule telling it what "TI99SIM" even means + # and would report the emulator as not found regardless of anything + # in es_systems.xml. Same strip-and-reappend idempotency as above, in + # case this file ever gains other custom emulator entries later. + local _TI99_RULES="$GAME_STORAGE_DIR/esde-custom-systems/es_find_rules.xml" + backup_if_exists "$_TI99_RULES" + python3 - "$_TI99_RULES" << 'TI99RULESPY' +import re, sys +path = sys.argv[1] +try: + with open(path) as f: + content = f.read() +except FileNotFoundError: + content = '\n\n' +content = re.sub(r'[ \t]*.*?\s*\n?', '', content, flags=re.DOTALL) +block = ''' + + ~/Applications/ti99sim-sdl + + +''' +content = content.replace('', block + '') +with open(path, 'w') as f: + f.write(content) +TI99RULESPY + chown "$ACTUAL_USER:$ACTUAL_USER" "$_TI99_RULES" + log_success "TI-99/4A ES-DE find rule written/refreshed (custom_systems/es_find_rules.xml)" echo "" if [ ! -x "$GAME_STORAGE_DIR/emulators/ti99sim-sdl" ]; then # Build inside a container running the EXACT SAME image ES-DE