PGXP: Treat add rd, rs, zero as moves
Fixes exploding vertices in BIOS intro. Needs further investigation as to why this fixes it - clearly the actual oepration is incorrect.
This commit is contained in:
parent
59ac365b52
commit
52dbcbaca5
|
@ -901,6 +901,8 @@ void CPU_ADDI(u32 instr, u32 rtVal, u32 rsVal)
|
|||
tempImm.d = imm(instr);
|
||||
tempImm.sd = (tempImm.sd << 16) >> 16; // sign extend
|
||||
|
||||
if (tempImm.d != 0)
|
||||
{
|
||||
ret.x = (float)f16Unsign(ret.x);
|
||||
ret.x += (float)tempImm.w.l;
|
||||
|
||||
|
@ -912,6 +914,7 @@ void CPU_ADDI(u32 instr, u32 rtVal, u32 rsVal)
|
|||
|
||||
// truncate on overflow/underflow
|
||||
ret.y += (ret.y > SHRT_MAX) ? -(USHRT_MAX + 1) : (ret.y < SHRT_MIN) ? USHRT_MAX + 1 : 0.f;
|
||||
}
|
||||
|
||||
CPU_reg[rt(instr)] = ret;
|
||||
CPU_reg[rt(instr)].value = rtVal;
|
||||
|
@ -1069,6 +1072,8 @@ void CPU_ADD(u32 instr, u32 rdVal, u32 rsVal, u32 rtVal)
|
|||
Validate(&CPU_reg[rs(instr)], rsVal);
|
||||
Validate(&CPU_reg[rt(instr)], rtVal);
|
||||
|
||||
if (rtVal != 0)
|
||||
{
|
||||
// iCB: Only require one valid input
|
||||
if (((CPU_reg[rt(instr)].flags & VALID_01) != VALID_01) != ((CPU_reg[rs(instr)].flags & VALID_01) != VALID_01))
|
||||
{
|
||||
|
@ -1096,6 +1101,11 @@ void CPU_ADD(u32 instr, u32 rdVal, u32 rsVal, u32 rtVal)
|
|||
ret.gFlags |= CPU_reg[rt(instr)].gFlags;
|
||||
ret.lFlags |= CPU_reg[rt(instr)].lFlags;
|
||||
ret.hFlags |= CPU_reg[rt(instr)].hFlags;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = CPU_reg[rs(instr)];
|
||||
}
|
||||
|
||||
ret.value = rdVal;
|
||||
|
||||
|
|
Loading…
Reference in New Issue