Skip to content

Commit 2cd41ad

Browse files
Remove bin2c, load the PPC context header by path.
1 parent ca39a3b commit 2cd41ad

8 files changed

Lines changed: 19 additions & 100 deletions

File tree

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ endif()
1313

1414
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
1515

16-
include("cmake/bin2h.cmake")
17-
1816
add_subdirectory(${THIRDPARTY_ROOT})
1917
set(POWERANALYSE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/PowerAnalyse)
2018
set(POWERUTILS_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/PowerUtils)

PowerRecomp/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ cmake_minimum_required (VERSION 3.8)
22

33
project("PowerRecomp")
44

5-
BIN2H(SOURCE_FILE
6-
${POWERUTILS_ROOT}/ppc_context.h
7-
HEADER_FILE "generated/ppc_context.gen.h"
8-
ARRAY_TYPE "char"
9-
VARIABLE_NAME "g_PPCContextText")
10-
115
add_executable(PowerRecomp
126
"main.cpp"
137
"recompiler.cpp"

PowerRecomp/generated/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

PowerRecomp/main.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,15 @@ int main(int argc, char* argv[])
2323
entry->name = "_xstart";
2424
}
2525

26-
recompiler.Recompile();
26+
const char* headerFilePath =
27+
#ifdef HEADER_FILE_PATH
28+
HEADER_FILE_PATH
29+
#else
30+
argv[2]
31+
#endif
32+
;
33+
34+
recompiler.Recompile(headerFilePath);
2735
}
2836
else
2937
{

PowerRecomp/pch.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@
1717
#include <xxhash.h>
1818
#include <fmt/core.h>
1919
#include <xmmintrin.h>
20-
#include "generated/ppc_context.gen.h"

PowerRecomp/recompiler.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,7 +2361,7 @@ bool Recompiler::Recompile(const Function& fn)
23612361
return allRecompiled;
23622362
}
23632363

2364-
void Recompiler::Recompile()
2364+
void Recompiler::Recompile(const std::filesystem::path& headerFilePath)
23652365
{
23662366
out.reserve(10 * 1024 * 1024);
23672367

@@ -2403,7 +2403,14 @@ void Recompiler::Recompile()
24032403
println("#pragma once");
24042404

24052405
println("#include \"ppc_config.h\"\n");
2406-
println("{}", std::string_view{g_PPCContextText, g_PPCContextText_size});
2406+
2407+
std::ifstream stream(headerFilePath);
2408+
if (stream.good())
2409+
{
2410+
std::stringstream ss;
2411+
ss << stream.rdbuf();
2412+
out += ss.str();
2413+
}
24072414

24082415
SaveCurrentOutData("ppc_context.h");
24092416
}

PowerRecomp/recompiler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ struct Recompiler
6464

6565
bool Recompile(const Function& fn);
6666

67-
void Recompile();
67+
void Recompile(const std::filesystem::path& headerFilePath);
6868

6969
void SaveCurrentOutData(const std::string_view& name = std::string_view());
7070
};

cmake/bin2h.cmake

Lines changed: 0 additions & 84 deletions
This file was deleted.

0 commit comments

Comments
 (0)