nfp.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright 2018 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <array>
  6. #include <vector>
  7. #include "core/hle/service/kernel_helpers.h"
  8. #include "core/hle/service/service.h"
  9. namespace Kernel {
  10. class KEvent;
  11. }
  12. namespace Service::NFP {
  13. class Module final {
  14. public:
  15. class Interface : public ServiceFramework<Interface> {
  16. public:
  17. explicit Interface(std::shared_ptr<Module> module_, Core::System& system_,
  18. const char* name);
  19. ~Interface() override;
  20. struct ModelInfo {
  21. std::array<u8, 0x8> amiibo_identification_block;
  22. INSERT_PADDING_BYTES(0x38);
  23. };
  24. static_assert(sizeof(ModelInfo) == 0x40, "ModelInfo is an invalid size");
  25. struct AmiiboFile {
  26. std::array<u8, 10> uuid;
  27. INSERT_PADDING_BYTES(0x4a);
  28. ModelInfo model_info;
  29. };
  30. static_assert(sizeof(AmiiboFile) == 0x94, "AmiiboFile is an invalid size");
  31. void CreateUserInterface(Kernel::HLERequestContext& ctx);
  32. bool LoadAmiibo(const std::vector<u8>& buffer);
  33. Kernel::KReadableEvent& GetNFCEvent();
  34. const AmiiboFile& GetAmiiboBuffer() const;
  35. protected:
  36. std::shared_ptr<Module> module;
  37. private:
  38. KernelHelpers::ServiceContext service_context;
  39. Kernel::KEvent* nfc_tag_load;
  40. AmiiboFile amiibo{};
  41. };
  42. };
  43. void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
  44. } // namespace Service::NFP