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
This commit is contained in:
hrydgard 2010-06-19 16:22:24 +00:00
parent 8c6ae1f6f4
commit ccbc1feb0b
12 changed files with 43 additions and 30 deletions

View file

@ -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");
}
}