Remove bin2c, load the PPC context header by path.

This commit is contained in:
Skyth
2025-01-15 01:25:04 +03:00
parent ca39a3b992
commit 2cd41adf42
8 changed files with 19 additions and 100 deletions

View File

@@ -2,12 +2,6 @@ cmake_minimum_required (VERSION 3.8)
project("PowerRecomp")
BIN2H(SOURCE_FILE
${POWERUTILS_ROOT}/ppc_context.h
HEADER_FILE "generated/ppc_context.gen.h"
ARRAY_TYPE "char"
VARIABLE_NAME "g_PPCContextText")
add_executable(PowerRecomp
"main.cpp"
"recompiler.cpp"

View File

@@ -1,3 +0,0 @@
*
!.gitignore

View File

@@ -23,7 +23,15 @@ int main(int argc, char* argv[])
entry->name = "_xstart";
}
recompiler.Recompile();
const char* headerFilePath =
#ifdef HEADER_FILE_PATH
HEADER_FILE_PATH
#else
argv[2]
#endif
;
recompiler.Recompile(headerFilePath);
}
else
{

View File

@@ -17,4 +17,3 @@
#include <xxhash.h>
#include <fmt/core.h>
#include <xmmintrin.h>
#include "generated/ppc_context.gen.h"

View File

@@ -2361,7 +2361,7 @@ bool Recompiler::Recompile(const Function& fn)
return allRecompiled;
}
void Recompiler::Recompile()
void Recompiler::Recompile(const std::filesystem::path& headerFilePath)
{
out.reserve(10 * 1024 * 1024);
@@ -2403,7 +2403,14 @@ void Recompiler::Recompile()
println("#pragma once");
println("#include \"ppc_config.h\"\n");
println("{}", std::string_view{g_PPCContextText, g_PPCContextText_size});
std::ifstream stream(headerFilePath);
if (stream.good())
{
std::stringstream ss;
ss << stream.rdbuf();
out += ss.str();
}
SaveCurrentOutData("ppc_context.h");
}

View File

@@ -64,7 +64,7 @@ struct Recompiler
bool Recompile(const Function& fn);
void Recompile();
void Recompile(const std::filesystem::path& headerFilePath);
void SaveCurrentOutData(const std::string_view& name = std::string_view());
};