Skip to content

Commit 87baa69

Browse files
authored
Merge pull request #20488 from hrydgard/more-fixes
Fix another texture replacement crash
2 parents bc63bd7 + 252d342 commit 87baa69

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

Common/File/VFS/DirectoryReader.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,14 @@ size_t DirectoryReader::Read(VFSOpenFile *vfsOpenFile, void *buffer, size_t leng
9797

9898
void DirectoryReader::CloseFile(VFSOpenFile *vfsOpenFile) {
9999
DirectoryReaderOpenFile *openFile = (DirectoryReaderOpenFile *)vfsOpenFile;
100+
_dbg_assert_(openFile);
101+
if (!openFile) {
102+
return;
103+
}
100104
_dbg_assert_(openFile->file != nullptr);
101105
if (openFile->file) {
102106
fclose(openFile->file);
107+
openFile->file = nullptr;
103108
}
104-
openFile->file = nullptr;
105109
delete openFile;
106110
}

Core/Config.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,14 @@ static float DefaultUISaturation() {
210210
return IsVREnabled() ? 1.5f : 1.0f;
211211
}
212212

213+
static int DefaultUIScaleFactor() {
214+
#if PPSSPP_PLATFORM(WINDOWS)
215+
return -1;
216+
#else
217+
return 0;
218+
#endif
219+
}
220+
213221
static const ConfigSetting generalSettings[] = {
214222
ConfigSetting("FirstRun", &g_Config.bFirstRun, true, CfgFlag::DEFAULT),
215223
ConfigSetting("RunCount", &g_Config.iRunCount, 0, CfgFlag::DEFAULT),
@@ -333,7 +341,7 @@ static const ConfigSetting generalSettings[] = {
333341

334342
ConfigSetting("ShowGPOLEDs", &g_Config.bShowGPOLEDs, false, CfgFlag::PER_GAME),
335343

336-
ConfigSetting("UIScaleFactor", &g_Config.iUIScaleFactor, false, CfgFlag::DEFAULT),
344+
ConfigSetting("UIScaleFactor", &g_Config.iUIScaleFactor, &DefaultUIScaleFactor, CfgFlag::DEFAULT),
337345

338346
ConfigSetting("VulkanDisableImplicitLayers", &g_Config.bVulkanDisableImplicitLayers, false, CfgFlag::DEFAULT),
339347
};

GPU/Common/ReplacedTexture.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,6 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
681681
out.resize(level.w * level.h * 4);
682682
if (!png_image_finish_read(&png, nullptr, &out[0], level.w * 4, nullptr)) {
683683
ERROR_LOG(Log::TexReplacement, "Could not load texture replacement: %s - %s", filename.c_str(), png.message);
684-
vfs_->CloseFile(openFile);
685684
out.resize(0);
686685
return LoadLevelResult::LOAD_ERROR;
687686
}

GPU/Common/SplineCommon.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ struct SurfaceInfo {
6464
if (tess_u > 2) tess_u = HALF_CEIL(tess_u);
6565
if (tess_v > 2) tess_v = HALF_CEIL(tess_v);
6666
break;
67+
default:
68+
break;
6769
}
6870
}
6971
};

0 commit comments

Comments
 (0)