nice little hack to make efb copies scaled with the efb so everything will look a more HD, for now there is no GUI i'm with a lot of work at home. if everyone likes this change will add it to the GUI. for now just use the config file.

it brakes sms goop so in that game avoid this . test and let me know.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4696 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Rodolfo Osvaldo Bogado 2009-12-15 01:40:54 +00:00
parent 19f3ed11c7
commit 9c930f0825
6 changed files with 27 additions and 6 deletions

View File

@ -91,6 +91,7 @@ void VideoConfig::Load(const char *ini_file)
iniFile.Get("Hacks", "EFBCopyDisable", &bEFBCopyDisable, 0);
iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bOSDHotKey, 0);
iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToRAM, true);
iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true);
iniFile.Get("Hacks", "ProjectionHack", &iPhackvalue, 0);
iniFile.Get("Hardware", "Adapter", &iAdapter, 0);
@ -120,6 +121,8 @@ void VideoConfig::GameIniLoad(const char *ini_file)
iniFile.Get("Video", "EFBCopyDisableHotKey", &bOSDHotKey, 0);
if (iniFile.Exists("Video", "EFBToRAMEnable"))
iniFile.Get("Video", "EFBToRAMEnable", &bCopyEFBToRAM, 0);
if (iniFile.Exists("Video", "EFBScaledCopy"))
iniFile.Get("Video", "EFBScaledCopy", &bCopyEFBScaled, 0);
if (iniFile.Exists("Video", "SafeTextureCache"))
iniFile.Get("Video", "SafeTextureCache", &bSafeTextureCache, false);
if (iniFile.Exists("Video", "MSAA"))
@ -181,6 +184,7 @@ void VideoConfig::Save(const char *ini_file)
iniFile.Set("Hacks", "EFBCopyDisable", bEFBCopyDisable);
iniFile.Set("Hacks", "EFBCopyDisableHotKey", bOSDHotKey);
iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToRAM);
iniFile.Set("Hacks", "EFBScaledCopy", bCopyEFBScaled);
iniFile.Set("Hacks", "ProjectionHack", iPhackvalue);
iniFile.Set("Hardware", "Adapter", iAdapter);

View File

@ -109,6 +109,7 @@ struct VideoConfig
bool bOSDHotKey;
bool bHack;
bool bCopyEFBToRAM;
bool bCopyEFBScaled;
bool bSafeTextureCache;
int iPhackvalue;
bool bPhackvalue1, bPhackvalue2;

View File

@ -457,6 +457,11 @@ void SetTexture(DWORD Stage, LPDIRECT3DBASETEXTURE9 pTexture)
}
}
void RefreshRenderState(D3DRENDERSTATETYPE State)
{
D3D::dev->SetRenderState(State, m_RenderStates[State]);
}
void SetRenderState(D3DRENDERSTATETYPE State, DWORD Value)
{
if (m_RenderStates[State] != Value)

View File

@ -75,6 +75,7 @@ void ShowD3DError(HRESULT err);
// The following are "filtered" versions of the corresponding D3Ddev-> functions.
void SetTexture(DWORD Stage, IDirect3DBaseTexture9 *pTexture);
void SetRenderState(D3DRENDERSTATETYPE State, DWORD Value);
void RefreshRenderState(D3DRENDERSTATETYPE State);
void SetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value);
void RefreshSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type);
void SetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value);

View File

@ -451,12 +451,15 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo
int tex_w = (abs(source_rect.GetWidth()) >> bScaleByHalf);
int tex_h = (abs(source_rect.GetHeight()) >> bScaleByHalf);
int Scaledtex_w = (g_ActiveConfig.bCopyEFBScaled)?((int)(Renderer::GetTargetScaleX() * tex_w)):tex_w;
int Scaledtex_h = (g_ActiveConfig.bCopyEFBScaled)?((int)(Renderer::GetTargetScaleY() * tex_h)):tex_h;
TexCache::iterator iter;
LPDIRECT3DTEXTURE9 tex;
iter = textures.find(address);
if (iter != textures.end())
{
if (iter->second.isRenderTarget && iter->second.w == tex_w && iter->second.h == tex_h)
if (iter->second.isRenderTarget && iter->second.Scaledw == Scaledtex_w && iter->second.Scaledh == Scaledtex_h)
{
tex = iter->second.texture;
@ -479,9 +482,11 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo
entry.frameCount = frameCount;
entry.w = tex_w;
entry.h = tex_h;
entry.Scaledw = Scaledtex_w;
entry.Scaledh = Scaledtex_h;
entry.fmt = copyfmt;
D3D::dev->CreateTexture(tex_w, tex_h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &entry.texture, 0);
D3D::dev->CreateTexture(Scaledtex_w, Scaledtex_h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &entry.texture, 0);
textures[address] = entry;
tex = entry.texture;
}
@ -610,15 +615,15 @@ have_texture:
// Stretch picture with increased internal resolution
vp.X = 0;
vp.Y = 0;
vp.Width = tex_w;
vp.Height = tex_h;
vp.Width = Scaledtex_w;
vp.Height = Scaledtex_h;
vp.MinZ = 0.0f;
vp.MaxZ = 1.0f;
D3D::dev->SetViewport(&vp);
RECT destrect;
destrect.bottom = tex_h;
destrect.bottom = Scaledtex_h;
destrect.left = 0;
destrect.right = tex_w;
destrect.right = Scaledtex_w;
destrect.top = 0;

View File

@ -40,6 +40,7 @@ public:
int frameCount;
int w, h, fmt;
int Scaledw, Scaledh;
float scaleX, scaleY; // Hires texutres need this
@ -59,6 +60,10 @@ public:
scaleX = 1.0f;
scaleY = 1.0f;
isNonPow2 = true;
w = 0;
h = 0;
Scaledw = 0;
Scaledh = 0;
}
void Destroy(bool shutdown);
bool IntersectsMemoryRange(u32 range_address, u32 range_size);