rsx: Vertex Decompiler, fix sca register assignment

This commit is contained in:
Jake 2017-08-18 00:47:59 -05:00 committed by kd-11
parent 4d5f98017f
commit 5d7c454e52
2 changed files with 6 additions and 5 deletions

View file

@ -51,21 +51,22 @@ std::string CgBinaryDisasm::GetScaMaskDisasm()
std::string CgBinaryDisasm::GetDSTDisasm(bool isSca) std::string CgBinaryDisasm::GetDSTDisasm(bool isSca)
{ {
std::string ret; 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: 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; break;
default: default:
if (d3.dst > 15) if (d3.dst > 15)
LOG_ERROR(RSX, "dst index out of range: %u", d3.dst); 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 // Vertex Program supports double destinations, notably in MOV
if (d0.dst_tmp != 0x3f) if (d0.dst_tmp != 0x3f)
ret += fmt::format(" R%d", d0.dst_tmp) + GetVecMaskDisasm(); ret += fmt::format(" R%d", d0.dst_tmp) + mask;
break; break;
} }

View file

@ -43,7 +43,7 @@ std::string VertexProgramDecompiler::GetDST(bool isSca)
std::string mask = GetMask(isSca); std::string mask = GetMask(isSca);
switch (isSca ? 0x1f : d3.dst) switch ((isSca && d3.sca_dst_tmp != 0x3f) ? 0x1f : d3.dst)
{ {
case 0x1f: 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; ret += m_parr.AddParam(PF_PARAM_NONE, getFloatTypeName(4), std::string("tmp") + std::to_string(isSca ? d3.sca_dst_tmp : d0.dst_tmp)) + mask;