Open Aidanamite opened 3 months ago
@Aidanamite can you possibly explain your steps a bit more in-depth for how you confirmed the function were still being called even though the registered hook was never triggering? I'm trying to figure out if I'm running into the same issue when trying to mod Echo Point Nova which is unreal engine version 4.27.2.0. I'm on the 3.0.1 release so slightly different from the experimental branch but I checked 2.5.2 and nothing was different.
can you possibly explain your steps a bit more in-depth for how you confirmed the function were still being called even though the registered hook was never triggering?
i used cheat engine to manually locate the function's native code and used breakpoints to check if the code worked how i thought it did
as a side note to that: i've been "modding" the game using cheat engine for a while now, making fairly complex scripts to add in various behaviours.
i was hoping to be able to use ue4ss to remake the same sort of tweaks in a more dynamic and maintainable way
as a side note to that: i've been "modding" the game using cheat engine for a while now, making fairly complex scripts to add in various behaviours.
i was hoping to be able to use ue4ss to remake the same sort of tweaks in a more dynamic and maintainable way
Make a UE4SS C++ mod then. It has more freedom, Lua implementation is still very limited.
can the c++ mods hook functions that lua can't? as far as i can tell, the issue is that it's failing to hook the functions, therefore wouldn't it have the same issue regardless of if i'm using lua or c++ or does it use a completely different hooking system for c++ mods?
can the c++ mods hook functions that lua can't? as far as i can tell, the issue is that it's failing to hook the functions, therefore wouldn't it have the same issue regardless of if i'm using lua or c++ or does it use a completely different hooking system for c++ mods?
Lua is just basically an API to call C++ functions, but it's not just a simple 1:1 call, it's more complicated and depends on the implementation.
UE4SS C++ has much more options that you can use. In worst case you can always use RegisterProcessEventPreCallback
or RegisterProcessEventPostCallback
and catch the call of your function this way.
You can even hook native or vtable functions that are not reflected, but it would obviously require some reverse engineering.
Long story short, in C++ you can do anything.
so do you think the issue of the lua hook not working is caused by the hook just failing to call the lua callback and not because the hook isn't attaching to the function correctly?
so do you think the issue of the lua hook not working is caused by the hook just failing to call the lua callback and not because the hook isn't attaching to the function correctly?
No, it's definitely not it. I just say that in a C++ mod you have much more options.
After reading the first post once again, I think that the problem is that the game never calls the function over ProcessEvent, but calls it over it's native function.
It is quite common that there are functions that are exposed to reflection but are only called by C++ code, which then uses its underlined native function. That's most likely the reason why you can breakpoint the function with CE but the hook in Lua never gets triggered.
In such case the only solution is to hook the native function with a detour hook, which is only possible with a C++ DLL inside the game.
i assumed the hooks were detour hooks by default. because that's the more reliable way to ensure the hook gets called.
Branch or Release Experimental 3.0.1-151
Game and Engine Version Grounded UE 4.27
Describe the bug Most of the functions in Grounded do not seem to be able to be hooked. Some can, but most not. Calling the RegisterHook function says that it was successful in the log, but when the function is supposed to occur, the function provided to the hook is simply not run.
I have attempted to fix the issue by both configuring the engine version override to the game's engine version and delaying registering the hooks even as late as after I've loaded into a world.
Based on what I can tell from using the zDev tools for UE4SS, the functions that are not hookable are any function that is both
Final
andBlueprintCallable
Using the UE4SS header dumps, I was able to use Cheat Engine to find the function and add a breakpoint to verify that the function is being called and it is, just that the hook itself isn't
To Reproduce
In my case, the main function I've been trying to hook is the
/Script/Maine.Item:RemoveDurability
functionExpected behavior I expected the hook function to be run.
Desktop (please complete the following information):