From a1507e60447f6d8fa57c2633275f050ab0f0c9a2 Mon Sep 17 00:00:00 2001 From: gabest11 Date: Fri, 15 May 2009 07:48:51 +0000 Subject: [PATCH] GSdx: this should fix d3d9 mode and the aspect ratio bug git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1191 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/GSdx/GSLocalMemory.cpp | 2 +- plugins/GSdx/GSTexture9.cpp | 5 ++++- plugins/GSdx/GSTextureCache.h | 3 ++- plugins/GSdx/GSVector.cpp | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/GSdx/GSLocalMemory.cpp b/plugins/GSdx/GSLocalMemory.cpp index 5e1ab20d09..0d4605b566 100644 --- a/plugins/GSdx/GSLocalMemory.cpp +++ b/plugins/GSdx/GSLocalMemory.cpp @@ -28,7 +28,7 @@ #include "GSLocalMemory.h" #define ASSERT_BLOCK(r, w, h) \ - ASSERT((r).Width() >= w && (r).Height() >= h && !((r).left&(w-1)) && !((r).top&(h-1)) && !((r).right&(w-1)) && !((r).bottom&(h-1))); \ + ASSERT((r).width() >= w && (r).height() >= h && !((r).left&(w-1)) && !((r).top&(h-1)) && !((r).right&(w-1)) && !((r).bottom&(h-1))); \ #define FOREACH_BLOCK_START(w, h, bpp) \ uint32 bp = TEX0.TBP0; \ diff --git a/plugins/GSdx/GSTexture9.cpp b/plugins/GSdx/GSTexture9.cpp index bbb42e0420..e0eaa212b6 100644 --- a/plugins/GSdx/GSTexture9.cpp +++ b/plugins/GSdx/GSTexture9.cpp @@ -94,7 +94,10 @@ bool GSTexture9::Update(const GSVector4i& r, const void* data, int pitch) uint8* src = (uint8*)data; uint8* dst = (uint8*)lr.pBits; - int bytes = min(pitch, lr.Pitch); + int bytes = r.width() << (m_desc.Format == D3DFMT_A1R5G5B5 ? 1 : 2); + + bytes = min(bytes, pitch); + bytes = min(bytes, lr.Pitch); for(int i = 0, j = r.height(); i < j; i++, src += pitch, dst += lr.Pitch) { diff --git a/plugins/GSdx/GSTextureCache.h b/plugins/GSdx/GSTextureCache.h index d409d54f30..282e0b18ca 100644 --- a/plugins/GSdx/GSTextureCache.h +++ b/plugins/GSdx/GSTextureCache.h @@ -224,7 +224,8 @@ public: m_valid = m_valid.runion(r); static uint8* bits = (uint8*)::_aligned_malloc(1024 * 1024 * 4, 16); - static int pitch = 1024 * 4; + + int pitch = ((r.width() + 3) & ~3) * 4; if(m_renderer->m_psrr) { diff --git a/plugins/GSdx/GSVector.cpp b/plugins/GSdx/GSVector.cpp index 206fa163b9..1256e96a6f 100644 --- a/plugins/GSdx/GSVector.cpp +++ b/plugins/GSdx/GSVector.cpp @@ -58,7 +58,7 @@ GSVector4i GSVector4i::fit(int arx, int ary) const if(w * ary > h * arx) { - int w2 = w * arx / ary; + int w2 = h * arx / ary; r.left = (r.left + r.right - w2) >> 1; if(r.left & 1) r.left++; r.right = r.left + w2;