mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-24 11:49:05 +02:00
UI: Reduce IO for texture ini on dev settings.
This commit is contained in:
1 parent
b529313db2
commit
020dcc9d68
2 files changed
+15
-7
No files matched your search
@@ -1826,18 +1826,20 @@ void DeveloperToolsScreen::CreateViews() {
|
||||
list->Add(new Choice(dev->T("Copy savestates to memstick root")))->OnClick.Handle(this, &DeveloperToolsScreen::OnCopyStatesToRoot);
|
||||
#endif
|
||||
|
||||
// Reconsider whenever recreating views.
|
||||
hasTexturesIni_ = HasIni::MAYBE;
|
||||
|
||||
Choice *createTextureIni = list->Add(new Choice(dev->T("Create/Open textures.ini file for current game")));
|
||||
createTextureIni->OnClick.Handle(this, &DeveloperToolsScreen::OnOpenTexturesIniFile);
|
||||
createTextureIni->SetEnabledFunc([] {
|
||||
createTextureIni->SetEnabledFunc([&] {
|
||||
if (!PSP_IsInited())
|
||||
return false;
|
||||
|
||||
// Disable the choice to Open/Create if the textures.ini file already exists, and we can't open it due to platform support limitations.
|
||||
if (!System_GetPropertyBool(SYSPROP_SUPPORTS_OPEN_FILE_IN_EDITOR)) {
|
||||
std::string gameID = g_paramSFO.GetDiscID();
|
||||
if (TextureReplacer::IniExists(gameID)) {
|
||||
return false;
|
||||
}
|
||||
if (hasTexturesIni_ == HasIni::MAYBE)
|
||||
hasTexturesIni_ = TextureReplacer::IniExists(g_paramSFO.GetDiscID()) ? HasIni::YES : HasIni::NO;
|
||||
return hasTexturesIni_ != HasIni::YES;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
@@ -1898,8 +1900,6 @@ UI::EventReturn DeveloperToolsScreen::OnOpenTexturesIniFile(UI::EventParams &e)
|
||||
std::string gameID = g_paramSFO.GetDiscID();
|
||||
Path generatedFilename;
|
||||
|
||||
bool existedBefore = TextureReplacer::IniExists(gameID);
|
||||
|
||||
if (TextureReplacer::GenerateIni(gameID, generatedFilename)) {
|
||||
if (System_GetPropertyBool(SYSPROP_SUPPORTS_OPEN_FILE_IN_EDITOR)) {
|
||||
File::OpenFileInEditor(generatedFilename);
|
||||
@@ -1908,6 +1908,8 @@ UI::EventReturn DeveloperToolsScreen::OnOpenTexturesIniFile(UI::EventParams &e)
|
||||
auto dev = GetI18NCategory("Developer");
|
||||
System_Toast((generatedFilename.ToVisualString() + ": " + dev->T("Texture ini file created")).c_str());
|
||||
}
|
||||
|
||||
hasTexturesIni_ = HasIni::YES;
|
||||
}
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
@@ -181,6 +181,12 @@ private:
|
||||
|
||||
bool allowDebugger_ = false;
|
||||
bool canAllowDebugger_ = true;
|
||||
enum class HasIni {
|
||||
NO,
|
||||
YES,
|
||||
MAYBE,
|
||||
};
|
||||
HasIni hasTexturesIni_ = HasIni::MAYBE;
|
||||
};
|
||||
|
||||
class HostnameSelectScreen : public PopupScreen {
|
||||
|
||||
Reference in new issue
Block a user