Latte: Use the Wii U overflow value for MOVA
Some checks failed
Build check / build (push) Has been cancelled
Generate translation template / generate-pot (push) Has been cancelled

The Wii U returns -256 when MOVA goes out of range.
Cemu clamped large positive values to 255 instead.
This commit is contained in:
Crementif
2026-09-17 20:03:23 +02:00
parent 54ffbed26a
commit e33db57f94
2 changed files with 4 additions and 4 deletions

View File

@@ -1084,7 +1084,7 @@ void _emitALUOP2InstructionCode(LatteDecompilerShaderContext* shaderContext, Lat
_emitOperandInputCode(shaderContext, aluInstruction, 0, LATTE_DECOMPILER_DTYPE_FLOAT);
src->add(";" _CRLF);
src->add("tempResultf = floor(tempResultf);" _CRLF);
src->add("tempResultf = clamp(tempResultf, -256.0, 255.0);" _CRLF);
src->add("tempResultf = (tempResultf >= -256.0 && tempResultf <= 255.0) ? tempResultf : -256.0;" _CRLF);
// set AR
if( aluInstruction->destElem == 0 )
src->add("ARi.x = int(tempResultf);" _CRLF);
@@ -1109,7 +1109,7 @@ void _emitALUOP2InstructionCode(LatteDecompilerShaderContext* shaderContext, Lat
src->add("tempResulti = ");
_emitOperandInputCode(shaderContext, aluInstruction, 0, LATTE_DECOMPILER_DTYPE_SIGNED_INT);
src->add(";" _CRLF);
src->add("tempResulti = clamp(tempResulti, -256, 255);" _CRLF);
src->add("tempResulti = (tempResulti >= -256 && tempResulti <= 255) ? tempResulti : -256;" _CRLF);
// set AR
if( aluInstruction->destElem == 0 )
src->add("ARi.x = tempResulti;" _CRLF);

View File

@@ -1018,7 +1018,7 @@ static void _emitALUOP2InstructionCode(LatteDecompilerShaderContext* shaderConte
_emitOperandInputCode(shaderContext, aluInstruction, 0, LATTE_DECOMPILER_DTYPE_FLOAT);
src->add(";" _CRLF);
src->add("tempResultf = floor(tempResultf);" _CRLF);
src->add("tempResultf = clamp(tempResultf, -256.0, 255.0);" _CRLF);
src->add("tempResultf = (tempResultf >= -256.0 && tempResultf <= 255.0) ? tempResultf : -256.0;" _CRLF);
// set AR
if( aluInstruction->destElem == 0 )
src->add("ARi.x = int(tempResultf);" _CRLF);
@@ -1043,7 +1043,7 @@ static void _emitALUOP2InstructionCode(LatteDecompilerShaderContext* shaderConte
src->add("tempResulti = ");
_emitOperandInputCode(shaderContext, aluInstruction, 0, LATTE_DECOMPILER_DTYPE_SIGNED_INT);
src->add(";" _CRLF);
src->add("tempResulti = clamp(tempResulti, -256, 255);" _CRLF);
src->add("tempResulti = (tempResulti >= -256 && tempResulti <= 255) ? tempResulti : -256;" _CRLF);
// set AR
if( aluInstruction->destElem == 0 )
src->add("ARi.x = tempResulti;" _CRLF);