Merge pull request #424 from outis1one/claude/wolf-pair-port-conflict-7nz8qg

Fix TI-99/4A "emulator not found" by using a real es_find_rules.xml e…
This commit is contained in:
Outis
2026-09-02 15:58:20 -04:00
committed by GitHub
+55 -1
View File
@@ -972,6 +972,27 @@ UDEV
# <command> 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 <command> 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 <command> 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 = ''' <system>
<fullname>Texas Instruments TI-99/4A</fullname>
<path>%ROMPATH%/ti994a</path>
<extension>.ctg .rpk .bin</extension>
<command>%INJECT%=%BASENAME%.esprefix /bin/bash -c "cd /home/retro/Applications && ./ti99sim-sdl --joystick1=1 '%ROM%'"</command>
<command>%INJECT%=%BASENAME%.esprefix %STARTDIR%=%EMUDIR% %EMULATOR_TI99SIM% --joystick1=1 %ROM%</command>
<platform>ti99</platform>
<theme>ti99</theme>
</system>
@@ -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 = '<ruleList>\n</ruleList>\n'
content = re.sub(r'[ \t]*<emulator name="TI99SIM">.*?</emulator>\s*\n?', '', content, flags=re.DOTALL)
block = ''' <emulator name="TI99SIM">
<rule type="staticpath">
<entry>~/Applications/ti99sim-sdl</entry>
</rule>
</emulator>
'''
content = content.replace('</ruleList>', block + '</ruleList>')
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