summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorhrydgard <hrydgard@gmail.com>2010-05-02 14:05:14 +0000
committerhrydgard <hrydgard@gmail.com>2010-05-02 14:05:14 +0000
commit66ffa3b04590ced0dff0fde1bdc12d572e5de4bd (patch)
treeb8a0a43d3f1ad2a507eb8b49417ad7f622014d10 /Source
parent533162b41ffaf7efc5c2907b9c940752f7f53d06 (diff)
Commit durante_d3dhiresfix.patch. should finally fix rb swap when loading hires replacement textures in the d3d plugin.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5428 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source')
-rw-r--r--Source/Plugins/Plugin_VideoDX9/Src/D3DTexture.cpp25
-rw-r--r--Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp2
2 files changed, 21 insertions, 6 deletions
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/D3DTexture.cpp b/Source/Plugins/Plugin_VideoDX9/Src/D3DTexture.cpp
index 712ea5c6eb..2f4f69b071 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/D3DTexture.cpp
+++ b/Source/Plugins/Plugin_VideoDX9/Src/D3DTexture.cpp
@@ -110,11 +110,26 @@ LPDIRECT3DTEXTURE9 CreateTexture2D(const u8* buffer, const int width, const int
else
{*/
u32* pIn = pBuffer;
- for (int y = 0; y < height; y++)
- {
- u32* pBits = (u32*)((u8*)Lock.pBits + (y * Lock.Pitch));
- memcpy(pBits, pIn, width * 4);
- pIn += pitch;
+ if (!swap_r_b) {
+ for (int y = 0; y < height; y++)
+ {
+ u32 *pBits = (u32*)((u8*)Lock.pBits + (y * Lock.Pitch));
+ memcpy(pBits, pIn, width * 4);
+ pIn += pitch;
+ }
+ } else {
+ for (int y = 0; y < height; y++)
+ {
+ u8 *pIn8 = (u8 *)pIn;
+ u8 *pBits = (u8 *)((u8*)Lock.pBits + (y * Lock.Pitch));
+ for (int x = 0; x < width * 4; x += 4) {
+ pBits[x + 0] = pIn8[x + 2];
+ pBits[x + 1] = pIn8[x + 1];
+ pBits[x + 2] = pIn8[x + 0];
+ pBits[x + 3] = pIn8[x + 3];
+ }
+ pIn += pitch;
+ }
}
//}
}
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp
index b41417fcec..a0f3b30d5a 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp
+++ b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp
@@ -288,7 +288,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
TexLevels = maxlevel;
if (!skip_texture_create)
{
- entry.texture = D3D::CreateTexture2D((BYTE*)temp, width, height, expandedWidth, d3d_fmt, swap_r_b,TexLevels);
+ entry.texture = D3D::CreateTexture2D((BYTE*)temp, width, height, expandedWidth, d3d_fmt, swap_r_b, TexLevels);
}
else
{