2026-08-18 18:11:33 +02:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
2022-04-23 04:59:50 -04:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2015-01-18 15:07:48 -08:00
|
|
|
|
2023-12-05 18:39:18 -06:00
|
|
|
#include "core/hle/kernel/k_process.h"
|
|
|
|
|
#include "core/hle/kernel/kernel.h"
|
2016-09-20 23:52:38 -07:00
|
|
|
#include "core/hle/service/hid/hid.h"
|
2023-11-14 21:34:27 -06:00
|
|
|
#include "core/hle/service/hid/hid_debug_server.h"
|
|
|
|
|
#include "core/hle/service/hid/hid_server.h"
|
|
|
|
|
#include "core/hle/service/hid/hid_system_server.h"
|
2021-05-02 18:41:03 -05:00
|
|
|
#include "core/hle/service/hid/hidbus.h"
|
2018-07-26 08:39:25 -04:00
|
|
|
#include "core/hle/service/hid/irs.h"
|
2018-07-26 08:50:32 -04:00
|
|
|
#include "core/hle/service/hid/xcd.h"
|
2023-02-18 16:26:48 -05:00
|
|
|
#include "core/hle/service/server_manager.h"
|
2024-01-04 20:37:43 -06:00
|
|
|
#include "hid_core/resource_manager.h"
|
|
|
|
|
#include "hid_core/resources/hid_firmware_settings.h"
|
2015-03-09 00:14:59 -04:00
|
|
|
|
2023-11-14 21:34:27 -06:00
|
|
|
namespace Service::HID {
|
2018-07-26 08:56:16 -04:00
|
|
|
|
2026-08-18 18:11:33 +02:00
|
|
|
class IHidTemporaryServer final : public ServiceFramework<IHidTemporaryServer> {
|
|
|
|
|
public:
|
|
|
|
|
explicit IHidTemporaryServer(Core::System& system_)
|
|
|
|
|
: ServiceFramework{system_, "hid:tmp"} {
|
|
|
|
|
// clang-format off
|
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
|
{0, nullptr, "GetConsoleSixAxisSensorCalibrationValues"},
|
|
|
|
|
};
|
|
|
|
|
// clang-format on
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
|
}
|
|
|
|
|
~IHidTemporaryServer() override = default;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class AHID_CD final : public ServiceFramework<AHID_CD> {
|
|
|
|
|
public:
|
|
|
|
|
explicit AHID_CD(Core::System& system_)
|
|
|
|
|
: ServiceFramework{system_, "ahid:cd"} {
|
|
|
|
|
// clang-format off
|
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
|
{0, nullptr, "AcquireDevice"},
|
|
|
|
|
{1, nullptr, "ReleaseDevice"},
|
|
|
|
|
{2, nullptr, "GetCtrlSession"},
|
|
|
|
|
{3, nullptr, "GetReadSession"},
|
|
|
|
|
{4, nullptr, "GetWriteSession"},
|
|
|
|
|
};
|
|
|
|
|
// clang-format on
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
|
}
|
|
|
|
|
~AHID_CD() override = default;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class AHID_HDR final : public ServiceFramework<AHID_HDR> {
|
|
|
|
|
public:
|
|
|
|
|
explicit AHID_HDR(Core::System& system_)
|
|
|
|
|
: ServiceFramework{system_, "ahid:hdr"} {
|
|
|
|
|
// clang-format off
|
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
|
{0, nullptr, "GetDeviceEntries"},
|
|
|
|
|
{1, nullptr, "GetDeviceList"},
|
|
|
|
|
{2, nullptr, "GetDeviceParameters"},
|
|
|
|
|
{3, nullptr, "AttachDevice"},
|
|
|
|
|
{4, nullptr, "DetachDevice"},
|
|
|
|
|
{5, nullptr, "SetDeviceFilter"},
|
|
|
|
|
};
|
|
|
|
|
// clang-format on
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
|
}
|
|
|
|
|
~AHID_HDR() override = default;
|
|
|
|
|
};
|
|
|
|
|
|
2023-02-18 16:26:48 -05:00
|
|
|
void LoopProcess(Core::System& system) {
|
|
|
|
|
auto server_manager = std::make_unique<ServerManager>(system);
|
2026-08-18 18:11:33 +02:00
|
|
|
auto firmware_settings = std::make_shared<HidFirmwareSettings>(system);
|
|
|
|
|
auto resource_manager = std::make_shared<ResourceManager>(system, firmware_settings);
|
2023-11-14 21:34:27 -06:00
|
|
|
|
2024-01-02 17:12:16 -05:00
|
|
|
resource_manager->Initialize();
|
2023-12-05 18:39:18 -06:00
|
|
|
|
2026-08-18 18:11:33 +02:00
|
|
|
server_manager->RegisterNamedService("hid", std::make_shared<IHidServer>(system, resource_manager, firmware_settings));
|
|
|
|
|
server_manager->RegisterNamedService("hid:dbg", std::make_shared<IHidDebugServer>(system, resource_manager, firmware_settings));
|
|
|
|
|
server_manager->RegisterNamedService("hid:sys", std::make_shared<IHidSystemServer>(system, resource_manager, firmware_settings));
|
|
|
|
|
server_manager->RegisterNamedService("hid:tmp", std::make_shared<IHidTemporaryServer>(system));
|
2018-07-26 08:56:16 -04:00
|
|
|
|
2024-02-07 16:43:28 -06:00
|
|
|
server_manager->RegisterNamedService("hidbus", std::make_shared<Hidbus>(system));
|
2018-07-26 08:56:16 -04:00
|
|
|
|
2023-11-14 21:34:27 -06:00
|
|
|
server_manager->RegisterNamedService("irs", std::make_shared<IRS::IRS>(system));
|
|
|
|
|
server_manager->RegisterNamedService("irs:sys", std::make_shared<IRS::IRS_SYS>(system));
|
2023-02-18 16:26:48 -05:00
|
|
|
|
2026-08-18 18:11:33 +02:00
|
|
|
server_manager->RegisterNamedService("ahid:cd", std::make_shared<AHID_CD>(system));
|
|
|
|
|
server_manager->RegisterNamedService("ahid:hdr", std::make_shared<AHID_HDR>(system));
|
|
|
|
|
|
2023-02-18 16:26:48 -05:00
|
|
|
server_manager->RegisterNamedService("xcd:sys", std::make_shared<XCD_SYS>(system));
|
2023-11-14 21:34:27 -06:00
|
|
|
|
2023-02-18 16:26:48 -05:00
|
|
|
system.RunServer(std::move(server_manager));
|
2018-01-14 21:24:50 -05:00
|
|
|
}
|
|
|
|
|
|
2018-04-19 21:41:44 -04:00
|
|
|
} // namespace Service::HID
|