Create constant for GPFifo physical address

This commit is contained in:
Pokechu22 2022-07-20 17:44:49 -07:00
parent b76f4dd5f8
commit 1c833ddc3c
5 changed files with 14 additions and 6 deletions

View File

@ -9,6 +9,10 @@ class PointerWrap;
namespace GPFifo namespace GPFifo
{ {
// This address is configurable in the WPAR SPR, but all games put it at this address
// (and presumably the hardware backing this system uses this address).
constexpr u32 GATHER_PIPE_PHYSICAL_ADDRESS = 0x0C008000;
constexpr u32 GATHER_PIPE_SIZE = 32; constexpr u32 GATHER_PIPE_SIZE = 32;
constexpr u32 GATHER_PIPE_EXTRA_SIZE = GATHER_PIPE_SIZE * 16; constexpr u32 GATHER_PIPE_EXTRA_SIZE = GATHER_PIPE_SIZE * 16;

View File

@ -13,6 +13,7 @@
#include "Common/BitUtils.h" #include "Common/BitUtils.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/HW/GPFifo.h"
#include "Core/HW/MMIOHandlers.h" #include "Core/HW/MMIOHandlers.h"
namespace MMIO namespace MMIO
@ -43,7 +44,7 @@ const u32 NUM_MMIOS = NUM_BLOCKS * BLOCK_SIZE;
// interface. // interface.
inline bool IsMMIOAddress(u32 address) inline bool IsMMIOAddress(u32 address)
{ {
if (address == 0x0C008000) if (address == GPFifo::GATHER_PIPE_PHYSICAL_ADDRESS)
return false; // WG Pipe return false; // WG Pipe
if ((address & 0xFFFF0000) == 0x0C000000) if ((address & 0xFFFF0000) == 0x0C000000)
return true; // GameCube MMIOs return true; // GameCube MMIOs

View File

@ -341,7 +341,8 @@ void Interpreter::mtspr(UGeckoInstruction inst)
break; break;
case SPR_WPAR: case SPR_WPAR:
ASSERT_MSG(POWERPC, rGPR[inst.RD] == 0x0C008000, "Gather pipe @ {:08x}", PC); ASSERT_MSG(POWERPC, rSPR(SPR_WPAR) == GPFifo::GATHER_PIPE_PHYSICAL_ADDRESS,
"Gather pipe changed to unexpected address {:08x} @ PC {:08x}", rSPR(SPR_WPAR), PC);
GPFifo::ResetGatherPipe(); GPFifo::ResetGatherPipe();
break; break;

View File

@ -285,7 +285,8 @@ static void WriteToHardware(u32 em_address, const u32 data, const u32 size)
// Check for a gather pipe write. // Check for a gather pipe write.
// Note that we must mask the address to correctly emulate certain games; // Note that we must mask the address to correctly emulate certain games;
// Pac-Man World 3 in particular is affected by this. // Pac-Man World 3 in particular is affected by this.
if (flag == XCheckTLBFlag::Write && (em_address & 0xFFFFF000) == 0x0C008000) if (flag == XCheckTLBFlag::Write &&
(em_address & 0xFFFFF000) == GPFifo::GATHER_PIPE_PHYSICAL_ADDRESS)
{ {
switch (size) switch (size)
{ {
@ -1086,7 +1087,7 @@ bool IsOptimizableGatherPipeWrite(u32 address)
return false; return false;
// Check whether the translated address equals the address in WPAR. // Check whether the translated address equals the address in WPAR.
return address == 0x0C008000; return address == GPFifo::GATHER_PIPE_PHYSICAL_ADDRESS;
} }
TranslateResult JitCache_TranslateAddress(u32 address) TranslateResult JitCache_TranslateAddress(u32 address)

View File

@ -8,6 +8,7 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Config/Config.h" #include "Common/Config/Config.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Core/HW/GPFifo.h"
#include "Core/HW/MMIO.h" #include "Core/HW/MMIO.h"
#include "UICommon/UICommon.h" #include "UICommon/UICommon.h"
@ -40,7 +41,7 @@ TEST(IsMMIOAddress, SpecialAddresses)
SConfig::GetInstance().bWii = true; SConfig::GetInstance().bWii = true;
// WG Pipe address, should not be handled by MMIO. // WG Pipe address, should not be handled by MMIO.
EXPECT_FALSE(MMIO::IsMMIOAddress(0x0C008000)); EXPECT_FALSE(MMIO::IsMMIOAddress(GPFifo::GATHER_PIPE_PHYSICAL_ADDRESS));
// Locked L1 cache allocation. // Locked L1 cache allocation.
EXPECT_FALSE(MMIO::IsMMIOAddress(0xE0000000)); EXPECT_FALSE(MMIO::IsMMIOAddress(0xE0000000));
@ -52,7 +53,7 @@ TEST(IsMMIOAddress, SpecialAddresses)
// addresses. // addresses.
EXPECT_FALSE(MMIO::IsMMIOAddress(0xCC0000E0)); EXPECT_FALSE(MMIO::IsMMIOAddress(0xCC0000E0));
// And lets check some valid addresses too // And let's check some valid addresses too
EXPECT_TRUE(MMIO::IsMMIOAddress(0x0C0000E0)); // GameCube MMIOs EXPECT_TRUE(MMIO::IsMMIOAddress(0x0C0000E0)); // GameCube MMIOs
EXPECT_TRUE(MMIO::IsMMIOAddress(0x0D00008C)); // Wii MMIOs EXPECT_TRUE(MMIO::IsMMIOAddress(0x0D00008C)); // Wii MMIOs
EXPECT_TRUE(MMIO::IsMMIOAddress(0x0D800F10)); // Mirror of Wii MMIOs EXPECT_TRUE(MMIO::IsMMIOAddress(0x0D800F10)); // Mirror of Wii MMIOs