Skip to content

fix: harden lock/getdc lifecycle and isolate internal dc path#474

Open
weypro wants to merge 4 commits intoFunkyFr3sh:masterfrom
weypro:master
Open

fix: harden lock/getdc lifecycle and isolate internal dc path#474
weypro wants to merge 4 commits intoFunkyFr3sh:masterfrom
weypro:master

Conversation

@weypro
Copy link

@weypro weypro commented Feb 25, 2026

In the course of researching how to run Red Alert 2 on newer versions of Windows, I came across this project.

During that process, I noticed that the lifecycle management around lock/getdc was not rigorous enough, so I attempted to refactor that part based on my understanding.

These changes still need further review to confirm that they do not introduce new issues or behavioral changes.

In addition, this patch also includes some adjustments related to project conventions and log readability.

These changes do not affect functional logic and can be safely merged.

- split and refine log switches to support category-based output control
- enable detailed logs by default under _DEBUG_X, with per-category opt-out flags
- add scaling disabled/restored logs for child-window cases in D3D9/GDI/OpenGL paths
- add child-window enumeration/tree diagnostics
- validate DDSURFACEDESC/DDSURFACEDESC2 sizes before lock/surface-desc operations
- enforce lock and public dc acquisition states to return busy/not-locked/no-dc errors consistently
- split internal dc access from public GetDC and route blt/debug/render/hack paths through the internal helper
- guard Warcraft/Diablo and Armada unlock hacks on successful internal dc acquisition to avoid invalid dc usage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant