diff --git a/RSPRecomp/RSPRecomp.vcxproj b/RSPRecomp/RSPRecomp.vcxproj new file mode 100644 index 0000000..952a4c9 --- /dev/null +++ b/RSPRecomp/RSPRecomp.vcxproj @@ -0,0 +1,163 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + + {b56d9db2-fb5d-4241-848a-159d17120f35} + + + {17be354c-2b15-4175-8535-7d0d046217a6} + + + + 16.0 + Win32Proj + {31e04b52-67ad-4cef-803f-09a10f81b100} + RSPRecomp + 10.0 + + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + false + + + true + + + false + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)lib\rabbitizer\include;$(SolutionDir)lib\rabbitizer\cplusplus\include;$(SolutionDir)lib\ELFIO;$(SolutionDir)lib\fmt\include;$(ProjectDir)include;%(AdditionalIncludeDirectories) + stdcpp20 + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)lib\rabbitizer\include;$(SolutionDir)lib\rabbitizer\cplusplus\include;$(SolutionDir)lib\ELFIO;$(SolutionDir)lib\fmt\include;$(ProjectDir)include;%(AdditionalIncludeDirectories) + stdcpp20 + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)lib\rabbitizer\include;$(SolutionDir)lib\rabbitizer\cplusplus\include;$(SolutionDir)lib\ELFIO;$(SolutionDir)lib\fmt\include;$(ProjectDir)include;%(AdditionalIncludeDirectories) + stdcpp20 + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)lib\rabbitizer\include;$(SolutionDir)lib\rabbitizer\cplusplus\include;$(SolutionDir)lib\ELFIO;$(SolutionDir)lib\fmt\include;$(ProjectDir)include;%(AdditionalIncludeDirectories) + stdcpp20 + + + Console + true + true + true + + + + + + \ No newline at end of file diff --git a/RSPRecomp/RSPRecomp.vcxproj.filters b/RSPRecomp/RSPRecomp.vcxproj.filters new file mode 100644 index 0000000..fae6693 --- /dev/null +++ b/RSPRecomp/RSPRecomp.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/RSPRecomp/src/rsp_recomp.cpp b/RSPRecomp/src/rsp_recomp.cpp new file mode 100644 index 0000000..fe04dfc --- /dev/null +++ b/RSPRecomp/src/rsp_recomp.cpp @@ -0,0 +1,33 @@ +#include "rabbitizer.hpp" +#include "fmt/format.h" +#include "fmt/ostream.h" + +int main() { + //rabbitizer::InstructionRsp instr{ 0xE9DD3801, 0x040013E0 }; // suv $v29[0], 0x8($14) + rabbitizer::InstructionRsp instr{ 0xEAF70B84, 0x04001624 }; // ssv $v23[7], 0x8($23) + //rabbitizer::InstructionRsp instr{ 0x4B5E888F, 0x04001414 }; // vmadh $v2, $v17, $v30[2] + bool has_element = false; + int element = 0; + + fmt::print("{}\n", instr.disassemble(0)); + fmt::print("{}\n", instr.getOpcodeName()); + fmt::print("{}\n", instr.disassembleOperands()); + + if (instr.hasOperand(rabbitizer::OperandType::rsp_vt_elementhigh)) { + element = instr.GetRsp_elementhigh(); + has_element = true; + } else if (instr.hasOperand(rabbitizer::OperandType::rsp_vt_elementlow)) { + if (has_element) { + fmt::print(stderr, "Instruction cannot have two element values {}\n", instr.disassemble(0)); + std::exit(EXIT_FAILURE); + } + element = instr.GetRsp_elementlow(); + has_element = true; + } + + if (has_element) { + fmt::print("element: 0x{:X}\n", element); + } + + return 0; +} diff --git a/RecompPort.sln b/RecompPort.sln index 9fc265b..9de0456 100644 --- a/RecompPort.sln +++ b/RecompPort.sln @@ -9,6 +9,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Rabbitizer", "lib\Rabbitize EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fmtlib", "lib\fmtlib.vcxproj", "{B56D9DB2-FB5D-4241-848A-159D17120F35}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RSPRecomp", "RSPRecomp\RSPRecomp.vcxproj", "{31E04B52-67AD-4CEF-803F-09A10F81B100}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -41,6 +43,14 @@ Global {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 + {31E04B52-67AD-4CEF-803F-09A10F81B100}.Debug|x64.ActiveCfg = Debug|x64 + {31E04B52-67AD-4CEF-803F-09A10F81B100}.Debug|x64.Build.0 = Debug|x64 + {31E04B52-67AD-4CEF-803F-09A10F81B100}.Debug|x86.ActiveCfg = Debug|Win32 + {31E04B52-67AD-4CEF-803F-09A10F81B100}.Debug|x86.Build.0 = Debug|Win32 + {31E04B52-67AD-4CEF-803F-09A10F81B100}.Release|x64.ActiveCfg = Release|x64 + {31E04B52-67AD-4CEF-803F-09A10F81B100}.Release|x64.Build.0 = Release|x64 + {31E04B52-67AD-4CEF-803F-09A10F81B100}.Release|x86.ActiveCfg = Release|Win32 + {31E04B52-67AD-4CEF-803F-09A10F81B100}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/test/src/overlays.cpp b/test/src/overlays.cpp index 68d7891..ac62a5b 100644 --- a/test/src/overlays.cpp +++ b/test/src/overlays.cpp @@ -88,7 +88,7 @@ extern "C" void unload_overlays(int32_t ram_addr, uint32_t size) { void init_overlays() { for (size_t section_index = 0; section_index < num_code_sections; section_index++) { - section_addresses[section_index] = section_table[section_index].ram_addr; + section_addresses[section_table[section_index].index] = section_table[section_index].ram_addr; } // Sort the executable sections by rom address