mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-03-11 16:05:23 +01:00
[rsx/wip] Take the branching code on BRB when bit 25 of d3 is set
This commit is contained in:
parent
91b73dafd5
commit
335fb6456e
|
|
@ -216,22 +216,12 @@ std::string VertexProgramDecompiler::Format(const std::string& code)
|
|||
return "if(" + cond + ") ";
|
||||
}
|
||||
},
|
||||
{ "$cond", std::bind(std::mem_fn(&VertexProgramDecompiler::GetCond), this) },
|
||||
{ "$bconst", std::bind(std::mem_fn(&VertexProgramDecompiler::GetBooleanConstantCond), this) }
|
||||
{ "$cond", std::bind(std::mem_fn(&VertexProgramDecompiler::GetCond), this) }
|
||||
};
|
||||
|
||||
return fmt::replace_all(code, repl_list);
|
||||
}
|
||||
|
||||
std::string VertexProgramDecompiler::GetBooleanConstantCond()
|
||||
{
|
||||
if (d0.cond == 0) return "false";
|
||||
if (d0.cond == 7) return "true";
|
||||
|
||||
LOG_ERROR(RSX, "Boolean constant condition not found; returning false");
|
||||
return "false";
|
||||
}
|
||||
|
||||
std::string VertexProgramDecompiler::GetCond()
|
||||
{
|
||||
enum
|
||||
|
|
@ -671,24 +661,30 @@ std::string VertexProgramDecompiler::Decompile()
|
|||
case RSX_SCA_OPCODE_BRB:
|
||||
// works differently (BRB o[1].x !b0, L0;)
|
||||
{
|
||||
LOG_ERROR(RSX, "Unimplemented sca_opcode BRB d0=0x%X, d1=0x%X, d2=0x%X, d3=0x%X", d0.HEX, d1.HEX, d2.HEX, d3.HEX);
|
||||
u32 jump_position = find_jump_lvl(GetAddr());
|
||||
|
||||
LOG_WARNING(RSX, "sca_opcode BRB, d0=0x%X, d1=0x%X, d2=0x%X, d3=0x%X", d0.HEX, d1.HEX, d2.HEX, d3.HEX);
|
||||
AddCode(fmt::format("//BRB opcode, d0=0x%X, d1=0x%X, d2=0x%X, d3=0x%X", d0.HEX, d1.HEX, d2.HEX, d3.HEX));
|
||||
AddCode("if (!$bconst) //BRB"); //If only the cond flags are set, we can just use $ifcond
|
||||
AddCode("{");
|
||||
m_cur_instr->open_scopes++;
|
||||
AddCode(fmt::format("jump_position = %u;", jump_position));
|
||||
AddCode("continue;");
|
||||
m_cur_instr->close_scopes++;
|
||||
AddCode("}");
|
||||
|
||||
if (d3.brb_cond_true)
|
||||
{
|
||||
u32 jump_position = find_jump_lvl(GetAddr());
|
||||
AddCode(fmt::format("jump_position = %u;", jump_position));
|
||||
AddCode("continue;");
|
||||
AddCode("");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case RSX_SCA_OPCODE_CLB: break;
|
||||
// works same as BRB
|
||||
LOG_ERROR(RSX, "Unimplemented sca_opcode CLB");
|
||||
AddCode("if (!$bconst) $f(); //CLB");
|
||||
LOG_WARNING(RSX, "sca_opcode CLB, d0=0x%X, d1=0x%X, d2=0x%X, d3=0x%X", d0.HEX, d1.HEX, d2.HEX, d3.HEX);
|
||||
AddCode("//CLB");
|
||||
|
||||
if (d3.brb_cond_true)
|
||||
{
|
||||
AddCode("$f(); //CLB");
|
||||
AddCode("");
|
||||
}
|
||||
|
||||
break;
|
||||
case RSX_SCA_OPCODE_PSH: break;
|
||||
// works differently (PSH o[1].x A0;)
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@ struct VertexProgramDecompiler
|
|||
std::string GetFunc();
|
||||
std::string GetTex();
|
||||
std::string GetCond();
|
||||
std::string GetBooleanConstantCond();
|
||||
std::string AddAddrMask();
|
||||
std::string AddAddrReg();
|
||||
std::string AddAddrRegWithoutMask();
|
||||
|
|
|
|||
|
|
@ -146,9 +146,12 @@ union D3
|
|||
u32 sca_writemask_x : 1;
|
||||
u32 src2l : 11;
|
||||
};
|
||||
|
||||
struct
|
||||
{
|
||||
u32 : 29;
|
||||
u32 : 25;
|
||||
u32 brb_cond_true : 1;
|
||||
u32 : 3;
|
||||
u32 iaddrl : 3;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue