diff --git a/pcsx2/BoothMultiplier.cpp b/pcsx2/BoothMultiplier.cpp deleted file mode 100644 index a008ae3cb7c4d..0000000000000 --- a/pcsx2/BoothMultiplier.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team -// SPDX-License-Identifier: GPL-3.0+ - -#include -#include -#include -#include -#include -#include "BoothMultiplier.h" - -BoothMultiplier::BoothRecode BoothMultiplier::Booth(uint32_t a, uint32_t b, uint32_t bit) -{ - uint32_t test = (bit ? b >> (bit * 2 - 1) : b << 1) & 7; - a <<= (bit * 2); - a += (test == 3 || test == 4) ? a : 0; - uint32_t neg = (test >= 4 && test <= 6) ? ~0u : 0; - uint32_t pos = 1 << (bit * 2); - a ^= (neg & -pos); - a &= (test >= 1 && test <= 6) ? ~0u : 0; - return {a, neg & pos}; -} - -BoothMultiplier::AddResult BoothMultiplier::Add3(uint32_t a, uint32_t b, uint32_t c) -{ - uint32_t u = a ^ b; - return {u ^ c, ((u & c) | (a & b)) << 1}; -} - -uint64_t BoothMultiplier::MulMantissa(uint32_t a, uint32_t b) -{ - uint64_t full = static_cast(a) * static_cast(b); - BoothRecode b0 = Booth(a, b, 0); - BoothRecode b1 = Booth(a, b, 1); - BoothRecode b2 = Booth(a, b, 2); - BoothRecode b3 = Booth(a, b, 3); - BoothRecode b4 = Booth(a, b, 4); - BoothRecode b5 = Booth(a, b, 5); - BoothRecode b6 = Booth(a, b, 6); - BoothRecode b7 = Booth(a, b, 7); - - // First cycle - AddResult t0 = Add3(b1.data, b2.data, b3.data); - AddResult t1 = Add3(b4.data & ~0x7ffu, b5.data & ~0xfffu, b6.data); - // A few adds get skipped, squeeze them back in - t1.hi |= b6.negate | (b5.data & 0x800); - b7.data |= (b5.data & 0x400) + b5.negate; - - // Second cycle - AddResult t2 = Add3(b0.data, t0.lo, t0.hi); - AddResult t3 = Add3(b7.data, t1.lo, t1.hi); - - // Third cycle - AddResult t4 = Add3(t2.hi, t3.lo, t3.hi); - - // Fourth cycle - AddResult t5 = Add3(t2.lo, t4.lo, t4.hi); - - // Discard bits and sum - t5.hi += b7.negate; - t5.lo &= ~0x7fffu; - t5.hi &= ~0x7fffu; - uint32_t ps2lo = t5.lo + t5.hi; - return full - ((ps2lo ^ full) & 0x8000); -} \ No newline at end of file diff --git a/pcsx2/BoothMultiplier.h b/pcsx2/BoothMultiplier.h deleted file mode 100644 index 17bb602a75309..0000000000000 --- a/pcsx2/BoothMultiplier.h +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team -// SPDX-License-Identifier: GPL-3.0+ - -#pragma once - -class BoothMultiplier -{ -public: - - static uint64_t MulMantissa(uint32_t a, uint32_t b); - -protected: - -private: - struct BoothRecode - { - uint32_t data; - uint32_t negate; - }; - - struct AddResult - { - uint32_t lo; - uint32_t hi; - }; - - static BoothRecode Booth(uint32_t a, uint32_t b, uint32_t bit); - - static AddResult Add3(uint32_t a, uint32_t b, uint32_t c); -}; \ No newline at end of file diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index 868fcbc7867c8..4e0a82db9e977 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -93,8 +93,7 @@ set(pcsx2Sources MTGS.cpp MTVU.cpp Patch.cpp - BoothMultiplier.cpp - Ps2Float.cpp + PS2Float.cpp Pcsx2Config.cpp PerformanceMetrics.cpp PrecompiledHeader.cpp @@ -175,8 +174,7 @@ set(pcsx2Headers MTVU.h Memory.h MemoryTypes.h - BoothMultiplier.h - Ps2Float.h + PS2Float.h Patch.h PerformanceMetrics.h PrecompiledHeader.h diff --git a/pcsx2/FPU.cpp b/pcsx2/FPU.cpp index 5eefc00c66888..bab1cd9bc199c 100644 --- a/pcsx2/FPU.cpp +++ b/pcsx2/FPU.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: GPL-3.0+ #include "Common.h" -#include "Ps2Float.h" +#include "PS2Float.h" #include // Helper Macros @@ -65,7 +65,7 @@ bool checkOverflow(u32& xReg, u32 cFlagsToSet) { if (CHECK_FPU_SOFT_ADDSUB || CHECK_FPU_SOFT_MULDIV || CHECK_FPU_SOFT_SQRT) { - if (xReg == Ps2Float::MAX_FLOATING_POINT_VALUE || xReg == Ps2Float::MIN_FLOATING_POINT_VALUE) + if (xReg == PS2Float::MAX_FLOATING_POINT_VALUE || xReg == PS2Float::MIN_FLOATING_POINT_VALUE) { _ContVal_ |= (cFlagsToSet); return true; @@ -94,7 +94,7 @@ bool checkUnderflow(u32& xReg, u32 cFlagsToSet) { if (CHECK_FPU_SOFT_ADDSUB || CHECK_FPU_SOFT_MULDIV || CHECK_FPU_SOFT_SQRT) { - if (Ps2Float(xReg).IsDenormalized()) + if (PS2Float(xReg).IsDenormalized()) { _ContVal_ |= (cFlagsToSet); return true; @@ -137,8 +137,8 @@ bool checkDivideByZero(u32& xReg, u32 yDivisorReg, u32 zDividendReg, u32 cFlagsT if (CHECK_FPU_SOFT_ADDSUB || CHECK_FPU_SOFT_MULDIV || CHECK_FPU_SOFT_SQRT) { - Ps2Float yMatrix = Ps2Float(yDivisorReg); - Ps2Float zMatrix = Ps2Float(zDividendReg); + PS2Float yMatrix = PS2Float(yDivisorReg); + PS2Float zMatrix = PS2Float(zDividendReg); if (yMatrix.IsZero()) { @@ -149,10 +149,10 @@ bool checkDivideByZero(u32& xReg, u32 yDivisorReg, u32 zDividendReg, u32 cFlagsT bool IsSigned = yMatrix.Sign ^ zMatrix.Sign; if (dividendZero) - xReg = IsSigned ? Ps2Float::MIN_FLOATING_POINT_VALUE : Ps2Float::MAX_FLOATING_POINT_VALUE; + xReg = IsSigned ? PS2Float::MIN_FLOATING_POINT_VALUE : PS2Float::MAX_FLOATING_POINT_VALUE; else { - Ps2Float zeroRes = Ps2Float(0); + PS2Float zeroRes = PS2Float(0); zeroRes.Sign = IsSigned; xReg = zeroRes.AsUInt32(); @@ -219,14 +219,14 @@ float fpuDouble(u32 f) } } -static __fi uint32_t fpuAccurateAddSub(u32 a, u32 b, bool issub) +static __fi u32 fpuAccurateAddSub(u32 a, u32 b, bool issub) { if (CHECK_FPU_SOFT_ADDSUB) { if (issub) - return Ps2Float(a).Sub(Ps2Float(b)).AsUInt32(); + return PS2Float(a).Sub(PS2Float(b)).AsUInt32(); else - return Ps2Float(a).Add(Ps2Float(b)).AsUInt32(); + return PS2Float(a).Add(PS2Float(b)).AsUInt32(); } if (issub) @@ -235,14 +235,14 @@ static __fi uint32_t fpuAccurateAddSub(u32 a, u32 b, bool issub) return std::bit_cast(fpuDouble(a) + fpuDouble(b)); } -static __fi uint32_t fpuAccurateMulDiv(u32 a, u32 b, bool isdiv) +static __fi u32 fpuAccurateMulDiv(u32 a, u32 b, bool isdiv) { if (CHECK_FPU_SOFT_MULDIV) { if (isdiv) - return Ps2Float(a).Div(Ps2Float(b)).AsUInt32(); + return PS2Float(a).Div(PS2Float(b)).AsUInt32(); else - return Ps2Float(a).Mul(Ps2Float(b)).AsUInt32(); + return PS2Float(a).Mul(PS2Float(b)).AsUInt32(); } if (isdiv) @@ -267,7 +267,7 @@ static __fi void C_cond_S(uint8_t mode) case 0: // == if (CHECK_FPU_SOFT_ADDSUB || CHECK_FPU_SOFT_MULDIV || CHECK_FPU_SOFT_SQRT) { - _ContVal_ = (Ps2Float(_FsValUl_).CompareTo(Ps2Float(_FtValUl_)) == 0) ? (_ContVal_ | FPUflagC) : (_ContVal_ & ~FPUflagC); + _ContVal_ = (PS2Float(_FsValUl_).CompareTo(PS2Float(_FtValUl_)) == 0) ? (_ContVal_ | FPUflagC) : (_ContVal_ & ~FPUflagC); } else { @@ -277,7 +277,7 @@ static __fi void C_cond_S(uint8_t mode) case 1: // <= if (CHECK_FPU_SOFT_ADDSUB || CHECK_FPU_SOFT_MULDIV || CHECK_FPU_SOFT_SQRT) { - int32_t cmpResult = Ps2Float(_FsValUl_).CompareTo(Ps2Float(_FtValUl_)); + int32_t cmpResult = PS2Float(_FsValUl_).CompareTo(PS2Float(_FtValUl_)); _ContVal_ = (cmpResult == 0 || cmpResult == -1) ? (_ContVal_ | FPUflagC) : (_ContVal_ & ~FPUflagC); } else @@ -288,7 +288,7 @@ static __fi void C_cond_S(uint8_t mode) case 2: // < if (CHECK_FPU_SOFT_ADDSUB || CHECK_FPU_SOFT_MULDIV || CHECK_FPU_SOFT_SQRT) { - _ContVal_ = (Ps2Float(_FsValUl_).CompareTo(Ps2Float(_FtValUl_)) == -1) ? (_ContVal_ | FPUflagC) : (_ContVal_ & ~FPUflagC); + _ContVal_ = (PS2Float(_FsValUl_).CompareTo(PS2Float(_FtValUl_)) == -1) ? (_ContVal_ | FPUflagC) : (_ContVal_ & ~FPUflagC); } else { @@ -371,7 +371,7 @@ void CVT_S() { void CVT_W() { if (CHECK_FPU_SOFT_ADDSUB || CHECK_FPU_SOFT_MULDIV || CHECK_FPU_SOFT_SQRT) { - _FdValSl_ = double_to_int(Ps2Float(_FsValUl_).ToDouble()); + _FdValSl_ = double_to_int(PS2Float(_FsValUl_).ToDouble()); } else { @@ -479,22 +479,22 @@ void RSQRT_S() { if (CHECK_FPU_SOFT_SQRT) { - Ps2Float value = Ps2Float(_FtValUl_); + PS2Float value = PS2Float(_FtValUl_); if (value.IsDenormalized()) { _ContVal_ |= FPUflagD | FPUflagSD; - _FdValUl_ = value.Sign ? Ps2Float::MIN_FLOATING_POINT_VALUE : Ps2Float::MAX_FLOATING_POINT_VALUE; + _FdValUl_ = value.Sign ? PS2Float::MIN_FLOATING_POINT_VALUE : PS2Float::MAX_FLOATING_POINT_VALUE; return; } else if (_FtValUl_ & 0x80000000) { // Ft is negative _ContVal_ |= FPUflagI | FPUflagSI; - _FdValUl_ = Ps2Float(_FsValUl_).Rsqrt(Ps2Float(value.Abs())).AsUInt32(); + _FdValUl_ = PS2Float(_FsValUl_).Rsqrt(PS2Float(value.Abs())).AsUInt32(); } else { - _FdValUl_ = Ps2Float(_FsValUl_).Rsqrt(value).AsUInt32(); + _FdValUl_ = PS2Float(_FsValUl_).Rsqrt(value).AsUInt32(); } // Ft is positive and not zero } else @@ -526,12 +526,12 @@ void SQRT_S() { if (CHECK_FPU_SOFT_SQRT) { - Ps2Float value = Ps2Float(_FtValUl_); + PS2Float value = PS2Float(_FtValUl_); if (_FtValUl_ & 0x80000000) { // If Ft is Negative _ContVal_ |= FPUflagI | FPUflagSI; - _FdValUl_ = Ps2Float(value.Abs()).Sqrt().AsUInt32(); + _FdValUl_ = PS2Float(value.Abs()).Sqrt().AsUInt32(); } else _FdValUl_ = value.Sqrt().AsUInt32(); // If Ft is Positive diff --git a/pcsx2/Ps2Float.cpp b/pcsx2/Ps2Float.cpp index 354622e403ac8..9ffc2d11d5b54 100644 --- a/pcsx2/Ps2Float.cpp +++ b/pcsx2/Ps2Float.cpp @@ -8,64 +8,126 @@ #include #include #include -#include "Ps2Float.h" -#include "BoothMultiplier.h" +#include "PS2Float.h" #include "Common.h" -const uint8_t Ps2Float::BIAS = 127; -const uint32_t Ps2Float::SIGNMASK = 0x80000000; -const uint32_t Ps2Float::MAX_FLOATING_POINT_VALUE = 0x7FFFFFFF; -const uint32_t Ps2Float::MIN_FLOATING_POINT_VALUE = 0xFFFFFFFF; -const uint32_t Ps2Float::POSITIVE_INFINITY_VALUE = 0x7F800000; -const uint32_t Ps2Float::NEGATIVE_INFINITY_VALUE = 0xFF800000; -const uint32_t Ps2Float::ONE = 0x3F800000; -const uint32_t Ps2Float::MIN_ONE = 0xBF800000; -const int32_t Ps2Float::IMPLICIT_LEADING_BIT_POS = 23; - -Ps2Float::Ps2Float(uint32_t value) +const u8 PS2Float::BIAS = 127; +const u32 PS2Float::SIGNMASK = 0x80000000; +const u32 PS2Float::MAX_FLOATING_POINT_VALUE = 0x7FFFFFFF; +const u32 PS2Float::MIN_FLOATING_POINT_VALUE = 0xFFFFFFFF; +const u32 PS2Float::POSITIVE_INFINITY_VALUE = 0x7F800000; +const u32 PS2Float::NEGATIVE_INFINITY_VALUE = 0xFF800000; +const u32 PS2Float::ONE = 0x3F800000; +const u32 PS2Float::MIN_ONE = 0xBF800000; +const s32 PS2Float::IMPLICIT_LEADING_BIT_POS = 23; + +//**************************************************************** +// Booth Multiplier +//**************************************************************** + +PS2Float::BoothRecode PS2Float::Booth(u32 a, u32 b, u32 bit) +{ + u32 test = (bit ? b >> (bit * 2 - 1) : b << 1) & 7; + a <<= (bit * 2); + a += (test == 3 || test == 4) ? a : 0; + u32 neg = (test >= 4 && test <= 6) ? ~0u : 0; + u32 pos = 1 << (bit * 2); + a ^= (neg & -pos); + a &= (test >= 1 && test <= 6) ? ~0u : 0; + return {a, neg & pos}; +} + +PS2Float::AddResult PS2Float::Add3(u32 a, u32 b, u32 c) +{ + u32 u = a ^ b; + return {u ^ c, ((u & c) | (a & b)) << 1}; +} + +u64 PS2Float::MulMantissa(u32 a, u32 b) +{ + u64 full = static_cast(a) * static_cast(b); + BoothRecode b0 = Booth(a, b, 0); + BoothRecode b1 = Booth(a, b, 1); + BoothRecode b2 = Booth(a, b, 2); + BoothRecode b3 = Booth(a, b, 3); + BoothRecode b4 = Booth(a, b, 4); + BoothRecode b5 = Booth(a, b, 5); + BoothRecode b6 = Booth(a, b, 6); + BoothRecode b7 = Booth(a, b, 7); + + // First cycle + AddResult t0 = Add3(b1.data, b2.data, b3.data); + AddResult t1 = Add3(b4.data & ~0x7ffu, b5.data & ~0xfffu, b6.data); + // A few adds get skipped, squeeze them back in + t1.hi |= b6.negate | (b5.data & 0x800); + b7.data |= (b5.data & 0x400) + b5.negate; + + // Second cycle + AddResult t2 = Add3(b0.data, t0.lo, t0.hi); + AddResult t3 = Add3(b7.data, t1.lo, t1.hi); + + // Third cycle + AddResult t4 = Add3(t2.hi, t3.lo, t3.hi); + + // Fourth cycle + AddResult t5 = Add3(t2.lo, t4.lo, t4.hi); + + // Discard bits and sum + t5.hi += b7.negate; + t5.lo &= ~0x7fffu; + t5.hi &= ~0x7fffu; + u32 ps2lo = t5.lo + t5.hi; + return full - ((ps2lo ^ full) & 0x8000); +} + +//**************************************************************** +// Float Processor +//**************************************************************** + +PS2Float::PS2Float(u32 value) : Sign((value >> 31) & 1) - , Exponent((uint8_t)(((value >> 23) & 0xFF))) + , Exponent((u8)(((value >> 23) & 0xFF))) , Mantissa(value & 0x7FFFFF) { } -Ps2Float::Ps2Float(bool sign, uint8_t exponent, uint32_t mantissa) +PS2Float::PS2Float(bool sign, u8 exponent, u32 mantissa) : Sign(sign) , Exponent(exponent) , Mantissa(mantissa) { } -Ps2Float Ps2Float::Max() +PS2Float PS2Float::Max() { - return Ps2Float(MAX_FLOATING_POINT_VALUE); + return PS2Float(MAX_FLOATING_POINT_VALUE); } -Ps2Float Ps2Float::Min() +PS2Float PS2Float::Min() { - return Ps2Float(MIN_FLOATING_POINT_VALUE); + return PS2Float(MIN_FLOATING_POINT_VALUE); } -Ps2Float Ps2Float::One() +PS2Float PS2Float::One() { - return Ps2Float(ONE); + return PS2Float(ONE); } -Ps2Float Ps2Float::MinOne() +PS2Float PS2Float::MinOne() { - return Ps2Float(MIN_ONE); + return PS2Float(MIN_ONE); } -uint32_t Ps2Float::AsUInt32() const +u32 PS2Float::AsUInt32() const { - uint32_t result = 0; + u32 result = 0; result |= (Sign ? 1u : 0u) << 31; - result |= (uint32_t)(Exponent << 23); + result |= (u32)(Exponent << 23); result |= Mantissa; return result; } -Ps2Float Ps2Float::Add(Ps2Float addend) +PS2Float PS2Float::Add(PS2Float addend) { if (IsDenormalized() || addend.IsDenormalized()) return SolveAddSubDenormalizedOperation(*this, addend, true); @@ -73,9 +135,8 @@ Ps2Float Ps2Float::Add(Ps2Float addend) if (IsAbnormal() && addend.IsAbnormal()) return SolveAbnormalAdditionOrSubtractionOperation(*this, addend, true); - uint32_t a = AsUInt32(); - uint32_t b = addend.AsUInt32(); - int32_t temp = 0; + u32 a = AsUInt32(); + u32 b = addend.AsUInt32(); //exponent difference int exp_diff = ((a >> 23) & 0xFF) - ((b >> 23) & 0xFF); @@ -90,8 +151,7 @@ Ps2Float Ps2Float::Add(Ps2Float addend) else if (exp_diff > 0) { exp_diff = exp_diff - 1; - temp = MIN_FLOATING_POINT_VALUE << exp_diff; - b = temp & b; + b = (MIN_FLOATING_POINT_VALUE << exp_diff) & b; } //diff = -255 .. -25, expd < expt @@ -105,14 +165,13 @@ Ps2Float Ps2Float::Add(Ps2Float addend) { exp_diff = -exp_diff; exp_diff = exp_diff - 1; - temp = MIN_FLOATING_POINT_VALUE << exp_diff; - a = a & temp; + a = a & (MIN_FLOATING_POINT_VALUE << exp_diff); } - return Ps2Float(a).DoAdd(Ps2Float(b)); + return PS2Float(a).DoAdd(PS2Float(b)); } -Ps2Float Ps2Float::Sub(Ps2Float subtrahend) +PS2Float PS2Float::Sub(PS2Float subtrahend) { if (IsDenormalized() || subtrahend.IsDenormalized()) return SolveAddSubDenormalizedOperation(*this, subtrahend, false); @@ -120,9 +179,8 @@ Ps2Float Ps2Float::Sub(Ps2Float subtrahend) if (IsAbnormal() && subtrahend.IsAbnormal()) return SolveAbnormalAdditionOrSubtractionOperation(*this, subtrahend, false); - uint32_t a = AsUInt32(); - uint32_t b = subtrahend.AsUInt32(); - int32_t temp = 0; + u32 a = AsUInt32(); + u32 b = subtrahend.AsUInt32(); //exponent difference int exp_diff = ((a >> 23) & 0xFF) - ((b >> 23) & 0xFF); @@ -137,8 +195,7 @@ Ps2Float Ps2Float::Sub(Ps2Float subtrahend) else if (exp_diff > 0) { exp_diff = exp_diff - 1; - temp = MIN_FLOATING_POINT_VALUE << exp_diff; - b = temp & b; + b = (MIN_FLOATING_POINT_VALUE << exp_diff) & b; } //diff = -255 .. -25, expd < expt @@ -152,15 +209,14 @@ Ps2Float Ps2Float::Sub(Ps2Float subtrahend) { exp_diff = -exp_diff; exp_diff = exp_diff - 1; - temp = MIN_FLOATING_POINT_VALUE << exp_diff; - a = a & temp; + a = a & (MIN_FLOATING_POINT_VALUE << exp_diff); } - return Ps2Float(a).DoAdd(Neg(Ps2Float(b))); + return PS2Float(a).DoAdd(Neg(PS2Float(b))); } -Ps2Float Ps2Float::Mul(Ps2Float mulend) +PS2Float PS2Float::Mul(PS2Float mulend) { if (IsDenormalized() || mulend.IsDenormalized()) return SolveMultiplicationDenormalizedOperation(*this, mulend); @@ -170,7 +226,7 @@ Ps2Float Ps2Float::Mul(Ps2Float mulend) if (IsZero() || mulend.IsZero()) { - Ps2Float result = Ps2Float(0); + PS2Float result = PS2Float(0); result.Sign = DetermineMultiplicationDivisionOperationSign(*this, mulend); return result; @@ -179,7 +235,7 @@ Ps2Float Ps2Float::Mul(Ps2Float mulend) return DoMul(mulend); } -Ps2Float Ps2Float::Div(Ps2Float divend) +PS2Float PS2Float::Div(PS2Float divend) { if (IsDenormalized() || divend.IsDenormalized()) return SolveDivisionDenormalizedOperation(*this, divend); @@ -189,7 +245,7 @@ Ps2Float Ps2Float::Div(Ps2Float divend) if (IsZero()) { - Ps2Float result = Ps2Float(0); + PS2Float result = PS2Float(0); result.Sign = DetermineMultiplicationDivisionOperationSign(*this, divend); return result; @@ -200,21 +256,22 @@ Ps2Float Ps2Float::Div(Ps2Float divend) return DoDiv(divend); } -Ps2Float Ps2Float::Sqrt() +// Rounding can be slightly off: (PS2: rsqrt(0x7FFFFFF0) -> 0x5FB504ED | SoftFloat/IEEE754 rsqrt(0x7FFFFFF0) -> 0x5FB504EE). +PS2Float PS2Float::Sqrt() { - int32_t t; - int32_t s = 0; - int32_t q = 0; - uint32_t r = 0x01000000; /* r = moving bit from right to left */ + s32 t; + s32 s = 0; + s32 q = 0; + u32 r = 0x01000000; /* r = moving bit from right to left */ if (IsDenormalized()) - return Ps2Float(0); + return PS2Float(0); // PS2 only takes positive numbers for SQRT, and convert if necessary. - int32_t ix = (int32_t)(Ps2Float(false, Exponent, Mantissa).AsUInt32()); + s32 ix = (s32)(PS2Float(false, Exponent, Mantissa).AsUInt32()); /* extract mantissa and unbias exponent */ - int32_t m = (ix >> 23) - BIAS; + s32 m = (ix >> 23) - BIAS; ix = (ix & 0x007FFFFF) | 0x00800000; if ((m & 1) == 1) @@ -230,12 +287,12 @@ Ps2Float Ps2Float::Sqrt() while (r != 0) { - t = s + (int32_t)(r); + t = s + (s32)(r); if (t <= ix) { - s = t + (int32_t)(r); + s = t + (s32)(r); ix -= t; - q += (int32_t)(r); + q += (s32)(r); } ix += ix; @@ -251,48 +308,48 @@ Ps2Float Ps2Float::Sqrt() ix = (q >> 1) + 0x3F000000; ix += m << 23; - return Ps2Float((uint32_t)(ix)); + return PS2Float((u32)(ix)); } -Ps2Float Ps2Float::Rsqrt(Ps2Float other) +PS2Float PS2Float::Rsqrt(PS2Float other) { return Div(other.Sqrt()); } -bool Ps2Float::IsDenormalized() +bool PS2Float::IsDenormalized() { return Exponent == 0; } -bool Ps2Float::IsAbnormal() +bool PS2Float::IsAbnormal() { - uint32_t val = AsUInt32(); + u32 val = AsUInt32(); return val == MAX_FLOATING_POINT_VALUE || val == MIN_FLOATING_POINT_VALUE || val == POSITIVE_INFINITY_VALUE || val == NEGATIVE_INFINITY_VALUE; } -bool Ps2Float::IsZero() +bool PS2Float::IsZero() { return (Abs()) == 0; } -uint32_t Ps2Float::Abs() +u32 PS2Float::Abs() { return (AsUInt32() & MAX_FLOATING_POINT_VALUE); } -Ps2Float Ps2Float::RoundTowardsZero() +PS2Float PS2Float::RoundTowardsZero() { - return Ps2Float((uint32_t)(std::trunc((double)(AsUInt32())))); + return PS2Float((u32)(std::trunc((double)(AsUInt32())))); } -int32_t Ps2Float::CompareTo(Ps2Float other) +s32 PS2Float::CompareTo(PS2Float other) { - int32_t selfTwoComplementVal = (int32_t)(Abs()); + s32 selfTwoComplementVal = (s32)(Abs()); if (Sign) selfTwoComplementVal = -selfTwoComplementVal; - int32_t otherTwoComplementVal = (int32_t)(other.Abs()); + s32 otherTwoComplementVal = (s32)(other.Abs()); if (other.Sign) otherTwoComplementVal = -otherTwoComplementVal; @@ -304,10 +361,10 @@ int32_t Ps2Float::CompareTo(Ps2Float other) return 1; } -int32_t Ps2Float::CompareOperand(Ps2Float other) +s32 PS2Float::CompareOperand(PS2Float other) { - int32_t selfTwoComplementVal = (int32_t)(Abs()); - int32_t otherTwoComplementVal = (int32_t)(other.Abs()); + s32 selfTwoComplementVal = (s32)(Abs()); + s32 otherTwoComplementVal = (s32)(other.Abs()); if (selfTwoComplementVal < otherTwoComplementVal) return -1; @@ -317,16 +374,16 @@ int32_t Ps2Float::CompareOperand(Ps2Float other) return 1; } -double Ps2Float::ToDouble() +double PS2Float::ToDouble() { return std::bit_cast(((u64)Sign << 63) | ((((u64)Exponent - BIAS) + 1023ULL) << 52) | ((u64)Mantissa << 29)); } -std::string Ps2Float::ToString() +std::string PS2Float::ToString() { double res = ToDouble(); - uint32_t value = AsUInt32(); + u32 value = AsUInt32(); std::ostringstream oss; oss << std::fixed << std::setprecision(6); @@ -358,12 +415,12 @@ std::string Ps2Float::ToString() return oss.str(); } -Ps2Float Ps2Float::DoAdd(Ps2Float other) +PS2Float PS2Float::DoAdd(PS2Float other) { - const uint8_t roundingMultiplier = 6; + const u8 roundingMultiplier = 6; - uint8_t selfExponent = Exponent; - int32_t resExponent = selfExponent - other.Exponent; + u8 selfExponent = Exponent; + s32 resExponent = selfExponent - other.Exponent; if (resExponent < 0) return other.DoAdd(*this); @@ -371,46 +428,46 @@ Ps2Float Ps2Float::DoAdd(Ps2Float other) return *this; // http://graphics.stanford.edu/~seander/bithacks.html#ConditionalNegate - uint32_t sign1 = (uint32_t)((int32_t)AsUInt32() >> 31); - int32_t selfMantissa = (int32_t)(((Mantissa | 0x800000) ^ sign1) - sign1); - uint32_t sign2 = (uint32_t)((int32_t)other.AsUInt32() >> 31); - int32_t otherMantissa = (int32_t)(((other.Mantissa | 0x800000) ^ sign2) - sign2); + u32 sign1 = (u32)((s32)AsUInt32() >> 31); + s32 selfMantissa = (s32)(((Mantissa | 0x800000) ^ sign1) - sign1); + u32 sign2 = (u32)((s32)other.AsUInt32() >> 31); + s32 otherMantissa = (s32)(((other.Mantissa | 0x800000) ^ sign2) - sign2); // PS2 multiply by 2 before doing the Math here. - int32_t man = (selfMantissa << roundingMultiplier) + ((otherMantissa << roundingMultiplier) >> resExponent); - int32_t absMan = abs(man); + s32 man = (selfMantissa << roundingMultiplier) + ((otherMantissa << roundingMultiplier) >> resExponent); + s32 absMan = abs(man); if (absMan == 0) - return Ps2Float(0); + return PS2Float(0); // Remove from exponent the PS2 Multiplier value. - int32_t rawExp = selfExponent - roundingMultiplier; + s32 rawExp = selfExponent - roundingMultiplier; - int32_t amount = normalizeAmounts[clz(absMan)]; + s32 amount = normalizeAmounts[clz(absMan)]; rawExp -= amount; absMan <<= amount; - int32_t msbIndex = BitScanReverse8(absMan >> 23); + s32 msbIndex = BitScanReverse8(absMan >> 23); rawExp += msbIndex; absMan >>= msbIndex; if (rawExp > 255) return man < 0 ? Min() : Max(); else if (rawExp <= 0) - return Ps2Float(man < 0, 0, 0); + return PS2Float(man < 0, 0, 0); - return Ps2Float((uint32_t)man & SIGNMASK | (uint32_t)rawExp << 23 | ((uint32_t)absMan & 0x7FFFFF)); + return PS2Float(((u32)man & SIGNMASK) | (u32)rawExp << 23 | ((u32)absMan & 0x7FFFFF)); } -Ps2Float Ps2Float::DoMul(Ps2Float other) +PS2Float PS2Float::DoMul(PS2Float other) { - uint8_t selfExponent = Exponent; - uint8_t otherExponent = other.Exponent; - uint32_t selfMantissa = Mantissa | 0x800000; - uint32_t otherMantissa = other.Mantissa | 0x800000; - uint32_t sign = (AsUInt32() ^ other.AsUInt32()) & SIGNMASK; + u8 selfExponent = Exponent; + u8 otherExponent = other.Exponent; + u32 selfMantissa = Mantissa | 0x800000; + u32 otherMantissa = other.Mantissa | 0x800000; + u32 sign = (AsUInt32() ^ other.AsUInt32()) & SIGNMASK; - int32_t resExponent = selfExponent + otherExponent - 127; - uint32_t resMantissa = (uint32_t)(BoothMultiplier::MulMantissa(selfMantissa, otherMantissa) >> 23); + s32 resExponent = selfExponent + otherExponent - 127; + u32 resMantissa = (u32)(MulMantissa(selfMantissa, otherMantissa) >> 23); if (resMantissa > 0xFFFFFF) { @@ -419,51 +476,52 @@ Ps2Float Ps2Float::DoMul(Ps2Float other) } if (resExponent > 255) - return Ps2Float(sign | MAX_FLOATING_POINT_VALUE); + return PS2Float(sign | MAX_FLOATING_POINT_VALUE); else if (resExponent <= 0) - return Ps2Float(sign); + return PS2Float(sign); - return Ps2Float(sign | (uint32_t)(resExponent << 23) | (resMantissa & 0x7FFFFF)); + return PS2Float(sign | (u32)(resExponent << 23) | (resMantissa & 0x7FFFFF)); } -Ps2Float Ps2Float::DoDiv(Ps2Float other) +// Rounding can be slightly off: (PS2: 0x3F800000 / 0x3F800001 = 0x3F7FFFFF | SoftFloat/IEEE754: 0x3F800000 / 0x3F800001 = 0x3F7FFFFE). +PS2Float PS2Float::DoDiv(PS2Float other) { - uint64_t selfMantissa64; - uint32_t selfMantissa = Mantissa | 0x800000; - uint32_t otherMantissa = other.Mantissa | 0x800000; - int resExponent = Exponent - other.Exponent + BIAS; + u64 selfMantissa64; + u32 selfMantissa = Mantissa | 0x800000; + u32 otherMantissa = other.Mantissa | 0x800000; + s32 resExponent = Exponent - other.Exponent + BIAS; - Ps2Float result = Ps2Float(0); + PS2Float result = PS2Float(0); result.Sign = DetermineMultiplicationDivisionOperationSign(*this, other); if (resExponent > 255) return result.Sign ? Min() : Max(); else if (resExponent <= 0) - return Ps2Float(result.Sign, 0, 0); + return PS2Float(result.Sign, 0, 0); if (selfMantissa < otherMantissa) { --resExponent; if (resExponent == 0) - return Ps2Float(result.Sign, 0, 0); - selfMantissa64 = (uint64_t)(selfMantissa) << 31; + return PS2Float(result.Sign, 0, 0); + selfMantissa64 = (u64)(selfMantissa) << 31; } else { - selfMantissa64 = (uint64_t)(selfMantissa) << 30; + selfMantissa64 = (u64)(selfMantissa) << 30; } - uint32_t resMantissa = (uint32_t)(selfMantissa64 / otherMantissa); + u32 resMantissa = (u32)(selfMantissa64 / otherMantissa); if ((resMantissa & 0x3F) == 0) - resMantissa |= ((uint64_t)(otherMantissa)*resMantissa != selfMantissa64) ? 1U : 0; + resMantissa |= ((u64)(otherMantissa)*resMantissa != selfMantissa64) ? 1U : 0; - result.Exponent = (uint8_t)(resExponent); + result.Exponent = (u8)(resExponent); result.Mantissa = (resMantissa + 0x39U /* Non-standard value, 40U in IEEE754 (PS2: rsqrt(0x40400000, 0x40400000) = 0x3FDDB3D7 -> IEEE754: rsqrt(0x40400000, 0x40400000) = 0x3FDDB3D8 */) >> 7; if (result.Mantissa > 0) { - int32_t leadingBitPosition = Ps2Float::GetMostSignificantBitPosition(result.Mantissa); + s32 leadingBitPosition = PS2Float::GetMostSignificantBitPosition(result.Mantissa); while (leadingBitPosition != IMPLICIT_LEADING_BIT_POS) { @@ -471,12 +529,12 @@ Ps2Float Ps2Float::DoDiv(Ps2Float other) { result.Mantissa >>= 1; - int32_t exp = ((int32_t)result.Exponent + 1); + s32 exp = ((s32)result.Exponent + 1); if (exp > 255) return result.Sign ? Min() : Max(); - result.Exponent = (uint8_t)exp; + result.Exponent = (u8)exp; leadingBitPosition--; } @@ -484,12 +542,12 @@ Ps2Float Ps2Float::DoDiv(Ps2Float other) { result.Mantissa <<= 1; - int32_t exp = ((int32_t)result.Exponent - 1); + s32 exp = ((s32)result.Exponent - 1); if (exp <= 0) - return Ps2Float(result.Sign, 0, 0); + return PS2Float(result.Sign, 0, 0); - result.Exponent = (uint8_t)exp; + result.Exponent = (u8)exp; leadingBitPosition++; } @@ -500,66 +558,68 @@ Ps2Float Ps2Float::DoDiv(Ps2Float other) return result.RoundTowardsZero(); } -Ps2Float Ps2Float::SolveAbnormalAdditionOrSubtractionOperation(Ps2Float a, Ps2Float b, bool add) +PS2Float PS2Float::SolveAbnormalAdditionOrSubtractionOperation(PS2Float a, PS2Float b, bool add) { - uint32_t aval = a.AsUInt32(); - uint32_t bval = b.AsUInt32(); + u32 aval = a.AsUInt32(); + u32 bval = b.AsUInt32(); if (aval == MAX_FLOATING_POINT_VALUE && bval == MAX_FLOATING_POINT_VALUE) - return add ? Max() : Ps2Float(0); + return add ? Max() : PS2Float(0); if (aval == MIN_FLOATING_POINT_VALUE && bval == MIN_FLOATING_POINT_VALUE) - return add ? Min() : Ps2Float(0); + return add ? Min() : PS2Float(0); if (aval == MIN_FLOATING_POINT_VALUE && bval == MAX_FLOATING_POINT_VALUE) - return add ? Ps2Float(0) : Min(); + return add ? PS2Float(0) : Min(); if (aval == MAX_FLOATING_POINT_VALUE && bval == MIN_FLOATING_POINT_VALUE) - return add ? Ps2Float(0) : Max(); + return add ? PS2Float(0) : Max(); if (aval == POSITIVE_INFINITY_VALUE && bval == POSITIVE_INFINITY_VALUE) - return add ? Max() : Ps2Float(0); + return add ? Max() : PS2Float(0); if (aval == NEGATIVE_INFINITY_VALUE && bval == POSITIVE_INFINITY_VALUE) - return add ? Ps2Float(0) : Min(); + return add ? PS2Float(0) : Min(); if (aval == POSITIVE_INFINITY_VALUE && bval == NEGATIVE_INFINITY_VALUE) - return add ? Ps2Float(0) : Max(); + return add ? PS2Float(0) : Max(); if (aval == NEGATIVE_INFINITY_VALUE && bval == NEGATIVE_INFINITY_VALUE) - return add ? Min() : Ps2Float(0); + return add ? Min() : PS2Float(0); if (aval == MAX_FLOATING_POINT_VALUE && bval == POSITIVE_INFINITY_VALUE) - return add ? Max() : Ps2Float(0x7F7FFFFE); + return add ? Max() : PS2Float(0x7F7FFFFE); if (aval == MAX_FLOATING_POINT_VALUE && bval == NEGATIVE_INFINITY_VALUE) - return add ? Ps2Float(0x7F7FFFFE) : Max(); + return add ? PS2Float(0x7F7FFFFE) : Max(); if (aval == MIN_FLOATING_POINT_VALUE && bval == POSITIVE_INFINITY_VALUE) - return add ? Ps2Float(0xFF7FFFFE) : Min(); + return add ? PS2Float(0xFF7FFFFE) : Min(); if (aval == MIN_FLOATING_POINT_VALUE && bval == NEGATIVE_INFINITY_VALUE) - return add ? Min() : Ps2Float(0xFF7FFFFE); + return add ? Min() : PS2Float(0xFF7FFFFE); if (aval == POSITIVE_INFINITY_VALUE && bval == MAX_FLOATING_POINT_VALUE) - return add ? Max() : Ps2Float(0xFF7FFFFE); + return add ? Max() : PS2Float(0xFF7FFFFE); if (aval == POSITIVE_INFINITY_VALUE && bval == MIN_FLOATING_POINT_VALUE) - return add ? Ps2Float(0xFF7FFFFE) : Max(); + return add ? PS2Float(0xFF7FFFFE) : Max(); if (aval == NEGATIVE_INFINITY_VALUE && bval == MAX_FLOATING_POINT_VALUE) - return add ? Ps2Float(0x7F7FFFFE) : Min(); + return add ? PS2Float(0x7F7FFFFE) : Min(); if (aval == NEGATIVE_INFINITY_VALUE && bval == MIN_FLOATING_POINT_VALUE) - return add ? Min() : Ps2Float(0x7F7FFFFE); + return add ? Min() : PS2Float(0x7F7FFFFE); Console.Error("Unhandled abnormal add/sub floating point operation"); + + return PS2Float(0); } -Ps2Float Ps2Float::SolveAbnormalMultiplicationOrDivisionOperation(Ps2Float a, Ps2Float b, bool mul) +PS2Float PS2Float::SolveAbnormalMultiplicationOrDivisionOperation(PS2Float a, PS2Float b, bool mul) { - uint32_t aval = a.AsUInt32(); - uint32_t bval = b.AsUInt32(); + u32 aval = a.AsUInt32(); + u32 bval = b.AsUInt32(); if (mul) { @@ -630,36 +690,38 @@ Ps2Float Ps2Float::SolveAbnormalMultiplicationOrDivisionOperation(Ps2Float a, Ps return One(); if (aval == MAX_FLOATING_POINT_VALUE && bval == POSITIVE_INFINITY_VALUE) - return Ps2Float(0x3FFFFFFF); + return PS2Float(0x3FFFFFFF); if (aval == MAX_FLOATING_POINT_VALUE && bval == NEGATIVE_INFINITY_VALUE) - return Ps2Float(0xBFFFFFFF); + return PS2Float(0xBFFFFFFF); if (aval == MIN_FLOATING_POINT_VALUE && bval == POSITIVE_INFINITY_VALUE) - return Ps2Float(0xBFFFFFFF); + return PS2Float(0xBFFFFFFF); if (aval == MIN_FLOATING_POINT_VALUE && bval == NEGATIVE_INFINITY_VALUE) - return Ps2Float(0x3FFFFFFF); + return PS2Float(0x3FFFFFFF); if (aval == POSITIVE_INFINITY_VALUE && bval == MAX_FLOATING_POINT_VALUE) - return Ps2Float(0x3F000001); + return PS2Float(0x3F000001); if (aval == POSITIVE_INFINITY_VALUE && bval == MIN_FLOATING_POINT_VALUE) - return Ps2Float(0xBF000001); + return PS2Float(0xBF000001); if (aval == NEGATIVE_INFINITY_VALUE && bval == MAX_FLOATING_POINT_VALUE) - return Ps2Float(0xBF000001); + return PS2Float(0xBF000001); if (aval == NEGATIVE_INFINITY_VALUE && bval == MIN_FLOATING_POINT_VALUE) - return Ps2Float(0x3F000001); + return PS2Float(0x3F000001); } Console.Error("Unhandled abnormal mul/div floating point operation"); + + return PS2Float(0); } -Ps2Float Ps2Float::SolveAddSubDenormalizedOperation(Ps2Float a, Ps2Float b, bool add) +PS2Float PS2Float::SolveAddSubDenormalizedOperation(PS2Float a, PS2Float b, bool add) { - Ps2Float result = Ps2Float(0); + PS2Float result = PS2Float(0); if (a.IsDenormalized() && !b.IsDenormalized()) result = b; @@ -675,18 +737,18 @@ Ps2Float Ps2Float::SolveAddSubDenormalizedOperation(Ps2Float a, Ps2Float b, bool return result; } -Ps2Float Ps2Float::SolveMultiplicationDenormalizedOperation(Ps2Float a, Ps2Float b) +PS2Float PS2Float::SolveMultiplicationDenormalizedOperation(PS2Float a, PS2Float b) { - Ps2Float result = Ps2Float(0); + PS2Float result = PS2Float(0); result.Sign = DetermineMultiplicationDivisionOperationSign(a, b); return result; } -Ps2Float Ps2Float::SolveDivisionDenormalizedOperation(Ps2Float a, Ps2Float b) +PS2Float PS2Float::SolveDivisionDenormalizedOperation(PS2Float a, PS2Float b) { bool sign = DetermineMultiplicationDivisionOperationSign(a, b); - Ps2Float result = Ps2Float(0); + PS2Float result = PS2Float(0); if (a.IsDenormalized() && !b.IsDenormalized()) { @@ -702,17 +764,17 @@ Ps2Float Ps2Float::SolveDivisionDenormalizedOperation(Ps2Float a, Ps2Float b) return result; } -Ps2Float Ps2Float::Neg(Ps2Float self) +PS2Float PS2Float::Neg(PS2Float self) { - return Ps2Float(self.AsUInt32() ^ SIGNMASK); + return PS2Float(self.AsUInt32() ^ SIGNMASK); } -bool Ps2Float::DetermineMultiplicationDivisionOperationSign(Ps2Float a, Ps2Float b) +bool PS2Float::DetermineMultiplicationDivisionOperationSign(PS2Float a, PS2Float b) { return a.Sign ^ b.Sign; } -bool Ps2Float::DetermineAdditionOperationSign(Ps2Float a, Ps2Float b) +bool PS2Float::DetermineAdditionOperationSign(PS2Float a, PS2Float b) { if (a.IsZero() && b.IsZero()) { @@ -727,7 +789,7 @@ bool Ps2Float::DetermineAdditionOperationSign(Ps2Float a, Ps2Float b) return a.CompareOperand(b) >= 0 ? a.Sign : b.Sign; } -bool Ps2Float::DetermineSubtractionOperationSign(Ps2Float a, Ps2Float b) +bool PS2Float::DetermineSubtractionOperationSign(PS2Float a, PS2Float b) { if (a.IsZero() && b.IsZero()) { @@ -742,7 +804,7 @@ bool Ps2Float::DetermineSubtractionOperationSign(Ps2Float a, Ps2Float b) return a.CompareOperand(b) >= 0 ? a.Sign : !b.Sign; } -int32_t Ps2Float::clz(int x) +s32 PS2Float::clz(s32 x) { x |= x >> 1; x |= x >> 2; @@ -750,17 +812,17 @@ int32_t Ps2Float::clz(int x) x |= x >> 8; x |= x >> 16; - return debruijn32[(uint)x * 0x8c0b2891u >> 26]; + return debruijn32[(u32)x * 0x8c0b2891u >> 26]; } -int32_t Ps2Float::BitScanReverse8(int b) +s32 PS2Float::BitScanReverse8(s32 b) { return msb[b]; } -int32_t Ps2Float::GetMostSignificantBitPosition(uint32_t value) +s32 PS2Float::GetMostSignificantBitPosition(u32 value) { - for (int32_t i = 31; i >= 0; i--) + for (s32 i = 31; i >= 0; i--) { if (((value >> i) & 1) != 0) return i; @@ -768,7 +830,7 @@ int32_t Ps2Float::GetMostSignificantBitPosition(uint32_t value) return -1; } -const int8_t Ps2Float::msb[256] = +const s8 PS2Float::msb[256] = { -1, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, @@ -779,13 +841,13 @@ const int8_t Ps2Float::msb[256] = 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}; -const int32_t Ps2Float::debruijn32[64] = +const s32 PS2Float::debruijn32[64] = { 32, 8, 17, -1, -1, 14, -1, -1, -1, 20, -1, -1, -1, 28, -1, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 26, 25, 24, 4, 11, 23, 31, 3, 7, 10, 16, 22, 30, -1, -1, 2, 6, 13, 9, -1, 15, -1, 21, -1, 29, 19, -1, -1, -1, -1, -1, 1, 27, 5, 12}; -const int32_t Ps2Float::normalizeAmounts[] = +const s32 PS2Float::normalizeAmounts[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 16, 16, 16, 16, 16, 16, 16, 16, 24, 24, 24, 24, 24, 24, 24}; diff --git a/pcsx2/Ps2Float.h b/pcsx2/Ps2Float.h index ceffb01af738d..14ef962942021 100644 --- a/pcsx2/Ps2Float.h +++ b/pcsx2/Ps2Float.h @@ -5,54 +5,72 @@ #include -class Ps2Float +class PS2Float { + struct BoothRecode + { + u32 data; + u32 negate; + }; + + struct AddResult + { + u32 lo; + u32 hi; + }; + + static u64 MulMantissa(u32 a, u32 b); + + static BoothRecode Booth(u32 a, u32 b, u32 bit); + + static AddResult Add3(u32 a, u32 b, u32 c); + public: bool Sign; - uint8_t Exponent; - uint32_t Mantissa; - - static const uint8_t BIAS; - static const uint32_t SIGNMASK; - static const uint32_t MAX_FLOATING_POINT_VALUE; - static const uint32_t MIN_FLOATING_POINT_VALUE; - static const uint32_t POSITIVE_INFINITY_VALUE; - static const uint32_t NEGATIVE_INFINITY_VALUE; - static const uint32_t ONE; - static const uint32_t MIN_ONE; + u8 Exponent; + u32 Mantissa; + + static const u8 BIAS; + static const u32 SIGNMASK; + static const u32 MAX_FLOATING_POINT_VALUE; + static const u32 MIN_FLOATING_POINT_VALUE; + static const u32 POSITIVE_INFINITY_VALUE; + static const u32 NEGATIVE_INFINITY_VALUE; + static const u32 ONE; + static const u32 MIN_ONE; static const int IMPLICIT_LEADING_BIT_POS; - static const int8_t msb[256]; - static const int32_t debruijn32[64]; - static const int32_t normalizeAmounts[]; + static const s8 msb[256]; + static const s32 debruijn32[64]; + static const s32 normalizeAmounts[]; - Ps2Float(uint32_t value); + PS2Float(u32 value); - Ps2Float(bool sign, uint8_t exponent, uint32_t mantissa); + PS2Float(bool sign, u8 exponent, u32 mantissa); - static Ps2Float Max(); + static PS2Float Max(); - static Ps2Float Min(); + static PS2Float Min(); - static Ps2Float One(); + static PS2Float One(); - static Ps2Float MinOne(); + static PS2Float MinOne(); - static Ps2Float Neg(Ps2Float self); + static PS2Float Neg(PS2Float self); - uint32_t AsUInt32() const; + u32 AsUInt32() const; - Ps2Float Add(Ps2Float addend); + PS2Float Add(PS2Float addend); - Ps2Float Sub(Ps2Float subtrahend); + PS2Float Sub(PS2Float subtrahend); - Ps2Float Mul(Ps2Float mulend); + PS2Float Mul(PS2Float mulend); - Ps2Float Div(Ps2Float divend); + PS2Float Div(PS2Float divend); - Ps2Float Sqrt(); + PS2Float Sqrt(); - Ps2Float Rsqrt(Ps2Float other); + PS2Float Rsqrt(PS2Float other); bool IsDenormalized(); @@ -60,13 +78,13 @@ class Ps2Float bool IsZero(); - uint32_t Abs(); + u32 Abs(); - Ps2Float RoundTowardsZero(); + PS2Float RoundTowardsZero(); - int32_t CompareTo(Ps2Float other); + s32 CompareTo(PS2Float other); - int32_t CompareOperand(Ps2Float other); + s32 CompareOperand(PS2Float other); double ToDouble(); @@ -76,31 +94,31 @@ class Ps2Float private: - Ps2Float DoAdd(Ps2Float other); + PS2Float DoAdd(PS2Float other); - Ps2Float DoMul(Ps2Float other); + PS2Float DoMul(PS2Float other); - Ps2Float DoDiv(Ps2Float other); + PS2Float DoDiv(PS2Float other); - static Ps2Float SolveAbnormalAdditionOrSubtractionOperation(Ps2Float a, Ps2Float b, bool add); + static PS2Float SolveAbnormalAdditionOrSubtractionOperation(PS2Float a, PS2Float b, bool add); - static Ps2Float SolveAbnormalMultiplicationOrDivisionOperation(Ps2Float a, Ps2Float b, bool mul); + static PS2Float SolveAbnormalMultiplicationOrDivisionOperation(PS2Float a, PS2Float b, bool mul); - static Ps2Float SolveAddSubDenormalizedOperation(Ps2Float a, Ps2Float b, bool add); + static PS2Float SolveAddSubDenormalizedOperation(PS2Float a, PS2Float b, bool add); - static Ps2Float SolveMultiplicationDenormalizedOperation(Ps2Float a, Ps2Float b); + static PS2Float SolveMultiplicationDenormalizedOperation(PS2Float a, PS2Float b); - static Ps2Float SolveDivisionDenormalizedOperation(Ps2Float a, Ps2Float b); + static PS2Float SolveDivisionDenormalizedOperation(PS2Float a, PS2Float b); - static bool DetermineMultiplicationDivisionOperationSign(Ps2Float a, Ps2Float b); + static bool DetermineMultiplicationDivisionOperationSign(PS2Float a, PS2Float b); - static bool DetermineAdditionOperationSign(Ps2Float a, Ps2Float b); + static bool DetermineAdditionOperationSign(PS2Float a, PS2Float b); - static bool DetermineSubtractionOperationSign(Ps2Float a, Ps2Float b); + static bool DetermineSubtractionOperationSign(PS2Float a, PS2Float b); - static int32_t GetMostSignificantBitPosition(uint32_t value); + static s32 GetMostSignificantBitPosition(u32 value); - static int32_t BitScanReverse8(int32_t b); + static s32 BitScanReverse8(s32 b); - static int32_t clz(int32_t x); + static s32 clz(s32 x); }; diff --git a/pcsx2/VU.h b/pcsx2/VU.h index ad55a0e12b214..72b519c8fa932 100644 --- a/pcsx2/VU.h +++ b/pcsx2/VU.h @@ -124,7 +124,7 @@ struct alignas(16) VURegs REG_VI q; REG_VI p; - VECTOR TMP; + VECTOR TMP; // Temporary vector used to stack FMA operations uint idx; // VU index (0 or 1) // flags/cycle are needed by VIF dma code, so they have to be here (for now) diff --git a/pcsx2/VUflags.cpp b/pcsx2/VUflags.cpp index 85a38eb1b8274..d3422c2587998 100644 --- a/pcsx2/VUflags.cpp +++ b/pcsx2/VUflags.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: GPL-3.0+ #include "Common.h" -#include "Ps2Float.h" +#include "PS2Float.h" #include #include @@ -12,12 +12,12 @@ /* NEW FLAGS */ //By asadr. Thnkx F|RES :p /*****************************************/ -static __ri u32 VU_MAC_UPDATE(int shift, VURegs* VU, uint32_t f) +static __ri u32 VU_MAC_UPDATE(int shift, VURegs* VU, u32 f) { - Ps2Float ps2f = Ps2Float(f); + PS2Float ps2f = PS2Float(f); - uint exp = ps2f.Exponent; - u32 s = ps2f.AsUInt32() & Ps2Float::SIGNMASK; + u32 exp = ps2f.Exponent; + u32 s = ps2f.AsUInt32() & PS2Float::SIGNMASK; if (s) VU->macflag |= 0x0010<macflag = (VU->macflag & ~(0x0101 << shift)) | (0x1000 << shift); return f; @@ -62,42 +62,42 @@ static __ri u32 VU_MAC_UPDATE(int shift, VURegs* VU, uint32_t f) } } -__fi u32 VU_MACx_UPDATE(VURegs * VU, uint32_t x) +__fi u32 VU_MACx_UPDATE(VURegs* VU, u32 x) { return VU_MAC_UPDATE(3, VU, x); } -__fi u32 VU_MACy_UPDATE(VURegs* VU, uint32_t y) +__fi u32 VU_MACy_UPDATE(VURegs* VU, u32 y) { return VU_MAC_UPDATE(2, VU, y); } -__fi u32 VU_MACz_UPDATE(VURegs* VU, uint32_t z) +__fi u32 VU_MACz_UPDATE(VURegs* VU, u32 z) { return VU_MAC_UPDATE(1, VU, z); } -__fi u32 VU_MACw_UPDATE(VURegs* VU, uint32_t w) +__fi u32 VU_MACw_UPDATE(VURegs* VU, u32 w) { return VU_MAC_UPDATE(0, VU, w); } -__fi void VU_MACx_CLEAR(VURegs * VU) +__fi void VU_MACx_CLEAR(VURegs* VU) { VU->macflag&= ~(0x1111<<3); } -__fi void VU_MACy_CLEAR(VURegs * VU) +__fi void VU_MACy_CLEAR(VURegs* VU) { VU->macflag&= ~(0x1111<<2); } -__fi void VU_MACz_CLEAR(VURegs * VU) +__fi void VU_MACz_CLEAR(VURegs* VU) { VU->macflag&= ~(0x1111<<1); } -__fi void VU_MACw_CLEAR(VURegs * VU) +__fi void VU_MACw_CLEAR(VURegs* VU) { VU->macflag&= ~(0x1111<<0); } diff --git a/pcsx2/VUflags.h b/pcsx2/VUflags.h index 9a5a5fafa89dd..12bd316351270 100644 --- a/pcsx2/VUflags.h +++ b/pcsx2/VUflags.h @@ -4,12 +4,12 @@ #pragma once #include "VU.h" -extern u32 VU_MACx_UPDATE(VURegs * VU, uint32_t x); -extern u32 VU_MACy_UPDATE(VURegs* VU, uint32_t y); -extern u32 VU_MACz_UPDATE(VURegs* VU, uint32_t z); -extern u32 VU_MACw_UPDATE(VURegs* VU, uint32_t w); -extern void VU_MACx_CLEAR(VURegs * VU); -extern void VU_MACy_CLEAR(VURegs * VU); -extern void VU_MACz_CLEAR(VURegs * VU); -extern void VU_MACw_CLEAR(VURegs * VU); -extern void VU_STAT_UPDATE(VURegs * VU); +extern u32 VU_MACx_UPDATE(VURegs* VU, u32 x); +extern u32 VU_MACy_UPDATE(VURegs* VU, u32 y); +extern u32 VU_MACz_UPDATE(VURegs* VU, u32 z); +extern u32 VU_MACw_UPDATE(VURegs* VU, u32 w); +extern void VU_MACx_CLEAR(VURegs* VU); +extern void VU_MACy_CLEAR(VURegs* VU); +extern void VU_MACz_CLEAR(VURegs* VU); +extern void VU_MACw_CLEAR(VURegs* VU); +extern void VU_STAT_UPDATE(VURegs* VU); diff --git a/pcsx2/VUops.cpp b/pcsx2/VUops.cpp index 60e26a707f112..f12903b72d3a8 100644 --- a/pcsx2/VUops.cpp +++ b/pcsx2/VUops.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: GPL-3.0+ #include "Common.h" -#include "Ps2Float.h" +#include "PS2Float.h" #include "VUops.h" #include "GS.h" #include "Gif_Unit.h" @@ -463,14 +463,14 @@ static __fi float vuDouble(u32 f) } #endif -static __fi uint32_t vuAccurateAddSub(VURegs* VU, u32 a, u32 b, bool issub) +static __fi u32 vuAccurateAddSub(VURegs* VU, u32 a, u32 b, bool issub) { if (CHECK_VU_SOFT_ADDSUB((VU == &VU1) ? 1 : 0)) { if (issub) - return Ps2Float(a).Sub(Ps2Float(b)).AsUInt32(); + return PS2Float(a).Sub(PS2Float(b)).AsUInt32(); else - return Ps2Float(a).Add(Ps2Float(b)).AsUInt32(); + return PS2Float(a).Add(PS2Float(b)).AsUInt32(); } if (issub) @@ -480,14 +480,14 @@ static __fi uint32_t vuAccurateAddSub(VURegs* VU, u32 a, u32 b, bool issub) } -static __fi uint32_t vuAccurateMulDiv(VURegs* VU, u32 a, u32 b, bool isdiv) +static __fi u32 vuAccurateMulDiv(VURegs* VU, u32 a, u32 b, bool isdiv) { if (CHECK_VU_SOFT_MULDIV((VU == &VU1) ? 1 : 0)) { if (isdiv) - return Ps2Float(a).Div(Ps2Float(b)).AsUInt32(); + return PS2Float(a).Div(PS2Float(b)).AsUInt32(); else - return Ps2Float(a).Mul(Ps2Float(b)).AsUInt32(); + return PS2Float(a).Mul(PS2Float(b)).AsUInt32(); } if (isdiv) @@ -505,19 +505,19 @@ void _vuABS(VURegs* VU) { if (_X) { - VU->VF[_Ft_].i.x = Ps2Float(VU->VF[_Fs_].i.x).Abs(); + VU->VF[_Ft_].i.x = PS2Float(VU->VF[_Fs_].i.x).Abs(); } if (_Y) { - VU->VF[_Ft_].i.y = Ps2Float(VU->VF[_Fs_].i.y).Abs(); + VU->VF[_Ft_].i.y = PS2Float(VU->VF[_Fs_].i.y).Abs(); } if (_Z) { - VU->VF[_Ft_].i.z = Ps2Float(VU->VF[_Fs_].i.z).Abs(); + VU->VF[_Ft_].i.z = PS2Float(VU->VF[_Fs_].i.z).Abs(); } if (_W) { - VU->VF[_Ft_].i.w = Ps2Float(VU->VF[_Fs_].i.w).Abs(); + VU->VF[_Ft_].i.w = PS2Float(VU->VF[_Fs_].i.w).Abs(); } } else @@ -750,11 +750,11 @@ static __fi void _vuSUBq(VURegs* VU) else dst = &VU->VF[_Fd_]; - if (_X){ dst->i.x = VU_MACx_UPDATE(VU, vuAccurateAddSub(VU, VU->VF[_Fs_].i.x, VU->VI[REG_Q].UL, 1));} else VU_MACx_CLEAR(VU); - if (_Y){ dst->i.y = VU_MACy_UPDATE(VU, vuAccurateAddSub(VU, VU->VF[_Fs_].i.y, VU->VI[REG_Q].UL, 1));} else VU_MACy_CLEAR(VU); - if (_Z){ dst->i.z = VU_MACz_UPDATE(VU, vuAccurateAddSub(VU, VU->VF[_Fs_].i.z, VU->VI[REG_Q].UL, 1));} else VU_MACz_CLEAR(VU); - if (_W){ dst->i.w = VU_MACw_UPDATE(VU, vuAccurateAddSub(VU, VU->VF[_Fs_].i.w, VU->VI[REG_Q].UL, 1));} else VU_MACw_CLEAR(VU); - VU_STAT_UPDATE(VU); + if (_X){ dst->i.x = VU_MACx_UPDATE(VU, vuAccurateAddSub(VU, VU->VF[_Fs_].i.x, VU->VI[REG_Q].UL, 1));} else VU_MACx_CLEAR(VU); + if (_Y){ dst->i.y = VU_MACy_UPDATE(VU, vuAccurateAddSub(VU, VU->VF[_Fs_].i.y, VU->VI[REG_Q].UL, 1));} else VU_MACy_CLEAR(VU); + if (_Z){ dst->i.z = VU_MACz_UPDATE(VU, vuAccurateAddSub(VU, VU->VF[_Fs_].i.z, VU->VI[REG_Q].UL, 1));} else VU_MACz_CLEAR(VU); + if (_W){ dst->i.w = VU_MACw_UPDATE(VU, vuAccurateAddSub(VU, VU->VF[_Fs_].i.w, VU->VI[REG_Q].UL, 1));} else VU_MACw_CLEAR(VU); + VU_STAT_UPDATE(VU); } static __fi void _vuSUBx(VURegs* VU) @@ -931,7 +931,7 @@ static __fi void _vuMULx(VURegs* VU) else dst = &VU->VF[_Fd_]; - uint32_t ftx = VU->VF[_Ft_].i.x; + u32 ftx = VU->VF[_Ft_].i.x; if (_X){ dst->i.x = VU_MACx_UPDATE(VU, vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, ftx, 0)); } else VU_MACx_CLEAR(VU); if (_Y){ dst->i.y = VU_MACy_UPDATE(VU, vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, ftx, 0)); } else VU_MACy_CLEAR(VU); if (_Z){ dst->i.z = VU_MACz_UPDATE(VU, vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, ftx, 0)); } else VU_MACz_CLEAR(VU); @@ -948,7 +948,7 @@ static __fi void _vuMULy(VURegs* VU) else dst = &VU->VF[_Fd_]; - uint32_t fty = VU->VF[_Ft_].i.y; + u32 fty = VU->VF[_Ft_].i.y; if (_X){ dst->i.x = VU_MACx_UPDATE(VU, vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, fty, 0)); } else VU_MACx_CLEAR(VU); if (_Y){ dst->i.y = VU_MACy_UPDATE(VU, vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, fty, 0)); } else VU_MACy_CLEAR(VU); if (_Z){ dst->i.z = VU_MACz_UPDATE(VU, vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, fty, 0)); } else VU_MACz_CLEAR(VU); @@ -964,7 +964,7 @@ static __fi void _vuMULz(VURegs* VU) else dst = &VU->VF[_Fd_]; - uint32_t ftz = VU->VF[_Ft_].i.z; + u32 ftz = VU->VF[_Ft_].i.z; if (_X){ dst->i.x = VU_MACx_UPDATE(VU, vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, ftz, 0)); } else VU_MACx_CLEAR(VU); if (_Y){ dst->i.y = VU_MACy_UPDATE(VU, vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, ftz, 0)); } else VU_MACy_CLEAR(VU); if (_Z){ dst->i.z = VU_MACz_UPDATE(VU, vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, ftz, 0)); } else VU_MACz_CLEAR(VU); @@ -980,7 +980,7 @@ static __fi void _vuMULw(VURegs* VU) else dst = &VU->VF[_Fd_]; - uint32_t ftw = VU->VF[_Ft_].i.w; + u32 ftw = VU->VF[_Ft_].i.w; if (_X){ dst->i.x = VU_MACx_UPDATE(VU, vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, ftw, 0)); } else VU_MACx_CLEAR(VU); if (_Y){ dst->i.y = VU_MACy_UPDATE(VU, vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, ftw, 0)); } else VU_MACy_CLEAR(VU); if (_Z){ dst->i.z = VU_MACz_UPDATE(VU, vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, ftw, 0)); } else VU_MACz_CLEAR(VU); @@ -1108,7 +1108,7 @@ static __fi void _vuMADDx(VURegs* VU) dst = &VU->VF[_Fd_]; tmp = &VU->TMP; - uint32_t ftx = VU->VF[_Ft_].i.x; + u32 ftx = VU->VF[_Ft_].i.x; if (_X) {tmp->i.x = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, ftx, 0); dst->i.x = VU_MACx_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.x, tmp->i.x, 0));} else VU_MACx_CLEAR(VU); if (_Y) {tmp->i.y = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, ftx, 0); dst->i.y = VU_MACy_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.y, tmp->i.y, 0));} else VU_MACy_CLEAR(VU); if (_Z) {tmp->i.z = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, ftx, 0); dst->i.z = VU_MACz_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.z, tmp->i.z, 0));} else VU_MACz_CLEAR(VU); @@ -1126,7 +1126,7 @@ static __fi void _vuMADDy(VURegs* VU) dst = &VU->VF[_Fd_]; tmp = &VU->TMP; - uint32_t fty = VU->VF[_Ft_].i.y; + u32 fty = VU->VF[_Ft_].i.y; if (_X) {tmp->i.x = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, fty, 0); dst->i.x = VU_MACx_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.x, tmp->i.x, 0));} else VU_MACx_CLEAR(VU); if (_Y) {tmp->i.y = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, fty, 0); dst->i.y = VU_MACy_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.y, tmp->i.y, 0));} else VU_MACy_CLEAR(VU); if (_Z) {tmp->i.z = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, fty, 0); dst->i.z = VU_MACz_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.z, tmp->i.z, 0));} else VU_MACz_CLEAR(VU); @@ -1144,7 +1144,7 @@ static __fi void _vuMADDz(VURegs* VU) dst = &VU->VF[_Fd_]; tmp = &VU->TMP; - uint32_t ftz = VU->VF[_Ft_].i.z; + u32 ftz = VU->VF[_Ft_].i.z; if (_X) {tmp->i.x = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, ftz, 0); dst->i.x = VU_MACx_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.x, tmp->i.x, 0));} else VU_MACx_CLEAR(VU); if (_Y) {tmp->i.y = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, ftz, 0); dst->i.y = VU_MACy_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.y, tmp->i.y, 0));} else VU_MACy_CLEAR(VU); if (_Z) {tmp->i.z = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, ftz, 0); dst->i.z = VU_MACz_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.z, tmp->i.z, 0));} else VU_MACz_CLEAR(VU); @@ -1162,7 +1162,7 @@ static __fi void _vuMADDw(VURegs* VU) dst = &VU->VF[_Fd_]; tmp = &VU->TMP; - uint32_t ftw = VU->VF[_Ft_].i.w; + u32 ftw = VU->VF[_Ft_].i.w; if (_X) {tmp->i.x = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, ftw, 0); dst->i.x = VU_MACx_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.x, tmp->i.x, 0));} else VU_MACx_CLEAR(VU); if (_Y) {tmp->i.y = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, ftw, 0); dst->i.y = VU_MACy_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.y, tmp->i.y, 0));} else VU_MACy_CLEAR(VU); if (_Z) {tmp->i.z = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, ftw, 0); dst->i.z = VU_MACz_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.z, tmp->i.z, 0));} else VU_MACz_CLEAR(VU); @@ -1309,7 +1309,7 @@ static __fi void _vuMSUBx(VURegs* VU) dst = &VU->VF[_Fd_]; tmp = &VU->TMP; - uint32_t ftx = VU->VF[_Ft_].i.x; + u32 ftx = VU->VF[_Ft_].i.x; if (_X) {tmp->i.x = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, ftx, 0); dst->i.x = VU_MACx_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.x, tmp->i.x, 1));} else VU_MACx_CLEAR(VU); if (_Y) {tmp->i.y = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, ftx, 0); dst->i.y = VU_MACy_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.y, tmp->i.y, 1));} else VU_MACy_CLEAR(VU); if (_Z) {tmp->i.z = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, ftx, 0); dst->i.z = VU_MACz_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.z, tmp->i.z, 1));} else VU_MACz_CLEAR(VU); @@ -1327,7 +1327,7 @@ static __fi void _vuMSUBy(VURegs* VU) dst = &VU->VF[_Fd_]; tmp = &VU->TMP; - uint32_t fty = VU->VF[_Ft_].i.y; + u32 fty = VU->VF[_Ft_].i.y; if (_X) {tmp->i.x = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, fty, 0); dst->i.x = VU_MACx_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.x, tmp->i.x, 1));} else VU_MACx_CLEAR(VU); if (_Y) {tmp->i.y = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, fty, 0); dst->i.y = VU_MACy_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.y, tmp->i.y, 1));} else VU_MACy_CLEAR(VU); if (_Z) {tmp->i.z = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, fty, 0); dst->i.z = VU_MACz_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.z, tmp->i.z, 1));} else VU_MACz_CLEAR(VU); @@ -1345,7 +1345,7 @@ static __fi void _vuMSUBz(VURegs* VU) dst = &VU->VF[_Fd_]; tmp = &VU->TMP; - uint32_t ftz = VU->VF[_Ft_].i.z; + u32 ftz = VU->VF[_Ft_].i.z; if (_X) {tmp->i.x = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, ftz, 0); dst->i.x = VU_MACx_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.x, tmp->i.x, 1));} else VU_MACx_CLEAR(VU); if (_Y) {tmp->i.y = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, ftz, 0); dst->i.y = VU_MACy_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.y, tmp->i.y, 1));} else VU_MACy_CLEAR(VU); if (_Z) {tmp->i.z = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, ftz, 0); dst->i.z = VU_MACz_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.z, tmp->i.z, 1));} else VU_MACz_CLEAR(VU); @@ -1363,7 +1363,7 @@ static __fi void _vuMSUBw(VURegs* VU) dst = &VU->VF[_Fd_]; tmp = &VU->TMP; - uint32_t ftw = VU->VF[_Ft_].i.w; + u32 ftw = VU->VF[_Ft_].i.w; if (_X) {tmp->i.x = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, ftw, 0); dst->i.x = VU_MACx_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.x, tmp->i.x, 1));} else VU_MACx_CLEAR(VU); if (_Y) {tmp->i.y = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, ftw, 0); dst->i.y = VU_MACy_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.y, tmp->i.y, 1));} else VU_MACy_CLEAR(VU); if (_Z) {tmp->i.z = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, ftw, 0); dst->i.z = VU_MACz_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.z, tmp->i.z, 1));} else VU_MACz_CLEAR(VU); @@ -1409,7 +1409,7 @@ static __fi void _vuMSUBAx(VURegs* VU) { VECTOR* tmp; tmp = &VU->TMP; - uint32_t tx = VU->VF[_Ft_].i.x; + u32 tx = VU->VF[_Ft_].i.x; if (_X) {tmp->i.x = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, tx, 0); VU->ACC.i.x = VU_MACx_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.x, tmp->i.x, 1));} else VU_MACx_CLEAR(VU); if (_Y) {tmp->i.y = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, tx, 0); VU->ACC.i.y = VU_MACy_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.y, tmp->i.y, 1));} else VU_MACy_CLEAR(VU); if (_Z) {tmp->i.z = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, tx, 0); VU->ACC.i.z = VU_MACz_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.z, tmp->i.z, 1));} else VU_MACz_CLEAR(VU); @@ -1421,7 +1421,7 @@ static __fi void _vuMSUBAy(VURegs* VU) { VECTOR* tmp; tmp = &VU->TMP; - uint32_t ty = VU->VF[_Ft_].i.y; + u32 ty = VU->VF[_Ft_].i.y; if (_X) {tmp->i.x = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, ty, 0); VU->ACC.i.x = VU_MACx_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.x, tmp->i.x, 1));} else VU_MACx_CLEAR(VU); if (_Y) {tmp->i.y = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, ty, 0); VU->ACC.i.y = VU_MACy_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.y, tmp->i.y, 1));} else VU_MACy_CLEAR(VU); if (_Z) {tmp->i.z = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, ty, 0); VU->ACC.i.z = VU_MACz_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.z, tmp->i.z, 1));} else VU_MACz_CLEAR(VU); @@ -1433,7 +1433,7 @@ static __fi void _vuMSUBAz(VURegs* VU) { VECTOR* tmp; tmp = &VU->TMP; - uint32_t tz = VU->VF[_Ft_].i.z; + u32 tz = VU->VF[_Ft_].i.z; if (_X) {tmp->i.x = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, tz, 0); VU->ACC.i.x = VU_MACx_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.x, tmp->i.x, 1));} else VU_MACx_CLEAR(VU); if (_Y) {tmp->i.y = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, tz, 0); VU->ACC.i.y = VU_MACy_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.y, tmp->i.y, 1));} else VU_MACy_CLEAR(VU); if (_Z) {tmp->i.z = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, tz, 0); VU->ACC.i.z = VU_MACz_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.z, tmp->i.z, 1));} else VU_MACz_CLEAR(VU); @@ -1445,7 +1445,7 @@ static __fi void _vuMSUBAw(VURegs* VU) { VECTOR* tmp; tmp = &VU->TMP; - uint32_t tw = VU->VF[_Ft_].i.w; + u32 tw = VU->VF[_Ft_].i.w; if (_X) {tmp->i.x = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, tw, 0); VU->ACC.i.x = VU_MACx_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.x, tmp->i.x, 1));} else VU_MACx_CLEAR(VU); if (_Y) {tmp->i.y = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, tw, 0); VU->ACC.i.y = VU_MACy_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.y, tmp->i.y, 1));} else VU_MACy_CLEAR(VU); if (_Z) {tmp->i.z = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, tw, 0); VU->ACC.i.z = VU_MACz_UPDATE(VU, vuAccurateAddSub(VU, VU->ACC.i.z, tmp->i.z, 1));} else VU_MACz_CLEAR(VU); @@ -1663,13 +1663,13 @@ static __fi void _vuFTOI0(VURegs* VU) { if (CHECK_VU_SOFT_ADDSUB((VU == &VU1) ? 1 : 0) || CHECK_VU_SOFT_MULDIV((VU == &VU1) ? 1 : 0) || CHECK_VU_SOFT_SQRT((VU == &VU1) ? 1 : 0)) { if (_X) - VU->VF[_Ft_].SL[0] = double_to_int(Ps2Float(VU->VF[_Fs_].i.x).ToDouble()); + VU->VF[_Ft_].SL[0] = double_to_int(PS2Float(VU->VF[_Fs_].i.x).ToDouble()); if (_Y) - VU->VF[_Ft_].SL[1] = double_to_int(Ps2Float(VU->VF[_Fs_].i.y).ToDouble()); + VU->VF[_Ft_].SL[1] = double_to_int(PS2Float(VU->VF[_Fs_].i.y).ToDouble()); if (_Z) - VU->VF[_Ft_].SL[2] = double_to_int(Ps2Float(VU->VF[_Fs_].i.z).ToDouble()); + VU->VF[_Ft_].SL[2] = double_to_int(PS2Float(VU->VF[_Fs_].i.z).ToDouble()); if (_W) - VU->VF[_Ft_].SL[3] = double_to_int(Ps2Float(VU->VF[_Fs_].i.w).ToDouble()); + VU->VF[_Ft_].SL[3] = double_to_int(PS2Float(VU->VF[_Fs_].i.w).ToDouble()); } else { @@ -1763,20 +1763,20 @@ static __fi void _vuCLIP(VURegs* VU) { if (CHECK_VU_SOFT_ADDSUB((VU == &VU1) ? 1 : 0) || CHECK_VU_SOFT_MULDIV((VU == &VU1) ? 1 : 0) || CHECK_VU_SOFT_SQRT((VU == &VU1) ? 1 : 0)) { - double value = Ps2Float(Ps2Float(VU->VF[_Ft_].i.w).Abs()).ToDouble(); + double value = PS2Float(PS2Float(VU->VF[_Ft_].i.w).Abs()).ToDouble(); VU->clipflag <<= 6; - if (Ps2Float(VU->VF[_Fs_].i.x).ToDouble() > +value) + if (PS2Float(VU->VF[_Fs_].i.x).ToDouble() > +value) VU->clipflag |= 0x01; - if (Ps2Float(VU->VF[_Fs_].i.x).ToDouble() < -value) + if (PS2Float(VU->VF[_Fs_].i.x).ToDouble() < -value) VU->clipflag |= 0x02; - if (Ps2Float(VU->VF[_Fs_].i.y).ToDouble() > +value) + if (PS2Float(VU->VF[_Fs_].i.y).ToDouble() > +value) VU->clipflag |= 0x04; - if (Ps2Float(VU->VF[_Fs_].i.y).ToDouble() < -value) + if (PS2Float(VU->VF[_Fs_].i.y).ToDouble() < -value) VU->clipflag |= 0x08; - if (Ps2Float(VU->VF[_Fs_].i.z).ToDouble() > +value) + if (PS2Float(VU->VF[_Fs_].i.z).ToDouble() > +value) VU->clipflag |= 0x10; - if (Ps2Float(VU->VF[_Fs_].i.z).ToDouble() < -value) + if (PS2Float(VU->VF[_Fs_].i.z).ToDouble() < -value) VU->clipflag |= 0x20; } else @@ -1809,8 +1809,8 @@ static __fi void _vuDIV(VURegs* VU) { if (CHECK_VU_SOFT_MULDIV((VU == &VU1) ? 1 : 0)) { - Ps2Float ft = Ps2Float(VU->VF[_Ft_].UL[_Ftf_]); - Ps2Float fs = Ps2Float(VU->VF[_Fs_].UL[_Fsf_]); + PS2Float ft = PS2Float(VU->VF[_Ft_].UL[_Ftf_]); + PS2Float fs = PS2Float(VU->VF[_Fs_].UL[_Fsf_]); VU->statusflag &= ~0x30; @@ -1823,9 +1823,9 @@ static __fi void _vuDIV(VURegs* VU) if ((VU->VF[_Ft_].UL[_Ftf_] & 0x80000000) ^ (VU->VF[_Fs_].UL[_Fsf_] & 0x80000000)) - VU->q.UL = Ps2Float::MIN_FLOATING_POINT_VALUE; + VU->q.UL = PS2Float::MIN_FLOATING_POINT_VALUE; else - VU->q.UL = Ps2Float::MAX_FLOATING_POINT_VALUE; + VU->q.UL = PS2Float::MAX_FLOATING_POINT_VALUE; } else { @@ -1864,13 +1864,13 @@ static __fi void _vuSQRT(VURegs* VU) { if (CHECK_VU_SOFT_SQRT((VU == &VU1) ? 1 : 0)) { - Ps2Float ft = Ps2Float(VU->VF[_Ft_].UL[_Ftf_]); + PS2Float ft = PS2Float(VU->VF[_Ft_].UL[_Ftf_]); VU->statusflag &= ~0x30; if (ft.ToDouble() < 0.0) VU->statusflag |= 0x10; - VU->q.UL = Ps2Float(ft.Abs()).Sqrt().AsUInt32(); + VU->q.UL = PS2Float(ft.Abs()).Sqrt().AsUInt32(); } else { @@ -1889,8 +1889,8 @@ static __fi void _vuRSQRT(VURegs* VU) { if (CHECK_VU_SOFT_SQRT((VU == &VU1) ? 1 : 0)) { - Ps2Float ft = Ps2Float(VU->VF[_Ft_].UL[_Ftf_]); - Ps2Float fs = Ps2Float(VU->VF[_Fs_].UL[_Fsf_]); + PS2Float ft = PS2Float(VU->VF[_Ft_].UL[_Ftf_]); + PS2Float fs = PS2Float(VU->VF[_Fs_].UL[_Fsf_]); VU->statusflag &= ~0x30; @@ -1902,9 +1902,9 @@ static __fi void _vuRSQRT(VURegs* VU) { if ((VU->VF[_Ft_].UL[_Ftf_] & 0x80000000) ^ (VU->VF[_Fs_].UL[_Fsf_] & 0x80000000)) - VU->q.UL = Ps2Float::MIN_FLOATING_POINT_VALUE; + VU->q.UL = PS2Float::MIN_FLOATING_POINT_VALUE; else - VU->q.UL = Ps2Float::MAX_FLOATING_POINT_VALUE; + VU->q.UL = PS2Float::MAX_FLOATING_POINT_VALUE; } else { @@ -1925,7 +1925,7 @@ static __fi void _vuRSQRT(VURegs* VU) } if (CHECK_VU_SOFT_MULDIV((VU == &VU1) ? 1 : 0)) - VU->q.UL = fs.Div(Ps2Float(ft.Abs()).Sqrt()).AsUInt32(); + VU->q.UL = fs.Div(PS2Float(ft.Abs()).Sqrt()).AsUInt32(); else { float temp = sqrt(fabs(vuDouble(ft.AsUInt32()))); @@ -2619,25 +2619,25 @@ static __ri void _vuWAITP(VURegs* VU) static __ri void _vuESADD(VURegs* VU) { - uint32_t x = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, VU->VF[_Fs_].i.x, 0); - uint32_t y = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, VU->VF[_Fs_].i.y, 0); - uint32_t z = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, VU->VF[_Fs_].i.z, 0); + u32 x = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, VU->VF[_Fs_].i.x, 0); + u32 y = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, VU->VF[_Fs_].i.y, 0); + u32 z = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, VU->VF[_Fs_].i.z, 0); VU->p.UL = vuAccurateAddSub(VU, vuAccurateAddSub(VU, x, y, 0), z, 0); } static __ri void _vuERSADD(VURegs* VU) { - uint32_t x = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, VU->VF[_Fs_].i.x, 0); - uint32_t y = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, VU->VF[_Fs_].i.y, 0); - uint32_t z = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, VU->VF[_Fs_].i.z, 0); + u32 x = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, VU->VF[_Fs_].i.x, 0); + u32 y = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, VU->VF[_Fs_].i.y, 0); + u32 z = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, VU->VF[_Fs_].i.z, 0); - Ps2Float p = Ps2Float(vuAccurateAddSub(VU, vuAccurateAddSub(VU, x, y, 0), z, 0)); + PS2Float p = PS2Float(vuAccurateAddSub(VU, vuAccurateAddSub(VU, x, y, 0), z, 0)); if (!p.IsZero()) { if (CHECK_VU_SOFT_MULDIV((VU == &VU1) ? 1 : 0)) - p = Ps2Float::One().Div(p); + p = PS2Float::One().Div(p); else { VU->p.F = 1.0f / vuDouble(p.AsUInt32()); @@ -2650,11 +2650,11 @@ static __ri void _vuERSADD(VURegs* VU) static __ri void _vuELENG(VURegs* VU) { - uint32_t x = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, VU->VF[_Fs_].i.x, 0); - uint32_t y = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, VU->VF[_Fs_].i.y, 0); - uint32_t z = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, VU->VF[_Fs_].i.z, 0); + u32 x = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, VU->VF[_Fs_].i.x, 0); + u32 y = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, VU->VF[_Fs_].i.y, 0); + u32 z = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, VU->VF[_Fs_].i.z, 0); - Ps2Float value = Ps2Float(vuAccurateAddSub(VU, vuAccurateAddSub(VU, x, y, 0), z, 0)); + PS2Float value = PS2Float(vuAccurateAddSub(VU, vuAccurateAddSub(VU, x, y, 0), z, 0)); if (CHECK_VU_SOFT_SQRT((VU == &VU1) ? 1 : 0)) { @@ -2678,11 +2678,11 @@ static __ri void _vuELENG(VURegs* VU) static __ri void _vuERLENG(VURegs* VU) { - uint32_t x = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, VU->VF[_Fs_].i.x, 0); - uint32_t y = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, VU->VF[_Fs_].i.y, 0); - uint32_t z = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, VU->VF[_Fs_].i.z, 0); + u32 x = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.x, VU->VF[_Fs_].i.x, 0); + u32 y = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, VU->VF[_Fs_].i.y, 0); + u32 z = vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, VU->VF[_Fs_].i.z, 0); - Ps2Float value = Ps2Float(vuAccurateAddSub(VU, vuAccurateAddSub(VU, x, y, 0), z, 0)); + PS2Float value = PS2Float(vuAccurateAddSub(VU, vuAccurateAddSub(VU, x, y, 0), z, 0)); if (CHECK_VU_SOFT_SQRT((VU == &VU1) ? 1 : 0)) { @@ -2693,7 +2693,7 @@ static __ri void _vuERLENG(VURegs* VU) { if (CHECK_VU_SOFT_MULDIV((VU == &VU1) ? 1 : 0)) { - value = Ps2Float::One().Div(value); + value = PS2Float::One().Div(value); } else { @@ -2721,7 +2721,7 @@ static __ri void _vuERLENG(VURegs* VU) } -static __ri float _vuCalculateEATAN(uint32_t inputvalue) { +static __ri float _vuCalculateEATAN(u32 inputvalue) { float fvalue = vuDouble(inputvalue); @@ -2748,7 +2748,7 @@ static __ri void _vuEATAN(VURegs* VU) static __ri void _vuEATANxy(VURegs* VU) { float p = 0; - if (!Ps2Float(VU->VF[_Fs_].i.x).IsZero()) + if (!PS2Float(VU->VF[_Fs_].i.x).IsZero()) { p = _vuCalculateEATAN(vuAccurateMulDiv(VU, VU->VF[_Fs_].i.y, VU->VF[_Fs_].i.x, 1)); } @@ -2758,7 +2758,7 @@ static __ri void _vuEATANxy(VURegs* VU) static __ri void _vuEATANxz(VURegs* VU) { float p = 0; - if (!Ps2Float(VU->VF[_Fs_].i.x).IsZero()) + if (!PS2Float(VU->VF[_Fs_].i.x).IsZero()) { p = _vuCalculateEATAN(vuAccurateMulDiv(VU, VU->VF[_Fs_].i.z, VU->VF[_Fs_].i.x, 1)); } @@ -2772,13 +2772,13 @@ static __ri void _vuESUM(VURegs* VU) static __ri void _vuERCPR(VURegs* VU) { - Ps2Float p = Ps2Float(VU->VF[_Fs_].UL[_Fsf_]); + PS2Float p = PS2Float(VU->VF[_Fs_].UL[_Fsf_]); if (!p.IsZero()) { if (CHECK_VU_SOFT_MULDIV((VU == &VU1) ? 1 : 0)) { - p = Ps2Float::One().Div(p); + p = PS2Float::One().Div(p); } else { @@ -2794,7 +2794,7 @@ static __ri void _vuESQRT(VURegs* VU) { if (CHECK_VU_SOFT_SQRT((VU == &VU1) ? 1 : 0)) { - Ps2Float value = Ps2Float(VU->VF[_Fs_].UL[_Fsf_]); + PS2Float value = PS2Float(VU->VF[_Fs_].UL[_Fsf_]); if (value.ToDouble() >= 0) { @@ -2820,7 +2820,7 @@ static __ri void _vuERSQRT(VURegs* VU) { if (CHECK_VU_SOFT_SQRT((VU == &VU1) ? 1 : 0)) { - Ps2Float value = Ps2Float(VU->VF[_Fs_].UL[_Fsf_]); + PS2Float value = PS2Float(VU->VF[_Fs_].UL[_Fsf_]); if (value.ToDouble() >= 0) { @@ -2834,7 +2834,7 @@ static __ri void _vuERSQRT(VURegs* VU) } else { - value = Ps2Float::One().Div(value); + value = PS2Float::One().Div(value); } } } diff --git a/pcsx2/pcsx2.vcxproj b/pcsx2/pcsx2.vcxproj index 9fb77e262afae..3a6555254b0a8 100644 --- a/pcsx2/pcsx2.vcxproj +++ b/pcsx2/pcsx2.vcxproj @@ -126,7 +126,6 @@ true - @@ -282,7 +281,7 @@ - + @@ -584,7 +583,6 @@ true - @@ -729,7 +727,7 @@ - + diff --git a/pcsx2/pcsx2.vcxproj.filters b/pcsx2/pcsx2.vcxproj.filters index 2e6adfb7334c8..0fa8c4cd9fa53 100644 --- a/pcsx2/pcsx2.vcxproj.filters +++ b/pcsx2/pcsx2.vcxproj.filters @@ -1446,10 +1446,7 @@ System\Ps2\Iop\SIO\PAD - - System\Ps2\EmotionEngine\Shared - - + System\Ps2\EmotionEngine\Shared @@ -2408,10 +2405,7 @@ System\Ps2\Iop\SIO\PAD - - System\Ps2\EmotionEngine\Shared - - + System\Ps2\EmotionEngine\Shared