|
|
@ -23,9 +23,9 @@ constexpr ResultCode ERR_TAG_FAILED(ErrorModule::NFP,
|
|
|
|
constexpr ResultCode ERR_NO_APPLICATION_AREA(ErrorModule::NFP, 152);
|
|
|
|
constexpr ResultCode ERR_NO_APPLICATION_AREA(ErrorModule::NFP, 152);
|
|
|
|
} // namespace ErrCodes
|
|
|
|
} // namespace ErrCodes
|
|
|
|
|
|
|
|
|
|
|
|
Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)
|
|
|
|
Module::Interface::Interface(std::shared_ptr<Module> module, Core::System& system, const char* name)
|
|
|
|
: ServiceFramework(name), module(std::move(module)) {
|
|
|
|
: ServiceFramework(name), module(std::move(module)), system(system) {
|
|
|
|
auto& kernel = Core::System::GetInstance().Kernel();
|
|
|
|
auto& kernel = system.Kernel();
|
|
|
|
nfc_tag_load = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Automatic,
|
|
|
|
nfc_tag_load = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Automatic,
|
|
|
|
"IUser:NFCTagDetected");
|
|
|
|
"IUser:NFCTagDetected");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -34,8 +34,8 @@ Module::Interface::~Interface() = default;
|
|
|
|
|
|
|
|
|
|
|
|
class IUser final : public ServiceFramework<IUser> {
|
|
|
|
class IUser final : public ServiceFramework<IUser> {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
IUser(Module::Interface& nfp_interface)
|
|
|
|
IUser(Module::Interface& nfp_interface, Core::System& system)
|
|
|
|
: ServiceFramework("NFP::IUser"), nfp_interface(nfp_interface) {
|
|
|
|
: ServiceFramework("NFP::IUser"), nfp_interface(nfp_interface), system(system) {
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, &IUser::Initialize, "Initialize"},
|
|
|
|
{0, &IUser::Initialize, "Initialize"},
|
|
|
|
{1, &IUser::Finalize, "Finalize"},
|
|
|
|
{1, &IUser::Finalize, "Finalize"},
|
|
|
@ -65,7 +65,7 @@ public:
|
|
|
|
};
|
|
|
|
};
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
|
|
|
|
|
|
|
|
auto& kernel = Core::System::GetInstance().Kernel();
|
|
|
|
auto& kernel = system.Kernel();
|
|
|
|
deactivate_event = Kernel::WritableEvent::CreateEventPair(
|
|
|
|
deactivate_event = Kernel::WritableEvent::CreateEventPair(
|
|
|
|
kernel, Kernel::ResetType::Automatic, "IUser:DeactivateEvent");
|
|
|
|
kernel, Kernel::ResetType::Automatic, "IUser:DeactivateEvent");
|
|
|
|
availability_change_event = Kernel::WritableEvent::CreateEventPair(
|
|
|
|
availability_change_event = Kernel::WritableEvent::CreateEventPair(
|
|
|
@ -324,6 +324,7 @@ private:
|
|
|
|
Kernel::EventPair deactivate_event;
|
|
|
|
Kernel::EventPair deactivate_event;
|
|
|
|
Kernel::EventPair availability_change_event;
|
|
|
|
Kernel::EventPair availability_change_event;
|
|
|
|
const Module::Interface& nfp_interface;
|
|
|
|
const Module::Interface& nfp_interface;
|
|
|
|
|
|
|
|
Core::System& system;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void Module::Interface::CreateUserInterface(Kernel::HLERequestContext& ctx) {
|
|
|
|
void Module::Interface::CreateUserInterface(Kernel::HLERequestContext& ctx) {
|
|
|
@ -331,7 +332,7 @@ void Module::Interface::CreateUserInterface(Kernel::HLERequestContext& ctx) {
|
|
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<IUser>(*this);
|
|
|
|
rb.PushIpcInterface<IUser>(*this, system);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool Module::Interface::LoadAmiibo(const std::vector<u8>& buffer) {
|
|
|
|
bool Module::Interface::LoadAmiibo(const std::vector<u8>& buffer) {
|
|
|
@ -353,9 +354,9 @@ const Module::Interface::AmiiboFile& Module::Interface::GetAmiiboBuffer() const
|
|
|
|
return amiibo;
|
|
|
|
return amiibo;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InstallInterfaces(SM::ServiceManager& service_manager) {
|
|
|
|
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
|
|
|
|
auto module = std::make_shared<Module>();
|
|
|
|
auto module = std::make_shared<Module>();
|
|
|
|
std::make_shared<NFP_User>(module)->InstallAsService(service_manager);
|
|
|
|
std::make_shared<NFP_User>(module, system)->InstallAsService(service_manager);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace Service::NFP
|
|
|
|
} // namespace Service::NFP
|
|
|
|