Compare commits

...

6 Commits

Author SHA1 Message Date
refractionpcsx2 0ee69fdf99
Merge bfb8351e73 into fbe0c8b9cc 2025-01-17 17:52:58 -05:00
shockdude fbe0c8b9cc USB: Fix DJ Hero Turntable automatic mapping & turntable multiplier 2025-01-17 10:44:52 -05:00
Ziemas 2e3501366f iR3000A/iR5900: Partial revert of 8c98f5d928 ("Remove mid block jumping") 2025-01-17 10:42:48 -05:00
Ziemas ef7169dbbf host: fix gcc build 2025-01-17 10:42:13 -05:00
refractionpcsx2 bfb8351e73 GameDB: Add IBit hack to Killzone and Shellshock - Nam '67 2025-01-14 14:11:00 +00:00
refractionpcsx2 57a3907a63 VU: Expand IBit hack to work for immediates on several instructions 2025-01-14 14:11:00 +00:00
8 changed files with 237 additions and 38 deletions

View File

@ -3755,6 +3755,8 @@ SCED-52759:
region: "PAL-M5" region: "PAL-M5"
clampModes: clampModes:
vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas. vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas.
gameFixes:
- IbitHack # Reduces VU recompilation.
gsHWFixes: gsHWFixes:
halfPixelOffset: 4 # Fixes post positioning. halfPixelOffset: 4 # Fixes post positioning.
nativeScaling: 2 # Fixes post effects. nativeScaling: 2 # Fixes post effects.
@ -3784,6 +3786,8 @@ SCED-52846:
region: "PAL-E" region: "PAL-E"
clampModes: clampModes:
vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas. vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas.
gameFixes:
- IbitHack # Reduces VU recompilation.
gsHWFixes: gsHWFixes:
halfPixelOffset: 4 # Fixes post positioning. halfPixelOffset: 4 # Fixes post positioning.
nativeScaling: 2 # Fixes post effects. nativeScaling: 2 # Fixes post effects.
@ -3855,6 +3859,8 @@ SCED-52899:
region: "PAL-M5" region: "PAL-M5"
clampModes: clampModes:
vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas. vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas.
gameFixes:
- IbitHack # Reduces VU recompilation.
gsHWFixes: gsHWFixes:
halfPixelOffset: 4 # Fixes post positioning. halfPixelOffset: 4 # Fixes post positioning.
nativeScaling: 2 # Fixes post effects. nativeScaling: 2 # Fixes post effects.
@ -5358,6 +5364,8 @@ SCES-52004:
compat: 5 compat: 5
clampModes: clampModes:
vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas. vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas.
gameFixes:
- IbitHack # Reduces VU recompilation.
gsHWFixes: gsHWFixes:
halfPixelOffset: 4 # Fixes post positioning. halfPixelOffset: 4 # Fixes post positioning.
nativeScaling: 2 # Fixes post effects. nativeScaling: 2 # Fixes post effects.
@ -5690,6 +5698,8 @@ SCES-52893:
region: "PAL-E-GR-R" region: "PAL-E-GR-R"
clampModes: clampModes:
vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas. vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas.
gameFixes:
- IbitHack # Reduces VU recompilation.
gsHWFixes: gsHWFixes:
halfPixelOffset: 4 # Fixes post positioning. halfPixelOffset: 4 # Fixes post positioning.
nativeScaling: 2 # Fixes post effects. nativeScaling: 2 # Fixes post effects.
@ -7203,6 +7213,8 @@ SCKA-20048:
region: "NTSC-K" region: "NTSC-K"
clampModes: clampModes:
vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas. vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas.
gameFixes:
- IbitHack # Reduces VU recompilation.
gsHWFixes: gsHWFixes:
halfPixelOffset: 4 # Fixes post positioning. halfPixelOffset: 4 # Fixes post positioning.
nativeScaling: 2 # Fixes post effects. nativeScaling: 2 # Fixes post effects.
@ -7415,6 +7427,8 @@ SCKA-20078:
region: "NTSC-K" region: "NTSC-K"
clampModes: clampModes:
vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas. vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas.
gameFixes:
- IbitHack # Reduces VU recompilation.
gsHWFixes: gsHWFixes:
halfPixelOffset: 4 # Fixes post positioning. halfPixelOffset: 4 # Fixes post positioning.
nativeScaling: 2 # Fixes post effects. nativeScaling: 2 # Fixes post effects.
@ -11537,6 +11551,8 @@ SCUS-97402:
compat: 5 compat: 5
clampModes: clampModes:
vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas. vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas.
gameFixes:
- IbitHack # Reduces VU recompilation.
gsHWFixes: gsHWFixes:
halfPixelOffset: 4 # Fixes post positioning. halfPixelOffset: 4 # Fixes post positioning.
nativeScaling: 2 # Fixes post effects. nativeScaling: 2 # Fixes post effects.
@ -11677,6 +11693,8 @@ SCUS-97431:
region: "NTSC-U" region: "NTSC-U"
clampModes: clampModes:
vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas. vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas.
gameFixes:
- IbitHack # Reduces VU recompilation.
gsHWFixes: gsHWFixes:
halfPixelOffset: 4 # Fixes post positioning. halfPixelOffset: 4 # Fixes post positioning.
nativeScaling: 2 # Fixes post effects. nativeScaling: 2 # Fixes post effects.
@ -11685,6 +11703,8 @@ SCUS-97432:
region: "NTSC-U" region: "NTSC-U"
clampModes: clampModes:
vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas. vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas.
gameFixes:
- IbitHack # Reduces VU recompilation.
gsHWFixes: gsHWFixes:
halfPixelOffset: 4 # Fixes post positioning. halfPixelOffset: 4 # Fixes post positioning.
nativeScaling: 2 # Fixes post effects. nativeScaling: 2 # Fixes post effects.
@ -12128,6 +12148,8 @@ SCUS-97517:
region: "NTSC-U" region: "NTSC-U"
clampModes: clampModes:
vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas. vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas.
gameFixes:
- IbitHack # Reduces VU recompilation.
gsHWFixes: gsHWFixes:
halfPixelOffset: 4 # Fixes post positioning. halfPixelOffset: 4 # Fixes post positioning.
nativeScaling: 2 # Fixes post effects. nativeScaling: 2 # Fixes post effects.
@ -13316,6 +13338,8 @@ SLED-52899:
region: "PAL-M5" region: "PAL-M5"
clampModes: clampModes:
vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas. vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas.
gameFixes:
- IbitHack # Reduces VU recompilation.
gsHWFixes: gsHWFixes:
halfPixelOffset: 4 # Fixes post positioning. halfPixelOffset: 4 # Fixes post positioning.
nativeScaling: 2 # Fixes post effects. nativeScaling: 2 # Fixes post effects.
@ -18441,6 +18465,8 @@ SLES-51981:
region: "PAL-E" region: "PAL-E"
clampModes: clampModes:
vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas. vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas.
gameFixes:
- IbitHack # Reduces VU recompilation.
gsHWFixes: gsHWFixes:
roundSprite: 1 # Fixes slight blur. roundSprite: 1 # Fixes slight blur.
SLES-51982: SLES-51982:
@ -18448,6 +18474,8 @@ SLES-51982:
region: "PAL-M3" region: "PAL-M3"
clampModes: clampModes:
vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas. vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas.
gameFixes:
- IbitHack # Reduces VU recompilation.
gsHWFixes: gsHWFixes:
roundSprite: 1 # Fixes slight blur. roundSprite: 1 # Fixes slight blur.
SLES-51986: SLES-51986:
@ -45399,6 +45427,8 @@ SLPM-66151:
region: "NTSC-J" region: "NTSC-J"
clampModes: clampModes:
vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas. vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas.
gameFixes:
- IbitHack # Reduces VU recompilation.
gsHWFixes: gsHWFixes:
halfPixelOffset: 4 # Fixes post positioning. halfPixelOffset: 4 # Fixes post positioning.
nativeScaling: 2 # Fixes post effects. nativeScaling: 2 # Fixes post effects.
@ -65100,6 +65130,8 @@ SLUS-20828:
compat: 5 compat: 5
clampModes: clampModes:
vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas. vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas.
gameFixes:
- IbitHack # Reduces VU recompilation.
gsHWFixes: gsHWFixes:
roundSprite: 1 # Fixes slight blur. roundSprite: 1 # Fixes slight blur.
SLUS-20830: SLUS-20830:
@ -72595,6 +72627,8 @@ TCES-52004:
region: "PAL-E" region: "PAL-E"
clampModes: clampModes:
vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas. vuClampMode: 0 # Resolves I Reg Clamping / performance impact and yellow graphics in certain areas.
gameFixes:
- IbitHack # Reduces VU recompilation.
gsHWFixes: gsHWFixes:
halfPixelOffset: 4 # Fixes post positioning. halfPixelOffset: 4 # Fixes post positioning.
nativeScaling: 2 # Fixes post effects. nativeScaling: 2 # Fixes post effects.

View File

@ -10,6 +10,7 @@
#include <ctime> #include <ctime>
#include <functional> #include <functional>
#include <memory>
#include <mutex> #include <mutex>
#include <optional> #include <optional>
#include <string> #include <string>

View File

@ -93,19 +93,19 @@ namespace usb_pad
u8 right_turntable = 0x80; u8 right_turntable = 0x80;
if (data.left_turntable_ccw > 0) if (data.left_turntable_ccw > 0)
{ {
left_turntable -= static_cast<u8>(std::min<int>(data.left_turntable_ccw * turntable_multiplier, 0x7F)); left_turntable -= static_cast<u8>(std::min<int>(data.left_turntable_ccw, 0x7F));
} }
else else
{ {
left_turntable += static_cast<u8>(std::min<int>(data.left_turntable_cw * turntable_multiplier, 0x7F)); left_turntable += static_cast<u8>(std::min<int>(data.left_turntable_cw, 0x7F));
} }
if (data.right_turntable_ccw > 0) if (data.right_turntable_ccw > 0)
{ {
right_turntable -= static_cast<u8>(std::min<int>(data.right_turntable_ccw * turntable_multiplier, 0x7F)); right_turntable -= static_cast<u8>(std::min<int>(data.right_turntable_ccw, 0x7F));
} }
else else
{ {
right_turntable += static_cast<u8>(std::min<int>(data.right_turntable_cw * turntable_multiplier, 0x7F)); right_turntable += static_cast<u8>(std::min<int>(data.right_turntable_cw, 0x7F));
} }
buf[3] = 0x80; buf[3] = 0x80;
buf[4] = 0x80; buf[4] = 0x80;
@ -369,19 +369,19 @@ namespace usb_pad
break; break;
case CID_DJ_LEFT_TURNTABLE_CW: case CID_DJ_LEFT_TURNTABLE_CW:
s->data.left_turntable_cw = static_cast<u32>(std::clamp<long>(std::lroundf(value * 128.0f), 0, 128)); s->data.left_turntable_cw = static_cast<u32>(std::clamp<long>(std::lroundf(value * s->turntable_multiplier * 128.0f), 0, 128));
break; break;
case CID_DJ_LEFT_TURNTABLE_CCW: case CID_DJ_LEFT_TURNTABLE_CCW:
s->data.left_turntable_ccw = static_cast<u32>(std::clamp<long>(std::lroundf(value * 128.0f), 0, 128)); s->data.left_turntable_ccw = static_cast<u32>(std::clamp<long>(std::lroundf(value * s->turntable_multiplier * 128.0f), 0, 128));
break; break;
case CID_DJ_RIGHT_TURNTABLE_CW: case CID_DJ_RIGHT_TURNTABLE_CW:
s->data.right_turntable_cw = static_cast<u32>(std::clamp<long>(std::lroundf(value * 128.0f), 0, 128)); s->data.right_turntable_cw = static_cast<u32>(std::clamp<long>(std::lroundf(value * s->turntable_multiplier * 128.0f), 0, 128));
break; break;
case CID_DJ_RIGHT_TURNTABLE_CCW: case CID_DJ_RIGHT_TURNTABLE_CCW:
s->data.right_turntable_ccw = static_cast<u32>(std::clamp<long>(std::lroundf(value * 128.0f), 0, 128)); s->data.right_turntable_ccw = static_cast<u32>(std::clamp<long>(std::lroundf(value * s->turntable_multiplier * 128.0f), 0, 128));
break; break;
case CID_DJ_DPAD_UP: case CID_DJ_DPAD_UP:
@ -446,8 +446,8 @@ namespace usb_pad
{"EffectsKnobRight", TRANSLATE_NOOP("USB", "Effects Knob Right"), nullptr, InputBindingInfo::Type::HalfAxis, CID_DJ_EFFECTSKNOB_RIGHT, GenericInputBinding::RightStickRight}, {"EffectsKnobRight", TRANSLATE_NOOP("USB", "Effects Knob Right"), nullptr, InputBindingInfo::Type::HalfAxis, CID_DJ_EFFECTSKNOB_RIGHT, GenericInputBinding::RightStickRight},
{"LeftTurntableCW", TRANSLATE_NOOP("USB", "Left Turntable Clockwise"), nullptr, InputBindingInfo::Type::HalfAxis, CID_DJ_LEFT_TURNTABLE_CW, GenericInputBinding::LeftStickRight}, {"LeftTurntableCW", TRANSLATE_NOOP("USB", "Left Turntable Clockwise"), nullptr, InputBindingInfo::Type::HalfAxis, CID_DJ_LEFT_TURNTABLE_CW, GenericInputBinding::LeftStickRight},
{"LeftTurntableCCW", TRANSLATE_NOOP("USB", "Left Turntable Counterclockwise"), nullptr, InputBindingInfo::Type::HalfAxis, CID_DJ_LEFT_TURNTABLE_CCW, GenericInputBinding::LeftStickLeft}, {"LeftTurntableCCW", TRANSLATE_NOOP("USB", "Left Turntable Counterclockwise"), nullptr, InputBindingInfo::Type::HalfAxis, CID_DJ_LEFT_TURNTABLE_CCW, GenericInputBinding::LeftStickLeft},
{"RightTurntableCW", TRANSLATE_NOOP("USB", "Right Turntable Clockwise"), nullptr, InputBindingInfo::Type::HalfAxis, CID_DJ_RIGHT_TURNTABLE_CW, GenericInputBinding::LeftStickDown}, {"RightTurntableCW", TRANSLATE_NOOP("USB", "Right Turntable Clockwise"), nullptr, InputBindingInfo::Type::HalfAxis, CID_DJ_RIGHT_TURNTABLE_CW, GenericInputBinding::LeftStickUp},
{"RightTurntableCCW", TRANSLATE_NOOP("USB", "Right Turntable Counterclockwise"), nullptr, InputBindingInfo::Type::HalfAxis, CID_DJ_RIGHT_TURNTABLE_CCW, GenericInputBinding::LeftStickUp}, {"RightTurntableCCW", TRANSLATE_NOOP("USB", "Right Turntable Counterclockwise"), nullptr, InputBindingInfo::Type::HalfAxis, CID_DJ_RIGHT_TURNTABLE_CCW, GenericInputBinding::LeftStickDown},
{"LeftTurntableGreen", TRANSLATE_NOOP("USB", "Left Turntable Green"), nullptr, InputBindingInfo::Type::Button, CID_DJ_LEFT_GREEN, GenericInputBinding::Unknown}, {"LeftTurntableGreen", TRANSLATE_NOOP("USB", "Left Turntable Green"), nullptr, InputBindingInfo::Type::Button, CID_DJ_LEFT_GREEN, GenericInputBinding::Unknown},
{"LeftTurntableRed", TRANSLATE_NOOP("USB", "Left Turntable Red"), nullptr, InputBindingInfo::Type::Button, CID_DJ_LEFT_RED, GenericInputBinding::Unknown}, {"LeftTurntableRed", TRANSLATE_NOOP("USB", "Left Turntable Red"), nullptr, InputBindingInfo::Type::Button, CID_DJ_LEFT_RED, GenericInputBinding::Unknown},
{"LeftTurntableBlue", TRANSLATE_NOOP("USB", "Left Turntable Blue"), nullptr, InputBindingInfo::Type::Button, CID_DJ_LEFT_BLUE, GenericInputBinding::Unknown}, {"LeftTurntableBlue", TRANSLATE_NOOP("USB", "Left Turntable Blue"), nullptr, InputBindingInfo::Type::Button, CID_DJ_LEFT_BLUE, GenericInputBinding::Unknown},
@ -464,8 +464,8 @@ namespace usb_pad
{ {
static constexpr const SettingInfo info[] = { static constexpr const SettingInfo info[] = {
{SettingInfo::Type::Float, "TurntableMultiplier", TRANSLATE_NOOP("USB", "Turntable Multiplier"), {SettingInfo::Type::Float, "TurntableMultiplier", TRANSLATE_NOOP("USB", "Turntable Multiplier"),
TRANSLATE_NOOP("USB", "Apply a multiplier to the turntable"), TRANSLATE_NOOP("USB", "Apply a sensitivity multiplier to turntable rotation.\nXbox 360 turntables require a 256x multiplier, most other turntables can use the default 1x multiplier."),
"1.00", "0.00", "100.0", "1.0", "%.0fx", nullptr, nullptr, 1.0f}}; "1.00", "0.00", "512.0", "1.0", "%.0fx", nullptr, nullptr, 1.0f}};
return info; return info;
} }

View File

@ -1595,6 +1595,14 @@ static void iopRecRecompile(const u32 startpc)
while (1) while (1)
{ {
BASEBLOCK* pblock = PSX_GETBLOCK(i);
if (i != startpc && pblock->GetFnptr() != (uptr)iopJITCompile)
{
// branch = 3
willbranch3 = 1;
s_nEndBlock = i;
break;
}
psxRegs.code = iopMemRead32(i); psxRegs.code = iopMemRead32(i);

View File

@ -2294,6 +2294,8 @@ static void recRecompile(const u32 startpc)
while (1) while (1)
{ {
BASEBLOCK* pblock = PC_GETBLOCK(i);
// stop before breakpoints // stop before breakpoints
if (isBreakpointNeeded(i) != 0 || isMemcheckNeeded(i) != 0) if (isBreakpointNeeded(i) != 0 || isMemcheckNeeded(i) != 0)
{ {
@ -2311,6 +2313,13 @@ static void recRecompile(const u32 startpc)
eeRecPerfLog.Write("Pagesplit @ %08X : size=%d insts", startpc, (i - startpc) / 4); eeRecPerfLog.Write("Pagesplit @ %08X : size=%d insts", startpc, (i - startpc) / 4);
break; break;
} }
if (pblock->GetFnptr() != (uptr)JITCompile)
{
willbranch3 = 1;
s_nEndBlock = i;
break;
}
} }
//HUH ? PSM ? whut ? THIS IS VIRTUAL ACCESS GOD DAMMIT //HUH ? PSM ? whut ? THIS IS VIRTUAL ACCESS GOD DAMMIT
@ -2614,6 +2623,34 @@ StartRecomp:
pxAssert((pc - startpc) >> 2 <= 0xffff); pxAssert((pc - startpc) >> 2 <= 0xffff);
s_pCurBlockEx->size = (pc - startpc) >> 2; s_pCurBlockEx->size = (pc - startpc) >> 2;
if (HWADDR(pc) <= Ps2MemSize::ExposedRam)
{
BASEBLOCKEX* oldBlock;
int i;
i = recBlocks.LastIndex(HWADDR(pc) - 4);
while ((oldBlock = recBlocks[i--]))
{
if (oldBlock == s_pCurBlockEx)
continue;
if (oldBlock->startpc >= HWADDR(pc))
continue;
if ((oldBlock->startpc + oldBlock->size * 4) <= HWADDR(startpc))
break;
if (memcmp(&recRAMCopy[oldBlock->startpc / 4], PSM(oldBlock->startpc),
oldBlock->size * 4))
{
recClear(startpc, (pc - startpc) / 4);
s_pCurBlockEx = recBlocks.Get(HWADDR(startpc));
pxAssert(s_pCurBlockEx->startpc == HWADDR(startpc));
break;
}
}
memcpy(&recRAMCopy[HWADDR(startpc) / 4], PSM(startpc), pc - startpc);
}
s_pCurBlock->SetFnptr((uptr)recPtr); s_pCurBlock->SetFnptr((uptr)recPtr);
if (!(pc & 0x10000000)) if (!(pc & 0x10000000))

View File

@ -228,7 +228,7 @@ __fi void mVUanalyzeIALU2(mV, int Is, int It)
__fi void mVUanalyzeIADDI(mV, int Is, int It, s16 imm) __fi void mVUanalyzeIADDI(mV, int Is, int It, s16 imm)
{ {
mVUanalyzeIALU2(mVU, Is, It); mVUanalyzeIALU2(mVU, Is, It);
if (!Is) if (!Is && !EmuConfig.Gamefixes.IbitHack)
{ {
setConstReg(It, imm); setConstReg(It, imm);
} }

View File

@ -742,12 +742,27 @@ void* mVUcompile(microVU& mVU, u32 startPC, uptr pState)
{ {
mVUsetupRange(mVU, xPC, false); mVUsetupRange(mVU, xPC, false);
if (branch < 2) if (branch < 2)
mVUsetupRange(mVU, xPC + 8, true); // Ideally we'd do +4 but the mmx compare only works in 64bits, this should be fine mVUsetupRange(mVU, xPC + 4, true);
} }
} }
else else
{ {
incPC(-1); incPC(-1);
if (EmuConfig.Gamefixes.IbitHack)
{
// Ignore IADDI, IADDIU and ISUBU, ILW, ISW, LQ, SQ.
// Be warned, this is a little risky as we could be ignoring subtle differences in the operations.
// 2 is too much, 1 is too little, so it gets 2. It's a hack anyways...
const u32 upper = (mVU.code >> 25);
if (upper == 0x1 || upper == 0x0 || upper == 0x4 || upper == 0x5 || upper == 0x8 || upper == 0x9 || (upper == 0x40 && (mVU.code & 0x3F) == 0x32))
{
incPC(1);
mVUsetupRange(mVU, xPC, false);
if (branch < 2)
mVUsetupRange(mVU, xPC + 2, true);
incPC(-1);
}
}
mVUopL(mVU, 0); mVUopL(mVU, 0);
incPC(1); incPC(1);
} }

View File

@ -858,17 +858,37 @@ mVUop(mVU_IADDI)
if (_Is_ == 0) if (_Is_ == 0)
{ {
const xRegister32& regT = mVU.regAlloc->allocGPR(-1, _It_, mVUlow.backupVI); const xRegister32& regT = mVU.regAlloc->allocGPR(-1, _It_, mVUlow.backupVI);
if (_Imm5_ != 0) if (!EmuConfig.Gamefixes.IbitHack)
xMOV(regT, _Imm5_); {
if (_Imm5_ != 0)
xMOV(regT, _Imm5_);
else
xXOR(regT, regT);
}
else else
xXOR(regT, regT); {
xMOV(regT, ptr32[&curI]);
xSHL(regT, 21);
xSAR(regT, 27);
}
mVU.regAlloc->clearNeeded(regT); mVU.regAlloc->clearNeeded(regT);
} }
else else
{ {
const xRegister32& regS = mVU.regAlloc->allocGPR(_Is_, _It_, mVUlow.backupVI); const xRegister32& regS = mVU.regAlloc->allocGPR(_Is_, _It_, mVUlow.backupVI);
if (_Imm5_ != 0) if (!EmuConfig.Gamefixes.IbitHack)
xADD(regS, _Imm5_); {
if (_Imm5_ != 0)
xADD(regS, _Imm5_);
}
else
{
xMOV(gprT1, ptr32[&curI]);
xSHL(gprT1, 21);
xSAR(gprT1, 27);
xADD(regS, gprT1);
}
mVU.regAlloc->clearNeeded(regS); mVU.regAlloc->clearNeeded(regS);
} }
mVU.profiler.EmitOp(opIADDI); mVU.profiler.EmitOp(opIADDI);
@ -884,17 +904,43 @@ mVUop(mVU_IADDIU)
if (_Is_ == 0) if (_Is_ == 0)
{ {
const xRegister32& regT = mVU.regAlloc->allocGPR(-1, _It_, mVUlow.backupVI); const xRegister32& regT = mVU.regAlloc->allocGPR(-1, _It_, mVUlow.backupVI);
if (_Imm15_ != 0) if (!EmuConfig.Gamefixes.IbitHack)
xMOV(regT, _Imm15_); {
if (_Imm15_ != 0)
xMOV(regT, _Imm15_);
else
xXOR(regT, regT);
}
else else
xXOR(regT, regT); {
xMOV(regT, ptr32[&curI]);
xMOV(gprT1, regT);
xSHR(gprT1, 10);
xAND(gprT1, 0x7800);
xAND(regT, 0x7FF);
xOR(regT, gprT1);
}
mVU.regAlloc->clearNeeded(regT); mVU.regAlloc->clearNeeded(regT);
} }
else else
{ {
const xRegister32& regS = mVU.regAlloc->allocGPR(_Is_, _It_, mVUlow.backupVI); const xRegister32& regS = mVU.regAlloc->allocGPR(_Is_, _It_, mVUlow.backupVI);
if (_Imm15_ != 0) if (!EmuConfig.Gamefixes.IbitHack)
xADD(regS, _Imm15_); {
if (_Imm15_ != 0)
xADD(regS, _Imm15_);
}
else
{
xMOV(gprT1, ptr32[&curI]);
xMOV(gprT2, gprT1);
xSHR(gprT2, 10);
xAND(gprT2, 0x7800);
xAND(gprT1, 0x7FF);
xOR(gprT1, gprT2);
xADD(regS, gprT1);
}
mVU.regAlloc->clearNeeded(regS); mVU.regAlloc->clearNeeded(regS);
} }
mVU.profiler.EmitOp(opIADDIU); mVU.profiler.EmitOp(opIADDIU);
@ -964,8 +1010,22 @@ mVUop(mVU_ISUBIU)
pass2 pass2
{ {
const xRegister32& regS = mVU.regAlloc->allocGPR(_Is_, _It_, mVUlow.backupVI); const xRegister32& regS = mVU.regAlloc->allocGPR(_Is_, _It_, mVUlow.backupVI);
if (_Imm15_ != 0) if (!EmuConfig.Gamefixes.IbitHack)
xSUB(regS, _Imm15_); {
if (_Imm15_ != 0)
xSUB(regS, _Imm15_);
}
else
{
xMOV(gprT1, ptr32[&curI]);
xMOV(gprT2, gprT1);
xSHR(gprT2, 10);
xAND(gprT2, 0x7800);
xAND(gprT1, 0x7FF);
xOR(gprT1, gprT2);
xSUB(regS, gprT1);
}
mVU.regAlloc->clearNeeded(regS); mVU.regAlloc->clearNeeded(regS);
mVU.profiler.EmitOp(opISUBIU); mVU.profiler.EmitOp(opISUBIU);
} }
@ -1100,12 +1160,23 @@ mVUop(mVU_ILW)
pass2 pass2
{ {
void* ptr = mVU.regs().Mem + offsetSS; void* ptr = mVU.regs().Mem + offsetSS;
std::optional<xAddressVoid> optaddr(mVUoptimizeConstantAddr(mVU, _Is_, _Imm11_, offsetSS)); std::optional<xAddressVoid> optaddr(EmuConfig.Gamefixes.IbitHack ? std::nullopt : mVUoptimizeConstantAddr(mVU, _Is_, _Imm11_, offsetSS));
if (!optaddr.has_value()) if (!optaddr.has_value())
{ {
mVU.regAlloc->moveVIToGPR(gprT1, _Is_); mVU.regAlloc->moveVIToGPR(gprT1, _Is_);
if (_Imm11_ != 0) if (!EmuConfig.Gamefixes.IbitHack)
xADD(gprT1, _Imm11_); {
if (_Imm11_ != 0)
xADD(gprT1, _Imm11_);
}
else
{
xMOV(gprT2, ptr32[&curI]);
xSHL(gprT2, 21);
xSAR(gprT2, 21);
xADD(gprT1, gprT2);
}
mVUaddrFix(mVU, gprT1q); mVUaddrFix(mVU, gprT1q);
} }
@ -1164,12 +1235,23 @@ mVUop(mVU_ISW)
} }
pass2 pass2
{ {
std::optional<xAddressVoid> optaddr(mVUoptimizeConstantAddr(mVU, _Is_, _Imm11_, 0)); std::optional<xAddressVoid> optaddr(EmuConfig.Gamefixes.IbitHack ? std::nullopt : mVUoptimizeConstantAddr(mVU, _Is_, _Imm11_, 0));
if (!optaddr.has_value()) if (!optaddr.has_value())
{ {
mVU.regAlloc->moveVIToGPR(gprT1, _Is_); mVU.regAlloc->moveVIToGPR(gprT1, _Is_);
if (_Imm11_ != 0) if (!EmuConfig.Gamefixes.IbitHack)
xADD(gprT1, _Imm11_); {
if (_Imm11_ != 0)
xADD(gprT1, _Imm11_);
}
else
{
xMOV(gprT2, ptr32[&curI]);
xSHL(gprT2, 21);
xSAR(gprT2, 21);
xADD(gprT1, gprT2);
}
mVUaddrFix(mVU, gprT1q); mVUaddrFix(mVU, gprT1q);
} }
@ -1251,12 +1333,23 @@ mVUop(mVU_LQ)
pass1 { mVUanalyzeLQ(mVU, _Ft_, _Is_, false); } pass1 { mVUanalyzeLQ(mVU, _Ft_, _Is_, false); }
pass2 pass2
{ {
const std::optional<xAddressVoid> optaddr(mVUoptimizeConstantAddr(mVU, _Is_, _Imm11_, 0)); const std::optional<xAddressVoid> optaddr(EmuConfig.Gamefixes.IbitHack ? std::nullopt : mVUoptimizeConstantAddr(mVU, _Is_, _Imm11_, 0));
if (!optaddr.has_value()) if (!optaddr.has_value())
{ {
mVU.regAlloc->moveVIToGPR(gprT1, _Is_); mVU.regAlloc->moveVIToGPR(gprT1, _Is_);
if (_Imm11_ != 0) if (!EmuConfig.Gamefixes.IbitHack)
xADD(gprT1, _Imm11_); {
if (_Imm11_ != 0)
xADD(gprT1, _Imm11_);
}
else
{
xMOV(gprT2, ptr32[&curI]);
xSHL(gprT2, 21);
xSAR(gprT2, 21);
xADD(gprT1, gprT2);
}
mVUaddrFix(mVU, gprT1q); mVUaddrFix(mVU, gprT1q);
} }
@ -1345,12 +1438,23 @@ mVUop(mVU_SQ)
pass1 { mVUanalyzeSQ(mVU, _Fs_, _It_, false); } pass1 { mVUanalyzeSQ(mVU, _Fs_, _It_, false); }
pass2 pass2
{ {
const std::optional<xAddressVoid> optptr(mVUoptimizeConstantAddr(mVU, _It_, _Imm11_, 0)); const std::optional<xAddressVoid> optptr(EmuConfig.Gamefixes.IbitHack ? std::nullopt : mVUoptimizeConstantAddr(mVU, _It_, _Imm11_, 0));
if (!optptr.has_value()) if (!optptr.has_value())
{ {
mVU.regAlloc->moveVIToGPR(gprT1, _It_); mVU.regAlloc->moveVIToGPR(gprT1, _It_);
if (_Imm11_ != 0) if (!EmuConfig.Gamefixes.IbitHack)
xADD(gprT1, _Imm11_); {
if (_Imm11_ != 0)
xADD(gprT1, _Imm11_);
}
else
{
xMOV(gprT2, ptr32[&curI]);
xSHL(gprT2, 21);
xSAR(gprT2, 21);
xADD(gprT1, gprT2);
}
mVUaddrFix(mVU, gprT1q); mVUaddrFix(mVU, gprT1q);
} }