From be9435e691073e7d1ce3bc4880dd16ea00fac37e Mon Sep 17 00:00:00 2001 From: Takoroka <137927095+Takoroka@users.noreply.github.com> Date: Tue, 27 Oct 2026 14:13:03 -0400 Subject: [PATCH] service: correct TIPC data replies; vi2 timestamp recorder count ResponseBuilder::Push(Result) writes the CMIF two-word result, so TIPC data pushed after it landed one word late and outside the copied size; clients read zeros. TipcReplyWords writes the one-word TIPC result and the data. vi2 TIPC 5 returns 7 (LayerHistory needs 7 recorders). With this the title creates its layer and goes on to hid/acc/aoc and RomFS asset loading. --- src/core/hle/service/nx2_gsv.h | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/core/hle/service/nx2_gsv.h b/src/core/hle/service/nx2_gsv.h index 44b5bdc673..9faa262624 100644 --- a/src/core/hle/service/nx2_gsv.h +++ b/src/core/hle/service/nx2_gsv.h @@ -4,6 +4,7 @@ #pragma once #include +#include #include #include "core/core.h" @@ -45,6 +46,17 @@ inline Kernel::KClientSession* CreateRawSession(Core::System& system, HLERequest return &session->GetClientSession(); } +// Replies to a TIPC request with success and raw u32 data words. ResponseBuilder::Push(Result) +// writes the CMIF two-word result, which shifts TIPC data one word past where the client reads +// it (and past the copied size); TIPC has a one-word result followed directly by the data. +inline void TipcReplyWords(HLERequestContext& ctx, std::initializer_list words) { + IPC::ResponseBuilder rb{ctx, static_cast(2 + words.size())}; + rb.PushRaw(ResultSuccess.raw); + for (const u32 w : words) { + rb.Push(w); + } +} + // Replies with success and a copied handle to a new session served by `iface`. template inline void ReturnRawSession(Core::System& system, HLERequestContext& ctx, std::shared_ptr iface) { @@ -75,9 +87,7 @@ public: private: void GetCount(HLERequestContext& ctx) { LOG_WARNING(Service, "(STUBBED) nx2:syncpt TIPC 1, returning 32"); - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.Push(32); + TipcReplyWords(ctx, {32}); } }; @@ -121,10 +131,7 @@ private: void GetIdRange(HLERequestContext& ctx) { LOG_WARNING(Service, "(STUBBED) nx2:gpu TIPC 11, returning [0, {}]", NumIds - 1); - IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(ResultSuccess); - rb.Push(0); - rb.Push(NumIds - 1); + TipcReplyWords(ctx, {0, NumIds - 1}); } void GetIdEvent(HLERequestContext& ctx) { @@ -165,6 +172,7 @@ public: RegisterHandlersTipc({ {1, &INx2Vi2Session::ReturnOne, "Unknown1"}, {3, &INx2Vi2Session::ReturnOne, "GetDisplayCount (guessed)"}, + {5, &INx2Vi2Session::GetTimestampRecorderCount, "GetTimestampRecorderCount (guessed)"}, {11, &INx2Vi2Session::ReturnEvent, "Unknown11"}, {31, &INx2Vi2Session::ReturnEvent, "Unknown31"}, {32, &INx2Vi2Session::ReturnEvent, "Unknown32"}, @@ -180,9 +188,13 @@ public: private: void ReturnOne(HLERequestContext& ctx) { LOG_WARNING(Service, "(STUBBED) nx2:vi2 TIPC {}, returning 1", ctx.GetCommand()); - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.Push(1); + TipcReplyWords(ctx, {1}); + } + + // Must be < 8; nn::vi::detail::LayerHistory creates 7 timestamp recorders per layer. + void GetTimestampRecorderCount(HLERequestContext& ctx) { + LOG_WARNING(Service, "(STUBBED) nx2:vi2 TIPC 5, returning 7"); + TipcReplyWords(ctx, {7}); } void ReturnEvent(HLERequestContext& ctx) {