From b54d0c605a670d92d8ec28cf2e18565a8df1dfee Mon Sep 17 00:00:00 2001 From: Andrew Quenehen Date: Sat, 1 Aug 2026 13:13:09 -0300 Subject: [PATCH] fix(switch): stamp Version.lua, gate resume music, keep NX import hint Co-authored-by: Cursor --- scripts/build_switch.sh | 19 +++++++++++++++++++ src/core/Game.lua | 7 +++++-- src/import/RomImporter.lua | 13 ++++++++----- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/scripts/build_switch.sh b/scripts/build_switch.sh index 913e7cc3..13290e7c 100755 --- a/scripts/build_switch.sh +++ b/scripts/build_switch.sh @@ -91,6 +91,25 @@ pack_game_love() { --output "$love_out" \ --listing "$listing" \ --build-info "$build_info" >/dev/null + # Stamp release version into the archive (same as build.sh / build_android.sh). + # Working tree keeps 0.0.0-dev; only X.Y.Z --version patches Version.lua in-place. + if printf '%s' "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$'; then + say "stamping engine version $VERSION into game.love" + local stamp_dir="$WORK/stamp" + rm -rf "$stamp_dir" + mkdir -p "$stamp_dir/src/core" + sed -E "s/(engine[[:space:]]*=[[:space:]]*\")[^\"]*(\")/\1$VERSION\2/" \ + "$ROOT/src/core/Version.lua" > "$stamp_dir/src/core/Version.lua" + (cd "$stamp_dir" && zip -q "$love_out" src/core/Version.lua) + local version_re + version_re="$(printf '%s' "$VERSION" | sed 's/\./\\./g')" + unzip -p "$love_out" src/core/Version.lua \ + | grep -Eq "engine[[:space:]]*=[[:space:]]*\"$version_re\"" \ + || fail "version stamp failed: game.love does not report engine $VERSION" + say "stamped engine version: $VERSION" + else + say "version '$VERSION' is not X.Y.Z, shipping default engine (no stamp)" + fi cp "$build_info" "$DIST/build-info.json" cp "$build_info" "$DIST/gen1recomp-${VERSION}-build-info.json" printf '%s' "$love_out" diff --git a/src/core/Game.lua b/src/core/Game.lua index 1322f2d6..ae8a0b6c 100644 --- a/src/core/Game.lua +++ b/src/core/Game.lua @@ -591,9 +591,12 @@ end function Game:onResume() Input:reset() TouchControls:reset() - -- Chip music may survive suspend as a duplicate stream; stop it and let + -- Chip music may survive NX suspend as a duplicate stream; stop it and let -- the active screen re-cue on the next frame (hardware audio check: T19). - require("src.core.ChipAudio").stopMusic() + -- Desktop/mobile window-visible flips must not kill overworld music. + if require("src.core.Platform").isNX() then + require("src.core.ChipAudio").stopMusic() + end local SwitchDiagnostics = require("src.debug.SwitchDiagnostics") if SwitchDiagnostics.isEnabled() then SwitchDiagnostics.onEvent("lifecycle", { event = "resume" }) diff --git a/src/import/RomImporter.lua b/src/import/RomImporter.lua index 9d83d649..af904518 100644 --- a/src/import/RomImporter.lua +++ b/src/import/RomImporter.lua @@ -1136,15 +1136,18 @@ function RomImporter:startData(data, displayName) and not displayName:find("[/\\]") then love.filesystem.remove(displayName) end - if self.isNX and type(displayName) == "string" then - self.detail = Strings("%s imported. You may delete the copy from " - .. "imports/ when finished.", displayName) - end self.importing = nil self.workState = "complete" self.completeVersion = version self.status = "Ready" - self.detail = "Starting " .. info.displayName .. "..." + -- NX launcher stays put: keep the imports/ cleanup hint instead of + -- overwriting it with a "Starting…" line that never boots from here. + if self.launcher and self.isNX and type(displayName) == "string" then + self.detail = Strings("%s imported. You may delete the copy from " + .. "imports/ when finished.", displayName) + else + self.detail = "Starting " .. info.displayName .. "..." + end self.progress = 1 if self.launcher then -- Stay on the launcher; the player presses Play to boot the new game.