mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-06-10 20:53:15 +00:00
core: Add wrapper for calling into guest code. (#967)
This commit is contained in:
parent
ad9f1370d5
commit
4ba19a02b0
8 changed files with 57 additions and 35 deletions
|
@ -1,6 +1,8 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/singleton.h"
|
||||
#include "core/linker.h"
|
||||
#include "net_ctl_codes.h"
|
||||
#include "net_ctl_obj.h"
|
||||
|
||||
|
@ -57,18 +59,22 @@ s32 Libraries::NetCtl::NetCtlInternal::registerNpToolkitCallback(
|
|||
|
||||
void Libraries::NetCtl::NetCtlInternal::checkCallback() {
|
||||
std::unique_lock lock{m_mutex};
|
||||
auto* linker = Common::Singleton<Core::Linker>::Instance();
|
||||
for (auto& callback : callbacks) {
|
||||
if (callback.func != nullptr) {
|
||||
callback.func(ORBIS_NET_CTL_EVENT_TYPE_DISCONNECTED, callback.arg);
|
||||
linker->ExecuteGuest(callback.func, ORBIS_NET_CTL_EVENT_TYPE_DISCONNECTED,
|
||||
callback.arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Libraries::NetCtl::NetCtlInternal::checkNpToolkitCallback() {
|
||||
std::unique_lock lock{m_mutex};
|
||||
auto* linker = Common::Singleton<Core::Linker>::Instance();
|
||||
for (auto& callback : nptoolCallbacks) {
|
||||
if (callback.func != nullptr) {
|
||||
callback.func(ORBIS_NET_CTL_EVENT_TYPE_DISCONNECTED, callback.arg);
|
||||
linker->ExecuteGuest(callback.func, ORBIS_NET_CTL_EVENT_TYPE_DISCONNECTED,
|
||||
callback.arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue