Fix HITMAN 3 boot, layered presentation, and socket imports #851
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!851
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/851/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Pcniado on GitHub · 2026-09-26 13:26 UTC · original
Pcniado:fix/ppsa16388-boot→main· +959 −285 · 21 files · 5 commits · merged 2026-09-26 22:13 UTCGets Hitman WOA in game
https://github.com/user-attachments/assets/317db928-16ff-4153-b451-1e28e863def0
This pull request introduces significant improvements to the GPU video output and presentation pipeline, focusing on robust handling of overlay planes, enhanced error checking, and expanded support for flip modes. The changes add support for overlay rendering, improve how unmapped GPU buffers are handled, and extend the set of valid flip modes. Additionally, the code now gracefully handles edge cases that previously resulted in program termination.
The most important changes are:
Overlay Plane and Presentation Enhancements:
gpu_blit_texture_overlay.frag, its integration into the build system, and updates to thePresenterand swapchain code to manage overlay frames and image views. (CMakeLists.txt,src/graphics/host_gpu/shaders/gpu_blit_texture_overlay.frag,src/graphics/presentation/presenter.h,src/graphics/presentation/window/swapchain.cpp) [1] [2] [3] [4] [5] [6] [7]Error Handling and Buffer Management:
src/graphics/host_gpu/renderer/pipeline/descriptors.cpp,src/graphics/host_gpu/renderer/renderDraw.cpp) [1] [2] [3]Flip Mode and Video Output Robustness:
src/graphics/presentation/videoOut.cpp) [1] [2] [3] [4] [5]src/graphics/presentation/videoOut.cpp) [1] [2] [3] [4] [5] [6] [7]Debuggability:
src/graphics/host_gpu/renderer/sync.cpp)These changes collectively make the video output pipeline more robust, extensible, and maintainable, especially in handling overlays and error conditions.
ai assisted, however code reviewed and tested by me
@Copilot on GitHub · 2026-09-26 13:31 UTC · original
On
src/graphics/presentation/videoOut.cppline 1167 (outdated):The new selection can process a ready request that is not at the front (for example, a main request behind an overlay request), but
Cancelonly waits when the front request belongs to the closing config. Closing that main handle can therefore erase or encounter itsPresentingrequest whileFlipis using it, leading to the existing fatal checks or a frame being presented after close. Cancellation and processing need to track/wait for the selected non-front request(s), not just the queue front.@Copilot on GitHub · 2026-09-26 13:31 UTC · original
On
src/graphics/presentation/window/swapchain.cppline 530 (outdated):This destroys the overlay pipeline before waiting for the graphics queue to become idle. A submitted presentation command may still reference
m_overlay_pipeline(and its layout, shaders, sampler, or descriptor layout), so swapchain recreation can destroy Vulkan objects while they are in flight; move this cleanup afterqueue.waitIdle().@copilot-pull-request-reviewer[bot] on GitHub · 2026-09-26 13:31 UTC · original · reviewed
Copilot review overview
🟡 Changes recommended
Unresolved critical and moderate issues remain in the swapchain, video-output, and networking paths.
Review effort: Lite
· 1 
Findings: 3
Open (4)
What changed in this PR
Improves HITMAN 3 boot compatibility with GPU overlay presentation, expanded flip handling, safer buffer management, and networking/API additions.
Changes:
src/libs/network.hsrc/libs/network.cppsrc/libs/libVideoOut.cppsrc/libs/libNet.cppsrc/libs/libKernel.cppgetpeername.src/kernel/memory.hsrc/kernel/memory.cppsrc/graphics/shader/recompiler/frontend/decode/VectorAluOps.cppsrc/graphics/presentation/window/window.cppsrc/graphics/presentation/window/swapchain.cppsrc/graphics/presentation/videoOut.cppsrc/graphics/presentation/presenter.hsrc/graphics/host_gpu/shaders/gpu_blit_texture_overlay.fragsrc/graphics/host_gpu/renderer/sync.cppsrc/graphics/host_gpu/renderer/renderDraw.cppsrc/graphics/host_gpu/renderer/pipeline/descriptors.cppCMakeLists.txt💡 Add a
code-reviewagent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.@Copilot on GitHub · 2026-09-26 13:31 UTC · original
On
src/graphics/presentation/window/swapchain.cppline 1086 (outdated):The overlay frame is submitted in the same presentation command as
frame, but onlyframe.present_tickis updated. Releasing the overlay with its old tick lets the frame pool reacquire and overwrite its image before the presentation command has finished sampling it; copy the submission tick tooverlay->present_tickbefore releasing it (and do the same in the drop path below).@Copilot on GitHub · 2026-09-26 13:31 UTC · original
On
src/libs/network.cppline 2017 (outdated):When the descriptor is invalid,
GetSocketBackendhas already setPOSIX_EBADF, but this branch overwrites it withPOSIX_ENOTCONN. That makesgetpeernamereport the wrong errno for bad descriptors; preserve the error set byGetSocketBackendasGetsocknamedoes.@coderabbitai[bot] on GitHub · 2026-09-26 13:32 UTC · original · edited 2026-09-26 22:24 UTC
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
📝 Walkthrough
Walkthrough
The changes add optional overlay rendering and port-aware video flip scheduling. GPU buffer handling now reports unmapped spans and uses empty or null buffers for unavailable ranges. Networking exports add peer-address lookup, connect, send, and receive wrappers. The VideoOut library registers two handlers. Gamepad event handling adds failure checks, and vector ALU decoding gains additional opcode rules.
Suggested reviewers:
nmzikPriority: ➖ Normal
Change: Bug fix
Merge Risk: 🟠 High · up to
f4d8dThe new overlay presentation can corrupt displayed frames or cause GPU device loss. It can also replace the main game image with overlay content. Unplugging a controller that failed to open can crash the emulator. The new networking APIs report incorrect errors. These should be fixed before merging.
Security Architecture Review
Security architecture risk: 🟡 Moderate · up to
f4d8dMulti-port presentation introduces a cancellation race that can terminate the application or update a port after it closes. The apparent impact is confined to the application process, but guest-controlled timing makes the failure material.
Retained concerns
Security review details
Security Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring Coverage
Explanation
Docstring coverage is 1.96% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 51 functions across 15 files. (2 skipped: 2 unsupported.)
Comment
@coderabbitai helpto get the list of available commands.@coderabbitai[bot] on GitHub · 2026-09-26 13:32 UTC · original
On
src/graphics/presentation/videoOut.cppline 1179 (outdated):🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Do not promote a non-main request to the main presentation frame.
When no main-handle request is queued, Line 1177 moves the ready overlay or sub-port request into
main_it.Presenter::Presentthen blits that frame opaquely over the whole swapchain and ignores its alpha. It also stores the frame asm_last_frame, so paused and system-overlay refreshes show it again.This happens whenever an overlay port flips on a vblank where the main port has no queued flip. The trigger is common, because the ports flip independently. The displayed main image is then replaced by overlay content, such as a transparent or black HUD, and the result is flicker or a wrong frame.
Present an overlay-only request over the last main frame instead. One option is to acquire
PrepareLastFrame()as the source. Another option is to complete the overlay request without replacing the source frame.@coderabbitai[bot] on GitHub · 2026-09-26 13:32 UTC · original
On
src/graphics/presentation/window/swapchain.cppline 1086 (outdated):🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win
Set
overlay->present_tickbefore the overlay frame is released.On Line 1072,
Presenter::Presentsetsframe.present_tickfromswapchain.Submit. It does not updateoverlay->present_tick. The present command buffer samplesoverlay->sample_view. The overlay frame is then released back toFramePool.FramePool::AcquirecallsWaitForFrame, which waits only on the storedpresent_tick. For the overlay frame, that value is stale. As a result, a laterPrepareFrameorPrepareBlankFramecan runCopyFromorClearon the overlay image while the present submission still reads it.Configurecan also callDeleteImageand destroysample_viewwhile they are still in use. The result is a data race on the GPU, which can corrupt the overlay or cause device loss.Proposed fix
@coderabbitai[bot] on GitHub · 2026-09-26 13:32 UTC · original
On
src/graphics/presentation/window/window.cppline 315 (outdated):🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Keep failed gamepad opens out of the fatal removal path.
If
SDL_OpenGamepadorSDL_GetGamepadJoystickfails, this handler returns without callingController::Connect. A later removal event still callsController::Disconnect(f.id). That function callsEXIT_IFwhen the ID was never registered, so removing this gamepad can terminate the application. Make removal of an unregistered ID safe, while preserving cleanup of any opened gamepad. The null check aroundSDL_CloseGamepaddoes not protect the disconnect call. (wiki.libsdl.org)Also applies to: 322-322
@coderabbitai[bot] on GitHub · 2026-09-26 13:32 UTC · original
On
src/graphics/shader/recompiler/frontend/decode/VectorAluOps.cppline 1409 (outdated):🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Reject or implement cube
clampandomodbefore accepting them.When
op_selis zero, this branch accepts nonzeroclamporomod.DecodeVop3then clears both fields because the cube opcodes are not listed inSupportsNativeVop3ClamporSupportsNativeVop3ResultModifiers. The decoded instruction loses its output modifiers. AMDGPU GFX10/GFX11 instruction syntax listsclampandomodfor these cube opcodes. (rocmdocs.amd.com)Reject those fields here until the decoder and translation path support them.
@coderabbitai[bot] on GitHub · 2026-09-26 13:32 UTC · original
On
src/libs/libNet.cppline 178 (outdated):🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Use the Net error contract for failed sends and receives.
If
Net::SendorNet::Recvfails, these wrappers return the POSIX-1and store a negativeNET_ERROR_*code ing_net_errno.FinishSocketCallinstead returns the Net error code and stores a positive Net error number. Apply that conversion on failure while preserving theint64_tbyte count on success.Also applies to: 183-186
@coderabbitai[bot] on GitHub · 2026-09-26 13:32 UTC · original
On
src/libs/network.cppline 2016 (outdated):🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Preserve the socket lookup error.
If
sis invalid or closed,GetSocketBackendsetsPOSIX_EBADF. This branch replaces that error withPOSIX_ENOTCONN, so the new POSIX export reports a connection-state error for a bad descriptor. Return-1without changing the error, asGetsocknamedoes.@coderabbitai[bot] on GitHub · 2026-09-26 13:32 UTC · original
On
src/libs/network.cppline 2025 (outdated):🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Map an unconnected socket to
POSIX_ENOTCONNon non-Windows hosts.If host
getpeernamefails withENOTCONN,SetHostSocketErrorcallsConvertHostSocketError. Its non-Windows branch has noENOTCONNcase, so this new API reportsPOSIX_EIOinstead. Add that mapping before returning the host error to the guest.@coderabbitai[bot] on GitHub · 2026-09-26 13:32 UTC · original · reviewed
Actionable comments posted: 7
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
7a1b74e1-2e16-402a-9833-9f71b2f3cf51📥 Commits
Reviewing files that changed from the base of the PR and between
16b83a034cand f4d8d633d55ed9592937b88a78a8673f43df6b03.📒 Files selected for processing (17)
CMakeLists.txtsrc/graphics/host_gpu/renderer/pipeline/descriptors.cppsrc/graphics/host_gpu/renderer/renderDraw.cppsrc/graphics/host_gpu/renderer/sync.cppsrc/graphics/host_gpu/shaders/gpu_blit_texture_overlay.fragsrc/graphics/presentation/presenter.hsrc/graphics/presentation/videoOut.cppsrc/graphics/presentation/window/swapchain.cppsrc/graphics/presentation/window/window.cppsrc/graphics/shader/recompiler/frontend/decode/VectorAluOps.cppsrc/kernel/memory.cppsrc/kernel/memory.hsrc/libs/libKernel.cppsrc/libs/libNet.cppsrc/libs/libVideoOut.cppsrc/libs/network.cppsrc/libs/network.hIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.