Skip to content

Fixes for BGSAIWorldLocationRefRadius & LODDistance - #67

Open
frakkin64 wants to merge 3 commits into
Dear-Modding-FO4:masterfrom
frakkin64:for-dmfo4
Open

frakkin64 wants to merge 3 commits into
Dear-Modding-FO4:masterfrom
frakkin64:for-dmfo4

Conversation

@frakkin64

Copy link
Copy Markdown
Contributor

I am not sure how to test these two fixes specifically, but the module compiles and runs in game with OG/AE.

BGSAIWorldLocationRefRadius (AdModuleBGSAIWorldLocationRefRadius.cpp)

  • rsi is the address of the NiPointer<TESObjectREFR>&.
  • Since rsi is a reference, test rsi, rsi checks the wrong thing.
  • The check is now cmp qword[rsi], 0, which tests the _ptr.

LODDistance (AdModuleLODDistance.cpp)

  • NG/AE: the 1-byte 0xEB patch moves from REL::ID(2197513)+0x5B to REL::ID(2213411)+0x64. REL::ID(2197513)+0x5B is BGSMod::Attachment::Mod::GetFilterChance. REL::ID(2213411)+0x64 is the visibility lambda in BGSDistantObjectBlock::UpdateInstanceVisibility.
  • OG: REL::Offset(0x52A80) (xor eax,eax; ret) is replaced with REL::ID(1425899), so it resolves through Address Library. The old RVA was in the middle of BGSMod and was a getter, the new one is SetVisibleDistant. This aligns OG to what the NG/AE patch was doing.

ThisVirtualCall (5-arg overload) (Core/AdUtils.h)

  • The call passed a4 twice (a1, a2, a3, a4, a4, a5), so a5 landed in the wrong slot.
  • It now passes a1..a5 once each.
  • This overloaded form is not used currently.

@Perchik71

Perchik71 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

LOD checks when build mode.. lod one sec draws

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants