From 5d7c454e52f102f1ef42fb26218c1950211016a2 Mon Sep 17 00:00:00 2001 From: Jake Date: Fri, 18 Aug 2017 00:47:59 -0500 Subject: [PATCH] rsx: Vertex Decompiler, fix sca register assignment --- rpcs3/Emu/RSX/CgBinaryVertexProgram.cpp | 9 +++++---- rpcs3/Emu/RSX/Common/VertexProgramDecompiler.cpp | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/rpcs3/Emu/RSX/CgBinaryVertexProgram.cpp b/rpcs3/Emu/RSX/CgBinaryVertexProgram.cpp index 34ca3d8c89..e37c1bd313 100644 --- a/rpcs3/Emu/RSX/CgBinaryVertexProgram.cpp +++ b/rpcs3/Emu/RSX/CgBinaryVertexProgram.cpp @@ -51,21 +51,22 @@ std::string CgBinaryDisasm::GetScaMaskDisasm() std::string CgBinaryDisasm::GetDSTDisasm(bool isSca) { std::string ret; + std::string mask = GetMaskDisasm(isSca); - switch (isSca ? 0x1f : d3.dst) + switch ((isSca && d3.sca_dst_tmp != 0x3f) ? 0x1f : d3.dst) { case 0x1f: - ret += isSca ? fmt::format("R%d", d3.sca_dst_tmp) + GetScaMaskDisasm() : fmt::format("R%d", d0.dst_tmp) + GetVecMaskDisasm(); + ret += (isSca ? fmt::format("R%d", d3.sca_dst_tmp) : fmt::format("R%d", d0.dst_tmp)) + mask; break; default: if (d3.dst > 15) LOG_ERROR(RSX, "dst index out of range: %u", d3.dst); - ret += fmt::format("o[%d]", d3.dst) + GetVecMaskDisasm(); + ret += fmt::format("o[%d]", d3.dst) + mask; // Vertex Program supports double destinations, notably in MOV if (d0.dst_tmp != 0x3f) - ret += fmt::format(" R%d", d0.dst_tmp) + GetVecMaskDisasm(); + ret += fmt::format(" R%d", d0.dst_tmp) + mask; break; } diff --git a/rpcs3/Emu/RSX/Common/VertexProgramDecompiler.cpp b/rpcs3/Emu/RSX/Common/VertexProgramDecompiler.cpp index f800788b3a..cee3943e43 100644 --- a/rpcs3/Emu/RSX/Common/VertexProgramDecompiler.cpp +++ b/rpcs3/Emu/RSX/Common/VertexProgramDecompiler.cpp @@ -43,7 +43,7 @@ std::string VertexProgramDecompiler::GetDST(bool isSca) std::string mask = GetMask(isSca); - switch (isSca ? 0x1f : d3.dst) + switch ((isSca && d3.sca_dst_tmp != 0x3f) ? 0x1f : d3.dst) { case 0x1f: ret += m_parr.AddParam(PF_PARAM_NONE, getFloatTypeName(4), std::string("tmp") + std::to_string(isSca ? d3.sca_dst_tmp : d0.dst_tmp)) + mask;