Skip to content

New engine features: Add runtime item resources creation and tweak op122/255#117

Open
4Luke4 wants to merge 6 commits into
Bubb13:develfrom
4Luke4:item
Open

New engine features: Add runtime item resources creation and tweak op122/255#117
4Luke4 wants to merge 6 commits into
Bubb13:develfrom
4Luke4:item

Conversation

@4Luke4
Copy link
Copy Markdown
Contributor

@4Luke4 4Luke4 commented Apr 18, 2026

This pull request introduces a robust system for creating, copying, persisting, and restoring in-memory ITM (item) resources, along with related opcode and marshalling infrastructure. The core changes enable items to be dynamically created, modified, and saved across game sessions, with hooks for engine integration and opcode extension.

The most important changes are:

Item Creation, Copying, and Persistence (EEex_Item):

  • Added EEex_Item.lua, which implements functions to create new in-memory items (EEex_Item_CreateFromResref), copy existing items (EEex_Item_CreateCopy), and manage persistent item resources, including marshaling and unmarshaling item state for save/load support. This includes validation, resource management, and header override logic.
  • Added infrastructure for tracking which items should persist across saves, and for serializing/deserializing their data as hex blobs.

Marshalling Integration:

  • Integrated item persistence with the game's marshalling system: only the first portrait sprite carries the item marshal payload, and unmarshaling is gated to occur once per game-state lifetime. Listeners reset the unmarshaled state when the game state is destroyed.
  • Registered EEex_Item with the startup file list to ensure the new item logic is loaded at game initialization.

Opcode and Engine Hook Extensions:

  • Added hooks for CGameEffectCreateItem (opcodes #122/#255), allowing pre- and post-processing when items are created by effects. This enables custom item flags/logic to be injected before and after the engine places the item. [1] [2]

These changes provide a foundation for dynamic, persistent, and extensible item handling in the engine, with deep integration into the save/load and effect processing systems.

Requires: Bubb13/InfinityLoader#5.
Requires: #116.

Register an opcode hook (op122/255) in EEex_Opcode_Patch.lua to invoke EEex.dll hooks around CGameEffectCreateItem item placement.
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