Skip to content

Add missing GetVirtualScreenSize stub to HeadlessWrapper#1789

Merged
LocalIdentity merged 1 commit intoPathOfBuildingCommunity:devfrom
YangLeoZhao:fix/headless-getvirtualscreensize
Apr 25, 2026
Merged

Add missing GetVirtualScreenSize stub to HeadlessWrapper#1789
LocalIdentity merged 1 commit intoPathOfBuildingCommunity:devfrom
YangLeoZhao:fix/headless-getvirtualscreensize

Conversation

@YangLeoZhao
Copy link
Copy Markdown
Contributor

Summary

  • HeadlessWrapper.lua stubs GetScreenSize() and GetScreenScale(), but not GetVirtualScreenSize()
  • Launch.lua calls GetVirtualScreenSize() in DrawPopup() (line 390) and during restart (line 125)
  • When running headless and an error triggers DrawPopup on the first OnFrame, this causes a crash because GetVirtualScreenSize is not yet defined — Modules/Common.lua (where it is normally defined, line 1044) hasn't loaded yet at that point
  • The stub delegates to GetScreenSize() since GetScreenScale() returns 1 (no scaling) in headless mode, matching what the real implementation in Common.lua would produce

Reproduction

  1. Run POB2 headless via HeadlessWrapper.lua
  2. Trigger any code path that calls DrawPopup before Modules/Common.lua is loaded (e.g., an initialization error on the first OnFrame)
  3. Crash: attempt to call global 'GetVirtualScreenSize' (a nil value)

Test plan

  • Verified the fix resolves the crash when running headless
  • Confirmed the return value matches Common.lua's implementation (since GetScreenScale() returns 1, GetVirtualScreenSize() == GetScreenSize())

Launch.lua calls GetVirtualScreenSize() in DrawPopup() and during
restart, but HeadlessWrapper.lua only stubs GetScreenSize() and
GetScreenScale(). When running headless and an error triggers
DrawPopup on the first OnFrame, this causes a crash because
GetVirtualScreenSize is not yet defined (Modules/Common.lua where
it is normally defined hasn't loaded yet).

The stub delegates to GetScreenSize() since GetScreenScale() returns
1 (no scaling) in headless mode, matching what the real implementation
in Common.lua would produce.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@LocalIdentity LocalIdentity added pob1 Should also be merged into PoB1 Repo technical Hidden from release notes labels Apr 25, 2026
@LocalIdentity LocalIdentity merged commit 69b69e2 into PathOfBuildingCommunity:dev Apr 25, 2026
1 of 3 checks passed
LocalIdentity pushed a commit to PathOfBuildingCommunity/PathOfBuilding that referenced this pull request Apr 25, 2026
…9818)

Co-authored-by: YangLeoZhao <YangLeoZhao@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pob1 Should also be merged into PoB1 Repo technical Hidden from release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants