boxcat.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright 2019 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <atomic>
  6. #include <map>
  7. #include <optional>
  8. #include "core/hle/service/bcat/backend/backend.h"
  9. namespace Service::BCAT {
  10. struct EventStatus {
  11. std::optional<std::string> header;
  12. std::optional<std::string> footer;
  13. std::vector<std::string> events;
  14. };
  15. /// Boxcat is yuzu's custom backend implementation of Nintendo's BCAT service. It is free to use and
  16. /// doesn't require a switch or nintendo account. The content is controlled by the yuzu team.
  17. class Boxcat final : public Backend {
  18. friend void SynchronizeInternal(DirectoryGetter dir_getter, TitleIDVersion title,
  19. CompletionCallback callback,
  20. std::optional<std::string> dir_name);
  21. public:
  22. explicit Boxcat(DirectoryGetter getter);
  23. ~Boxcat() override;
  24. bool Synchronize(TitleIDVersion title, CompletionCallback callback) override;
  25. bool SynchronizeDirectory(TitleIDVersion title, std::string name,
  26. CompletionCallback callback) override;
  27. bool Clear(u64 title_id) override;
  28. void SetPassphrase(u64 title_id, const Passphrase& passphrase) override;
  29. std::optional<std::vector<u8>> GetLaunchParameter(TitleIDVersion title) override;
  30. enum class StatusResult {
  31. Success,
  32. Offline,
  33. ParseError,
  34. BadClientVersion,
  35. };
  36. static StatusResult GetStatus(std::optional<std::string>& global,
  37. std::map<std::string, EventStatus>& games);
  38. private:
  39. std::atomic_bool is_syncing{false};
  40. class Client;
  41. std::unique_ptr<Client> client;
  42. };
  43. } // namespace Service::BCAT