mirror of
https://github.com/hedge-dev/XenonRecomp.git
synced 2025-07-23 05:23:59 +00:00
Remove hardcoded recompiler, load TOML file for configuration.
This commit is contained in:
@@ -1,32 +1,20 @@
|
||||
#include "pch.h"
|
||||
#include "swa_recompiler.h"
|
||||
#include "test_recompiler.h"
|
||||
|
||||
// argv 1: xex file path
|
||||
// argv 2: switches toml file path
|
||||
// argv 3: output directory path
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (strstr(argv[1], ".xex") != nullptr)
|
||||
const char* path =
|
||||
#ifdef CONFIG_FILE_PATH
|
||||
CONFIG_FILE_PATH
|
||||
#else
|
||||
argv[1]
|
||||
#endif
|
||||
;
|
||||
|
||||
if (std::filesystem::is_regular_file(path))
|
||||
{
|
||||
SWARecompiler recompiler;
|
||||
//recompiler.config.skipLr = true;
|
||||
recompiler.config.ctrAsLocalVariable = true;
|
||||
recompiler.config.xerAsLocalVariable = true;
|
||||
recompiler.config.reservedRegisterAsLocalVariable = true;
|
||||
recompiler.config.skipMsr = true;
|
||||
recompiler.config.crRegistersAsLocalVariables = true;
|
||||
recompiler.config.nonArgumentRegistersAsLocalVariables = true;
|
||||
recompiler.config.nonVolatileRegistersAsLocalVariables = true;
|
||||
|
||||
std::println("Loading executable...");
|
||||
recompiler.LoadExecutable(argv[1]);
|
||||
|
||||
std::println("Loading switch tables...");
|
||||
recompiler.LoadSwitchTables(argv[2]);
|
||||
|
||||
std::println("Analysing functions...");
|
||||
Recompiler recompiler;
|
||||
recompiler.LoadConfig(path);
|
||||
recompiler.Analyse();
|
||||
|
||||
auto entry = recompiler.image.symbols.find(recompiler.image.entry_point);
|
||||
@@ -35,11 +23,11 @@ int main(int argc, char* argv[])
|
||||
entry->name = "_xstart";
|
||||
}
|
||||
|
||||
recompiler.Recompile(argv[3]);
|
||||
recompiler.Recompile();
|
||||
}
|
||||
else
|
||||
{
|
||||
TestRecompiler::RecompileTests(argv[1], argv[2]);
|
||||
TestRecompiler::RecompileTests(path, argv[2]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user