2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 03:09:55 +00:00
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2014-02-10 18:54:46 +00:00
|
|
|
#pragma once
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2014-02-21 00:47:53 +00:00
|
|
|
#include <cstddef>
|
2017-06-04 08:33:14 +00:00
|
|
|
#include <optional>
|
2014-02-21 00:47:53 +00:00
|
|
|
#include <string>
|
2008-12-08 04:46:09 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2014-02-21 00:47:53 +00:00
|
|
|
#include "Common/CommonTypes.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "DiscIO/Filesystem.h"
|
2008-12-08 04:46:09 +00:00
|
|
|
|
|
|
|
namespace DiscIO
|
|
|
|
{
|
2014-02-21 00:47:53 +00:00
|
|
|
class IVolume;
|
2015-06-13 10:51:24 +00:00
|
|
|
struct Partition;
|
2014-02-21 00:47:53 +00:00
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
class CFileSystemGCWii : public IFileSystem
|
|
|
|
{
|
|
|
|
public:
|
2015-06-13 10:51:24 +00:00
|
|
|
CFileSystemGCWii(const IVolume* _rVolume, const Partition& partition);
|
2016-06-24 08:43:46 +00:00
|
|
|
virtual ~CFileSystemGCWii();
|
|
|
|
|
|
|
|
bool IsValid() const override { return m_Valid; }
|
|
|
|
u64 GetFileSize(const std::string& _rFullPath) override;
|
|
|
|
const std::vector<SFileInfo>& GetFileList() override;
|
2016-09-18 16:31:40 +00:00
|
|
|
std::string GetFileName(u64 _Address) override;
|
2016-06-24 08:43:46 +00:00
|
|
|
u64 ReadFile(const std::string& _rFullPath, u8* _pBuffer, u64 _MaxBufferSize,
|
|
|
|
u64 _OffsetInFile) override;
|
|
|
|
bool ExportFile(const std::string& _rFullPath, const std::string& _rExportFilename) override;
|
|
|
|
bool ExportApploader(const std::string& _rExportFolder) const override;
|
|
|
|
bool ExportDOL(const std::string& _rExportFolder) const override;
|
2017-06-04 08:33:14 +00:00
|
|
|
std::optional<u64> GetBootDOLOffset() const override;
|
|
|
|
std::optional<u32> GetBootDOLSize(u64 dol_offset) const override;
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2009-07-03 03:26:23 +00:00
|
|
|
private:
|
2016-06-24 08:43:46 +00:00
|
|
|
bool m_Initialized;
|
|
|
|
bool m_Valid;
|
2015-06-13 18:50:03 +00:00
|
|
|
u32 m_offset_shift;
|
2016-06-24 08:43:46 +00:00
|
|
|
std::vector<SFileInfo> m_FileInfoVector;
|
|
|
|
|
|
|
|
std::string GetStringFromOffset(u64 _Offset) const;
|
|
|
|
const SFileInfo* FindFileInfo(const std::string& _rFullPath);
|
|
|
|
bool DetectFileSystem();
|
|
|
|
void InitFileSystem();
|
|
|
|
size_t BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex,
|
|
|
|
const std::string& _szDirectory, u64 _NameTableOffset);
|
2008-12-08 04:46:09 +00:00
|
|
|
};
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
} // namespace
|