Skip to content

Update#3

Open
vinymayan wants to merge 8 commits into
mainfrom
viny
Open

Update#3
vinymayan wants to merge 8 commits into
mainfrom
viny

Conversation

@vinymayan

@vinymayan vinymayan commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

PR Notes

Summary
This branch changes DPF from a form-record cache model into an owner/key registry model. Mods can now request stable dynamic forms by owner and key, recover the same FormID across sessions, and explicitly release owned slots when they are no longer needed.

Behavior

  • DPF now maintains a compact binary registry cache at:
    Data/SKSE/Plugins/DPF_Cache.bin
  • The cache stores only internal registry data:
    owner table, key, localId, and formType.
  • The cache no longer stores full form content.
  • Form content is now the responsibility of the consuming mod.
  • DPF guarantees stable FormID identity, not domain-specific content.
  • Released slots are removed from the registry and may be reused.
  • The allocator tries the lowest available localId after release.
  • On new game, runtime records are cleared, but registry slots can be rebuilt by consumers calling the owner/key API again.

API Changes

  • Added public API header: public/DPFAPI.h.
  • Main owner/key function:
    GetOrCreateByOwnerKey(owner, key, formType, localIdOut, existedOut)
  • Kept:
    Create, Dispose, Track, UnTrack, CreateByType, GetOrCreateByLocalId, GetOrCreateByFormId, ReleaseByOwnerKey, ReleaseByLocalId, ReleaseOwner

Papyrus Changes

  • Papyrus keeps simple:
    GetOrCreateByOwnerKey(owner, key, formType)
  • Papyrus does not expose localId or existed.
  • Kept:
    ReleaseByOwnerKey, ReleaseByLocalId, ReleaseOwner

How Consumers Should Use

  1. Get the DPF API from DynamicPersistentForms.dll.
  2. Check API availability/version.
  3. Pick a stable owner name for the mod.
  4. Pick a stable key for each generated form.
  5. Call GetOrCreateByOwnerKey.
  6. Use the returned form.
  7. If existed is true, DPF recovered an existing slot.
  8. If existed is false, DPF created and registered a new slot.
  9. Apply or reapply all form content every session.
  10. Release unused forms with ReleaseByOwnerKey, ReleaseByLocalId, or ReleaseOwner.

Important Design Difference
DPF now owns persistent identity. Consumer mods own content.

Example:

  • DPF provides same FormID for BookOfPerks + perk:Skyrim.esm|1711E.
  • Book of Perks must still set name, description, model, flags, and perk mapping after retrieving the form.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant