aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakoroka <137927095+Takoroka@users.noreply.github.com>2026-10-31 03:02:21 -0400
committerTakoroka <137927095+Takoroka@users.noreply.github.com>2026-11-01 12:35:48 -0500
commitc26cfaeac4cd86bfcdea2aea82ac6979bcd8144b (patch)
treedcc88b812cb9c2d6f42302295a83d29d6473a601
parent7f31fc4f538e5442e9ae72e3d6f9f65702832b9e (diff)
service: zero the reply of auto-stubbed commands
Switch 2 clients read the reply words they expect without checking the reply size, so an auto stub's result-only reply handed them the request's leftover words as data: Kirby Air Riders took them as an HDR output format, the GPU's CreateGraphicsDevice caller as a device id, and so on for every unimplemented or nullptr command. Reply with 32 zeroed words after the result instead.
-rw-r--r--src/core/hle/service/service.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 1490af0328..38ea936d3c 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -88,8 +88,15 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(HLERequestContext& ctx,
std::string_view{service_name}.starts_with(Nx2StubPrefix) ||
(caller != nullptr && caller->IsSwitch2())) {
LOG_WARNING(Service, "Using auto stub fallback!");
- IPC::ResponseBuilder rb{ctx, 2};
+ // Callers read the reply words they expect without checking how many were written, so an
+ // empty reply hands them the request's leftover words as data (an HDR output format, a
+ // refresh rate, a device id). Reply with zeroed words instead.
+ constexpr u32 ZeroedWords = 32;
+ IPC::ResponseBuilder rb{ctx, 2 + ZeroedWords};
rb.Push(ResultSuccess);
+ for (u32 i = 0; i < ZeroedWords; ++i) {
+ rb.Push<u32>(0);
+ }
}
}