xNVSE / NVSE

New Vegas Script Extender (NVSE)
https://git.io/JfSAo
702 stars 55 forks source link

Misc nvse requests #200

Closed bdemmy closed 2 months ago

bdemmy commented 2 months ago

Think these hooks are sufficient. Lmk if they are not.

korri123 commented 2 months ago

The hook structure looks quite unclean, if possible we prefer avoiding inline assembly with the help of GetParentBasePtr and prefer hooking calls directly (if thiscall is used __fastcall can be used to emulate it). If inline assembly is required we generally try to avoid pushad and popad. We also generally try not to mix inline assembly with C++. Example: https://github.com/xNVSE/NVSE/blob/a2852dd1f8a686d7506c44632559cc7b5d9726c5/nvse/nvse/Hooks_SaveLoad.cpp#L70 (feel free to checkout other usages of GetParentBasePtr, some good ones are in xNVSE, kNVSE and ShowOff xNVSE)

Edit: I previously had some thoughts this wouldn't register for script events but it actually does and I wasn't familiar with the EVENT_INFO macro.

korri123 commented 2 months ago

Actually, the only message dispatched is to the plugin manager so it's probably missing the call to EventManager::DispatchEvent as well if it should work in script events

bdemmy commented 2 months ago

This is all cleaned up now. Just going to convert to the other event system. Thanks again :)

bdemmy commented 2 months ago

Added some lockpick hooks (Lock broken, success, pick break).

bdemmy commented 2 months ago

Added terminal hack fail/success events. More to come.