ZHMModSDK icon indicating copy to clipboard operation
ZHMModSDK copied to clipboard

Added ZArray_PushBack hook, exposed FlushLoggers to mods

Open piepieonline opened this issue 11 months ago • 2 comments

Needed a new hook for my crash helper mod. https://github.com/piepieonline/H3-Crash-Debug-Helper

It's a weird function to hook, but the crashing method is slightly monolithic and hard to break down. A super long hook pattern because I struggled to avoid a very similar earlier method...

(This is also why I'd love private hooks 😅)

piepieonline avatar Jan 26 '25 11:01 piepieonline

This mod would probably make sense to be integrated into the SDK itself, probably in a slightly different way as now, since any other mod that wants to use these hooks won't be able to (when you call the original function from a hook, it breaks the execution chain so nobody else gets the callback).

OrfeasZ avatar Feb 15 '25 23:02 OrfeasZ

I think you'd only use this mod when you are actually are trying to debug crashes, as it could introduce stability issues in real gameplay - and generally just isn't needed.

The scene debugging code also has to run as an exception handler, as calling 'GetResourceInfo' during the loading process will actually make the game crash - so I can't run that code unless I know we are already crashing.

I could try and find where "resInfo.status" is set to "EResourceStatus::RESOURCE_STATUS_FAILED", but I didn't have any luck with that when I was looking before.

piepieonline avatar Feb 17 '25 21:02 piepieonline