mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-10 03:18:55 +02:00
[hle] fetch manager once in cmif wrapper (#3796)
shouldn't need to fetch twice or thrice per response :) Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3796 Reviewed-by: Maufeat <sahyno1996@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
ee2891c55e
commit
c3afd2fabd
2 changed files with 22 additions and 22 deletions
|
|
@ -438,20 +438,20 @@ void WriteOutArgument(bool is_domain, CallArguments& args, u8* raw_data, HLERequ
|
||||||
|
|
||||||
template <bool Domain, typename T, typename... A>
|
template <bool Domain, typename T, typename... A>
|
||||||
void CmifReplyWrapImpl(HLERequestContext& ctx, T& t, Result (T::*f)(A...)) {
|
void CmifReplyWrapImpl(HLERequestContext& ctx, T& t, Result (T::*f)(A...)) {
|
||||||
|
const auto mgr = ctx.GetManager().get();
|
||||||
// Verify domain state.
|
// Verify domain state.
|
||||||
if constexpr (!Domain) {
|
if constexpr (!Domain) {
|
||||||
const auto _mgr = ctx.GetManager();
|
const bool is_domain = mgr ? mgr->IsDomain() : false;
|
||||||
const bool _is_domain = _mgr ? _mgr->IsDomain() : false;
|
ASSERT_MSG(!is_domain,
|
||||||
ASSERT_MSG(!_is_domain,
|
"Non-domain reply used on domain session\n"
|
||||||
"Non-domain reply used on domain session\n"
|
"Service={} (TIPC={} CmdType={} Cmd=0x{:08X}\n"
|
||||||
"Service={} (TIPC={} CmdType={} Cmd=0x{:08X}\n"
|
"HasDomainHeader={} DomainHandlers={}\nDesc={}",
|
||||||
"HasDomainHeader={} DomainHandlers={}\nDesc={}",
|
t.GetServiceName(), ctx.IsTipc(),
|
||||||
t.GetServiceName(), ctx.IsTipc(),
|
u32(ctx.GetCommandType()), u32(ctx.GetCommand()),
|
||||||
static_cast<u32>(ctx.GetCommandType()), static_cast<u32>(ctx.GetCommand()),
|
ctx.HasDomainMessageHeader(), mgr ? u32(mgr->DomainHandlerCount()) : 0u,
|
||||||
ctx.HasDomainMessageHeader(), _mgr ? static_cast<u32>(_mgr->DomainHandlerCount()) : 0u,
|
ctx.Description());
|
||||||
ctx.Description());
|
|
||||||
}
|
}
|
||||||
const bool is_domain = Domain ? ctx.GetManager()->IsDomain() : false;
|
const bool is_domain = Domain ? mgr->IsDomain() : false;
|
||||||
|
|
||||||
static_assert(ConstIfReference<A...>(), "Arguments taken by reference must be const");
|
static_assert(ConstIfReference<A...>(), "Arguments taken by reference must be const");
|
||||||
using MethodArguments = std::tuple<std::remove_cvref_t<A>...>;
|
using MethodArguments = std::tuple<std::remove_cvref_t<A>...>;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
|
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
|
@ -78,32 +81,29 @@ public:
|
||||||
memset(cmdbuf, 0, sizeof(u32) * IPC::COMMAND_BUFFER_LENGTH);
|
memset(cmdbuf, 0, sizeof(u32) * IPC::COMMAND_BUFFER_LENGTH);
|
||||||
|
|
||||||
IPC::CommandHeader header{};
|
IPC::CommandHeader header{};
|
||||||
|
auto const mgr = ctx.GetManager().get();
|
||||||
|
|
||||||
// The entire size of the raw data section in u32 units, including the 16 bytes of mandatory
|
// The entire size of the raw data section in u32 units, including the 16 bytes of mandatory
|
||||||
// padding.
|
// padding.
|
||||||
u32 raw_data_size = ctx.write_size =
|
u32 raw_data_size = ctx.write_size = ctx.IsTipc() ? normal_params_size - 1 : normal_params_size;
|
||||||
ctx.IsTipc() ? normal_params_size - 1 : normal_params_size;
|
|
||||||
u32 num_handles_to_move{};
|
u32 num_handles_to_move{};
|
||||||
u32 num_domain_objects{};
|
u32 num_domain_objects{};
|
||||||
const bool always_move_handles{
|
const bool always_move_handles = (u32(flags) & u32(Flags::AlwaysMoveHandles)) != 0;
|
||||||
(static_cast<u32>(flags) & static_cast<u32>(Flags::AlwaysMoveHandles)) != 0};
|
if (!mgr->IsDomain() || always_move_handles) {
|
||||||
if (!ctx.GetManager()->IsDomain() || always_move_handles) {
|
|
||||||
num_handles_to_move = num_objects_to_move;
|
num_handles_to_move = num_objects_to_move;
|
||||||
} else {
|
} else {
|
||||||
num_domain_objects = num_objects_to_move;
|
num_domain_objects = num_objects_to_move;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.GetManager()->IsDomain()) {
|
if (mgr->IsDomain()) {
|
||||||
raw_data_size +=
|
raw_data_size += u32(sizeof(DomainMessageHeader) / sizeof(u32) + num_domain_objects);
|
||||||
static_cast<u32>(sizeof(DomainMessageHeader) / sizeof(u32) + num_domain_objects);
|
|
||||||
ctx.write_size += num_domain_objects;
|
ctx.write_size += num_domain_objects;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.IsTipc()) {
|
if (ctx.IsTipc()) {
|
||||||
header.type.Assign(ctx.GetCommandType());
|
header.type.Assign(ctx.GetCommandType());
|
||||||
} else {
|
} else {
|
||||||
raw_data_size += static_cast<u32>(sizeof(IPC::DataPayloadHeader) / sizeof(u32) + 4 +
|
raw_data_size += u32(sizeof(IPC::DataPayloadHeader) / sizeof(u32) + 4 + normal_params_size);
|
||||||
normal_params_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
header.data_size.Assign(raw_data_size);
|
header.data_size.Assign(raw_data_size);
|
||||||
|
|
@ -126,7 +126,7 @@ public:
|
||||||
if (!ctx.IsTipc()) {
|
if (!ctx.IsTipc()) {
|
||||||
AlignWithPadding();
|
AlignWithPadding();
|
||||||
|
|
||||||
if (ctx.GetManager()->IsDomain() && ctx.HasDomainMessageHeader()) {
|
if (mgr->IsDomain() && ctx.HasDomainMessageHeader()) {
|
||||||
IPC::DomainMessageHeader domain_header{};
|
IPC::DomainMessageHeader domain_header{};
|
||||||
domain_header.num_objects = num_domain_objects;
|
domain_header.num_objects = num_domain_objects;
|
||||||
PushRaw(domain_header);
|
PushRaw(domain_header);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue