summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/XFStructs.cpp
diff options
context:
space:
mode:
authorPokechu22 <Pokechu022@gmail.com>2021-04-22 20:57:56 -0700
committerPokechu22 <Pokechu022@gmail.com>2021-12-18 15:21:36 -0800
commitb5fd35f95145ecc8f88a179229ed69b390eb76be (patch)
tree7b6700d35c609ba6a43fcdf55a12d6756e9a206b /Source/Core/VideoCommon/XFStructs.cpp
parent04418262063bf6034bc2be172a64eb99a9e9a2bb (diff)
Refactor OpcodeDecoding and FIFO analyzer to use callbacks
Diffstat (limited to 'Source/Core/VideoCommon/XFStructs.cpp')
-rw-r--r--Source/Core/VideoCommon/XFStructs.cpp29
1 files changed, 6 insertions, 23 deletions
diff --git a/Source/Core/VideoCommon/XFStructs.cpp b/Source/Core/VideoCommon/XFStructs.cpp
index c31b8cbb54..65ebd548b8 100644
--- a/Source/Core/VideoCommon/XFStructs.cpp
+++ b/Source/Core/VideoCommon/XFStructs.cpp
@@ -264,19 +264,9 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, DataReader src)
}
}
-constexpr std::tuple<u32, u32, u32> ExtractIndexedXF(u32 val)
-{
- const u32 index = val >> 16;
- const u32 address = val & 0xFFF; // check mask
- const u32 size = ((val >> 12) & 0xF) + 1;
-
- return {index, address, size};
-}
-
// TODO - verify that it is correct. Seems to work, though.
-void LoadIndexedXF(CPArray array, u32 val)
+void LoadIndexedXF(CPArray array, u32 index, u16 address, u8 size)
{
- const auto [index, address, size] = ExtractIndexedXF(val);
// load stuff from array to address in xf mem
u32* currData = (u32*)(&xfmem) + address;
@@ -307,10 +297,8 @@ void LoadIndexedXF(CPArray array, u32 val)
}
}
-void PreprocessIndexedXF(CPArray array, u32 val)
+void PreprocessIndexedXF(CPArray array, u32 index, u16 address, u8 size)
{
- const auto [index, address, size] = ExtractIndexedXF(val);
-
const u8* new_data = Memory::GetPointer(g_preprocess_cp_state.array_bases[array] +
g_preprocess_cp_state.array_strides[array] * index);
@@ -581,13 +569,9 @@ std::string GetXFMemDescription(u32 address, u32 value)
}
}
-std::pair<std::string, std::string> GetXFTransferInfo(const u8* data)
+std::pair<std::string, std::string> GetXFTransferInfo(u16 base_address, u8 transfer_size,
+ const u8* data)
{
- const u32 cmd = Common::swap32(data);
- data += 4;
- u32 base_address = cmd & 0xFFFF;
- const u32 transfer_size = ((cmd >> 16) & 15) + 1;
-
if (base_address > XFMEM_REGISTERS_END)
{
return std::make_pair("Invalid XF Transfer", "Base address past end of address space");
@@ -655,10 +639,9 @@ std::pair<std::string, std::string> GetXFTransferInfo(const u8* data)
return std::make_pair(fmt::to_string(name), fmt::to_string(desc));
}
-std::pair<std::string, std::string> GetXFIndexedLoadInfo(CPArray array, u32 value)
+std::pair<std::string, std::string> GetXFIndexedLoadInfo(CPArray array, u32 index, u16 address,
+ u8 size)
{
- const auto [index, address, size] = ExtractIndexedXF(value);
-
const auto desc = fmt::format("Load {} bytes to XF address {:03x} from CP array {} row {}", size,
address, array, index);
fmt::memory_buffer written;