From ed2ade4e22dcf63a391927416caad412e29b3e59 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 14 May 2021 22:43:49 -0700 Subject: [PATCH 1/7] headless: Correct tests. --- headless/Compare.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/headless/Compare.cpp b/headless/Compare.cpp index b80b1b2dcd..1b81867a67 100644 --- a/headless/Compare.cpp +++ b/headless/Compare.cpp @@ -209,7 +209,7 @@ std::string GetTestName(const Path &bootFilename) } bool CompareOutput(const Path &bootFilename, const std::string &output, bool verbose) { - Path expect_filename = bootFilename.WithReplacedExtension("prx", "expected"); + Path expect_filename = bootFilename.WithReplacedExtension(".prx", ".expected"); std::unique_ptr expect_loader(ConstructFileLoader(expect_filename)); if (expect_loader->Exists()) { @@ -271,7 +271,7 @@ bool CompareOutput(const Path &bootFilename, const std::string &output, bool ver printf("%s", output.c_str()); printf("============== expected output:\n"); std::string fullExpected; - if (File::ReadFileToString(true, Path(expect_filename), fullExpected)) + if (File::ReadFileToString(true, expect_filename, fullExpected)) printf("%s", fullExpected.c_str()); printf("===============================\n"); } From 2a9170a2ea6c1d146bc6f6c701b2e6fef87461d0 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 14 May 2021 22:46:03 -0700 Subject: [PATCH 2/7] http: Use Path for the download file. --- Common/Buffer.cpp | 6 ++++-- Common/Buffer.h | 4 +++- Common/Net/HTTPClient.cpp | 14 +++++++------- Common/Net/HTTPClient.h | 11 ++++++----- Core/Config.cpp | 2 +- Core/Util/GameManager.cpp | 8 ++++---- Core/Util/GameManager.h | 2 +- UI/DevScreens.cpp | 2 +- UI/Store.cpp | 4 ++-- 9 files changed, 29 insertions(+), 24 deletions(-) diff --git a/Common/Buffer.cpp b/Common/Buffer.cpp index fd25b0ad97..6dc6b74c5a 100644 --- a/Common/Buffer.cpp +++ b/Common/Buffer.cpp @@ -3,6 +3,8 @@ #include #include "Common/Buffer.h" +#include "Common/File/FileUtil.h" +#include "Common/File/Path.h" #include "Common/Log.h" Buffer::Buffer() { } @@ -115,8 +117,8 @@ void Buffer::Printf(const char *fmt, ...) { memcpy(ptr, buffer, retval); } -bool Buffer::FlushToFile(const char *filename) { - FILE *f = fopen(filename, "wb"); +bool Buffer::FlushToFile(const Path &filename) { + FILE *f = File::OpenCFile(filename, "wb"); if (!f) return false; if (data_.size()) { diff --git a/Common/Buffer.h b/Common/Buffer.h index 2e92669b29..4d63a8e5ad 100644 --- a/Common/Buffer.h +++ b/Common/Buffer.h @@ -5,6 +5,8 @@ #include "Common/Common.h" +class Path; + // Acts as a queue. Intended to be as fast as possible for most uses. // Does not do synchronization, must use external mutexes. class Buffer { @@ -66,7 +68,7 @@ public: // Writes the entire buffer to the file descriptor. Also resets the // size to zero. On failure, data remains in buffer and nothing is // written. - bool FlushToFile(const char *filename); + bool FlushToFile(const Path &filename); // Utilities. Try to avoid checking for size. size_t size() const { return data_.size(); } diff --git a/Common/Net/HTTPClient.cpp b/Common/Net/HTTPClient.cpp index f06072cc7d..e1b25bb073 100644 --- a/Common/Net/HTTPClient.cpp +++ b/Common/Net/HTTPClient.cpp @@ -457,7 +457,7 @@ int Client::ReadResponseEntity(net::Buffer *readbuf, const std::vector Downloader::StartDownload(const std::string &url, const std::string &outfile) { +std::shared_ptr Downloader::StartDownload(const std::string &url, const Path &outfile) { std::shared_ptr dl(new Download(url, outfile)); downloads_.push_back(dl); dl->Start(); @@ -578,7 +578,7 @@ std::shared_ptr Downloader::StartDownload(const std::string &url, cons std::shared_ptr Downloader::StartDownloadWithCallback( const std::string &url, - const std::string &outfile, + const Path &outfile, std::function callback) { std::shared_ptr dl(new Download(url, outfile)); dl->SetCallback(callback); diff --git a/Common/Net/HTTPClient.h b/Common/Net/HTTPClient.h index 2087f1ea71..0924d4b9b7 100644 --- a/Common/Net/HTTPClient.h +++ b/Common/Net/HTTPClient.h @@ -5,6 +5,7 @@ #include #include +#include "Common/File/Path.h" #include "Common/Net/NetBuffer.h" #include "Common/Net/Resolve.h" @@ -90,7 +91,7 @@ protected: // Not particularly efficient, but hey - it's a background download, that's pretty cool :P class Download { public: - Download(const std::string &url, const std::string &outfile); + Download(const std::string &url, const Path &outfile); ~Download(); void Start(); @@ -108,7 +109,7 @@ public: int ResultCode() const { return resultCode_; } std::string url() const { return url_; } - std::string outfile() const { return outfile_; } + const Path &outfile() const { return outfile_; } // If not downloading to a file, access this to get the result. Buffer &buffer() { return buffer_; } @@ -147,7 +148,7 @@ private: Buffer buffer_; std::vector responseHeaders_; std::string url_; - std::string outfile_; + Path outfile_; std::thread thread_; int resultCode_ = 0; bool completed_ = false; @@ -166,11 +167,11 @@ public: CancelAll(); } - std::shared_ptr StartDownload(const std::string &url, const std::string &outfile); + std::shared_ptr StartDownload(const std::string &url, const Path &outfile); std::shared_ptr StartDownloadWithCallback( const std::string &url, - const std::string &outfile, + const Path &outfile, std::function callback); // Drops finished downloads from the list. diff --git a/Core/Config.cpp b/Core/Config.cpp index e365673778..5664828011 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -1301,7 +1301,7 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) { // upgrade number in the ini. if (iRunCount % 10 == 0 && bCheckForNewVersion) { std::shared_ptr dl = g_DownloadManager.StartDownloadWithCallback( - "http://www.ppsspp.org/version.json", "", &DownloadCompletedCallback); + "http://www.ppsspp.org/version.json", Path(), &DownloadCompletedCallback); dl->SetHidden(true); } diff --git a/Core/Util/GameManager.cpp b/Core/Util/GameManager.cpp index 50280938c1..f72977d67f 100644 --- a/Core/Util/GameManager.cpp +++ b/Core/Util/GameManager.cpp @@ -52,15 +52,15 @@ GameManager g_GameManager; GameManager::GameManager() { } -std::string GameManager::GetTempFilename() const { +Path GameManager::GetTempFilename() const { #ifdef _WIN32 wchar_t tempPath[MAX_PATH]; GetTempPath(MAX_PATH, tempPath); wchar_t buffer[MAX_PATH]; GetTempFileName(tempPath, L"PSP", 1, buffer); - return ConvertWStringToUTF8(buffer); + return Path(buffer); #else - return (g_Config.memStickDirectory / "ppsspp.dl").ToString(); + return g_Config.memStickDirectory / "ppsspp.dl"; #endif } @@ -79,7 +79,7 @@ bool GameManager::DownloadAndInstall(std::string storeFileUrl) { return false; } - std::string filename = GetTempFilename(); + Path filename = GetTempFilename(); curDownload_ = g_DownloadManager.StartDownload(storeFileUrl, filename); return true; } diff --git a/Core/Util/GameManager.h b/Core/Util/GameManager.h index 382038c3fd..4f8826bc88 100644 --- a/Core/Util/GameManager.h +++ b/Core/Util/GameManager.h @@ -85,7 +85,7 @@ private: bool DetectTexturePackDest(struct zip *z, int iniIndex, Path &dest); void SetInstallError(const std::string &err); - std::string GetTempFilename() const; + Path GetTempFilename() const; std::string GetGameID(const Path &path) const; std::string GetPBPGameID(FileLoader *loader) const; std::string GetISOGameID(FileLoader *loader) const; diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index f04b7d4a9e..8698b16005 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -1192,7 +1192,7 @@ void FrameDumpTestScreen::update() { UIScreen::update(); if (!listing_) { - listing_ = g_DownloadManager.StartDownload(framedumpsBaseUrl, ""); + listing_ = g_DownloadManager.StartDownload(framedumpsBaseUrl, Path()); } if (listing_ && listing_->Done() && files_.empty()) { diff --git a/UI/Store.cpp b/UI/Store.cpp index fb83b3a860..111b2b2731 100644 --- a/UI/Store.cpp +++ b/UI/Store.cpp @@ -134,7 +134,7 @@ void HttpImageFileView::DownloadCompletedCallback(http::Download &download) { void HttpImageFileView::Draw(UIContext &dc) { using namespace Draw; if (!texture_ && !textureFailed_ && !path_.empty() && !download_) { - download_ = downloader_->StartDownloadWithCallback(path_, "", std::bind(&HttpImageFileView::DownloadCompletedCallback, this, std::placeholders::_1)); + download_ = downloader_->StartDownloadWithCallback(path_, Path(), std::bind(&HttpImageFileView::DownloadCompletedCallback, this, std::placeholders::_1)); download_->SetHidden(true); } @@ -367,7 +367,7 @@ StoreScreen::StoreScreen() { std::string indexPath = storeBaseUrl + "index.json"; - listing_ = g_DownloadManager.StartDownload(indexPath, ""); + listing_ = g_DownloadManager.StartDownload(indexPath, Path()); } StoreScreen::~StoreScreen() { From d376e67f8799f034d77c7723f3756838f8ce63da Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 14 May 2021 22:48:04 -0700 Subject: [PATCH 3/7] Common: Cleanup some Path constructions. --- Common/File/DirListing.cpp | 2 +- Common/File/PathBrowser.cpp | 2 +- Core/Config.cpp | 2 +- Core/HLE/Plugins.cpp | 4 ++-- Core/System.cpp | 2 +- Core/TextureReplacer.cpp | 4 ++-- Core/Util/GameManager.cpp | 2 +- UI/GameInfoCache.cpp | 12 ++++++------ UI/GameSettingsScreen.cpp | 2 +- UI/NativeApp.cpp | 4 ++-- UI/PauseScreen.cpp | 2 +- UI/SavedataScreen.cpp | 2 +- UWP/PPSSPP_UWPMain.cpp | 3 +-- 13 files changed, 21 insertions(+), 22 deletions(-) diff --git a/Common/File/DirListing.cpp b/Common/File/DirListing.cpp index 1140c64d7e..36f05b9259 100644 --- a/Common/File/DirListing.cpp +++ b/Common/File/DirListing.cpp @@ -197,7 +197,7 @@ size_t GetFilesInDir(const Path &directory, std::vector * files, const info.size = 0; info.isWritable = false; // TODO - implement some kind of check if (!info.isDirectory) { - std::string ext = Path(info.fullName).GetFileExtension(); + std::string ext = info.fullName.GetFileExtension(); if (!ext.empty()) { ext = ext.substr(1); // Remove the dot. if (filter && filters.find(ext) == filters.end()) { diff --git a/Common/File/PathBrowser.cpp b/Common/File/PathBrowser.cpp index 25fbe86cca..61797f2a1b 100644 --- a/Common/File/PathBrowser.cpp +++ b/Common/File/PathBrowser.cpp @@ -258,7 +258,7 @@ bool PathBrowser::GetListing(std::vector &fileInfo, const char * fileInfo = ApplyFilter(pendingFiles_, filter); return true; } else { - File::GetFilesInDir(Path(path_), &fileInfo, filter); + File::GetFilesInDir(path_, &fileInfo, filter); return true; } } diff --git a/Core/Config.cpp b/Core/Config.cpp index 5664828011..27a5b7507d 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -1593,7 +1593,7 @@ void Config::RestoreDefaults() { createGameConfig(gameId_); } else { if (File::Exists(iniFilename_)) - File::Delete(Path(iniFilename_)); + File::Delete(iniFilename_); recentIsos.clear(); currentDirectory = ""; } diff --git a/Core/HLE/Plugins.cpp b/Core/HLE/Plugins.cpp index f4d7367a4b..1647c6d55a 100644 --- a/Core/HLE/Plugins.cpp +++ b/Core/HLE/Plugins.cpp @@ -86,8 +86,8 @@ static std::vector FindPlugins(const std::string &gameID, const std: GetFilesInDir(GetSysDirectory(DIRECTORY_PLUGINS), &pluginDirs); std::vector found; - for (auto subdir : pluginDirs) { - Path subdirFullName(subdir.fullName); + for (const auto &subdir : pluginDirs) { + const Path &subdirFullName = subdir.fullName; if (!subdir.isDirectory || !File::Exists(subdirFullName / "plugin.ini")) continue; diff --git a/Core/System.cpp b/Core/System.cpp index bdbe292b7e..0fc1cc48d7 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -676,7 +676,7 @@ void InitSysDirectories() { INFO_LOG(COMMON, "Memstick directory not present, creating at '%s'", g_Config.memStickDirectory.c_str()); } - Path testFile = Path(g_Config.memStickDirectory) / "_writable_test.$$$"; + Path testFile = g_Config.memStickDirectory / "_writable_test.$$$"; // If any directory is read-only, fall back to the Documents directory. // We're screwed anyway if we can't write to Documents, or can't detect it. diff --git a/Core/TextureReplacer.cpp b/Core/TextureReplacer.cpp index b3eb8e8c0b..b5df4ee94f 100644 --- a/Core/TextureReplacer.cpp +++ b/Core/TextureReplacer.cpp @@ -696,7 +696,7 @@ void ReplacedTexture::Load(int level, void *out, int rowPitch) { png_image png = {}; png.version = PNG_IMAGE_VERSION; - FILE *fp = File::OpenCFile(Path(info.file), "rb"); + FILE *fp = File::OpenCFile(info.file, "rb"); if (!png_image_begin_read_from_stdio(&png, fp)) { ERROR_LOG(G3D, "Could not load texture replacement info: %s - %s", info.file.c_str(), png.message); return; @@ -733,7 +733,7 @@ bool TextureReplacer::GenerateIni(const std::string &gameID, Path &generatedFile if (gameID.empty()) return false; - Path texturesDirectory = Path(GetSysDirectory(DIRECTORY_TEXTURES)) / gameID; + Path texturesDirectory = GetSysDirectory(DIRECTORY_TEXTURES) / gameID; if (!File::Exists(texturesDirectory)) { File::CreateFullPath(texturesDirectory); } diff --git a/Core/Util/GameManager.cpp b/Core/Util/GameManager.cpp index f72977d67f..b77d81e6d3 100644 --- a/Core/Util/GameManager.cpp +++ b/Core/Util/GameManager.cpp @@ -580,7 +580,7 @@ bool GameManager::InstallMemstickGame(struct zip *z, const Path &zipfile, const installInProgress_ = false; installError_ = ""; if (deleteAfter) { - File::Delete(Path(zipfile)); + File::Delete(zipfile); } InstallDone(); return true; diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index 592d23f182..f920e079a6 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -62,7 +62,7 @@ bool GameInfo::Delete() { case IdentifiedFileType::PSP_ISO_NP: { // Just delete the one file (TODO: handle two-disk games as well somehow). - Path fileToRemove = Path(filePath_); + Path fileToRemove = filePath_; File::Delete(fileToRemove); g_Config.RemoveRecent(filePath_.ToString()); return true; @@ -134,7 +134,7 @@ std::vector GameInfo::GetSaveDataDirectories() { } for (size_t i = 0; i < dirs.size(); i++) { if (startsWith(dirs[i].name, id)) { - directories.push_back(Path(dirs[i].fullName)); + directories.push_back(dirs[i].fullName); } } @@ -155,7 +155,7 @@ u64 GameInfo::GetSaveDataSizeInBytes() { // Note: GetFilesInDir does not fill in fileSize properly. for (size_t i = 0; i < fileInfo.size(); i++) { File::FileInfo finfo; - File::GetFileInfo(Path(fileInfo[i].fullName), &finfo); + File::GetFileInfo(fileInfo[i].fullName, &finfo); if (!finfo.isDirectory) filesSizeInDir += finfo.size; } @@ -182,7 +182,7 @@ u64 GameInfo::GetInstallDataSizeInBytes() { // Note: GetFilesInDir does not fill in fileSize properly. for (size_t i = 0; i < fileInfo.size(); i++) { File::FileInfo finfo; - File::GetFileInfo(Path(fileInfo[i].fullName), &finfo); + File::GetFileInfo(fileInfo[i].fullName, &finfo); if (!finfo.isDirectory) filesSizeInDir += finfo.size; } @@ -235,7 +235,7 @@ bool GameInfo::DeleteAllSaveData() { File::GetFilesInDir(saveDataDir[j], &fileInfo); for (size_t i = 0; i < fileInfo.size(); i++) { - File::Delete(Path(fileInfo[i].fullName)); + File::Delete(fileInfo[i].fullName); } File::DeleteDir(saveDataDir[j]); @@ -493,7 +493,7 @@ handleELF: // Let's use the screenshot as an icon, too. Path screenshotPath = gamePath_.WithReplacedExtension("ppst", "jpg"); if (File::Exists(screenshotPath)) { - if (File::ReadFileToString(false, Path(screenshotPath), info_->icon.data)) { + if (File::ReadFileToString(false, screenshotPath, info_->icon.data)) { info_->icon.dataLoaded = true; } else { ERROR_LOG(G3D, "Error loading screenshot data: '%s'", screenshotPath.c_str()); diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index fea5ff2e85..bc1be681f6 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -1772,7 +1772,7 @@ UI::EventReturn DeveloperToolsScreen::OnCopyStatesToRoot(UI::EventParams &e) { GetFilesInDir(savestate_dir, &files, nullptr, 0); for (const File::FileInfo &file : files) { - Path src = Path(file.fullName); + Path src = file.fullName; Path dst = root_dir / file.name; INFO_LOG(SYSTEM, "Copying file '%s' to '%s'", src.c_str(), dst.c_str()); File::Copy(src, dst); diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 295b99f07a..feed38bd5e 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -429,7 +429,7 @@ static void ClearFailedGPUBackends() { // In case they update drivers and have totally different problems much later, clear the failed list. g_Config.sFailedGPUBackends.clear(); if (System_GetPropertyBool(SYSPROP_SUPPORTS_PERMISSIONS)) { - File::Delete(Path(GetSysDirectory(DIRECTORY_APP_CACHE)) / "FailedGraphicsBackends.txt"); + File::Delete(GetSysDirectory(DIRECTORY_APP_CACHE) / "FailedGraphicsBackends.txt"); } else { g_Config.Save("clearFailedGPUBackends"); } @@ -1004,7 +1004,7 @@ void NativeShutdownGraphics() { void TakeScreenshot() { g_TakeScreenshot = false; - Path path = Path(GetSysDirectory(DIRECTORY_SCREENSHOT)); + Path path = GetSysDirectory(DIRECTORY_SCREENSHOT); if (!File::Exists(path)) { File::CreateDir(path); } diff --git a/UI/PauseScreen.cpp b/UI/PauseScreen.cpp index d8853a80ab..f6d89b663c 100644 --- a/UI/PauseScreen.cpp +++ b/UI/PauseScreen.cpp @@ -159,7 +159,7 @@ void AsyncImageFileView::Draw(UIContext &dc) { class ScreenshotViewScreen : public PopupScreen { public: - ScreenshotViewScreen(Path filename, std::string title, int slot, std::shared_ptr i18n) + ScreenshotViewScreen(const Path &filename, std::string title, int slot, std::shared_ptr i18n) : PopupScreen(title, i18n->T("Load State"), "Back"), filename_(filename), slot_(slot) {} // PopupScreen will translate Back on its own int GetSlot() const { diff --git a/UI/SavedataScreen.cpp b/UI/SavedataScreen.cpp index fe426a4a61..97fe8cb6d1 100644 --- a/UI/SavedataScreen.cpp +++ b/UI/SavedataScreen.cpp @@ -114,7 +114,7 @@ public: } else { Path image_path = savePath_.WithReplacedExtension(".ppst", ".jpg"); if (File::Exists(image_path)) { - toprow->Add(new AsyncImageFileView(Path(image_path), IS_KEEP_ASPECT, new LinearLayoutParams(480, 272, Margins(10, 0)))); + toprow->Add(new AsyncImageFileView(image_path, IS_KEEP_ASPECT, new LinearLayoutParams(480, 272, Margins(10, 0)))); } else { toprow->Add(new TextView(sa->T("No screenshot"), new LinearLayoutParams(Margins(10, 5))))->SetTextColor(textStyle.fgColor); } diff --git a/UWP/PPSSPP_UWPMain.cpp b/UWP/PPSSPP_UWPMain.cpp index 4939ccb9e8..17b2c82d22 100644 --- a/UWP/PPSSPP_UWPMain.cpp +++ b/UWP/PPSSPP_UWPMain.cpp @@ -96,8 +96,7 @@ PPSSPP_UWPMain::PPSSPP_UWPMain(App ^app, const std::shared_ptrLocalFolder->Path->Data(); - - g_Config.memStickDirectory = Path(ReplaceAll(ConvertWStringToUTF8(memstickFolderW), "\\", "/")); + g_Config.memStickDirectory = Path(memstickFolderW); // On Win32 it makes more sense to initialize the system directories here // because the next place it was called was in the EmuThread, and it's too late by then. From c03e68c99637abe31651869acf2119c4c8b6a90e Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 14 May 2021 22:48:32 -0700 Subject: [PATCH 4/7] Debugger: Simplify symbol map filename build. --- Qt/QtHost.cpp | 6 +----- UWP/UWPHost.cpp | 25 ++++++++----------------- Windows/WindowsHost.cpp | 25 ++++++++----------------- 3 files changed, 17 insertions(+), 39 deletions(-) diff --git a/Qt/QtHost.cpp b/Qt/QtHost.cpp index e91a719012..02ed199734 100644 --- a/Qt/QtHost.cpp +++ b/Qt/QtHost.cpp @@ -19,9 +19,5 @@ #include "Qt/QtHost.h" Path QtHost::SymbolMapFilename(Path currentFilename) { - std::string ext = currentFilename.GetFileExtension(); - if (ext == "") - return currentFilename.WithExtraExtension("map"); - else - return currentFilename.WithReplacedExtension(ext, "map"); + return currentFilename.WithReplacedExtension(".map"); } diff --git a/UWP/UWPHost.cpp b/UWP/UWPHost.cpp index 9282a9caf1..5e489e161c 100644 --- a/UWP/UWPHost.cpp +++ b/UWP/UWPHost.cpp @@ -121,36 +121,27 @@ void UWPHost::BootDone() { Core_EnableStepping(false); } -static Path SymbolMapFilename(const char *currentFilename, const char *ext) { +static Path SymbolMapFilename(const Path ¤tFilename, const char *ext) { File::FileInfo info; - - std::string result = currentFilename; - // can't fail, definitely exists if it gets this far - File::GetFileInfo(Path(currentFilename), &info); + File::GetFileInfo(currentFilename, &info); if (info.isDirectory) { - return Path(result) / (std::string(".ppsspp-symbols") + ext); - } else { - size_t dot = result.rfind('.'); - if (dot == result.npos) - return Path(result + ext); - - result.replace(dot, result.npos, ext); - return Path(result); + return currentFilename / (std::string(".ppsspp-symbols") + ext); } + return currentFilename.WithReplacedExtension(ext); } bool UWPHost::AttemptLoadSymbolMap() { - bool result1 = g_symbolMap->LoadSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str(), ".ppmap")); + bool result1 = g_symbolMap->LoadSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart, ".ppmap")); // Load the old-style map file. if (!result1) - result1 = g_symbolMap->LoadSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str(), ".map")); - bool result2 = g_symbolMap->LoadNocashSym(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str(), ".sym")); + result1 = g_symbolMap->LoadSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart, ".map")); + bool result2 = g_symbolMap->LoadNocashSym(SymbolMapFilename(PSP_CoreParameter().fileToStart, ".sym")); return result1 || result2; } void UWPHost::SaveSymbolMap() { - g_symbolMap->SaveSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str(), ".ppmap")); + g_symbolMap->SaveSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart, ".ppmap")); } void UWPHost::NotifySymbolMapUpdated() { diff --git a/Windows/WindowsHost.cpp b/Windows/WindowsHost.cpp index eae7edc830..610b79890b 100644 --- a/Windows/WindowsHost.cpp +++ b/Windows/WindowsHost.cpp @@ -268,39 +268,30 @@ void WindowsHost::BootDone() { SetDebugMode(!g_Config.bAutoRun); } -static Path SymbolMapFilename(const char *currentFilename, const char* ext) { +static Path SymbolMapFilename(const Path ¤tFilename, const char *ext) { File::FileInfo info; - - std::string result = currentFilename; - // can't fail, definitely exists if it gets this far - File::GetFileInfo(Path(currentFilename), &info); + File::GetFileInfo(currentFilename, &info); if (info.isDirectory) { - return Path(result) / (std::string(".ppsspp-symbols") + ext); - } else { - const size_t dot = result.rfind('.'); - if (dot == result.npos) - return Path(result + ext); - - result.replace(dot, result.npos, ext); - return Path(result); + return currentFilename / (std::string(".ppsspp-symbols") + ext); } + return currentFilename.WithReplacedExtension(ext); } bool WindowsHost::AttemptLoadSymbolMap() { if (!g_symbolMap) return false; - bool result1 = g_symbolMap->LoadSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str(), ".ppmap")); + bool result1 = g_symbolMap->LoadSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart, ".ppmap")); // Load the old-style map file. if (!result1) - result1 = g_symbolMap->LoadSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str(), ".map")); - bool result2 = g_symbolMap->LoadNocashSym(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str(), ".sym")); + result1 = g_symbolMap->LoadSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart, ".map")); + bool result2 = g_symbolMap->LoadNocashSym(SymbolMapFilename(PSP_CoreParameter().fileToStart, ".sym")); return result1 || result2; } void WindowsHost::SaveSymbolMap() { if (g_symbolMap) - g_symbolMap->SaveSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str(),".ppmap")); + g_symbolMap->SaveSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart, ".ppmap")); } void WindowsHost::NotifySymbolMapUpdated() { From 8db4277e6cad6d3966117b8ac712354abcf2a770 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 14 May 2021 22:48:48 -0700 Subject: [PATCH 5/7] UI: Correct fallback to screenshots for icons. --- UI/GameInfoCache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index f920e079a6..5c1ebaad4c 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -491,7 +491,7 @@ handleELF: std::lock_guard guard(info_->lock); // Let's use the screenshot as an icon, too. - Path screenshotPath = gamePath_.WithReplacedExtension("ppst", "jpg"); + Path screenshotPath = gamePath_.WithReplacedExtension(".ppst", ".jpg"); if (File::Exists(screenshotPath)) { if (File::ReadFileToString(false, screenshotPath, info_->icon.data)) { info_->icon.dataLoaded = true; From b74ecd5fa020d31818ce669544944f766e74f16d Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 14 May 2021 23:00:22 -0700 Subject: [PATCH 6/7] SaveState: Use Path instead of strings. --- Core/SaveState.cpp | 30 +++++++++++++++--------------- Core/SaveState.h | 22 +++++++++++----------- Qt/mainwindow.cpp | 4 ++-- UI/EmuScreen.cpp | 16 ++++++++-------- UI/GameInfoCache.cpp | 2 +- UI/PauseScreen.cpp | 16 ++++++++-------- Windows/MainWindowMenu.cpp | 8 ++++---- 7 files changed, 49 insertions(+), 49 deletions(-) diff --git a/Core/SaveState.cpp b/Core/SaveState.cpp index b727889e71..9db711e466 100644 --- a/Core/SaveState.cpp +++ b/Core/SaveState.cpp @@ -397,22 +397,22 @@ namespace SaveState return title + " (" + filename + ")"; } - std::string GetTitle(const std::string &filename) { + std::string GetTitle(const Path &filename) { std::string title; - if (CChunkFileReader::GetFileTitle(Path(filename), &title) == CChunkFileReader::ERROR_NONE) { + if (CChunkFileReader::GetFileTitle(filename, &title) == CChunkFileReader::ERROR_NONE) { if (title.empty()) { - return File::GetFilename(filename); + return filename.GetFilename(); } - return AppendSlotTitle(filename, title); + return AppendSlotTitle(filename.GetFilename(), title); } // The file can't be loaded - let's note that. auto sy = GetI18NCategory("System"); - return File::GetFilename(filename) + " " + sy->T("(broken)"); + return filename.GetFilename() + " " + sy->T("(broken)"); } - Path GenerateSaveSlotFilename(const std::string &gameFilename, int slot, const char *extension) + Path GenerateSaveSlotFilename(const Path &gameFilename, int slot, const char *extension) { std::string discId = g_paramSFO.GetValueString("DISC_ID"); std::string discVer = g_paramSFO.GetValueString("DISC_VERSION"); @@ -437,7 +437,7 @@ namespace SaveState g_Config.iCurrentStateSlot = (g_Config.iCurrentStateSlot + 1) % NUM_SLOTS; } - void LoadSlot(const std::string &gameFilename, int slot, Callback callback, void *cbUserData) + void LoadSlot(const Path &gameFilename, int slot, Callback callback, void *cbUserData) { Path fn = GenerateSaveSlotFilename(gameFilename, slot, STATE_EXTENSION); if (!fn.empty()) { @@ -471,7 +471,7 @@ namespace SaveState } } - void SaveSlot(const std::string &gameFilename, int slot, Callback callback, void *cbUserData) + void SaveSlot(const Path &gameFilename, int slot, Callback callback, void *cbUserData) { Path fn = GenerateSaveSlotFilename(gameFilename, slot, STATE_EXTENSION); Path shot = GenerateSaveSlotFilename(gameFilename, slot, SCREENSHOT_EXTENSION); @@ -506,7 +506,7 @@ namespace SaveState } } - bool UndoSaveSlot(const std::string &gameFilename, int slot) { + bool UndoSaveSlot(const Path &gameFilename, int slot) { Path fn = GenerateSaveSlotFilename(gameFilename, slot, STATE_EXTENSION); Path shot = GenerateSaveSlotFilename(gameFilename, slot, SCREENSHOT_EXTENSION); Path fnUndo = GenerateSaveSlotFilename(gameFilename, slot, UNDO_STATE_EXTENSION); @@ -523,19 +523,19 @@ namespace SaveState return false; } - bool HasSaveInSlot(const std::string &gameFilename, int slot) + bool HasSaveInSlot(const Path &gameFilename, int slot) { Path fn = GenerateSaveSlotFilename(gameFilename, slot, STATE_EXTENSION); return File::Exists(fn); } - bool HasUndoSaveInSlot(const std::string &gameFilename, int slot) + bool HasUndoSaveInSlot(const Path &gameFilename, int slot) { Path fn = GenerateSaveSlotFilename(gameFilename, slot, STATE_EXTENSION); return File::Exists(fn.WithExtraExtension(".undo")); } - bool HasScreenshotInSlot(const std::string &gameFilename, int slot) + bool HasScreenshotInSlot(const Path &gameFilename, int slot) { Path fn = GenerateSaveSlotFilename(gameFilename, slot, SCREENSHOT_EXTENSION); return File::Exists(fn); @@ -578,7 +578,7 @@ namespace SaveState return true; } - int GetNewestSlot(const std::string &gameFilename) { + int GetNewestSlot(const Path &gameFilename) { int newestSlot = -1; tm newestDate = {0}; for (int i = 0; i < NUM_SLOTS; i++) { @@ -595,7 +595,7 @@ namespace SaveState return newestSlot; } - int GetOldestSlot(const std::string &gameFilename) { + int GetOldestSlot(const Path &gameFilename) { int oldestSlot = -1; tm oldestDate = {0}; for (int i = 0; i < NUM_SLOTS; i++) { @@ -612,7 +612,7 @@ namespace SaveState return oldestSlot; } - std::string GetSlotDateAsString(const std::string &gameFilename, int slot) { + std::string GetSlotDateAsString(const Path &gameFilename, int slot) { Path fn = GenerateSaveSlotFilename(gameFilename, slot, STATE_EXTENSION); if (File::Exists(fn)) { tm time; diff --git a/Core/SaveState.h b/Core/SaveState.h index 6399e7f0a7..d7bb0142fe 100644 --- a/Core/SaveState.h +++ b/Core/SaveState.h @@ -42,24 +42,24 @@ namespace SaveState // Cycle through the 5 savestate slots void NextSlot(); - void SaveSlot(const std::string &gameFilename, int slot, Callback callback, void *cbUserData = 0); - void LoadSlot(const std::string &gameFilename, int slot, Callback callback, void *cbUserData = 0); - bool UndoSaveSlot(const std::string &gameFilename, int slot); + void SaveSlot(const Path &gameFilename, int slot, Callback callback, void *cbUserData = 0); + void LoadSlot(const Path &gameFilename, int slot, Callback callback, void *cbUserData = 0); + bool UndoSaveSlot(const Path &gameFilename, int slot); // Checks whether there's an existing save in the specified slot. - bool HasSaveInSlot(const std::string &gameFilename, int slot); - bool HasUndoSaveInSlot(const std::string &gameFilename, int slot); - bool HasScreenshotInSlot(const std::string &gameFilename, int slot); + bool HasSaveInSlot(const Path &gameFilename, int slot); + bool HasUndoSaveInSlot(const Path &gameFilename, int slot); + bool HasScreenshotInSlot(const Path &gameFilename, int slot); int GetCurrentSlot(); // Returns -1 if there's no oldest/newest slot. - int GetNewestSlot(const std::string &gameFilename); - int GetOldestSlot(const std::string &gameFilename); + int GetNewestSlot(const Path &gameFilename); + int GetOldestSlot(const Path &gameFilename); - std::string GetSlotDateAsString(const std::string &gameFilename, int slot); - Path GenerateSaveSlotFilename(const std::string &gameFilename, int slot, const char *extension); + std::string GetSlotDateAsString(const Path &gameFilename, int slot); + Path GenerateSaveSlotFilename(const Path &gameFilename, int slot, const char *extension); - std::string GetTitle(const std::string &filename); + std::string GetTitle(const Path &filename); // Load the specified file into the current state (async.) // Warning: callback will be called on a different thread. diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index f8aaf61d2c..53e18c23d4 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -157,13 +157,13 @@ void SaveStateActionFinished(SaveState::Status status, const std::string &messag void MainWindow::qlstateAct() { - std::string gamePath = PSP_CoreParameter().fileToStart.ToString(); + Path gamePath = PSP_CoreParameter().fileToStart; SaveState::LoadSlot(gamePath, 0, SaveStateActionFinished, this); } void MainWindow::qsstateAct() { - std::string gamePath = PSP_CoreParameter().fileToStart.ToString(); + Path gamePath = PSP_CoreParameter().fileToStart; SaveState::SaveSlot(gamePath, 0, SaveStateActionFinished, this); } diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 5c504b8392..799cc20da2 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -629,10 +629,10 @@ void EmuScreen::onVKeyDown(int virtualKeyCode) { } break; case VIRTKEY_SAVE_STATE: - SaveState::SaveSlot(gamePath_.ToString(), g_Config.iCurrentStateSlot, &AfterSaveStateAction); + SaveState::SaveSlot(gamePath_, g_Config.iCurrentStateSlot, &AfterSaveStateAction); break; case VIRTKEY_LOAD_STATE: - SaveState::LoadSlot(gamePath_.ToString(), g_Config.iCurrentStateSlot, &AfterSaveStateAction); + SaveState::LoadSlot(gamePath_, g_Config.iCurrentStateSlot, &AfterSaveStateAction); break; case VIRTKEY_NEXT_SLOT: SaveState::NextSlot(); @@ -1226,8 +1226,8 @@ void EmuScreen::update() { saveStateSlot_ = currentSlot; Path fn; - if (SaveState::HasSaveInSlot(gamePath_.ToString(), currentSlot)) { - fn = SaveState::GenerateSaveSlotFilename(gamePath_.ToString(), currentSlot, SaveState::SCREENSHOT_EXTENSION); + if (SaveState::HasSaveInSlot(gamePath_, currentSlot)) { + fn = SaveState::GenerateSaveSlotFilename(gamePath_, currentSlot, SaveState::SCREENSHOT_EXTENSION); } saveStatePreview_->SetFilename(fn); @@ -1672,18 +1672,18 @@ void EmuScreen::autoLoad() { case (int)AutoLoadSaveState::OFF: // "AutoLoad Off" return; case (int)AutoLoadSaveState::OLDEST: // "Oldest Save" - autoSlot = SaveState::GetOldestSlot(gamePath_.ToString()); + autoSlot = SaveState::GetOldestSlot(gamePath_); break; case (int)AutoLoadSaveState::NEWEST: // "Newest Save" - autoSlot = SaveState::GetNewestSlot(gamePath_.ToString()); + autoSlot = SaveState::GetNewestSlot(gamePath_); break; default: // try the specific save state slot specified - autoSlot = (SaveState::HasSaveInSlot(gamePath_.ToString(), g_Config.iAutoLoadSaveState - 3)) ? (g_Config.iAutoLoadSaveState - 3) : -1; + autoSlot = (SaveState::HasSaveInSlot(gamePath_, g_Config.iAutoLoadSaveState - 3)) ? (g_Config.iAutoLoadSaveState - 3) : -1; break; } if (g_Config.iAutoLoadSaveState && autoSlot != -1) { - SaveState::LoadSlot(gamePath_.ToString(), autoSlot, &AfterSaveStateAction); + SaveState::LoadSlot(gamePath_, autoSlot, &AfterSaveStateAction); g_Config.iCurrentStateSlot = autoSlot; } } diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index 5c1ebaad4c..99873b9172 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -486,7 +486,7 @@ handleELF: case IdentifiedFileType::PPSSPP_SAVESTATE: { - info_->SetTitle(SaveState::GetTitle(gamePath_.ToString())); + info_->SetTitle(SaveState::GetTitle(gamePath_)); std::lock_guard guard(info_->lock); diff --git a/UI/PauseScreen.cpp b/UI/PauseScreen.cpp index f6d89b663c..f4108a85f8 100644 --- a/UI/PauseScreen.cpp +++ b/UI/PauseScreen.cpp @@ -206,7 +206,7 @@ public: } std::string GetScreenshotTitle() const { - return SaveState::GetSlotDateAsString(gamePath_.ToString(), slot_); + return SaveState::GetSlotDateAsString(gamePath_, slot_); } UI::Event OnStateLoaded; @@ -229,7 +229,7 @@ private: SaveSlotView::SaveSlotView(const Path &gameFilename, int slot, UI::LayoutParams *layoutParams) : UI::LinearLayout(UI::ORIENT_HORIZONTAL, layoutParams), slot_(slot), gamePath_(gameFilename) { using namespace UI; - screenshotFilename_ = SaveState::GenerateSaveSlotFilename(gamePath_.ToString(), slot, SaveState::SCREENSHOT_EXTENSION); + screenshotFilename_ = SaveState::GenerateSaveSlotFilename(gamePath_, slot, SaveState::SCREENSHOT_EXTENSION); Add(new Spacer(5)); AsyncImageFileView *fv = Add(new AsyncImageFileView(screenshotFilename_, IS_DEFAULT, new UI::LayoutParams(82 * 2, 47 * 2))); @@ -246,11 +246,11 @@ SaveSlotView::SaveSlotView(const Path &gameFilename, int slot, UI::LayoutParams fv->OnClick.Handle(this, &SaveSlotView::OnScreenshotClick); - if (SaveState::HasSaveInSlot(gamePath_.ToString(), slot)) { + if (SaveState::HasSaveInSlot(gamePath_, slot)) { loadStateButton_ = buttons->Add(new Button(pa->T("Load State"), new LinearLayoutParams(0.0, G_VCENTER))); loadStateButton_->OnClick.Handle(this, &SaveSlotView::OnLoadState); - std::string dateStr = SaveState::GetSlotDateAsString(gamePath_.ToString(), slot_); + std::string dateStr = SaveState::GetSlotDateAsString(gamePath_, slot_); std::vector dateStrs; SplitString(dateStr, ' ', dateStrs); if (!dateStrs.empty() && !dateStrs[0].empty()) { @@ -281,7 +281,7 @@ static void AfterSaveStateAction(SaveState::Status status, const std::string &me UI::EventReturn SaveSlotView::OnLoadState(UI::EventParams &e) { g_Config.iCurrentStateSlot = slot_; - SaveState::LoadSlot(gamePath_.ToString(), slot_, &AfterSaveStateAction); + SaveState::LoadSlot(gamePath_, slot_, &AfterSaveStateAction); UI::EventParams e2{}; e2.v = this; OnStateLoaded.Trigger(e2); @@ -290,7 +290,7 @@ UI::EventReturn SaveSlotView::OnLoadState(UI::EventParams &e) { UI::EventReturn SaveSlotView::OnSaveState(UI::EventParams &e) { g_Config.iCurrentStateSlot = slot_; - SaveState::SaveSlot(gamePath_.ToString(), slot_, &AfterSaveStateAction); + SaveState::SaveSlot(gamePath_, slot_, &AfterSaveStateAction); UI::EventParams e2{}; e2.v = this; OnStateSaved.Trigger(e2); @@ -408,7 +408,7 @@ void GamePauseScreen::dialogFinished(const Screen *dialog, DialogResult dr) { ScreenshotViewScreen *s = (ScreenshotViewScreen *)dialog; int slot = s->GetSlot(); g_Config.iCurrentStateSlot = slot; - SaveState::LoadSlot(gamePath_.ToString(), slot, &AfterSaveStateAction); + SaveState::LoadSlot(gamePath_, slot, &AfterSaveStateAction); finishNextFrame_ = true; } else { @@ -421,7 +421,7 @@ UI::EventReturn GamePauseScreen::OnScreenshotClicked(UI::EventParams &e) { SaveSlotView *v = static_cast(e.v); int slot = v->GetSlot(); g_Config.iCurrentStateSlot = v->GetSlot(); - if (SaveState::HasSaveInSlot(gamePath_.ToString(), slot)) { + if (SaveState::HasSaveInSlot(gamePath_, slot)) { Path fn = v->GetScreenshotFilename(); std::string title = v->GetScreenshotTitle(); auto pa = GetI18NCategory("Pause"); diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index 39a48fe8a0..c0d790e06f 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -681,7 +681,7 @@ namespace MainWindow { case ID_FILE_QUICKLOADSTATE: { SetCursor(LoadCursor(0, IDC_WAIT)); - SaveState::LoadSlot(PSP_CoreParameter().fileToStart.ToString(), g_Config.iCurrentStateSlot, SaveStateActionFinished); + SaveState::LoadSlot(PSP_CoreParameter().fileToStart, g_Config.iCurrentStateSlot, SaveStateActionFinished); break; } @@ -690,14 +690,14 @@ namespace MainWindow { if (KeyMap::g_controllerMap[VIRTKEY_LOAD_STATE].empty()) { SetCursor(LoadCursor(0, IDC_WAIT)); - SaveState::LoadSlot(PSP_CoreParameter().fileToStart.ToString(), g_Config.iCurrentStateSlot, SaveStateActionFinished); + SaveState::LoadSlot(PSP_CoreParameter().fileToStart, g_Config.iCurrentStateSlot, SaveStateActionFinished); } break; } case ID_FILE_QUICKSAVESTATE: { SetCursor(LoadCursor(0, IDC_WAIT)); - SaveState::SaveSlot(PSP_CoreParameter().fileToStart.ToString(), g_Config.iCurrentStateSlot, SaveStateActionFinished); + SaveState::SaveSlot(PSP_CoreParameter().fileToStart, g_Config.iCurrentStateSlot, SaveStateActionFinished); break; } @@ -706,7 +706,7 @@ namespace MainWindow { if (KeyMap::g_controllerMap[VIRTKEY_SAVE_STATE].empty()) { SetCursor(LoadCursor(0, IDC_WAIT)); - SaveState::SaveSlot(PSP_CoreParameter().fileToStart.ToString(), g_Config.iCurrentStateSlot, SaveStateActionFinished); + SaveState::SaveSlot(PSP_CoreParameter().fileToStart, g_Config.iCurrentStateSlot, SaveStateActionFinished); break; } break; From a097403298eef706e82de25d1a20e605b5ac2de4 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 14 May 2021 23:08:00 -0700 Subject: [PATCH 7/7] Common: Remove File::GetFilename(). --- Common/File/FileUtil.cpp | 8 -------- Common/File/FileUtil.h | 3 --- Common/File/PathBrowser.cpp | 4 ++-- Core/System.cpp | 2 +- UI/GameInfoCache.cpp | 2 +- 5 files changed, 4 insertions(+), 15 deletions(-) diff --git a/Common/File/FileUtil.cpp b/Common/File/FileUtil.cpp index 64b661395a..c360055ccb 100644 --- a/Common/File/FileUtil.cpp +++ b/Common/File/FileUtil.cpp @@ -578,14 +578,6 @@ std::string GetDir(const std::string &path) { return cutpath; } -std::string GetFilename(std::string path) { - size_t off = GetDir(path).size() + 1; - if (off < path.size()) - return path.substr(off); - else - return path; -} - std::string GetFileExtension(const std::string & fn) { size_t pos = fn.rfind("."); if (pos == std::string::npos) { diff --git a/Common/File/FileUtil.h b/Common/File/FileUtil.h index a077c0c237..b918d90d4d 100644 --- a/Common/File/FileUtil.h +++ b/Common/File/FileUtil.h @@ -59,9 +59,6 @@ std::string GetFileExtension(const std::string &filename); // Extracts the directory from a path. std::string GetDir(const std::string &path); -// Extracts the filename from a path. -std::string GetFilename(std::string path); - // Returns struct with modification date of file bool GetModifTime(const Path &filename, tm &return_time); diff --git a/Common/File/PathBrowser.cpp b/Common/File/PathBrowser.cpp index 61797f2a1b..6608481636 100644 --- a/Common/File/PathBrowser.cpp +++ b/Common/File/PathBrowser.cpp @@ -209,9 +209,9 @@ bool PathBrowser::IsListingReady() { } std::string PathBrowser::GetFriendlyPath() const { - std::string str = GetPath().ToString(); + std::string str = GetPath().ToVisualString(); // Show relative to memstick root if there. - std::string root = GetSysDirectory(DIRECTORY_MEMSTICK_ROOT).ToString(); + std::string root = GetSysDirectory(DIRECTORY_MEMSTICK_ROOT).ToVisualString(); if (startsWith(str, root)) { return std::string("ms:/") + str.substr(root.size()); diff --git a/Core/System.cpp b/Core/System.cpp index 0fc1cc48d7..c2a5d01169 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -206,7 +206,7 @@ bool DiscIDFromGEDumpPath(const Path &path, FileLoader *fileLoader, std::string } // Fall back to using the filename. - std::string filename = File::GetFilename(path.ToString()); + std::string filename = path.GetFilename(); // Could be more discerning, but hey.. if (filename.size() > 10 && filename[0] == 'U' && filename[9] == '_') { *id = filename.substr(0, 9); diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index 99873b9172..64e95df69e 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -206,7 +206,7 @@ bool GameInfo::LoadFromPath(const Path &gamePath) { filePath_ = gamePath; // This is a fallback title, while we're loading / if unable to load. - title = File::GetFilename(filePath_.ToString()); + title = filePath_.GetFilename(); } return true;