From ccbc1feb0bc7c63cb6c06434d4d0620bef3ac67e Mon Sep 17 00:00:00 2001 From: hrydgard Date: Sat, 19 Jun 2010 16:22:24 +0000 Subject: D3D9: Fix issue where the shader caches were lost whenever the render window was resized. Add some error logging to LinearDiskCache. + some minor cleanup. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5747 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/LinearDiskCache.cpp | 27 +++++++++++++++++++++++---- Source/Core/VideoCommon/Src/Render.h | 2 -- 2 files changed, 23 insertions(+), 6 deletions(-) (limited to 'Source/Core') diff --git a/Source/Core/Common/Src/LinearDiskCache.cpp b/Source/Core/Common/Src/LinearDiskCache.cpp index 372628d4da..e5f3fb1d32 100644 --- a/Source/Core/Common/Src/LinearDiskCache.cpp +++ b/Source/Core/Common/Src/LinearDiskCache.cpp @@ -46,6 +46,11 @@ bool LinearDiskCache::ValidateHeader() { } int LinearDiskCache::OpenAndRead(const char *filename, LinearDiskCacheReader *reader) { + if (file_) + { + ERROR_LOG(VIDEO, "LinearDiskCache trying to open an alredy opened cache"); + return 0; + } int items_read_count = 0; file_ = fopen(filename, "rb"); int file_size = 0; @@ -143,11 +148,25 @@ void LinearDiskCache::Append( } void LinearDiskCache::Sync() { - fflush(file_); + if (file_) + { + fflush(file_); + } + else + { + ERROR_LOG(VIDEO, "LinearDiskCache trying to sync closed cache"); + } } void LinearDiskCache::Close() { - fclose(file_); - file_ = 0; - num_entries_ = 0; + if (file_) + { + fclose(file_); + file_ = 0; + num_entries_ = 0; + } + else + { + ERROR_LOG(VIDEO, "LinearDiskCache trying to close an alredy closed cache"); + } } diff --git a/Source/Core/VideoCommon/Src/Render.h b/Source/Core/VideoCommon/Src/Render.h index 37350e08c4..31127fdeb7 100644 --- a/Source/Core/VideoCommon/Src/Render.h +++ b/Source/Core/VideoCommon/Src/Render.h @@ -49,8 +49,6 @@ public: static void ResetAPIState(); static void RestoreAPIState(); - static void ReinitView(); - static void SetColorMask(); static void SetBlendMode(bool forceUpdate); static bool SetScissorRect(); -- cgit v1.2.3