From 4b1dc1401913f1046bba5406948d25b1fab43c90 Mon Sep 17 00:00:00 2001 From: Mr-Wiseguy Date: Tue, 15 Nov 2022 19:55:48 -0500 Subject: [PATCH] Added ELFIO and fmtlib libraries --- .gitignore | 3 + .gitmodules | 6 ++ RecompPort.sln | 10 +++ RecompPort.vcxproj | 14 +++- RecompPort.vcxproj.filters | 5 ++ lib/ELFIO | 1 + lib/fmt | 1 + lib/fmtlib.vcxproj | 151 +++++++++++++++++++++++++++++++++++++ lib/fmtlib.vcxproj.filters | 22 ++++++ src/main.cpp | 5 +- 10 files changed, 213 insertions(+), 5 deletions(-) create mode 160000 lib/ELFIO create mode 160000 lib/fmt create mode 100644 lib/fmtlib.vcxproj create mode 100644 lib/fmtlib.vcxproj.filters diff --git a/.gitignore b/.gitignore index 6545e72..4712504 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ # VSCode file settings .vscode/settings.json +# Input elf files +*.elf + # Linux build output build/ *.o diff --git a/.gitmodules b/.gitmodules index f16f2f8..bee03b3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,9 @@ [submodule "lib/rabbitizer"] path = lib/rabbitizer url = https://github.com/Decompollaborate/rabbitizer +[submodule "lib/ELFIO"] + path = lib/ELFIO + url = https://github.com/serge1/ELFIO +[submodule "lib/fmt"] + path = lib/fmt + url = https://github.com/fmtlib/fmt diff --git a/RecompPort.sln b/RecompPort.sln index b78ca84..9fc265b 100644 --- a/RecompPort.sln +++ b/RecompPort.sln @@ -7,6 +7,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RecompPort", "RecompPort.vc EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Rabbitizer", "lib\Rabbitizer.vcxproj", "{17BE354C-2B15-4175-8535-7D0D046217A6}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fmtlib", "lib\fmtlib.vcxproj", "{B56D9DB2-FB5D-4241-848A-159D17120F35}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -31,6 +33,14 @@ Global {17BE354C-2B15-4175-8535-7D0D046217A6}.Release|x64.Build.0 = Release|x64 {17BE354C-2B15-4175-8535-7D0D046217A6}.Release|x86.ActiveCfg = Release|Win32 {17BE354C-2B15-4175-8535-7D0D046217A6}.Release|x86.Build.0 = Release|Win32 + {B56D9DB2-FB5D-4241-848A-159D17120F35}.Debug|x64.ActiveCfg = Debug|x64 + {B56D9DB2-FB5D-4241-848A-159D17120F35}.Debug|x64.Build.0 = Debug|x64 + {B56D9DB2-FB5D-4241-848A-159D17120F35}.Debug|x86.ActiveCfg = Debug|Win32 + {B56D9DB2-FB5D-4241-848A-159D17120F35}.Debug|x86.Build.0 = Debug|Win32 + {B56D9DB2-FB5D-4241-848A-159D17120F35}.Release|x64.ActiveCfg = Release|x64 + {B56D9DB2-FB5D-4241-848A-159D17120F35}.Release|x64.Build.0 = Release|x64 + {B56D9DB2-FB5D-4241-848A-159D17120F35}.Release|x86.ActiveCfg = Release|Win32 + {B56D9DB2-FB5D-4241-848A-159D17120F35}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/RecompPort.vcxproj b/RecompPort.vcxproj index cf32fad..9ba36e6 100644 --- a/RecompPort.vcxproj +++ b/RecompPort.vcxproj @@ -76,7 +76,7 @@ ProgramDatabase Disabled stdcpp17 - $(SolutionDir)lib\rabbitizer\include;$(SolutionDir)lib\rabbitizer\cplusplus\include;%(AdditionalIncludeDirectories) + $(SolutionDir)lib\rabbitizer\include;$(SolutionDir)lib\rabbitizer\cplusplus\include;$(SolutionDir)lib\ELFIO;$(SolutionDir)lib\fmt\include;%(AdditionalIncludeDirectories) MachineX86 @@ -92,7 +92,7 @@ Level3 ProgramDatabase stdcpp17 - $(SolutionDir)lib\rabbitizer\include;$(SolutionDir)lib\rabbitizer\cplusplus\include;%(AdditionalIncludeDirectories) + $(SolutionDir)lib\rabbitizer\include;$(SolutionDir)lib\rabbitizer\cplusplus\include;$(SolutionDir)lib\ELFIO;$(SolutionDir)lib\fmt\include;%(AdditionalIncludeDirectories) MachineX86 @@ -106,7 +106,7 @@ stdcpp17 - $(SolutionDir)lib\rabbitizer\include;$(SolutionDir)lib\rabbitizer\cplusplus\include;%(AdditionalIncludeDirectories) + $(SolutionDir)lib\rabbitizer\include;$(SolutionDir)lib\rabbitizer\cplusplus\include;$(SolutionDir)lib\ELFIO;$(SolutionDir)lib\fmt\include;%(AdditionalIncludeDirectories) Console @@ -116,7 +116,7 @@ stdcpp17 - $(SolutionDir)lib\rabbitizer\include;$(SolutionDir)lib\rabbitizer\cplusplus\include;%(AdditionalIncludeDirectories) + $(SolutionDir)lib\rabbitizer\include;$(SolutionDir)lib\rabbitizer\cplusplus\include;$(SolutionDir)lib\ELFIO;$(SolutionDir)lib\fmt\include;%(AdditionalIncludeDirectories) Console @@ -124,6 +124,9 @@ + + {b56d9db2-fb5d-4241-848a-159d17120f35} + {17be354c-2b15-4175-8535-7d0d046217a6} @@ -131,6 +134,9 @@ + + + diff --git a/RecompPort.vcxproj.filters b/RecompPort.vcxproj.filters index ddc083e..4d4d73c 100644 --- a/RecompPort.vcxproj.filters +++ b/RecompPort.vcxproj.filters @@ -19,4 +19,9 @@ Source Files + + + Header Files + + \ No newline at end of file diff --git a/lib/ELFIO b/lib/ELFIO new file mode 160000 index 0000000..ad8b641 --- /dev/null +++ b/lib/ELFIO @@ -0,0 +1 @@ +Subproject commit ad8b641f9682b6091ba8b9f7c8152255c1a2c803 diff --git a/lib/fmt b/lib/fmt new file mode 160000 index 0000000..d2e89c8 --- /dev/null +++ b/lib/fmt @@ -0,0 +1 @@ +Subproject commit d2e89c8b080394e996d449371267365c223ca76b diff --git a/lib/fmtlib.vcxproj b/lib/fmtlib.vcxproj new file mode 100644 index 0000000..b6e558b --- /dev/null +++ b/lib/fmtlib.vcxproj @@ -0,0 +1,151 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {b56d9db2-fb5d-4241-848a-159d17120f35} + fmtlib + 10.0 + + + + StaticLibrary + true + v142 + Unicode + + + StaticLibrary + false + v142 + true + Unicode + + + StaticLibrary + true + v142 + Unicode + + + StaticLibrary + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + false + + + true + + + false + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(ProjectDir)fmt\include;%(AdditionalIncludeDirectories) + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(ProjectDir)fmt\include;%(AdditionalIncludeDirectories) + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(ProjectDir)fmt\include;%(AdditionalIncludeDirectories) + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(ProjectDir)fmt\include;%(AdditionalIncludeDirectories) + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/lib/fmtlib.vcxproj.filters b/lib/fmtlib.vcxproj.filters new file mode 100644 index 0000000..48d6a1f --- /dev/null +++ b/lib/fmtlib.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index df3952a..b40653a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,6 @@ #include "rabbitizer.hpp" +#include "elfio/elfio.hpp" +#include "fmt/format.h" #include @@ -8,7 +10,8 @@ int main(int argc, char** argv) { int extraLJust = 5; rabbitizer::InstructionCpu instr(word, vram); - printf("%08X: %s\n", word, instr.disassemble(extraLJust).c_str()); + fmt::print("{}\n", instr.isBranch()); + fmt::print("{:08X}: {}\n", word, instr.disassemble(extraLJust)); return 0; }