Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions EEex/copy/EEex_scripts/EEex_Opcode.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,22 @@
EEex_Opcode_ListsResolvedListeners = {}

function EEex_Opcode_AddListsResolvedListener(func)
-- This legacy listener is called immediately after each engine effect-list
-- resolution. High-volume callers, such as item comparison, should use
-- EEex_Opcode_AddDeferredListsResolvedListener() instead.
-- [EEex.dll]
EEex.Opcode_LuaHook_AfterListsResolved_Enabled = true
table.insert(EEex_Opcode_ListsResolvedListeners, func)
end

EEex_Opcode_DeferredListsResolvedListeners = {}

function EEex_Opcode_AddDeferredListsResolvedListener(func)
-- [EEex.dll]
EEex.Opcode_LuaHook_DeferredAfterListsResolved_Enabled = true
table.insert(EEex_Opcode_DeferredListsResolvedListeners, func)
end

-----------------------
-- Private Functions --
-----------------------
Expand Down Expand Up @@ -129,6 +140,12 @@ function EEex_Opcode_LuaHook_AfterListsResolved(sprite)
end
end

function EEex_Opcode_LuaHook_DeferredAfterListsResolved(sprite)
for _, func in ipairs(EEex_Opcode_DeferredListsResolvedListeners) do
EEex_Utility_TryIgnore(func, sprite)
end
end

--[[
+--------------------------------------------------------------------------------+
| Opcode #214 |
Expand Down
20 changes: 20 additions & 0 deletions EEex/copy/EEex_scripts/EEex_Opcode_Patch.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,26 @@
]]}
)

--[[
+--------------------------------------------------------------------------------------------------+
| Flush coalesced lists-resolved listeners near the end of the sprite's real AI processing pass |
+--------------------------------------------------------------------------------------------------+
| [EEex.dll] EEex::Opcode_Hook_FlushDeferredAfterListsResolved(pSprite: CGameSprite*) |
+--------------------------------------------------------------------------------------------------+
--]]

EEex_HookBeforeRestoreWithLabels(EEex_Label("Hook-CGameSprite::ProcessAI()-BeforeReturn"), 0, 8, 8, {
{"hook_integrity_watchdog_ignore_registers", {
EEex_HookIntegrityWatchdogRegister.RAX, EEex_HookIntegrityWatchdogRegister.RCX, EEex_HookIntegrityWatchdogRegister.RDX,
EEex_HookIntegrityWatchdogRegister.R8, EEex_HookIntegrityWatchdogRegister.R9, EEex_HookIntegrityWatchdogRegister.R10,
EEex_HookIntegrityWatchdogRegister.R11
}}},
{[[
mov rcx, rsi ; pSprite
call #L(EEex::Opcode_Hook_FlushDeferredAfterListsResolved)
]]}
)

--------------------------------------
-- Opcode Changes --
--------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions EEex/loader/InfinityLoader.db
Original file line number Diff line number Diff line change
Expand Up @@ -2372,6 +2372,10 @@ Operations=ADD 51
Pattern=0FB7974C4B0000
Operations=ADD 121

[Hook-CGameSprite::ProcessAI()-BeforeReturn]
Pattern=4C8BBC24680100004C8BAC2460010000
Operations=ADD 0

[Hook-CGameSprite::ProcessEffectList()-AfterListsResolved-1]
Pattern=837D8C00
Operations=ADD 20
Expand Down