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
+10 -3
View File
@@ -838,7 +838,7 @@ void register_code_generator_tests()
t.IsTrue(generated.find("if (ctx->pc != 0xD008u) { return; }") != std::string::npos, "JALR should check return PC");
});
tc.Run("backward BEQ emits label and goto (sign-extended offset)", [](TestCase &t) {
tc.Run("backward BEQ yields cooperatively on sign-extended internal loop", [](TestCase &t) {
Function func;
func.name = "backward_branch";
func.start = 0x1100;
@@ -861,10 +861,17 @@ void register_code_generator_tests()
CodeGenerator gen({}, {});
std::string generated = gen.generateFunction(func, instructions, false);
printGeneratedCode("backward BEQ emits label and goto (sign-extended offset)", generated);
printGeneratedCode("backward BEQ yields cooperatively on sign-extended internal loop", generated);
t.IsTrue(generated.find("label_1100:") != std::string::npos, "target should emit a label");
t.IsTrue(generated.find("goto label_1100;") != std::string::npos, "backward internal branch should goto label");
t.IsTrue(generated.find("ctx->pc = 0x1100u;") != std::string::npos,
"backward internal branch should preserve the loop target in ctx->pc");
t.IsTrue(generated.find("runtime->cooperativeGuestYield();") != std::string::npos,
"backward internal branch should yield guest execution before re-entering the loop");
t.IsTrue(generated.find("goto label_1100;") != std::string::npos,
"backward internal branch should re-enter the in-function label after yielding");
t.IsTrue(generated.find("ctx->pc = 0x1100u;\n return;") == std::string::npos,
"backward internal branch should not return to the dispatcher for a non-entry internal label");
});
tc.Run("branch-likely places delay slot only in taken path", [](TestCase &t) {