// CFTTSaveFile - [2020-04-13 11:57:46]
#ifndef _CFTTSAVEFILE_H_
#define _CFTTSAVEFILE_H_

#include "CFTTSerialize.h"
#include "CFTTFile_RAM.h"

/*
002676C4 CFTTSaveFile::Initialise(CFTTSaveFileProjectSettings const&)
00267710 CFTTSaveFile::SetAllowCloud(bool)
00267774 CFTTSaveFile::Shutdown(bool)
002677A0 CFTTSaveFile::ShutdownCloud()
002677CC CFTTSaveFile::BeginLoadFromDisk(char const*)
00267804 CFTTSaveFile::BeginLoadInternal(char const*,bool &)
002678F8 CFTTSaveFile::EndLoad(CFTTSerialize *,bool)
00267924 CFTTSaveFile::BeginSave()
00267974 CFTTSaveFile::EndSave(CFTTSerialize *,char *)
002679DC CFTTSaveFile::EndSaveToCloud(CFTTSerialize *,char *)
00267A7C CFTTSaveFile::EndSaveShared(CFTTSerialize *,char const*,bool)
00267C80 CFTTSaveFile::IsCloudActive()
00267CA8 CFTTSaveFile::InitCloud()
00267D88 CFTTSaveFile::TurnOffCloud()
00267DB4 CFTTSaveFile::GetCloudInitResult(bool)
00267E08 CFTTSaveFile::BeginLoadFromCloud(bool &,bool)
00267E50 CFTTSaveFile::BeginSaveToCloud()
00267E94 CFTTSaveFile::LoadAndCheckFile(char const*,CFTTSaveFileHeader &,bool &)
00267FA8 CFTTSaveFile::OnCloudSync(char const*)
00268048 CFTTSaveFile::OnICloudAvailable()
00268090 CFTTSaveFile::OnICloudUnavailable()
002680A0 CFTTSaveFile::OnGoogleSavedGamesSync(bool,char const*)
002680C8 CFTTSaveFile::AllowSaveFromWrongThread(bool)
*/

struct CFTTSaveFileProjectSettings {
  const char *v1;
  const char *v2;
  const char *v3;
  const char *v4;
  const char *v5;
  const char *v6;
  const char *v7;
  const char *v8;
  int v9;
  int v10;
  int v11;
  unsigned int v12;
  unsigned int v13;
  unsigned int v14;
  unsigned int v15;
};

// size    0x10   .text:00267ED2                 MOVS            R2, #0x10
class CFTTSaveFileHeader {
public:
  union {
    struct {
      ushort field_0;
      ushort field_2;
    };
    struct {
      uchar c_0;
      uchar c_1;
      uchar c_2;
      uchar c_3;
    };
    uint i_0;
  };

  uint field_4;
  int field_8;
  int field_C;
};

class CFTTSaveFile {
public:
  static void Initialise(struct CFTTSaveFileProjectSettings const &);         // 002676C4
  static void SetAllowCloud(bool);                                            // 00267710
  static void Shutdown(bool);                                                 // 00267774
  void ShutdownCloud();                                                       // 002677A0
  static CFTTSerialize *BeginLoadFromDisk(char const *);                      // 002677CC
  static CFTTSerialize *BeginLoadInternal(char const *, bool &);              // 00267804
  static bool EndLoad(CFTTSerialize *, bool);                                 // 002678F8
  static CFTTSerialize *BeginSave();                                          // 00267924
  static int EndSave(CFTTSerialize *, char *);                                // 00267974
  static int EndSaveToCloud(CFTTSerialize *, char *);                         // 002679DC
  static int EndSaveShared(CFTTSerialize *, char const *, bool);              // 00267A7C
  static int IsCloudActive();                                                 // 00267C80
  static void InitCloud();                                                    // 00267CA8
  static void TurnOffCloud();                                                 // 00267D88
  void GetCloudInitResult(bool);                                              // 00267DB4
  void BeginLoadFromCloud(bool &, bool);                                      // 00267E08
  void BeginSaveToCloud();                                                    // 00267E50
  static char *LoadAndCheckFile(char const *, CFTTSaveFileHeader &, bool &);  // 00267E94
  static void OnCloudSync(char const *);                                      // 00267FA8
  static void OnICloudAvailable();                                            // 00268048
  static void OnICloudUnavailable();                                          // 00268090
  void OnGoogleSavedGamesSync(bool, char const *);                            // 002680A0
  void AllowSaveFromWrongThread(bool);                                        // 002680C8

  static bool s_bIsInitialised;
  static int s_eCloudState;
  static bool s_bCloudAllowed;
  static CFTTSaveFile s_tProjectSettings;
  static CFTTFile_RAM *s_pTempSaveData;
  static bool s_bDoingLoad;
  static bool s_bSavingToCloud;
  static int s_tSaveThread;
  char const *field_0;
  char const *field_4;
  char *field_8;
  char *field_C;
  char *field_10;
  int field_14;
  int field_18;
  char *field_1C;
  int field_20;
  int field_24;
  uint field_28;
  uint field_2C;
  uint field_30;
  uint field_34;
  uint field_38;
};

#endif  //_CFTTSAVEFILE_H_