diff --git a/Common/UI/View.cpp b/Common/UI/View.cpp index 71096012f2..1012da916a 100644 --- a/Common/UI/View.cpp +++ b/Common/UI/View.cpp @@ -540,6 +540,11 @@ void InfoItem::Draw(UIContext &dc) { UI::Style style = HasFocus() ? dc.theme->itemFocusedStyle : dc.theme->infoStyle; + if (choiceStyle_) { + style = dc.theme->buttonStyle; + } + + if (style.background.type == DRAW_SOLID_COLOR) { // For a smoother fade, using the same color with 0 alpha. if ((style.background.color & 0xFF000000) == 0) diff --git a/Common/UI/View.h b/Common/UI/View.h index adcddd758a..710c7634ea 100644 --- a/Common/UI/View.h +++ b/Common/UI/View.h @@ -765,6 +765,9 @@ public: void SetRightText(const std::string &text) { rightText_ = text; } + void SetChoiceStyle(bool choiceStyle) { + choiceStyle_ = choiceStyle; + } private: CallbackColorTween *bgColor_ = nullptr; @@ -772,6 +775,8 @@ private: std::string text_; std::string rightText_; + + bool choiceStyle_ = false; }; class ItemHeader : public Item { diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 41920ffa9f..2655094776 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -82,6 +82,7 @@ #if PPSSPP_PLATFORM(ANDROID) #include "android/jni/AndroidAudio.h" +#include "android/jni/AndroidContentURI.h" extern AndroidAudioState *g_audioState; @@ -163,6 +164,31 @@ static std::string *GPUDeviceNameSetting() { return nullptr; } +bool PathToVisualUsbPath(Path path, std::string &outPath) { + switch (path.Type()) { + case PathType::NATIVE: + if (path.StartsWith(g_Config.memStickDirectory)) { + return g_Config.memStickDirectory.ComputePathTo(path, outPath); + } + break; + case PathType::CONTENT_URI: +#if PPSSPP_PLATFORM(ANDROID) + { + // Try to parse something sensible out of the content URI. + AndroidContentURI uri(path.ToString()); + outPath = uri.RootPath(); + if (startsWith(outPath, "primary:")) { + outPath = "/" + outPath.substr(8); + } + return true; + } +#endif + default: + break; + } + return false; +} + void GameSettingsScreen::CreateViews() { ReloadAllPostShaderInfo(); @@ -896,9 +922,19 @@ void GameSettingsScreen::CreateViews() { #if PPSSPP_PLATFORM(ANDROID) memstickDisplay_ = g_Config.memStickDirectory.ToVisualString(); - auto memstickPath = systemSettings->Add(new ChoiceWithValueDisplay(&memstickDisplay_, sy->T("Change Memory Stick folder", "Memory Stick folder"), (const char *)nullptr)); + auto memstickPath = systemSettings->Add(new ChoiceWithValueDisplay(&memstickDisplay_, sy->T("Memory Stick folder", "Memory Stick folder"), (const char *)nullptr)); memstickPath->SetEnabled(!PSP_IsInited()); memstickPath->OnClick.Handle(this, &GameSettingsScreen::OnChangeMemStickDir); + + // Display USB path for convenience. + std::string usbPath; + if (PathToVisualUsbPath(g_Config.memStickDirectory, usbPath)) { + if (usbPath.empty()) { + // Probably it's just the root. So let's add PSP to make it clear. + usbPath = "/PSP"; + } + systemSettings->Add(new InfoItem(sy->T("USB"), usbPath))->SetChoiceStyle(true); + } #elif defined(_WIN32) && !PPSSPP_PLATFORM(UWP) SavePathInMyDocumentChoice = systemSettings->Add(new CheckBox(&installed_, sy->T("Save path in My Documents", "Save path in My Documents"))); SavePathInMyDocumentChoice->SetEnabled(!PSP_IsInited()); @@ -944,7 +980,8 @@ void GameSettingsScreen::CreateViews() { } #endif systemSettings->Add(new CheckBox(&g_Config.bMemStickInserted, sy->T("Memory Stick inserted"))); - systemSettings->Add(new PopupSliderChoice(&g_Config.iMemStickSizeGB, 1, 32, sy->T("Change Memory Stick Size", "Memory Stick Size (GB)"), screenManager(), "GB")); + UI::PopupSliderChoice *sizeChoice = systemSettings->Add(new PopupSliderChoice(&g_Config.iMemStickSizeGB, 1, 32, sy->T("Memory Stick size", "Memory Stick size"), screenManager(), "GB")); + sizeChoice->SetFormat("%d GB"); systemSettings->Add(new ItemHeader(sy->T("Help the PPSSPP team"))); if (!enableReportsSet_)