Refactor InnerFAT into Savegame and Extdata

And derive TitleDB from it too.
This commit is contained in:
Pengfei
2021-07-06 16:11:03 +08:00
parent 184d73d465
commit c81db424bb
13 changed files with 711 additions and 714 deletions
+20
View File
@@ -15,6 +15,7 @@
#include <type_traits>
#include <vector>
#include "common/common_types.h"
#include "common/logging/log.h"
#ifdef _MSC_VER
#include "common/string_util.h"
#endif
@@ -251,6 +252,25 @@ private:
bool m_good = true;
};
template <typename T>
bool WriteBytesToFile(const std::string& path, T* data, std::size_t length) {
if (!CreateFullPath(path)) {
LOG_ERROR(Core, "Could not create path {}", path);
return false;
}
IOFile file(path, "wb");
if (!file.IsOpen()) {
LOG_ERROR(Core, "Could not open file {}", path);
return false;
}
if (file.WriteBytes(data, length) != length) {
LOG_ERROR(Core, "Write data failed (file: {})", path);
return false;
}
return true;
}
} // namespace FileUtil
// To deal with Windows being dumb at unicode: