mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-24 04:16:24 -05:00
Merge pull request #237 from mailwl/nifm-module
Service/NIFM: convert to module
This commit is contained in:
commit
07ae1f972d
8 changed files with 83 additions and 124 deletions
|
@ -32,7 +32,7 @@ public:
|
||||||
{0, &IRequest::GetRequestState, "GetRequestState"},
|
{0, &IRequest::GetRequestState, "GetRequestState"},
|
||||||
{1, &IRequest::GetResult, "GetResult"},
|
{1, &IRequest::GetResult, "GetResult"},
|
||||||
{2, &IRequest::GetSystemEventReadableHandles, "GetSystemEventReadableHandles"},
|
{2, &IRequest::GetSystemEventReadableHandles, "GetSystemEventReadableHandles"},
|
||||||
{3, nullptr, "Cancel"},
|
{3, &IRequest::Cancel, "Cancel"},
|
||||||
{4, nullptr, "Submit"},
|
{4, nullptr, "Submit"},
|
||||||
{5, nullptr, "SetRequirement"},
|
{5, nullptr, "SetRequirement"},
|
||||||
{6, nullptr, "SetRequirementPreset"},
|
{6, nullptr, "SetRequirementPreset"},
|
||||||
|
@ -80,6 +80,11 @@ private:
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushCopyObjects(event1, event2);
|
rb.PushCopyObjects(event1, event2);
|
||||||
}
|
}
|
||||||
|
void Cancel(Kernel::HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service_NIFM, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
Kernel::SharedPtr<Kernel::Event> event1, event2;
|
Kernel::SharedPtr<Kernel::Event> event1, event2;
|
||||||
};
|
};
|
||||||
|
@ -96,13 +101,56 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class IGeneralService final : public ServiceFramework<IGeneralService> {
|
||||||
|
public:
|
||||||
|
IGeneralService();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void GetClientId(Kernel::HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service_NIFM, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 4};
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
rb.Push<u64>(0);
|
||||||
|
}
|
||||||
|
void CreateScanRequest(Kernel::HLERequestContext& ctx) {
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
|
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
rb.PushIpcInterface<IScanRequest>();
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_NIFM, "called");
|
||||||
|
}
|
||||||
|
void CreateRequest(Kernel::HLERequestContext& ctx) {
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
|
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
rb.PushIpcInterface<IRequest>();
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_NIFM, "called");
|
||||||
|
}
|
||||||
|
void RemoveNetworkProfile(Kernel::HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service_NIFM, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
}
|
||||||
|
void CreateTemporaryNetworkProfile(Kernel::HLERequestContext& ctx) {
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
|
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
rb.PushIpcInterface<INetworkProfile>();
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_NIFM, "called");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
IGeneralService::IGeneralService() : ServiceFramework("IGeneralService") {
|
IGeneralService::IGeneralService() : ServiceFramework("IGeneralService") {
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{1, &IGeneralService::GetClientId, "GetClientId"},
|
{1, &IGeneralService::GetClientId, "GetClientId"},
|
||||||
{2, &IGeneralService::CreateScanRequest, "CreateScanRequest"},
|
{2, &IGeneralService::CreateScanRequest, "CreateScanRequest"},
|
||||||
{4, &IGeneralService::CreateRequest, "CreateRequest"},
|
{4, &IGeneralService::CreateRequest, "CreateRequest"},
|
||||||
{6, nullptr, "GetCurrentNetworkProfile"},
|
{5, nullptr, "GetCurrentNetworkProfile"},
|
||||||
{7, nullptr, "EnumerateNetworkInterfaces"},
|
{6, nullptr, "EnumerateNetworkInterfaces"},
|
||||||
|
{7, nullptr, "EnumerateNetworkProfiles"},
|
||||||
{8, nullptr, "GetNetworkProfile"},
|
{8, nullptr, "GetNetworkProfile"},
|
||||||
{9, nullptr, "SetNetworkProfile"},
|
{9, nullptr, "SetNetworkProfile"},
|
||||||
{10, &IGeneralService::RemoveNetworkProfile, "RemoveNetworkProfile"},
|
{10, &IGeneralService::RemoveNetworkProfile, "RemoveNetworkProfile"},
|
||||||
|
@ -137,50 +185,28 @@ IGeneralService::IGeneralService() : ServiceFramework("IGeneralService") {
|
||||||
RegisterHandlers(functions);
|
RegisterHandlers(functions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IGeneralService::GetClientId(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::CreateGeneralServiceOld(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_WARNING(Service_NIFM, "(STUBBED) called");
|
|
||||||
IPC::ResponseBuilder rb{ctx, 4};
|
|
||||||
rb.Push(RESULT_SUCCESS);
|
|
||||||
rb.Push<u64>(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IGeneralService::CreateScanRequest(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<IScanRequest>();
|
rb.PushIpcInterface<IGeneralService>();
|
||||||
|
|
||||||
LOG_DEBUG(Service_NIFM, "called");
|
LOG_DEBUG(Service_NIFM, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void IGeneralService::CreateRequest(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::CreateGeneralService(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<IRequest>();
|
rb.PushIpcInterface<IGeneralService>();
|
||||||
|
|
||||||
LOG_DEBUG(Service_NIFM, "called");
|
LOG_DEBUG(Service_NIFM, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void IGeneralService::RemoveNetworkProfile(Kernel::HLERequestContext& ctx) {
|
Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)
|
||||||
LOG_WARNING(Service_NIFM, "(STUBBED) called");
|
: ServiceFramework(name), module(std::move(module)) {}
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(RESULT_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IGeneralService::CreateTemporaryNetworkProfile(Kernel::HLERequestContext& ctx) {
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
||||||
|
|
||||||
rb.Push(RESULT_SUCCESS);
|
|
||||||
rb.PushIpcInterface<INetworkProfile>();
|
|
||||||
|
|
||||||
LOG_DEBUG(Service_NIFM, "called");
|
|
||||||
}
|
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager) {
|
void InstallInterfaces(SM::ServiceManager& service_manager) {
|
||||||
std::make_shared<NIFM_A>()->InstallAsService(service_manager);
|
auto module = std::make_shared<Module>();
|
||||||
std::make_shared<NIFM_S>()->InstallAsService(service_manager);
|
std::make_shared<NIFM_A>(module)->InstallAsService(service_manager);
|
||||||
std::make_shared<NIFM_U>()->InstallAsService(service_manager);
|
std::make_shared<NIFM_S>(module)->InstallAsService(service_manager);
|
||||||
|
std::make_shared<NIFM_U>(module)->InstallAsService(service_manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace NIFM
|
} // namespace NIFM
|
||||||
|
|
|
@ -9,16 +9,18 @@
|
||||||
namespace Service {
|
namespace Service {
|
||||||
namespace NIFM {
|
namespace NIFM {
|
||||||
|
|
||||||
class IGeneralService final : public ServiceFramework<IGeneralService> {
|
class Module final {
|
||||||
public:
|
public:
|
||||||
IGeneralService();
|
class Interface : public ServiceFramework<Interface> {
|
||||||
|
public:
|
||||||
|
Interface(std::shared_ptr<Module> module, const char* name);
|
||||||
|
|
||||||
private:
|
void CreateGeneralServiceOld(Kernel::HLERequestContext& ctx);
|
||||||
void GetClientId(Kernel::HLERequestContext& ctx);
|
void CreateGeneralService(Kernel::HLERequestContext& ctx);
|
||||||
void CreateScanRequest(Kernel::HLERequestContext& ctx);
|
|
||||||
void CreateRequest(Kernel::HLERequestContext& ctx);
|
protected:
|
||||||
void RemoveNetworkProfile(Kernel::HLERequestContext& ctx);
|
std::shared_ptr<Module> module;
|
||||||
void CreateTemporaryNetworkProfile(Kernel::HLERequestContext& ctx);
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager);
|
void InstallInterfaces(SM::ServiceManager& service_manager);
|
||||||
|
|
|
@ -2,29 +2,12 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
|
||||||
#include "core/hle/ipc_helpers.h"
|
|
||||||
#include "core/hle/service/nifm/nifm.h"
|
|
||||||
#include "core/hle/service/nifm/nifm_a.h"
|
#include "core/hle/service/nifm/nifm_a.h"
|
||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
namespace NIFM {
|
namespace NIFM {
|
||||||
|
|
||||||
void NIFM_A::CreateGeneralServiceOld(Kernel::HLERequestContext& ctx) {
|
NIFM_A::NIFM_A(std::shared_ptr<Module> module) : Module::Interface(std::move(module), "nifm:a") {
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
||||||
rb.Push(RESULT_SUCCESS);
|
|
||||||
rb.PushIpcInterface<IGeneralService>();
|
|
||||||
LOG_DEBUG(Service_NIFM, "called");
|
|
||||||
}
|
|
||||||
|
|
||||||
void NIFM_A::CreateGeneralService(Kernel::HLERequestContext& ctx) {
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
||||||
rb.Push(RESULT_SUCCESS);
|
|
||||||
rb.PushIpcInterface<IGeneralService>();
|
|
||||||
LOG_DEBUG(Service_NIFM, "called");
|
|
||||||
}
|
|
||||||
|
|
||||||
NIFM_A::NIFM_A() : ServiceFramework("nifm:a") {
|
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{4, &NIFM_A::CreateGeneralServiceOld, "CreateGeneralServiceOld"},
|
{4, &NIFM_A::CreateGeneralServiceOld, "CreateGeneralServiceOld"},
|
||||||
{5, &NIFM_A::CreateGeneralService, "CreateGeneralService"},
|
{5, &NIFM_A::CreateGeneralService, "CreateGeneralService"},
|
||||||
|
|
|
@ -4,20 +4,14 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "core/hle/kernel/hle_ipc.h"
|
#include "core/hle/service/nifm/nifm.h"
|
||||||
#include "core/hle/service/service.h"
|
|
||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
namespace NIFM {
|
namespace NIFM {
|
||||||
|
|
||||||
class NIFM_A final : public ServiceFramework<NIFM_A> {
|
class NIFM_A final : public Module::Interface {
|
||||||
public:
|
public:
|
||||||
NIFM_A();
|
explicit NIFM_A(std::shared_ptr<Module> module);
|
||||||
~NIFM_A() = default;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void CreateGeneralServiceOld(Kernel::HLERequestContext& ctx);
|
|
||||||
void CreateGeneralService(Kernel::HLERequestContext& ctx);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace NIFM
|
} // namespace NIFM
|
||||||
|
|
|
@ -2,29 +2,12 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
|
||||||
#include "core/hle/ipc_helpers.h"
|
|
||||||
#include "core/hle/service/nifm/nifm.h"
|
|
||||||
#include "core/hle/service/nifm/nifm_s.h"
|
#include "core/hle/service/nifm/nifm_s.h"
|
||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
namespace NIFM {
|
namespace NIFM {
|
||||||
|
|
||||||
void NIFM_S::CreateGeneralServiceOld(Kernel::HLERequestContext& ctx) {
|
NIFM_S::NIFM_S(std::shared_ptr<Module> module) : Module::Interface(std::move(module), "nifm:s") {
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
||||||
rb.Push(RESULT_SUCCESS);
|
|
||||||
rb.PushIpcInterface<IGeneralService>();
|
|
||||||
LOG_DEBUG(Service_NIFM, "called");
|
|
||||||
}
|
|
||||||
|
|
||||||
void NIFM_S::CreateGeneralService(Kernel::HLERequestContext& ctx) {
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
||||||
rb.Push(RESULT_SUCCESS);
|
|
||||||
rb.PushIpcInterface<IGeneralService>();
|
|
||||||
LOG_DEBUG(Service_NIFM, "called");
|
|
||||||
}
|
|
||||||
|
|
||||||
NIFM_S::NIFM_S() : ServiceFramework("nifm:s") {
|
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{4, &NIFM_S::CreateGeneralServiceOld, "CreateGeneralServiceOld"},
|
{4, &NIFM_S::CreateGeneralServiceOld, "CreateGeneralServiceOld"},
|
||||||
{5, &NIFM_S::CreateGeneralService, "CreateGeneralService"},
|
{5, &NIFM_S::CreateGeneralService, "CreateGeneralService"},
|
||||||
|
|
|
@ -4,20 +4,14 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "core/hle/kernel/hle_ipc.h"
|
#include "core/hle/service/nifm/nifm.h"
|
||||||
#include "core/hle/service/service.h"
|
|
||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
namespace NIFM {
|
namespace NIFM {
|
||||||
|
|
||||||
class NIFM_S final : public ServiceFramework<NIFM_S> {
|
class NIFM_S final : public Module::Interface {
|
||||||
public:
|
public:
|
||||||
NIFM_S();
|
explicit NIFM_S(std::shared_ptr<Module> module);
|
||||||
~NIFM_S() = default;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void CreateGeneralServiceOld(Kernel::HLERequestContext& ctx);
|
|
||||||
void CreateGeneralService(Kernel::HLERequestContext& ctx);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace NIFM
|
} // namespace NIFM
|
||||||
|
|
|
@ -2,29 +2,12 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
|
||||||
#include "core/hle/ipc_helpers.h"
|
|
||||||
#include "core/hle/service/nifm/nifm.h"
|
|
||||||
#include "core/hle/service/nifm/nifm_u.h"
|
#include "core/hle/service/nifm/nifm_u.h"
|
||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
namespace NIFM {
|
namespace NIFM {
|
||||||
|
|
||||||
void NIFM_U::CreateGeneralServiceOld(Kernel::HLERequestContext& ctx) {
|
NIFM_U::NIFM_U(std::shared_ptr<Module> module) : Module::Interface(std::move(module), "nifm:u") {
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
||||||
rb.Push(RESULT_SUCCESS);
|
|
||||||
rb.PushIpcInterface<IGeneralService>();
|
|
||||||
LOG_DEBUG(Service_NIFM, "called");
|
|
||||||
}
|
|
||||||
|
|
||||||
void NIFM_U::CreateGeneralService(Kernel::HLERequestContext& ctx) {
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
||||||
rb.Push(RESULT_SUCCESS);
|
|
||||||
rb.PushIpcInterface<IGeneralService>();
|
|
||||||
LOG_DEBUG(Service_NIFM, "called");
|
|
||||||
}
|
|
||||||
|
|
||||||
NIFM_U::NIFM_U() : ServiceFramework("nifm:u") {
|
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{4, &NIFM_U::CreateGeneralServiceOld, "CreateGeneralServiceOld"},
|
{4, &NIFM_U::CreateGeneralServiceOld, "CreateGeneralServiceOld"},
|
||||||
{5, &NIFM_U::CreateGeneralService, "CreateGeneralService"},
|
{5, &NIFM_U::CreateGeneralService, "CreateGeneralService"},
|
||||||
|
|
|
@ -4,20 +4,14 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "core/hle/kernel/hle_ipc.h"
|
#include "core/hle/service/nifm/nifm.h"
|
||||||
#include "core/hle/service/service.h"
|
|
||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
namespace NIFM {
|
namespace NIFM {
|
||||||
|
|
||||||
class NIFM_U final : public ServiceFramework<NIFM_U> {
|
class NIFM_U final : public Module::Interface {
|
||||||
public:
|
public:
|
||||||
NIFM_U();
|
explicit NIFM_U(std::shared_ptr<Module> module);
|
||||||
~NIFM_U() = default;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void CreateGeneralServiceOld(Kernel::HLERequestContext& ctx);
|
|
||||||
void CreateGeneralService(Kernel::HLERequestContext& ctx);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace NIFM
|
} // namespace NIFM
|
||||||
|
|
Loading…
Reference in a new issue