Installer.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef FREESHOP_INSTALLER_HPP
  2. #define FREESHOP_INSTALLER_HPP
  3. #include <string>
  4. #include <vector>
  5. #include <cpp3ds/Config.hpp>
  6. #include <cpp3ds/System/Mutex.hpp>
  7. #ifndef EMULATION
  8. #include <3ds.h>
  9. #endif
  10. namespace FreeShop {
  11. class Installer {
  12. public:
  13. Installer(cpp3ds::Uint64 titleId, int contentIndex = -1);
  14. ~Installer();
  15. bool installTicket(cpp3ds::Uint16 titleVersion);
  16. bool installSeed(const void *seed);
  17. bool start(bool deleteTitle);
  18. bool resume();
  19. bool suspend();
  20. void abort();
  21. bool installTmd(const void *data, size_t size);
  22. bool installContent(const void *data, size_t size, cpp3ds::Uint16 index);
  23. bool finalizeTmd();
  24. bool finalizeContent();
  25. bool importContents(size_t count, cpp3ds::Uint16 *indices);
  26. bool commit();
  27. cpp3ds::Int32 getErrorCode() const;
  28. const cpp3ds::String &getErrorString() const;
  29. cpp3ds::Uint64 getTitleId() const;
  30. int getCurrentContentIndex() const;
  31. cpp3ds::Uint64 getCurrentContentPosition() const;
  32. private:
  33. private:
  34. cpp3ds::Uint64 m_titleId;
  35. cpp3ds::Uint32 m_titleType;
  36. int m_currentContentIndex;
  37. cpp3ds::Uint64 m_currentContentPosition;
  38. cpp3ds::Mutex m_mutex;
  39. cpp3ds::String m_errorStr;
  40. #ifndef EMULATION
  41. Result m_result;
  42. Handle m_handleTmd;
  43. Handle m_handleContent;
  44. FS_MediaType m_mediaType;
  45. NIM_TitleConfig tc;
  46. bool applyErrorLedPattern();
  47. #endif
  48. bool m_isSuspended;
  49. bool m_isInstalling;
  50. bool m_isInstallingTmd;
  51. bool m_isInstallingContent;
  52. };
  53. } // namespace FreeShop
  54. #endif // FREESHOP_INSTALLER_HPP