Migrated a stop-fixing patch to DX9. Stopping works!

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2568 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
XTra.KrazzY 2009-03-06 16:47:04 +00:00
parent 3abe591195
commit e8556a5391
4 changed files with 11 additions and 11 deletions

View File

@ -219,6 +219,6 @@ void DlgSettings_Show(HINSTANCE hInstance, HWND _hParent)
if(( tfoe != g_Config.bTexFmtOverlayEnable) || if(( tfoe != g_Config.bTexFmtOverlayEnable) ||
((g_Config.bTexFmtOverlayEnable) && ( tfoc != g_Config.bTexFmtOverlayCenter))) ((g_Config.bTexFmtOverlayEnable) && ( tfoc != g_Config.bTexFmtOverlayCenter)))
{ {
TextureCache::Invalidate(); TextureCache::Invalidate(false);
} }
} }

View File

@ -38,12 +38,12 @@ extern int frameCount;
#define TEMP_SIZE (1024*1024*4) #define TEMP_SIZE (1024*1024*4)
void TextureCache::TCacheEntry::Destroy() void TextureCache::TCacheEntry::Destroy(bool shutdown)
{ {
if (texture) if (texture)
texture->Release(); texture->Release();
texture = 0; texture = 0;
if (!isRenderTarget) { if (!isRenderTarget && !shutdown) {
u32 *ptr = (u32*)g_VideoInitialize.pGetMemoryPointer(addr + hashoffset*4); u32 *ptr = (u32*)g_VideoInitialize.pGetMemoryPointer(addr + hashoffset*4);
if (*ptr == hash) if (*ptr == hash)
*ptr = oldpixel; *ptr = oldpixel;
@ -56,18 +56,18 @@ void TextureCache::Init()
TexDecoder_SetTexFmtOverlayOptions(g_Config.bTexFmtOverlayEnable, g_Config.bTexFmtOverlayCenter); TexDecoder_SetTexFmtOverlayOptions(g_Config.bTexFmtOverlayEnable, g_Config.bTexFmtOverlayCenter);
} }
void TextureCache::Invalidate() void TextureCache::Invalidate(bool shutdown)
{ {
TexCache::iterator iter = textures.begin(); TexCache::iterator iter = textures.begin();
for (; iter != textures.end(); iter++) for (; iter != textures.end(); iter++)
iter->second.Destroy(); iter->second.Destroy(shutdown);
textures.clear(); textures.clear();
TexDecoder_SetTexFmtOverlayOptions(g_Config.bTexFmtOverlayEnable, g_Config.bTexFmtOverlayCenter); TexDecoder_SetTexFmtOverlayOptions(g_Config.bTexFmtOverlayEnable, g_Config.bTexFmtOverlayCenter);
} }
void TextureCache::Shutdown() void TextureCache::Shutdown()
{ {
Invalidate(); Invalidate(true);
if (temp != NULL) if (temp != NULL)
{ {
@ -86,7 +86,7 @@ void TextureCache::Cleanup()
{ {
if (!iter->second.isRenderTarget) if (!iter->second.isRenderTarget)
{ {
iter->second.Destroy(); iter->second.Destroy(false);
iter = textures.erase(iter); iter = textures.erase(iter);
} }
else else
@ -162,7 +162,7 @@ void TextureCache::Load(int stage, u32 address, int width, int height, int forma
} }
else else
{*/ {*/
iter->second.Destroy(); iter->second.Destroy(false);
textures.erase(iter); textures.erase(iter);
//} //}
} }

View File

@ -43,7 +43,7 @@ class TextureCache
isRenderTarget=0; isRenderTarget=0;
hash=0; hash=0;
} }
void Destroy(); void Destroy(bool shutdown);
}; };
@ -56,7 +56,7 @@ public:
static void Init(); static void Init();
static void Cleanup(); static void Cleanup();
static void Shutdown(); static void Shutdown();
static void Invalidate(); static void Invalidate(bool shutdown);
static void Load(int stage, u32 address, int width, int height, int format, int tlutaddr, int tlutfmt); static void Load(int stage, u32 address, int width, int height, int format, int tlutaddr, int tlutfmt);
static void CopyEFBToRenderTarget(u32 address, RECT *source); static void CopyEFBToRenderTarget(u32 address, RECT *source);
}; };

View File

@ -192,7 +192,7 @@ void Initialize(void *init)
void DoState(unsigned char **ptr, int mode) { void DoState(unsigned char **ptr, int mode) {
// Clear all caches // Clear all caches
TextureCache::Invalidate(); TextureCache::Invalidate(false);
PointerWrap p(ptr, mode); PointerWrap p(ptr, mode);
VideoCommon_DoState(p); VideoCommon_DoState(p);