Skip to content

Commit 16a9c55

Browse files
committed
[WIP] modifed CopyAnimation hook for SIFPAnimations
This is needed for unloading IFP. We'll use this to increment and decrement iReferences in SIFPAnimations when an animation association is created and destroyed respectively.
1 parent 90e784f commit 16a9c55

File tree

1 file changed

+39
-6
lines changed

1 file changed

+39
-6
lines changed

Client/multiplayer_sa/CMultiplayerSA.cpp

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5384,20 +5384,42 @@ void _declspec(naked) HOOK_CAnimBlendAssocGroup_CopyAnimation ()
53845384
{
53855385
_asm
53865386
{
5387-
popad
5387+
popad
5388+
5389+
push ecx
5390+
push ebp
5391+
mov ebp, esp
5392+
sub esp, 4
5393+
53885394
push eax
53895395
push ecx
53905396
push edi
53915397

5398+
lea eax, [ebp-4]
5399+
push eax
5400+
53925401
// Allocate memory for our new static association
53935402
call AllocateStaticAssociationMemory
53945403
mov edi, eax
5395-
5404+
53965405
// push the static association
53975406
push edi
5398-
call m_pAssocGroupCopyAnimationHandler //CAnimBlendAssocGroup_CopyAnimation
5399-
add esp, 10h
5407+
call m_pAssocGroupCopyAnimationHandler
5408+
add esp, 14h
5409+
5410+
mov ecx, [ebp-4]
54005411

5412+
add esp, 4 // remove space for local var
5413+
mov esp, ebp
5414+
pop ebp
5415+
5416+
// save eax and ecx for later to check whether current animation is custom or not
5417+
// after calling FUNC_CAnimBlendAssociation_Constructor function
5418+
push eax
5419+
push ecx
5420+
5421+
// get "this" from stack that we pushed first
5422+
mov ecx, [esp+8]
54015423
mov ecx, [ecx+4]
54025424
sub eax, edx
54035425
push esi
@@ -5413,9 +5435,9 @@ void _declspec(naked) HOOK_CAnimBlendAssocGroup_CopyAnimation ()
54135435
push 3Ch
54145436
call FUNC_NEW_OPERATOR
54155437
add esp, 8
5416-
mov [esp+14h], eax
5438+
mov [esp+20h], eax
54175439
test eax, eax
5418-
mov [esp+0Ch], 0
5440+
mov [esp+18h], 0
54195441
jz ERROR_CopyAnimation
54205442
push esi
54215443
mov ecx, eax
@@ -5427,8 +5449,19 @@ void _declspec(naked) HOOK_CAnimBlendAssocGroup_CopyAnimation ()
54275449
call DeleteStaticAssociation
54285450
add esp, 4
54295451

5452+
pop ecx
5453+
pop eax
5454+
5455+
// Check wether this is a custom animation or not
5456+
cmp al, 0
5457+
je NOT_CUSTOM_ANIMATION_CopyAnimation
5458+
5459+
// It's a custom animation, store it in a map
5460+
5461+
NOT_CUSTOM_ANIMATION_CopyAnimation:
54305462
// put CAnimBlendAssociation in eax
54315463
mov eax, edi
5464+
add esp, 4
54325465
jmp RETURN_CAnimBlendAssocGroup_CopyAnimation
54335466

54345467
ERROR_CopyAnimation:

0 commit comments

Comments
 (0)