yuzu-emu
/
yuzu
Archived
1
0
Fork 0

psc: stub overlay notification channel

This commit is contained in:
Liam 2024-02-21 22:25:31 -05:00
parent 352297d361
commit e85466c1ae
11 changed files with 230 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);