mirror of
https://github.com/TheBozos/TMB_Recomp.git
synced 2026-12-06 08:46:44 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd3a257d83 | ||
|
|
601cb31a95 | ||
|
|
88beda600e |
No files matched your search
@@ -7,6 +7,12 @@ under "Unreleased" as they land, then move them under the new version's heading
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
- After an update, the game could still be the previous version's: TMB Launcher's Play started the game built before the
|
||||
update until you pressed Rebuild now, and RecompLauncher did not build it again at all, so the update's fixes
|
||||
were missing. Play now builds the game again first (only what changed), and RecompLauncher rebuilds it after each
|
||||
update.
|
||||
|
||||
## [0.8.1] - 2026-12-03
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -3,6 +3,25 @@
|
||||
Use a scratch `PS2X_USER_DIR` for every automated run. Keep game data and generated code out of Git and release ZIPs.
|
||||
Publication is separate from a successful build; this checklist records what was actually verified.
|
||||
|
||||
v0.8.1 was published on 2026-12-03 after tagged CI and the owner's release request. Its draft assets were checked
|
||||
locally before publication, and the published files are byte-identical to the checked ones:
|
||||
- both player ZIPs pass the SHA-256 and package audits, carry an identical 8,027-file payload, and are stamped with
|
||||
the release commit and engine version `0.7.8`; the sources ZIP matches its hash; both carry the commit's
|
||||
`recomplauncher.json`; no package holds Python's bytecode cache any more (#131);
|
||||
- the Linux archive matches its hash and passes `verify_tar`; its `source/` is the zips' but for line ends;
|
||||
- the release's fix (red flashes after a lost level's retry, #133) was reproduced and checked before tagging: Prison
|
||||
Passage driven by the story pad script to a game over and its retry (`TMB_KILL_PLAYER=15 TMB_PLAYER_LIVES=1`),
|
||||
about 1,040 captures, had 4 solid-red and 7 half-red frames before the fix and none after;
|
||||
- Windows: a fresh install in a path with spaces and accents was built offline from the disc with only the bundled
|
||||
kit, stopped and resumed, played and exited normally, with menu/movie timing passing; the v0.8.0 install was
|
||||
updated by its own updater, rebuilt and played (a first run failed movie 1 at 28.4 pictures/s with the game clock
|
||||
at 0.991; the rerun passed at 29.97); the v0.3.2 updater accepted the migration ZIP; player data was kept in both
|
||||
update cases; Enhanced textures made 2,190 replacements;
|
||||
- Linux (Docker, Ubuntu 24.04, Mesa llvmpipe, Xvfb): the archive unpacked into a path with spaces and accents passes
|
||||
the launcher's self-check; the launcher's self-test prepared the game from the disc (stopped and resumed), played
|
||||
40 s and closed it with exit code 0 (the close-signal fix, #131); RecompLauncher's prepare through `kit/python3`
|
||||
built the game in 186 s ("Ready to play"), said "Already built" when run again, and its start played 600 frames.
|
||||
|
||||
v0.8.0 was published on 2026-12-02 after tagged CI and the owner's release request. Its draft assets were checked
|
||||
locally before publication:
|
||||
- both player ZIPs pass the SHA-256 and package audits, carry an identical 8,028-file payload, and are stamped with
|
||||
|
||||
+103
-6
@@ -372,6 +372,7 @@ struct App
|
||||
plat::Process builder;
|
||||
BuildModel model;
|
||||
bool building = false, cancelled = false;
|
||||
bool playAfterBuild = false; // Play pressed after an update: the game starts once the rebuild is done
|
||||
std::string notice; // a line under the Play card (done, stopped)
|
||||
unsigned noticeColor = ui::color::good;
|
||||
|
||||
@@ -920,9 +921,13 @@ struct App
|
||||
phase = Phase::Ready;
|
||||
notice = std::string(L("The game is ready. Prepared in ", "Le jeu est prêt. Préparé en ")) + fmtDuration(cfg.lastBuildSeconds) + ".";
|
||||
noticeColor = ui::color::good;
|
||||
if (playAfterBuild && !codeChanged())
|
||||
play();
|
||||
playAfterBuild = false;
|
||||
}
|
||||
else if (cancelled)
|
||||
{
|
||||
playAfterBuild = false;
|
||||
phase = Phase::Ready;
|
||||
notice = L("Stopped. Preparing continues from there next time.",
|
||||
"Arrêté. La préparation reprendra à partir de là.");
|
||||
@@ -936,6 +941,7 @@ struct App
|
||||
model.errorMessage = std::string(L("The build stopped unexpectedly (exit code ", "La préparation s'est arrêtée (code ")) +
|
||||
std::to_string(code) + ").";
|
||||
}
|
||||
playAfterBuild = false;
|
||||
phase = Phase::Failed;
|
||||
}
|
||||
}
|
||||
@@ -971,6 +977,21 @@ struct App
|
||||
|
||||
// -- the game
|
||||
|
||||
// The Play button. After an update the game folder still holds the old version's game: it is built again first
|
||||
// (only what changed), then started. Playing the old build would keep the bugs the update fixed.
|
||||
void playOrRebuild()
|
||||
{
|
||||
if (gameRunning || building || !built())
|
||||
return;
|
||||
if (!codeChanged())
|
||||
{
|
||||
play();
|
||||
return;
|
||||
}
|
||||
startBuild();
|
||||
playAfterBuild = building;
|
||||
}
|
||||
|
||||
void play()
|
||||
{
|
||||
if (gameRunning || building || !built())
|
||||
@@ -1241,12 +1262,16 @@ static void drawReady(App &app, float inner)
|
||||
if (built && !app.cfg.buildPending)
|
||||
{
|
||||
const ImVec2 start = ImGui::GetCursorScreenPos();
|
||||
const bool stale = app.codeChanged();
|
||||
if (ui::button(L("Play##play", "Jouer##play"), ImVec2(S(300), S(84)), ui::Kind::Primary, !app.gameRunning, 34))
|
||||
app.play();
|
||||
app.playOrRebuild();
|
||||
ImGui::SetItemDefaultFocus();
|
||||
ImGui::SetCursorScreenPos(ImVec2(start.x + S(330), start.y + S(4)));
|
||||
ImGui::BeginGroup();
|
||||
ui::text(L("Ready to play", "Prêt à jouer"), 22, ui::color::good);
|
||||
if (stale)
|
||||
ui::text(L("Play rebuilds the game first", "Jouer reconstruit d'abord le jeu"), 22, ui::color::wip);
|
||||
else
|
||||
ui::text(L("Ready to play", "Prêt à jouer"), 22, ui::color::good);
|
||||
ui::text(fileName(app.cfg.disc).c_str(), 16, ui::color::inkFaint);
|
||||
ImGui::EndGroup();
|
||||
ImGui::SetCursorScreenPos(ImVec2(start.x, start.y + S(84)));
|
||||
@@ -1320,8 +1345,8 @@ static void drawReady(App &app, float inner)
|
||||
: std::string(L("Version ", "La version ")) + app.sourceVersion +
|
||||
L(" is installed.", " est installée.");
|
||||
noteBox(what.c_str(),
|
||||
L("Rebuild the game to play it: only what changed is built again. Your saves and settings are kept.",
|
||||
"Reconstruisez le jeu pour y jouer : seul ce qui a changé est refait. Vos sauvegardes et réglages sont conservés."),
|
||||
L("The game is built again before it starts (Play or Rebuild now): only what changed. Your saves and settings are kept.",
|
||||
"Le jeu est reconstruit avant de démarrer (Jouer ou Reconstruire maintenant) : seul ce qui a changé. Vos sauvegardes et réglages sont conservés."),
|
||||
ui::color::wip, inner);
|
||||
gap(6);
|
||||
if (ui::button(L("Rebuild now", "Reconstruire maintenant"), ImVec2(0, S(48)), ui::Kind::Primary, !app.gameRunning))
|
||||
@@ -1824,7 +1849,7 @@ static void drawFrame(App &app)
|
||||
struct Selftest
|
||||
{
|
||||
std::string iso, shots, wrong;
|
||||
bool errorDemo = false, cancel = false, screensOnly = false, enhanceOnly = false;
|
||||
bool errorDemo = false, cancel = false, screensOnly = false, rebuildTest = false, enhanceOnly = false;
|
||||
bool failed = false;
|
||||
double playSeconds = 40, crashSeconds = 0;
|
||||
std::FILE *log = nullptr;
|
||||
@@ -1929,6 +1954,70 @@ struct Selftest
|
||||
}});
|
||||
}
|
||||
|
||||
// --rebuild-test: the game folder was built from an older release (an update unzipped over it). Play must build
|
||||
// the game again first, then start it: never the old build.
|
||||
void buildRebuildTest()
|
||||
{
|
||||
steps.push_back(shot("r1-stale", 1.0));
|
||||
steps.push_back({"play after an update", [this](App &app, double t)
|
||||
{
|
||||
if (t == 0.0)
|
||||
{
|
||||
say("source %s, built from %s", app.sourceCommit, app.builtCommit);
|
||||
if (!app.codeChanged())
|
||||
{
|
||||
say("FAIL the game is not seen as built from older code");
|
||||
failed = true;
|
||||
app.quit = true;
|
||||
return true;
|
||||
}
|
||||
app.playOrRebuild();
|
||||
if (!app.building || app.gameRunning)
|
||||
{
|
||||
say("FAIL Play did not rebuild first (building %s, game running %s)",
|
||||
app.building ? "yes" : "no", app.gameRunning ? "yes" : "no");
|
||||
failed = true;
|
||||
app.quit = true;
|
||||
return true;
|
||||
}
|
||||
say("Play started the rebuild");
|
||||
return false;
|
||||
}
|
||||
if (app.building)
|
||||
return false;
|
||||
if (!app.gameRunning)
|
||||
{
|
||||
say("FAIL the game did not start after the rebuild (phase %s, notice: %s)",
|
||||
std::to_string(static_cast<int>(app.phase)), app.notice);
|
||||
failed = true;
|
||||
app.quit = true;
|
||||
return true;
|
||||
}
|
||||
say("rebuilt, then the game started; built from %s", app.builtCommit);
|
||||
return true;
|
||||
}});
|
||||
steps.push_back({"game exits", [this](App &app, double t)
|
||||
{
|
||||
if (app.gameRunning && t < 30)
|
||||
return false;
|
||||
if (app.gameRunning)
|
||||
app.game.kill();
|
||||
return !app.gameRunning;
|
||||
}});
|
||||
steps.push_back(shot("r2-after", 1.0));
|
||||
steps.push_back({"quit", [this](App &app, double)
|
||||
{
|
||||
if (app.codeChanged())
|
||||
{
|
||||
say("FAIL still seen as built from older code");
|
||||
failed = true;
|
||||
}
|
||||
say("rebuild test done");
|
||||
app.quit = true;
|
||||
return true;
|
||||
}});
|
||||
}
|
||||
|
||||
void build()
|
||||
{
|
||||
if (screensOnly)
|
||||
@@ -1936,6 +2025,11 @@ struct Selftest
|
||||
buildScreens();
|
||||
return;
|
||||
}
|
||||
if (rebuildTest)
|
||||
{
|
||||
buildRebuildTest();
|
||||
return;
|
||||
}
|
||||
if (enhanceOnly)
|
||||
{
|
||||
buildEnhance();
|
||||
@@ -2260,7 +2354,7 @@ static int selfCheck(const std::string &release, const std::string &file, const
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
std::string release, selftestIso, shots, wrong;
|
||||
bool errorDemo = false, cancel = false, screensOnly = false, enhanceOnly = false;
|
||||
bool errorDemo = false, cancel = false, screensOnly = false, rebuildTest = false, enhanceOnly = false;
|
||||
double playSeconds = 40, crashSeconds = 0;
|
||||
float uiScale = 0;
|
||||
std::string updateUrl, selfCheckFile, reportPath, downloadPrefix;
|
||||
@@ -2290,6 +2384,8 @@ int main(int argc, char **argv)
|
||||
crashSeconds = std::atof(next().c_str());
|
||||
else if (a == "--screens")
|
||||
screensOnly = true;
|
||||
else if (a == "--rebuild-test") // a built game whose built_from.ini is an older release's: Play rebuilds, then plays
|
||||
rebuildTest = true;
|
||||
else if (a == "--enhance") // a test (with --selftest): Settings' Make enhanced textures, to its end
|
||||
enhanceOnly = true;
|
||||
else if (a == "--ui-scale") // a test: the layout at another DPI scale (1.5 = Windows' 150 %)
|
||||
@@ -2347,6 +2443,7 @@ int main(int argc, char **argv)
|
||||
test.playSeconds = playSeconds;
|
||||
test.crashSeconds = crashSeconds;
|
||||
test.screensOnly = screensOnly;
|
||||
test.rebuildTest = rebuildTest;
|
||||
test.enhanceOnly = enhanceOnly;
|
||||
#ifdef _WIN32
|
||||
test.log = _wfopen((plat::path(test.shots) / L"selftest.log").c_str(), L"w");
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
"""The built stamps: after an update, the game is built again (RecompLauncher's done file is per version)."""
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT / 'tools'))
|
||||
import make_release
|
||||
import tmb_build
|
||||
|
||||
|
||||
class BuiltStampTests(unittest.TestCase):
|
||||
def test_release_manifest_versions_done(self):
|
||||
# The shipped manifest waits for game/built_<version>.ini, which the build writes: after an update the file is
|
||||
# missing and RecompLauncher builds the game again. The repository's keeps built_from.ini.
|
||||
manifest = (ROOT / 'recomplauncher.json').read_bytes()
|
||||
shipped = json.loads(make_release.release_manifest(manifest, '9.8.7'))
|
||||
self.assertEqual(shipped['prepare']['done'], ['{install}/game/built_9.8.7.ini'])
|
||||
with self.assertRaises(make_release.ReleaseError):
|
||||
make_release.release_manifest(manifest.replace(b'built_from.ini', b'other.ini'), '9.8.7')
|
||||
|
||||
def test_built_stamps(self):
|
||||
# A build writes built_from.ini (the launcher) and built_<version>.ini (RecompLauncher's done), and removes an
|
||||
# older version's file.
|
||||
with tempfile.TemporaryDirectory() as game:
|
||||
Path(game, 'built_0.0.1.ini').write_text('version = 0.0.1\n', encoding='utf-8')
|
||||
tmb_build.Build.write_built_from(SimpleNamespace(game=game))
|
||||
self.assertEqual(sorted(os.listdir(game)), sorted(['built_from.ini', tmb_build.built_stamp_name()]))
|
||||
self.assertRegex(tmb_build.built_stamp_name(), r'^built_[\w.\-]+\.ini$')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -74,6 +74,16 @@ LINUX_SUFFIX = '-linux.tar.gz'
|
||||
LINUX_LAUNCHER = 'tmb-launcher'
|
||||
# RecompLauncher's manifest (recomplauncher.com/sdk): at the repo's top, shipped at the zip's top.
|
||||
RECOMPLAUNCHER_JSON = 'recomplauncher.json'
|
||||
RECOMPLAUNCHER_DONE = b'"{install}/game/built_from.ini"'
|
||||
|
||||
|
||||
def release_manifest(manifest, version):
|
||||
"""The shipped recomplauncher.json: prepare's done names game/built_<version>.ini (the build writes it beside
|
||||
built_from.ini), so after an update RecompLauncher finds it missing and builds the game again. The repository's
|
||||
manifest keeps built_from.ini (a checkout's builds are not versioned)."""
|
||||
if manifest.count(RECOMPLAUNCHER_DONE) != 1:
|
||||
raise ReleaseError('recomplauncher.json: prepare.done must be ["{install}/game/built_from.ini"]')
|
||||
return manifest.replace(RECOMPLAUNCHER_DONE, b'"{install}/game/built_%s.ini"' % version.encode())
|
||||
VERSION_RE = re.compile(r'^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$')
|
||||
MSYS2_SOURCES = 'https://repo.msys2.org/mingw/sources/'
|
||||
# The launcher's font (launcher/CMakeLists.txt pins the same commit and hash).
|
||||
@@ -787,6 +797,7 @@ class Release:
|
||||
write_text(os.path.join(self.stage, 'CHANGELOG.md'), text, crlf=True)
|
||||
# RecompLauncher's manifest at the top, next to the launcher, where RecompLauncher reads it: the commit's.
|
||||
manifest = git('show', '%s:%s' % (self.commit, RECOMPLAUNCHER_JSON), binary=True)
|
||||
manifest = release_manifest(manifest, self.version)
|
||||
with open(os.path.join(self.stage, RECOMPLAUNCHER_JSON), 'wb') as f:
|
||||
f.write(manifest)
|
||||
|
||||
@@ -1114,6 +1125,7 @@ class LinuxRelease(Release):
|
||||
text = text[:at] + '## [%s] - test build\n\n%s\n\n' % (self.version, self.changelog_section) + text[at:]
|
||||
write_text(os.path.join(self.stage, 'CHANGELOG.md'), text)
|
||||
manifest = git('show', '%s:%s' % (self.commit, RECOMPLAUNCHER_JSON), binary=True)
|
||||
manifest = release_manifest(manifest, self.version)
|
||||
with open(os.path.join(self.stage, RECOMPLAUNCHER_JSON), 'wb') as f:
|
||||
f.write(manifest)
|
||||
|
||||
|
||||
+25
-1
@@ -166,6 +166,20 @@ def fingerprint(*items):
|
||||
return hashlib.sha1(json.dumps(items, sort_keys=True, default=str).encode()).hexdigest()[:16]
|
||||
|
||||
|
||||
def built_stamp_name():
|
||||
"""game/built_<version>.ini: the file recomplauncher.json's prepare lists as done (see write_built_from). The
|
||||
version is the release's (release.ini, written by tools/make_release.py), else the VERSION file, else dev."""
|
||||
for name, pattern in (('release.ini', r'^version\s*=\s*(\S+)'), ('VERSION', r'^(\S+)')):
|
||||
try:
|
||||
with open(os.path.join(ROOT, name), encoding='utf-8') as f:
|
||||
found = re.search(pattern, f.read(), re.M)
|
||||
except OSError:
|
||||
continue
|
||||
if found:
|
||||
return 'built_%s.ini' % found.group(1)
|
||||
return 'built_dev.ini'
|
||||
|
||||
|
||||
def file_stamp(path):
|
||||
try:
|
||||
st = os.stat(path)
|
||||
@@ -750,9 +764,19 @@ class Build:
|
||||
except OSError:
|
||||
pass
|
||||
text = 'version = dev\ncommit = %s\n' % commit
|
||||
body = '\n'.join(l for l in text.splitlines() if l and not l.startswith('#')) + '\n'
|
||||
with open(os.path.join(self.game, 'built_from.ini'), 'w', encoding='utf-8', newline='\n') as f:
|
||||
f.write('# The TMB_Recomp code this game folder was built from (tools/tmb_build.py writes this file).\n')
|
||||
f.write('\n'.join(l for l in text.splitlines() if l and not l.startswith('#')) + '\n')
|
||||
f.write(body)
|
||||
# The same, named after the version: recomplauncher.json's prepare waits for this one (its done), so after an
|
||||
# update RecompLauncher finds it missing and builds the game again. Older versions' files are removed.
|
||||
name = built_stamp_name()
|
||||
for old in os.listdir(self.game):
|
||||
if re.fullmatch(r'built_\d[\w.\-]*\.ini', old) and old != name:
|
||||
os.remove(os.path.join(self.game, old))
|
||||
with open(os.path.join(self.game, name), 'w', encoding='utf-8', newline='\n') as f:
|
||||
f.write('# The game folder is built from this version (RecompLauncher waits for this file).\n')
|
||||
f.write(body)
|
||||
|
||||
# -- driver
|
||||
|
||||
|
||||
Reference in new issue
Block a user