diff options
author | Liam <byteslice@airmail.cc> | 2024-02-22 04:25:31 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2024-02-22 04:54:05 +0100 |
commit | e85466c1ae5c993617920f28e9ee1799591d4a9a (patch) | |
tree | 06e0610553d633da38488813ee3bf33987cf4bf3 /src | |
parent | psc: rewrite IPmService (diff) | |
download | yuzu-e85466c1ae5c993617920f28e9ee1799591d4a9a.tar yuzu-e85466c1ae5c993617920f28e9ee1799591d4a9a.tar.gz yuzu-e85466c1ae5c993617920f28e9ee1799591d4a9a.tar.bz2 yuzu-e85466c1ae5c993617920f28e9ee1799591d4a9a.tar.lz yuzu-e85466c1ae5c993617920f28e9ee1799591d4a9a.tar.xz yuzu-e85466c1ae5c993617920f28e9ee1799591d4a9a.tar.zst yuzu-e85466c1ae5c993617920f28e9ee1799591d4a9a.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/core/CMakeLists.txt | 9 | ||||
-rw-r--r-- | src/core/hle/service/psc/ovln/ovln_types.h | 21 | ||||
-rw-r--r-- | src/core/hle/service/psc/ovln/receiver.cpp | 24 | ||||
-rw-r--r-- | src/core/hle/service/psc/ovln/receiver.h | 16 | ||||
-rw-r--r-- | src/core/hle/service/psc/ovln/receiver_service.cpp | 28 | ||||
-rw-r--r-- | src/core/hle/service/psc/ovln/receiver_service.h | 22 | ||||
-rw-r--r-- | src/core/hle/service/psc/ovln/sender.cpp | 32 | ||||
-rw-r--r-- | src/core/hle/service/psc/ovln/sender.h | 21 | ||||
-rw-r--r-- | src/core/hle/service/psc/ovln/sender_service.cpp | 30 | ||||
-rw-r--r-- | src/core/hle/service/psc/ovln/sender_service.h | 23 | ||||
-rw-r--r-- | src/core/hle/service/psc/psc.cpp | 4 |
11 files changed, 230 insertions, 0 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 6610da751..a9ee535e3 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -891,6 +891,15 @@ add_library(core STATIC hle/service/pm/pm.h hle/service/prepo/prepo.cpp hle/service/prepo/prepo.h + hle/service/psc/ovln/ovln_types.h + hle/service/psc/ovln/receiver_service.cpp + hle/service/psc/ovln/receiver_service.h + hle/service/psc/ovln/receiver.cpp + hle/service/psc/ovln/receiver.h + hle/service/psc/ovln/sender_service.cpp + hle/service/psc/ovln/sender_service.h + hle/service/psc/ovln/sender.cpp + hle/service/psc/ovln/sender.h hle/service/psc/pm_control.cpp hle/service/psc/pm_control.h hle/service/psc/pm_module.cpp diff --git a/src/core/hle/service/psc/ovln/ovln_types.h b/src/core/hle/service/psc/ovln/ovln_types.h new file mode 100644 index 000000000..343b05dcc --- /dev/null +++ b/src/core/hle/service/psc/ovln/ovln_types.h @@ -0,0 +1,21 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "common/bit_field.h" +#include "common/common_types.h" + +namespace Service::PSC { + +using OverlayNotification = std::array<u64, 0x10>; +static_assert(sizeof(OverlayNotification) == 0x80, "OverlayNotification has incorrect size"); + +union MessageFlags { + u64 raw; + BitField<0, 8, u64> message_type; + BitField<8, 8, u64> queue_type; +}; +static_assert(sizeof(MessageFlags) == 0x8, "MessageFlags has incorrect size"); + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/ovln/receiver.cpp b/src/core/hle/service/psc/ovln/receiver.cpp new file mode 100644 index 000000000..85f62816d --- /dev/null +++ b/src/core/hle/service/psc/ovln/receiver.cpp @@ -0,0 +1,24 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/psc/ovln/receiver.h" + +namespace Service::PSC { + +IReceiver::IReceiver(Core::System& system_) : ServiceFramework{system_, "IReceiver"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "AddSource"}, + {1, nullptr, "RemoveSource"}, + {2, nullptr, "GetReceiveEventHandle"}, + {3, nullptr, "Receive"}, + {4, nullptr, "ReceiveWithTick"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +IReceiver::~IReceiver() = default; + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/ovln/receiver.h b/src/core/hle/service/psc/ovln/receiver.h new file mode 100644 index 000000000..c47a4ff7e --- /dev/null +++ b/src/core/hle/service/psc/ovln/receiver.h @@ -0,0 +1,16 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/service.h" + +namespace Service::PSC { + +class IReceiver final : public ServiceFramework<IReceiver> { +public: + explicit IReceiver(Core::System& system_); + ~IReceiver() override; +}; + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/ovln/receiver_service.cpp b/src/core/hle/service/psc/ovln/receiver_service.cpp new file mode 100644 index 000000000..bb988e905 --- /dev/null +++ b/src/core/hle/service/psc/ovln/receiver_service.cpp @@ -0,0 +1,28 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/cmif_serialization.h" +#include "core/hle/service/psc/ovln/receiver.h" +#include "core/hle/service/psc/ovln/receiver_service.h" + +namespace Service::PSC { + +IReceiverService::IReceiverService(Core::System& system_) : ServiceFramework{system_, "ovln:rcv"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IReceiverService::OpenReceiver>, "OpenReceiver"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +IReceiverService::~IReceiverService() = default; + +Result IReceiverService::OpenReceiver(Out<SharedPointer<IReceiver>> out_receiver) { + LOG_DEBUG(Service_PSC, "called"); + *out_receiver = std::make_shared<IReceiver>(system); + R_SUCCEED(); +} + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/ovln/receiver_service.h b/src/core/hle/service/psc/ovln/receiver_service.h new file mode 100644 index 000000000..b3b31ba4a --- /dev/null +++ b/src/core/hle/service/psc/ovln/receiver_service.h @@ -0,0 +1,22 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/service.h" + +namespace Service::PSC { + +class IReceiver; + +class IReceiverService final : public ServiceFramework<IReceiverService> { +public: + explicit IReceiverService(Core::System& system_); + ~IReceiverService() override; + +private: + Result OpenReceiver(Out<SharedPointer<IReceiver>> out_receiver); +}; + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/ovln/sender.cpp b/src/core/hle/service/psc/ovln/sender.cpp new file mode 100644 index 000000000..3227a56f2 --- /dev/null +++ b/src/core/hle/service/psc/ovln/sender.cpp @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/cmif_serialization.h" +#include "core/hle/service/psc/ovln/sender.h" + +namespace Service::PSC { + +ISender::ISender(Core::System& system_) : ServiceFramework{system_, "ISender"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&ISender::Send>, "Send"}, + {1, nullptr, "GetUnreceivedMessageCount"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +ISender::~ISender() = default; + +Result ISender::Send(const OverlayNotification& notification, MessageFlags flags) { + std::string data; + for (const auto m : notification) { + data += fmt::format("{:016X} ", m); + } + + LOG_WARNING(Service_PSC, "(STUBBED) called, flags={} notification={}", flags.raw, data); + R_SUCCEED(); +} + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/ovln/sender.h b/src/core/hle/service/psc/ovln/sender.h new file mode 100644 index 000000000..c1575428e --- /dev/null +++ b/src/core/hle/service/psc/ovln/sender.h @@ -0,0 +1,21 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/psc/ovln/ovln_types.h" +#include "core/hle/service/service.h" + +namespace Service::PSC { + +class ISender final : public ServiceFramework<ISender> { +public: + explicit ISender(Core::System& system_); + ~ISender() override; + +private: + Result Send(const OverlayNotification& notification, MessageFlags flags); +}; + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/ovln/sender_service.cpp b/src/core/hle/service/psc/ovln/sender_service.cpp new file mode 100644 index 000000000..18d2c83a3 --- /dev/null +++ b/src/core/hle/service/psc/ovln/sender_service.cpp @@ -0,0 +1,30 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/cmif_serialization.h" +#include "core/hle/service/psc/ovln/sender.h" +#include "core/hle/service/psc/ovln/sender_service.h" + +namespace Service::PSC { + +ISenderService::ISenderService(Core::System& system_) : ServiceFramework{system_, "ovln:snd"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&ISenderService::OpenSender>, "OpenSender"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +ISenderService::~ISenderService() = default; + +Result ISenderService::OpenSender(Out<SharedPointer<ISender>> out_sender, u32 sender_id, + std::array<u64, 2> data) { + LOG_WARNING(Service_PSC, "(STUBBED) called, sender_id={}, data={:016X} {:016X}", sender_id, + data[0], data[1]); + *out_sender = std::make_shared<ISender>(system); + R_SUCCEED(); +} + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/ovln/sender_service.h b/src/core/hle/service/psc/ovln/sender_service.h new file mode 100644 index 000000000..10027701f --- /dev/null +++ b/src/core/hle/service/psc/ovln/sender_service.h @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/service.h" + +namespace Service::PSC { + +class ISender; + +class ISenderService final : public ServiceFramework<ISenderService> { +public: + explicit ISenderService(Core::System& system_); + ~ISenderService() override; + +private: + Result OpenSender(Out<SharedPointer<ISender>> out_sender, u32 sender_id, + std::array<u64, 2> data); +}; + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/psc.cpp b/src/core/hle/service/psc/psc.cpp index a086c13ed..e1762d694 100644 --- a/src/core/hle/service/psc/psc.cpp +++ b/src/core/hle/service/psc/psc.cpp @@ -1,6 +1,8 @@ // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include "core/hle/service/psc/ovln/receiver_service.h" +#include "core/hle/service/psc/ovln/sender_service.h" #include "core/hle/service/psc/pm_control.h" #include "core/hle/service/psc/pm_service.h" #include "core/hle/service/psc/psc.h" @@ -17,6 +19,8 @@ void LoopProcess(Core::System& system) { server_manager->RegisterNamedService("psc:c", std::make_shared<IPmControl>(system)); server_manager->RegisterNamedService("psc:m", std::make_shared<IPmService>(system)); + server_manager->RegisterNamedService("ovln:rcv", std::make_shared<IReceiverService>(system)); + server_manager->RegisterNamedService("ovln:snd", std::make_shared<ISenderService>(system)); auto time = std::make_shared<Time::TimeManager>(system); |