2020-12-28 19:15:37 +04:00
|
|
|
// Copyright 2018 yuzu emulator team
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <array>
|
|
|
|
#include <vector>
|
2021-02-04 03:41:27 +04:00
|
|
|
|
2020-12-28 19:15:37 +04:00
|
|
|
#include "core/hle/service/service.h"
|
|
|
|
|
2021-02-04 03:41:27 +04:00
|
|
|
namespace Kernel {
|
|
|
|
class KEvent;
|
|
|
|
}
|
|
|
|
|
2020-12-28 19:15:37 +04:00
|
|
|
namespace Service::NFP {
|
|
|
|
|
|
|
|
class Module final {
|
|
|
|
public:
|
|
|
|
class Interface : public ServiceFramework<Interface> {
|
|
|
|
public:
|
|
|
|
explicit Interface(std::shared_ptr<Module> module_, Core::System& system_,
|
|
|
|
const char* name);
|
|
|
|
~Interface() override;
|
|
|
|
|
|
|
|
struct ModelInfo {
|
|
|
|
std::array<u8, 0x8> amiibo_identification_block;
|
|
|
|
INSERT_PADDING_BYTES(0x38);
|
|
|
|
};
|
|
|
|
static_assert(sizeof(ModelInfo) == 0x40, "ModelInfo is an invalid size");
|
|
|
|
|
|
|
|
struct AmiiboFile {
|
|
|
|
std::array<u8, 10> uuid;
|
|
|
|
INSERT_PADDING_BYTES(0x4a);
|
|
|
|
ModelInfo model_info;
|
|
|
|
};
|
|
|
|
static_assert(sizeof(AmiiboFile) == 0x94, "AmiiboFile is an invalid size");
|
|
|
|
|
|
|
|
void CreateUserInterface(Kernel::HLERequestContext& ctx);
|
|
|
|
bool LoadAmiibo(const std::vector<u8>& buffer);
|
2021-05-06 05:20:08 +04:00
|
|
|
const std::shared_ptr<Kernel::KReadableEvent>& GetNFCEvent() const;
|
2020-12-28 19:15:37 +04:00
|
|
|
const AmiiboFile& GetAmiiboBuffer() const;
|
|
|
|
|
|
|
|
private:
|
2021-05-06 05:20:08 +04:00
|
|
|
std::shared_ptr<Kernel::KEvent> nfc_tag_load;
|
2020-12-28 19:15:37 +04:00
|
|
|
AmiiboFile amiibo{};
|
|
|
|
|
|
|
|
protected:
|
|
|
|
std::shared_ptr<Module> module;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
|
|
|
|
|
|
|
|
} // namespace Service::NFP
|