diff --git a/services/wolf.sh b/services/wolf.sh
index 32ede95..3bda79f 100644
--- a/services/wolf.sh
+++ b/services/wolf.sh
@@ -966,12 +966,22 @@ UDEV
if [[ "$_GET_TI99" =~ ^[Yy]$ ]]; then
mkdir -p "$GAME_STORAGE_DIR/esde-custom-systems" "$GAME_STORAGE_DIR/roms/ti994a"
local _TI99_XML="$GAME_STORAGE_DIR/esde-custom-systems/es_systems.xml"
- if [ ! -f "$_TI99_XML" ] || ! grep -q 'ti994a' "$_TI99_XML" 2>/dev/null; then
- backup_if_exists "$_TI99_XML"
- [ -f "$_TI99_XML" ] || echo '' > "$_TI99_XML"
- sed -i 's###' "$_TI99_XML" 2>/dev/null
- cat >> "$_TI99_XML" << 'XMLEOF'
-
+ backup_if_exists "$_TI99_XML"
+ # Always strip and re-add the ti994a block rather than "skip if
+ # already present" — confirmed live: that check left a stale
+ # 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.
+ python3 - "$_TI99_XML" << 'TI99XMLPY'
+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*ti994a.*?\s*\n?', '', content, flags=re.DOTALL)
+block = '''
ti994a
Texas Instruments TI-99/4A
%ROMPATH%/ti994a
@@ -980,13 +990,13 @@ UDEV
ti99
ti99
-
-XMLEOF
- chown "$ACTUAL_USER:$ACTUAL_USER" "$_TI99_XML"
- log_success "TI-99/4A added as an ES-DE system (roms/ti994a/, custom_systems/es_systems.xml)"
- else
- log_info "TI-99/4A system definition already present — left as-is."
- fi
+'''
+content = content.replace('', block + '')
+with open(path, 'w') as f:
+ f.write(content)
+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)"
echo ""
if [ ! -x "$GAME_STORAGE_DIR/emulators/ti99sim-sdl" ]; then
# Build inside a container running the EXACT SAME image ES-DE