Files
901ea27228 Diagnostics read once (SBC_ENV): the game thread 2.9x faster; M_19_02's black screen explained (#16)
Seventeen diagnostic switches called getenv per draw or per frame; on Windows
getenv takes the environment lock and scans it: 64% of the game thread on
M_19_03. SBC_ENV reads each once (6.0 s -> 2.1 s for 300 frames there).

M_19_02 stays black because, warped to from the story's opening, it does not
fit in memory: 7.4 MB of its DAT spill into the main heap and MapInitSystem's
pools come out empty ("MemblkInit: Memory Alloc Error !"), the task pool among
them, so the map script (player, fade-in) never starts. The game's own
allocations over the same files; notes in docs/RECOMP_NOTES.md.

SBC_TRACE_ENTRANCES lists a map's places; SBC_TRACE_PRINTF / LOADS / TEXREAD no
longer need SBC_PROBE.

Co-authored-by: Thomas Martin <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-30 18:29:58 +01:00

548 lines
39 KiB
C++

// Probes (a development tool): native sites at the first instruction of the game's 2D, texture and TIM2 functions
// that count each call and run the instruction as it is (they return false). SBC_PROBE=<frame>: the calls counted from
// that frame on, printed at the end of the run (which of the game's own draw functions a screen uses).
#include "sbc_port.h"
#include "bozo/port.h"
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <map>
#include <set>
namespace sbc::probe
{
namespace
{
std::map<uint32_t, uint64_t> g_counts;
uint64_t g_from = ~0ull;
std::map<uint64_t, uint64_t> g_prims; // (IMD primitive type << 8 | mode) -> calls
std::map<uint64_t, uint32_t> g_primSample; // -> the first primitive seen
uint8_t *g_ram = nullptr;
uint32_t g_gp = 0;
} // namespace
// SBC_DUMP_SPRITES=1: at g2dSpriteSetPkt (0x222780), each texture's records once: the sprite (a0, 0x50 bytes), its
// texture descriptor (+0x40), the TEXimage (TexGetTEXimage's table at gp-0x7cc0) and its transfer packets.
void dumpSprite(uint8_t *ram, const R5900Context *ctx)
{
static std::set<int> seen;
auto rd32 = [&](uint32_t a) { uint32_t v; std::memcpy(&v, ram + (a & 0x1FFFFFFu), 4); return v; };
auto bytes = [&](const char *what, uint32_t a, uint32_t n) {
std::printf("[sbc:dump] %s %08x:", what, a);
for (uint32_t i = 0; i < n; i += 4)
std::printf("%s%08x", i % 32 ? " " : "\n[sbc:dump] ", rd32(a + i));
std::printf("\n");
};
const uint32_t sprite = ctx->r[4].uw[0], desc = rd32(sprite + 0x40);
const int16_t id = static_cast<int16_t>(rd32(desc) & 0xFFFF);
if (!seen.insert(id).second)
return;
const uint32_t gp = ctx->r[28].uw[0];
bytes("sprite", sprite, 0x50);
bytes("desc", desc, 0x10);
if (id < 0 || id >= static_cast<int32_t>(rd32(gp - 0x7cccu)))
return;
const uint32_t image = rd32(rd32(gp - 0x7cc0u) + 4u * static_cast<uint32_t>(id));
bytes("teximage", image, 0x80);
if (rd32(image))
bytes("level0 packet", rd32(image), 0xc0);
if (rd32(image + 0x10))
bytes("clut packet", rd32(image + 0x10), 0x80);
}
bool site(uint8_t *ram, R5900Context *ctx, Runtime *rt, uint32_t pc)
{
if (pc == 0x222780u)
if (static const bool dump = std::getenv("SBC_DUMP_SPRITES") != nullptr; dump)
dumpSprite(ram, ctx);
// SBC_TRACE_PRINTF=1: the game's own debug print 0x267a30 (silent in this release): its format and arguments.
if (pc == 0x267a30u && SBC_ENV("SBC_TRACE_PRINTF"))
{
const uint32_t f = ctx->r[4].uw[0] & 0x1FFFFFFu;
char text[200] = {};
for (uint32_t i = 0; i + 1 < sizeof text && ram[f + i]; ++i)
text[i] = ram[f + i] == '\n' ? ' ' : static_cast<char>(ram[f + i]);
std::printf("[sbc:print] kick %llu: \"%s\" %x %x %x (from %x)\n", static_cast<unsigned long long>(render::frames()),
text, ctx->r[5].uw[0], ctx->r[6].uw[0], ctx->r[7].uw[0], ctx->r[31].uw[0]);
}
// SBC_TRACE_LOADS=1: the file-info loader 0x2a1840(offset, buffer, bytes, to IOP), each request.
if (pc == 0x2a1840u && SBC_ENV("SBC_TRACE_LOADS"))
{
uint32_t base;
std::memcpy(&base, ram + 0x6160c4u, 4);
std::printf("[sbc:load] kick %llu: offset %08x -> %s %08x, %x bytes, sector base %x (from %x)\n",
static_cast<unsigned long long>(render::frames()), ctx->r[4].uw[0], ctx->r[7].uw[0] ? "IOP" : "EE",
ctx->r[5].uw[0], ctx->r[6].uw[0], base, ctx->r[31].uw[0]);
}
// SBC_TRACE_TEXREAD=1: TexReadMem(id, data, ...) 0x261cd0, each call's arguments (which textures load).
if (pc == 0x261cd0u && SBC_ENV("SBC_TRACE_TEXREAD"))
std::printf("[sbc:tex] TexReadMem(%04x, %08x, %08x, %08x) kick %llu\n", ctx->r[4].uw[0], ctx->r[5].uw[0],
ctx->r[6].uw[0], ctx->r[7].uw[0], static_cast<unsigned long long>(render::frames()));
static const bool on = [] {
if (const char *e = std::getenv("SBC_PROBE"))
g_from = std::strtoull(e, nullptr, 0);
return std::getenv("SBC_PROBE") != nullptr;
}();
if (!on)
return false;
// ImdCallPrimDrv(prim, mode): the primitive types and modes the frames use, a sample of each, the drivers.
if (pc == 0x22e9a0u && render::frames() >= g_from && ctx->r[4].uw[0] && ctx->r[4].uw[0] != 0xFFFFFFFFu)
{
g_ram = ram;
g_gp = ctx->r[28].uw[0];
uint32_t id;
std::memcpy(&id, ram + (ctx->r[4].uw[0] & 0x1FFFFFFu), 4);
const uint64_t key = (static_cast<uint64_t>(id & 0x7FFFFFFFu) << 8) | (ctx->r[5].uw[0] & 0xFFu);
if (!g_prims[key]++)
g_primSample[key] = ctx->r[4].uw[0];
// SBC_DUMP_PRIM=<n>: the scratchpad (the VU staging buffer, its matrices) as the n-th type-72 primitive of
// the counted frames is drawn, to build/spr_prim.bin, with that primitive's address.
static const long long dumpAt = std::getenv("SBC_DUMP_PRIM") ? std::atoll(std::getenv("SBC_DUMP_PRIM")) : -1;
static long long seen72 = 0;
if ((id & 0x7FFFFFFFu) == 72u && dumpAt >= 0 && seen72++ == dumpAt)
if (FILE *f = std::fopen("build/spr_prim.bin", "wb"))
{
std::fwrite(bozo::port::scratchpad(rt), 1, 0x4000, f);
std::fclose(f);
std::printf("[sbc:imd] scratchpad at type-72 primitive %08x (kick %llu) to build/spr_prim.bin\n",
ctx->r[4].uw[0], static_cast<unsigned long long>(render::frames()));
}
}
switch (pc)
{
case 0x00221170u: // native site: probe 0x221170 (counted, then run)
case 0x00221210u: // native site: probe 0x221210 (counted, then run)
case 0x00221260u: // native site: probe 0x221260 (counted, then run)
case 0x002213a0u: // native site: probe 0x2213a0 (counted, then run)
case 0x002215c4u: // native site: probe 0x2215c0 (counted, then run)
case 0x002215f4u: // native site: probe 0x2215f0 (counted, then run)
case 0x00221620u: // native site: probe 0x221620 (counted, then run)
case 0x00221664u: // native site: probe 0x221660 (counted, then run)
case 0x00221674u: // native site: probe 0x221670 (counted, then run)
case 0x00221680u: // native site: probe 0x221680 (counted, then run)
case 0x00221740u: // native site: probe 0x221740 (counted, then run)
case 0x00221870u: // native site: probe 0x221870 (counted, then run)
case 0x00222010u: // native site: probe 0x222010 (counted, then run)
case 0x00222150u: // native site: probe 0x222150 (counted, then run)
case 0x002222a0u: // native site: probe 0x2222a0 (counted, then run)
case 0x002223f0u: // native site: probe 0x2223f0 (counted, then run)
case 0x002224b4u: // native site: probe 0x2224b0 (counted, then run)
case 0x002224c0u: // native site: probe 0x2224c0 (counted, then run)
case 0x00222590u: // native site: probe 0x222590 (counted, then run)
case 0x002226b4u: // native site: probe 0x2226b0 (counted, then run)
case 0x002229e0u: // native site: probe 0x2229e0 (counted, then run)
case 0x00222aa0u: // native site: probe 0x222aa0 (counted, then run)
case 0x00222b90u: // native site: probe 0x222b90 (counted, then run)
case 0x00222c80u: // native site: probe 0x222c80 (counted, then run)
case 0x00222d70u: // native site: probe 0x222d70 (counted, then run)
case 0x00223030u: // native site: probe 0x223030 (counted, then run)
case 0x00223270u: // native site: probe 0x223270 (counted, then run)
case 0x00223370u: // native site: probe 0x223370 (counted, then run)
case 0x00223500u: // native site: probe 0x223500 (counted, then run)
case 0x00223690u: // native site: probe 0x223690 (counted, then run)
case 0x002236f0u: // native site: probe 0x2236f0 (counted, then run)
case 0x00223ae0u: // native site: probe 0x223ae0 (counted, then run)
case 0x00223c60u: // native site: probe 0x223c60 (counted, then run)
case 0x00223db0u: // native site: probe 0x223db0 (counted, then run)
case 0x00224020u: // native site: probe 0x224020 (counted, then run)
case 0x00224130u: // native site: probe 0x224130 (counted, then run)
case 0x00224530u: // native site: probe 0x224530 (counted, then run)
case 0x002245a0u: // native site: probe 0x2245a0 (counted, then run)
case 0x002245e4u: // native site: probe 0x2245e0 (counted, then run)
case 0x002245f0u: // native site: probe 0x2245f0 (counted, then run)
case 0x002248e0u: // native site: probe 0x2248e0 (counted, then run)
case 0x00224ad0u: // native site: probe 0x224ad0 (counted, then run)
case 0x00224ae0u: // native site: probe 0x224ae0 (counted, then run)
case 0x00224b40u: // native site: probe 0x224b40 (counted, then run)
case 0x00225180u: // native site: probe 0x225180 (counted, then run)
case 0x00225190u: // native site: probe 0x225190 (counted, then run)
case 0x002251a0u: // native site: probe 0x2251a0 (counted, then run)
case 0x002251d0u: // native site: probe 0x2251d0 (counted, then run)
case 0x00225210u: // native site: probe 0x225210 (counted, then run)
case 0x00225230u: // native site: probe 0x225230 (counted, then run)
case 0x002252a0u: // native site: probe 0x2252a0 (counted, then run)
case 0x002252b0u: // native site: probe 0x2252b0 (counted, then run)
case 0x00225310u: // native site: probe 0x225310 (counted, then run)
case 0x00225330u: // native site: probe 0x225330 (counted, then run)
case 0x00225370u: // native site: probe 0x225370 (counted, then run)
case 0x00225380u: // native site: probe 0x225380 (counted, then run)
case 0x002253b0u: // native site: probe 0x2253b0 (counted, then run)
case 0x002253c0u: // native site: probe 0x2253c0 (counted, then run)
case 0x002253d0u: // native site: probe 0x2253d0 (counted, then run)
case 0x00225550u: // native site: probe 0x225550 (counted, then run)
case 0x002257b0u: // native site: probe 0x2257b0 (counted, then run)
case 0x00225840u: // native site: probe 0x225840 (counted, then run)
case 0x002258a0u: // native site: probe 0x2258a0 (counted, then run)
case 0x00225910u: // native site: probe 0x225910 (counted, then run)
case 0x00225920u: // native site: probe 0x225920 (counted, then run)
case 0x00225940u: // native site: probe 0x225940 (counted, then run)
case 0x00225960u: // native site: probe 0x225960 (counted, then run)
case 0x00226140u: // native site: probe 0x226140 (counted, then run)
case 0x00226160u: // native site: probe 0x226160 (counted, then run)
case 0x002261e0u: // native site: probe 0x2261e0 (counted, then run)
case 0x00226270u: // native site: probe 0x226270 (counted, then run)
case 0x00226340u: // native site: probe 0x226340 (counted, then run)
case 0x002264c0u: // native site: probe 0x2264c0 (counted, then run)
case 0x002267b0u: // native site: probe 0x2267b0 (counted, then run)
case 0x00226aa0u: // native site: probe 0x226aa0 (counted, then run)
case 0x00226d94u: // native site: probe 0x226d90 (counted, then run)
case 0x00227270u: // native site: probe 0x227270 (counted, then run)
case 0x00227840u: // native site: probe 0x227840 (counted, then run)
case 0x00227e00u: // native site: probe 0x227e00 (counted, then run)
case 0x00227e40u: // native site: probe 0x227e40 (counted, then run)
case 0x00227ec4u: // native site: probe 0x227ec0 (counted, then run)
case 0x00227ed4u: // native site: probe 0x227ed0 (counted, then run)
case 0x00227ee0u: // native site: probe 0x227ee0 (counted, then run)
case 0x00227f70u: // native site: probe 0x227f70 (counted, then run)
case 0x00228060u: // native site: probe 0x228060 (counted, then run)
case 0x002280c0u: // native site: probe 0x2280c0 (counted, then run)
case 0x002281a0u: // native site: probe 0x2281a0 (counted, then run)
case 0x00228260u: // native site: probe 0x228260 (counted, then run)
case 0x002283b0u: // native site: probe 0x2283b0 (counted, then run)
case 0x00228400u: // native site: probe 0x228400 (counted, then run)
case 0x00228444u: // native site: probe 0x228440 (counted, then run)
case 0x00228454u: // native site: probe 0x228450 (counted, then run)
case 0x00228460u: // native site: probe 0x228460 (counted, then run)
case 0x00228470u: // native site: probe 0x228470 (counted, then run)
case 0x00228490u: // native site: probe 0x228490 (counted, then run)
case 0x002285b0u: // native site: probe 0x2285b0 (counted, then run)
case 0x002286d0u: // native site: probe 0x2286d0 (counted, then run)
case 0x00228740u: // native site: probe 0x228740 (counted, then run)
case 0x002289d0u: // native site: probe 0x2289d0 (counted, then run)
case 0x00228e70u: // native site: probe 0x228e70 (counted, then run)
case 0x00229210u: // native site: probe 0x229210 (counted, then run)
case 0x00229764u: // native site: probe 0x229760 (counted, then run)
case 0x00229770u: // native site: probe 0x229770 (counted, then run)
case 0x00229784u: // native site: probe 0x229780 (counted, then run)
case 0x002297b4u: // native site: probe 0x2297b0 (counted, then run)
case 0x002297c0u: // native site: probe 0x2297c0 (counted, then run)
case 0x002297e0u: // native site: probe 0x2297e0 (counted, then run)
case 0x00229804u: // native site: probe 0x229800 (counted, then run)
case 0x00229814u: // native site: probe 0x229810 (counted, then run)
case 0x00229824u: // native site: probe 0x229820 (counted, then run)
case 0x00229830u: // native site: probe 0x229830 (counted, then run)
case 0x002299c0u: // native site: probe 0x2299c0 (counted, then run)
case 0x00229b90u: // native site: probe 0x229b90 (counted, then run)
case 0x00229d04u: // native site: probe 0x229d00 (counted, then run)
case 0x00229d10u: // native site: probe 0x229d10 (counted, then run)
case 0x00229d40u: // native site: probe 0x229d40 (counted, then run)
case 0x00229db0u: // native site: probe 0x229db0 (counted, then run)
case 0x00229e20u: // native site: probe 0x229e20 (counted, then run)
case 0x00229f54u: // native site: probe 0x229f50 (counted, then run)
case 0x00229f60u: // native site: probe 0x229f60 (counted, then run)
case 0x00229f90u: // native site: probe 0x229f90 (counted, then run)
case 0x00229fc4u: // native site: probe 0x229fc0 (counted, then run)
case 0x00229fd4u: // native site: probe 0x229fd0 (counted, then run)
case 0x00229fe4u: // native site: probe 0x229fe0 (counted, then run)
case 0x0022a054u: // native site: probe 0x22a050 (counted, then run)
case 0x0022a060u: // native site: probe 0x22a060 (counted, then run)
case 0x0022a0f0u: // native site: probe 0x22a0f0 (counted, then run)
case 0x0022a150u: // native site: probe 0x22a150 (counted, then run)
case 0x0022a160u: // native site: probe 0x22a160 (counted, then run)
case 0x0022a2f0u: // native site: probe 0x22a2f0 (counted, then run)
case 0x0022a530u: // native site: probe 0x22a530 (counted, then run)
case 0x0022a5c0u: // native site: probe 0x22a5c0 (counted, then run)
case 0x0022a6c4u: // native site: probe 0x22a6c0 (counted, then run)
case 0x0022a6d4u: // native site: probe 0x22a6d0 (counted, then run)
case 0x0022a6e0u: // native site: probe 0x22a6e0 (counted, then run)
case 0x0022a6f4u: // native site: probe 0x22a6f0 (counted, then run)
case 0x0022a704u: // native site: probe 0x22a700 (counted, then run)
case 0x0022a710u: // native site: probe 0x22a710 (counted, then run)
case 0x0022a834u: // native site: probe 0x22a830 (counted, then run)
case 0x0022a870u: // native site: probe 0x22a870 (counted, then run)
case 0x0022a890u: // native site: probe 0x22a890 (counted, then run)
case 0x0022a8b0u: // native site: probe 0x22a8b0 (counted, then run)
case 0x0022a8f0u: // native site: probe 0x22a8f0 (counted, then run)
case 0x0022a910u: // native site: probe 0x22a910 (counted, then run)
case 0x0022aa20u: // native site: probe 0x22aa20 (counted, then run)
case 0x0022aa90u: // native site: probe 0x22aa90 (counted, then run)
case 0x0022aad0u: // native site: probe 0x22aad0 (counted, then run)
case 0x0022aaf0u: // native site: probe 0x22aaf0 (counted, then run)
case 0x0022ab54u: // native site: probe 0x22ab50 (counted, then run)
case 0x0022ab60u: // native site: probe 0x22ab60 (counted, then run)
case 0x0022ab70u: // native site: probe 0x22ab70 (counted, then run)
case 0x0022abd0u: // native site: probe 0x22abd0 (counted, then run)
case 0x0022ac90u: // native site: probe 0x22ac90 (counted, then run)
case 0x0022b150u: // native site: probe 0x22b150 (counted, then run)
case 0x0022b420u: // native site: probe 0x22b420 (counted, then run)
case 0x0022b5a0u: // native site: probe 0x22b5a0 (counted, then run)
case 0x0022b684u: // native site: probe 0x22b680 (counted, then run)
case 0x0022b6b0u: // native site: probe 0x22b6b0 (counted, then run)
case 0x0022b790u: // native site: probe 0x22b790 (counted, then run)
case 0x0022b864u: // native site: probe 0x22b860 (counted, then run)
case 0x0022b874u: // native site: probe 0x22b870 (counted, then run)
case 0x0022b880u: // native site: probe 0x22b880 (counted, then run)
case 0x0022b904u: // native site: probe 0x22b900 (counted, then run)
case 0x0022b970u: // native site: probe 0x22b970 (counted, then run)
case 0x0022bb90u: // native site: probe 0x22bb90 (counted, then run)
case 0x0022bc30u: // native site: probe 0x22bc30 (counted, then run)
case 0x0022bc70u: // native site: probe 0x22bc70 (counted, then run)
case 0x0022bd00u: // native site: probe 0x22bd00 (counted, then run)
case 0x0022bd94u: // native site: probe 0x22bd90 (counted, then run)
case 0x0022be30u: // native site: probe 0x22be30 (counted, then run)
case 0x0022be94u: // native site: probe 0x22be90 (counted, then run)
case 0x0022bf00u: // native site: probe 0x22bf00 (counted, then run)
case 0x0022c004u: // native site: probe 0x22c000 (counted, then run)
case 0x0022c054u: // native site: probe 0x22c050 (counted, then run)
case 0x0022c094u: // native site: probe 0x22c090 (counted, then run)
case 0x0022c1b0u: // native site: probe 0x22c1b0 (counted, then run)
case 0x0022c2c4u: // native site: probe 0x22c2c0 (counted, then run)
case 0x0022c304u: // native site: probe 0x22c300 (counted, then run)
case 0x0022c330u: // native site: probe 0x22c330 (counted, then run)
case 0x0022c410u: // native site: probe 0x22c410 (counted, then run)
case 0x0022c680u: // native site: probe 0x22c680 (counted, then run)
case 0x0022c6f0u: // native site: probe 0x22c6f0 (counted, then run)
case 0x0022cfb0u: // native site: probe 0x22cfb0 (counted, then run)
case 0x0022d7b4u: // native site: probe 0x22d7b0 (counted, then run)
case 0x0022d7d4u: // native site: probe 0x22d7d0 (counted, then run)
case 0x0022d7f0u: // native site: probe 0x22d7f0 (counted, then run)
case 0x0022d800u: // native site: probe 0x22d800 (counted, then run)
case 0x0022d870u: // native site: probe 0x22d870 (counted, then run)
case 0x0022da50u: // native site: probe 0x22da50 (counted, then run)
case 0x0022db70u: // native site: probe 0x22db70 (counted, then run)
case 0x0022db80u: // native site: probe 0x22db80 (counted, then run)
case 0x0022dc00u: // native site: probe 0x22dc00 (counted, then run)
case 0x0022dc50u: // native site: probe 0x22dc50 (counted, then run)
case 0x0022dd10u: // native site: probe 0x22dd10 (counted, then run)
case 0x0022dd80u: // native site: probe 0x22dd80 (counted, then run)
case 0x0022e004u: // native site: probe 0x22e000 (counted, then run)
case 0x0022e010u: // native site: probe 0x22e010 (counted, then run)
case 0x0022e020u: // native site: probe 0x22e020 (counted, then run)
case 0x0022e030u: // native site: probe 0x22e030 (counted, then run)
case 0x0022e040u: // native site: probe 0x22e040 (counted, then run)
case 0x0022e050u: // native site: probe 0x22e050 (counted, then run)
case 0x0022e060u: // native site: probe 0x22e060 (counted, then run)
case 0x0022e070u: // native site: probe 0x22e070 (counted, then run)
case 0x0022e080u: // native site: probe 0x22e080 (counted, then run)
case 0x0022e0a0u: // native site: probe 0x22e0a0 (counted, then run)
case 0x0022e0c0u: // native site: probe 0x22e0c0 (counted, then run)
case 0x0022e0d0u: // native site: probe 0x22e0d0 (counted, then run)
case 0x0022e0e0u: // native site: probe 0x22e0e0 (counted, then run)
case 0x0022e0f0u: // native site: probe 0x22e0f0 (counted, then run)
case 0x0022e100u: // native site: probe 0x22e100 (counted, then run)
case 0x0022e120u: // native site: probe 0x22e120 (counted, then run)
case 0x0022e130u: // native site: probe 0x22e130 (counted, then run)
case 0x0022e140u: // native site: probe 0x22e140 (counted, then run)
case 0x0022e150u: // native site: probe 0x22e150 (counted, then run)
case 0x0022e160u: // native site: probe 0x22e160 (counted, then run)
case 0x0022e1f0u: // native site: probe 0x22e1f0 (counted, then run)
case 0x0022e224u: // native site: probe 0x22e220 (counted, then run)
case 0x0022e260u: // native site: probe 0x22e260 (counted, then run)
case 0x0022e280u: // native site: probe 0x22e280 (counted, then run)
case 0x0022e2a0u: // native site: probe 0x22e2a0 (counted, then run)
case 0x0022e2b0u: // native site: probe 0x22e2b0 (counted, then run)
case 0x0022e2c0u: // native site: probe 0x22e2c0 (counted, then run)
case 0x0022e2d4u: // native site: probe 0x22e2d0 (counted, then run)
case 0x0022e420u: // native site: probe 0x22e420 (counted, then run)
case 0x0022e590u: // native site: probe 0x22e590 (counted, then run)
case 0x0022e880u: // native site: probe 0x22e880 (counted, then run)
case 0x0022e900u: // native site: probe 0x22e900 (counted, then run)
case 0x0022e9a0u: // native site: probe 0x22e9a0 (counted, then run)
case 0x0022eab0u: // native site: probe 0x22eab0 (counted, then run)
case 0x0022eaf0u: // native site: probe 0x22eaf0 (counted, then run)
case 0x0022eb00u: // native site: probe 0x22eb00 (counted, then run)
case 0x0022ec00u: // native site: probe 0x22ec00 (counted, then run)
case 0x0022ecf0u: // native site: probe 0x22ecf0 (counted, then run)
case 0x0022edb0u: // native site: probe 0x22edb0 (counted, then run)
case 0x0022edd0u: // native site: probe 0x22edd0 (counted, then run)
case 0x0022ef74u: // native site: probe 0x22ef70 (counted, then run)
case 0x0022ef80u: // native site: probe 0x22ef80 (counted, then run)
case 0x0022ef94u: // native site: probe 0x22ef90 (counted, then run)
case 0x0022efa0u: // native site: probe 0x22efa0 (counted, then run)
case 0x0022f020u: // native site: probe 0x22f020 (counted, then run)
case 0x0022f034u: // native site: probe 0x22f030 (counted, then run)
case 0x0022f040u: // native site: probe 0x22f040 (counted, then run)
case 0x0022f054u: // native site: probe 0x22f050 (counted, then run)
case 0x0022f060u: // native site: probe 0x22f060 (counted, then run)
case 0x0022f1d0u: // native site: probe 0x22f1d0 (counted, then run)
case 0x0022f204u: // native site: probe 0x22f200 (counted, then run)
case 0x0022f214u: // native site: probe 0x22f210 (counted, then run)
case 0x0022f224u: // native site: probe 0x22f220 (counted, then run)
case 0x0022f234u: // native site: probe 0x22f230 (counted, then run)
case 0x0022f244u: // native site: probe 0x22f240 (counted, then run)
case 0x0022f254u: // native site: probe 0x22f250 (counted, then run)
case 0x0022f264u: // native site: probe 0x22f260 (counted, then run)
case 0x0022f274u: // native site: probe 0x22f270 (counted, then run)
case 0x0022f280u: // native site: probe 0x22f280 (counted, then run)
case 0x0022f2b0u: // native site: probe 0x22f2b0 (counted, then run)
case 0x0022f390u: // native site: probe 0x22f390 (counted, then run)
case 0x0022f3e0u: // native site: probe 0x22f3e0 (counted, then run)
case 0x0022f430u: // native site: probe 0x22f430 (counted, then run)
case 0x0022f4b0u: // native site: probe 0x22f4b0 (counted, then run)
case 0x0022f710u: // native site: probe 0x22f710 (counted, then run)
case 0x0022f790u: // native site: probe 0x22f790 (counted, then run)
case 0x0022f7e0u: // native site: probe 0x22f7e0 (counted, then run)
case 0x0022f880u: // native site: probe 0x22f880 (counted, then run)
case 0x0022f8d0u: // native site: probe 0x22f8d0 (counted, then run)
case 0x0022fc70u: // native site: probe 0x22fc70 (counted, then run)
case 0x0022fca4u: // native site: probe 0x22fca0 (counted, then run)
case 0x0022fcb0u: // native site: probe 0x22fcb0 (counted, then run)
case 0x00260a80u: // native site: probe 0x260a80 (counted, then run)
case 0x00260bc0u: // native site: probe 0x260bc0 (counted, then run)
case 0x00260c00u: // native site: probe 0x260c00 (counted, then run)
case 0x00260ca0u: // native site: probe 0x260ca0 (counted, then run)
case 0x00260da4u: // native site: probe 0x260da0 (counted, then run)
case 0x00260db4u: // native site: probe 0x260db0 (counted, then run)
case 0x00260dc4u: // native site: probe 0x260dc0 (counted, then run)
case 0x00260dd0u: // native site: probe 0x260dd0 (counted, then run)
case 0x00260f10u: // native site: probe 0x260f10 (counted, then run)
case 0x00261130u: // native site: probe 0x261130 (counted, then run)
case 0x00261350u: // native site: probe 0x261350 (counted, then run)
case 0x00261470u: // native site: probe 0x261470 (counted, then run)
case 0x00261570u: // native site: probe 0x261570 (counted, then run)
case 0x00261580u: // native site: probe 0x261580 (counted, then run)
case 0x00261590u: // native site: probe 0x261590 (counted, then run)
case 0x00261610u: // native site: probe 0x261610 (counted, then run)
case 0x002616a0u: // native site: probe 0x2616a0 (counted, then run)
case 0x00261710u: // native site: probe 0x261710 (counted, then run)
case 0x00261a14u: // native site: probe 0x261a10 (counted, then run)
case 0x00261a20u: // native site: probe 0x261a20 (counted, then run)
case 0x00261cd0u: // native site: probe 0x261cd0 (counted, then run)
case 0x00261fb0u: // native site: probe 0x261fb0 (counted, then run)
case 0x002621c0u: // native site: probe 0x2621c0 (counted, then run)
case 0x00262240u: // native site: probe 0x262240 (counted, then run)
case 0x002622d4u: // native site: probe 0x2622d0 (counted, then run)
case 0x002622e0u: // native site: probe 0x2622e0 (counted, then run)
case 0x00262340u: // native site: probe 0x262340 (counted, then run)
case 0x00262350u: // native site: probe 0x262350 (counted, then run)
case 0x00262360u: // native site: probe 0x262360 (counted, then run)
case 0x002623c0u: // native site: probe 0x2623c0 (counted, then run)
case 0x00262550u: // native site: probe 0x262550 (counted, then run)
case 0x002625b0u: // native site: probe 0x2625b0 (counted, then run)
case 0x002626d4u: // native site: probe 0x2626d0 (counted, then run)
case 0x00262720u: // native site: probe 0x262720 (counted, then run)
case 0x002627b0u: // native site: probe 0x2627b0 (counted, then run)
case 0x00262840u: // native site: probe 0x262840 (counted, then run)
case 0x002628b0u: // native site: probe 0x2628b0 (counted, then run)
case 0x00262920u: // native site: probe 0x262920 (counted, then run)
case 0x002629a0u: // native site: probe 0x2629a0 (counted, then run)
case 0x00262a20u: // native site: probe 0x262a20 (counted, then run)
case 0x00262aa4u: // native site: probe 0x262aa0 (counted, then run)
case 0x00262b50u: // native site: probe 0x262b50 (counted, then run)
case 0x00262bf0u: // native site: probe 0x262bf0 (counted, then run)
case 0x00262c70u: // native site: probe 0x262c70 (counted, then run)
case 0x00262ce0u: // native site: probe 0x262ce0 (counted, then run)
case 0x00265000u: // native site: probe 0x265000 (counted, then run)
case 0x00265270u: // native site: probe 0x265270 (counted, then run)
case 0x00265280u: // native site: probe 0x265280 (counted, then run)
case 0x00265290u: // native site: probe 0x265290 (counted, then run)
case 0x00265410u: // native site: probe 0x265410 (counted, then run)
case 0x00265424u: // native site: probe 0x265420 (counted, then run)
case 0x00265434u: // native site: probe 0x265430 (counted, then run)
case 0x00265450u: // native site: probe 0x265450 (counted, then run)
case 0x00265460u: // native site: probe 0x265460 (counted, then run)
case 0x00265490u: // native site: probe 0x265490 (counted, then run)
case 0x002654c0u: // native site: probe 0x2654c0 (counted, then run)
case 0x002654d0u: // native site: probe 0x2654d0 (counted, then run)
case 0x00265554u: // native site: probe 0x265550 (counted, then run)
case 0x00265560u: // native site: probe 0x265560 (counted, then run)
case 0x002655d0u: // native site: probe 0x2655d0 (counted, then run)
case 0x00265650u: // native site: probe 0x265650 (counted, then run)
case 0x002656f0u: // native site: probe 0x2656f0 (counted, then run)
case 0x002658f0u: // native site: probe 0x2658f0 (counted, then run)
case 0x00265b10u: // native site: probe 0x265b10 (counted, then run)
case 0x00265cc0u: // native site: probe 0x265cc0 (counted, then run)
case 0x00265eb0u: // native site: probe 0x265eb0 (counted, then run)
case 0x00266060u: // native site: probe 0x266060 (counted, then run)
case 0x00266070u: // native site: probe 0x266070 (counted, then run)
case 0x00266080u: // native site: probe 0x266080 (counted, then run)
case 0x002660c0u: // native site: probe 0x2660c0 (counted, then run)
case 0x002660e0u: // native site: probe 0x2660e0 (counted, then run)
case 0x00266240u: // native site: probe 0x266240 (counted, then run)
case 0x00266560u: // native site: probe 0x266560 (counted, then run)
case 0x002665e4u: // native site: probe 0x2665e0 (counted, then run)
case 0x00266630u: // native site: probe 0x266630 (counted, then run)
case 0x00266640u: // native site: probe 0x266640 (counted, then run)
case 0x00266660u: // native site: probe 0x266660 (counted, then run)
case 0x00266740u: // native site: probe 0x266740 (counted, then run)
case 0x002667f0u: // native site: probe 0x2667f0 (counted, then run)
case 0x00266900u: // native site: probe 0x266900 (counted, then run)
case 0x00266a80u: // native site: probe 0x266a80 (counted, then run)
case 0x00266bc0u: // native site: probe 0x266bc0 (counted, then run)
case 0x00266bd0u: // native site: probe 0x266bd0 (counted, then run)
case 0x00266ef0u: // native site: probe 0x266ef0 (counted, then run)
case 0x00266f00u: // native site: probe 0x266f00 (counted, then run)
case 0x00267220u: // native site: probe 0x267220 (counted, then run)
case 0x00267260u: // native site: probe 0x267260 (counted, then run)
case 0x00267270u: // native site: probe 0x267270 (counted, then run)
case 0x002672c0u: // native site: probe 0x2672c0 (counted, then run)
case 0x00267310u: // native site: probe 0x267310 (counted, then run)
case 0x00267850u: // native site: probe 0x267850 (counted, then run)
case 0x00267a30u: // native site: probe 0x267a30 (counted, then run)
case 0x00267a60u: // native site: probe 0x267a60 (counted, then run)
case 0x00267fa0u: // native site: probe 0x267fa0 (counted, then run)
case 0x00267fc0u: // native site: probe 0x267fc0 (counted, then run)
case 0x0026af00u: // native site: probe 0x26af00 (counted, then run)
case 0x0026b4c0u: // native site: probe 0x26b4c0 (counted, then run)
case 0x002a0050u: // native site: probe 0x2a0050 (counted, then run)
case 0x002a0080u: // native site: probe 0x2a0080 (counted, then run)
case 0x002a01b4u: // native site: probe 0x2a01b0 (counted, then run)
case 0x002a01c0u: // native site: probe 0x2a01c0 (counted, then run)
case 0x002a0214u: // native site: probe 0x2a0210 (counted, then run)
case 0x002a0220u: // native site: probe 0x2a0220 (counted, then run)
case 0x002a0284u: // native site: probe 0x2a0280 (counted, then run)
case 0x002a0294u: // native site: probe 0x2a0290 (counted, then run)
case 0x002a02a4u: // native site: probe 0x2a02a0 (counted, then run)
case 0x002a02b0u: // native site: probe 0x2a02b0 (counted, then run)
case 0x002a03e0u: // native site: probe 0x2a03e0 (counted, then run)
case 0x002a0590u: // native site: probe 0x2a0590 (counted, then run)
case 0x002a0650u: // native site: probe 0x2a0650 (counted, then run)
case 0x002a0680u: // native site: probe 0x2a0680 (counted, then run)
case 0x002a06d0u: // native site: probe 0x2a06d0 (counted, then run)
case 0x002a0900u: // native site: probe 0x2a0900 (counted, then run)
case 0x002a0940u: // native site: probe 0x2a0940 (counted, then run)
case 0x002a0d30u: // native site: probe 0x2a0d30 (counted, then run)
case 0x002a13e0u: // native site: probe 0x2a13e0 (counted, then run)
case 0x002a1610u: // native site: probe 0x2a1610 (counted, then run)
case 0x002a1840u: // native site: probe 0x2a1840 (counted, then run)
case 0x002a19f4u: // native site: probe 0x2a19f0 (counted, then run)
case 0x002a1a14u: // native site: probe 0x2a1a10 (counted, then run)
case 0x002a1a30u: // native site: probe 0x2a1a30 (counted, then run)
case 0x002a1a70u: // native site: probe 0x2a1a70 (counted, then run)
case 0x002a1c40u: // native site: probe 0x2a1c40 (counted, then run)
case 0x002a1c70u: // native site: probe 0x2a1c70 (counted, then run)
case 0x002a1cb0u: // native site: probe 0x2a1cb0 (counted, then run)
case 0x002a1d60u: // native site: probe 0x2a1d60 (counted, then run)
case 0x002a1de0u: // native site: probe 0x2a1de0 (counted, then run)
case 0x002a1e90u: // native site: probe 0x2a1e90 (counted, then run)
case 0x002a1ea0u: // native site: probe 0x2a1ea0 (counted, then run)
case 0x002a1f30u: // native site: probe 0x2a1f30 (counted, then run)
case 0x002a1f40u: // native site: probe 0x2a1f40 (counted, then run)
case 0x002a1f50u: // native site: probe 0x2a1f50 (counted, then run)
case 0x002a1fc0u: // native site: probe 0x2a1fc0 (counted, then run)
case 0x0013f500u: // native site: probe 0x13f500 (a VU1 MSCAL outside IMD)
case 0x0013f5f0u: // native site: probe 0x13f5f0 (a VU1 MSCAL outside IMD)
case 0x0013f844u: // native site: probe 0x13f844 (a VU1 MSCAL outside IMD)
case 0x0013fbe4u: // native site: probe 0x13fbe4 (a VU1 MSCAL outside IMD)
case 0x0013fdf8u: // native site: probe 0x13fdf8 (a VU1 MSCAL outside IMD)
case 0x001401a8u: // native site: probe 0x1401a8 (a VU1 MSCAL outside IMD)
case 0x001afe70u: // native site: probe 0x1afe70 (a VU1 MSCAL outside IMD)
if (render::frames() >= g_from)
++g_counts[pc];
return false;
default: return false;
}
(void)rt;
}
void report()
{
for (const auto &[pc, n] : g_counts)
std::printf("[sbc:probe] %08x %llu\n", pc, static_cast<unsigned long long>(n));
if (!g_ram)
return;
auto rd32 = [](uint32_t a) { uint32_t v; std::memcpy(&v, g_ram + (a & 0x1FFFFFFu), 4); return v; };
const uint32_t table = rd32(g_gp - 0x7d60u);
for (const auto &[key, n] : g_prims)
{
const uint32_t id = static_cast<uint32_t>(key >> 8), mode = static_cast<uint32_t>(key & 0xFF);
const uint32_t sample = g_primSample[key];
std::printf("[sbc:imd] type %3u mode %u: %llu calls, driver %08x, sample %08x:", id, mode,
static_cast<unsigned long long>(n), mode < 8 ? rd32(table + id * 32 + mode * 4) : 0u, sample);
for (uint32_t i = 0; i < 0x40; i += 4)
std::printf(" %08x", rd32(sample + i));
std::printf("\n");
}
}
} // namespace sbc::probe