diff --git a/Utilities/File.cpp b/Utilities/File.cpp index 78e71177e5..cc0c60c71d 100644 --- a/Utilities/File.cpp +++ b/Utilities/File.cpp @@ -1,4 +1,4 @@ -#include "File.h" +#include "File.h" #include "mutex.h" #include "StrFmt.h" #include "BEType.h" @@ -1580,7 +1580,7 @@ bool fs::remove_all(const std::string& path, bool remove_root) return true; } -u64 fs::get_dir_size(const std::string& path) +u64 fs::get_dir_size(const std::string& path, u64 rounding_alignment) { u64 result = 0; @@ -1593,12 +1593,12 @@ u64 fs::get_dir_size(const std::string& path) if (entry.is_directory == false) { - result += entry.size; + result += ::align(entry.size, rounding_alignment); } if (entry.is_directory == true) { - result += get_dir_size(path + '/' + entry.name); + result += get_dir_size(path + '/' + entry.name, rounding_alignment); } } diff --git a/Utilities/File.h b/Utilities/File.h index 91d0fbe8e0..e97efce522 100644 --- a/Utilities/File.h +++ b/Utilities/File.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "types.h" #include "bit_set.h" @@ -506,7 +506,7 @@ namespace fs bool remove_all(const std::string& path, bool remove_root = true); // Get size of all files recursively - u64 get_dir_size(const std::string& path); + u64 get_dir_size(const std::string& path, u64 rounding_alignment = 1); enum class error : uint { diff --git a/rpcs3/Emu/Cell/Modules/cellGame.cpp b/rpcs3/Emu/Cell/Modules/cellGame.cpp index aea2f86aab..0cdea2bdd8 100644 --- a/rpcs3/Emu/Cell/Modules/cellGame.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGame.cpp @@ -234,7 +234,7 @@ error_code cellHddGameGetSizeKB(vm::ptr size) return CELL_HDDGAME_ERROR_FAILURE; } - *size = ::narrow(fs::get_dir_size(local_dir) / 1024); + *size = ::narrow(fs::get_dir_size(local_dir, 1024) / 1024); return CELL_OK; } @@ -273,7 +273,7 @@ error_code cellGameDataGetSizeKB(vm::ptr size) return CELL_GAMEDATA_ERROR_FAILURE; } - *size = ::narrow(fs::get_dir_size(local_dir) / 1024); + *size = ::narrow(fs::get_dir_size(local_dir, 1024) / 1024); return CELL_OK; } @@ -849,7 +849,7 @@ error_code cellGameGetSizeKB(vm::ptr size) } } - *size = ::narrow(fs::get_dir_size(local_dir) / 1024); + *size = ::narrow(fs::get_dir_size(local_dir, 1024) / 1024); return CELL_OK; }