mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-19 21:52:45 +00:00
Show the path to access PSP data through USB in the settings screen.
This commit is contained in:
parent
adac44fd9b
commit
80d4450e84
@ -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)
|
||||
|
@ -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 {
|
||||
|
@ -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_)
|
||||
|
Loading…
x
Reference in New Issue
Block a user