mirror of
https://github.com/hedge-dev/XenonRecomp.git
synced 2025-04-19 10:51:18 +00:00
Use clang-cl for all projects & decrease recompiled CPP count.
This commit is contained in:
parent
126d5c3aee
commit
918e09d380
@ -1,61 +0,0 @@
|
||||
{
|
||||
"version": 3,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "windows-base",
|
||||
"hidden": true,
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/out/build/${presetName}",
|
||||
"installDir": "${sourceDir}/out/install/${presetName}",
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "cl.exe",
|
||||
"CMAKE_CXX_COMPILER": "cl.exe"
|
||||
},
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x64-debug",
|
||||
"displayName": "x64 Debug",
|
||||
"inherits": "windows-base",
|
||||
"architecture": {
|
||||
"value": "x64",
|
||||
"strategy": "external"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x64-release",
|
||||
"displayName": "x64 Release",
|
||||
"inherits": "x64-debug",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x86-debug",
|
||||
"displayName": "x86 Debug",
|
||||
"inherits": "windows-base",
|
||||
"architecture": {
|
||||
"value": "x86",
|
||||
"strategy": "external"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x86-release",
|
||||
"displayName": "x86 Release",
|
||||
"inherits": "x86-debug",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
28
CMakeSettings.json
Normal file
28
CMakeSettings.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "x64-Clang-Debug",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": "",
|
||||
"inheritEnvironments": [ "clang_cl_x64_x64" ],
|
||||
"variables": []
|
||||
},
|
||||
{
|
||||
"name": "x64-Clang-Release",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "RelWithDebInfo",
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": "",
|
||||
"inheritEnvironments": [ "clang_cl_x64_x64" ],
|
||||
"variables": []
|
||||
}
|
||||
]
|
||||
}
|
@ -1745,10 +1745,7 @@ bool Recompiler::Recompile(const Function& fn)
|
||||
println("PPC_FUNC(sub_{}) {{", fn.base);
|
||||
}
|
||||
|
||||
println("\t__assume((reinterpret_cast<size_t>(base) & 0xFFFFFFFF) == 0);");
|
||||
println("\tPPCRegister temp;");
|
||||
println("\tPPCVRegister vtemp;");
|
||||
println("\tuint32_t ea;\n");
|
||||
println("\tPPC_FUNC_PROLOGUE();");
|
||||
|
||||
auto switchTable = switchTables.end();
|
||||
bool allRecompiled = true;
|
||||
@ -1817,13 +1814,13 @@ void Recompiler::Recompile(const char* directoryPath)
|
||||
|
||||
for (size_t i = 0; i < functions.size(); i++)
|
||||
{
|
||||
if ((i % 100) == 0)
|
||||
if ((i % 256) == 0)
|
||||
{
|
||||
SaveCurrentOutData(directoryPath);
|
||||
println("#include \"ppc_recomp_shared.h\"\n");
|
||||
}
|
||||
|
||||
if ((i % 2000) == 0 || (i == (functions.size() - 1)))
|
||||
if ((i % 2048) == 0 || (i == (functions.size() - 1)))
|
||||
std::println("Recompiling functions... {}%", static_cast<float>(i + 1) / functions.size() * 100.0f);
|
||||
|
||||
Recompile(functions[i]);
|
||||
|
@ -115,6 +115,7 @@ void SWARecompiler::Analyse()
|
||||
else if (f.base == 0x82DE38A0) f.size = 0x16C;
|
||||
else if (f.base == 0x830B7DD0) f.size = 0x74;
|
||||
else if (f.base == 0x831B0BA0) f.size = 0xA0;
|
||||
else if (f.base == 0x8305D168) f.size = 0x278;
|
||||
};
|
||||
|
||||
for (const auto& section : image.sections)
|
||||
@ -145,7 +146,6 @@ void SWARecompiler::Analyse()
|
||||
}
|
||||
|
||||
data = section.data;
|
||||
const Symbol* prevSymbol = nullptr;
|
||||
|
||||
while (data < dataEnd)
|
||||
{
|
||||
@ -168,7 +168,6 @@ void SWARecompiler::Analyse()
|
||||
{
|
||||
assert(fnSymbol->address == base);
|
||||
|
||||
prevSymbol = &*fnSymbol;
|
||||
base += fnSymbol->size;
|
||||
data += fnSymbol->size;
|
||||
}
|
||||
|
@ -1,12 +1,9 @@
|
||||
project("PowerSample")
|
||||
|
||||
set(CMAKE_CXX_COMPILER "clang-cl")
|
||||
set(CMAKE_C_COMPILER "clang-cl")
|
||||
add_compile_options(
|
||||
"/clang:-march=x86-64-v3"
|
||||
"/clang:-Wall"
|
||||
"/clang:-Wno-unused-label"
|
||||
"/clang:-Wno-unused-variable")
|
||||
"-march=x86-64-v3"
|
||||
"-Wno-unused-label"
|
||||
"-Wno-unused-variable")
|
||||
|
||||
file(GLOB RecompiledFiles *.cpp)
|
||||
add_library(PowerSample ${RecompiledFiles})
|
||||
|
@ -20,6 +20,12 @@
|
||||
|
||||
#define PPC_FUNC(x) extern "C" void x(PPCContext& __restrict ctx, uint8_t* base) noexcept
|
||||
|
||||
#define PPC_FUNC_PROLOGUE() \
|
||||
__assume((reinterpret_cast<size_t>(base) & 0xFFFFFFFF) == 0); \
|
||||
PPCRegister temp; \
|
||||
PPCVRegister vtemp; \
|
||||
uint32_t ea
|
||||
|
||||
#define PPC_LOAD_U8(x) *(uint8_t*)(base + (x))
|
||||
#define PPC_LOAD_U16(x) _byteswap_ushort(*(uint16_t*)(base + (x)))
|
||||
#define PPC_LOAD_U32(x) _byteswap_ulong(*(uint32_t*)(base + (x)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user