From c86fc2c9b9d8e15350ce097f6ce69cbf1751b5d8 Mon Sep 17 00:00:00 2001 From: ramapcsx2 Date: Sun, 20 Dec 2009 02:50:34 +0000 Subject: [PATCH] GSdx: - Added a macro that disables any upscale hacks. - More work on the dx10 renderer upscale hacks. PCSX2: - Changed a warning so it reads more like a notice :p git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2366 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/gui/i18n.cpp | 5 ++- plugins/GSdx/GSRenderer.cpp | 2 - plugins/GSdx/GSRendererDX10.cpp | 72 ++++++++++++++++++--------------- plugins/GSdx/GSTextureCache.cpp | 16 ++++++++ plugins/GSdx/GSVector.cpp | 7 ++++ plugins/GSdx/stdafx.h | 2 + 6 files changed, 68 insertions(+), 36 deletions(-) diff --git a/pcsx2/gui/i18n.cpp b/pcsx2/gui/i18n.cpp index 38269d617b..c6b791b24d 100644 --- a/pcsx2/gui/i18n.cpp +++ b/pcsx2/gui/i18n.cpp @@ -168,9 +168,10 @@ bool i18n_SetLanguage( int wxLangId ) if( !IsEnglish(wxLangId) && !locale->AddCatalog( L"pcsx2main" ) ) { - Console.Warning( L"SetLanguage: Cannot find pcsx2main.mo file for language '%s' [%s]", + /*Console.Warning( L"SetLanguage: Cannot find pcsx2main.mo file for language '%s' [%s]", wxLocale::GetLanguageName( locale->GetLanguage() ).c_str(), locale->GetCanonicalName().c_str() - ); + );*/ + Console.Warning("SetLanguage is not implemented yet, using English."); return false; } diff --git a/plugins/GSdx/GSRenderer.cpp b/plugins/GSdx/GSRenderer.cpp index 59c23ab8fe..4835a7f24b 100644 --- a/plugins/GSdx/GSRenderer.cpp +++ b/plugins/GSdx/GSRenderer.cpp @@ -222,8 +222,6 @@ bool GSRenderer::Merge(int field) { r += GSVector4i(0, 1).xyxy(); } - - r += GSVector4i(1, 1, -1, -1); //crop a few of the outermost pixels, which are often buggy. GSVector4 scale = GSVector4(tex[i]->GetScale()).xyxy(); diff --git a/plugins/GSdx/GSRendererDX10.cpp b/plugins/GSdx/GSRendererDX10.cpp index 6e6ec04901..d1c47e08ce 100644 --- a/plugins/GSdx/GSRendererDX10.cpp +++ b/plugins/GSdx/GSRendererDX10.cpp @@ -46,6 +46,7 @@ void GSRendererDX10::VertexKick(bool skip) dst.vi[0] = m_v.vi[0]; dst.vi[1] = m_v.vi[1]; +#ifdef USE_UPSCALE_HACKS if(tme && fst) { //GSVector4::storel(&dst.ST, m_v.GetUV()); @@ -57,49 +58,56 @@ void GSRendererDX10::VertexKick(bool skip) if (multiplier > 1) { + Udiff = m_v.UV.U & 4095; + Vdiff = m_v.UV.V & 4095; + if (Udiff != 0){ + if (Udiff >= 4080) {/*printf("U+ %d %d\n", Udiff, m_v.UV.U);*/ Uadjust = -1; } + else if (Udiff <= 16) {/*printf("U- %d %d\n", Udiff, m_v.UV.U);*/ Uadjust = 1; } + } + if (Vdiff != 0){ + if (Vdiff >= 4080) {/*printf("V+ %d %d\n", Vdiff, m_v.UV.V);*/ Vadjust = -1; } + else if (Vdiff <= 16) {/*printf("V- %d %d\n", Vdiff, m_v.UV.V);*/ Vadjust = 1; } + } + Udiff = m_v.UV.U & 255; Vdiff = m_v.UV.V & 255; - if (Udiff != 0){ - if (Udiff > 247) Uadjust = -1; //Mana Khemia 2 - else if (Udiff < 9) Uadjust = 1; //Ar Tonelico 2 - else - { - //float jaja = (float)m_v.UV.U / (float)(m_context->TEX0.TW*64); - //int test = (int)jaja ; - //float result = jaja-(float)test; - // - //if (result < 0.031251f || m_v.UV.U == 272 || m_v.UV.U == 400){ - // Uadjust = 16; //Wild Arms Engine, still problems with Odin Sphere - //} - //else - Uadjust = 0; - } + if (Udiff >= 248) { Uadjust = -1; } + else if (Udiff <= 8) { Uadjust = 1; } } - else Uadjust = 0; if (Vdiff != 0){ - if (Vdiff > 247) Vadjust = -1; - else if (Vdiff < 9) Vadjust = 1; - else - { - //float jaja = (float)m_v.UV.V / (float)(m_context->TEX0.TH*64); - //int test = (int)jaja ; - //float result = jaja-(float)test; - // - //if (result < 0.031251f || m_v.UV.V == 272 || m_v.UV.V == 400){ - // Vadjust = 16; //Wild Arms Engine, still problems with Odin Sphere - //} - //else - Vadjust = 0; - } + if (Vdiff >= 248) { Vadjust = -1; } + else if (Vdiff <= 8) { Vadjust = 1; } + } + + Udiff = m_v.UV.U & 15; + Vdiff = m_v.UV.V & 15; + if (Udiff != 0){ + if (Udiff >= 15) { Uadjust = -1; } + else if (Udiff <= 1) { Uadjust = 1; } + } + + if (Vdiff != 0){ + if (Vdiff >= 15) { Vadjust = -1; } + else if (Vdiff <= 1) { Vadjust = 1; } } - else Vadjust = 0; } dst.ST.S = (float)m_v.UV.U - Uadjust; dst.ST.T = (float)m_v.UV.V - Vadjust; - } + else if (tme) + { + // Wip :p + //dst.XYZ.X += 5; + //dst.XYZ.Y += 5; + } +#else + if(tme && fst) + { + GSVector4::storel(&dst.ST, m_v.GetUV()); + } +#endif int count = 0; diff --git a/plugins/GSdx/GSTextureCache.cpp b/plugins/GSdx/GSTextureCache.cpp index 59c189e764..321e3dc191 100644 --- a/plugins/GSdx/GSTextureCache.cpp +++ b/plugins/GSdx/GSTextureCache.cpp @@ -624,6 +624,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con GSVector4 dr(0, 0, w, h); +#ifdef USE_UPSCALE_HACKS float multiplier = (float) m_renderer->upscale_Multiplier()-1; //dr += a few pixels, to fight blur/brightness layers beeing more offset the more we upscale if(w > dstsize.x) @@ -643,7 +644,22 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con dr += GSVector4 (0.0f, 0.25f*multiplier, 0.0f, 0.25f*multiplier); } else dr += GSVector4 (0.0f, 0.5f*multiplier, 0.0f, 0.5f*multiplier); +#else + if(w > dstsize.x) + { + scale.x = (float)dstsize.x / tw; + dr.z = (float)dstsize.x * scale.x / dst->m_texture->GetScale().x; + w = dstsize.x; + } + if(h > dstsize.y) + { + scale.y = (float)dstsize.y / th; + dr.w = (float)dstsize.y * scale.y / dst->m_texture->GetScale().y; + h = dstsize.y; + } +#endif + GSVector4 sr(0, 0, w, h); GSTexture* st = src->m_texture ? src->m_texture : dst->m_texture; diff --git a/plugins/GSdx/GSVector.cpp b/plugins/GSdx/GSVector.cpp index d7f6e7ec77..6d7b47f994 100644 --- a/plugins/GSdx/GSVector.cpp +++ b/plugins/GSdx/GSVector.cpp @@ -96,5 +96,12 @@ GSVector4i GSVector4i::fit(int preset) const r = *this; } +#ifdef USE_UPSCALE_HACKS //don't show outermost pixels, they're often buggy + r.x-=1; + r.y-=1; + r.z+=1; + r.w+=1; +#endif + return r; } diff --git a/plugins/GSdx/stdafx.h b/plugins/GSdx/stdafx.h index 81cd131dff..bcaf3afd33 100644 --- a/plugins/GSdx/stdafx.h +++ b/plugins/GSdx/stdafx.h @@ -123,6 +123,8 @@ typedef signed long long int64; #define D3DCOLORWRITEENABLE_RGBA (D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_ALPHA) +#define USE_UPSCALE_HACKS //Hacks intended to fix upscaling / rendering glitches in HW renderers + // dxsdk beta missing these: #define D3D11_SHADER_MACRO D3D10_SHADER_MACRO #define ID3D11Blob ID3D10Blob