Skip to content

Modifications on DPF#3

Open
vinymayan wants to merge 24 commits into
Thiago099:mainfrom
QTR-Modding:viny
Open

Modifications on DPF#3
vinymayan wants to merge 24 commits into
Thiago099:mainfrom
QTR-Modding:viny

Conversation

@vinymayan

Copy link
Copy Markdown

API Changes

  • Bumped DPF::InterfaceVersion to 4.
  • Preserved the existing vtable order for backwards layout stability.
  • Added ownership-aware slot APIs at the end of the public interface:
    • CreateByTypeForOwner(const char* owner, const char* key, uint32_t formType)
    • GetOrCreateByOwnerKey(const char* owner, const char* key, uint32_t formType)
    • ReleaseByOwnerKey(const char* owner, const char* key)
    • ReleaseByLocalId(uint32_t localId, const char* owner)
    • ReleaseOwner(const char* owner)
  • Added equivalent Papyrus native wrappers for the new ownership APIs.
  • Existing anonymous APIs remain available:
    • CreateByType(formType)
    • GetOrCreateByLocalId(localId, formType)
    • GetOrCreateByFormId(formId, formType)

Global Registry Behavior

  • Data/SKSE/Plugins/DPF.json is now the single global registry for DPF FormID slots.
  • Registry schema was upgraded to schemaVersion: 2.
  • Slots now store ownership metadata:
    • localId
    • formType
    • state
    • owner
    • key
  • The stable identity is still the ESP-local localId, not the full FormID.
  • Full FormIDs are recalculated from the current load order of Dynamic Persistent Forms.esp.

Ownership Rules

  • owner + key uniquely identifies a named slot.
  • GetOrCreateByOwnerKey(owner, key, type):
    • returns the existing form if the same owner/key/type already exists;
    • returns nullptr if the owner/key exists with a different type;
    • allocates and registers a new slot if no matching slot exists.
  • CreateByTypeForOwner(owner, key, type) follows the same owner/key behavior.
  • Anonymous APIs continue to create slots with empty owner and key.
  • A slot cannot be reused with a different formType.

Release / Cleanup Behavior

  • ReleaseByOwnerKey(owner, key) removes a single owned slot.
  • ReleaseByLocalId(localId, owner) only releases the slot if the owner matches.
  • ReleaseOwner(owner) removes all slots owned by that owner and returns the number released.
  • Released runtime forms are marked deleted when present.
  • Released slots are removed from DPF.json, making those local IDs available again.

Schema Handling

  • No compatibility or migration is provided for older registry schemas.
  • If DPF.json is missing, invalid, or not schema 2, DPF starts with an empty registry and rewrites the file using schema 2.
  • Old registry data is intentionally ignored to avoid mixing incompatible slot ownership rules.

Consumer Mod Flow

  • Mods should prefer GetOrCreateByOwnerKey(owner, key, formType) for stable owned slots.
  • The consumer mod remains responsible for defining what the form does.
  • Recommended flow:
    • request or recover a slot using owner + key;
    • store the key/localId as needed;
    • reapply perk/spell/item data on load;
    • call release APIs when the owned slot should be freed.

Quantumyilmaz and others added 19 commits November 21, 2025 17:21
Removed Visual Studio workspace and configuration files. Major overhaul of CMakeLists.txt to improve build configuration, add resource handling, and update compiler settings. Updated CMakePresets.json with new overlay ports and build types. Replaced vcpkg-configuration.json and revised vcpkg.json to update dependencies and add package overrides.
Added a .gitignore entry for the .vs directory and deleted the SKSE_Plugin/.vscode/launch.json file to clean up project configuration.
Moved implementation from src/ to include/ as header files and updated includes to use headers. Added new CMake scripts for source/header lists and output management. Updated vcpkg dependencies and removed unused target_link_libraries from CMakeLists.txt.
Enable build
Removed the custom log.h implementation and replaced it with logger.h using spdlog for logging. Updated all logging calls throughout the codebase to use the new logger interface, improving consistency and log output. Updated CMake header list and removed log.h from includes.
Moved function and class method implementations from header files to corresponding source files for improved code organization and compilation speed. Updated headers to contain only declarations, and added new .cpp files for Services, form, model, persistence, serializer, and related modules.
Replaced std::lock_guard<std::mutex> with std::lock_guard for brevity across multiple source files. Improved const correctness in function signatures and lambda parameters. Cleaned up plugin.cpp by moving OnMessage into an anonymous namespace and removing unnecessary blank lines.
Replaced direct Read/Write calls with template usage for serializer methods to improve type safety and consistency. Updated function signatures to use const references and const qualifiers where appropriate. Cleaned up formatting, removed redundant code, and improved error handling in several files.
Changed logger::trace calls to use format strings for improved readability and consistency, displaying values with explicit formatting (e.g., hexadecimal for form IDs).
GetOrCreateFormByOwnerKeyEx so it knows now if the formid already existed
@vinymayan

Copy link
Copy Markdown
Author

Remember to when build remove the logger info of when save stuff since i was testing on release 🫠

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.

3 participants