1
0
Fork 0
forked from suyu/suyu

Merge pull request #13117 from liamwhite/ovln

psc: stub overlay notification channel
This commit is contained in:
liamwhite 2024-02-22 20:26:03 -05:00 committed by GitHub
commit dad9ea3e07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 372 additions and 69 deletions

View file

@ -895,6 +895,21 @@ add_library(core STATIC
hle/service/pm/pm.h hle/service/pm/pm.h
hle/service/prepo/prepo.cpp hle/service/prepo/prepo.cpp
hle/service/prepo/prepo.h 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
hle/service/psc/pm_module.h
hle/service/psc/pm_service.cpp
hle/service/psc/pm_service.h
hle/service/psc/psc.cpp hle/service/psc/psc.cpp
hle/service/psc/psc.h hle/service/psc/psc.h
hle/service/psc/time/alarms.cpp hle/service/psc/time/alarms.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

@ -0,0 +1,28 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/psc/pm_control.h"
namespace Service::PSC {
IPmControl::IPmControl(Core::System& system_) : ServiceFramework{system_, "psc:c"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "Initialize"},
{1, nullptr, "DispatchRequest"},
{2, nullptr, "GetResult"},
{3, nullptr, "GetState"},
{4, nullptr, "Cancel"},
{5, nullptr, "PrintModuleInformation"},
{6, nullptr, "GetModuleInformation"},
{10, nullptr, "AcquireStateLock"},
{11, nullptr, "HasStateLock"},
};
// clang-format on
RegisterHandlers(functions);
}
IPmControl::~IPmControl() = 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 IPmControl final : public ServiceFramework<IPmControl> {
public:
explicit IPmControl(Core::System& system_);
~IPmControl() override;
};
} // 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/pm_module.h"
namespace Service::PSC {
IPmModule::IPmModule(Core::System& system_) : ServiceFramework{system_, "IPmModule"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "Initialize"},
{1, nullptr, "GetRequest"},
{2, nullptr, "Acknowledge"},
{3, nullptr, "Finalize"},
{4, nullptr, "AcknowledgeEx"},
};
// clang-format on
RegisterHandlers(functions);
}
IPmModule::~IPmModule() = 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 IPmModule final : public ServiceFramework<IPmModule> {
public:
explicit IPmModule(Core::System& system_);
~IPmModule() 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/pm_module.h"
#include "core/hle/service/psc/pm_service.h"
namespace Service::PSC {
IPmService::IPmService(Core::System& system_) : ServiceFramework{system_, "psc:m"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&IPmService::GetPmModule>, "GetPmModule"},
};
// clang-format on
RegisterHandlers(functions);
}
IPmService::~IPmService() = default;
Result IPmService::GetPmModule(Out<SharedPointer<IPmModule>> out_module) {
LOG_DEBUG(Service_PSC, "called");
*out_module = std::make_shared<IPmModule>(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 IPmModule;
class IPmService final : public ServiceFramework<IPmService> {
public:
explicit IPmService(Core::System& system_);
~IPmService() override;
private:
Result GetPmModule(Out<SharedPointer<IPmModule>> out_module);
};
} // namespace Service::PSC

View file

@ -1,11 +1,10 @@
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <memory> #include "core/hle/service/psc/ovln/receiver_service.h"
#include "core/hle/service/psc/ovln/sender_service.h"
#include "common/logging/log.h" #include "core/hle/service/psc/pm_control.h"
#include "core/core.h" #include "core/hle/service/psc/pm_service.h"
#include "core/hle/service/ipc_helpers.h"
#include "core/hle/service/psc/psc.h" #include "core/hle/service/psc/psc.h"
#include "core/hle/service/psc/time/manager.h" #include "core/hle/service/psc/time/manager.h"
#include "core/hle/service/psc/time/power_state_service.h" #include "core/hle/service/psc/time/power_state_service.h"
@ -15,71 +14,13 @@
namespace Service::PSC { namespace Service::PSC {
class IPmControl final : public ServiceFramework<IPmControl> {
public:
explicit IPmControl(Core::System& system_) : ServiceFramework{system_, "psc:c"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "Initialize"},
{1, nullptr, "DispatchRequest"},
{2, nullptr, "GetResult"},
{3, nullptr, "GetState"},
{4, nullptr, "Cancel"},
{5, nullptr, "PrintModuleInformation"},
{6, nullptr, "GetModuleInformation"},
{10, nullptr, "AcquireStateLock"},
{11, nullptr, "HasStateLock"},
};
// clang-format on
RegisterHandlers(functions);
}
};
class IPmModule final : public ServiceFramework<IPmModule> {
public:
explicit IPmModule(Core::System& system_) : ServiceFramework{system_, "IPmModule"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "Initialize"},
{1, nullptr, "GetRequest"},
{2, nullptr, "Acknowledge"},
{3, nullptr, "Finalize"},
{4, nullptr, "AcknowledgeEx"},
};
// clang-format on
RegisterHandlers(functions);
}
};
class IPmService final : public ServiceFramework<IPmService> {
public:
explicit IPmService(Core::System& system_) : ServiceFramework{system_, "psc:m"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, &IPmService::GetPmModule, "GetPmModule"},
};
// clang-format on
RegisterHandlers(functions);
}
private:
void GetPmModule(HLERequestContext& ctx) {
LOG_DEBUG(Service_PSC, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess);
rb.PushIpcInterface<IPmModule>(system);
}
};
void LoopProcess(Core::System& system) { void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system); auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("psc:c", std::make_shared<IPmControl>(system)); server_manager->RegisterNamedService("psc:c", std::make_shared<IPmControl>(system));
server_manager->RegisterNamedService("psc:m", std::make_shared<IPmService>(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); auto time = std::make_shared<Time::TimeManager>(system);

View file

@ -7,10 +7,6 @@ namespace Core {
class System; class System;
} }
namespace Service::SM {
class ServiceManager;
}
namespace Service::PSC { namespace Service::PSC {
void LoopProcess(Core::System& system); void LoopProcess(Core::System& system);