From c1a592703617fd10c10fd6a97f7e9d56423a0512 Mon Sep 17 00:00:00 2001 From: Claxten Date: Wed, 29 Jul 2026 17:13:38 +0200 Subject: [PATCH] graphics: pm4: accept trailing PM4 type-2 packets * A one-dword type-2 NOP is a valid packet tail. Parse it normally instead of aborting command-buffer dumps. Signed-off-by: Claxten --- src/graphics/guest_gpu/pm4.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/graphics/guest_gpu/pm4.cpp b/src/graphics/guest_gpu/pm4.cpp index 854e88e7a..8167b2623 100644 --- a/src/graphics/guest_gpu/pm4.cpp +++ b/src/graphics/guest_gpu/pm4.cpp @@ -110,7 +110,6 @@ void DumpPm4PacketStream(Common::File* file, uint32_t* cmd_buffer, uint32_t star auto* cmd = cmd_buffer + start_dw; auto dw = num_dw; while (dw != 0) { - EXIT_NOT_IMPLEMENTED(dw < 2); EXIT_NOT_IMPLEMENTED(dw > num_dw); auto cmd_id = *cmd++; @@ -120,6 +119,9 @@ void DumpPm4PacketStream(Common::File* file, uint32_t* cmd_buffer, uint32_t star uint32_t len = 0; const auto packet_type = static_cast(cmd_id >> 30u); + // Type-2 packets are header-only padding; every other packet type requires a body. + EXIT_NOT_IMPLEMENTED(dw < 2 && packet_type != PacketType::Type2); + switch (packet_type) { case PacketType::Type3: { const bool sh_gx = (cmd_id & 0x2u) == 0;