mirror of
https://github.com/TheBozos/TMB_Recomp.git
synced 2026-12-01 21:33:22 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7869c0af8 | ||
|
|
e189cb3b23 | ||
|
|
a11583c0bf | ||
|
|
1152e7fca0 | ||
|
|
abf529224c |
No files matched your search
+24
-1
@@ -7,6 +7,28 @@ under "Unreleased" as they land, then move them under the new version's heading
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.3.2] - 2026-11-02
|
||||
|
||||
### Added
|
||||
|
||||
- **Story: start at** (F2, Cheats): a new story can begin at any of its stages, Midtown Suburbs to Warhawk's Rooftop,
|
||||
instead of the Junkyard, then goes on from there as usual. Handy to try the later stages without playing through.
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Black Vista Highway** (story stage 3) had no road: most of the level's ground and walls were not drawn. Some
|
||||
pieces of three Challenge arenas (DEATH1, DEATH2, DEATH5) were missing for the same reason. "Rebuild now" after
|
||||
updating fixes them.
|
||||
- **Movie sound volume**: the movies' sound now plays at the volume the game sets for it (it used a default
|
||||
volume before; a fix from the Valkyrie Profile 2 port, which shares the sound code).
|
||||
|
||||
### Known limits
|
||||
|
||||
- Story stages past the first are reachable and load correctly, but most have not been played to the end yet.
|
||||
- No widescreen yet.
|
||||
- Only the USA disc (SCUS-97101) is supported.
|
||||
- The launcher and the game are not signed: Windows SmartScreen asks for "More info", then "Run anyway".
|
||||
|
||||
## [0.3.1] - 2026-11-02
|
||||
|
||||
### Changed
|
||||
@@ -101,7 +123,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.3.1...HEAD
|
||||
[Unreleased]: https://github.com/TheBozos/TMB_Recomp/compare/v0.3.2...HEAD
|
||||
[0.3.2]: https://github.com/TheBozos/TMB_Recomp/compare/v0.3.1...v0.3.2
|
||||
[0.3.1]: https://github.com/TheBozos/TMB_Recomp/compare/v0.3.0...v0.3.1
|
||||
[0.3.0]: https://github.com/TheBozos/TMB_Recomp/compare/v0.2.0...v0.3.0
|
||||
[0.2.0]: https://github.com/TheBozos/TMB_Recomp/compare/v0.1.0...v0.2.0
|
||||
|
||||
+1
-1
Submodule PS2Recomp updated: f57615f03e...3eb40ffffd.
@@ -467,6 +467,7 @@ screen); the variables give their state at launch (`runtime/tmb_cheats.cpp`).
|
||||
| Cheat | | Variable |
|
||||
|---|---|---|
|
||||
| Unlock everything | every level (Freeway, Prison Passage, Skyscrapers, Minion's Stadium...), every vehicle (Yellow Jacket, Axel, Warthog, Manslaughter, Minion...) and every movie, opened in the menus; switched off, put back; saving while it is on keeps them on the card | `TMB_UNLOCK_ALL=1` |
|
||||
| Story: start at | a new story begins at the chosen level instead of the Junkyard (every stage: Midtown Suburbs or Expressway 104, Downtown or Black Vista Highway, Minion's Stadium, Prison Passage, Blackfield Asylum, Abandoned Skyscrapers, Warhawk's Rooftop; and the other arenas), then goes on as the game chains them; for testing the later stages without playing through | `TMB_STORY_LEVEL=<level number>` (the game's level table: 1 Junkyard, 0 Suburbs, 2 Expressway, 5 Downtown, 6 Black Vista, 14 Stadium, 3 Prison, 16 Asylum, 4 Skyscrapers, 13 their second part, 20 Warhawk's Rooftop) |
|
||||
| Infinite health | per player: the car's health held at its maximum (the game's own, as its health bar shows it) | `TMB_PLAYER_GOD=<players>` |
|
||||
| Infinite ammo | per player: pickup weapons and the special are not spent (the HUD's counts stay) | `TMB_INFINITE_AMMO=<players>` |
|
||||
| Infinite energy | per player: the energy bar (freeze, mines, shield...) held full | `TMB_INFINITE_ENERGY=<players>` |
|
||||
|
||||
@@ -64,6 +64,25 @@ namespace tmb::cheats
|
||||
std::atomic<uint32_t> g_infiniteHealth{0}, g_infiniteAmmo{0}, g_infiniteEnergy{0};
|
||||
std::atomic<bool> g_noAi{false};
|
||||
std::atomic<bool> g_unlockAll{false};
|
||||
// Story: start at a level (-1: off). The story's state is the level being played, Shell + 0x18000 + 0x2354 (the
|
||||
// index of the game's level table: GetLevelName, LoadLevelDB), the one last won at + 0x2358, the mode at
|
||||
// + 0x235C (1: one-player story); a new story sets the level to 1, the Junkyard, and each level won sets the
|
||||
// next (EvaluateOnePlayerStoryStatus).
|
||||
std::atomic<int> g_storyStart{-1};
|
||||
constexpr uint32_t kStoryLevel = 0x2354u, kStoryLastWon = 0x2358u, kGameMode = 0x235Cu;
|
||||
constexpr int kLevelCount = 21;
|
||||
// The levels by the level table's index (its names at 0x426070, 16 bytes each), with the card the story shows
|
||||
// when it starts there (the stage, of 8). Two stages have two arenas (the story picks one); ASYLUM and ROOFTOP2
|
||||
// show no card (reached from inside another level); the others are arenas the story does not use.
|
||||
constexpr const char *kLevelNames[kLevelCount] = {
|
||||
"Stage 2: Midtown Suburbs (SUBURB)", "Stage 1: Junkyard (JUNKYARD)", "Stage 2: Midtown Expressway 104 (FREEWAY)",
|
||||
"Stage 5: Prison Passage to Blackfield Asylum (PRISON)", "Stage 7: Abandoned Skyscrapers (ROOFTOP)",
|
||||
"Stage 3: Downtown Business District (CITY)", "Stage 3: Black Vista Highway (LOOP)", "Arena DEATH1", "Arena DEATH2",
|
||||
"Arena DEATH3", "Arena DEATH4", "Arena DEATH5", "Arena DEATH6", "Rooftops, second part (ROOFTOP2)",
|
||||
"Stage 4: Minion's Stadium (STADIUM)", "Arena SHIP", "Blackfield Asylum (ASYLUM)", "Arena MINICITY", "Arena MINIBURB",
|
||||
"Arena JUNK2", "Stage 8: Warhawk's Rooftop (ROOFBOSS)"};
|
||||
// The picker's order: the story's, then the rest.
|
||||
constexpr int kLevelOrder[kLevelCount] = {1, 0, 2, 5, 6, 14, 3, 16, 4, 13, 20, 7, 8, 9, 10, 11, 12, 15, 17, 18, 19};
|
||||
std::vector<uint32_t> g_unlocked; // the lock words Unlock everything opened (put back when it goes off)
|
||||
std::atomic<float> g_enemyCap{-1.0f}; // weak enemies: every computer vehicle's health held at most this; < 0 off
|
||||
std::atomic<float> g_playerCap{-1.0f}; // TMB_PLAYER_HEALTH_CAP (testing)
|
||||
@@ -233,6 +252,20 @@ namespace tmb::cheats
|
||||
g_unlockAll.store(unlock, std::memory_order_relaxed);
|
||||
ImGui::TextDisabled("Opened in the menus; saving the game while it is on keeps them on the card.");
|
||||
|
||||
int start = g_storyStart.load(std::memory_order_relaxed);
|
||||
ImGui::SetNextItemWidth(420.0f);
|
||||
if (ImGui::BeginCombo("Story: start at", start < 0 ? "the first level (as the game)" : kLevelNames[start]))
|
||||
{
|
||||
if (ImGui::Selectable("the first level (as the game)", start < 0))
|
||||
start = -1;
|
||||
for (const int i : kLevelOrder)
|
||||
if (ImGui::Selectable(kLevelNames[i], start == i))
|
||||
start = i;
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
g_storyStart.store(start, std::memory_order_relaxed);
|
||||
ImGui::TextDisabled("For testing: a new story begins at this level, then goes on as the game chains them.");
|
||||
|
||||
ImGui::SeparatorText("Players");
|
||||
perPlayer("Infinite health", g_infiniteHealth, players);
|
||||
perPlayer("Infinite ammo", g_infiniteAmmo, players);
|
||||
@@ -267,6 +300,47 @@ namespace tmb::cheats
|
||||
void setTheGame(uint32_t game) { g_theGame.store(game, std::memory_order_relaxed); }
|
||||
|
||||
// Once a frame (timerEndOfRealTimeProcessing, the frame's processing done).
|
||||
// TMB_LOG_PROGRESS=1 (finding the story's state): each word of Shell + 0x18000 + 0x2180 to + 0x2500 that changes,
|
||||
// with the time, from every frame end (the menus' too).
|
||||
void logProgress(uint8_t *rdram, uint32_t gp)
|
||||
{
|
||||
const uint32_t shell = word(rdram, gp - kGpShell);
|
||||
if (shell == 0u)
|
||||
return;
|
||||
// Story: start at a level. When a new story sets its first level (the Junkyard, nothing won yet), that level
|
||||
// is replaced, before the game loads it (it does once the character is chosen); the game's own chain goes on
|
||||
// from there.
|
||||
{
|
||||
const uint32_t progress = shell + kShellProgress;
|
||||
const int level = static_cast<int32_t>(word(rdram, progress + kStoryLevel));
|
||||
static int s_lastLevel = -2;
|
||||
const int start = g_storyStart.load(std::memory_order_relaxed);
|
||||
if (start >= 0 && level == 1 && s_lastLevel != 1 && word(rdram, progress + kGameMode) == 1u &&
|
||||
word(rdram, progress + kStoryLastWon) == 0u && start != 1)
|
||||
{
|
||||
setWord(rdram, progress + kStoryLevel, static_cast<uint32_t>(start));
|
||||
std::fprintf(stderr, "[tmb:cheats] story starts at level %s\n", kLevelNames[start]);
|
||||
}
|
||||
s_lastLevel = static_cast<int32_t>(word(rdram, progress + kStoryLevel));
|
||||
}
|
||||
static const bool s_on = std::getenv("TMB_LOG_PROGRESS") != nullptr;
|
||||
if (!s_on)
|
||||
return;
|
||||
static uint32_t s_last[0xE0] = {};
|
||||
static bool s_seen = false;
|
||||
static const auto s_start = std::chrono::steady_clock::now();
|
||||
const double t = std::chrono::duration<double>(std::chrono::steady_clock::now() - s_start).count();
|
||||
for (uint32_t i = 0; i < 0xE0u; ++i)
|
||||
{
|
||||
const uint32_t value = word(rdram, shell + kShellProgress + 0x2180u + i * 4u);
|
||||
if (s_seen && value != s_last[i])
|
||||
std::fprintf(stderr, "[tmb:progress] t=%.1f +0x%x: %d -> %d\n", t, 0x2180u + i * 4u, static_cast<int32_t>(s_last[i]),
|
||||
static_cast<int32_t>(value));
|
||||
s_last[i] = value;
|
||||
}
|
||||
s_seen = true;
|
||||
}
|
||||
|
||||
void onFrame(uint8_t *rdram)
|
||||
{
|
||||
g_rdram.store(rdram, std::memory_order_relaxed);
|
||||
@@ -368,6 +442,8 @@ namespace tmb::cheats
|
||||
{
|
||||
g_noAi.store(std::getenv("TMB_NO_AI") && *std::getenv("TMB_NO_AI") == '1');
|
||||
g_unlockAll.store(std::getenv("TMB_UNLOCK_ALL") && *std::getenv("TMB_UNLOCK_ALL") == '1');
|
||||
if (const char *level = std::getenv("TMB_STORY_LEVEL"); level && *level)
|
||||
g_storyStart.store(std::clamp(std::atoi(level), -1, kLevelCount - 1));
|
||||
g_infiniteHealth.store(envMask("TMB_PLAYER_GOD"));
|
||||
g_infiniteAmmo.store(envMask("TMB_INFINITE_AMMO"));
|
||||
g_infiniteEnergy.store(envMask("TMB_INFINITE_ENERGY"));
|
||||
|
||||
@@ -1286,6 +1286,15 @@ namespace tmb::meshes
|
||||
if (!it)
|
||||
{
|
||||
++g_stats.noObject;
|
||||
// TMB_NATIVE_MESHES_LOG_MISSING=1: the first objects of a loaded file the pack does not have.
|
||||
static const bool s_logMissing = std::getenv("TMB_NATIVE_MESHES_LOG_MISSING") != nullptr;
|
||||
static std::unordered_map<uint32_t, bool> s_seen;
|
||||
if (s_logMissing && !s_seen[obj] && s_seen.size() < 40u)
|
||||
{
|
||||
s_seen[obj] = true;
|
||||
std::fprintf(stderr, "[tmb:mesh] object %#x (%s + %#x, setup %#x, flags %#x, %s): not in the pack\n", obj,
|
||||
file.file->name.c_str(), offset, pc, fp, opaque ? "opaque" : "alpha");
|
||||
}
|
||||
stateOnly(ee, extra, opaque);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ namespace tmb::cheats
|
||||
void install(PS2Runtime &runtime);
|
||||
void setTheGame(uint32_t game);
|
||||
void onFrame(uint8_t *rdram);
|
||||
void logProgress(uint8_t *rdram, uint32_t gp);
|
||||
}
|
||||
|
||||
namespace tmb::meshes
|
||||
@@ -1104,6 +1105,7 @@ namespace
|
||||
tmb::native::onMenuFrameEnd(); // TMB_NATIVE: publishes a menu frame's native draws (not in a match)
|
||||
const double step = pacer.frameEnd();
|
||||
g_lastFrameEndSeconds.store(hitchClock(), std::memory_order_relaxed);
|
||||
tmb::cheats::logProgress(rdram, gp); // TMB_LOG_PROGRESS
|
||||
// The fps overlay in the menus (a match's frames are counted at timerEndOfRealTimeProcessing).
|
||||
if (hitchClock() - g_lastMatchFrameNoted.load(std::memory_order_relaxed) > 0.5)
|
||||
runtime->noteGameFrame();
|
||||
|
||||
+17
-6
@@ -55,10 +55,13 @@ from tmb_build import pe_imports, cmake_rc_flags # noqa: E402
|
||||
|
||||
KIT_VERSION = 1
|
||||
|
||||
# ---- pinned downloads (official upstream only) ----
|
||||
# ---- pinned downloads (official upstream; a mirror of ours only as a fallback, held to the same SHA-256) ----
|
||||
FFMPEG = {
|
||||
'version': '9.0.2',
|
||||
'url': 'https://ffmpeg.org/releases/ffmpeg-9.0.2.tar.xz',
|
||||
# Tried only when the upstream address fails: the same file on our build-deps pre-release (ffmpeg.org dropped
|
||||
# the release runner's connections), held to the same SHA-256.
|
||||
'mirrors': ['https://github.com/TheBozos/TMB_Recomp/releases/download/build-deps/ffmpeg-9.0.2.tar.xz'],
|
||||
'sha256': '8c3850283eb25fa026482078a04051e0be17347b09ef81a0849bec15a96e002e',
|
||||
# ffmpeg-9.0.2.tar.xz.asc checked once with gpg against https://ffmpeg.org/ffmpeg-devel.asc:
|
||||
'signing_key': 'FCF986EA15E6E293A5644F10B4322F04D67658D8 (FFmpeg release signing key)',
|
||||
@@ -246,18 +249,26 @@ def download(spec, downloads):
|
||||
if not (os.path.isfile(path) and sha256_file(path) == spec['sha256']):
|
||||
# A few tries, further apart each time: an upstream site sometimes drops or times out a CI runner's connection
|
||||
# (GitHub's release runs start with an empty download cache: a tag's run cannot read another tag's cache).
|
||||
# Then the spec's mirrors, if any; a file from any of them must have the pinned SHA-256.
|
||||
tmp = path + '.part'
|
||||
for attempt, wait in enumerate((0, 20, 60, 120, 240)):
|
||||
tries = [(spec['url'], wait) for wait in (0, 20, 60, 120)]
|
||||
tries += [(mirror, wait) for mirror in spec.get('mirrors', ()) for wait in (0, 20, 60)]
|
||||
error = None
|
||||
for url, wait in tries:
|
||||
if wait:
|
||||
log(' %s failed (%s): again in %d s' % (spec['url'], error, wait))
|
||||
log(' %s failed (%s): again in %d s' % (url, error, wait))
|
||||
time.sleep(wait)
|
||||
log(' downloading %s' % spec['url'])
|
||||
log(' downloading %s' % url)
|
||||
try:
|
||||
with urllib.request.urlopen(spec['url'], timeout=120) as r, open(tmp, 'wb') as f:
|
||||
with urllib.request.urlopen(url, timeout=120) as r, open(tmp, 'wb') as f:
|
||||
shutil.copyfileobj(r, f, 1 << 20)
|
||||
break
|
||||
except (urllib.error.URLError, OSError) as e:
|
||||
error = e
|
||||
continue
|
||||
digest = sha256_file(tmp)
|
||||
if digest == spec['sha256']:
|
||||
break
|
||||
error = 'SHA-256 %s, expected %s' % (digest, spec['sha256'])
|
||||
else:
|
||||
raise KitError('%s: could not download (%s)' % (spec['url'], error))
|
||||
os.replace(tmp, path)
|
||||
|
||||
+14
-4
@@ -11,7 +11,8 @@ What it reads:
|
||||
- the NGP files (LVL/*.NGP, SHELL/*.NGP: a zip entry, "IE" instead of "PK", raw deflate after the local header;
|
||||
ACAR/PCAR car files: raw). Each is a memory image linked at EE 0x980000: a pointer is (value - 0x980000) in the file.
|
||||
The .PTR file next to it lists the pointer words (its first count, then their byte offsets); a hierobject is a node
|
||||
of type 0 (word 0 bits 0-5) whose +4 (a listed pointer) is its own prebuilt packet, at obj + 0x70 + 0x30 * ntex.
|
||||
of type 0 (word 0 bits 0-5) whose +4 (a listed pointer) is its own prebuilt packet, at obj + 0x70 + 0x30 * ntex
|
||||
or a little after it, zeros between (LOOP pads some packets to an alignment).
|
||||
- the hierobject: +8 u64 flags (VU1 program choice), +0x10 bounding sphere, +0x50 u16[5] texture numbers (the file's
|
||||
own, before the game adds the file's texture base), +0x5a ntex, +0x64 skeleton (0 = rigid).
|
||||
- its packet: DMA tags (REF: data elsewhere in the file, next tag after it; CNT / RET: data after the tag, RET ends;
|
||||
@@ -104,18 +105,27 @@ def load_pointers(path):
|
||||
|
||||
|
||||
def find_objects(image, pointers):
|
||||
"""Every hierobject: a type 0 node whose listed +4 pointer is its own packet."""
|
||||
"""Every hierobject: a type 0 node whose listed +4 pointer is its own packet: right after its texture blocks, or up
|
||||
to 0x100 bytes later with only zeros between (an aligned packet: LOOP's)."""
|
||||
found = []
|
||||
for slot in pointers:
|
||||
obj = slot - 4
|
||||
if obj < 0 or obj + 0x70 > len(image) or u32(image, obj) & 0x3f:
|
||||
continue
|
||||
ntex = u16(image, obj + 0x5a)
|
||||
if ntex <= 5 and u32(image, obj + 4) - LINK == obj + 0x70 + 0x30 * ntex:
|
||||
if ntex > 5:
|
||||
continue
|
||||
after, packet = obj + 0x70 + 0x30 * ntex, u32(image, obj + 4) - LINK
|
||||
if packet == after or (after < packet < after + 0x100 and packet % 16 == 0 and not any(image[after:packet])):
|
||||
found.append(obj)
|
||||
return sorted(set(found))
|
||||
|
||||
|
||||
def packet_start(image, obj):
|
||||
"""Where an object's packet is: its +4 pointer (find_objects checked it)."""
|
||||
return u32(image, obj + 4) - LINK
|
||||
|
||||
|
||||
def packet_segments(image, start):
|
||||
"""The DMA chain from start: [(VIF bytes, their offset in the image)] (the tag's two VIF codes first)."""
|
||||
return dma_chain(image, start, LINK)
|
||||
@@ -129,7 +139,7 @@ def packet_stream(image, obj):
|
||||
|
||||
def packet_stream_mapped(image, obj):
|
||||
"""The same, with where each piece of it is in the image: (stream, [(stream offset, image offset, length)])."""
|
||||
return chain_stream(image, obj + 0x70 + 0x30 * u16(image, obj + 0x5a), LINK)
|
||||
return chain_stream(image, packet_start(image, obj), LINK)
|
||||
|
||||
|
||||
class Strip:
|
||||
|
||||
Reference in new issue
Block a user