Check actual free disk space when games ask.

Windows only for the moment.
This commit is contained in:
Unknown W. Brackets
2014-11-01 00:33:19 -07:00
parent 763e5c9c4b
commit 2958c575a1
12 changed files with 79 additions and 36 deletions
+15
View File
@@ -15,6 +15,7 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include <limits>
#include "ChunkFile.h"
#include "FileUtil.h"
#include "DirectoryFileSystem.h"
@@ -721,6 +722,20 @@ std::vector<PSPFileInfo> DirectoryFileSystem::GetDirListing(std::string path) {
return myVector;
}
u64 DirectoryFileSystem::FreeSpace(const std::string &path) {
#ifdef _WIN32
const std::wstring w32path = ConvertUTF8ToWString(GetLocalPath(path));
ULARGE_INTEGER free;
if (GetDiskFreeSpaceExW(w32path.c_str(), &free, nullptr, nullptr))
return free.QuadPart;
#else
// TODO: Implement.
#endif
// Just assume they're swimming in free disk space if we don't know otherwise.
return std::numeric_limits<u64>::max();
}
void DirectoryFileSystem::DoState(PointerWrap &p) {
auto s = p.Section("DirectoryFileSystem", 0, 2);
if (!s)