VERY experimental Nintendo Switch 2 emulator
C++
service: Add Friend service interface.
bunnei55537f1f02f3
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txtindex 76f70a8447..ec011787eb 100644--- a/src/core/CMakeLists.txt+++ b/src/core/CMakeLists.txt@@ -112,6 +112,10 @@ add_library(core STATIChle/service/filesystem/filesystem.hhle/service/filesystem/fsp_srv.cpphle/service/filesystem/fsp_srv.h+ hle/service/friend/friend.cpp+ hle/service/friend/friend.h+ hle/service/friend/friend_a.cpp+ hle/service/friend/friend_a.hhle/service/hid/hid.cpphle/service/hid/hid.hhle/service/lm/lm.cppdiff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cppnew file mode 100644index 0000000000..26593bb0cd--- /dev/null+++ b/src/core/hle/service/friend/friend.cpp@@ -0,0 +1,28 @@+// Copyright 2018 yuzu emulator team+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#include "common/logging/log.h"+#include "core/hle/ipc_helpers.h"+#include "core/hle/service/friend/friend.h"+#include "core/hle/service/friend/friend_a.h"++namespace Service {+namespace Friend {++void Module::Interface::Unknown(Kernel::HLERequestContext& ctx) {+ IPC::ResponseBuilder rb{ctx, 2};+ rb.Push(RESULT_SUCCESS);+ LOG_WARNING(Service_Friend, "(STUBBED) called");+}++Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)+ : ServiceFramework(name), module(std::move(module)) {}++void InstallInterfaces(SM::ServiceManager& service_manager) {+ auto module = std::make_shared<Module>();+ std::make_shared<Friend_A>(module)->InstallAsService(service_manager);+}++} // namespace Friend+} // namespace Servicediff --git a/src/core/hle/service/friend/friend.h b/src/core/hle/service/friend/friend.hnew file mode 100644index 0000000000..ffa498397e--- /dev/null+++ b/src/core/hle/service/friend/friend.h@@ -0,0 +1,29 @@+// Copyright 2018 yuzu emulator team+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#pragma once++#include "core/hle/service/service.h"++namespace Service {+namespace Friend {++class Module final {+public:+ class Interface : public ServiceFramework<Interface> {+ public:+ Interface(std::shared_ptr<Module> module, const char* name);++ void Unknown(Kernel::HLERequestContext& ctx);++ protected:+ std::shared_ptr<Module> module;+ };+};++/// Registers all Friend services with the specified service manager.+void InstallInterfaces(SM::ServiceManager& service_manager);++} // namespace Friend+} // namespace Servicediff --git a/src/core/hle/service/friend/friend_a.cpp b/src/core/hle/service/friend/friend_a.cppnew file mode 100644index 0000000000..e1f2397c27--- /dev/null+++ b/src/core/hle/service/friend/friend_a.cpp@@ -0,0 +1,19 @@+// Copyright 2018 yuzu emulator team+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#include "core/hle/service/friend/friend_a.h"++namespace Service {+namespace Friend {++Friend_A::Friend_A(std::shared_ptr<Module> module)+ : Module::Interface(std::move(module), "friend:a") {+ static const FunctionInfo functions[] = {+ {0, &Friend_A::Unknown, "Unknown"},+ };+ RegisterHandlers(functions);+}++} // namespace Friend+} // namespace Servicediff --git a/src/core/hle/service/friend/friend_a.h b/src/core/hle/service/friend/friend_a.hnew file mode 100644index 0000000000..68fa58297c--- /dev/null+++ b/src/core/hle/service/friend/friend_a.h@@ -0,0 +1,18 @@+// Copyright 2018 yuzu emulator team+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#pragma once++#include "core/hle/service/friend/friend.h"++namespace Service {+namespace Friend {++class Friend_A final : public Module::Interface {+public:+ explicit Friend_A(std::shared_ptr<Module> module);+};++} // namespace Friend+} // namespace Servicediff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cppindex 5e6d837290..6a2d6a4ef7 100644--- a/src/core/hle/service/service.cpp+++ b/src/core/hle/service/service.cpp@@ -20,6 +20,7 @@#include "core/hle/service/apm/apm.h"#include "core/hle/service/audio/audio.h"#include "core/hle/service/filesystem/filesystem.h"+#include "core/hle/service/friend/friend.h"#include "core/hle/service/hid/hid.h"#include "core/hle/service/lm/lm.h"#include "core/hle/service/nifm/nifm.h"@@ -180,6 +181,7 @@ void Init() {APM::InstallInterfaces(*SM::g_service_manager);Audio::InstallInterfaces(*SM::g_service_manager);FileSystem::InstallInterfaces(*SM::g_service_manager);+ Friend::InstallInterfaces(*SM::g_service_manager);HID::InstallInterfaces(*SM::g_service_manager);LM::InstallInterfaces(*SM::g_service_manager);NIFM::InstallInterfaces(*SM::g_service_manager);