Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Hooks_Camera.h"
- #include "GameCamera.h"
- #include "PapyrusEvents.h"
- #include "SafeWrite.h"
- #include <queue>
- static const UInt32 kInstallCameraHook_Base = 0x00653097;
- static const UInt32 kInstallCameraHook_Entry_retn = kInstallCameraHook_Base + 0x05;
- /*
- .text:00653094 mov ecx, [esi+20h]
- .text:00653097 mov eax, ecx
- .text:00653099 neg eax
- .text:0065309B pop edi
- .text:0065309C sbb eax, eax
- .text:0065309E pop esi
- .text:0065309F pop ebx
- edi - old state
- ecx - new state
- */
- void __stdcall InstallCameraHook(TESCameraState * oldState, TESCameraState * newState)
- {
- SKSECameraEvent evn(oldState, newState);
- g_cameraEventDispatcher.SendEvent(&evn);
- }
- __declspec(naked) void InstallHookCamera_Entry(void)
- {
- __asm
- {
- pushad
- push ecx
- push edi
- call InstallCameraHook
- popad
- // overwritten code
- mov eax, ecx
- neg eax
- pop edi
- jmp [kInstallCameraHook_Entry_retn]
- }
- }
- void Hooks_Camera_Commit(void)
- {
- WriteRelJump(kInstallCameraHook_Base, (UInt32)InstallHookCamera_Entry);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement