From 0cd7af44f10a9bff15c5decdf37f7624b33af913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 13 May 2021 11:49:33 +0200 Subject: [PATCH] Fix ZipAssetReader file listing. Fixes post shaders on Android --- Common/File/VFS/AssetReader.cpp | 5 ++--- Common/File/VFS/VFS.cpp | 9 +++++---- GPU/Common/PostShader.cpp | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Common/File/VFS/AssetReader.cpp b/Common/File/VFS/AssetReader.cpp index 8608bbd07f79..c4afdcea7a76 100644 --- a/Common/File/VFS/AssetReader.cpp +++ b/Common/File/VFS/AssetReader.cpp @@ -132,10 +132,9 @@ bool ZipAssetReader::GetFileListing(const char *orig_path, std::vectorpush_back(info); } diff --git a/Common/File/VFS/VFS.cpp b/Common/File/VFS/VFS.cpp index a612002fcceb..ff6dd374307e 100644 --- a/Common/File/VFS/VFS.cpp +++ b/Common/File/VFS/VFS.cpp @@ -24,7 +24,8 @@ void VFSShutdown() { num_entries = 0; } -static bool IsLocalPath(const char *path) { +// TODO: Use Path more. +static bool IsLocalAbsolutePath(const char *path) { bool isUnixLocal = path[0] == '/'; #ifdef _WIN32 bool isWindowsLocal = isalpha(path[0]) && path[1] == ':'; @@ -36,7 +37,7 @@ static bool IsLocalPath(const char *path) { // The returned data should be free'd with delete[]. uint8_t *VFSReadFile(const char *filename, size_t *size) { - if (IsLocalPath(filename)) { + if (IsLocalAbsolutePath(filename)) { // Local path, not VFS. // INFO_LOG(IO, "Not a VFS path: %s . Reading local file.", filename); return File::ReadLocalFile(filename, size); @@ -65,7 +66,7 @@ uint8_t *VFSReadFile(const char *filename, size_t *size) { } bool VFSGetFileListing(const char *path, std::vector *listing, const char *filter) { - if (IsLocalPath(path)) { + if (IsLocalAbsolutePath(path)) { // Local path, not VFS. // INFO_LOG(IO, "Not a VFS path: %s . Reading local directory.", path); File::GetFilesInDir(Path(std::string(path)), listing, filter); @@ -92,7 +93,7 @@ bool VFSGetFileListing(const char *path, std::vector *listing, c } bool VFSGetFileInfo(const char *path, File::FileInfo *info) { - if (IsLocalPath(path)) { + if (IsLocalAbsolutePath(path)) { // Local path, not VFS. // INFO_LOG(IO, "Not a VFS path: %s . Getting local file info.", path); return File::GetFileInfo(Path(std::string(path)), info); diff --git a/GPU/Common/PostShader.cpp b/GPU/Common/PostShader.cpp index d6d23cb9f58f..c14754ff321d 100644 --- a/GPU/Common/PostShader.cpp +++ b/GPU/Common/PostShader.cpp @@ -22,6 +22,7 @@ #include #include +#include "Common/Log.h" #include "Common/Data/Format/IniFile.h" #include "Common/File/FileUtil.h" #include "Common/File/DirListing.h" @@ -183,7 +184,7 @@ void LoadPostShaderInfo(const std::vector &directories) { // Scans the directories for shader ini files and collects info about all the shaders found. void ReloadAllPostShaderInfo() { std::vector directories; - directories.push_back(Path("shaders")); // Hm, why? + directories.push_back(Path("shaders")); // For VFS directories.push_back(g_Config.memStickDirectory / "PSP" / "shaders"); LoadPostShaderInfo(directories); }