From 961726dc8894f5453554794fd291e1170f7de215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 15 Oct 2026 00:09:25 +0200 Subject: [PATCH] VFPU: vrnds takes its seed from the vs field The toolchain encodes vrnds's operand in vs and leaves vd zero, so we always seeded from S000. Resistance: Retribution reseeds per particle from S620, which made every particle in its smoke and explosions take new random values each frame. They flickered, and some never drew. Hardware test: cpu/vfpu/vrnd (vs and vd fields). Co-Authored-By: Claude Opus 5.5 (1M context) --- Core/MIPS/InterpreterVFPU.cpp | 5 +++-- Core/MIPS/MIPSDisVFPU.cpp | 4 ++-- pspautotests | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Core/MIPS/InterpreterVFPU.cpp b/Core/MIPS/InterpreterVFPU.cpp index 598fec521c..481577b47d 100644 --- a/Core/MIPS/InterpreterVFPU.cpp +++ b/Core/MIPS/InterpreterVFPU.cpp @@ -1587,8 +1587,9 @@ namespace MIPSInt } void Int_Vrnds(MIPSState *mips, MIPSOpcode op) { - int vd = _VD; - int seed = VI(vd); + // The seed is in the vs field. The toolchain leaves vd zero, so reading vd gets S000. + int vs = _VS; + int seed = VI(vs); // Swizzles apply a constant value, constants/abs/neg work to vary the seed. ApplySwizzleS(mips, reinterpret_cast(&seed), V_Single); vrnd_init(uint32_t(seed), mips->vfpuCtrl + VFPU_CTRL_RCX0); diff --git a/Core/MIPS/MIPSDisVFPU.cpp b/Core/MIPS/MIPSDisVFPU.cpp index da1c3e974d..55787b9d7b 100644 --- a/Core/MIPS/MIPSDisVFPU.cpp +++ b/Core/MIPS/MIPSDisVFPU.cpp @@ -567,9 +567,9 @@ namespace MIPSDis } void Dis_Vrnds(MIPSOpcode op, uint32_t pc, char *out, size_t outSize) { - int vd = _VD; + int vs = _VS; const char *name = MIPSGetName(op); - snprintf(out, outSize, "%s%s\t%s", name, VSuff(op), VN(vd, V_Single)); + snprintf(out, outSize, "%s%s\t%s", name, VSuff(op), VN(vs, V_Single)); } void Dis_VrndX(MIPSOpcode op, uint32_t pc, char *out, size_t outSize) { diff --git a/pspautotests b/pspautotests index 4fc14891c7..011a777e66 160000 --- a/pspautotests +++ b/pspautotests @@ -1 +1 @@ -Subproject commit 4fc14891c752c95e221e08e94686ce917342c048 +Subproject commit 011a777e6623632ce7dca581782fb0f78cca94f8