Play Windows games on Apple Silicon Macs. Free, open-source app that installs the official Battle.net, Steam, Epic and GOG launchers and lists your games in one library.
HTML apple-siliconbattle-netcrossover-alternatived3dmetaldiablo-ii-resurrecteddxmtea-appepic-gamesgame-porting-toolkitgogmac-gamingmacosmacos-gamingrockstar-gamessteamubisoft-connectwhisky-alternativewindows-gameswinewine-wrapper
D2R VR: create characters in the headset with the controller; release v1.9.1 (#75)
Mikek373e342e4ee1
diff --git a/README.ko.md b/README.ko.mdindex 5222c289710..74780f0b165 100644--- a/README.ko.md+++ b/README.ko.md@@ -81,7 +81,7 @@ soju install # 이후: soju battlenet / soju d2r / soju steam / soju epic /설치기는 **다운로드 전에 원하는 런처부터 선택**합니다. Steam만 선택하면 CX 엔진과 애플 GPTK를 받지 않습니다. Steam 그래픽 구성요소는 SHA-256으로 검증한 뒤 Soju 전용 Wine 11.0 환경에 자동으로 설치합니다. Battle.net·Epic·GOG는 공통 CX 엔진과 사용자가 별도로 받은 애플 GPTK를 사용합니다. 각 런처의 보틀·로그인·게임은 독립적으로 유지합니다.-[Soju 맥 앱 다운로드](https://github.com/BCD1210/soju/releases/download/v1.9.0/Soju-1.9.0-macos-arm64.zip): 네이티브 앱 프리뷰에서 설치된 게임과 보유 게임, 스토어 검색, 즐겨찾기, 게임 실행, 플랫폼 관리를 한 화면에서 다룰 수 있습니다. [설치 안내와 요구 사항](docs/DESKTOP.md)을 확인해 주세요.+[Soju 맥 앱 다운로드](https://github.com/BCD1210/soju/releases/download/v1.9.1/Soju-1.9.1-macos-arm64.zip): 네이티브 앱 프리뷰에서 설치된 게임과 보유 게임, 스토어 검색, 즐겨찾기, 게임 실행, 플랫폼 관리를 한 화면에서 다룰 수 있습니다. [설치 안내와 요구 사항](docs/DESKTOP.md)을 확인해 주세요.## 일상 명령diff --git a/README.md b/README.mdindex 7968ffa2170..50f6f323a0a 100644--- a/README.md+++ b/README.md@@ -25,7 +25,7 @@ CodeWeavers' published sources; Steam uses a separate private Wine 11 setup.Apple's proprietary GPTK/D3DMetal is downloaded separately. Games and storeclients are not included.-**Current release: [v1.9.0](https://github.com/BCD1210/soju/releases/tag/v1.9.0).**+**Current release: [v1.9.1](https://github.com/BCD1210/soju/releases/tag/v1.9.1).**The compatibility examples below were verified on M4 Pro / macOS 26.5.D2R and Hogwarts Legacy are examples of supported games, not the scope of the project.@@ -101,7 +101,7 @@ soju install # then: soju battlenet / soju d2r / soju steam / soju epic / soThe installer asks which launchers you want **before downloading anything**. Steam-only installs skip the CX engine and Apple GPTK. Steam rendering components are downloaded with SHA-256 verification and installed in a Soju-owned Wine 11.0 runtime. Battle.net, Epic and GOG use the shared CX engine and your separately downloaded Apple GPTK. Each official client keeps its own bottle and shortcut in `~/Applications`.-[Download Soju for Mac](https://github.com/BCD1210/soju/releases/download/v1.9.0/Soju-1.9.0-macos-arm64.zip): the native desktop preview includes installed and owned games, store search, favorites, game launching and platform management. See [desktop setup and requirements](docs/DESKTOP.md).+[Download Soju for Mac](https://github.com/BCD1210/soju/releases/download/v1.9.1/Soju-1.9.1-macos-arm64.zip): the native desktop preview includes installed and owned games, store search, favorites, game launching and platform management. See [desktop setup and requirements](docs/DESKTOP.md).## Everyday commandsdiff --git a/README.zh.md b/README.zh.mdindex 9c726970aeb..f6addf4c889 100644--- a/README.zh.md+++ b/README.zh.md@@ -85,7 +85,7 @@ soju install # 然后:soju battlenet / soju d2r / soju steam / soju epic /安装器会**先询问要安装哪些启动器,再下载对应组件**。仅选择 Steam 时,不会下载 CX 引擎或 Apple GPTK。Steam 图形组件经过 SHA-256 校验后,自动安装到 Soju 专用的 Wine 11.0 环境中。战网、Epic 和 GOG 使用共享 CX 引擎及用户单独下载的 Apple GPTK。各客户端的 bottle、账户和游戏分别保留。-[下载 Soju Mac 应用](https://github.com/BCD1210/soju/releases/download/v1.9.0/Soju-1.9.0-macos-arm64.zip):原生桌面预览版在一个窗口中管理已安装和已拥有的游戏、商店搜索、收藏、游戏启动和平台管理。[安装说明与要求](docs/DESKTOP.md)。+[下载 Soju Mac 应用](https://github.com/BCD1210/soju/releases/download/v1.9.1/Soju-1.9.1-macos-arm64.zip):原生桌面预览版在一个窗口中管理已安装和已拥有的游戏、商店搜索、收藏、游戏启动和平台管理。[安装说明与要求](docs/DESKTOP.md)。## 日常维护diff --git a/VERSION b/VERSIONindex f8e233b2733..9ab8337f396 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-1.9.0+1.9.1diff --git a/docs/DESKTOP.md b/docs/DESKTOP.mdindex a42d63fbe3c..9cecff38bc8 100644--- a/docs/DESKTOP.md+++ b/docs/DESKTOP.md@@ -1,6 +1,6 @@# Soju for Mac-[Download v1.9.0](https://github.com/BCD1210/soju/releases/download/v1.9.0/Soju-1.9.0-macos-arm64.zip)+[Download v1.9.1](https://github.com/BCD1210/soju/releases/download/v1.9.1/Soju-1.9.1-macos-arm64.zip)1. Unzip and move **Soju.app** into Applications or ~/Applications.2. Open **Platforms** to install or open Battle.net, Steam, Epic Games or GOG GALAXY.diff --git a/docs/VR.md b/docs/VR.mdindex 1cdec72b49b..e288da1e962 100644--- a/docs/VR.md+++ b/docs/VR.md@@ -4,9 +4,9 @@ Soju can set up [D2R VR Unleashed](https://github.com/bearstonem/d2r-pcvr) (D2R-first-person VR mod for **offline characters**, and stream it to a headset from your Mac.```bash-soju vr setup # once (about 2 minutes, ~110 MB of downloads)-soju vr play # every time-soju vr play --flat # same copy without VR: create offline characters with the mouse+soju vr setup # once (about 2 minutes, ~125 MB of downloads)+soju vr play # after connecting the headset or simulator+soju vr play --flat # optional desktop modesoju vr statussoju vr setup --refresh # after a D2R update or when the 30-day check appearssoju vr remove --yes@@ -22,7 +22,7 @@ In the app: right-click Diablo II: Resurrected in the library, then **Set Up VRgame.- Downloads, each pinned by size and SHA-256 in `resources/d2r-vr.json`: the mod's release ZIP (GitHub), D2RLoader1.3.1-beta (d2rloader.net), ReShade 6.8.0 (reshade.me; only `ReShade64.dll` is extracted, the setup never runs),- Windows embeddable Python 3.12 (python.org) for the mod's own installer, and Soju's VR runtime.+ Windows embeddable Python 3.12 (python.org) for the mod's own installer, Soju's VR runtime, and the patched mod DLL.- The VR runtime ([vr-runtime-v1](https://github.com/BCD1210/soju/releases/tag/vr-runtime-v1)) is built by`scripts/build-vr-runtime.sh` from pinned commits: the OXRSys OpenXR runtime for macOS (MPL-2.0) and a wineopenxrbridge (LGPL-2.1-or-later) that hands the game's D3D12 eye images to the runtime as Metal textures.@@ -39,15 +39,74 @@ The game streams to a headset running the **OXRSys client** (Meta Quest / PICO,Simulator on the Mac for testing. The Mac and the headset need to be on the same network (or USB with adb).Status (November 2026): verified on M4 Pro / macOS 26.5 with the OXRSys Simulator: first-person view in Act 1 at-72 fps. **Not yet tested on a real headset.** Controller input therefore has not been checked.+72 fps. **Not yet tested on a real headset.** Physical Quest controller input therefore has not been checked.++## Create an offline character inside VR++Connect the OXRSys headset/client or Simulator **before `soju vr play`**. If the+runtime only becomes discoverable when the game starts, have the client ready and+connect as soon as it appears, before advancing the title screen. Opening the+simulator window alone is insufficient: press **Connect** so it sends tracked head+poses. The menu cannot anchor without tracking.++1. Press **A** at the title and release it. The character list opens in controller+ mode. On the VR **Characters** panel, move the **left stick right** to highlight+ **New**, then press **A**. Up/down still selects an existing character; left+ selects **Play**. Start remains a shortcut for New.+2. Move the **left stick left/right** to choose a class, then press **A** and release+ it. The VR **Character Name** keyboard opens automatically.+3. Move the **left stick** across the letters and press **A** for each letter.+ **X** erases one character; **Y** switches letter case. Select **Create** at the+ lower right and press **A** to create the character and enter its game.+ D2R validates the name, including length and duplicates. An invalid name keeps+ the screen open so you can correct it. No desktop click or `--flat` launch is needed.+4. **B** backs out of name entry; another B returns from creation to the character+ list. On the list, B opens the native exit confirmation; B cancels it.+ Release each press between screens. A held accept cannot select the next+ screen's default item. Physical keyboard input remains available through D2R's+ normal text field when the keyboard is routed to the game.++For the local lab simulator build: **I/K/J/L** = left stick up/down/left/right;+**B** = controller A/confirm; **N** = controller B/back; **Escape** = Start/New;+**Z** = controller X/erase; **X** = controller Y/case; **Space/V** = right/left trigger.+Keep the simulator frontmost while using these keys and release each press.+**Tab** toggles right-hand mouse aim; press it again to reset the hand aim and+return to mouse head look. The existing backtick toggle aims the left hand.+These keyboard mappings are lab additions; the stock OXRSys app may differ.+On Quest use the physical left thumbstick and A/B/X/Y buttons.++The PC build's controller name field did not open an on-screen keyboard when+selected or accepted in the lab. The mod supplies its own VR keyboard and routes+its keys to the native name field; it does not create saves or bypass game validation.+The simulator created the Necromancer `sojunecro` with controller input and entered+stereo gameplay. An empty character list was also tested: New → Warlock →+`sojufresh` → stereo gameplay, using only simulator controller keys. B was checked+in the list exit confirmation, class selection, and name entry. Wait for class+selection animations to finish before sending the next action. The OXRSys menu+includes a black projection background so its runtime streams the menu quads. The virtual pad stays connected with neutral+controls while loading pauses XR publication, avoiding the reconnect dialog.++After restarting D2R, disconnect the simulator's old session and Search/Connect+again; an old frozen image with RECV 0 does not mean it connected to the new game.+Real Quest testing remains outstanding. A separate existing body-calibration+font-weight warning appeared in the lab build; this work does not qualify that+calibration UI or extended gameplay.++## Patched mod distribution++Setup verifies the additional `mod_patch` DLL pin in `resources/d2r-vr.json`, then+passes that DLL to the upstream installer, which backs up an existing plugin.+The MPL-2.0 source patch, license, exact upstream source commit, and rebuild guide+are in [patches/d2r-pcvr](../patches/d2r-pcvr/README.md). A source notice and patch+are also placed in the installed mod's `soju-source` directory.++The `vr-mod-v1` release is staged locally for this change and is **not published**.+Publish its pinned DLL and corresponding source before distributing this Soju+version. Setup deliberately cannot substitute an unpatched or unchecked DLL.## Notes- Use **offline characters** only. Characters you make in VR live in the copy; `--refresh` keeps them.-- To make the first offline character, run `soju vr play --flat`, choose Play (not Multiplayer), New, pick a class and- name it, then quit and start `soju vr play`. In VR the mod draws the menus for the controller laser, so on the- simulator the Mac mouse cannot pick a class on the character creation screen. `--flat` starts the copy without- Soju's VR runtime, so the mod stays off and the normal screen and mouse work.- D2R requires an online sign-in within the last 30 days even for offline play. If it says so, play D2R online oncefrom Battle.net, then run `soju vr setup --refresh`.- The mod supports D2R 3.3.93847. Setup refuses other builds.diff --git a/docs/index.html b/docs/index.htmlindex aa39b62b159..93e065cc83a 100644--- a/docs/index.html+++ b/docs/index.html@@ -124,7 +124,7 @@ its own login, purchases, downloads and game updates.</p><section id="install" aria-labelledby="install-title"><h2 id="install-title">Choose your launchers. Get set up.</h2>-<p><a class="btn" href="https://github.com/BCD1210/soju/releases/download/v1.9.0/Soju-1.9.0-macos-arm64.zip">Download Soju for Mac</a></p>+<p><a class="btn" href="https://github.com/BCD1210/soju/releases/download/v1.9.1/Soju-1.9.1-macos-arm64.zip">Download Soju for Mac</a></p><p>The native desktop preview combines installed and imported owned games, searches stores and manages all four launchers.Apple Silicon · app UI: macOS 14+ · Steam component build: macOS 26+.<a href="https://github.com/BCD1210/soju/blob/main/docs/DESKTOP.md">Setup and signing notes</a>.</p>diff --git a/patches/d2r-pcvr/LICENSE b/patches/d2r-pcvr/LICENSEnew file mode 100644index 00000000000..d0a1fa1482e--- /dev/null+++ b/patches/d2r-pcvr/LICENSE@@ -0,0 +1,373 @@+Mozilla Public License Version 2.0+==================================++1. Definitions+--------------++1.1. "Contributor"+ means each individual or legal entity that creates, contributes to+ the creation of, or owns Covered Software.++1.2. "Contributor Version"+ means the combination of the Contributions of others (if any) used+ by a Contributor and that particular Contributor's Contribution.++1.3. "Contribution"+ means Covered Software of a particular Contributor.++1.4. "Covered Software"+ means Source Code Form to which the initial Contributor has attached+ the notice in Exhibit A, the Executable Form of such Source Code+ Form, and Modifications of such Source Code Form, in each case+ including portions thereof.++1.5. "Incompatible With Secondary Licenses"+ means++ (a) that the initial Contributor has attached the notice described+ in Exhibit B to the Covered Software; or++ (b) that the Covered Software was made available under the terms of+ version 1.1 or earlier of the License, but not also under the+ terms of a Secondary License.++1.6. "Executable Form"+ means any form of the work other than Source Code Form.++1.7. "Larger Work"+ means a work that combines Covered Software with other material, in+ a separate file or files, that is not Covered Software.++1.8. "License"+ means this document.++1.9. "Licensable"+ means having the right to grant, to the maximum extent possible,+ whether at the time of the initial grant or subsequently, any and+ all of the rights conveyed by this License.++1.10. "Modifications"+ means any of the following:++ (a) any file in Source Code Form that results from an addition to,+ deletion from, or modification of the contents of Covered+ Software; or++ (b) any new file in Source Code Form that contains any Covered+ Software.++1.11. "Patent Claims" of a Contributor+ means any patent claim(s), including without limitation, method,+ process, and apparatus claims, in any patent Licensable by such+ Contributor that would be infringed, but for the grant of the+ License, by the making, using, selling, offering for sale, having+ made, import, or transfer of either its Contributions or its+ Contributor Version.++1.12. "Secondary License"+ means either the GNU General Public License, Version 2.0, the GNU+ Lesser General Public License, Version 2.1, the GNU Affero General+ Public License, Version 3.0, or any later versions of those+ licenses.++1.13. "Source Code Form"+ means the form of the work preferred for making modifications.++1.14. "You" (or "Your")+ means an individual or a legal entity exercising rights under this+ License. For legal entities, "You" includes any entity that+ controls, is controlled by, or is under common control with You. For+ purposes of this definition, "control" means (a) the power, direct+ or indirect, to cause the direction or management of such entity,+ whether by contract or otherwise, or (b) ownership of more than+ fifty percent (50%) of the outstanding shares or beneficial+ ownership of such entity.++2. License Grants and Conditions+--------------------------------++2.1. Grants++Each Contributor hereby grants You a world-wide, royalty-free,+non-exclusive license:++(a) under intellectual property rights (other than patent or trademark)+ Licensable by such Contributor to use, reproduce, make available,+ modify, display, perform, distribute, and otherwise exploit its+ Contributions, either on an unmodified basis, with Modifications, or+ as part of a Larger Work; and++(b) under Patent Claims of such Contributor to make, use, sell, offer+ for sale, have made, import, and otherwise transfer either its+ Contributions or its Contributor Version.++2.2. Effective Date++The licenses granted in Section 2.1 with respect to any Contribution+become effective for each Contribution on the date the Contributor first+distributes such Contribution.++2.3. Limitations on Grant Scope++The licenses granted in this Section 2 are the only rights granted under+this License. No additional rights or licenses will be implied from the+distribution or licensing of Covered Software under this License.+Notwithstanding Section 2.1(b) above, no patent license is granted by a+Contributor:++(a) for any code that a Contributor has removed from Covered Software;+ or++(b) for infringements caused by: (i) Your and any other third party's+ modifications of Covered Software, or (ii) the combination of its+ Contributions with other software (except as part of its Contributor+ Version); or++(c) under Patent Claims infringed by Covered Software in the absence of+ its Contributions.++This License does not grant any rights in the trademarks, service marks,+or logos of any Contributor (except as may be necessary to comply with+the notice requirements in Section 3.4).++2.4. Subsequent Licenses++No Contributor makes additional grants as a result of Your choice to+distribute the Covered Software under a subsequent version of this+License (see Section 10.2) or under the terms of a Secondary License (if+permitted under the terms of Section 3.3).++2.5. Representation++Each Contributor represents that the Contributor believes its+Contributions are its original creation(s) or it has sufficient rights+to grant the rights to its Contributions conveyed by this License.++2.6. Fair Use++This License is not intended to limit any rights You have under+applicable copyright doctrines of fair use, fair dealing, or other+equivalents.++2.7. Conditions++Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted+in Section 2.1.++3. Responsibilities+-------------------++3.1. Distribution of Source Form++All distribution of Covered Software in Source Code Form, including any+Modifications that You create or to which You contribute, must be under+the terms of this License. You must inform recipients that the Source+Code Form of the Covered Software is governed by the terms of this+License, and how they can obtain a copy of this License. You may not+attempt to alter or restrict the recipients' rights in the Source Code+Form.++3.2. Distribution of Executable Form++If You distribute Covered Software in Executable Form then:++(a) such Covered Software must also be made available in Source Code+ Form, as described in Section 3.1, and You must inform recipients of+ the Executable Form how they can obtain a copy of such Source Code+ Form by reasonable means in a timely manner, at a charge no more+ than the cost of distribution to the recipient; and++(b) You may distribute such Executable Form under the terms of this+ License, or sublicense it under different terms, provided that the+ license for the Executable Form does not attempt to limit or alter+ the recipients' rights in the Source Code Form under this License.++3.3. Distribution of a Larger Work++You may create and distribute a Larger Work under terms of Your choice,+provided that You also comply with the requirements of this License for+the Covered Software. If the Larger Work is a combination of Covered+Software with a work governed by one or more Secondary Licenses, and the+Covered Software is not Incompatible With Secondary Licenses, this+License permits You to additionally distribute such Covered Software+under the terms of such Secondary License(s), so that the recipient of+the Larger Work may, at their option, further distribute the Covered+Software under the terms of either this License or such Secondary+License(s).++3.4. Notices++You may not remove or alter the substance of any license notices+(including copyright notices, patent notices, disclaimers of warranty,+or limitations of liability) contained within the Source Code Form of+the Covered Software, except that You may alter any license notices to+the extent required to remedy known factual inaccuracies.++3.5. Application of Additional Terms++You may choose to offer, and to charge a fee for, warranty, support,+indemnity or liability obligations to one or more recipients of Covered+Software. However, You may do so only on Your own behalf, and not on+behalf of any Contributor. You must make it absolutely clear that any+such warranty, support, indemnity, or liability obligation is offered by+You alone, and You hereby agree to indemnify every Contributor for any+liability incurred by such Contributor as a result of warranty, support,+indemnity or liability terms You offer. You may include additional+disclaimers of warranty and limitations of liability specific to any+jurisdiction.++4. Inability to Comply Due to Statute or Regulation+---------------------------------------------------++If it is impossible for You to comply with any of the terms of this+License with respect to some or all of the Covered Software due to+statute, judicial order, or regulation then You must: (a) comply with+the terms of this License to the maximum extent possible; and (b)+describe the limitations and the code they affect. Such description must+be placed in a text file included with all distributions of the Covered+Software under this License. Except to the extent prohibited by statute+or regulation, such description must be sufficiently detailed for a+recipient of ordinary skill to be able to understand it.++5. Termination+--------------++5.1. The rights granted under this License will terminate automatically+if You fail to comply with any of its terms. However, if You become+compliant, then the rights granted under this License from a particular+Contributor are reinstated (a) provisionally, unless and until such+Contributor explicitly and finally terminates Your grants, and (b) on an+ongoing basis, if such Contributor fails to notify You of the+non-compliance by some reasonable means prior to 60 days after You have+come back into compliance. Moreover, Your grants from a particular+Contributor are reinstated on an ongoing basis if such Contributor+notifies You of the non-compliance by some reasonable means, this is the+first time You have received notice of non-compliance with this License+from such Contributor, and You become compliant prior to 30 days after+Your receipt of the notice.++5.2. If You initiate litigation against any entity by asserting a patent+infringement claim (excluding declaratory judgment actions,+counter-claims, and cross-claims) alleging that a Contributor Version+directly or indirectly infringes any patent, then the rights granted to+You by any and all Contributors for the Covered Software under Section+2.1 of this License shall terminate.++5.3. In the event of termination under Sections 5.1 or 5.2 above, all+end user license agreements (excluding distributors and resellers) which+have been validly granted by You or Your distributors under this License+prior to termination shall survive termination.++************************************************************************+* *+* 6. Disclaimer of Warranty *+* ------------------------- *+* *+* Covered Software is provided under this License on an "as is" *+* basis, without warranty of any kind, either expressed, implied, or *+* statutory, including, without limitation, warranties that the *+* Covered Software is free of defects, merchantable, fit for a *+* particular purpose or non-infringing. The entire risk as to the *+* quality and performance of the Covered Software is with You. *+* Should any Covered Software prove defective in any respect, You *+* (not any Contributor) assume the cost of any necessary servicing, *+* repair, or correction. This disclaimer of warranty constitutes an *+* essential part of this License. No use of any Covered Software is *+* authorized under this License except under this disclaimer. *+* *+************************************************************************++************************************************************************+* *+* 7. Limitation of Liability *+* -------------------------- *+* *+* Under no circumstances and under no legal theory, whether tort *+* (including negligence), contract, or otherwise, shall any *+* Contributor, or anyone who distributes Covered Software as *+* permitted above, be liable to You for any direct, indirect, *+* special, incidental, or consequential damages of any character *+* including, without limitation, damages for lost profits, loss of *+* goodwill, work stoppage, computer failure or malfunction, or any *+* and all other commercial damages or losses, even if such party *+* shall have been informed of the possibility of such damages. This *+* limitation of liability shall not apply to liability for death or *+* personal injury resulting from such party's negligence to the *+* extent applicable law prohibits such limitation. Some *+* jurisdictions do not allow the exclusion or limitation of *+* incidental or consequential damages, so this exclusion and *+* limitation may not apply to You. *+* *+************************************************************************++8. Litigation+-------------++Any litigation relating to this License may be brought only in the+courts of a jurisdiction where the defendant maintains its principal+place of business and such litigation shall be governed by laws of that+jurisdiction, without reference to its conflict-of-law provisions.+Nothing in this Section shall prevent a party's ability to bring+cross-claims or counter-claims.++9. Miscellaneous+----------------++This License represents the complete agreement concerning the subject+matter hereof. If any provision of this License is held to be+unenforceable, such provision shall be reformed only to the extent+necessary to make it enforceable. Any law or regulation which provides+that the language of a contract shall be construed against the drafter+shall not be used to construe this License against a Contributor.++10. Versions of the License+---------------------------++10.1. New Versions++Mozilla Foundation is the license steward. Except as provided in Section+10.3, no one other than the license steward has the right to modify or+publish new versions of this License. Each version will be given a+distinguishing version number.++10.2. Effect of New Versions++You may distribute the Covered Software under the terms of the version+of the License under which You originally received the Covered Software,+or under the terms of any subsequent version published by the license+steward.++10.3. Modified Versions++If you create software not governed by this License, and you want to+create a new license for such software, you may create and use a+modified version of this License if you rename the license and remove+any references to the name of the license steward (except to note that+such modified license differs from this License).++10.4. Distributing Source Code Form that is Incompatible With Secondary+Licenses++If You choose to distribute Source Code Form that is Incompatible With+Secondary Licenses under the terms of this version of the License, the+notice described in Exhibit B of this License must be attached.++Exhibit A - Source Code Form License Notice+-------------------------------------------++ This Source Code Form is subject to the terms of the Mozilla Public+ License, v. 2.0. If a copy of the MPL was not distributed with this+ file, You can obtain one at https://mozilla.org/MPL/2.0/.++If it is not possible or desirable to put the notice in a particular+file, then You may include the notice in a location (such as a LICENSE+file in a relevant directory) where a recipient would be likely to look+for such a notice.++You may add additional accurate notices of copyright ownership.++Exhibit B - "Incompatible With Secondary Licenses" Notice+---------------------------------------------------------++ This Source Code Form is "Incompatible With Secondary Licenses", as+ defined by the Mozilla Public License, v. 2.0.diff --git a/patches/d2r-pcvr/README.md b/patches/d2r-pcvr/README.mdnew file mode 100644index 00000000000..f9a33e69ae5--- /dev/null+++ b/patches/d2r-pcvr/README.md@@ -0,0 +1,62 @@+# D2R-PCVR front-end controller fix++Upstream: https://github.com/bearstonem/d2r-pcvr+Base: `70ad0e665952f1bd829176ba461a85ebb974c3f0` (v0.3.31).+License: Mozilla Public License 2.0; see LICENSE here and the upstream notices.+`vr-character-create.patch` contains all Soju source changes against that base,+including the portable regression test and macOS cross-build include fix.++The anchored front end accepts native controller input without desktop focus.+It does not pull focus from the simulator, and mouse injection still requires+D2R focus. The existing Native-tagged BodyWalk/XInput path selects classes.+On OXRSys, a fresh title-screen A/Start posts Enter to the game window only while+TitleScreenPanel is open. A release gate prevents that press carrying into Play.+A black projection background makes OXRSys stream quad-only menus. During loading,+the in-process virtual pad returns neutral controls instead of disconnecting;+external BodyWalk writers retain their timeout.++The UI thread restores native controller layout on the front end. A VR Play/New+strip maps stick-right/A to native Start, and the name screen has a stick/A keyboard+with X erase, Y case and native B back. Screen changes consume held buttons.+Keyboard events use the game's window thread and TranslateMessage with scoped+modifier state; they never activate the desktop window. Physical typing stays on+the original input path. Front-end, native-panel, composition and atlas tests cover+the portable state and layout rules; name entry is also verified live.++## Rebuild++Use local copies of the upstream source and SDK checkouts. The script archives+only the pinned base, applies this patch in a temporary directory, verifies SDK+commits and tracked cleanliness, and builds without downloading or installing.+Use llvm-mingw-20260616-ucrt-macos-universal, CMake, Ninja and Python 3.9+.+The SDK commits are pinned in the script and upstream setup_windows_tools.ps1.++```sh+python3 scripts/build-vr-mod.py \+ --source /path/to/d2r-pcvr-src \+ --deps /path/to/pcvr-0331/deps \+ --toolchain /path/to/llvm-mingw-20260616-ucrt-macos-universal+```++Output: `dist/vr-mod/d2rl-pcvr-soju.dll`, a complete patched source archive,+MPL license, and patch. The build prints sizes and SHA-256 hashes. Byte-for-byte+reproducibility across paths/toolchain versions is not assumed; pin the exact+built DLL that will be published. No game assets are included.++## Release gate++No artifact has been uploaded by this change. After simulator qualification (real Quest remains unverified):++1. Publish the staged DLL at the `vr-mod-v1` URL in resources/d2r-vr.json. Confirm+ its size and SHA-256 match `mod_patch`; never replace a published artifact.+2. Publish `d2r-pcvr-soju-source.tar.xz`, LICENSE, and the patch alongside it.+ Keep the source available for recipients under MPL-2.0, and publish this repo's+ patch and rebuild script with the Soju release. Preserve upstream notices.+3. If rebuilding changes the bytes, update the manifest to the new exact size+ and digest before release. All setup downloads use the existing verified+ downloader; none bypass checksum validation.+4. Smoke-test fresh setup and upgrade, then distribute Soju. Do not distribute+ this manifest while the pinned release asset is absent.++For the current local test, only `mods/pcvr-dev/d2rloader/plugins/d2rl-pcvr.dll`+is replaced, with a verified backup. The installed release mod stays untouched.diff --git a/patches/d2r-pcvr/vr-character-create.patch b/patches/d2r-pcvr/vr-character-create.patchnew file mode 100644index 00000000000..d86003c15b9--- /dev/null+++ b/patches/d2r-pcvr/vr-character-create.patch@@ -0,0 +1,710 @@+diff --git a/steamvr/CMakeLists.txt b/steamvr/CMakeLists.txt+index f524503..7793bac 100644+--- a/steamvr/CMakeLists.txt++++ b/steamvr/CMakeLists.txt+@@ -5,7 +5,7 @@ option(D2RVR_DEVELOPER "Enable developer diagnostics" OFF)+ set(CMAKE_CXX_SCAN_FOR_MODULES OFF)+ # Linux needs a case adapter for SDK includes of Windows.h. On Windows the+ # adapter would resolve its own windows.h include and hide the real SDK header.+-if(NOT CMAKE_HOST_WIN32)++if(NOT CMAKE_HOST_WIN32 AND NOT CMAKE_HOST_APPLE)+ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/compat)+ endif()+ set(CMAKE_CXX_STANDARD 20)+@@ -272,6 +272,8 @@ target_link_libraries(interaction-test PRIVATE framevr-runtime)++ add_executable(journal-test journal_test.cpp)+ add_executable(native-panels-test native_panels_test.cpp)++add_executable(frontend-controls-test frontend_controls_test.cpp)++add_test(NAME frontend-controls-test COMMAND frontend-controls-test)+ add_executable(dropped-bottles-test dropped_bottles_test.cpp dropped_bottles.cpp)+ target_link_libraries(dropped-bottles-test PRIVATE box3d framevr-runtime)+ add_executable(props-test props_test.cpp)+diff --git a/steamvr/composition_layers.h b/steamvr/composition_layers.h+index e074e34..303e64a 100644+--- a/steamvr/composition_layers.h++++ b/steamvr/composition_layers.h+@@ -2,6 +2,22 @@+ #include <openxr/openxr.h>++ namespace framevr::composition {++// Some streaming runtimes need a projection source before they can composite++// quads. A black texel supplies an opaque background without flattening the++// menu: the following quads retain their world-space pose and stereo depth.++inline void BlackBackdrop(XrCompositionLayerProjection& layer,++ XrCompositionLayerProjectionView (&eyes)[2],++ const XrView* views,XrSpace space,XrSwapchain atlas,++ XrOffset2Di blackTexel) {++ layer={XR_TYPE_COMPOSITION_LAYER_PROJECTION};layer.space=space;++ layer.viewCount=2;layer.views=eyes;++ for(int i=0;i<2;++i) {++ eyes[i]={XR_TYPE_COMPOSITION_LAYER_PROJECTION_VIEW};++ eyes[i].pose=views[i].pose;eyes[i].fov=views[i].fov;++ eyes[i].subImage.swapchain=atlas;++ eyes[i].subImage.imageRect={blackTexel,{1,1}};++ }++}+ // Proton Experimental's win64 layer-array converter (observed 2026-10-09)+ // sizes EVERY output element from input[0]->type. Projection is 48 bytes;+ // quad is 112. A projection followed by quads therefore overlaps outputs.+diff --git a/steamvr/composition_layers_test.cpp b/steamvr/composition_layers_test.cpp+index a95d936..1a25c41 100644+--- a/steamvr/composition_layers_test.cpp++++ b/steamvr/composition_layers_test.cpp+@@ -39,5 +39,16 @@ int main(){+ Check(!PrependQuadPadding(layers.data(),count,layers.size(),padding,space,atlas),"capacity respected");+ count=1;layers[0]=base;+ Check(!PrependQuadPadding(layers.data(),count,layers.size(),padding,space,atlas)&&count==1,"scene-only frame adds nothing");++ XrView views[2]{{XR_TYPE_VIEW},{XR_TYPE_VIEW}};++ views[0].pose.orientation.w=views[1].pose.orientation.w=1;++ views[0].pose.position.x=-.032f;views[1].pose.position.x=.032f;++ views[0].fov=views[1].fov={-.8f,.8f,.8f,-.8f};++ XrCompositionLayerProjection backdrop{};XrCompositionLayerProjectionView backdropEyes[2]{};++ BlackBackdrop(backdrop,backdropEyes,views,space,atlas,{1032,32});++ Check(backdrop.viewCount==2&&backdrop.space==space&&backdrop.layerFlags==0,"opaque stereo backdrop");++ Check(backdropEyes[0].pose.position.x<0&&backdropEyes[1].pose.position.x>0,"background keeps tracked stereo poses");++ Check(backdropEyes[0].subImage.imageRect.extent.width==1&&backdropEyes[1].subImage.imageRect.offset.y==32,"background reads only reserved black texel");++ count=2;layers[0]=reinterpret_cast<const XrCompositionLayerBaseHeader*>(&backdrop);layers[1]=reinterpret_cast<const XrCompositionLayerBaseHeader*>(&menu);++ Check(PrependQuadPadding(layers.data(),count,layers.size(),padding,space,atlas)&&SurvivesBridge(layers.data(),count),"menu backdrop survives mixed-layer bridge");+ std::puts("Composition: reproduced Wine quad overlap; padding preserves fields, order, capacity and native path");+ }+diff --git a/steamvr/frontend_controls.h b/steamvr/frontend_controls.h+new file mode 100644+index 0000000..f716007+--- /dev/null++++ b/steamvr/frontend_controls.h+@@ -0,0 +1,52 @@++#pragma once++#include "menu_controls.h"++++namespace framevr::frontend {++constexpr int Width=960,Height=360;++constexpr unsigned NameKeyMessage=0x8000+0x3a1;++// Native screen values are published by the UI-message listener. Name input++// uses the game's focused text box, so validation and physical typing stay native.++struct Output {menus::Pad pad;char text=0;bool erase=false,back=false;};++struct Controls {++ int screen=0,selected=0,direction=0;++ uint16_t held=0xffff,blocked=0;++ uint64_t repeatAt=0;++ bool upper=false;++ bool Visible() const{return screen==1||screen==3;}++ Output Step(int next,menus::Pad pad,uint64_t now) {++ if(next!=screen){screen=next;selected=0;direction=0;repeatAt=0;held=pad.buttons;blocked=pad.buttons;}++ blocked&=pad.buttons;pad.buttons&=~blocked;++ const auto pressed=uint16_t(pad.buttons&~held);held=pad.buttons;++ Output out{pad};++ if(!Visible())return out;++ const int dx=pad.lx>16000?1:pad.lx<-16000?-1:0;++ const int dy=screen==3?(pad.ly>16000?-10:pad.ly<-16000?10:0):0;++ const int move=dx?dx:dy;++ if(move&&(move!=direction||now>=repeatAt)) {++ selected=screen==1?std::clamp(selected+move,0,1):(selected+move+30)%30;++ repeatAt=now+(move!=direction?400:140);++ }++ direction=move;++ out.pad.lx=0;++ if(screen==1) {++ out.back=(pressed&menus::B)!=0;out.pad.buttons&=~menus::B;++ if(selected==1&&(pad.buttons&menus::A)){out.pad.buttons&=~menus::A;out.pad.buttons|=menus::Start;}++ return out;++ }++ out.pad={};++ if(pressed&menus::B){out.pad.buttons=menus::B;return out;}++ if(pressed&menus::Y)upper=!upper;++ if(pressed&menus::X)out.erase=true;++ if(pressed&menus::A) {++ if(selected<26)out.text=char((upper?'A':'a')+selected);++ else if(selected<28)out.text=selected==26?'-':'_';++ else if(selected==28)out.erase=true;++ else out.pad.buttons=menus::A;++ }++ // Native buttons need a sampled hold, not a one-frame pulse.++ if((held&menus::B))out.pad.buttons=menus::B;++ if(selected==29&&(held&menus::A))out.pad.buttons=menus::A;++ return out;++ }++};++}+diff --git a/steamvr/frontend_controls_art.h b/steamvr/frontend_controls_art.h+new file mode 100644+index 0000000..61c9dd9+--- /dev/null++++ b/steamvr/frontend_controls_art.h+@@ -0,0 +1,35 @@++#pragma once++#include <windows.h>++#include <vector>++#include "frontend_controls.h"++namespace framevr::frontend {++inline std::vector<uint8_t> Paint(const Controls& model) {++ std::vector<uint8_t> rgba(size_t(Width)*Height*4);++ BITMAPINFO info{};info.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);++ info.bmiHeader.biWidth=Width;info.bmiHeader.biHeight=-Height;info.bmiHeader.biPlanes=1;info.bmiHeader.biBitCount=32;++ HDC dc=CreateCompatibleDC(nullptr);void* bits=nullptr;++ HBITMAP bitmap=dc?CreateDIBSection(dc,&info,DIB_RGB_COLORS,&bits,nullptr,0):nullptr;++ if(!dc||!bitmap||!bits){if(bitmap)DeleteObject(bitmap);if(dc)DeleteDC(dc);return {};}++ const auto old=SelectObject(dc,bitmap);++ auto fill=[&](RECT r,COLORREF c){auto b=CreateSolidBrush(c);FillRect(dc,&r,b);DeleteObject(b);};++ fill({0,0,Width,Height},RGB(18,16,14));++ auto font=CreateFontW(28,0,0,0,FW_SEMIBOLD,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,++ CLIP_DEFAULT_PRECIS,ANTIALIASED_QUALITY,DEFAULT_PITCH,L"Segoe UI");++ const auto oldFont=SelectObject(dc,font);SetBkMode(dc,TRANSPARENT);SetTextColor(dc,RGB(245,235,210));++ auto text=[&](const wchar_t* t,RECT r){DrawTextW(dc,t,-1,&r,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX);};++ text(model.screen==1?L"CHARACTERS | A: select B: back":L"CHARACTER NAME",{12,4,Width-12,48});++ text(model.screen==1?L"Stick left/right: Play / New | Up/down: character":L"Stick: move A: type X: erase Y: case B: back",{12,Height-52,Width-12,Height-8});++ const int count=model.screen==1?2:30;++ for(int i=0;i<count;++i){++ RECT r=model.screen==1?RECT{40+i*460,85,460+i*460,255}:RECT{18+(i%10)*93,58+(i/10)*78,105+(i%10)*93,128+(i/10)*78};++ fill(r,i==model.selected?RGB(150,107,42):RGB(48,43,36));++ wchar_t letter[2]={wchar_t((model.upper?'A':'a')+i),0};++ const wchar_t* label=model.screen==1?(i?L"New":L"Play"):i<26?letter:i==26?L"-":i==27?L"_":i==28?L"Erase":L"Create";++ text(label,r);++ }++ GdiFlush();const auto* bgra=static_cast<const uint8_t*>(bits);++ for(size_t i=0;i<rgba.size();i+=4){rgba[i]=bgra[i+2];rgba[i+1]=bgra[i+1];rgba[i+2]=bgra[i];rgba[i+3]=255;}++ SelectObject(dc,oldFont);DeleteObject(font);SelectObject(dc,old);DeleteObject(bitmap);DeleteDC(dc);++ return rgba;++}++}+diff --git a/steamvr/frontend_controls_test.cpp b/steamvr/frontend_controls_test.cpp+new file mode 100644+index 0000000..185d196+--- /dev/null++++ b/steamvr/frontend_controls_test.cpp+@@ -0,0 +1,28 @@++#include "frontend_controls.h"++#include <cassert>++#include <cstdio>++using namespace framevr;++int main(){++ frontend::Controls c;menus::Pad p;++ c.Step(1,p,0);p.lx=25000;c.Step(1,p,1);assert(c.selected==1);++ p={};p.buttons=menus::A;assert(c.Step(1,p,2).pad.buttons==menus::Start);++ assert(!c.Step(2,p,3).pad.buttons);auto out=c.Step(3,p,4);assert(!out.text&&!out.pad.buttons);++ p={};c.Step(3,p,5);p.buttons=menus::A;assert(c.Step(3,p,6).text=='a');++ assert(!c.Step(3,p,7).text);p={};c.Step(3,p,8);++ p.lx=-25000;c.Step(3,p,9);assert(c.selected==29);++ c.Step(3,p,10);assert(c.selected==29);++ c.Step(3,p,409);assert(c.selected==28);++ p={};p.buttons=menus::A;assert(c.Step(3,p,410).erase);++ p={};c.Step(3,p,411);p.buttons=menus::B;assert(c.Step(3,p,412).pad.buttons==menus::B);++ assert(c.Step(3,p,413).pad.buttons==menus::B);++ c.Step(0,p,414);assert(!c.Visible());++ c.Step(3,{},415);p={};p.buttons=menus::Y;c.Step(3,p,416);++ c.Step(3,{},417);p.buttons=menus::A;assert(c.Step(3,p,418).text=='A');++ c.Step(1,{},500);p={};p.buttons=menus::B;++ out=c.Step(1,p,501);assert(out.back&&!out.pad.buttons);++ assert(!c.Step(1,p,502).back);++ assert(!c.Step(0,p,503).pad.buttons); // no held B in confirmation++ c.Step(0,{},504);assert(c.Step(0,p,505).pad.buttons==menus::B);++ assert(!c.Step(1,p,506).back); // closing confirmation cannot reopen it++ puts("Front-end navigation and name keyboard passed");++}+diff --git a/steamvr/menu_controls.h b/steamvr/menu_controls.h+index 65285d6..0e10b9e 100644+--- a/steamvr/menu_controls.h++++ b/steamvr/menu_controls.h+@@ -21,6 +21,27 @@ inline bool Tagged(uint32_t tag){return tag==uint32_t(Mode::World)||tag==uint32_+ inline bool Allowed(uint32_t tag,uint32_t epoch,uint32_t current,bool native,bool settings) {+ return epoch==current&&!settings&&tag==uint32_t(native?Mode::Native:Mode::World);+ }++// Front-end XInput does not require desktop focus (the simulator owns its keys).++// Gameplay menus and injected mouse input still require the game window's focus.++inline bool NavigationActive(bool uiActive,bool focused,bool frontend) {++ return uiActive&&(focused||frontend);++}++// Wine's title panel accepts window key messages but can ignore native pad++// events before its controller UI exists. Consume one fresh accept through the++// transition so a held title press cannot also enter the selected character.++class TitleAccept {++ bool down=true,consumed=false;++public:++ bool Step(bool active,bool title,Pad& pad) {++ const bool pressed=(pad.buttons&(A|Start))!=0;++ const bool fire=active&&title&&pressed&&!down;++ if(!pressed)consumed=false;++ if(fire)consumed=true;++ down=pressed||!active;++ if(consumed)pad.buttons&=~(A|Start);++ return fire;++ }++};+ inline bool Tilted(int16_t x,int16_t y){return std::max(std::abs(int(x)),std::abs(int(y)))>8000;}+ inline bool Busy(const Pad& p){return p.buttons||p.lt>25||p.rt>25||Tilted(p.lx,p.ly)||Tilted(p.rx,p.ry);}+ inline bool SettingsChord(const Pad& p,bool quickCastConsumed) {+diff --git a/steamvr/native_panels_test.cpp b/steamvr/native_panels_test.cpp+index b55d252..46f4177 100644+--- a/steamvr/native_panels_test.cpp++++ b/steamvr/native_panels_test.cpp+@@ -2,6 +2,7 @@+ #include "npc_dialogue.h"+ #include "panel_input_mode.h"+ #include "menu_controls.h"++#include "pad_mirror_policy.h"+ #include "quick_cast.h"+ #include "journal.h"+ #include "input.h"+@@ -11,6 +12,54 @@+ using namespace framevr;+ static void Check(bool ok,const char* message){if(!ok){std::fprintf(stderr,"FAIL: %s\n",message);std::exit(1);}}+ int main(){++ BWPadMirror source{};source.version=BW_PAD_MIRROR_VERSION;source.writer_pid=42;++ source.counter=123;source.reserved[0]=uint32_t(menus::Mode::Native);source.reserved[1]=7;++ source.buttons=menus::A;source.left_trigger=200;source.right_trigger=255;++ source.thumb_lx=12000;source.thumb_ly=-15000;source.thumb_rx=22000;source.thumb_ry=-24000;++ BWPadMirror copied{};++ Check(menus::CopyMirror(source,true,42,copied)&&copied.buttons==menus::A,"fresh mirror preserves input");++ Check(menus::CopyMirror(source,false,42,copied),"internal pad stays connected through loading");++ Check(!copied.buttons&&!copied.left_trigger&&!copied.right_trigger&&!copied.thumb_lx&&!copied.thumb_ly&&!copied.thumb_rx&&!copied.thumb_ry,"loading releases every control");++ Check(copied.counter==123&&copied.reserved[1]==7,"neutral mirror retains packet and epoch");++ Check(!menus::CopyMirror(source,false,99,copied),"stale external pad disconnects");++ Check(menus::CopyMirror(source,true,99,copied),"fresh external pad remains supported");++ source.reserved[0]=0;++ Check(!menus::CopyMirror(source,false,42,copied),"untagged writer retains timeout");++ source.version=0;++ Check(!menus::CopyMirror(source,true,42,copied),"unknown mirror version rejected");++ menus::TitleAccept titleAccept;++ menus::Pad accept;accept.buttons=menus::A;++ Check(!titleAccept.Step(true,true,accept),"held input on attachment cannot skip title");++ menus::Pad released;++ titleAccept.Step(true,true,released);++ Check(titleAccept.Step(true,true,accept)&&accept.buttons==0,"fresh title A becomes one window accept");++ accept.buttons=menus::A;++ Check(!titleAccept.Step(true,false,accept)&&accept.buttons==0,"held title A cannot play selected character");++ titleAccept.Step(true,false,released);accept.buttons=menus::A;++ Check(!titleAccept.Step(true,false,accept)&&accept.buttons==menus::A,"next A uses native character selection");++ titleAccept.Step(false,true,released);accept.buttons=menus::Start;++ Check(!titleAccept.Step(false,true,accept),"inactive VR cannot post a title key");++++ // Simulator owns desktop focus while the anchored title/class picker consumes XInput.++ for(bool focused:{false,true})for(bool frontend:{false,true})for(bool placed:{false,true}) {++ menus::Navigation nav;++ menus::Pad stick;stick.lx=24000;++ const bool active=menus::NavigationActive(placed,focused,frontend);++ Check(active==(placed&&(focused||frontend)),"front-end navigation focus policy");++ auto report=nav.Step(active,stick,false,0,0,false);++ Check((report.lx==24000)==active,"only anchored front-end pad bypasses desktop focus");++ menus::Pad accept;accept.buttons=menus::A;++ report=nav.Step(active,accept,false,0,0,false);++ Check(bool(report.buttons&menus::A)==active,"class selection A reaches native UI without a laser hit");++ report=nav.Step(active,{},false,0,0,false);++ Check(!menus::Busy(report),"A release reaches native UI while simulator retains focus");++ Check(menus::Allowed(uint32_t(menus::Mode::Native),7,7,true,false),"front-end mirror accepts Native tag");++ Check(!menus::Allowed(uint32_t(menus::Mode::Native),7,8,true,false),"stale character panel epoch is rejected");++ panels::MouseGate mouse;++ Check(mouse.Step(placed&&focused,true,true,false).press[0]==(placed&&focused),++ "front-end exemption never injects a background mouse click");++ }+++ for(int preset=0;preset<3;++preset)for(bool main:{false,true}) {+ const float distance=panels::MenuDistance(preset,main);+ Check(std::fabs(distance-(main?.70f:.55f)-.30f*preset)<.00001f,"distance presets add 30 cm without changing canvas scale");+diff --git a/steamvr/pad_mirror_policy.h b/steamvr/pad_mirror_policy.h+new file mode 100644+index 0000000..7e57d71+--- /dev/null++++ b/steamvr/pad_mirror_policy.h+@@ -0,0 +1,18 @@++#pragma once++#include "../external/bodywalk/pad_mirror_shared.h"++#include "menu_controls.h"++++namespace framevr::menus {++// Internal XR publication can pause during loading. Keep that virtual device++// connected, but release every control. External writers still time out.++inline bool CopyMirror(const BWPadMirror& source,bool fresh,uint32_t owner,BWPadMirror& out) {++ if(source.version!=BW_PAD_MIRROR_VERSION)return false;++ if(!fresh&&(source.writer_pid!=owner||!Tagged(source.reserved[0])))return false;++ out=source;++ if(!fresh) {++ out.buttons=0;out.left_trigger=out.right_trigger=0;++ out.thumb_lx=out.thumb_ly=out.thumb_rx=out.thumb_ry=0;++ }++ return true;++}++}+diff --git a/steamvr/panel_atlas.h b/steamvr/panel_atlas.h+index 2ac7138..6141f4a 100644+--- a/steamvr/panel_atlas.h++++ b/steamvr/panel_atlas.h+@@ -1,5 +1,6 @@+ #pragma once+ #include "arcane_decay.h"++#include "frontend_controls.h"+ #include "blood_screen.h"+ #include "bow_laser.h"+ #include "glyph_trail.h"+@@ -58,7 +59,8 @@ constexpr Region Strain{Blood.x+Blood.w+Gap,Blood.y,strain::Size,strain::Size};+ constexpr Region Notice{Strain.x+Strain.w+Gap,Blood.y,notice::Width,notice::Height};+ constexpr Region BowLaser{Notice.x+Notice.w+Gap,Blood.y,bowlaser::AtlasWidth,bowlaser::AtlasHeight};+ constexpr Region ArcaneDecay{Strain.x,Strain.y+Strain.h+Gap,arcane::Size,arcane::Size};+-constexpr int SharedWidth=2048,SharedHeight=Blood.y+Blood.h;++constexpr Region Frontend{0,Blood.y+Blood.h+Gap,frontend::Width,frontend::Height};++constexpr int SharedWidth=2048,SharedHeight=Frontend.y+Frontend.h;++ constexpr bool Inside(Region r,int width,int height){return r.x>=0&&r.y>=0&&r.w>0&&r.h>0&&r.x+r.w<=width&&r.y+r.h<=height;}+ // Apart by at least Gap texels on one axis.+diff --git a/steamvr/panel_atlas_test.cpp b/steamvr/panel_atlas_test.cpp+index 93594b2..ff7feaf 100644+--- a/steamvr/panel_atlas_test.cpp++++ b/steamvr/panel_atlas_test.cpp+@@ -10,7 +10,7 @@ int main() {+ Respec(0),Respec(1),Respec(2),Respec(3),Respec(4),Respec(5),Respec(6),Respec(7)};+ constexpr int Statics=int(sizeof statics/sizeof statics[0]);+ static_assert(Statics==6+RespecPictures,"every static picture checked");+- const Region shared[]={Settings,Blood,Strain,Notice,BowLaser,ArcaneDecay,Glyph};++ const Region shared[]={Settings,Blood,Strain,Notice,BowLaser,ArcaneDecay,Glyph,Frontend};+ constexpr int Shared=int(sizeof shared/sizeof shared[0]);+ for(const auto& r:statics)assert(Inside(r,StaticWidth,StaticHeight));+ for(const auto& r:shared)assert(Inside(r,SharedWidth,SharedHeight));+diff --git a/steamvr/transport.cpp b/steamvr/transport.cpp+index 7710bd9..27f1dca 100644+--- a/steamvr/transport.cpp++++ b/steamvr/transport.cpp+@@ -48,6 +48,7 @@+ #include "interaction_ui.h"+ #include "sewer_prompt_art.h"+ #include "notice_card_art.h"++#include "frontend_controls_art.h"+ #include "arcane_decay.h"+ #include "glyph_cast.h"+ #include "glyph_trail.h"+@@ -120,7 +121,7 @@++ namespace gamestate {uint32_t WeaponType();uint32_t HandsKey();uint32_t WeaponSet();uint32_t WeaponClass();uint32_t TwoHanded();uint64_t LocalPlayer();uint32_t MenuEpoch();}+ namespace gamecmd {void RequestPotion(int slot);void CancelPotion();}+-namespace gamestate {void MenuMap(bool wanted);uint32_t QuestNotices();bool NoticePanelOpen();bool NoticeText(int kind,char* out,uint32_t size);}++namespace gamestate {void MenuMap(bool wanted);uint32_t QuestNotices();bool NoticePanelOpen();bool TitleScreenOpen();int FrontendScreen();void FrontendPad();bool NoticeText(int kind,char* out,uint32_t size);}+ namespace gamestate {bool LeftShield();bool RightThrowingPotion();uint32_t RightThrowingPotionCode();framevr::dualwield::Equipment MeleeEquipment();}+ namespace combat {float GameVolume();}+ namespace projectiles {int ObservedGait(uint64_t& at,bool* tired);void StickFullRun(bool on);}+@@ -146,6 +147,7 @@ XR_FUNCTIONS(DECLARE)+ PFN_xrGetInstanceProcAddr getProc=nullptr;+ HMODULE loader=nullptr;+ bool wineOpenXR=false;++bool oxrsysRuntime=false;+ // Frame generation (frame_generation.h): the settings now, packed as+ // mode*100+preset*10+scale (-1 before the INI is read), how this instance+ // started with OFXR Bridge and the layer's control API while it is loaded.+@@ -265,6 +267,11 @@ bool glyphDrawClear=false; // a game skill was put on the draw button: draw_sl+ // Quest / level-up notices: a card standing in the room for a few seconds+ // instead of the native panel at the eyes (notice_card.h). Each card is+ // painted once, in the background, when it comes up.++frontend::Controls frontendControls;++LatestWorker<frontend::Controls,std::vector<uint8_t>> frontendPainter(frontend::Paint);++uint64_t frontendPaintRequest=0;++int frontendPaintKey=-1;++bool frontendAtlasPending=false,frontendImageReady=false;+ struct NoticeJob {char text[256]{};};+ LatestWorker<NoticeJob,std::vector<uint8_t>> noticePainter([](const NoticeJob& job) {+ std::vector<uint8_t> pixels;notice::Paint(job.text,pixels);return pixels;+@@ -835,6 +842,7 @@ elements::Scene elementalScene;+ panels::MouseGate panelMouse;+ menus::ReleaseGate menuControls;+ menus::Navigation menuNavigation;++menus::TitleAccept titleAccept;+ menus::Pad nativeMenuPad;+ menus::LaserClick laserClick;+ panels::ScrollGate panelScroll;+@@ -1084,7 +1092,7 @@ void ClearInput() {+ wristHeading.Reset();compassFrame=false;mapZoom.Reset();wristMapLooked=false;+ panelinput::WorldInput(false);+ gamestate::MenuMap(false);+- menuControls.Suspend();menuNavigation.Reset();nativeMenuPad={};laserClick={};panelinput::UseController();++ menuControls.Suspend();menuNavigation.Reset();titleAccept={};nativeMenuPad={};laserClick={};panelinput::UseController();+ statsPress.Reset();statsShown=statsLit=false;menuDrop.Reset();+ handControls.Suspend();+ bodyCalibration.Suspend();+@@ -1347,6 +1355,7 @@ bool LoadFunctions() {+ XrInstanceProperties props{XR_TYPE_INSTANCE_PROPERTIES};pGetInstanceProperties(instance,&props);+ char b[192];std::snprintf(b,sizeof b,"Frame OpenXR: runtime %s",props.runtimeName);Say(b);+ runtimeVdxr.store(std::strstr(props.runtimeName,"VirtualDesktop")!=nullptr);++ oxrsysRuntime=std::strstr(props.runtimeName,"OXRSys")!=nullptr;+ XrSystemGetInfo si{XR_TYPE_SYSTEM_GET_INFO};si.formFactor=XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY;+ if(!Check(pGetSystem(instance,&si,&system),"get headset system"))return false;+ XrSystemProperties limits{XR_TYPE_SYSTEM_PROPERTIES};+@@ -1617,6 +1626,7 @@ std::vector<uint8_t> PaintPointer() {+ const float radius=std::hypot((x-31.5f)/30.f,(y-63.5f)/30.f);+ p[3]=y<32?200:uint8_t(std::clamp((1-radius)*10,0.f,1.f)*255);+ }++ pixels[(32*64)*4]=pixels[(32*64)*4+1]=pixels[(32*64)*4+2]=0; // transparent black backdrop texel+ return pixels;+ }+ // Static text atlas: painted once, never repainted in the frame loop; empty if+@@ -1731,6 +1741,7 @@ bool SetupStatic(DXGI_FORMAT eyeFormat) {+ if(!bloodPainter.Start())Say("Frame blood visor: background painter unavailable; blood stays hidden");+ if(!arcanePainter.Start())Say("Frame arcane decay: background painter unavailable; arcane warning stays hidden");+ if(!glyphPainter.Start())Say("Frame glyph: background painter unavailable; glyph trails stay hidden");++ if(!frontendPainter.Start())Say("Frame front-end: keyboard painter unavailable");+ if(!noticePainter.Start())Say("Frame notices: background painter unavailable; quest and level-up cards stay hidden");+ if(!strainPainter.Start())Say("Frame guard strain: background painter unavailable; the light stays hidden");+ if(!settingsPainter.Start())Say("Frame VR settings: background painter unavailable; VR Settings and calibration cannot be shown");+@@ -1958,11 +1969,14 @@ void MenuPointer(const menus::Pad& controls) {+ if(settingsModel.open||bodyCalibration.Active()||calibrationRelease.blocked){panelinput::ItemHover(false);menuDrop.Reset();respecShown=false;respecButton.Hide();return;}+ const bool spatialReady=spatialMode&&SurfacePlaced()&&uiCrop[2]>0;+ const bool uiActive=(panelMode&&menuPlaced)||spatialReady;++ const bool frontend = panelMode && !(inWorld && inWorld());++ if(frontend&&uiActive)gamestate::FrontendPad();+ const auto surfacePose=spatialMode?UiSurfacePose():menuPose;+ const auto surface=spatialMode?UiSurfaceSize():panels::Fit(width,height,panelWidth);+ const bool pressed=controls.rt>140;+ bool focused=gameWindow&&GetForegroundWindow()==gameWindow;+- if(uiActive&&menus::Busy(controls)&&!focused)focused=FocusGameForUi();++ // Front-end pad reports do not need OS focus; leave simulator key releases with it.++ if(uiActive&&!frontend&&menus::Busy(controls)&&!focused)focused=FocusGameForUi();+ XrSpaceLocation aim{XR_TYPE_SPACE_LOCATION};+ const auto flags=XR_SPACE_LOCATION_POSITION_VALID_BIT|XR_SPACE_LOCATION_ORIENTATION_VALID_BIT|+ XR_SPACE_LOCATION_POSITION_TRACKED_BIT|XR_SPACE_LOCATION_ORIENTATION_TRACKED_BIT;+@@ -2047,10 +2061,41 @@ void MenuPointer(const menus::Pad& controls) {+ menus::Pad navigation=controls;+ if(leatherMode&&leatherShown.load())navigation.lx=navigation.ly=navigation.rx=navigation.ry=0;+ if(onButton||statsPress.Held()||respecPress.Held()||dropOwns)navigation.rt=0; // a button's or the drop's trigger is never the game's RT+- nativeMenuPad=menuNavigation.Step(uiActive&&focused,navigation,pointerHit&&!onButton,hit.u,hit.v,mouseDown||rightMouseDown);++ nativeMenuPad=menuNavigation.Step(menus::NavigationActive(uiActive,focused,frontend),navigation,pointerHit&&!onButton,hit.u,hit.v,mouseDown||rightMouseDown);++ if(titleAccept.Step(oxrsysRuntime&&frontend&&uiActive,gamestate::TitleScreenOpen(),nativeMenuPad)) {++ if(gameWindow) {++ PostMessageW(gameWindow,WM_KEYDOWN,VK_RETURN,0x001c0001);++ PostMessageW(gameWindow,WM_KEYUP,VK_RETURN,0xc01c0001);++ Say("Frame panels: title accept posted to game window; desktop focus unchanged");++ }++ }++ const int frontendScreen=frontend&&uiActive?gamestate::FrontendScreen():0;++ if(frontendScreen!=frontendControls.screen){char line[100];std::snprintf(line,sizeof line,"Frame front-end: screen %d (list=1 classes=2 name=3)",frontendScreen);Say(line);}++ const auto entry=frontendControls.Step(frontendScreen,nativeMenuPad,GetTickCount64());++ nativeMenuPad=entry.pad;++ if(gameWindow&&entry.back) {++ PostMessageW(gameWindow,WM_KEYDOWN,VK_ESCAPE,0x00010001);++ PostMessageW(gameWindow,WM_KEYUP,VK_ESCAPE,0xc0010001);++ Say("Frame front-end: B opened native exit confirmation; desktop focus unchanged");++ }++ if(gameWindow&&(entry.text||entry.erase)) {++ PostMessageW(gameWindow,frontend::NameKeyMessage,entry.erase?8:entry.text,0);++ Say(entry.erase?"Frame name keyboard: erase sent":"Frame name keyboard: character sent");++ }++ if(frontendControls.Visible()) {++ const int key=frontendScreen*100+frontendControls.selected+(frontendControls.upper?1000:0);++ if(key!=frontendPaintKey) {++ frontendPaintRequest=frontendPainter.Submit(frontendControls);frontendPaintKey=key;++ }++ std::vector<uint8_t> painted;++ if(frontendPaintRequest&&!frontendAtlasPending&&atlasUploads.size()<3&&frontendPainter.Take(frontendPaintRequest,painted)) {++ if(!painted.empty())UploadShared(panelatlas::Frontend,painted,&frontendAtlasPending);++ frontendPaintRequest=0;++ }++ } else {frontendPaintKey=-1;frontendImageReady=false;}+ if(statsPress.Held())nativeMenuPad.buttons|=menus::Back; // View: Advanced Stats (Start closes the menu)+ if(menuDrop.Down())nativeMenuPad.buttons|=menus::X; // X: the controller menu's Drop for the item on the cursor+- if(wasNative!=menuNavigation.Native()&&uiActive&&focused)++ if(wasNative!=menuNavigation.Native()&&menus::NavigationActive(uiActive,focused,frontend))+ Say(menuNavigation.Native()?"Frame panels: native controller navigation":"Frame panels: laser navigation");+ const bool laser=!menuNavigation.Native();+ if(!laser){panelinput::UseController();pointerVisible=pointerHit=false;}+@@ -3218,7 +3263,7 @@ void Input() {+ }+ settingsOwned=settingsOwned||settingsModel.open;+ bool focused=gameWindow&&GetForegroundWindow()==gameWindow;+- if(!settingsOwned&&(menuPressed||inventoryPressed)&&!focused)focused=FocusGameForUi();++ if(!settingsOwned&&!(panelMode&&!(inWorld&&inWorld()))&&(menuPressed||inventoryPressed)&&!focused)focused=FocusGameForUi();+ if(heldKeyScan&&(!focused||GetTickCount64()>=keyReleaseAt))ReleaseUiKey();+ if(!settingsOwned&&!nativeUi&&focused&&menuPressed)PulseUiKey(VK_ESCAPE);+ if(!settingsOwned&&(!nativeUi||gripMenuPressed)&&inventoryPressed&&inWorld&&inWorld()) {+@@ -5864,11 +5909,11 @@ void EndPair() {+ // The shared panels' pictures uploaded this frame, all in one copy (panelatlas).+ if(sharedDirty) {+ const bool flushed=FlushShared();+- for(auto* p:{&settingsAtlasPending,&bloodAtlasPending,&strainAtlasPending,&bowLaserAtlasPending,¬iceAtlasPending,&arcaneAtlasPending,&glyphAtlasPending})if(*p) {++ for(auto* p:{&settingsAtlasPending,&bloodAtlasPending,&strainAtlasPending,&bowLaserAtlasPending,¬iceAtlasPending,&arcaneAtlasPending,&glyphAtlasPending,&frontendAtlasPending})if(*p) {+ *p=false;+ if(p==&settingsAtlasPending)settingsImageReady=flushed;else if(p==&bloodAtlasPending)bloodImageReady=flushed;+ else if(p==&strainAtlasPending)strainImageReady=flushed;else if(p==&bowLaserAtlasPending)bowLaserImageReady=flushed;+- else if(p==&arcaneAtlasPending)arcaneImageReady=flushed;else if(p==&glyphAtlasPending)glyphImageReady=flushed;else noticeImageReady=flushed;++ else if(p==&arcaneAtlasPending)arcaneImageReady=flushed;else if(p==&glyphAtlasPending)glyphImageReady=flushed;else if(p==&frontendAtlasPending)frontendImageReady=flushed;else noticeImageReady=flushed;+ }+ }+ // The native menus closed short of swapchains: their surface goes back for the map.+@@ -5889,9 +5934,18 @@ void EndPair() {+ // [interactions] leather_world=0: the leather against the same black (a test fallback).+ const bool blackMenu=((opaqueMenuMode&&workspacePlaced)||(leatherMode&&!leatherShown.load()&&leatherHolder.Placed()))&&+ uiEye.copied&&uiCrop[2]>0&&!settingsModel.open&&!bodyCalibration.Active();++ XrCompositionLayerProjection backdrop{XR_TYPE_COMPOSITION_LAYER_PROJECTION};++ XrCompositionLayerProjectionView backdropEyes[2]{};++ const bool menuBackdrop=oxrsysRuntime&&pointerChain&&render&&valid&&++ (blackMenu||(layer&&layer->type==XR_TYPE_COMPOSITION_LAYER_QUAD));++ if(menuBackdrop) {++ composition::BlackBackdrop(backdrop,backdropEyes,views.data(),space,pointerChain,{panelatlas::Pointer.x,panelatlas::Pointer.y+32});++ layers[count++]=reinterpret_cast<const XrCompositionLayerBaseHeader*>(&backdrop);++ static bool told=false;if(!told){told=true;Say("Frame OpenXR: black projection backdrop for OXRSys quad menus");}++ }+ if(layer&&!blackMenu)layers[count++]=layer;+ const uint32_t capacity=std::min(uint32_t(layers.size()),layerLimit);+- const bool padQuads=composition::NeedsQuadPadding(wineOpenXR,layer,pointerChain);++ const bool padQuads=composition::NeedsQuadPadding(wineOpenXR,count?layers[0]:nullptr,pointerChain);+ const uint32_t contentLimit=padQuads&&capacity>1?capacity-1:capacity;+ XrCompositionLayerQuad palette{XR_TYPE_COMPOSITION_LAYER_QUAD},bottle{XR_TYPE_COMPOSITION_LAYER_QUAD},chosen{XR_TYPE_COMPOSITION_LAYER_QUAD};+ std::array<XrCompositionLayerQuad,2> arrow{{{XR_TYPE_COMPOSITION_LAYER_QUAD},{XR_TYPE_COMPOSITION_LAYER_QUAD}}};+@@ -6031,6 +6085,13 @@ void EndPair() {+ // dialogue surfaces; opaque menus, the leather and VR Settings hold it back.+ // The mod's own message also shows over the flat menu panel and the+ // leather (VR Settings opened from the title screen could not draw).++ XrCompositionLayerQuad frontendQuad{XR_TYPE_COMPOSITION_LAYER_QUAD};++ if(frontendControls.Visible()&&frontendImageReady&&sharedChain&&layer&&panelMode&&!settingsModel.open&&!bodyCalibration.Active()) {++ auto pose=menuPose;++ const auto p=V(pose.position)+math::Rotate(Q(pose.orientation),{0,-.48f,.08f});++ pose.position={p.x,p.y,p.z};++ motionQuad(frontendQuad,pose,1.12f,1.12f*frontend::Height/frontend::Width,Rect(panelatlas::Frontend),sharedChain);++ }+ XrCompositionLayerQuad noticeQuad{XR_TYPE_COMPOSITION_LAYER_QUAD};+ const bool noticeMessage=noticeCard.kind==notice::Message;+ if(noticeImageReady&&sharedChain&¬iceCard.kind>=0&¬icePaintedSequence==noticeCard.sequence&&+@@ -6797,7 +6858,7 @@ void Shutdown(bool preserveResolution) {+ if(!preserveResolution)hud::NativeSession(false);+ if(!preserveResolution)resolution::Restore();+ windowFocus.Cancel();+- EndPair();ClearInput();interactionPainter.Stop();bloodPainter.Stop();arcanePainter.Stop();glyphPainter.Stop();strainPainter.Stop();noticePainter.Stop();settingsPainter.Stop();turnCompiler.Stop();interaction::icons::Shutdown();++ EndPair();ClearInput();interactionPainter.Stop();bloodPainter.Stop();arcanePainter.Stop();glyphPainter.Stop();strainPainter.Stop();noticePainter.Stop();frontendPainter.Stop();settingsPainter.Stop();turnCompiler.Stop();interaction::icons::Shutdown();+ // Completion is mandatory before destroying our commands/resources, even+ // when ordinary frame submission uses queue ordering without a CPU wait.+ if(fence&&!WaitGpu())failed=true;+@@ -6820,6 +6881,7 @@ void Shutdown(bool preserveResolution) {+ arcaneController.Reset();arcaneOutput={};arcanePaintKey=~0ull;arcanePaintSession=0;arcanePaintAt=0;arcaneAtlasPending=arcaneImageReady=false;+ glyphStroke={};glyphCast={};glyphPaintKey=glyphShownStroke=0;glyphBeganAt=0;glyphEndedAt=-1;glyphPaintAt=0;glyphLook=glyphtrail::Look::Drawing;glyphPressRt=glyphTrailShown=false;glyphAtlasPending=glyphImageReady=false;+ bowLaserHue=-1;bowLaserAtlasPending=bowLaserImageReady=false;++ frontendControls={};frontendPaintKey=-1;frontendPaintRequest=0;frontendAtlasPending=frontendImageReady=false;+ noticeWatch={};noticeCards.Clear();noticeCard={};noticePaintRequest=noticeRequestedSequence=noticePaintedSequence=0;noticeAtlasPending=noticeImageReady=false;+ heartStream.Stop();heartPlaying=false;heartLevel.Reset();heartAt=0;heartHush.Reset();heartHealth=-1;+ guardStrain.Reset();strainOutput={};strainPaintKey=~0ull;strainPaintSession=0;strainPaintAt=0;strainAtlasPending=strainImageReady=strainSlotReported=false;+diff --git a/vr/gamestate.cpp b/vr/gamestate.cpp+index 1251de1..8fd4589 100644+--- a/vr/gamestate.cpp++++ b/vr/gamestate.cpp+@@ -337,6 +337,9 @@ std::atomic<bool> g_respecButton{false}; // its Character page alone: Reset Ski+ std::atomic<uint32_t> g_panelChanges{0}; // every panel opened or closed (leather::Back)+ std::atomic<bool> g_npcChoices{false};+ std::atomic<uint32_t> g_questNotices{0}; // quest updates while the notification panel is hidden++std::atomic<bool> g_titlePanel{false};++std::atomic<int> g_frontend{0}; // 1 list, 2 classes, 3 name++std::atomic<uint64_t> g_frontendPadAt{0};+ std::atomic<bool> g_noticePanel{false}; // the native NotificationPanel is open (hidden or not)+ std::mutex noticeMutex;+ char noticeTexts[framevr::notice::Kinds][256]{};+@@ -698,6 +701,9 @@ void __cdecl ReadItems(const PluginContext* ctx, void* token) noexcept {+ #ifdef D2RVR_NATIVE_OPENXR+ respec::Poll(); // Reset Skills & Stats: the minted token's native use (respec.cpp)+ panelinput::MaintainWorldController(havePlayer,g_menu.load()!=0);++ const auto frontendAt=g_frontendPadAt.load();++ if(!havePlayer&&g_frontend.load()>0&&g_frontend.load()<3&&frontendAt&&GetTickCount64()-frontendAt<400)++ panelinput::ControllerReady();+ MaintainToolbar(ctx);+ ReadNoticeTexts();+ const auto now=GetTickCount64(),mapAt=g_menuMapAt.load();+@@ -890,7 +896,17 @@ SharedEvents::UiMessageAction __cdecl OnUiMessage(const PluginContext* ctx, cons+ snprintf(b, sizeof b, "gamestate: ui message '%s' '%s' text '%.80s'", target, command, text);+ Log(b);+ }++ if(!strcmp(target,"CharacterCreate")) {++ if(!strcmp(command,"Select"))g_frontend=3;++ else if(!strcmp(command,"Unselect"))g_frontend=2;++ }+ if (strcmp(target, "PanelManager") == 0) {++ const bool opening=!strcmp(command,"OpenPanel")||!strcmp(command,"OpenExclusivePanel");++ if(opening&&!strcmp(text,"MainMenuPanel"))g_frontend=1;++ else if(opening&&!strcmp(text,"CharacterCreatePanel"))g_frontend=2;++ else if(opening&&!strcmp(text,"TitleScreenPanel"))g_frontend=0;++ else if((!strcmp(command,"UnloadPanel")||!strcmp(command,"ClosePanel"))&&++ ((!strcmp(text,"MainMenuPanel")&&g_frontend==1)||(!strcmp(text,"CharacterCreatePanel")&&g_frontend>=2)))g_frontend=0;+ const bool before = g_menu.load() != 0;+ if (!strcmp(command, "OpenPanel") || !strcmp(command, "OpenExclusivePanel")) { if (*text) g_panels.insert(text); }+ else if (!strcmp(command, "ClosePanel") || !strcmp(command, "UnloadPanel")) g_panels.erase(text);+@@ -899,6 +915,7 @@ SharedEvents::UiMessageAction __cdecl OnUiMessage(const PluginContext* ctx, cons+ !strcmp(command, "UnloadPanel") || !strcmp(command, "UnloadAll") || !strcmp(command, "CloseAll")) g_panelChanges.fetch_add(1);+ g_autoMap.store(g_panels.count("AutoMap") ? 1 : 0);+ framevr::fullmap::g_panel.store(g_panels.count("AutoMap") != 0);++ g_titlePanel.store(g_panels.count("TitleScreenPanel") != 0);+ g_noticePanel.store(g_panels.count("NotificationPanel") != 0);+ g_upperBandMenu.store(std::any_of(g_panels.begin(),g_panels.end(),+ [](const auto& name){return framevr::panels::UpperBand(name);}));+@@ -1122,6 +1139,9 @@ int ObjectLight(uint32_t txt, uint32_t mode, float rgb[3]) {+ }++ uint32_t QuestNotices(){return g_questNotices.load();}++int FrontendScreen(){return g_menu.load()?0:g_frontend.load();}++void FrontendPad(){g_frontendPadAt=GetTickCount64();}++bool TitleScreenOpen(){return g_titlePanel.load();}+ bool NoticePanelOpen(){return g_noticePanel.load();}+ bool NoticeText(int kind,char* out,uint32_t size) {+ if(kind<0||kind>=framevr::notice::Kinds||!out||!size)return false;+diff --git a/vr/vrcam.cpp b/vr/vrcam.cpp+index 6dcd253..a151351 100644+--- a/vr/vrcam.cpp++++ b/vr/vrcam.cpp+@@ -21,6 +21,8 @@+ #ifndef NOMINMAX+ #define NOMINMAX+ #endif++#include "../steamvr/frontend_controls.h"++namespace gamestate {int FrontendScreen();}+ #include <windows.h>+ #include "pcvr_identity.h"+ #include "pcvr_mod_layout.h"+@@ -114,6 +116,7 @@ namespace gamestate {bool RunOnUi(D2RL::Threads::Callback callback);}+ #include "light_bounds.h"+ #include "game_device_only.h"+ #include "menu_controls.h"++#include "pad_mirror_policy.h"+ #include "xinput_rumble.h"+ #include "native_panels.h"+ #include "spell_aim.h"+@@ -4451,9 +4454,18 @@ bool PadMirrorRead(BWPadMirror* out) {+ static std::atomic<ULONGLONG> movedAt{0};+ const BWPadMirror m = *p;+ if (m.counter != seen.load()) { seen.store(m.counter); movedAt.store(GetTickCount64()); }+- if (m.version != BW_PAD_MIRROR_VERSION || GetTickCount64() - movedAt.load() > 1000) return false;+- *out = m;+- return true;++ const bool fresh=GetTickCount64()-movedAt.load()<=1000;++#ifdef D2RVR_NATIVE_OPENXR++ const bool available=framevr::menus::CopyMirror(m,fresh,GetCurrentProcessId(),*out);++ if(available&&!fresh) {++ static std::atomic<bool> told{false};++ if(!told.exchange(true))Log("Frame input: XR publication paused; virtual pad connected with neutral controls");++ }++ return available;++#else++ if(m.version!=BW_PAD_MIRROR_VERSION||!fresh)return false;++ *out=m;return true;++#endif+ }++ bool PadFromBodyWalk(XINPUT_STATE* s, BWPadMirror* report=nullptr) {+@@ -5962,6 +5974,30 @@ void HookCursor() {+ // and panels on them) - but not while the chat line is open: then they are+ // letters, and every other key goes to the game anyway.+ LRESULT CALLBACK GameWndProc(HWND h, UINT msg, WPARAM w, LPARAM l) {++#ifdef D2RVR_NATIVE_OPENXR++ // Use the native key-down/TranslateMessage path for text entry. Scope the++ // virtual keyboard's modifiers to this UI thread and this one native call.++ // No desktop focus or system-wide key state is changed.++ if(msg==framevr::frontend::NameKeyMessage) {++ if(g_set.platform.load()!=1||g_inWorld.load()||gamestate::FrontendScreen()!=3)return 0;++ const SHORT mapping=w==8?VK_BACK:VkKeyScanW(wchar_t(w));++ if(mapping==-1)return 0;++ BYTE saved[256]{};if(!GetKeyboardState(saved))return 0;++ BYTE keys[256];std::memcpy(keys,saved,sizeof keys);++ for(int key:{VK_SHIFT,VK_LSHIFT,VK_RSHIFT,VK_CONTROL,VK_LCONTROL,VK_RCONTROL,VK_MENU,VK_LMENU,VK_RMENU,VK_CAPITAL})keys[key]=0;++ if(mapping&0x100)keys[VK_SHIFT]=keys[VK_LSHIFT]=0x80;++ const auto key=BYTE(mapping);keys[key]=0x80;SetKeyboardState(keys);++ const LPARAM scan=LPARAM(MapVirtualKeyW(key,MAPVK_VK_TO_VSC))<<16;++ MSG keyMessage{};keyMessage.hwnd=h;keyMessage.message=WM_KEYDOWN;keyMessage.wParam=key;keyMessage.lParam=scan|1;++ TranslateMessage(&keyMessage);++ panelinput::Typed(0);++ Log("Frame name keyboard: native key translated on window thread");++ CallWindowProcW(g_gameWndProc,h,WM_KEYDOWN,key,scan|1);++ keys[key]=0;SetKeyboardState(keys);++ CallWindowProcW(g_gameWndProc,h,WM_KEYUP,key,scan|0xc0000001);++ SetKeyboardState(saved);return 0;++ }++#endif+ #ifdef D2RVR_NATIVE_OPENXR+ LRESULT resolutionResult=0;+ if(framevr::resolution::Handle(h,msg,w,l,g_gameWndProc,resolutionResult))return resolutionResult;diff --git a/resources/d2r-vr.json b/resources/d2r-vr.jsonindex e7833349a7d..661b53c49df 100644--- a/resources/d2r-vr.json+++ b/resources/d2r-vr.json@@ -40,5 +40,15 @@"new": "e91804000090909090","patched_sha256": "77e51ea578f972f7b33a77ab79b807d88975a1b06cb725af8b629dd01a137be5"}+ },+ "mod_patch": {+ "url": "https://github.com/BCD1210/soju/releases/download/vr-mod-v1/d2rl-pcvr-soju.dll",+ "size": 15577088,+ "sha256": "5d88447228efcc7d51288909c252fe0719318bacd6be92a8ef5ae18c9d41812a",+ "patch": "patches/d2r-pcvr/vr-character-create.patch",+ "patch_sha256": "7317ee23b03238b8bff580352d1648da040fccca7cf68d9e9fc3c227994acbbb",+ "base_commit": "70ad0e665952f1bd829176ba461a85ebb974c3f0",+ "source_url": "https://github.com/bearstonem/d2r-pcvr/tree/70ad0e665952f1bd829176ba461a85ebb974c3f0",+ "license": "MPL-2.0; source patch and license in patches/d2r-pcvr; rebuild with scripts/build-vr-mod.py"}}diff --git a/scripts/build-vr-mod.py b/scripts/build-vr-mod.pynew file mode 100644index 00000000000..c6679c62654--- /dev/null+++ b/scripts/build-vr-mod.py@@ -0,0 +1,88 @@+#!/usr/bin/env python3+"""Build the Soju D2R-PCVR patch from local, pinned source checkouts.++No downloads, installation, or game launch. Requires cmake, ninja, and llvm-mingw.+See patches/d2r-pcvr/README.md for preparation and publication.+"""+import argparse+import hashlib+import json+from pathlib import Path+import shutil+import subprocess+import tarfile+import tempfile++ROOT = Path(__file__).resolve().parents[1]+BASE = '70ad0e665952f1bd829176ba461a85ebb974c3f0'+SDKS = {+ 'D2RLoader-PluginSDK': '717f727a0ec52912d1558764345f8fa3453a2bd6',+ 'OpenXR-SDK': '57af7fc61f9f2d492580cb28aab6d0ea59d8d417',+ 'box3d': '8441b4a06d6d09dcfb0b0f704df4d847d1437b92',+}+++def run(*args, **kwargs):+ return subprocess.run(args, check=True, **kwargs)+++def main():+ parser = argparse.ArgumentParser(description=__doc__)+ parser.add_argument('--source', type=Path, required=True, help='D2R-PCVR clone containing the pinned base')+ parser.add_argument('--deps', type=Path, required=True, help='directory of the three upstream SDK checkouts')+ parser.add_argument('--toolchain', type=Path, required=True, help='llvm-mingw-20260616-ucrt-macos-universal directory')+ parser.add_argument('--output', type=Path, default=ROOT / 'dist/vr-mod')+ args = parser.parse_args()+ source, deps, toolchain, out = (p.resolve() for p in (args.source, args.deps, args.toolchain, args.output))+ for name, commit in SDKS.items():+ actual = subprocess.check_output(['git', '-C', str(deps / name), 'rev-parse', 'HEAD'], text=True).strip()+ if actual != commit:+ parser.error(name + ' must be at ' + commit)+ run('git', '-C', str(deps / name), 'diff', '--exit-code', 'HEAD', '--')+ patch = ROOT / 'patches/d2r-pcvr/vr-character-create.patch'+ spec = json.loads((ROOT / 'resources/d2r-vr.json').read_text())['mod_patch']+ if hashlib.sha256(patch.read_bytes()).hexdigest() != spec['patch_sha256']:+ parser.error('source patch differs from the release pin')+ out.mkdir(parents=True, exist_ok=True)+ with tempfile.TemporaryDirectory(prefix='soju-vr-mod-') as work:+ work = Path(work)+ src = work / 'source'+ src.mkdir()+ archive = work / 'base.tar'+ with archive.open('wb') as stream:+ run('git', '-C', str(source), 'archive', BASE, stdout=stream)+ # This archive comes from the exact local Git commit above.+ run('tar', '-xf', str(archive), '-C', str(src))+ run('patch', '-p1', '-i', str(patch), cwd=src)+ cmake_toolchain = work / 'llvm-mingw.cmake'+ prefix = toolchain / 'bin/x86_64-w64-mingw32-'+ cmake_toolchain.write_text(+ 'set(CMAKE_SYSTEM_NAME Windows)\nset(CMAKE_SYSTEM_PROCESSOR AMD64)\n'+ + ''.join(f'set({key} "{prefix}{value}")\n' for key, value in {+ 'CMAKE_C_COMPILER': 'clang', 'CMAKE_CXX_COMPILER': 'clang++',+ 'CMAKE_RC_COMPILER': 'windres'}.items())+ + f'set(CMAKE_FIND_ROOT_PATH "{toolchain}/x86_64-w64-mingw32")\n'+ 'set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n'+ 'set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\nset(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n'+ 'set(CMAKE_C_FLAGS_INIT "-fms-extensions")\nset(CMAKE_CXX_FLAGS_INIT "-fms-extensions")\n'+ 'set(CMAKE_SHARED_LINKER_FLAGS_INIT "-static -static-libgcc -static-libstdc++")\n'+ 'set(CMAKE_EXE_LINKER_FLAGS_INIT "-static")\n')+ run('cmake', '-S', str(src / 'steamvr'), '-B', str(work / 'build'), '-G', 'Ninja',+ '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_TOOLCHAIN_FILE=' + str(cmake_toolchain),+ '-DD2RL_SDK=' + str(deps / 'D2RLoader-PluginSDK'),+ '-DOPENXR_SDK=' + str(deps / 'OpenXR-SDK'), '-DBOX3D_SDK=' + str(deps / 'box3d'))+ run('cmake', '--build', str(work / 'build'), '--target', 'd2rl-pcvr', '-j', '6')+ dll = out / 'd2rl-pcvr-soju.dll'+ shutil.copy2(work / 'build/d2rl-pcvr.dll', dll)+ with tarfile.open(out / 'd2r-pcvr-soju-source.tar.xz', 'w:xz') as tar:+ tar.add(src, arcname='d2r-pcvr-soju-source')+ shutil.copy2(src / 'LICENSE', out / 'LICENSE')+ shutil.copy2(patch, out / patch.name)+ for artifact in sorted(out.iterdir()):+ if artifact.is_file():+ print(artifact.name, artifact.stat().st_size, hashlib.sha256(artifact.read_bytes()).hexdigest())+ print('Builds may differ byte-for-byte. Pin the actual release DLL; publish source alongside it.')+++if __name__ == '__main__':+ main()diff --git a/scripts/d2r-vr.py b/scripts/d2r-vr.pyindex 9dd7bb04477..364c6216534 100644--- a/scripts/d2r-vr.py+++ b/scripts/d2r-vr.py@@ -326,6 +326,7 @@ def setup(refresh=False):runtime_archive = fetch(m['runtime'], 'soju-vr-runtime.tar.xz', 'the VR runtime')python_zip = fetch(m['python'], 'python-embed-amd64.zip', 'Windows Python (python.org)')mod_zip = fetch(m['mod'], 'd2r-pcvr-windows.zip', m['mod']['name'])+ patched_plugin = fetch(m['mod_patch'], 'd2rl-pcvr-soju.dll', 'the VR character creation fix')loader_zip = fetch(m['loader'], m['loader']['file'], 'D2RLoader (d2rloader.net)')reshade_exe = fetch(m['reshade'], 'ReShade_Setup_Addon.exe', 'ReShade (reshade.me)')@@ -335,6 +336,7 @@ def setup(refresh=False):safe_extract_zip(python_zip, VR / 'python')safe_extract_zip(mod_zip, VR / 'mod')mod = VR / 'mod' / m['mod']['folder']+ stage_mod_patch(mod, patched_plugin, m['mod_patch'])deps = VR / 'deps'(deps / 'reshade-6.8').mkdir(parents=True)shutil.copy2(loader_zip, deps / m['loader']['file'])@@ -368,6 +370,7 @@ def setup(refresh=False):tail = [line for line in (result.stdout + result.stderr).splitlines() if line.strip()][-3:]raise VRError('The mod installer stopped: ' + ' | '.join(tail) + ' (log: ' + str(log) + ')')+ shutil.copytree(mod / 'soju-source', game / 'mods' / m['mod']['mod_name'] / 'soju-source', dirs_exist_ok=True)patch_reshade(game / 'mods' / m['mod']['mod_name'] / 'reshade/ReShade64.dll', m['reshade'])if (game / 'd3d12.dll').exists():(game / 'd3d12.dll').rename(off)@@ -378,8 +381,8 @@ def setup(refresh=False):STATE.write_text(json.dumps({'recipe': recipe(m), 'game_build': game_build(BOTTLE),'mod': m['mod']['name']}, indent=2) + '\n')say('D2R VR is set up. Play with: soju vr play')- say('Use an OFFLINE character. Start the OXRSys client on your headset (or the OXRSys Simulator) to see it.')- say('No offline character yet? Make one with the mouse first: soju vr play --flat')+ say('Connect the OXRSys headset/client or Simulator before soju vr play; tracking must be ready before the title screen.')+ say('Create an OFFLINE character in VR: stick-right + A selects New; stick + A chooses a class and types on the VR keyboard.')say('If D2R says you have not been online for 30 days: play D2R online once from Battle.net, ''then run: soju vr setup --refresh (VR characters are kept).')return 0@@ -403,6 +406,25 @@ def status():}+def stage_mod_patch(mod, plugin, spec):+ """Verify before replacing the extracted plugin; the installer backs up installed files."""+ if plugin.stat().st_size != spec['size'] or digest(plugin) != spec['sha256']:+ raise VRError('The VR character creation DLL does not match its pin.')+ source_patch = ROOT / spec['patch']+ if digest(source_patch) != spec['patch_sha256']:+ raise VRError('The VR character creation source patch does not match its pin.')+ shutil.copy2(plugin, mod / 'bin/d2rl-pcvr.dll')+ notice = mod / 'soju-source'+ notice.mkdir(exist_ok=True)+ shutil.copy2(source_patch, notice / source_patch.name)+ shutil.copy2(source_patch.parent / 'LICENSE', notice / 'LICENSE')+ (notice / 'SOURCE.txt').write_text(+ 'D2R-PCVR modifications under MPL-2.0.\n'+ 'Source: ' + spec['source_url'] + '\n'+ 'Base commit: ' + spec['base_commit'] + '\n'+ 'Apply the accompanying patch to this base.\n')++def play_env(flat):env = wine_env(BOTTLE)if not flat:@@ -410,7 +432,7 @@ def play_env(flat):env['OXR_BRIDGE_ENV_FILE'] = str(VR / 'bridge.env')# flat: the OpenXR runtime cannot load, so the mod leaves VR off and the game# uses its normal screen, where the mouse can pick a class on character creation.- # In VR those menus are meant for the controller laser.+ # In VR, stick + A use D2R's native controller character picker.return env@@ -424,6 +446,9 @@ def play(extra, flat=False):env = play_env(flat)if flat:say('Opening the VR copy without VR. Create or check offline characters, then quit and run: soju vr play')+ if not flat:+ say('Connect the OXRSys headset/Simulator before the title screen. Use stick + A for offline character creation.')+ say('Use the VR name keyboard: stick + A types, X erases, Y changes case; select Create + A. B goes back.')os.chdir(BOTTLE / GAME_REL)# -mod keeps D2R offline: no Battle.net game servers.os.execve(str(ENGINE / 'bin/wine'), [str(ENGINE / 'bin/wine'), 'D2RLoader.exe', '-mod',@@ -453,7 +478,7 @@ def main(argv):p.add_argument('--refresh', action='store_true', help='copy the Battle.net bottle again (after a game update)')p = sub.add_parser('play')p.add_argument('--flat', action='store_true',- help='open the VR copy on the Mac screen without VR (to create offline characters)')+ help='open the VR copy on the Mac screen without VR (optional desktop mode)')p = sub.add_parser('status')p.add_argument('--json', action='store_true')p = sub.add_parser('remove')diff --git a/tests/test_d2r_vr.py b/tests/test_d2r_vr.pyindex 06aab162b14..0aa3d7f9b3a 100644--- a/tests/test_d2r_vr.py+++ b/tests/test_d2r_vr.py@@ -16,7 +16,7 @@ spec.loader.exec_module(vr)class ManifestTests(unittest.TestCase):def test_every_download_is_pinned_https(self):m = json.loads((ROOT / 'resources/d2r-vr.json').read_text())- for key in ('runtime', 'python', 'mod', 'loader', 'reshade'):+ for key in ('runtime', 'python', 'mod', 'mod_patch', 'loader', 'reshade'):self.assertTrue(m[key]['url'].startswith('https://'), key)self.assertRegex(m[key]['sha256'], '^[0-9a-f]{64}$', key)self.assertGreater(m[key]['size'], 0, key)@@ -26,6 +26,34 @@ class ManifestTests(unittest.TestCase):self.assertEqual(len(bytes.fromhex(patch['old'])), len(bytes.fromhex(patch['new'])))self.assertRegex(patch['patched_sha256'], '^[0-9a-f]{64}$')+ def test_mod_patch_source_pin(self):+ spec = vr.manifest()['mod_patch']+ self.assertEqual(vr.digest(ROOT / spec['patch']), spec['patch_sha256'])+ self.assertEqual(spec['base_commit'], '70ad0e665952f1bd829176ba461a85ebb974c3f0')++ def test_stage_mod_patch_verifies_before_replacing_and_keeps_source(self):+ with tempfile.TemporaryDirectory() as d:+ base = Path(d)+ mod = base / 'mod'+ (mod / 'bin').mkdir(parents=True)+ target = mod / 'bin/d2rl-pcvr.dll'+ target.write_bytes(b'upstream')+ plugin = base / 'patched.dll'+ plugin.write_bytes(b'patched fixture')+ spec = dict(vr.manifest()['mod_patch'], size=plugin.stat().st_size,+ sha256=vr.digest(plugin))+ vr.stage_mod_patch(mod, plugin, spec)+ self.assertEqual(target.read_bytes(), plugin.read_bytes())+ self.assertEqual(vr.digest(mod / 'soju-source/vr-character-create.patch'), spec['patch_sha256'])+ self.assertIn(spec['base_commit'], (mod / 'soju-source/SOURCE.txt').read_text())+ self.assertTrue((mod / 'soju-source/LICENSE').is_file())+ target.write_bytes(b'keep')+ for bad in (dict(spec, size=1), dict(spec, sha256='0' * 64),+ dict(spec, patch_sha256='0' * 64)):+ with self.assertRaises(vr.VRError):+ vr.stage_mod_patch(mod, plugin, bad)+ self.assertEqual(target.read_bytes(), b'keep')+def test_cli_routes_vr_to_the_script(self):self.assertIn('vr) shift; exec python3 "$ROOT/scripts/d2r-vr.py" "$@" ;;',(ROOT / 'scripts/soju').read_text())diff --git a/tests/test_installation.py b/tests/test_installation.pyindex ed2c6838e41..9245144a64f 100644--- a/tests/test_installation.py+++ b/tests/test_installation.py@@ -329,13 +329,13 @@ class DownloadCheckTests(unittest.TestCase):{"tag_name": "engine-v9", "prerelease": False, "assets": [{"name": "wine-engine-x86_64.tar.xz", "digest": "sha256:" + d}]},{"tag_name": "v2.0.0", "prerelease": True, "assets": [{"name": "Soju-2.0.0-macos-arm64.zip", "digest": "sha256:" + d}]},{"tag_name": "v1.9.0", "prerelease": False, "assets": [{"name": "Soju-1.9.0-macos-arm64.zip", "digest": None}]},- {"tag_name": "v1.9.0", "prerelease": False, "assets": [- {"name": "Soju-1.9.0-macos-arm64.zip.sha256", "digest": "sha256:" + "b" * 64},- {"name": "Soju-1.9.0-macos-arm64.zip", "digest": "sha256:" + d}]},+ {"tag_name": "v1.9.1", "prerelease": False, "assets": [+ {"name": "Soju-1.9.1-macos-arm64.zip.sha256", "digest": "sha256:" + "b" * 64},+ {"name": "Soju-1.9.1-macos-arm64.zip", "digest": "sha256:" + d}]},])self.assertEqual(result.returncode, 0, result.stderr)- self.assertEqual(result.stdout.split(), ["v1.9.0",- "https://github.com/BCD1210/soju/releases/download/v1.9.0/Soju-1.9.0-macos-arm64.zip", d])+ self.assertEqual(result.stdout.split(), ["v1.9.1",+ "https://github.com/BCD1210/soju/releases/download/v1.9.1/Soju-1.9.1-macos-arm64.zip", d])def test_latest_release_fails_without_a_checked_zip(self):result = self.latest([{"tag_name": "v1.0.0", "prerelease": False, "assets": []}])