2013-04-17 21:09:55 -06:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2014-02-10 11:54:46 -07:00
|
|
|
#pragma once
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2014-02-20 17:47:53 -07:00
|
|
|
#include <cstddef>
|
|
|
|
#include <string>
|
2008-12-07 21:46:09 -07:00
|
|
|
#include <vector>
|
|
|
|
|
2014-02-20 17:47:53 -07:00
|
|
|
#include "Common/CommonTypes.h"
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "DiscIO/Filesystem.h"
|
2008-12-07 21:46:09 -07:00
|
|
|
|
|
|
|
namespace DiscIO
|
|
|
|
{
|
|
|
|
|
2014-02-20 17:47:53 -07:00
|
|
|
class IVolume;
|
|
|
|
|
2008-12-07 21:46:09 -07:00
|
|
|
class CFileSystemGCWii : public IFileSystem
|
|
|
|
{
|
|
|
|
public:
|
2013-03-03 15:51:26 -07:00
|
|
|
CFileSystemGCWii(const IVolume* _rVolume);
|
2008-12-07 21:46:09 -07:00
|
|
|
virtual ~CFileSystemGCWii();
|
2014-03-07 17:54:44 -07:00
|
|
|
virtual bool IsValid() const override { return m_Valid; }
|
2014-03-12 13:33:41 -06:00
|
|
|
virtual u64 GetFileSize(const std::string& _rFullPath) override;
|
2014-03-07 17:54:44 -07:00
|
|
|
virtual size_t GetFileList(std::vector<const SFileInfo *> &_rFilenames) override;
|
2014-03-14 21:38:14 -06:00
|
|
|
virtual const std::string GetFileName(u64 _Address) override;
|
2014-03-12 13:33:41 -06:00
|
|
|
virtual u64 ReadFile(const std::string& _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) override;
|
|
|
|
virtual bool ExportFile(const std::string& _rFullPath, const std::string&_rExportFilename) override;
|
|
|
|
virtual bool ExportApploader(const std::string& _rExportFolder) const override;
|
|
|
|
virtual bool ExportDOL(const std::string& _rExportFolder) const override;
|
2014-03-07 17:54:44 -07:00
|
|
|
virtual bool GetBootDOL(u8* &buffer, u32 DolSize) const override;
|
|
|
|
virtual u32 GetBootDOLSize() const override;
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2009-07-02 21:26:23 -06:00
|
|
|
private:
|
2008-12-07 21:46:09 -07:00
|
|
|
bool m_Initialized;
|
2010-06-03 14:59:55 -06:00
|
|
|
bool m_Valid;
|
2008-12-07 21:46:09 -07:00
|
|
|
u32 m_OffsetShift; // WII offsets are all shifted
|
2013-10-28 23:23:17 -06:00
|
|
|
|
2009-07-02 21:26:23 -06:00
|
|
|
std::vector <SFileInfo> m_FileInfoVector;
|
2008-12-07 21:46:09 -07:00
|
|
|
u32 Read32(u64 _Offset) const;
|
2013-03-03 15:51:26 -07:00
|
|
|
std::string GetStringFromOffset(u64 _Offset) const;
|
2014-03-12 13:33:41 -06:00
|
|
|
const SFileInfo* FindFileInfo(const std::string& _rFullPath);
|
2010-06-03 14:37:32 -06:00
|
|
|
bool DetectFileSystem();
|
|
|
|
void InitFileSystem();
|
2014-03-14 21:38:14 -06:00
|
|
|
size_t BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex, const std::string& _szDirectory, u64 _NameTableOffset);
|
2008-12-07 21:46:09 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|