mirror of
https://github.com/ran-j/PS2Recomp.git
synced 2026-10-07 12:05:11 -04:00
feat: added header for link functions
This commit is contained in:
@@ -72,20 +72,14 @@ namespace ps2recomp
|
||||
size_t processedCount = 0;
|
||||
for (auto &function : m_functions)
|
||||
{
|
||||
std::cout << "processing function: " << function.name << std::endl;
|
||||
|
||||
if (shouldSkipFunction(function.name))
|
||||
{
|
||||
std::cout << "Skipping function: " << function.name << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (shouldStubFunction(function.name))
|
||||
{
|
||||
std::cout << "Stubbing function: " << function.name << std::endl;
|
||||
function.isStub = true;
|
||||
// TODO: Generate stub implementation
|
||||
continue;
|
||||
}
|
||||
|
||||
if (shouldStubFunction(function.name))
|
||||
{
|
||||
std::cout << "Stubbing function: " << function.name << std::endl;
|
||||
@@ -129,12 +123,15 @@ namespace ps2recomp
|
||||
{
|
||||
try
|
||||
{
|
||||
generateFunctionHeader();
|
||||
|
||||
if (m_config.singleFileOutput)
|
||||
{
|
||||
std::stringstream combinedOutput;
|
||||
|
||||
combinedOutput << "#include \"ps2_runtime_macros.h\"\n";
|
||||
combinedOutput << "#include \"ps2_runtime.h\"\n\n";
|
||||
combinedOutput << "#include \"ps2_runtime.h\"\n";
|
||||
combinedOutput << "#include \"ps2_recompiled_functions.h\"\n\n";
|
||||
|
||||
for (const auto &function : m_functions)
|
||||
{
|
||||
@@ -193,6 +190,41 @@ namespace ps2recomp
|
||||
}
|
||||
}
|
||||
|
||||
bool PS2Recompiler::generateFunctionHeader()
|
||||
{
|
||||
try
|
||||
{
|
||||
std::stringstream ss;
|
||||
|
||||
ss << "#ifndef PS2_RECOMPILED_FUNCTIONS_H\n";
|
||||
ss << "#define PS2_RECOMPILED_FUNCTIONS_H\n\n";
|
||||
|
||||
ss << "#include <cstdint>\n\n";
|
||||
ss << "struct R5900Context;\n\n";
|
||||
|
||||
for (const auto &function : m_functions)
|
||||
{
|
||||
if (function.isRecompiled)
|
||||
{
|
||||
ss << "void " << function.name << "(uint8_t* rdram, R5900Context* ctx);\n";
|
||||
}
|
||||
}
|
||||
|
||||
ss << "\n#endif // PS2_RECOMPILED_FUNCTIONS_H\n";
|
||||
|
||||
fs::path headerPath = fs::path(m_config.outputPath) / "ps2_recompiled_functions.h";
|
||||
writeToFile(headerPath.string(), ss.str());
|
||||
|
||||
std::cout << "Generated function header file: " << headerPath << std::endl;
|
||||
return true;
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
std::cerr << "Error generating function header: " << e.what() << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool PS2Recompiler::decodeFunction(Function &function)
|
||||
{
|
||||
std::vector<Instruction> instructions;
|
||||
|
||||
Reference in New Issue
Block a user