From c700c9508722722d39b368f94fc53607642eeaad Mon Sep 17 00:00:00 2001 From: Ran-j Date: Sat, 29 Nov 2025 01:20:45 -0300 Subject: [PATCH] feat: sync recompile and codegen output to match what are expected on runtime --- ps2xRecomp/src/code_generator.cpp | 11 ----------- ps2xRecomp/src/ps2_recompiler.cpp | 7 ++++--- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/ps2xRecomp/src/code_generator.cpp b/ps2xRecomp/src/code_generator.cpp index 67fc3ef..038b2af 100644 --- a/ps2xRecomp/src/code_generator.cpp +++ b/ps2xRecomp/src/code_generator.cpp @@ -2421,17 +2421,6 @@ namespace ps2recomp ss << "#include \"ps2_recompiled_functions.h\"\n"; ss << "#include \"ps2_stubs.h\"\n\n"; - ss << "// Default handler for unimplemented syscalls/functions\n"; - ss << "void ps2_syscalls::TODO(uint8_t* rdram, R5900Context* ctx) {\n"; - ss << " std::cout << \"Unimplemented syscall/function called at PC=0x\" << std::hex << ctx->pc << std::dec << std::endl;\n"; - ss << " ctx->r[2] = 0; // Return 0 by default\n"; - ss << "}\n\n"; - - ss << "void ps2_stubs::TODO(uint8_t* rdram, R5900Context* ctx) {\n"; - ss << " std::cout << \"Unimplemented library function called at PC=0x\" << std::hex << ctx->pc << std::dec << std::endl;\n"; - ss << " ctx->r[2] = 0; // Return 0 by default\n"; - ss << "}\n\n"; - // Registration function ss << "void registerAllFunctions(PS2Runtime& runtime) {\n"; diff --git a/ps2xRecomp/src/ps2_recompiler.cpp b/ps2xRecomp/src/ps2_recompiler.cpp index 7903ec2..0cfd1ed 100644 --- a/ps2xRecomp/src/ps2_recompiler.cpp +++ b/ps2xRecomp/src/ps2_recompiler.cpp @@ -116,8 +116,9 @@ namespace ps2recomp { std::stringstream combinedOutput; + combinedOutput << "#include \"ps2_recompiled_functions.h\"\n\n"; combinedOutput << "#include \"ps2_runtime_macros.h\"\n"; - combinedOutput << "#include \"ps2_runtime.h\"\n\n"; + combinedOutput << "#include \"ps2_runtime.h\"\n"; for (const auto &function : m_functions) { @@ -149,7 +150,7 @@ namespace ps2recomp } } - fs::path outputPath = fs::path(m_config.outputPath) / "recompiled.cpp"; + fs::path outputPath = fs::path(m_config.outputPath) / "ps2_recompiled_functions.cpp"; writeToFile(outputPath.string(), combinedOutput.str()); std::cout << "Wrote recompiled to combined output to: " << outputPath << std::endl; } @@ -215,7 +216,7 @@ namespace ps2recomp ss << "#define PS2_RECOMPILED_FUNCTIONS_H\n\n"; ss << "#include \n\n"; - ss << "struct R5900Context;\n\n"; + ss << "struct R5900Context;\n"; ss << "class PS2Runtime;\n\n"; for (const auto &function : m_functions)