Skip to content

PS2 games in the browser: static recompilation to WebAssembly with a native runtime

C++

A VIF reset keeps ROW and COL

Dusan Bako4a6de4402858
diff --git a/runtime/src/vif.cpp b/runtime/src/vif.cpp
index 7060071..38291ca 100644
--- a/runtime/src/vif.cpp
+++ b/runtime/src/vif.cpp
@@ -353,7 +353,12 @@ void write(int unit, std::uint32_t reg, std::uint32_t value) {
switch (reg) {
case 0x10:
if (value & 1u) {
- u = Unit{};
+ // A reset leaves the filling registers alone, as in PCSX2: Downhill
+ // Domination sets ROW once and resets the VIF before every frame.
+ Unit fresh{};
+ std::memcpy(fresh.row, u.row, sizeof fresh.row);
+ std::memcpy(fresh.col, u.col, sizeof fresh.col);
+ u = fresh;
}
if (value & 8u) {
u.stat &= ~0x3F00u;