Remove unmotivated check preventing texture ini creation on mobile. (#15647)

* Remove unmotivated check preventing  texture ini creation on mobile.

Fixes #15644

* Show a "toast" message on platforms that don't support opening a text editor, when you try to create/open a texture ini file.

* Avoid the need to ifdef around calls to SystemToast

* UWP buildfix (and some warning fixes).

And possibly libretro fix

* Rename for a bit more consistency
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2022-07-10 22:34:44 +02:00
1 parent bc0b5d42ab
commit a831cab14c
56 files changed
+196 -23

No files matched your search

+20 -5
View File
@@ -1826,13 +1826,20 @@ void DeveloperToolsScreen::CreateViews() {
list->Add(new Choice(dev->T("Copy savestates to memstick root")))->OnClick.Handle(this, &DeveloperToolsScreen::OnCopyStatesToRoot);
#endif
#if !defined(MOBILE_DEVICE)
Choice *createTextureIni = list->Add(new Choice(dev->T("Create/Open textures.ini file for current game")));
createTextureIni->OnClick.Handle(this, &DeveloperToolsScreen::OnOpenTexturesIniFile);
// 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)) {
createTextureIni->SetEnabled(false);
}
}
if (!PSP_IsInited()) {
createTextureIni->SetEnabled(false);
}
#endif
}
void DeveloperToolsScreen::onFinish(DialogResult result) {
@@ -1889,8 +1896,17 @@ UI::EventReturn DeveloperToolsScreen::OnLoadLanguageIni(UI::EventParams &e) {
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)) {
File::OpenFileInEditor(generatedFilename);
if (System_GetPropertyBool(SYSPROP_SUPPORTS_OPEN_FILE_IN_EDITOR)) {
File::OpenFileInEditor(generatedFilename);
} else {
// Can't do much here, let's send a "toast" so the user sees that something happened.
auto dev = GetI18NCategory("Developer");
System_Toast((generatedFilename.ToVisualString() + ": " + dev->T("Texture ini file created")).c_str());
}
}
return UI::EVENT_DONE;
}
@@ -2199,8 +2215,7 @@ void GestureMappingScreen::CreateViews() {
vert->Add(new PopupMultiChoice(&g_Config.iSwipeRight, mc->T("Swipe Right"), gestureButton, 0, ARRAY_SIZE(gestureButton), mc->GetName(), screenManager()))->SetEnabledPtr(&g_Config.bGestureControlEnabled);
vert->Add(new PopupSliderChoiceFloat(&g_Config.fSwipeSensitivity, 0.01f, 1.0f, co->T("Swipe sensitivity"), 0.01f, screenManager(), "x"))->SetEnabledPtr(&g_Config.bGestureControlEnabled);
vert->Add(new PopupSliderChoiceFloat(&g_Config.fSwipeSmoothing, 0.0f, 0.95f, co->T("Swipe smoothing"), 0.05f, screenManager(), "x"))->SetEnabledPtr(&g_Config.bGestureControlEnabled);
vert->Add(new ItemHeader(co->T("Double tap")));
vert->Add(new PopupMultiChoice(&g_Config.iDoubleTapGesture, mc->T("Double tap button"), gestureButton, 0, ARRAY_SIZE(gestureButton), mc->GetName(), screenManager()))->SetEnabledPtr(&g_Config.bGestureControlEnabled);
}