[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:
lizzie
2026-06-23 06:31:25 +02:00
committed by crueter
parent f8facda35f
commit 3aa0d46259
307 changed files with 4419 additions and 4477 deletions
+24 -53
View File
@@ -650,8 +650,7 @@ Result IHidServer::SetSupportedNpadStyleSet(Core::HID::NpadStyleSet supported_st
LOG_DEBUG(Service_HID, "called, supported_style_set={}, applet_resource_user_id={}",
supported_style_set, aruid.pid);
R_TRY(
GetResourceManager()->GetNpad()->SetSupportedNpadStyleSet(aruid.pid, supported_style_set));
R_TRY(GetResourceManager()->GetNpad()->SetSupportedNpadStyleSet(system.Kernel(), aruid.pid, supported_style_set));
Core::HID::NpadStyleTag style_tag{supported_style_set};
const auto revision = GetResourceManager()->GetNpad()->GetRevision(aruid.pid);
@@ -667,7 +666,7 @@ Result IHidServer::GetSupportedNpadStyleSet(Out<Core::HID::NpadStyleSet> out_sup
ClientAppletResourceUserId aruid) {
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", aruid.pid);
R_RETURN(GetResourceManager()->GetNpad()->GetSupportedNpadStyleSet(aruid.pid,
R_RETURN(GetResourceManager()->GetNpad()->GetSupportedNpadStyleSet(system.Kernel(), aruid.pid,
*out_supported_style_set));
}
@@ -677,7 +676,7 @@ Result IHidServer::SetSupportedNpadIdType(
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", aruid.pid);
R_RETURN(
GetResourceManager()->GetNpad()->SetSupportedNpadIdType(aruid.pid, supported_npad_list));
GetResourceManager()->GetNpad()->SetSupportedNpadIdType(system.Kernel(), aruid.pid, supported_npad_list));
}
Result IHidServer::ActivateNpad(ClientAppletResourceUserId aruid) {
@@ -702,14 +701,13 @@ Result IHidServer::AcquireNpadStyleSetUpdateEventHandle(
LOG_DEBUG(Service_HID, "called, npad_id={}, applet_resource_user_id={}, unknown={}", npad_id,
aruid.pid, unknown);
R_RETURN(GetResourceManager()->GetNpad()->AcquireNpadStyleSetUpdateEventHandle(
aruid.pid, out_event, npad_id));
R_RETURN(GetResourceManager()->GetNpad()->AcquireNpadStyleSetUpdateEventHandle(system.Kernel(), aruid.pid, out_event, npad_id));
}
Result IHidServer::DisconnectNpad(Core::HID::NpadIdType npad_id, ClientAppletResourceUserId aruid) {
LOG_DEBUG(Service_HID, "called, npad_id={}, applet_resource_user_id={}", npad_id, aruid.pid);
R_RETURN(GetResourceManager()->GetNpad()->DisconnectNpad(aruid.pid, npad_id));
R_RETURN(GetResourceManager()->GetNpad()->DisconnectNpad(system.Kernel(), aruid.pid, npad_id));
}
Result IHidServer::GetPlayerLedPattern(Out<Core::HID::LedPattern> out_led_pattern,
@@ -779,7 +777,7 @@ Result IHidServer::SetNpadJoyAssignmentModeSingleByDefault(Core::HID::NpadIdType
LOG_INFO(Service_HID, "called, npad_id={}, applet_resource_user_id={}", npad_id, aruid.pid);
Core::HID::NpadIdType new_npad_id{};
GetResourceManager()->GetNpad()->SetNpadMode(
GetResourceManager()->GetNpad()->SetNpadMode(system.Kernel(),
aruid.pid, new_npad_id, npad_id, NpadJoyDeviceType::Left, NpadJoyAssignmentMode::Single);
R_SUCCEED();
}
@@ -791,7 +789,7 @@ Result IHidServer::SetNpadJoyAssignmentModeSingle(Core::HID::NpadIdType npad_id,
npad_id, aruid.pid, npad_joy_device_type);
Core::HID::NpadIdType new_npad_id{};
GetResourceManager()->GetNpad()->SetNpadMode(
GetResourceManager()->GetNpad()->SetNpadMode(system.Kernel(),
aruid.pid, new_npad_id, npad_id, npad_joy_device_type, NpadJoyAssignmentMode::Single);
R_SUCCEED();
}
@@ -801,7 +799,7 @@ Result IHidServer::SetNpadJoyAssignmentModeDual(Core::HID::NpadIdType npad_id,
LOG_DEBUG(Service_HID, "called, npad_id={}, applet_resource_user_id={}", npad_id, aruid.pid);
Core::HID::NpadIdType new_npad_id{};
GetResourceManager()->GetNpad()->SetNpadMode(aruid.pid, new_npad_id, npad_id, {},
GetResourceManager()->GetNpad()->SetNpadMode(system.Kernel(), aruid.pid, new_npad_id, npad_id, {},
NpadJoyAssignmentMode::Dual);
R_SUCCEED();
}
@@ -813,7 +811,7 @@ Result IHidServer::MergeSingleJoyAsDualJoy(Core::HID::NpadIdType npad_id_1,
npad_id_1, npad_id_2, aruid.pid);
R_RETURN(
GetResourceManager()->GetNpad()->MergeSingleJoyAsDualJoy(aruid.pid, npad_id_1, npad_id_2));
GetResourceManager()->GetNpad()->MergeSingleJoyAsDualJoy(system.Kernel(), aruid.pid, npad_id_1, npad_id_2));
}
Result IHidServer::StartLrAssignmentMode(ClientAppletResourceUserId aruid) {
@@ -840,67 +838,40 @@ Result IHidServer::SetNpadHandheldActivationMode(ClientAppletResourceUserId arui
ASSERT_MSG(false, "Activation mode should be always None, Single or Dual");
R_SUCCEED();
}
R_RETURN(
GetResourceManager()->GetNpad()->SetNpadHandheldActivationMode(aruid.pid, activation_mode));
R_RETURN(GetResourceManager()->GetNpad()->SetNpadHandheldActivationMode(system.Kernel(), aruid.pid, activation_mode));
}
Result IHidServer::GetNpadHandheldActivationMode(
Out<NpadHandheldActivationMode> out_activation_mode, ClientAppletResourceUserId aruid) {
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", aruid.pid);
R_RETURN(GetResourceManager()->GetNpad()->GetNpadHandheldActivationMode(aruid.pid,
*out_activation_mode));
R_RETURN(GetResourceManager()->GetNpad()->GetNpadHandheldActivationMode(system.Kernel(), aruid.pid, *out_activation_mode));
}
Result IHidServer::SwapNpadAssignment(Core::HID::NpadIdType npad_id_1,
Core::HID::NpadIdType npad_id_2,
ClientAppletResourceUserId aruid) {
LOG_DEBUG(Service_HID, "called, npad_id_1={}, npad_id_2={}, applet_resource_user_id={}",
npad_id_1, npad_id_2, aruid.pid);
R_RETURN(GetResourceManager()->GetNpad()->SwapNpadAssignment(aruid.pid, npad_id_1, npad_id_2))
Result IHidServer::SwapNpadAssignment(Core::HID::NpadIdType npad_id_1, Core::HID::NpadIdType npad_id_2, ClientAppletResourceUserId aruid) {
LOG_DEBUG(Service_HID, "called, npad_id_1={}, npad_id_2={}, applet_resource_user_id={}", npad_id_1, npad_id_2, aruid.pid);
R_RETURN(GetResourceManager()->GetNpad()->SwapNpadAssignment(system.Kernel(), aruid.pid, npad_id_1, npad_id_2))
}
Result IHidServer::IsUnintendedHomeButtonInputProtectionEnabled(Out<bool> out_is_enabled,
Core::HID::NpadIdType npad_id,
ClientAppletResourceUserId aruid) {
Result IHidServer::IsUnintendedHomeButtonInputProtectionEnabled(Out<bool> out_is_enabled, Core::HID::NpadIdType npad_id, ClientAppletResourceUserId aruid) {
LOG_INFO(Service_HID, "called, npad_id={}, applet_resource_user_id={}", npad_id, aruid.pid);
R_UNLESS(IsNpadIdValid(npad_id), ResultInvalidNpadId);
R_RETURN(GetResourceManager()->GetNpad()->IsUnintendedHomeButtonInputProtectionEnabled(
*out_is_enabled, aruid.pid, npad_id));
R_RETURN(GetResourceManager()->GetNpad()->IsUnintendedHomeButtonInputProtectionEnabled(*out_is_enabled, aruid.pid, npad_id));
}
Result IHidServer::EnableUnintendedHomeButtonInputProtection(bool is_enabled,
Core::HID::NpadIdType npad_id,
ClientAppletResourceUserId aruid) {
LOG_DEBUG(Service_HID, "called, is_enabled={}, npad_id={}, applet_resource_user_id={}",
is_enabled, npad_id, aruid.pid);
Result IHidServer::EnableUnintendedHomeButtonInputProtection(bool is_enabled, Core::HID::NpadIdType npad_id, ClientAppletResourceUserId aruid) {
LOG_DEBUG(Service_HID, "called, is_enabled={}, npad_id={}, applet_resource_user_id={}",is_enabled, npad_id, aruid.pid);
R_UNLESS(IsNpadIdValid(npad_id), ResultInvalidNpadId);
R_RETURN(GetResourceManager()->GetNpad()->EnableUnintendedHomeButtonInputProtection(
aruid.pid, npad_id, is_enabled));
R_RETURN(GetResourceManager()->GetNpad()->EnableUnintendedHomeButtonInputProtection(aruid.pid, npad_id, is_enabled));
}
Result IHidServer::SetNpadJoyAssignmentModeSingleWithDestination(
Out<bool> out_is_reassigned, Out<Core::HID::NpadIdType> out_new_npad_id,
Core::HID::NpadIdType npad_id, ClientAppletResourceUserId aruid,
NpadJoyDeviceType npad_joy_device_type) {
LOG_INFO(Service_HID, "called, npad_id={}, applet_resource_user_id={}, npad_joy_device_type={}",
npad_id, aruid.pid, npad_joy_device_type);
*out_is_reassigned = GetResourceManager()->GetNpad()->SetNpadMode(
aruid.pid, *out_new_npad_id, npad_id, npad_joy_device_type, NpadJoyAssignmentMode::Single);
Result IHidServer::SetNpadJoyAssignmentModeSingleWithDestination(Out<bool> out_is_reassigned, Out<Core::HID::NpadIdType> out_new_npad_id, Core::HID::NpadIdType npad_id, ClientAppletResourceUserId aruid, NpadJoyDeviceType npad_joy_device_type) {
LOG_INFO(Service_HID, "called, npad_id={}, applet_resource_user_id={}, npad_joy_device_type={}", npad_id, aruid.pid, npad_joy_device_type);
*out_is_reassigned = GetResourceManager()->GetNpad()->SetNpadMode(system.Kernel(), aruid.pid, *out_new_npad_id, npad_id, npad_joy_device_type, NpadJoyAssignmentMode::Single);
R_SUCCEED();
}
Result IHidServer::SetNpadAnalogStickUseCenterClamp(bool use_center_clamp,
ClientAppletResourceUserId aruid) {
LOG_INFO(Service_HID, "called, use_center_clamp={}, applet_resource_user_id={}",
use_center_clamp, aruid.pid);
Result IHidServer::SetNpadAnalogStickUseCenterClamp(bool use_center_clamp, ClientAppletResourceUserId aruid) {
LOG_INFO(Service_HID, "called, use_center_clamp={}, applet_resource_user_id={}", use_center_clamp, aruid.pid);
GetResourceManager()->GetNpad()->SetNpadAnalogStickUseCenterClamp(aruid.pid, use_center_clamp);
R_SUCCEED();
}
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
@@ -281,7 +281,7 @@ void IHidSystemServer::ApplyNpadSystemCommonPolicy(HLERequestContext& ctx) {
LOG_INFO(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
GetResourceManager()->GetNpad()->ApplyNpadSystemCommonPolicy(applet_resource_user_id);
GetResourceManager()->GetNpad()->ApplyNpadSystemCommonPolicy(system.Kernel(), applet_resource_user_id);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
@@ -328,7 +328,7 @@ void IHidSystemServer::ApplyNpadSystemCommonPolicyFull(HLERequestContext& ctx) {
LOG_INFO(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
GetResourceManager()->GetNpad()->ApplyNpadSystemCommonPolicyFull(applet_resource_user_id);
GetResourceManager()->GetNpad()->ApplyNpadSystemCommonPolicyFull(system.Kernel(), applet_resource_user_id);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
@@ -358,9 +358,8 @@ void IHidSystemServer::GetMaskedSupportedNpadStyleSet(HLERequestContext& ctx) {
LOG_INFO(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
Core::HID::NpadStyleSet supported_styleset{};
const auto& npad = GetResourceManager()->GetNpad();
const Result result =
npad->GetMaskedSupportedNpadStyleSet(applet_resource_user_id, supported_styleset);
const auto npad = GetResourceManager()->GetNpad();
const Result result = npad->GetMaskedSupportedNpadStyleSet(system.Kernel(), applet_resource_user_id, supported_styleset);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(result);
@@ -373,9 +372,8 @@ void IHidSystemServer::SetSupportedNpadStyleSetAll(HLERequestContext& ctx) {
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
const auto& npad = GetResourceManager()->GetNpad();
const auto result =
npad->SetSupportedNpadStyleSet(applet_resource_user_id, Core::HID::NpadStyleSet::All);
const auto npad = GetResourceManager()->GetNpad();
const auto result = npad->SetSupportedNpadStyleSet(system.Kernel(), applet_resource_user_id, Core::HID::NpadStyleSet::All);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(result);