lifecycle: subclass the title window in its own character set (LIFECYCLE-ANSI-SUBCLASS) #2344
Closed
syfyra wants to merge 1 commit from
upstream-pr/2344 into main
pull from: upstream-pr/2344
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
ProjectLeonida/mandy!2344
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2344"
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?
Imported from ubiquitarianism/leonida. Originally posted by syfyra on 2026-11-26T14:18:23Z.
Claimed in the coordination issue as: LIFECYCLE-ANSI-SUBCLASS
What and why
runtime/shims/lifecycle.cppsubclasses the title's first top-level window soSC_CLOSEruns the suspend callbacks. It always did so withGetWindowLongPtrW/SetWindowLongPtrW. The retail title creates its window withCreateWindowExA(its import table names it from the-ansi-window set), which makes an ANSI window when the class was registered with the A function too; the title's class registration is not recorded indocs/, so whether the retail window is ANSI is not measured here. Setting a W procedure on an ANSI window turns it into a Unicode window:IsWindowUnicodebecomesTRUE, and every text message the title posts and dispatches with the A functions is converted to Unicode for the hook.CallWindowProcWthen converts it back for the title's ANSI procedure.With a single-byte code page the round trip is lossless. With UTF-8 as the ANSI code page it is not. That is the code page of Windows' "Beta: Use Unicode UTF-8 for worldwide language support" option, or of a process whose manifest asks for it. Measured on Windows 11 with a small probe, an ANSI window with
PostMessageA(WM_CHAR, byte)for each byte of "é€" (C3 A9 E2 82 AC), thenDispatchMessageA:c3 a9 e2 82 acSetWindowLongPtrW(main)83 c3 a9 c2 a2 c3 80 e2 ac c2SetWindowLongPtrA(this change)c3 a9 e2 82 acWith code page 1252 all three receive the bytes unchanged. Only
IsWindowUnicodediffers there.The hook now reads and sets the window procedure in the window's own character set (
IsWindowUnicode), with an A and a W variant of the procedure that call the title's withCallWindowProcA/CallWindowProcWand fall back toDefWindowProcA/DefWindowProcW. A Unicode window is hooked as before.Tested
Windows 11, MSVC 14.44 (Build Tools), RelWithDebInfo:
lifecycle_testgets a section 5. An ANSI class's window is created through theCreateWindowExAshim, and the test checks that it is hooked, that it stays an ANSI window, that the fiveWM_CHARcodes reach its procedure unchanged and in order, and thatWM_SETTEXT/WM_GETTEXTstill forward. A further check confirms a Unicode title window stays Unicode.main: 1 of 35 checks fails (the window becomes Unicode).lifecycle_utf8_test(MSVC only): the same source withtest/utf8_codepage.manifestembedded (activeCodePageUTF-8), plus a check thatGetACP()is 65001.main: 2 of 36 checks fail; the title's procedure receives83 c3 a9 c2 a2 c3 80 e2 ac c2.ctest -j 8over the 170 CPU tests (no Vulkan SDK here): all pass.runtime/CMakeLists.txt,runtime/shims/lifecycle.cpporruntime/test/lifecycle_test.cpp, including #2054.scripts/check_no_game_data.pyon the four files.Not tested under Wine, where the manifest test may need Wine's own
activeCodePagesupport.GPUs tested: n/a (CPU tests)
AI-assisted: yes (Claude Code, Claude Opus 5.5)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T15:37:24Z.
Review: COMMENTED
Built
lifecycle_testwith MSVC on Windows 11. The CTest run passed and exercised both ANSI and Unicode windows. The hooked ANSI window stayed ANSI, received the original WM_CHAR values in order and forwarded WM_SETTEXT/WM_GETTEXT. No findings.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-30T11:10:25Z.
Independent verification on this machine (Windows 11, MSVC 19.44.35226): the test this branch adds is registered with no command, so
ctestreports it as "Not Run" - and it turns a two-test target into a red one.1. It applies and builds.
merge-treeclean ontomaind367675c7;lifecycle_testlinks ([3/3] Linking CXX executable lifecycle_test.exe, built at 12:09:30 during this run - the binary is not stale).2. Running the target's two tests:
3. Why, from
ctest --show-only=json-v1:lifecycle_utf8is the test this pull request adds, and itscommandis empty, so CTest has a test with nothing to run.lifecycle- the pre-existing one - resolves normally and passes.4. This is the fourth pull request in the queue with the same defect, and
mainhas none of them in its 546 tests:vk_sparse_queue_orderwin32_env,win32_env_overrided3d12_skip_compute_{unset,one,all}lifecycle_utf8The cost in each case is the same and double: the test never runs, and
ctestcountsNot Runas a failure - so the branch turns the suite red while testing nothing.The likely fix, and it is one line:
add_test(NAME lifecycle_utf8 COMMAND lifecycle_test …)resolves only iflifecycle_testis visible in the same directory scope at that point;$<TARGET_FILE:lifecycle_test>always resolves, and so does moving theadd_testnext to itsadd_executable.What I did not test: whether the UTF-8 case itself passes once it runs - that needs the registration fixed first, and I did not add it locally to find out, because the fix belongs to the author.
Why I am commenting: I verify open pull requests that replay onto current
main, build the binaries their tests name, and run them. ANot Runis the one result that looks like a failure and is really an unfinished registration.Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-30T11:11:24Z.
Follow-up with the extra evidence, because the cause is not what I first implied: the target exists, builds, and the registration is shaped exactly like its working sibling.
So
$<TARGET_FILE:…>would fix the symptom, and so would whatever makes the sibling work - but the sibling is not different in the way I assumed. Here is the whole structural difference, side by side:The only difference I can find is that
lifecycle_utf8_testis created insideif(MSVC)while itsadd_testsits outside that block. Both guards pass on this machine (MSVC 19.44.35226), the target exists and links, and the manifest it references (test/utf8_codepage.manifest) is present.I am not going to assert that the
if(MSVC)is the cause - I could not reproduce a minimal case for it, and CMake's target scoping inadd_testis not something I want to guess about. What is proven: target builds, file exists, guard passes, and CTest still has the test with no command. What would settle it in one edit: move theadd_test(NAME lifecycle_utf8 …)inside theif(MSVC)block, or use$<TARGET_FILE:lifecycle_utf8_test>; either change is one line and the author can test both.Why this matters beyond this pull request: four pull requests in the queue have a test with an empty command (#1182, #1242, #1419, #2344) and
mainhas none. If theif()placement is the shared cause, one contiguous edit fixes all four - and if it is not, knowing that saves the next person from trying it.Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-30T11:12:09Z.
I tested both fixes on this machine, and both make the command resolve. Here are the results, so the author does not have to run the experiment.
Baseline (the branch as it is):
Variant 1 - generator expression, nothing moved:
Variant 2 - move the
add_testinside the block that creates the executable:So the cause is the placement relative to the conditional: the same
add_testline, with the same target name, resolves once it is inside the block that created the target, and does not resolve when it is 1400 lines below it and outside that block. Variant 2 is the more informative of the two: it shows the target name alone is enough when the registration sits in the same scope, which is what I could not establish by reading.What I did not do: decide which variant the author should take. Variant 1 is the smaller diff and cannot be affected by scope at all; variant 2 keeps the file's existing style (every other test registers where its executable is defined, as far as the blocks I looked at).
And the part that may help the other three: #1182, #1242 and #1419 have the same symptom - a test with an empty command,
mainhas none. If theiradd_testlines are also separated from theiradd_executableby a conditional, one contiguous edit fixes all four. I have not checked those three blocks, so treat that as the next thing to look at rather than a conclusion.How this was measured: applied the branch to
maind367675c7, made one edit, re-rancmake -S runtime -B …, readctest --show-only=json-v1, reverted the edit. Nothing was pushed - both edits were local to a scratch worktree.Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-30T11:17:49Z.
Correction, and it retracts the defect:
lifecycle_utf8is not registered with an empty command. The empty command came from reading the manifest before building that executable.The mechanism, measured here:
add_test(NAME lifecycle_utf8 COMMAND lifecycle_utf8_test)writes the target name into the test file; CTest substitutes the executable's path only once that executable exists. When I read the manifest I had builtlifecycle_test(because I was chasing the sibling) and notlifecycle_utf8_test- which is exactly why one resolved and the other did not.And my two "fixes" were not fixes:
$<TARGET_FILE:…>resolves at configure time into a literal path, so it bypasses the build state; moving theadd_testinsideif(MSVC)changed which configure I compared against, not the cause. Both made the empty value go away without touching anything real - which should have made me suspicious, and did not.So the whole "empty command" family was mine: four pull requests (#1182, #1242, #1419, #2344) reported with a defect none of them has. Two were withdrawn earlier today for a stale manifest; the other two are withdrawn now.
What the correct method is, and it is embarrassingly simple: build the test's target first, then read the manifest.
What still stands for this pull request: it applies to
maind367675c7,lifecycle_testandlifecycle_utf8_testboth build, and with both built the tests resolve - I will re-run the pair and report the result rather than the registration.Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-30T11:20:08Z.
After withdrawing my registration claim, here is the verification that one was standing in for: the change is covered by its own tests, and the control bites on both.
1. It applies and builds.
merge-treeclean ontomaind367675c7. Two executables built for this run:2. With the branch, both tests pass:
lifecycle_utf8runs - the "Not Run" I reported earlier was the manifest read before this binary existed, and I have retracted it above.3. The control - revert only the shim, keep both tests, rebuild both:
Both executables fail, with the same sentence, and that sentence is the change: a window the title hooked as ANSI must stay an ANSI window - the branch's subclassing keeps that property,
main's lets it flip. The fact that the identical assertion fails in both the ANSI and the UTF-8 process is the point of the second executable: the same code path, a different active code page.What I did not test: the other lifecycle paths the shim covers (
RegisterAppStateChangeNotification, oversized-window fitting), and the GPU-side title behaviour.Summary for this pull request, after the retraction:
maind367675c7Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:30:46Z.
Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review.
(AI-assisted triage.)
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:44:05Z.
Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (
d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools,d3d12/, or general docs), please feel free to reopen it.Pull request closed