mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-10 16:23:05 +00:00
Free space and other fixes
- Fixed freespace value - added back BOOTABLE case to BROWSE_FOR_FILE - Fixed fake folder info - Fixed some code formating
This commit is contained in:
parent
9b0577351f
commit
808ff28aa5
@ -25,19 +25,18 @@
|
||||
#include "Common/Data/Encoding/Utf8.h"
|
||||
|
||||
#if PPSSPP_PLATFORM(UWP)
|
||||
#include <UWP/UWPHelpers/StorageManager.h>
|
||||
#include "UWP/UWPHelpers/StorageManager.h"
|
||||
#endif
|
||||
|
||||
bool free_disk_space(const Path &path, int64_t &space) {
|
||||
#ifdef _WIN32
|
||||
ULARGE_INTEGER free;
|
||||
#if PPSSPP_PLATFORM(UWP)
|
||||
if (path == g_Config.internalDataDirectory) {
|
||||
space = GetLocalFreeSpace();
|
||||
if (GetDriveFreeSpace(path, space)) {
|
||||
return true;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
// Is 'GetDiskFreeSpaceExW' returning wrong values in UWP?
|
||||
if (GetDiskFreeSpaceExW(path.ToWString().c_str(), &free, nullptr, nullptr)) {
|
||||
space = free.QuadPart;
|
||||
return true;
|
||||
|
@ -768,7 +768,6 @@ void InitSysDirectories() {
|
||||
File::CreateDir(GetSysDirectory(DIRECTORY_SAVESTATE));
|
||||
File::CreateDir(GetSysDirectory(DIRECTORY_SYSTEM));
|
||||
File::CreateDir(GetSysDirectory(DIRECTORY_TEXTURES));
|
||||
File::CreateDir(GetSysDirectory(DIRECTORY_CHEATS));
|
||||
|
||||
if (g_Config.currentDirectory.empty()) {
|
||||
g_Config.currentDirectory = GetSysDirectory(DIRECTORY_GAME);
|
||||
|
@ -253,7 +253,7 @@ void App::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args) {
|
||||
create_task([app, deferral]() {
|
||||
g_Config.Save("App::OnSuspending");
|
||||
app->m_deviceResources->Trim();
|
||||
deferral->Complete();
|
||||
deferral->Complete();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -536,8 +536,11 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
|
||||
}
|
||||
case SystemRequestType::BROWSE_FOR_FILE:
|
||||
{
|
||||
std::vector<std::string> supportedExtensions = { ".cso", ".bin", ".iso", ".elf", ".pbp", ".zip"};
|
||||
std::vector<std::string> supportedExtensions = {};
|
||||
switch ((BrowseFileType)param3) {
|
||||
case BrowseFileType::BOOTABLE:
|
||||
supportedExtensions = { ".cso", ".bin", ".iso", ".elf", ".pbp", ".zip" };
|
||||
break;
|
||||
case BrowseFileType::INI:
|
||||
supportedExtensions = { ".ini" };
|
||||
break;
|
||||
@ -545,7 +548,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
|
||||
supportedExtensions = { ".db" };
|
||||
break;
|
||||
case BrowseFileType::ANY:
|
||||
supportedExtensions = {};
|
||||
// 'ChooseFile' will added '*' by default when there are no extensions assigned
|
||||
break;
|
||||
default:
|
||||
ERROR_LOG(FILESYS, "Unexpected BrowseFileType: %d", param3);
|
||||
|
@ -89,6 +89,7 @@
|
||||
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
|
||||
<AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
|
||||
<AppxBundle>Never</AppxBundle>
|
||||
<PackageCertificateThumbprint>C8DEB388B9BC89D1DC61324E4E9D9FE6A796B7AA</PackageCertificateThumbprint>
|
||||
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
|
||||
<AppInstallerUpdateFrequency>0</AppInstallerUpdateFrequency>
|
||||
<AppInstallerCheckForUpdateFrequency>OnApplicationRun</AppInstallerCheckForUpdateFrequency>
|
||||
|
@ -292,10 +292,10 @@ bool GetFakeFolders(Path path, std::vector<File::FileInfo>* files, const char* f
|
||||
info.exists = true;
|
||||
info.size = 1;
|
||||
info.isDirectory = true;
|
||||
info.isWritable = 0;
|
||||
info.atime = 1000;
|
||||
info.mtime = 1000;
|
||||
info.ctime = 1000;
|
||||
info.isWritable = true;
|
||||
info.atime = 0;
|
||||
info.mtime = 0;
|
||||
info.ctime = 0;
|
||||
info.access = 0111;
|
||||
|
||||
files->push_back(info);
|
||||
@ -347,25 +347,31 @@ bool OpenFolder(std::string path) {
|
||||
return state;
|
||||
}
|
||||
|
||||
int64_t GetLocalFreeSpace() {
|
||||
Platform::String^ freeSpaceKey = ref new Platform::String(L"System.FreeSpace");
|
||||
Platform::Collections::Vector<Platform::String^>^ propertiesToRetrieve = ref new Platform::Collections::Vector<Platform::String^>();
|
||||
propertiesToRetrieve->Append(freeSpaceKey);
|
||||
Windows::Foundation::Collections::IMap<Platform::String^, Platform::Object^>^ result;
|
||||
ExecuteTask(result, ApplicationData::Current->LocalFolder->Properties->RetrievePropertiesAsync(propertiesToRetrieve));
|
||||
int64_t remainingSize = 0;
|
||||
if (result != nullptr && result->Size > 0) {
|
||||
try {
|
||||
auto it = result->First();
|
||||
auto sizeString = it->Current->Value->ToString();
|
||||
const wchar_t* begin = sizeString->Data();
|
||||
remainingSize = (int64_t)std::wcstol(begin, nullptr, 10);
|
||||
}
|
||||
catch (...) {
|
||||
bool GetDriveFreeSpace(Path path, int64_t& space) {
|
||||
|
||||
bool state = false;
|
||||
Platform::String^ wString = ref new Platform::String(path.ToWString().c_str());
|
||||
StorageFolder^ storageItem;
|
||||
ExecuteTask(storageItem, StorageFolder::GetFolderFromPathAsync(wString));
|
||||
if (storageItem != nullptr) {
|
||||
Platform::String^ freeSpaceKey = ref new Platform::String(L"System.FreeSpace");
|
||||
Platform::Collections::Vector<Platform::String^>^ propertiesToRetrieve = ref new Platform::Collections::Vector<Platform::String^>();
|
||||
propertiesToRetrieve->Append(freeSpaceKey);
|
||||
Windows::Foundation::Collections::IMap<Platform::String^, Platform::Object^>^ result;
|
||||
ExecuteTask(result, storageItem->Properties->RetrievePropertiesAsync(propertiesToRetrieve));
|
||||
if (result != nullptr && result->Size > 0) {
|
||||
try {
|
||||
auto value = result->Lookup(L"System.FreeSpace");
|
||||
space = (uint64_t)value;
|
||||
state = true;
|
||||
}
|
||||
catch (...) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return remainingSize;
|
||||
|
||||
return state;
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
|
@ -51,7 +51,7 @@ bool IsRootForAccessibleItems(std::string path);
|
||||
bool OpenFile(std::string path);
|
||||
bool OpenFolder(std::string path);
|
||||
std::string ResolvePathUWP(std::string path);
|
||||
int64_t GetLocalFreeSpace();
|
||||
bool GetDriveFreeSpace(Path path, int64_t& space);
|
||||
|
||||
// Log helpers
|
||||
std::string GetLogFile();
|
||||
|
@ -35,12 +35,12 @@ concurrency::task<Platform::String^> PickSingleFolder()
|
||||
|
||||
return concurrency::create_task(folderPicker->PickSingleFolderAsync()).then([](StorageFolder^ folder) {
|
||||
auto path = ref new Platform::String();
|
||||
if (folder != nullptr)
|
||||
{
|
||||
if (folder != nullptr)
|
||||
{
|
||||
AddItemToFutureList(folder);
|
||||
path = folder->Path;
|
||||
}
|
||||
return path;
|
||||
path = folder->Path;
|
||||
}
|
||||
return path;
|
||||
});
|
||||
}
|
||||
|
||||
@ -62,12 +62,12 @@ concurrency::task<Platform::String^> PickSingleFile(std::vector<std::string> ext
|
||||
}
|
||||
return concurrency::create_task(filePicker->PickSingleFileAsync()).then([](StorageFile^ file) {
|
||||
auto path = ref new Platform::String();
|
||||
if (file != nullptr)
|
||||
{
|
||||
if (file != nullptr)
|
||||
{
|
||||
AddItemToFutureList(file);
|
||||
path = file->Path;
|
||||
}
|
||||
return path;
|
||||
path = file->Path;
|
||||
}
|
||||
return path;
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user