mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Address a bunch of the feedback
This commit is contained in:
parent
27dbcd3b34
commit
37d651a89d
@ -1132,35 +1132,65 @@ list(APPEND NativeAppSource
|
||||
android/jni/TestRunner.cpp
|
||||
UI/DiscordIntegration.cpp
|
||||
UI/NativeApp.cpp
|
||||
UI/BackgroundAudio.h
|
||||
UI/BackgroundAudio.cpp
|
||||
UI/ChatScreen.h
|
||||
UI/ChatScreen.cpp
|
||||
UI/DevScreens.cpp
|
||||
UI/DevScreens.h
|
||||
UI/DisplayLayoutEditor.cpp
|
||||
UI/DisplayLayoutEditor.h
|
||||
UI/DisplayLayoutScreen.cpp
|
||||
UI/DisplayLayoutScreen.h
|
||||
UI/EmuScreen.h
|
||||
UI/EmuScreen.cpp
|
||||
UI/GameInfoCache.h
|
||||
UI/GameInfoCache.cpp
|
||||
UI/MainScreen.h
|
||||
UI/MainScreen.cpp
|
||||
UI/MiscScreens.h
|
||||
UI/MiscScreens.cpp
|
||||
UI/PauseScreen.h
|
||||
UI/PauseScreen.cpp
|
||||
UI/GameScreen.h
|
||||
UI/GameScreen.cpp
|
||||
UI/GameSettingsScreen.h
|
||||
UI/GameSettingsScreen.cpp
|
||||
UI/GPUDriverTestScreen.h
|
||||
UI/GPUDriverTestScreen.cpp
|
||||
UI/TiltAnalogSettingsScreen.h
|
||||
UI/TiltAnalogSettingsScreen.cpp
|
||||
UI/TiltEventProcessor.h
|
||||
UI/TiltEventProcessor.cpp
|
||||
UI/TouchControlLayoutScreen.h
|
||||
UI/TouchControlLayoutScreen.cpp
|
||||
UI/TouchControlVisibilityScreen.h
|
||||
UI/TouchControlVisibilityScreen.cpp
|
||||
UI/GamepadEmu.h
|
||||
UI/GamepadEmu.cpp
|
||||
UI/OnScreenDisplay.h
|
||||
UI/OnScreenDisplay.cpp
|
||||
UI/ControlMappingScreen.h
|
||||
UI/ControlMappingScreen.cpp
|
||||
UI/RemoteISOScreen.h
|
||||
UI/RemoteISOScreen.cpp
|
||||
UI/ReportScreen.h
|
||||
UI/ReportScreen.cpp
|
||||
UI/SavedataScreen.h
|
||||
UI/SavedataScreen.cpp
|
||||
UI/Store.h
|
||||
UI/Store.cpp
|
||||
UI/CwCheatScreen.h
|
||||
UI/CwCheatScreen.cpp
|
||||
UI/InstallZipScreen.h
|
||||
UI/InstallZipScreen.cpp
|
||||
UI/MemStickScreen.h
|
||||
UI/MemStickScreen.cpp
|
||||
UI/ProfilerDraw.h
|
||||
UI/ProfilerDraw.cpp
|
||||
UI/TextureUtil.h
|
||||
UI/TextureUtil.cpp
|
||||
UI/ComboKeyMappingScreen.h
|
||||
UI/ComboKeyMappingScreen.cpp
|
||||
)
|
||||
|
||||
|
@ -35,7 +35,6 @@ bool GetFileInfo(const Path &path, FileInfo *fileInfo);
|
||||
|
||||
enum {
|
||||
GETFILES_GETHIDDEN = 1,
|
||||
GETFILES_URIENCODE_ANDROID = 2, // Android shenanigans
|
||||
};
|
||||
|
||||
size_t GetFilesInDir(const Path &directory, std::vector<FileInfo> *files, const char *filter = nullptr, int flags = 0);
|
||||
|
@ -479,7 +479,7 @@ bool CreateFullPath(const Path &path) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Deletes a directory filename, returns true on success
|
||||
// Deletes an empty directory, returns true on success
|
||||
bool DeleteDir(const Path &path) {
|
||||
switch (path.Type()) {
|
||||
case PathType::NATIVE:
|
||||
@ -492,8 +492,7 @@ bool DeleteDir(const Path &path) {
|
||||
INFO_LOG(COMMON, "DeleteDir: directory %s", path.c_str());
|
||||
|
||||
// check if a directory
|
||||
if (!File::IsDirectory(path))
|
||||
{
|
||||
if (!File::IsDirectory(path)) {
|
||||
ERROR_LOG(COMMON, "DeleteDir: Not a directory %s", path.c_str());
|
||||
return false;
|
||||
}
|
||||
@ -650,13 +649,21 @@ bool Move(const Path &srcFilename, const Path &destFilename) {
|
||||
// Returns the size of file (64bit)
|
||||
// TODO: Add a way to return an error.
|
||||
uint64_t GetFileSize(const Path &filename) {
|
||||
if (Android_IsContentUri(filename.ToString())) {
|
||||
FileInfo info;
|
||||
if (Android_GetFileInfo(filename.ToString(), &info)) {
|
||||
return info.size;
|
||||
} else {
|
||||
return 0;
|
||||
switch (filename.Type()) {
|
||||
case PathType::NATIVE:
|
||||
break; // OK
|
||||
case PathType::CONTENT_URI:
|
||||
{
|
||||
FileInfo info;
|
||||
if (Android_GetFileInfo(filename.ToString(), &info)) {
|
||||
return info.size;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && defined(UNICODE)
|
||||
@ -738,84 +745,38 @@ bool CreateEmptyFile(const Path &filename) {
|
||||
}
|
||||
|
||||
// Deletes the given directory and anything under it. Returns true on success.
|
||||
bool DeleteDirRecursively(const Path &directory) {
|
||||
if (Android_IsContentUri(directory.ToString())) {
|
||||
ERROR_LOG(COMMON, "DeleteDirRecursively(%s) not yet supported on content URIs", directory.c_str());
|
||||
bool DeleteDirRecursively(const Path &directory) {
|
||||
switch (directory.Type()) {
|
||||
case PathType::CONTENT_URI:
|
||||
case PathType::NATIVE:
|
||||
break; // OK
|
||||
default:
|
||||
ERROR_LOG(COMMON, "DeleteDirRecursively: Path type not supported");
|
||||
return false;
|
||||
}
|
||||
|
||||
//Removed check, it prevents the UWP from deleting store downloads
|
||||
INFO_LOG(COMMON, "DeleteDirRecursively: %s", directory.c_str());
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
// Find the first file in the directory.
|
||||
WIN32_FIND_DATA ffd;
|
||||
HANDLE hFind = FindFirstFile((directory.ToWString() + L"\\*").c_str(), &ffd);
|
||||
if (hFind == INVALID_HANDLE_VALUE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// windows loop
|
||||
do {
|
||||
const std::string virtualName = ConvertWStringToUTF8(ffd.cFileName);
|
||||
#else
|
||||
struct dirent *result = NULL;
|
||||
DIR *dirp = opendir(directory.c_str());
|
||||
if (!dirp)
|
||||
return false;
|
||||
|
||||
// non windows loop
|
||||
while ((result = readdir(dirp))) {
|
||||
const std::string virtualName = result->d_name;
|
||||
#endif
|
||||
// check for "." and ".."
|
||||
if (((virtualName[0] == '.') && (virtualName[1] == '\0')) ||
|
||||
((virtualName[0] == '.') && (virtualName[1] == '.') &&
|
||||
(virtualName[2] == '\0')))
|
||||
continue;
|
||||
|
||||
Path newPath = directory / virtualName;
|
||||
if (IsDirectory(newPath)) {
|
||||
if (!DeleteDirRecursively(newPath)) {
|
||||
#ifndef _WIN32
|
||||
closedir(dirp);
|
||||
#else
|
||||
FindClose(hFind);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
std::vector<FileInfo> files;
|
||||
GetFilesInDir(directory, &files, nullptr, GETFILES_GETHIDDEN);
|
||||
for (const auto &file : files) {
|
||||
if (file.isDirectory) {
|
||||
DeleteDirRecursively(file.fullName);
|
||||
} else {
|
||||
Delete(file.fullName);
|
||||
}
|
||||
else {
|
||||
if (!File::Delete(newPath)) {
|
||||
#ifndef _WIN32
|
||||
closedir(dirp);
|
||||
#else
|
||||
FindClose(hFind);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
} while (FindNextFile(hFind, &ffd) != 0);
|
||||
FindClose(hFind);
|
||||
#else
|
||||
}
|
||||
closedir(dirp);
|
||||
#endif
|
||||
return File::DeleteDir(directory);
|
||||
return DeleteDir(directory);
|
||||
}
|
||||
|
||||
bool OpenFileInEditor(const Path &fileName) {
|
||||
if (Android_IsContentUri(fileName.ToString())) {
|
||||
// TODO: This might even be supportable?
|
||||
|
||||
ERROR_LOG(COMMON, "OpenFileInEditor(%s) not yet supported on content URIs", fileName.c_str());
|
||||
switch (fileName.Type()) {
|
||||
case PathType::NATIVE:
|
||||
break; // OK
|
||||
default:
|
||||
ERROR_LOG(COMMON, "OpenFileInEditor(%s): Path type not supported", fileName.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if PPSSPP_PLATFORM(WINDOWS)
|
||||
#if PPSSPP_PLATFORM(UWP)
|
||||
// Do nothing.
|
||||
#else
|
||||
|
@ -78,7 +78,9 @@ public:
|
||||
bool CanNavigateUp() const;
|
||||
Path NavigateUp() const;
|
||||
|
||||
Path GetRootVolume() const; // Navigates as far up as possible on the current volume, whatever that is. If not possible, returns the same path.
|
||||
// Navigates as far up as possible from this path. If not possible to navigate upwards, returns the same path.
|
||||
// Not actually always the root of the volume, especially on systems like Mac and Linux where things are often mounted.
|
||||
Path GetRootVolume() const;
|
||||
|
||||
std::string PathTo(const Path &child);
|
||||
|
||||
|
@ -83,7 +83,7 @@ void MemStickScreen::CreateViews() {
|
||||
|
||||
std::string freeSpaceText = "Free space: N/A";
|
||||
if (freeSpaceAtMemStick >= 0) {
|
||||
freeSpaceText = StringFromFormat("free space: %lld bytes", freeSpaceAtMemStick);
|
||||
freeSpaceText = StringFromFormat("free space: %lld MB", freeSpaceAtMemStick / (1024 * 1024));
|
||||
}
|
||||
|
||||
leftColumn->Add(new TextView(freeSpaceText, ALIGN_LEFT, false, new AnchorLayoutParams(10, 240, NONE, NONE)));
|
||||
@ -117,8 +117,8 @@ void MemStickScreen::CallbackMemStickFolder(bool yes) {
|
||||
auto sy = GetI18NCategory("System");
|
||||
|
||||
if (yes) {
|
||||
Path memStickDirFile = Path(g_Config.internalDataDirectory) / "memstick_dir.txt";
|
||||
Path testWriteFile = Path(pendingMemStickFolder_) / ".write_verify_file";
|
||||
Path memStickDirFile = g_Config.internalDataDirectory / "memstick_dir.txt";
|
||||
Path testWriteFile = pendingMemStickFolder_ / ".write_verify_file";
|
||||
|
||||
// Doesn't already exist, create.
|
||||
// Should this ever happen?
|
||||
|
@ -14,8 +14,9 @@ dependencies {
|
||||
def appcompat_version = "1.2.0"
|
||||
|
||||
implementation "androidx.appcompat:appcompat:$appcompat_version"
|
||||
// For loading and tinting drawables on older versions of the platform
|
||||
// implementation "androidx.appcompat:appcompat-resources:$appcompat_version"
|
||||
|
||||
// Convenient wrapper around DocumentContract. Might look into writing our own
|
||||
// to see if there's some performance to squeeze at some point, but doubt it.
|
||||
implementation "androidx.documentfile:documentfile:1.0.1"
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user