summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Src/XFStructs.cpp
diff options
context:
space:
mode:
authorMatthew Parlane <parlane@gmail.com>2013-01-01 23:28:46 +1300
committerMatthew Parlane <parlane@gmail.com>2013-01-01 23:28:46 +1300
commite0c9a1fd09b9be953bf0ae41b9014485e750b07e (patch)
tree059744e17a2a35ca58dd9b817cab620faee38611 /Source/Core/VideoCommon/Src/XFStructs.cpp
parentfe1fdc5e7b957312c906324134e42ca3484fa2d5 (diff)
parentc728ef2cd30ef803210d5db0a1ecab6b198a2c65 (diff)
Merge branch 'master' into wii-network
Conflicts: Source/Core/Common/Src/CommonPaths.h Source/Core/Core/CMakeLists.txt Source/Core/Core/Src/Boot/Boot_BS2Emu.cpp Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp
Diffstat (limited to 'Source/Core/VideoCommon/Src/XFStructs.cpp')
-rw-r--r--Source/Core/VideoCommon/Src/XFStructs.cpp33
1 files changed, 23 insertions, 10 deletions
diff --git a/Source/Core/VideoCommon/Src/XFStructs.cpp b/Source/Core/VideoCommon/Src/XFStructs.cpp
index ec3975cb07..9f395bfecf 100644
--- a/Source/Core/VideoCommon/Src/XFStructs.cpp
+++ b/Source/Core/VideoCommon/Src/XFStructs.cpp
@@ -143,7 +143,7 @@ void XFRegWritten(int transferSize, u32 baseAddress, u32 *pData)
case XFMEM_SETNUMTEXGENS: // GXSetNumTexGens
if (xfregs.numTexGen.numTexGens != (newValue & 15))
- VertexManager::Flush();
+ VertexManager::Flush();
break;
case XFMEM_SETTEXMTXINFO:
@@ -257,13 +257,26 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
// TODO - verify that it is correct. Seems to work, though.
void LoadIndexedXF(u32 val, int refarray)
{
- int index = val >> 16;
- int address = val & 0xFFF; // check mask
- int size = ((val >> 12) & 0xF) + 1;
- //load stuff from array to address in xf mem
-
- XFMemWritten(size, address);
-
- for (int i = 0; i < size; i++)
- xfmem[address + i] = Memory::Read_U32(arraybases[refarray] + arraystrides[refarray] * index + i * 4);
+ int index = val >> 16;
+ int address = val & 0xFFF; // check mask
+ int size = ((val >> 12) & 0xF) + 1;
+ //load stuff from array to address in xf mem
+
+ u32* currData = (u32*)(xfmem + address);
+ u32* newData = (u32*)Memory::GetPointer(arraybases[refarray] + arraystrides[refarray] * index);
+ bool changed = false;
+ for (int i = 0; i < size; ++i)
+ {
+ if (currData[i] != Common::swap32(newData[i]))
+ {
+ changed = true;
+ XFMemWritten(size, address);
+ break;
+ }
+ }
+ if (changed)
+ {
+ for (int i = 0; i < size; ++i)
+ currData[i] = Common::swap32(newData[i]);
+ }
}