Added a somewhat more accurate upscale option via GSdx.ini. Not tested much! :p

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2055 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
ramapcsx2 2009-10-21 22:57:20 +00:00
parent e4330ee0ee
commit fb2169f64d
4 changed files with 42 additions and 14 deletions

View File

@ -34,6 +34,11 @@ GSRenderer::GSRenderer()
m_filter = theApp.GetConfig("filter", 1);
m_vsync = !!theApp.GetConfig("vsync", 0);
m_nativeres = !!theApp.GetConfig("nativeres", 0);
m_accurateScaleMulti = theApp.GetConfig("accurateScaleMulti", 1);
if(m_nativeres) m_accurateScaleMulti = 1;
else if (m_accurateScaleMulti > 4) m_accurateScaleMulti = 1;
m_aa1 = !!theApp.GetConfig("aa1", 0);
m_blur = !!theApp.GetConfig("blur", 0);

View File

@ -41,6 +41,7 @@ protected:
int m_interlace;
int m_aspectratio;
int m_filter;
int m_accurateScaleMulti;
bool m_vsync;
bool m_nativeres;
bool m_aa1;
@ -88,6 +89,10 @@ public:
{
return !m_nativeres && m_regs->PMODE.EN != 0; // upscale ratio depends on the display size, with no output it may not be set correctly (ps2 logo to game transition)
}
virtual int accurateScaleMulti()
{
return m_accurateScaleMulti;
}
// TODO : Implement proper locking here *if needed* (not sure yet if it is) --air
uint8* GetTextureBufferLock() { return m_tex_buff; }

View File

@ -32,6 +32,7 @@ class GSRendererHW : public GSRendererT<Vertex>
{
int m_width;
int m_height;
int m_accurateScaleMulti;
int m_skip;
bool m_reset;
@ -709,6 +710,7 @@ public:
, m_tc(tc)
, m_width(1024)
, m_height(1024)
, m_accurateScaleMulti(1)
, m_skip(0)
, m_reset(false)
{
@ -716,6 +718,13 @@ public:
{
m_width = theApp.GetConfig("resx", m_width);
m_height = theApp.GetConfig("resy", m_height);
m_accurateScaleMulti = theApp.GetConfig("accurateScaleMulti", m_accurateScaleMulti);
if (m_accurateScaleMulti > 4) m_accurateScaleMulti = 1; //use the normal upscale math
if (m_accurateScaleMulti > 1)
{
m_width = 1024 * m_accurateScaleMulti;
m_height = 1024 * m_accurateScaleMulti;
}
}
}

View File

@ -172,24 +172,33 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int
if(m_renderer->CanUpscale())
{
GSVector4i fr = m_renderer->GetFrameRect();
int ww = (int)(fr.left + dst->m_TEX0.TBW * 64);
int hh = (int)(fr.top + m_renderer->GetDisplayRect().height());
if(hh <= m_renderer->GetDeviceSize().y / 2)
int multiplier = m_renderer->accurateScaleMulti();
if (multiplier > 1) //it's limited to a maximum of 4 on reading the config
{
hh *= 2;
dst->m_texture->SetScale(GSVector2((float)multiplier, (float)multiplier));
}
if(hh < 512 && m_renderer->m_context->SCISSOR.SCAY1 == 511) // vp2
else
{
hh = 512;
}
if(ww > 0 && hh > 0)
{
dst->m_texture->SetScale(GSVector2((float)w / ww, (float)h / hh));
GSVector4i fr = m_renderer->GetFrameRect();
int ww = (int)(fr.left + dst->m_TEX0.TBW * 64);
int hh = (int)(fr.top + m_renderer->GetDisplayRect().height());
if(hh <= m_renderer->GetDeviceSize().y / 2)
{
hh *= 2;
}
if(hh < 512 && m_renderer->m_context->SCISSOR.SCAY1 == 511) // vp2
{
hh = 512;
}
if(ww > 0 && hh > 0)
{
dst->m_texture->SetScale(GSVector2((float)w / ww, (float)h / hh));
}
}
}