Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slightly more correct loads behavior. #1663

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/core/psxinterpreter.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/***************************************************************************

Check notice on line 1 in src/core/psxinterpreter.cc

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

✅ Getting better: Code Duplication

reduced similar code in: InterpretedCPU::psxSW. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.
* Copyright (C) 2023 PCSX-Redux authors *
* *
* This program is free software; you can redistribute it and/or modify *
Expand Down Expand Up @@ -857,6 +857,7 @@
void InterpretedCPU::psxLB(uint32_t code) {
// load delay = 1 latency
if (_Rt_) {
maybeCancelDelayedLoad(_Rt_);
_i32(delayedLoadRef(_Rt_)) = (int8_t)PCSX::g_emulator->m_mem->read8(_oB_);
} else {
PCSX::g_emulator->m_mem->read8(_oB_);
Expand All @@ -866,6 +867,7 @@
void InterpretedCPU::psxLBU(uint32_t code) {
// load delay = 1 latency
if (_Rt_) {
maybeCancelDelayedLoad(_Rt_);
_u32(delayedLoadRef(_Rt_)) = PCSX::g_emulator->m_mem->read8(_oB_);
} else {
PCSX::g_emulator->m_mem->read8(_oB_);
Expand All @@ -883,6 +885,7 @@
}

if (_Rt_) {
maybeCancelDelayedLoad(_Rt_);
_i32(delayedLoadRef(_Rt_)) = (short)PCSX::g_emulator->m_mem->read16(_oB_);
} else {
PCSX::g_emulator->m_mem->read16(_oB_);
Expand All @@ -900,6 +903,7 @@
}

if (_Rt_) {
maybeCancelDelayedLoad(_Rt_);
_u32(delayedLoadRef(_Rt_)) = PCSX::g_emulator->m_mem->read16(_oB_);
} else {
PCSX::g_emulator->m_mem->read16(_oB_);
Expand All @@ -918,6 +922,7 @@

uint32_t val = PCSX::g_emulator->m_mem->read32(_oB_);
if (_Rt_) {
maybeCancelDelayedLoad(_Rt_);
switch (_Rt_) {
case 29:
PCSX::g_emulator->m_callStacks->setSP(m_regs.GPR.n.sp, val);
Expand Down
Loading