Skip to content

Conversation

@X-rays5
Copy link
Owner

@X-rays5 X-rays5 commented Dec 19, 2025

This pull request introduces several improvements and refactorings across the codebase, focusing on enhanced exception recovery, thread safety, modernization of synchronization primitives, and better process/module handling. Major changes include the addition of a wide-to-ANSI string conversion utility, a robust vectored exception handler with recovery logic, significant concurrency and synchronization improvements, and updates to process/module identification logic.

Exception Handling and Recovery:

  • Implemented advanced vectored exception handler recovery logic using Zydis for instruction decoding, enabling the system to attempt to skip over fatal exceptions by advancing the instruction pointer. Added logic to ensure recovery is only attempted for exceptions occurring within the current module, and to limit recovery attempts to prevent infinite loops. (common/src/logging/exception/vectored_handler.cpp, common/src/win32/memory.cpp, common/src/win32/memory.hpp) [1] [2] [3] [4]

String Conversion and Logging:

  • Added a new CW2A utility class for converting wide strings to ANSI, replacing the previous ATL dependency. Updated logging formatter to use this new utility for thread descriptions. (common/src/conversion/cw2a.hpp, common/src/conversion/cw2a.cpp, common/CMakeLists.txt, common/src/logging/formatter/thread_id.hpp) [1] [2] [3] [4] [5]

Concurrency and Synchronization:

  • Improved Spinlock and RecursiveSpinlock for better thread safety and performance, including atomic lock count and exponential backoff. (common/src/concurrency/spinlock.cpp, common/src/concurrency/spinlock.hpp) [1] [2] [3]
  • Modernized the Signal synchronization primitive by replacing Windows events with std::binary_semaphore, simplifying the implementation and improving portability. (common/src/win32/signal.hpp)

Process and Module Identification:

  • Refactored process identification to support multiple target process names and improved module address handling by making function signatures more type-safe and consistent. Added a constant for an additional process name and updated logic to check against both. (common/src/globals.hpp, common/src/win32/misc.cpp, common/src/win32/misc.hpp) [1] [2] [3]
  • Improved module address and offset calculations by using reinterpret_cast for pointer arithmetic and making function parameters const where appropriate. (common/src/win32/memory.cpp) [1] [2] [3] [4]

Minor Improvements and Cleanups:

  • Enhanced exception reporting with additional stack dump information and improved const-correctness in several places. (common/src/logging/exception/exception_report.cpp) [1] [2] [3]

These changes collectively improve reliability, maintainability, and performance of the codebase, especially in exception handling and thread synchronization.

@X-rays5 X-rays5 added this to the 2.0 rewrite milestone Dec 19, 2025
@X-rays5 X-rays5 self-assigned this Dec 19, 2025
Copilot AI review requested due to automatic review settings December 19, 2025 10:24
@github-actions
Copy link

github-actions bot commented Dec 19, 2025

Test Results

42 tests  ±0   42 ✅ ±0   28s ⏱️ +2s
 1 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit d729273. ± Comparison against base commit 839ad34.

♻️ This comment has been updated with latest results.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR performs a comprehensive migration from DirectX 11 to DirectX 12 rendering backend, alongside significant improvements to exception handling, concurrency primitives, and process identification. The changes modernize the codebase with better thread safety, resource management, and error recovery capabilities.

Key Changes:

  • Complete migration from D3D11 to D3D12 rendering pipeline with new context management and descriptor heap allocation
  • Advanced vectored exception handler with instruction-level recovery using Zydis disassembler
  • Enhanced concurrency with improved spinlock implementation and modernized Signal class using std::binary_semaphore

Reviewed changes

Copilot reviewed 39 out of 41 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
vendor/imgui.cmake Switched from D3D11 to D3D12 backend
vendor/discord-rpc.cmake Pinned discord-rpc to specific commit, removed RapidJSON test flag
menu/src/ui/notification/manager.hpp Added null check to ADD_NOTIFICATION macro
menu/src/render/thread.cpp Added likely/unlikely attributes and optimized callback handling
menu/src/render/renderer.hpp Removed D3D11 COM objects, added D3D12 context
menu/src/render/renderer.cpp Complete rewrite for D3D12 initialization and frame rendering
menu/src/render/draw_util.cpp Improved word wrapping with vector-based memory management
menu/src/render/draw_commands.hpp Updated Image class for D3D12 descriptor handles
menu/src/render/draw.hpp Made read_signal_ mutable
menu/src/render/d3d12/heap/descriptor_heap_allocator.hpp New descriptor heap allocator for D3D12 resources
menu/src/render/d3d12/heap/descriptor_heap_allocator.cpp Implementation of thread-safe descriptor allocation
menu/src/render/d3d12/context.hpp New D3D12 context class managing device, command objects, and frames
menu/src/render/d3d12/context.cpp Complete D3D12 context implementation with synchronization
menu/src/render/animate.hpp Added IsComplete/Reset methods and improved const-correctness
menu/src/memory/signature/pattern.cpp Improved C-style cast to static_cast
menu/src/memory/signature/cached_batch.hpp Removed cached batch scanning feature
menu/src/memory/signature/cached_batch.cpp Removed cached batch scanning implementation
menu/src/memory/pointers.hpp Updated to use IDXGISwapChain3 and added command queue pointer
menu/src/memory/pointers.cpp Simplified pattern scanning, removed resolution/version patterns
menu/src/main.cpp Reordered initialization and improved const-correctness
menu/src/logging/plh_logger.hpp Changed PLH INFO logs to DEBUG level
menu/src/hooking/wndproc.hpp Refactored to use DetourHook instead of SetWindowLongPtr
menu/src/hooking/wndproc.cpp Complete rewrite using PolyHook detours
menu/src/hooking/hooking.hpp Added destructor
menu/src/hooking/hooking.cpp Added destructor implementation and improved const-correctness
menu/src/hooking/helpers/vmt.hpp Improved const-correctness
menu/src/hooking/helpers/detour.hpp Changed void* to auto for og variable
menu/src/dllmain.cpp Updated to use IsGameProcess instead of IsTargetProcess
menu/src/discord/rich_presence.hpp Added last_tick_time_ member
menu/src/discord/rich_presence.cpp Added tick throttling and ready handler
menu/CMakeLists.txt Removed cached_batch files, added D3D12 context files
common/src/win32/signal.hpp Modernized from Windows events to std::binary_semaphore
common/src/win32/misc.hpp Renamed IsTargetProcess to IsGameProcess
common/src/win32/misc.cpp Added support for multiple process names with static optimization
common/src/win32/memory.hpp Added IsAddressInCurrentModule function
common/src/win32/memory.cpp Added IsAddressInCurrentModule implementation and improved const-correctness
common/src/logging/exception/vectored_handler.cpp Added instruction-level exception recovery with Zydis
common/src/logging/exception/exception_report.cpp Moved stack dump earlier in report
common/src/globals.hpp Updated target window class and added Enhanced process names
common/src/concurrency/spinlock.hpp Made lock_count_ atomic
common/src/concurrency/spinlock.cpp Added exponential backoff and improved memory ordering

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

X-rays5 and others added 3 commits December 19, 2025 11:45
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@X-rays5 X-rays5 enabled auto-merge (squash) December 19, 2025 10:46
@sonarqubecloud
Copy link

@X-rays5 X-rays5 merged commit fe760ce into master Dec 19, 2025
7 checks passed
@X-rays5 X-rays5 deleted the enhanced-migration branch December 19, 2025 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants