mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-08-17 05:43:15 +00:00
[video_core, hle] remove redundant parent references in system structs (#3908)
reworked a bit to remove references of parent objects and instead pass as arguments to methods to prevent useless reloads Signed-off-by: lizzie <lizzie@eden-emu.dev> Co-authored-by: maufeat <sahyno1996@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3908 Reviewed-by: Maufeat <sahyno1996@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
@@ -13,12 +16,12 @@ KSession::KSession(KernelCore& kernel)
|
||||
: KAutoObjectWithSlabHeapAndContainer{kernel}, m_server{kernel}, m_client{kernel} {}
|
||||
KSession::~KSession() = default;
|
||||
|
||||
void KSession::Initialize(KClientPort* client_port, uintptr_t name) {
|
||||
void KSession::Initialize(KernelCore& kernel, KClientPort* client_port, uintptr_t name) {
|
||||
// Increment reference count.
|
||||
// Because reference count is one on creation, this will result
|
||||
// in a reference count of two. Thus, when both server and client are closed
|
||||
// this object will be destroyed.
|
||||
this->Open();
|
||||
this->Open(kernel);
|
||||
|
||||
// Create our sub sessions.
|
||||
KAutoObject::Create(std::addressof(m_server));
|
||||
@@ -33,45 +36,45 @@ void KSession::Initialize(KClientPort* client_port, uintptr_t name) {
|
||||
m_name = name;
|
||||
|
||||
// Set our owner process.
|
||||
m_process = GetCurrentProcessPointer(m_kernel);
|
||||
m_process->Open();
|
||||
m_process = GetCurrentProcessPointer(kernel);
|
||||
m_process->Open(kernel);
|
||||
|
||||
// Set our port.
|
||||
m_port = client_port;
|
||||
if (m_port != nullptr) {
|
||||
m_port->Open();
|
||||
m_port->Open(kernel);
|
||||
}
|
||||
|
||||
// Mark initialized.
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
void KSession::Finalize() {
|
||||
void KSession::Finalize(KernelCore& kernel) {
|
||||
if (m_port != nullptr) {
|
||||
m_port->OnSessionFinalized();
|
||||
m_port->Close();
|
||||
m_port->OnSessionFinalized(kernel);
|
||||
m_port->Close(kernel);
|
||||
}
|
||||
}
|
||||
|
||||
void KSession::OnServerClosed() {
|
||||
void KSession::OnServerClosed(KernelCore& kernel) {
|
||||
if (this->GetState() == State::Normal) {
|
||||
this->SetState(State::ServerClosed);
|
||||
m_client.OnServerClosed();
|
||||
}
|
||||
}
|
||||
|
||||
void KSession::OnClientClosed() {
|
||||
void KSession::OnClientClosed(KernelCore& kernel) {
|
||||
if (this->GetState() == State::Normal) {
|
||||
SetState(State::ClientClosed);
|
||||
m_server.OnClientClosed();
|
||||
this->SetState(State::ClientClosed);
|
||||
m_server.OnClientClosed(kernel);
|
||||
}
|
||||
}
|
||||
|
||||
void KSession::PostDestroy(uintptr_t arg) {
|
||||
void KSession::PostDestroy(KernelCore& kernel, uintptr_t arg) {
|
||||
// Release the session count resource the owner process holds.
|
||||
KProcess* owner = reinterpret_cast<KProcess*>(arg);
|
||||
owner->GetResourceLimit()->Release(LimitableResource::SessionCountMax, 1);
|
||||
owner->Close();
|
||||
owner->GetResourceLimit()->Release(kernel, LimitableResource::SessionCountMax, 1);
|
||||
owner->Close(kernel);
|
||||
}
|
||||
|
||||
} // namespace Kernel
|
||||
|
||||
Reference in New Issue
Block a user