Feature/added execution guess gs psmt (#104)

* fix: CRITICAL fix on code gen on generating BEQ translation, I added a small yeld because goto could spin forever and monopolize guest execution

* feat: add scratchpad alias base and improve scratchpad address handling

* feat: added debug logging on GifArbiter for submit and drain operations

* feat: add interrupt and thread management syscall implementations
fix: change some IDs calls to match ps2sdk

* feat: added vif1 logs

* feat: added logs on gs gpu
feat: added performLocalToLocalTransfer to GS emulation path for TRXDIR = 2. (emulates the PS2 GS “copy this rectangle from one place in VRAM to another”)

* feat: added PSMT8 and refactor PSMT4

* feat: some identation on vu1
feat: added some logs on vu1

* feat: added GuestExecutionScope to temporarily stop owning guest execution, then restore it exactly as it was.
feat: added vsync wizardry
feat: added some regression test

* fix: fix gs logger

* feat: remove extra logs I think they will help no one
feat: move join all threads to prevent the app to get stuck on close, but now it random crash on closing
feat: one more small test on psmt4 to try fix ghosting on re code veronica

* feat: added a small case for exporter from ghidra for metal slug 3

* feat: added ugly code to pass on test
This commit is contained in:
Ranieri
2026-03-18 19:14:40 -03:00
committed by GitHub
parent 7ca6a866c9
commit cad1ca0bb5
32 changed files with 3942 additions and 685 deletions
+16 -6
View File
@@ -227,6 +227,19 @@ namespace ps2recomp
const uint32_t branchPc = branchInst.address;
const uint32_t delayPc = branchInst.address + 4u;
const uint32_t fallthroughPc = branchInst.address + 8u;
auto emitInternalTarget = [&](uint32_t target, uint32_t sourcePc, std::string_view indent)
{
ss << fmt::format("{}ctx->pc = 0x{:X}u;\n", indent, target);
if (target <= sourcePc)
{
ss << fmt::format("{}runtime->cooperativeGuestYield();\n", indent);
ss << fmt::format("{}goto label_{:x};\n", indent, target);
}
else
{
ss << fmt::format("{}goto label_{:x};\n", indent, target);
}
};
std::vector<uint32_t> sortedInternalTargets;
if (branchInst.opcode == OPCODE_SPECIAL &&
@@ -293,8 +306,7 @@ namespace ps2recomp
if (internalTargets.contains(target))
{
ss << fmt::format(" ctx->pc = 0x{:X}u;\n", target);
ss << fmt::format(" goto label_{:x};\n", target);
emitInternalTarget(target, branchPc, " ");
}
else
{
@@ -579,8 +591,7 @@ namespace ps2recomp
if (internalTargets.contains(target))
{
ss << fmt::format(" ctx->pc = 0x{:X}u;\n", target);
ss << fmt::format(" goto label_{:x};\n", target);
emitInternalTarget(target, branchPc, " ");
}
else
{
@@ -606,8 +617,7 @@ namespace ps2recomp
ss << " if (" << branchTakenVar << ") {\n";
if (internalTargets.contains(target))
{
ss << fmt::format(" ctx->pc = 0x{:X}u;\n", target);
ss << fmt::format(" goto label_{:x};\n", target);
emitInternalTarget(target, branchPc, " ");
}
else
{