summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-01-15 03:24:50 +0100
committerbunnei <bunneidev@gmail.com>2018-01-15 03:45:06 +0100
commitf4a3d282246406d44a391aafd8d494ff68669cfa (patch)
treeae3cc59843498e5e5d5f11a16311929b7a0c5979 /src/core
parentMerge pull request #10 from Andrix44/mpwarnings (diff)
downloadyuzu-f4a3d282246406d44a391aafd8d494ff68669cfa.tar
yuzu-f4a3d282246406d44a391aafd8d494ff68669cfa.tar.gz
yuzu-f4a3d282246406d44a391aafd8d494ff68669cfa.tar.bz2
yuzu-f4a3d282246406d44a391aafd8d494ff68669cfa.tar.lz
yuzu-f4a3d282246406d44a391aafd8d494ff68669cfa.tar.xz
yuzu-f4a3d282246406d44a391aafd8d494ff68669cfa.tar.zst
yuzu-f4a3d282246406d44a391aafd8d494ff68669cfa.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/hid/hid.cpp64
-rw-r--r--src/core/hle/service/hid/hid.h13
-rw-r--r--src/core/hle/service/service.cpp5
3 files changed, 68 insertions, 14 deletions
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index f838713a3..db77a445a 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -1,19 +1,77 @@
-// Copyright 2015 Citra Emulator Project
+// 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/kernel/client_port.h"
+#include "core/hle/kernel/client_session.h"
+#include "core/hle/kernel/shared_memory.h"
#include "core/hle/service/hid/hid.h"
#include "core/hle/service/service.h"
namespace Service {
namespace HID {
-void Init() {}
+class IAppletResource final : public ServiceFramework<IAppletResource> {
+public:
+ IAppletResource() : ServiceFramework("IAppletResource") {
+ static const FunctionInfo functions[] = {
+ {0, &IAppletResource::GetSharedMemoryHandle, "GetSharedMemoryHandle"},
+ };
+ RegisterHandlers(functions);
-void Shutdown() {}
+ shared_mem = Kernel::SharedMemory::Create(
+ nullptr, 0x40000, Kernel::MemoryPermission::ReadWrite, Kernel::MemoryPermission::Read,
+ 0, Kernel::MemoryRegion::BASE, "HID:SharedMemory");
+ }
+
+private:
+ void GetSharedMemoryHandle(Kernel::HLERequestContext& ctx) {
+ IPC::RequestBuilder rb{ctx, 2, 1};
+ rb.Push(RESULT_SUCCESS);
+ rb.PushCopyObjects(shared_mem);
+ LOG_DEBUG(Service, "called");
+ }
+
+ // Handle to shared memory region designated to HID service
+ Kernel::SharedPtr<Kernel::SharedMemory> shared_mem;
+};
+
+class Hid final : public ServiceFramework<Hid> {
+public:
+ Hid() : ServiceFramework("hid") {
+ static const FunctionInfo functions[] = {
+ {0x00000000, &Hid::CreateAppletResource, "CreateAppletResource"},
+ };
+ RegisterHandlers(functions);
+ }
+ ~Hid() = default;
+
+private:
+ void CreateAppletResource(Kernel::HLERequestContext& ctx) {
+ auto client_port = std::make_shared<IAppletResource>()->CreatePort();
+ auto session = client_port->Connect();
+ if (session.Succeeded()) {
+ LOG_DEBUG(Service, "called, initialized IAppletResource -> session=%u",
+ (*session)->GetObjectId());
+ IPC::RequestBuilder rb{ctx, 2, 0, 1};
+ rb.Push(RESULT_SUCCESS);
+ rb.PushMoveObjects(std::move(session).Unwrap());
+ registered_loggers.emplace_back(std::move(client_port));
+ } else {
+ UNIMPLEMENTED();
+ }
+ }
+
+ std::vector<Kernel::SharedPtr<Kernel::ClientPort>> registered_loggers;
+};
void ReloadInputDevices() {}
+void InstallInterfaces(SM::ServiceManager& service_manager) {
+ std::make_shared<Hid>()->InstallAsService(service_manager);
+}
+
} // namespace HID
} // namespace Service
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h
index a1d227dfe..f7621f62d 100644
--- a/src/core/hle/service/hid/hid.h
+++ b/src/core/hle/service/hid/hid.h
@@ -1,20 +1,19 @@
-// Copyright 2015 Citra Emulator Project
+// 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 HID {
-/// Initialize HID service
-void Init();
-
-/// Shutdown HID service
-void Shutdown();
-
/// Reload input devices. Used when input configuration changed
void ReloadInputDevices();
+/// Registers all HID services with the specified service manager.
+void InstallInterfaces(SM::ServiceManager& service_manager);
+
} // namespace HID
} // namespace Service
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index b82df6f35..0ecc0eb16 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -164,20 +164,17 @@ void Init() {
AM::InstallInterfaces(*SM::g_service_manager);
AOC::InstallInterfaces(*SM::g_service_manager);
APM::InstallInterfaces(*SM::g_service_manager);
+ HID::InstallInterfaces(*SM::g_service_manager);
LM::InstallInterfaces(*SM::g_service_manager);
NVDRV::InstallInterfaces(*SM::g_service_manager);
PCTL::InstallInterfaces(*SM::g_service_manager);
VI::InstallInterfaces(*SM::g_service_manager);
- HID::Init();
-
LOG_DEBUG(Service, "initialized OK");
}
/// Shutdown ServiceManager
void Shutdown() {
- HID::Shutdown();
-
SM::g_service_manager = nullptr;
g_kernel_named_ports.clear();
LOG_DEBUG(Service, "shutdown OK");