Add shortcut for content_uri and native paths in CleanRecent. Saves 150ms.

This commit is contained in:
Henrik Rydgård 2021-11-13 22:47:29 +01:00
parent fc26beca4b
commit 42bc9066ee
2 changed files with 22 additions and 5 deletions

View file

@ -29,6 +29,7 @@
#include "Common/Net/URL.h"
#include "Common/Log.h"
#include "Common/TimeUtil.h"
#include "Common/Data/Format/IniFile.h"
#include "Common/Data/Format/JSONReader.h"
#include "Common/Data/Text/I18n.h"
@ -1643,18 +1644,34 @@ void Config::RemoveRecent(const std::string &file) {
}
void Config::CleanRecent() {
double startTime = time_now_d();
std::vector<std::string> cleanedRecent;
for (size_t i = 0; i < recentIsos.size(); i++) {
FileLoader *loader = ConstructFileLoader(Path(recentIsos[i]));
if (loader->ExistsFast()) {
bool exists = false;
Path path = Path(recentIsos[i]);
switch (path.Type()) {
case PathType::CONTENT_URI:
case PathType::NATIVE:
exists = File::Exists(path);
break;
default:
FileLoader *loader = ConstructFileLoader(path);
exists = loader->ExistsFast();
delete loader;
break;
}
if (exists) {
// Make sure we don't have any redundant items.
auto duplicate = std::find(cleanedRecent.begin(), cleanedRecent.end(), recentIsos[i]);
if (duplicate == cleanedRecent.end()) {
cleanedRecent.push_back(recentIsos[i]);
}
}
delete loader;
}
INFO_LOG(SYSTEM, "CleanRecent took %0.2f", time_now_d() - startTime);
recentIsos = cleanedRecent;
}

View file

@ -541,12 +541,12 @@ namespace MainWindow
}
void CreateGeDebuggerWindow() {
if (!geDebuggerWindow) {
#if PPSSPP_API(ANY_GL)
if (!geDebuggerWindow) {
geDebuggerWindow = new CGEDebugger(MainWindow::GetHInstance(), MainWindow::GetHWND());
DialogManager::AddDlg(geDebuggerWindow);
#endif
}
#endif
}
void CreateMemoryWindow() {