Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const char* AnimEvent = NULL;
- void DecideAnimReplace(int a1){
- if (!s_Idles || a1 == 0)
- return;
- AnimEvent = NULL;
- int obj = Lib::SafeRead32(a1 + 4);
- if (obj == 0)
- return;
- UInt64 key = Forms::GetFormKey((TESForm*)obj);
- if (key == 0)
- return;
- // Look for a replacer
- std::string AnimEventName((const char*)Lib::SafeRead32(a1 + 0x14));
- TESForm* FormRef = GetSingleton()->GetValue(key, AnimEventName, NULL);
- if (!FormRef)
- FormRef = GetSingleton()->GetValue(0, AnimEventName, NULL);
- if (!FormRef)
- return;
- // Get the Idle object to use
- TESIdleForm* IdleRef = NULL;
- if (FormRef && FormRef->formType == kFormType_Idle)
- IdleRef = DYNAMIC_CAST(FormRef, TESForm, TESIdleForm);
- if (!IdleRef)
- return;
- // Override
- //_MESSAGE(IdleRef->animationEvent.data);
- SafeWrite32(a1 + 0x24, (UInt32)IdleRef);
- AnimEvent = IdleRef->animationEvent.data;
- SafeWrite32(a1 + 0x14, (UInt32)AnimEvent);
- /*
- Normal a1 Modified a1
- +0 vtable
- +4 actor
- +8 0
- +C BGSAction (e.g. ActionIdle) ?BGSAction(Idle)
- +10 2
- +14 AnimationEventName* AnimationEventName *
- +18 AnimationParams?
- +1C 0
- +20 0
- +24 TESIdleForm*
- +28 0
- +2C 1
- +30 Return address of function?
- +34 0
- +38 40h
- +3C 0
- +40 1 Animation handler?
- +44 0
- +48 0
- +4C Unk*
- +50 Script* <- dynamically allocated
- +54 0
- +58 Animation event NOT POINTER <- this is not the case when BGSAction is not idle
- +... 0
- */
- }
- int animJNEBack = 0x6F0305;
- int animJEBack = 0x6F0312;
- void InitPlugin() {
- void * animCodeStart;
- _asm
- {
- mov animCodeStart, offset animStart
- jmp animEnd
- animStart :
- push eax
- push ecx
- push edx
- push esi
- call DecideAnimReplace
- add esp, 4
- pop edx
- pop ecx
- pop eax
- test byte ptr[esi + 0x2C], 1
- je animJEJump
- jmp animJNEBack
- animJEJump :
- jmp animJEBack
- animEnd :
- }
- WriteRelJump(0x6F02FF, (UInt32)animCodeStart);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement