mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-06 22:59:59 +00:00
Deglobalize System: Friend
This commit is contained in:
parent
a40e5b2def
commit
a9e9570d84
4 changed files with 24 additions and 22 deletions
|
@ -149,7 +149,8 @@ private:
|
||||||
|
|
||||||
class INotificationService final : public ServiceFramework<INotificationService> {
|
class INotificationService final : public ServiceFramework<INotificationService> {
|
||||||
public:
|
public:
|
||||||
INotificationService(Common::UUID uuid) : ServiceFramework("INotificationService"), uuid(uuid) {
|
INotificationService(Common::UUID uuid, Core::System& system)
|
||||||
|
: ServiceFramework("INotificationService"), uuid(uuid) {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &INotificationService::GetEvent, "GetEvent"},
|
{0, &INotificationService::GetEvent, "GetEvent"},
|
||||||
|
@ -159,6 +160,9 @@ public:
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
RegisterHandlers(functions);
|
RegisterHandlers(functions);
|
||||||
|
|
||||||
|
notification_event = Kernel::WritableEvent::CreateEventPair(
|
||||||
|
system.Kernel(), Kernel::ResetType::Manual, "INotificationService:NotifyEvent");
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -167,13 +171,6 @@ private:
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
if (!is_event_created) {
|
|
||||||
auto& kernel = Core::System::GetInstance().Kernel();
|
|
||||||
notification_event = Kernel::WritableEvent::CreateEventPair(
|
|
||||||
kernel, Kernel::ResetType::Manual, "INotificationService:NotifyEvent");
|
|
||||||
is_event_created = true;
|
|
||||||
}
|
|
||||||
rb.PushCopyObjects(notification_event.readable);
|
rb.PushCopyObjects(notification_event.readable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,21 +258,21 @@ void Module::Interface::CreateNotificationService(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<INotificationService>(uuid);
|
rb.PushIpcInterface<INotificationService>(uuid, system);
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {}
|
||||||
|
|
||||||
Module::Interface::~Interface() = default;
|
Module::Interface::~Interface() = default;
|
||||||
|
|
||||||
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<Friend>(module, "friend:a")->InstallAsService(service_manager);
|
std::make_shared<Friend>(module, system, "friend:a")->InstallAsService(service_manager);
|
||||||
std::make_shared<Friend>(module, "friend:m")->InstallAsService(service_manager);
|
std::make_shared<Friend>(module, system, "friend:m")->InstallAsService(service_manager);
|
||||||
std::make_shared<Friend>(module, "friend:s")->InstallAsService(service_manager);
|
std::make_shared<Friend>(module, system, "friend:s")->InstallAsService(service_manager);
|
||||||
std::make_shared<Friend>(module, "friend:u")->InstallAsService(service_manager);
|
std::make_shared<Friend>(module, system, "friend:u")->InstallAsService(service_manager);
|
||||||
std::make_shared<Friend>(module, "friend:v")->InstallAsService(service_manager);
|
std::make_shared<Friend>(module, system, "friend:v")->InstallAsService(service_manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::Friend
|
} // namespace Service::Friend
|
||||||
|
|
|
@ -6,13 +6,17 @@
|
||||||
|
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Service::Friend {
|
namespace Service::Friend {
|
||||||
|
|
||||||
class Module final {
|
class Module final {
|
||||||
public:
|
public:
|
||||||
class Interface : public ServiceFramework<Interface> {
|
class Interface : public ServiceFramework<Interface> {
|
||||||
public:
|
public:
|
||||||
explicit Interface(std::shared_ptr<Module> module, const char* name);
|
explicit Interface(std::shared_ptr<Module> module, Core::System& system, const char* name);
|
||||||
~Interface() override;
|
~Interface() override;
|
||||||
|
|
||||||
void CreateFriendService(Kernel::HLERequestContext& ctx);
|
void CreateFriendService(Kernel::HLERequestContext& ctx);
|
||||||
|
@ -20,10 +24,11 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<Module> module;
|
std::shared_ptr<Module> module;
|
||||||
|
Core::System& system;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Registers all Friend services with the specified service manager.
|
/// Registers all Friend services with the specified service manager.
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager);
|
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::Friend
|
} // namespace Service::Friend
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
|
|
||||||
namespace Service::Friend {
|
namespace Service::Friend {
|
||||||
|
|
||||||
Friend::Friend(std::shared_ptr<Module> module, const char* name)
|
Friend::Friend(std::shared_ptr<Module> module, Core::System& system, const char* name)
|
||||||
: Interface(std::move(module), name) {
|
: Interface(std::move(module), system, name) {
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &Friend::CreateFriendService, "CreateFriendService"},
|
{0, &Friend::CreateFriendService, "CreateFriendService"},
|
||||||
{1, &Friend::CreateNotificationService, "CreateNotificationService"},
|
{1, &Friend::CreateNotificationService, "CreateNotificationService"},
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace Service::Friend {
|
||||||
|
|
||||||
class Friend final : public Module::Interface {
|
class Friend final : public Module::Interface {
|
||||||
public:
|
public:
|
||||||
explicit Friend(std::shared_ptr<Module> module, const char* name);
|
explicit Friend(std::shared_ptr<Module> module, Core::System& system, const char* name);
|
||||||
~Friend() override;
|
~Friend() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue