mirror of
https://github.com/TheBozos/TMB_Recomp.git
synced 2026-12-01 12:54:41 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb17ea2508 | ||
|
|
c00c238331 | ||
|
|
14027a5026 | ||
|
|
2e37b81b0d | ||
|
|
13a63bcafd | ||
|
|
3f6623f47e | ||
|
|
f0806c5ef0 | ||
|
|
6db6a16b0d | ||
|
|
7ccc02b050 |
No files matched your search
@@ -13,6 +13,8 @@ jobs:
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.14'
|
||||
- name: The BozoEngine release cmake/bozo_engine.json pins (the RecompLauncher settings check reads it)
|
||||
run: cmake -P cmake/bozo_engine_fetch.cmake
|
||||
- name: Release, migration and timing checks
|
||||
run: python -m unittest discover -s tests -v
|
||||
- name: Python syntax
|
||||
|
||||
+14
-1
@@ -7,6 +7,18 @@ under "Unreleased" as they land, then move them under the new version's heading
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.7.3] - 2026-12-01
|
||||
|
||||
### Added
|
||||
|
||||
- **RecompLauncher support.** Releases carry a `recomplauncher.json`, so [RecompLauncher](https://recomplauncher.com)
|
||||
can install TMB_Recomp, check the disc against the USA dump, prepare the game with the release's own build, start
|
||||
it, show the video settings (display mode, widescreen, frame rate, render scale, anti-aliasing, texture smoothing)
|
||||
on the game's page and back up the memory cards. A game set up there keeps its saves, settings and logs in its
|
||||
`recompdata` folder.
|
||||
- Preparing again without a disc image uses the one the earlier preparation kept in the game folder, so an update can
|
||||
be built after the original image was deleted.
|
||||
|
||||
## [0.7.2] - 2026-11-30
|
||||
|
||||
### Changed
|
||||
@@ -299,7 +311,8 @@ The first release. You build the game on your own PC from your own USA disc; not
|
||||
- Technical: built from TMB_Recomp's code and the PS2Recomp fork (`native/renderer`) with the build kit's GCC 16.2,
|
||||
FFmpeg 9.0.2 and Python 3.14; the default mode has no GS, VU or SPU2 emulation and no IOP hardware model.
|
||||
|
||||
[Unreleased]: https://github.com/TheBozos/TMB_Recomp/compare/v0.7.2...HEAD
|
||||
[Unreleased]: https://github.com/TheBozos/TMB_Recomp/compare/v0.7.3...HEAD
|
||||
[0.7.3]: https://github.com/TheBozos/TMB_Recomp/compare/v0.7.2...v0.7.3
|
||||
[0.7.2]: https://github.com/TheBozos/TMB_Recomp/compare/v0.7.1...v0.7.2
|
||||
[0.7.1]: https://github.com/TheBozos/TMB_Recomp/compare/v0.7.0...v0.7.1
|
||||
[0.7.0]: https://github.com/TheBozos/TMB_Recomp/compare/v0.6.0...v0.7.0
|
||||
|
||||
@@ -50,6 +50,12 @@ remains available for comparison. The steps below describe the native packages.
|
||||
graphics driver is needed. The game then uses them; turn them off there or in F2 → Video → Texture pack. Nothing is
|
||||
downloaded or sent, and the result is yours alone: do not share it.
|
||||
|
||||
**RecompLauncher.** Releases carry a [`recomplauncher.json`](recomplauncher.json), so
|
||||
[RecompLauncher](https://recomplauncher.com) can install TMB_Recomp, check your disc, prepare the game with the same
|
||||
build, show the video settings on the game's page and back up the memory cards. A game set up there keeps its saves,
|
||||
settings and logs in its own `recompdata` folder, not in `%APPDATA%\TMB_Recomp`: copy `mc0` across to bring saves
|
||||
from TMB Launcher. Enhanced textures are made by TMB Launcher only.
|
||||
|
||||
Requires **Windows 10 version 1903 or newer / Windows 11, an AVX2 and FMA capable CPU, and OpenGL 3.3**.
|
||||
Original heat haze around fire and explosions is enabled by default. `BOZO_HEAT_HAZE=0` disables it for comparisons
|
||||
with the older PC port. Menus and movies use their native timing, independently of the presentation frame rate.
|
||||
|
||||
@@ -45,6 +45,11 @@ if(NOT bozo_engine_have STREQUAL bozo_engine_want)
|
||||
set(bozo_engine_unpack "${bozo_engine_root}/.BozoEngine-unpack")
|
||||
file(REMOVE_RECURSE "${bozo_engine_tree}" "${bozo_engine_unpack}")
|
||||
file(ARCHIVE_EXTRACT INPUT "${bozo_engine_archive}" DESTINATION "${bozo_engine_unpack}")
|
||||
# Its files dated now: unpacked with the archive's own dates (the release's, older than objects built since), a
|
||||
# build made on the last release kept objects compiled against the old headers after a pin bump (Shinobido 0.7.0 ->
|
||||
# 0.7.3: two files built on the old renderer.h, objects and the HUD missing from the picture).
|
||||
file(GLOB_RECURSE bozo_engine_files LIST_DIRECTORIES false "${bozo_engine_unpack}/*")
|
||||
file(TOUCH_NOCREATE ${bozo_engine_files})
|
||||
file(WRITE "${bozo_engine_unpack}/${bozo_engine_name}/.release" "${bozo_engine_want}\n")
|
||||
file(RENAME "${bozo_engine_unpack}/${bozo_engine_name}" "${bozo_engine_tree}")
|
||||
file(REMOVE_RECURSE "${bozo_engine_unpack}")
|
||||
|
||||
@@ -3,6 +3,35 @@
|
||||
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.7.3 was published on 2026-12-01 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,011-file payload, and are stamped with
|
||||
the release commit and engine version `0.6.0`; the sources ZIP matches its hash;
|
||||
- the release's change (RecompLauncher support, #125): both ZIPs carry the commit's `recomplauncher.json` at their
|
||||
top. On the `-bozo.zip`, unpacked into a path with accents, RecompLauncher's prepare and start (run as its
|
||||
`lib.rs` does, with DC's `rl_sim.py`) built the game in 158 s ending "Ready to play", said "Already built" when run
|
||||
again, played 600 frames hidden and muted at 59.7 frames/s with the cards and logs in `recompdata`, and prepared
|
||||
again from the kept `disc.iso` without the player's image;
|
||||
- a fresh install in a path with spaces and accents was built offline from the disc with only the bundled kit. The
|
||||
build was stopped and resumed, then the game played and exited normally, with menu/movie timing passing;
|
||||
- the v0.7.1 install was updated by its own updater, rebuilt and played; the v0.3.2 updater accepted the migration
|
||||
ZIP. Player data was kept in both update cases;
|
||||
- on the fresh install, the launcher's Enhanced textures made 2,181 replacements.
|
||||
|
||||
v0.7.2 was published on 2026-11-30 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,009-file payload, and are stamped with
|
||||
the release commit and engine version `0.6.0`; the sources ZIP matches its hash and holds the pinned engine release
|
||||
(`source/BozoEngine/.release`);
|
||||
- the release's changes (engine fetched from a pinned BozoEngine release, #121; BozoEngine 0.6.0, #122) were checked
|
||||
before tagging: a clean checkout builds with no submodule, and headless 1P (9,500 frames) and 4P (8,500 frames)
|
||||
records match the previous engine on every field;
|
||||
- a fresh install in a path with spaces and accents was built offline from the disc with only the bundled kit. The
|
||||
build was stopped and resumed, then the game played and exited normally, with menu/movie timing passing;
|
||||
- the v0.7.1 install was updated by its own updater, rebuilt and played; the v0.3.2 updater accepted the migration
|
||||
ZIP. Player data was kept in both update cases;
|
||||
- on the fresh install, the launcher's Enhanced textures made 2,191 replacements.
|
||||
|
||||
v0.7.1 was published on 2026-11-30 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,003-file payload, and are stamped with
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
{
|
||||
"$schema": "https://recomplauncher.com/schema/recomplauncher.json",
|
||||
"format": 1,
|
||||
"name": "Twisted Metal: Black",
|
||||
"repo": "TheBozos/TMB_Recomp",
|
||||
"inputs": [
|
||||
{
|
||||
"id": "game",
|
||||
"label": "Your disc image of the USA release, serial SCUS-97101 (.iso, or .bin/.cue).",
|
||||
"formats": [{ "type": "file" }],
|
||||
"check": { "iso9660": "SCUS_971.01", "ids": ["SCUS-97101"] },
|
||||
"dumps": [{ "name": "USA", "size": 3799744512, "crc32": "347e93f9" }]
|
||||
}
|
||||
],
|
||||
"prepare": {
|
||||
"program": ["kit/python/python.exe"],
|
||||
"args": ["-I", "-X", "utf8", "{install}/source/tools/tmb_build.py", "--disc={input:game}",
|
||||
"--out", "{install}/build", "--game", "{install}/game", "--progress-lines"],
|
||||
"label": "Building the game from your disc",
|
||||
"done": ["{install}/game/built_from.ini"],
|
||||
"keeps_copy": true
|
||||
},
|
||||
"start": {
|
||||
"program": ["game/tmb.exe"],
|
||||
"args": ["--elf", "{install}/game/SCUS_971.01", "--iso", "{install}/game/disc.iso"],
|
||||
"env": { "PS2X_USER_DIR": "{data}" }
|
||||
},
|
||||
"folders": {
|
||||
"game": [{ "path": "{install}/game" }],
|
||||
"saves": [{ "path": "{data}/mc0" }],
|
||||
"logs": [{ "path": "{data}/logs" }]
|
||||
},
|
||||
"saves": ["{data}/mc0", "{data}/mc1"],
|
||||
"config": [{ "format": "ini", "file": [{ "path": "{data}/video.ini" }] }],
|
||||
"settings": [
|
||||
{
|
||||
"id": "mode", "label": "Display mode",
|
||||
"choices": [
|
||||
{ "label": "Windowed", "set": { "video/mode": "windowed" } },
|
||||
{ "label": "Borderless", "set": { "video/mode": "borderless" } },
|
||||
{ "label": "Full screen", "set": { "video/mode": "fullscreen" } }
|
||||
],
|
||||
"defaults": { "video/mode": "windowed" }
|
||||
},
|
||||
{
|
||||
"id": "widescreen", "label": "Widescreen",
|
||||
"help": "16:9 with more of the arena at the sides in one- and two-player matches; menus, movies and four-player matches stay 4:3.",
|
||||
"choices": [
|
||||
{ "label": "Off (4:3)", "set": { "video/widescreen": "off" } },
|
||||
{ "label": "On (16:9)", "set": { "video/widescreen": "on" } }
|
||||
],
|
||||
"defaults": { "video/widescreen": "off" }
|
||||
},
|
||||
{
|
||||
"id": "frame_rate", "label": "Frame rate",
|
||||
"help": "Above 60, frames between the game's are drawn in between; the game itself still runs at its own speed.",
|
||||
"choices": [
|
||||
{ "label": "60 (the game's)", "set": { "video/frame_rate": "game" } },
|
||||
{ "label": "Monitor's refresh", "set": { "video/frame_rate": "monitor" } },
|
||||
{ "label": "120", "set": { "video/frame_rate": "120" } },
|
||||
{ "label": "144", "set": { "video/frame_rate": "144" } },
|
||||
{ "label": "240", "set": { "video/frame_rate": "240" } }
|
||||
],
|
||||
"defaults": { "video/frame_rate": "game" }
|
||||
},
|
||||
{
|
||||
"id": "render_scale", "label": "Render scale",
|
||||
"help": "The 3D drawn at this many times the window's size.",
|
||||
"choices": [
|
||||
{ "label": "1x", "set": { "video/render_scale": "1" } },
|
||||
{ "label": "1.5x", "set": { "video/render_scale": "1.5" } },
|
||||
{ "label": "2x", "set": { "video/render_scale": "2" } },
|
||||
{ "label": "3x", "set": { "video/render_scale": "3" } },
|
||||
{ "label": "4x", "set": { "video/render_scale": "4" } }
|
||||
],
|
||||
"defaults": { "video/render_scale": "1" }
|
||||
},
|
||||
{
|
||||
"id": "anti_aliasing", "label": "Anti-aliasing",
|
||||
"help": "Smooths the edges of the 3D (MSAA).",
|
||||
"choices": [
|
||||
{ "label": "Off", "set": { "video/anti_aliasing": "off" } },
|
||||
{ "label": "2x", "set": { "video/anti_aliasing": "2x" } },
|
||||
{ "label": "4x", "set": { "video/anti_aliasing": "4x" } },
|
||||
{ "label": "8x", "set": { "video/anti_aliasing": "8x" } }
|
||||
],
|
||||
"defaults": { "video/anti_aliasing": "off" }
|
||||
},
|
||||
{
|
||||
"id": "texture_smoothing", "label": "Texture smoothing",
|
||||
"help": "Off samples textures as the PS2 does; the others stop distant textures shimmering.",
|
||||
"choices": [
|
||||
{ "label": "Off", "set": { "video/texture_smoothing": "off" } },
|
||||
{ "label": "Trilinear", "set": { "video/texture_smoothing": "trilinear" } },
|
||||
{ "label": "4x anisotropic", "set": { "video/texture_smoothing": "4x" } },
|
||||
{ "label": "8x anisotropic", "set": { "video/texture_smoothing": "8x" } },
|
||||
{ "label": "16x anisotropic", "set": { "video/texture_smoothing": "16x" } }
|
||||
],
|
||||
"defaults": { "video/texture_smoothing": "off" }
|
||||
},
|
||||
{
|
||||
"id": "pause_in_background", "label": "Pause in the background", "advanced": true,
|
||||
"help": "Holds the game while another window has the focus.",
|
||||
"choices": [
|
||||
{ "label": "Off", "set": { "video/pause_in_background": "off" } },
|
||||
{ "label": "On", "set": { "video/pause_in_background": "on" } }
|
||||
],
|
||||
"defaults": { "video/pause_in_background": "off" }
|
||||
},
|
||||
{
|
||||
"id": "fast_forward", "label": "Fast-forward speed", "advanced": true,
|
||||
"help": "The game's speed while fast forward is held (` on the keyboard, or the touchpad).",
|
||||
"choices": [
|
||||
{ "label": "2x", "set": { "video/fast_forward": "2x" } },
|
||||
{ "label": "3x", "set": { "video/fast_forward": "3x" } },
|
||||
{ "label": "5x", "set": { "video/fast_forward": "5x" } },
|
||||
{ "label": "10x", "set": { "video/fast_forward": "10x" } },
|
||||
{ "label": "Unlimited", "set": { "video/fast_forward": "unlimited" } }
|
||||
],
|
||||
"defaults": { "video/fast_forward": "3x" }
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{ "id": "logs", "label": "Logs", "help": "The game's logs, for a bug report.", "open": "logs" }
|
||||
],
|
||||
"looks": { "graphics": "opengl" },
|
||||
"system": { "windows": { "version": "10", "graphics": { "opengl": "3.3" } } }
|
||||
}
|
||||
+113
-1
@@ -2,6 +2,7 @@
|
||||
import contextlib
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import tempfile
|
||||
import io
|
||||
@@ -20,7 +21,7 @@ from unittest.mock import patch
|
||||
from types import SimpleNamespace
|
||||
|
||||
REQUIRED = (
|
||||
'TMB Launcher.exe', 'README.txt', 'CHANGELOG.md', 'LICENSES/TMB_Recomp/LICENSE',
|
||||
'TMB Launcher.exe', 'README.txt', 'CHANGELOG.md', 'recomplauncher.json', 'LICENSES/TMB_Recomp/LICENSE',
|
||||
'LICENSES/BozoEngine/LICENSE', 'source/release.ini', 'kit/kit_manifest.json',
|
||||
'kit/python/python.exe', 'source/tools/tmb_build.py', 'source/BozoEngine/CMakeLists.txt',
|
||||
'kit/deps/sdl3-src/CMakeLists.txt', 'kit/deps/imgui-src/imgui.cpp',
|
||||
@@ -288,5 +289,116 @@ class TimingTests(unittest.TestCase):
|
||||
self.assertTrue(check_timing.check('')[0].startswith('FAIL:'))
|
||||
|
||||
|
||||
class RecompLauncherTests(unittest.TestCase):
|
||||
"""recomplauncher.json (RecompLauncher's manifest, recomplauncher.com/sdk) and what it runs."""
|
||||
|
||||
def manifest(self):
|
||||
return json.loads((ROOT / 'recomplauncher.json').read_text(encoding='utf-8'))
|
||||
|
||||
def test_progress_lines_follow_the_steps(self):
|
||||
self.assertEqual(tmb_build.progress_line(('PROGRESS', 'verify', '1/8', 'Checking the disc')),
|
||||
'progress 0.000 Checking the disc')
|
||||
before = sum(tmb_build.STEP_WEIGHTS[s] for s in tmb_build.STEPS[:tmb_build.STEPS.index('packs')])
|
||||
half = (before + tmb_build.STEP_WEIGHTS['packs'] / 2) / sum(tmb_build.STEP_WEIGHTS.values())
|
||||
self.assertEqual(tmb_build.progress_line(('PERCENT', 'packs', 50)),
|
||||
'progress %.3f %s (50%%)' % (half, tmb_build.STEP_TITLES['packs']))
|
||||
for other in (('SKIP', 'verify', '1/8'), ('DONE', 'stage', '8/8', 1.0), ('INFO', 'total', '1 s'),
|
||||
('ERROR', 'compile', 'x')):
|
||||
self.assertIsNone(tmb_build.progress_line(other))
|
||||
self.assertEqual(set(tmb_build.STEP_WEIGHTS), set(tmb_build.STEPS))
|
||||
# The launcher's own step weights (its progress bar), so both bars move alike.
|
||||
model = (ROOT / 'launcher' / 'src' / 'build_model.cpp').read_text(encoding='utf-8')
|
||||
self.assertEqual(dict((k, int(v)) for k, v in re.findall(r'\{"([a-z]+)", ([0-9]+)\}', model)),
|
||||
tmb_build.STEP_WEIGHTS)
|
||||
shares = []
|
||||
for step in tmb_build.STEPS:
|
||||
for parts in (('PROGRESS', step, '', ''), ('PERCENT', step, 37), ('PERCENT', step, 100)):
|
||||
shares.append(float(tmb_build.progress_line(parts).split()[1]))
|
||||
self.assertEqual(shares, sorted(shares))
|
||||
self.assertTrue(0 <= shares[0] and shares[-1] < 1)
|
||||
|
||||
def test_a_missing_disc_says_why_and_an_earlier_build_keeps_one(self):
|
||||
with tempfile.TemporaryDirectory() as folder:
|
||||
def run(*extra):
|
||||
return subprocess.run([sys.executable, '-I', '-X', 'utf8', str(ROOT / 'tools' / 'tmb_build.py'),
|
||||
'--out', str(Path(folder) / 'build'), '--game', str(Path(folder) / 'game')]
|
||||
+ list(extra), capture_output=True, text=True, encoding='utf-8')
|
||||
r = run('--progress-lines')
|
||||
self.assertEqual(r.returncode, 1)
|
||||
self.assertIn('ERROR verify no disc image given', r.stdout.strip().splitlines()[-1])
|
||||
# No --disc: the disc image an earlier build kept in the game folder (keeps_copy). Here it is not a disc.
|
||||
(Path(folder) / 'game').mkdir()
|
||||
(Path(folder) / 'game' / 'disc.iso').write_bytes(b'\0' * 65536)
|
||||
r = run('--check')
|
||||
self.assertEqual(r.returncode, 1)
|
||||
self.assertIn('ERROR verify disc.iso', r.stdout)
|
||||
|
||||
def test_manifest_runs_what_the_release_ships(self):
|
||||
m = self.manifest()
|
||||
self.assertEqual(m['format'], 1)
|
||||
self.assertEqual(m['repo'], 'TheBozos/TMB_Recomp')
|
||||
disc = m['inputs'][0]
|
||||
self.assertEqual(disc['id'], 'game')
|
||||
self.assertEqual(disc['check']['iso9660'], tmb_build.ELF_NAME)
|
||||
self.assertEqual(disc['check']['ids'], ['SCUS-97101'])
|
||||
# Redump's Twisted Metal: Black (USA), SCUS-97101 v1.00: its one dump, a DVD-5 (redump.org/disc/15035).
|
||||
self.assertEqual(disc['dumps'], [{'name': 'USA', 'size': 3799744512, 'crc32': '347e93f9'}])
|
||||
prepare, start = m['prepare'], m['start']
|
||||
self.assertEqual(prepare['program'], ['kit/python/python.exe'])
|
||||
self.assertIn('kit/python/python.exe', REQUIRED)
|
||||
self.assertIn('{install}/source/tools/tmb_build.py', prepare['args'])
|
||||
self.assertIn('source/tools/tmb_build.py', REQUIRED)
|
||||
# The disc as one argument: RecompLauncher leaves it out when the player's copy is gone (keeps_copy).
|
||||
self.assertTrue(prepare['keeps_copy'])
|
||||
self.assertEqual([a for a in prepare['args'] if '{input:game}' in a], ['--disc={input:game}'])
|
||||
help_text = subprocess.run([sys.executable, '-I', str(ROOT / 'tools' / 'tmb_build.py'), '--help'],
|
||||
capture_output=True, text=True, check=True).stdout
|
||||
for flag in (a.split('=', 1)[0] for a in prepare['args'] if a.startswith('--')):
|
||||
self.assertIn(flag, help_text)
|
||||
self.assertIn('--progress-lines', prepare['args'])
|
||||
# The working folder is the program's (kit/python): every path RecompLauncher passes is {install}'s.
|
||||
for a in prepare['args']:
|
||||
if '/' in a:
|
||||
self.assertTrue(a.split('=', 1)[-1].startswith(('{install}/', '{input:')), a)
|
||||
self.assertEqual(prepare['done'], ['{install}/game/built_from.ini'])
|
||||
self.assertEqual(start['program'], ['game/' + tmb_build.GAME_EXE + '.exe'])
|
||||
self.assertEqual(start['args'], ['--elf', '{install}/game/' + tmb_build.ELF_NAME, '--iso',
|
||||
'{install}/game/disc.iso'])
|
||||
# Everything the game writes (cards, settings, logs, save states) in RecompLauncher's {data}.
|
||||
self.assertEqual(start['env'], {'PS2X_USER_DIR': '{data}'})
|
||||
self.assertEqual(m['saves'], ['{data}/mc0', '{data}/mc1'])
|
||||
|
||||
def test_settings_are_keys_the_game_reads(self):
|
||||
m = self.manifest()
|
||||
self.assertEqual(m['config'], [{'format': 'ini', 'file': [{'path': '{data}/video.ini'}]}])
|
||||
source = ROOT / 'BozoEngine' / 'runtime' / 'app' / 'video_settings.cpp'
|
||||
if not source.is_file():
|
||||
self.skipTest('no BozoEngine tree (cmake -P cmake/bozo_engine_fetch.cmake)')
|
||||
written = set(re.findall(r'<< "([a-z_]+) = "', source.read_text(encoding='utf-8')))
|
||||
self.assertIn('widescreen', written)
|
||||
ids = [s['id'] for s in m['settings']]
|
||||
self.assertEqual(len(ids), len(set(ids)))
|
||||
for setting in m['settings']:
|
||||
keys = set(setting['defaults'])
|
||||
for choice in setting['choices']:
|
||||
self.assertEqual(set(choice['set']), keys, setting['id'])
|
||||
for key in keys:
|
||||
section, name = key.split('/')
|
||||
self.assertEqual(section, 'video')
|
||||
self.assertIn(name, written)
|
||||
values = [c['set'][k] for c in setting['choices'] for k in keys]
|
||||
self.assertEqual(len(values), len(set(values)), setting['id'])
|
||||
self.assertIn(setting['defaults'], [c['set'] for c in setting['choices']], setting['id'])
|
||||
|
||||
def test_release_zip_carries_the_manifest_at_its_top(self):
|
||||
with tempfile.TemporaryDirectory() as folder:
|
||||
path = Path(folder) / 'no_manifest.zip'
|
||||
with zipfile.ZipFile(path, 'w') as archive:
|
||||
for name in REQUIRED:
|
||||
if name != 'recomplauncher.json':
|
||||
archive.writestr('TMB_Recomp_Bozo/' + name, b'fixture')
|
||||
self.assertIn('TMB_Recomp_Bozo/recomplauncher.json is missing', make_release.verify_zip(path))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -28,7 +28,8 @@ What it does, from <commit> (default HEAD; only committed files count, the worki
|
||||
changelog CHANGELOG.md's section for the version (## [x.y.z], Keep a Changelog), from the commit: the release
|
||||
refuses to be made without one (an empty one, or only "Unreleased", too) unless
|
||||
--allow-missing-changelog (test builds). CHANGELOG.md is shipped at the zip's top (the launcher's
|
||||
"What's new" reads it) and the section is the release notes' "What's new".
|
||||
"What's new" reads it) and the section is the release notes' "What's new". recomplauncher.json (the
|
||||
commit's) is shipped at the zip's top too, where RecompLauncher reads it.
|
||||
zip TMB_Recomp-<version>.zip (deflate, entries sorted, every timestamp the commit's), <zip>.sha256,
|
||||
RELEASE_NOTES.md (the changelog section, the hashes, the source offer: the GitHub release's body). The
|
||||
zip's names are audited again.
|
||||
@@ -67,6 +68,8 @@ NAME = 'TMB_Recomp'
|
||||
# sit beside the fork build's (<NAME>-<version>.zip, folder TMB_Recomp) on a release page and on a player's disk.
|
||||
FLAVOR = 'bozo'
|
||||
TOP = 'TMB_Recomp_Bozo'
|
||||
# RecompLauncher's manifest (recomplauncher.com/sdk): at the repo's top, shipped at the zip's top.
|
||||
RECOMPLAUNCHER_JSON = 'recomplauncher.json'
|
||||
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).
|
||||
@@ -769,6 +772,10 @@ class Release:
|
||||
at = at + 1 if at >= 0 else len(text)
|
||||
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, 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)
|
||||
with open(os.path.join(self.stage, RECOMPLAUNCHER_JSON), 'wb') as f:
|
||||
f.write(manifest)
|
||||
|
||||
# -- the changelog
|
||||
|
||||
@@ -994,7 +1001,7 @@ def verify_zip(path, top=TOP):
|
||||
problems.append('%s: an ELF file' % n)
|
||||
if len(head) >= 0x8006 and head[0x8001:0x8006] == b'CD001':
|
||||
problems.append('%s: an ISO9660 volume' % n)
|
||||
for need in ('TMB Launcher.exe', 'README.txt', 'CHANGELOG.md', 'LICENSES/TMB_Recomp/LICENSE',
|
||||
for need in ('TMB Launcher.exe', 'README.txt', 'CHANGELOG.md', RECOMPLAUNCHER_JSON, 'LICENSES/TMB_Recomp/LICENSE',
|
||||
'LICENSES/BozoEngine/LICENSE', 'source/release.ini', 'kit/kit_manifest.json',
|
||||
'kit/python/python.exe', 'source/tools/tmb_build.py', 'source/BozoEngine/CMakeLists.txt',
|
||||
'kit/deps/sdl3-src/CMakeLists.txt', 'kit/deps/imgui-src/imgui.cpp'):
|
||||
|
||||
+43
-2
@@ -106,8 +106,31 @@ class BuildError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
# --progress-lines: RecompLauncher's setup step (recomplauncher.json's prepare) reads "progress <0 to 1> <text>" lines.
|
||||
PROGRESS_LINES = False
|
||||
# Each step's share of the bar: its usual seconds on a first build (launcher/src/build_model.cpp's kSteps).
|
||||
STEP_WEIGHTS = {'verify': 1, 'extract': 2, 'configure': 60, 'tools': 7, 'recompile': 2, 'packs': 32, 'compile': 55,
|
||||
'stage': 1}
|
||||
|
||||
|
||||
def emit(*parts):
|
||||
print(' '.join(str(p) for p in parts), flush=True)
|
||||
if PROGRESS_LINES:
|
||||
line = progress_line(parts)
|
||||
if line:
|
||||
print(line, flush=True)
|
||||
|
||||
|
||||
def progress_line(parts):
|
||||
"""RecompLauncher's line for a PROGRESS (a step starts) or PERCENT (it moves on) line, else None: the share of the
|
||||
whole build done, and the step's title (recomplauncher.com/sdk, prepare)."""
|
||||
if len(parts) < 3 or parts[0] not in ('PROGRESS', 'PERCENT') or parts[1] not in STEP_WEIGHTS:
|
||||
return None
|
||||
step = parts[1]
|
||||
pct = int(parts[2]) if parts[0] == 'PERCENT' else 0
|
||||
before = sum(STEP_WEIGHTS[s] for s in STEPS[:STEPS.index(step)])
|
||||
done = (before + STEP_WEIGHTS[step] * min(max(pct, 0), 100) / 100) / sum(STEP_WEIGHTS.values())
|
||||
return 'progress %.3f %s%s' % (min(done, 0.999), STEP_TITLES[step], ' (%d%%)' % pct if parts[0] == 'PERCENT' else '')
|
||||
|
||||
|
||||
def load_engine(path=None):
|
||||
@@ -732,6 +755,7 @@ class Build:
|
||||
redo_from = STEPS.index(self.args.redo) if self.args.redo else len(STEPS)
|
||||
n = len(STEPS)
|
||||
dirty = False
|
||||
ran = False
|
||||
total_start = time.time()
|
||||
for i, step in enumerate(STEPS, 1):
|
||||
self.step = step
|
||||
@@ -744,7 +768,7 @@ class Build:
|
||||
emit('INFO', 'stopped', 'after ' + step)
|
||||
return 0
|
||||
continue
|
||||
dirty = True # every later step runs again (Ninja only redoes what changed)
|
||||
dirty = ran = True # every later step runs again (Ninja only redoes what changed)
|
||||
emit('PROGRESS', step, '%d/%d' % (i, n), STEP_TITLES[step])
|
||||
t = time.time()
|
||||
self.state[step] = {'done': False}
|
||||
@@ -773,6 +797,8 @@ class Build:
|
||||
launcher = os.path.join(self.game, 'Play TMB.cmd' if os.name == 'nt' else 'play_tmb.sh')
|
||||
emit('INFO', 'total', '%.1f s' % (time.time() - total_start))
|
||||
emit('RESULT', self.game, launcher)
|
||||
if PROGRESS_LINES:
|
||||
print('progress 1 %s' % ('Ready to play' if ran else 'Already built'), flush=True)
|
||||
return 0
|
||||
|
||||
|
||||
@@ -830,7 +856,8 @@ def check_disc(path):
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser(description='Builds Twisted Metal: Black (USA) as a native PC game from your own disc.')
|
||||
ap.add_argument('--disc', required=True, help='the disc image (.iso, .bin, .cue) or an extracted disc folder')
|
||||
ap.add_argument('--disc', help='the disc image (.iso, .bin, .cue) or an extracted disc folder (default: the '
|
||||
'disc.iso an earlier build left in the game folder)')
|
||||
ap.add_argument('--out', default='tmb_build', help='the work folder; the game ends up in <out>/TMB')
|
||||
ap.add_argument('--game', help='the game folder to stage (default: <out>/TMB)')
|
||||
ap.add_argument('--check', action='store_true', help='only check the disc (no work folder): OK <message> or '
|
||||
@@ -848,7 +875,21 @@ def main():
|
||||
ap.add_argument('--jobs', type=int, default=os.cpu_count() or 4)
|
||||
ap.add_argument('--redo', choices=STEPS, help='run this step and the ones after it again')
|
||||
ap.add_argument('--stop-after', choices=STEPS, help='stop once this step is done')
|
||||
ap.add_argument('--progress-lines', action='store_true', help='also print "progress <0 to 1> <text>" lines, for '
|
||||
'RecompLauncher (recomplauncher.json)')
|
||||
args = ap.parse_args()
|
||||
global PROGRESS_LINES
|
||||
PROGRESS_LINES = args.progress_lines
|
||||
if not args.disc:
|
||||
# Built before: the game folder keeps the disc image (a link to the player's, or a copy), so an update builds
|
||||
# again without it (RecompLauncher's keeps_copy, after the player deleted their own).
|
||||
kept = os.path.join(os.path.abspath(args.game) if args.game else os.path.join(os.path.abspath(args.out), 'TMB'),
|
||||
'disc.iso')
|
||||
if not os.path.isfile(kept):
|
||||
emit('ERROR', 'verify', 'no disc image given (--disc) and none kept from an earlier build: pick your '
|
||||
'Twisted Metal: Black disc image (USA, SCUS-97101)')
|
||||
sys.exit(1)
|
||||
args.disc = kept
|
||||
load_engine(args.engine)
|
||||
if args.check:
|
||||
sys.exit(check_disc(args.disc))
|
||||
|
||||
Reference in new issue
Block a user