mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2025-06-16 15:27:58 -05:00
SaveDataCheck: Preliminary work in this archive.
This allows Steel Diver to boot further, some files are needed. This is still not ready and needs a big cleanup, this will possibly be delayed until the way we handle archives is fixed (with factory classes instead of ahead-of-time creation of archives)
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/file_util.h"
|
||||
#include "common/make_unique.h"
|
||||
|
||||
#include "core/file_sys/archive_romfs.h"
|
||||
@ -23,6 +24,10 @@ Archive_RomFS::Archive_RomFS(const Loader::AppLoader& app_loader) {
|
||||
}
|
||||
}
|
||||
|
||||
Archive_RomFS::Archive_RomFS(std::string mountp) : mount_point(mountp) {
|
||||
|
||||
}
|
||||
|
||||
std::unique_ptr<FileBackend> Archive_RomFS::OpenFile(const Path& path, const Mode mode) const {
|
||||
return Common::make_unique<File_RomFS>(this);
|
||||
}
|
||||
@ -67,4 +72,24 @@ ResultCode Archive_RomFS::Format(const Path& path) const {
|
||||
return UnimplementedFunction(ErrorModule::FS);
|
||||
}
|
||||
|
||||
ResultCode Archive_RomFS::Open(const Path& path) {
|
||||
if (mount_point.empty())
|
||||
return RESULT_SUCCESS;
|
||||
auto vec = path.AsBinary();
|
||||
const u32* data = reinterpret_cast<u32*>(vec.data());
|
||||
std::string file_path = Common::StringFromFormat("%s%08X%08X.bin", mount_point.c_str(), data[1], data[0]);
|
||||
FileUtil::IOFile file(file_path, "rb");
|
||||
|
||||
std::fill(raw_data.begin(), raw_data.end(), 0);
|
||||
|
||||
if (!file.IsOpen()) {
|
||||
return ResultCode(-1); // TODO(Subv): Find the right error code
|
||||
}
|
||||
auto size = file.GetSize();
|
||||
raw_data.resize(size);
|
||||
file.ReadBytes(raw_data.data(), size);
|
||||
file.Close();
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
} // namespace FileSys
|
||||
|
Reference in New Issue
Block a user