From 34c4481f9643f6e5bffe896348a1f8056387b2ce Mon Sep 17 00:00:00 2001 From: thibautbus <310327033+thibautbus@users.noreply.github.com> Date: Wed, 19 Aug 2026 14:31:09 +0200 Subject: [PATCH] Route the box-release confirmation through the real ROM text BoxMenu.lua's "Once released,\n%s is\ngone forever. OK?" prompt and its "%s was\nreleased outside.\fBye %s!" follow-up (shown after confirming) were both plain Lua literals, bypassing the extracted _OnceReleasedText and _MonWasReleasedText labels entirely even though both exist and are already translated in a real corpus build. Wrapped both in the same t._X or Strings(...) pattern already used four lines above for the Pikachu-unhappy prompt in this same function, with the same trailing gsub to fill the {RAM:wStringBuffer} token(s) either branch leaves in place -- _MonWasReleasedText's real text repeats the token twice (the name appears at both ends of the sentence), and gsub's default replace-all handles that the same way a single occurrence does. Independent code review flagged a separate issue on this line and the pre-existing Pikachu one right above it: both pass the nickname as a bare gsub replacement string, which Lua %-escapes ("%" followed by a digit 1-9 crashes with "invalid capture index", confirmed directly). Checked how reachable that actually is: the naming screen's charset can't produce a literal "%", and neither can a real cartridge import (the Gen 1/2 character-decode tables never map any ROM byte to "%" either) -- the only way in is editing a save's plain-Lua-source nickname field directly. Not fixed here, to stay consistent with the separate branch (fix/gsub-percent-escape-crash) already carrying this exact fix across every callsite that shares it, including this one -- splitting the same bug's fix across two branches by which one happened to touch the line first isn't a real reason to fix it in one place and not the other. --- src/ui/BoxMenu.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ui/BoxMenu.lua b/src/ui/BoxMenu.lua index 5dc2b694..5c39c7cc 100644 --- a/src/ui/BoxMenu.lua +++ b/src/ui/BoxMenu.lua @@ -185,14 +185,16 @@ local function release(game) return end game.stack:push(TextBox.new(game, - Strings("Once released,\n%s is\ngone forever. OK?", name), nil, { + (t._OnceReleasedText or Strings("Once released,\n%s is\ngone forever. OK?", name)) + :gsub("{RAM:wStringBuffer}", name), nil, { defaultNo = true, noSound = true, choice = function(yes) if not yes then return end table.remove(box, list.index) require("src.core.Sound").playCry(game.data, mon.species) game.stack:push(TextBox.new(game, - Strings("%s was\nreleased outside.\fBye %s!", name, name))) + ((t._MonWasReleasedText or Strings("%s was\nreleased outside.\fBye %s!", name, name)) + :gsub("{RAM:wStringBuffer}", name)))) list:removeCurrent() end, }))