diff --git a/XenonRecomp/CMakeLists.txt b/XenonRecomp/CMakeLists.txt index f5db6d1..895c18c 100644 --- a/XenonRecomp/CMakeLists.txt +++ b/XenonRecomp/CMakeLists.txt @@ -2,6 +2,11 @@ cmake_minimum_required (VERSION 3.8) project("XenonRecomp") +# Find required packages +find_package(fmt REQUIRED) +find_package(tomlplusplus REQUIRED) +find_package(xxHash REQUIRED) + add_executable(XenonRecomp "main.cpp" "recompiler.cpp" diff --git a/XenonRecomp/recompiler.cpp b/XenonRecomp/recompiler.cpp index 5374797..d28ca56 100644 --- a/XenonRecomp/recompiler.cpp +++ b/XenonRecomp/recompiler.cpp @@ -2240,6 +2240,75 @@ bool Recompiler::Recompile( println("\t{}.u64 = {}.u64 ^ {};", r(insn.operands[0]), r(insn.operands[1]), insn.operands[2] << 16); break; + case PPC_INST_MULHD: + println("\t{}.u64 = ({}.u64 * {}.u64) >> 64;", r(insn.operands[0]), r(insn.operands[1]), r(insn.operands[2])); + if (strchr(insn.opcode->name, '.')) + println("\t{}.compare({}.s64, 0);", cr(0), r(insn.operands[0])); + break; + +case PPC_INST_FRSQRTE: + println("\t{}.f64 = 1.0 / sqrt({}.f64);", f(insn.operands[0]), f(insn.operands[1])); + break; + +case PPC_INST_DCBST: + println("\t// Data Cache Block Store - system instruction, no operation in emulator"); + break; + +case PPC_INST_VCFPUXWS128: + println("\t{}.v4sf = vec_convert_to_float({}.v4si);", v(insn.operands[0]), v(insn.operands[1])); + break; + +case PPC_INST_VPKUWUS128: + println("\t{}.v8hi = vec_pack_unsigned({}.v4si, {}.v4si);", v(insn.operands[0]), v(insn.operands[1]), v(insn.operands[2])); + break; + +case PPC_INST_VPKUHUS128: + println("\t{}.v16qi = vec_pack_unsigned({}.v8hi, {}.v8hi);", v(insn.operands[0]), v(insn.operands[1]), v(insn.operands[2])); + break; + +case PPC_INST_EQV: + println("\t{}.u64 = ~({}.u64 ^ {}.u64);", r(insn.operands[0]), r(insn.operands[1]), r(insn.operands[2])); + if (strchr(insn.opcode->name, '.')) + println("\t{}.compare({}.s64, 0);", cr(0), r(insn.operands[0])); + break; + +case PPC_INST_VPKSWSS128: + println("\t{}.v8hi = vec_pack_saturate({}.v4si, {}.v4si);", v(insn.operands[0]), v(insn.operands[1]), v(insn.operands[2])); + break; + +case PPC_INST_MULHDU: + println("\t{}.u64 = ({}.u64 * {}.u64) >> 64;", r(insn.operands[0]), r(insn.operands[1]), r(insn.operands[2])); + if (strchr(insn.opcode->name, '.')) + println("\t{}.compare({}.u64, 0);", cr(0), r(insn.operands[0])); + break; + +case PPC_INST_STFSU: + println("\t*({}.ptr) = {}.f64;", r(insn.operands[1]), f(insn.operands[0])); + println("\t{}.u64 = {}.u64 + {}.s64;", r(insn.operands[1]), r(insn.operands[1]), r(insn.operands[2])); + break; + +case PPC_INST_MULLHWU: + println("\t{}.u32 = ({}.u16 * {}.u16);", r(insn.operands[0]), r(insn.operands[1]), r(insn.operands[2])); + if (strchr(insn.opcode->name, '.')) + println("\t{}.compare({}.u32, 0);", cr(0), r(insn.operands[0])); + break; + +case PPC_INST_VSEL128: + println("\t{}.v4si = vec_sel({}.v4si, {}.v4si, {}.v4si);", v(insn.operands[0]), v(insn.operands[1]), v(insn.operands[2]), v(insn.operands[3])); + break; + +case PPC_INST_VNOR128: + println("\t{}.v4si = ~({}.v4si | {}.v4si);", v(insn.operands[0]), v(insn.operands[1]), v(insn.operands[2])); + break; + +case PPC_INST_VANDC: + println("\t{}.v4si = {}.v4si & ~{}.v4si;", v(insn.operands[0]), v(insn.operands[1]), v(insn.operands[2])); + break; + +case PPC_INST_VPKSWSS: + println("\t{}.v8hi = vec_pack_saturate({}.v4si, {}.v4si);", v(insn.operands[0]), v(insn.operands[1]), v(insn.operands[2])); + break; + default: return false; } diff --git a/thirdparty/disasm/CMakeFiles/disasm.dir/disasm.c.obj b/thirdparty/disasm/CMakeFiles/disasm.dir/disasm.c.obj new file mode 100644 index 0000000..a3d0f68 Binary files /dev/null and b/thirdparty/disasm/CMakeFiles/disasm.dir/disasm.c.obj differ diff --git a/thirdparty/disasm/CMakeFiles/disasm.dir/ppc-dis.c.obj b/thirdparty/disasm/CMakeFiles/disasm.dir/ppc-dis.c.obj new file mode 100644 index 0000000..4e244f7 Binary files /dev/null and b/thirdparty/disasm/CMakeFiles/disasm.dir/ppc-dis.c.obj differ diff --git a/thirdparty/disasm/cmake_install.cmake b/thirdparty/disasm/cmake_install.cmake new file mode 100644 index 0000000..1238808 --- /dev/null +++ b/thirdparty/disasm/cmake_install.cmake @@ -0,0 +1,45 @@ +# Install script for directory: E:/recomp/XenonRecomp/thirdparty/disasm + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "C:/Program Files (x86)/disasm") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "Debug") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set path to fallback-tool for dependency-resolution. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "C:/msys64/clang64/bin/llvm-objdump.exe") +endif() + +string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT + "${CMAKE_INSTALL_MANIFEST_FILES}") +if(CMAKE_INSTALL_LOCAL_ONLY) + file(WRITE "E:/recomp/XenonRecomp/thirdparty/disasm/install_local_manifest.txt" + "${CMAKE_INSTALL_MANIFEST_CONTENT}") +endif() diff --git a/thirdparty/disasm/libdisasm.a b/thirdparty/disasm/libdisasm.a new file mode 100644 index 0000000..9e9a18c Binary files /dev/null and b/thirdparty/disasm/libdisasm.a differ