From a2a711b1b3e2519fc18f8ea809d8e679a1ae8cd7 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Wed, 17 Jul 2024 14:28:15 +0300 Subject: [PATCH] Bios: add support for Rom2 up to 4Mb --- pcsx2/IopMem.cpp | 22 +++++++++++----------- pcsx2/MemoryTypes.h | 2 +- pcsx2/x86/ix86-32/iR5900.cpp | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pcsx2/IopMem.cpp b/pcsx2/IopMem.cpp index abd7259a25..16889bfcb1 100644 --- a/pcsx2/IopMem.cpp +++ b/pcsx2/IopMem.cpp @@ -39,18 +39,18 @@ void iopMemRelease() // which is performed by MemInit and PsxMemInit() void iopMemReset() { - pxAssert( iopMem ); + pxAssert(iopMem); DbgCon.WriteLn("IOP resetting main memory..."); - memset(psxMemWLUT, 0, 0x2000 * sizeof(uptr) * 2); // clears both allocations, RLUT and WLUT + memset(psxMemWLUT, 0, 0x2000 * sizeof(uptr) * 2); // clears both allocations, RLUT and WLUT // Trick! We're accessing RLUT here through WLUT, since it's the non-const pointer. // So the ones with a 0x2000 prefixed are RLUT tables. // Map IOP main memory, which is Read/Write, and mirrored three times // at 0x0, 0x8000, and 0xa000: - for (int i=0; i<0x0080; i++) + for (int i = 0; i < 0x0080; i++) { psxMemWLUT[i + 0x0000] = (uptr)&iopMem->Main[(i & 0x1f) << 16]; @@ -78,7 +78,7 @@ void iopMemReset() psxMemWLUT[i + 0x2000 + 0x1e00] = (uptr)&eeMem->ROM1[i << 16]; } - for (int i = 0; i < 0x0008; i++) + for (int i = 0; i < 0x0040; i++) { psxMemWLUT[i + 0x2000 + 0x1e40] = (uptr)&eeMem->ROM2[i << 16]; } @@ -318,7 +318,7 @@ void iopMemWrite16(u32 mem, u16 value) default: psxHu16(mem) = value; - break; + break; } } else { @@ -443,7 +443,7 @@ void iopMemWrite32(u32 mem, u32 value) case 0x60: psHu32(SBUS_F260) = 0; - return; + return; } #if PSX_EXTRALOGS @@ -529,11 +529,11 @@ bool iopMemSafeWriteBytes(u32 mem, const void* src, u32 size) std::string iopMemReadString(u32 mem, int maxlen) { - std::string ret; - char c; + std::string ret; + char c; - while ((c = iopMemRead8(mem++)) && maxlen--) - ret.push_back(c); + while ((c = iopMemRead8(mem++)) && maxlen--) + ret.push_back(c); - return ret; + return ret; } diff --git a/pcsx2/MemoryTypes.h b/pcsx2/MemoryTypes.h index e6fa985956..53be6f9fd4 100644 --- a/pcsx2/MemoryTypes.h +++ b/pcsx2/MemoryTypes.h @@ -11,7 +11,7 @@ namespace Ps2MemSize static constexpr u32 TotalRam = _1mb * 128;// 128 MB total memory. static constexpr u32 Rom = _1mb * 4; // 4 MB main rom static constexpr u32 Rom1 = _1mb * 4; // DVD player - static constexpr u32 Rom2 = 0x00080000; // Chinese rom extension + static constexpr u32 Rom2 = _1mb * 4; // Chinese rom extension static constexpr u32 Hardware = _64kb; static constexpr u32 Scratch = _16kb; diff --git a/pcsx2/x86/ix86-32/iR5900.cpp b/pcsx2/x86/ix86-32/iR5900.cpp index db549f717c..4d3e112a64 100644 --- a/pcsx2/x86/ix86-32/iR5900.cpp +++ b/pcsx2/x86/ix86-32/iR5900.cpp @@ -548,7 +548,7 @@ static void recReserveRAM() recLUT_SetPage(recLUT, hwLUT, recROM1, 0xa000, i, i - 0x1e00); } - for (int i = 0x1e40; i < 0x1e48; i++) + for (int i = 0x1e40; i < 0x1e80; i++) { recLUT_SetPage(recLUT, hwLUT, recROM2, 0x0000, i, i - 0x1e40); recLUT_SetPage(recLUT, hwLUT, recROM2, 0x8000, i, i - 0x1e40); @@ -691,7 +691,7 @@ static void recExecute() if (!fastjmp_set(&m_SetJmp_StateCheck)) { eeCpuExecuting = true; - ((void(*)())EnterRecompiledCode)(); + ((void (*)())EnterRecompiledCode)(); // Generally unreachable code here ... } @@ -1544,7 +1544,7 @@ void dynarecMemcheck(size_t i) auto mc = CBreakPoints::GetMemChecks(BREAKPOINT_EE)[i]; - if(mc.hasCond) + if (mc.hasCond) { if (!mc.cond.Evaluate()) return; @@ -1557,7 +1557,7 @@ void dynarecMemcheck(size_t i) else DevCon.WriteLn("Hit load breakpoint @0x%x", cpuRegs.pc); } - + CBreakPoints::SetBreakpointTriggered(true, BREAKPOINT_EE); VMManager::SetPaused(true); recExitExecution();