mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Revert creating ToShortFriendlyPath, more cleanup
Path preview can actually solved within ToVisualString without creating another function, I feel it will cause confusing as both function will be similar.
This commit is contained in:
parent
b75cf52909
commit
f86a462145
@ -19,7 +19,6 @@
|
||||
#include <cinttypes>
|
||||
|
||||
#include "Common/Log.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Common/File/Path.h"
|
||||
#include "Common/File/AndroidStorage.h"
|
||||
#include "Common/Data/Encoding/Utf8.h"
|
||||
|
@ -845,12 +845,11 @@ uint64_t GetFileSize(const Path &filename) {
|
||||
#if defined(_WIN32) && defined(UNICODE)
|
||||
WIN32_FILE_ATTRIBUTE_DATA attr;
|
||||
#if PPSSPP_PLATFORM(UWP)
|
||||
if (!GetFileAttributesExFromAppW(filename.ToWString().c_str(), GetFileExInfoStandard, &attr)) {
|
||||
if (!GetFileAttributesExFromAppW(filename.ToWString().c_str(), GetFileExInfoStandard, &attr))
|
||||
#else
|
||||
if (!GetFileAttributesEx(filename.ToWString().c_str(), GetFileExInfoStandard, &attr)){
|
||||
if (!GetFileAttributesEx(filename.ToWString().c_str(), GetFileExInfoStandard, &attr))
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
if (attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
return 0;
|
||||
return ((uint64_t)attr.nFileSizeHigh << 32) | (uint64_t)attr.nFileSizeLow;
|
||||
|
@ -269,6 +269,9 @@ std::string Path::ToVisualString(const char *relativeRoot) const {
|
||||
return AndroidContentURI(path_).ToVisualString();
|
||||
#if PPSSPP_PLATFORM(WINDOWS)
|
||||
} else if (type_ == PathType::NATIVE) {
|
||||
#if PPSSPP_PLATFORM(UWP) && !defined(__LIBRETRO__)
|
||||
return GetPreviewPath(path_);
|
||||
#else
|
||||
// It can be useful to show the path as relative to the memstick
|
||||
if (relativeRoot) {
|
||||
std::string root = ReplaceAll(relativeRoot, "/", "\\");
|
||||
@ -281,6 +284,7 @@ std::string Path::ToVisualString(const char *relativeRoot) const {
|
||||
} else {
|
||||
return ReplaceAll(path_, "/", "\\");
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
if (relativeRoot) {
|
||||
std::string root = relativeRoot;
|
||||
@ -298,14 +302,6 @@ std::string Path::ToVisualString(const char *relativeRoot) const {
|
||||
}
|
||||
}
|
||||
|
||||
std::string Path::ToShortFriendlyPath() const {
|
||||
#if PPSSPP_PLATFORM(UWP) && !defined(__LIBRETRO__)
|
||||
return GetPreviewPath(path_);
|
||||
#else
|
||||
return Path(path_).ToVisualString();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Path::CanNavigateUp() const {
|
||||
if (type_ == PathType::CONTENT_URI) {
|
||||
return AndroidContentURI(path_).CanNavigateUp();
|
||||
|
@ -94,7 +94,6 @@ public:
|
||||
|
||||
// Pass in a relative root to turn the path into a relative path - if it is one!
|
||||
std::string ToVisualString(const char *relativeRoot = nullptr) const;
|
||||
std::string ToShortFriendlyPath() const;
|
||||
|
||||
bool CanNavigateUp() const;
|
||||
Path NavigateUp() const;
|
||||
|
@ -193,7 +193,7 @@ bool PathBrowser::IsListingReady() {
|
||||
}
|
||||
|
||||
std::string PathBrowser::GetFriendlyPath() const {
|
||||
std::string str = GetPath().ToShortFriendlyPath();
|
||||
std::string str = GetPath().ToVisualString();
|
||||
// Show relative to memstick root if there.
|
||||
if (startsWith(str, aliasMatch_)) {
|
||||
return aliasDisplay_ + str.substr(aliasMatch_.size());
|
||||
|
@ -652,10 +652,10 @@ void SystemInfoScreen::CreateViews() {
|
||||
|
||||
storage->Add(new ItemHeader(si->T("Directories")));
|
||||
// Intentionally non-translated
|
||||
storage->Add(new InfoItem("MemStickDirectory", g_Config.memStickDirectory.ToShortFriendlyPath()));
|
||||
storage->Add(new InfoItem("InternalDataDirectory", g_Config.internalDataDirectory.ToShortFriendlyPath()));
|
||||
storage->Add(new InfoItem("AppCacheDir", g_Config.appCacheDirectory.ToShortFriendlyPath()));
|
||||
storage->Add(new InfoItem("DefaultCurrentDir", g_Config.defaultCurrentDirectory.ToShortFriendlyPath()));
|
||||
storage->Add(new InfoItem("MemStickDirectory", g_Config.memStickDirectory.ToVisualString()));
|
||||
storage->Add(new InfoItem("InternalDataDirectory", g_Config.internalDataDirectory.ToVisualString()));
|
||||
storage->Add(new InfoItem("AppCacheDir", g_Config.appCacheDirectory.ToVisualString()));
|
||||
storage->Add(new InfoItem("DefaultCurrentDir", g_Config.defaultCurrentDirectory.ToVisualString()));
|
||||
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
storage->Add(new InfoItem("ExtFilesDir", g_extFilesDir));
|
||||
|
@ -115,7 +115,7 @@ void GameScreen::CreateViews() {
|
||||
tvID_ = infoLayout->Add(new TextView("", ALIGN_LEFT | FLAG_WRAP_TEXT, true, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)));
|
||||
tvID_->SetShadow(true);
|
||||
// This one doesn't need to be updated.
|
||||
infoLayout->Add(new TextView(gamePath_.ToShortFriendlyPath(), ALIGN_LEFT | FLAG_WRAP_TEXT, true, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetShadow(true);
|
||||
infoLayout->Add(new TextView(gamePath_.ToVisualString(), ALIGN_LEFT | FLAG_WRAP_TEXT, true, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetShadow(true);
|
||||
tvGameSize_ = infoLayout->Add(new TextView("...", ALIGN_LEFT, true, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)));
|
||||
tvGameSize_->SetShadow(true);
|
||||
tvSaveDataSize_ = infoLayout->Add(new TextView("...", ALIGN_LEFT, true, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)));
|
||||
|
@ -992,7 +992,7 @@ void GameSettingsScreen::CreateSystemSettings(UI::ViewGroup *systemSettings) {
|
||||
}
|
||||
#elif defined(_WIN32)
|
||||
#if PPSSPP_PLATFORM(UWP)
|
||||
memstickDisplay_ = g_Config.memStickDirectory.ToShortFriendlyPath();
|
||||
memstickDisplay_ = g_Config.memStickDirectory.ToVisualString();
|
||||
auto memstickPath = systemSettings->Add(new ChoiceWithValueDisplay(&memstickDisplay_, sy->T("Memory Stick folder", "Memory Stick folder"), I18NCat::NONE));
|
||||
memstickPath->SetEnabled(!PSP_IsInited());
|
||||
memstickPath->OnClick.Handle(this, &GameSettingsScreen::OnChangeMemStickDir);
|
||||
|
@ -267,7 +267,7 @@ void MemStickScreen::CreateViews() {
|
||||
if (choice_ == CHOICE_BROWSE_FOLDER || choice_ == CHOICE_SET_MANUAL) {
|
||||
UI::View *extraView = nullptr;
|
||||
if (!g_Config.memStickDirectory.empty()) {
|
||||
extraView = new TextView(StringFromFormat(" %s: %s", iz->T("Current"), g_Config.memStickDirectory.ToShortFriendlyPath().c_str()), ALIGN_LEFT, false);
|
||||
extraView = new TextView(StringFromFormat(" %s: %s", iz->T("Current"), g_Config.memStickDirectory.ToVisualString().c_str()), ALIGN_LEFT, false);
|
||||
}
|
||||
AddExplanation(leftColumn, (MemStickScreen::Choice)choice_, extraView);
|
||||
}
|
||||
@ -584,7 +584,7 @@ void ConfirmMemstickMoveScreen::CreateViews() {
|
||||
if (!initialSetup_) {
|
||||
leftColumn->Add(new TextView(iz->T("PPSSPP will restart after the change"), ALIGN_LEFT, false));
|
||||
}
|
||||
leftColumn->Add(new TextView(newMemstickFolder_.ToShortFriendlyPath(), ALIGN_LEFT, false));
|
||||
leftColumn->Add(new TextView(newMemstickFolder_.ToVisualString(), ALIGN_LEFT, false));
|
||||
std::string newFreeSpaceText = std::string(iz->T("Free space")) + ": " + FormatSpaceString(freeSpaceNew);
|
||||
leftColumn->Add(new TextView(newFreeSpaceText, ALIGN_LEFT, false));
|
||||
if (existingFilesInNewFolder_) {
|
||||
@ -601,7 +601,7 @@ void ConfirmMemstickMoveScreen::CreateViews() {
|
||||
std::string oldFreeSpaceText = std::string(iz->T("Free space")) + ": " + FormatSpaceString(freeSpaceOld);
|
||||
|
||||
rightColumn->Add(new TextView(std::string(iz->T("Current")) + ":", ALIGN_LEFT, false));
|
||||
rightColumn->Add(new TextView(oldMemstickFolder.ToShortFriendlyPath(), ALIGN_LEFT, false));
|
||||
rightColumn->Add(new TextView(oldMemstickFolder.ToVisualString(), ALIGN_LEFT, false));
|
||||
rightColumn->Add(new TextView(oldFreeSpaceText, ALIGN_LEFT, false));
|
||||
}
|
||||
|
||||
|
11
UWP/App.cpp
11
UWP/App.cpp
@ -15,7 +15,6 @@
|
||||
#include <ppltasks.h>
|
||||
|
||||
#include "UWPHelpers/LaunchItem.h"
|
||||
#include <regex>
|
||||
|
||||
using namespace UWP;
|
||||
|
||||
@ -125,8 +124,7 @@ bool App::HasBackButton() {
|
||||
void App::App_BackRequested(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs^ e) {
|
||||
if (m_isPhone) {
|
||||
e->Handled = m_main->OnHardwareButton(HardwareButton::BACK);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
e->Handled = true;
|
||||
}
|
||||
}
|
||||
@ -163,7 +161,7 @@ void App::OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::C
|
||||
float X = args->CurrentPoint->Position.X;
|
||||
float Y = args->CurrentPoint->Position.Y;
|
||||
int64_t timestamp = args->CurrentPoint->Timestamp;
|
||||
m_main->OnTouchEvent(TOUCH_DOWN | TOUCH_MOVE, pointerId, X, Y, (double)timestamp);
|
||||
m_main->OnTouchEvent(TOUCH_DOWN|TOUCH_MOVE, pointerId, X, Y, (double)timestamp);
|
||||
if (!m_isPhone) {
|
||||
sender->SetPointerCapture();
|
||||
}
|
||||
@ -176,7 +174,7 @@ void App::OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::
|
||||
float X = args->CurrentPoint->Position.X;
|
||||
float Y = args->CurrentPoint->Position.Y;
|
||||
int64_t timestamp = args->CurrentPoint->Timestamp;
|
||||
m_main->OnTouchEvent(TOUCH_UP | TOUCH_MOVE, pointerId, X, Y, (double)timestamp);
|
||||
m_main->OnTouchEvent(TOUCH_UP|TOUCH_MOVE, pointerId, X, Y, (double)timestamp);
|
||||
if (!m_isPhone) {
|
||||
sender->ReleasePointerCapture();
|
||||
}
|
||||
@ -206,8 +204,7 @@ void App::Run() {
|
||||
if (m_main->Render()) {
|
||||
m_deviceResources->Present();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending);
|
||||
}
|
||||
}
|
||||
|
@ -461,7 +461,7 @@ bool System_GetPropertyBool(SystemProperty prop) {
|
||||
case SYSPROP_HAS_FILE_BROWSER:
|
||||
return true;
|
||||
case SYSPROP_HAS_FOLDER_BROWSER:
|
||||
return true; // now supported
|
||||
return true;
|
||||
case SYSPROP_HAS_IMAGE_BROWSER:
|
||||
return true; // we just use the file browser
|
||||
case SYSPROP_HAS_BACK_BUTTON:
|
||||
|
Loading…
Reference in New Issue
Block a user