//CFTTFileSystem - [2020-04-13 11:57:46]
#ifndef _CFTTFILESYSTEM_H_
#define _CFTTFILESYSTEM_H_

#include "CFTTFile.h"
#include "CFTTFileIterator.h"

/*
002213EC CFTTFileSystem::~CFTTFileSystem()
00265852 CFTTFileSystem::~CFTTFileSystem()
00221D22 CFTTFileSystem::GetAbsoluteFilename(char const*,char *,uint)
00263FF2 CFTTFileSystem::Delete(char const*)
00221D26 CFTTFileSystem::Rename(char const*,char const*,CFTTFileSystem*)
00221D2A CFTTFileSystem::Copy(char const*,char const*,bool)
00263FF6 CFTTFileSystem::OpenDir(char const*, CFTTFileIterator **)
00263FFA CFTTFileSystem::FileExistsFS(char const*)
0026400E CFTTFileSystem::GetAttributesFS(char const*,TFTTFileAttributes *)


00263A6C CFTTFileSystem::Deregister(CFTTFileSystem*,char const*)
00263AB8 CFTTFileSystem::Deregister(char const*)
00263FDE CFTTFileSystem::Error(EFTTError,int,CFTTFile *,char const*)
00263BFC CFTTFileSystem::FileExists(char const*)
00263AF8 CFTTFileSystem::FindFileSystem(char const*)
00263D70 CFTTFileSystem::GetAttributes(char const*,TFTTFileAttributes *)
00263B44 CFTTFileSystem::GetModeFlags(char const*)
00263BA4 CFTTFileSystem::GetModeString(int)
00263830 CFTTFileSystem::Register(CFTTFileSystem*,char const*)
00263FEE CFTTFileSystem::SetErrorCallback(EFTTError (*)(CFTTFileSystem*,EFTTError,int,CFTTFile *,char const*))
00263DD8 CFTTFileSystem::TidyFilename(char const*,char const*,char,EFTTMemHeapID,bool)
00263EDC CFTTFileSystem::TidyFilename(char const*,wchar_t const*,wchar_t,EFTTMemHeapID,bool)
00263D54 CFTTFileSystem::fopen(char const*,char const*,EFTTMemHeapID)
00263C60 CFTTFileSystem::fopen(char const*,uint,EFTTMemHeapID)

vptr_CFTTFileSystem_3299E4:
  CFTTFileSystem::~CFTTFileSystem()
  CFTTFileSystem::~CFTTFileSystem()
  CFTTFileSystem::GetAbsoluteFilename(char const*,char *,uint)
  CFTTFileSystem::Open(char const*,uint,EFTTMemHeapID)  = 0;
  CFTTFileSystem::Delete(char const*)
  CFTTFileSystem::Rename(char const*,char const*,CFTTFileSystem*)
  CFTTFileSystem::Copy(char const*,char const*,bool)
  CFTTFileSystem::OpenDir(char const*,CFTTFileIterator **)
  CFTTFileSystem::FileExistsFS(char const*)
  CFTTFileSystem::GetAttributesFS(char const*,TFTTFileAttributes *)

vtable_CFTTFileSystem_Android:
  CFTTFileSystem_Android::~CFTTFileSystem_Android()
  CFTTFileSystem_Android::~CFTTFileSystem_Android()
  CFTTFileSystem_Android::GetAbsoluteFilename(char const*,char *,uint)
  CFTTFileSystem_Android::Open(char const*,uint,EFTTMemHeapID)
  CFTTFileSystem_Android::Delete(char const*)
  CFTTFileSystem_Android::Rename(char const*,char const*,CFTTFileSystem *)
  CFTTFileSystem_Android::Copy(char const*,char const*,bool)
  CFTTFileSystem_Android::OpenDir(char const*,CFTTFileIterator **)
  CFTTFileSystem_Android::FileExistsFS(char const*)
  CFTTFileSystem_Android::GetAttributesFS(char const*,TFTTFileAttributes *)


CFTTFileSystem_APKX	    00329B80	0x2C
CFTTFileSystem_Android	00329AE4	0x10
CFTTFileSystem_PAK	    0032878C	0x28

*/

class CFTTFileSystem;

struct FileSystemNode {
  CFTTFileSystem* FileSystem_0;  //在删除这个指针是不调用析构函数的，切记!!!
  char* pType_4;
  FileSystemNode* next_8;
};

typedef EFTTError (*EFTTErrorCallback)(CFTTFileSystem* pFileSystem,
                                       EFTTError errId1,
                                       int a2,
                                       CFTTFile* pFile3,
                                       char const* pBuf4);

class CFTTFileSystem {
public:
  //CFTTFileSystem(char* a2, char* ptype);
  virtual ~CFTTFileSystem();  //002213EC 00265852

  virtual bool GetAbsoluteFilename(char const* filepath,
                                   char* pOutputName,
                                   uint outpue_len);  //00221D22
  virtual CFTTFile* Open(char const* filepath, uint a3, EFTTMemHeapID eHeapId) = 0;
  virtual EFTTError Delete(char const* a1);                                      //00263FF2
  virtual EFTTError Rename(char const* a1, char const* a2, CFTTFileSystem* a3);  //00221D26
  virtual EFTTError Copy(char const* a1, char const* a2, bool a3);               //00221D2A
  virtual EFTTError OpenDir(char const* a1, CFTTFileIterator** ppFileIt);        //00263FF6
  virtual bool FileExistsFS(char const* pFileName);                              //00263FFA
  virtual EFTTError GetAttributesFS(char const* filepath,
                                    TFTTFileAttributes* pAttr);  //0026400E

  EFTTError Error(EFTTError derr, int, CFTTFile*, char const*);  //00263FDE
  void SetErrorCallback(EFTTErrorCallback errfunc);              //00263FEE
  static void Deregister(CFTTFileSystem* pFileSystem,
                         char const* ptype);  //00263A6C
  static void Deregister(char const* ptype);  //00263AB8
  static char* TidyFilename(char const* file,
                            char const* type,
                            char a3,
                            EFTTMemHeapID eID,
                            bool a5);  //00263DD8

  static char16_t* TidyFilename(char const* file,
                                wchar_t const* wtype,
                                wchar_t wc,
                                EFTTMemHeapID a4,
                                bool a5);  //00263EDC

  static EFTTError GetAttributes(char const* filepath, TFTTFileAttributes* pAttr);        //00263D70
  static void Register(CFTTFileSystem* pFileSystem, char const* ptype);                   //00263830
  static bool FileExists(char const* filepath);                                           //00263BFC
  static CFTTFileSystem* FindFileSystem(char const* filetype);                            //00263AF8
  static uint GetModeFlags(char const* fmod);                                             //00263B44
  static const char* GetModeString(int dMod);                                             //00263BA4
  static CFTTFile* fopen(char const* filepath, char const* pmod, EFTTMemHeapID eHeapID);  //00263D54
  static CFTTFile* fopen(char const* filepath, uint dMod, EFTTMemHeapID eHeapID);         //00263C60

  EFTTErrorCallback errFunc_4;
  static FileSystemNode* ms_pFileSystems;
};

extern CFTTFileSystem* g_pFTTFileSystem;          //005CB398
extern CFTTFileSystem* g_pPackageFileSystem;      //005CB39C
extern CFTTFileSystem* g_pTempFileSystem;         //005CB3A0
extern CFTTFileSystem* g_pDocsFileSystem;         //005CB3A4
extern CFTTFileSystem* g_pCachesFileSystem;       //005CB3A8
extern CFTTFileSystem* g_pSupportFileSystem;      //005CB3AC
extern CFTTFileSystem* g_pAndroidAPKXFileSystem;  //005CB3B0
#endif  //_CFTTFILESYSTEM_H_