Closed hxef closed 1 year ago
This is correct. I'm not sure what your issue here is?
According to msvc documentation for calloc, it's supposed to allocate memory blocks with values set to 0.
In my mod, I create my own BaseExtraList instance to make new stacks(with different OMODs) of certain BGSInventoryItem objects.
When a BaseExtraList is created, its _flags property is initially null, and adding an extra data object to it calls the CreateFlags function which ends up initializing the flags with random data.
Adding another extra data type results in assertion error, because the list now thinks it already contains an extra data of said type(due to the junk data from the _flags member).
I've created a PR with a fix proposal. It works on my plugin.
BTW, I'd like to ask you a question if you don't mind. Do you know how I can refresh a BGSInventoryItem stack after attaching new OMODs to it? For instance, the way I do it is via BGSObjectInstanceExtra::AddMod function, but this action is not reflected in the UI/InstanceData. It only takes effect when I drop said stack to the ground or by saving and reloading.
Is there some other function I have to call, or is this something that hasn't been decoded yet?
I don't remember how to refresh items when you add OMODs to them. I would look at the crafting bench code to see how its done.
Ah, unfortunately I don't have any knowledge of reverse engineering so I need to find some workarounds, as I merely tinker with what others decoded until something works, haha. It's been a good experience so far because I've learned C! (sort of)
Just wondering(sorry for being offtopic): is there a community(e.g. discord) for F4SE/SKSE related development and plugin authors? I am interested in FO4 but a SKSE group would also suit me since the engines are closely related. I have a lot of questions about plugin development and maybe I could contribute by helping others as I gain more experience with it.
Also, thanks for merging the PR! I am closing the issue.
There's a discord server for RE here: https://discord.gg/wJchVBAAen
There's a discord server for RE here: https://discord.gg/wJchVBAAen
Thanks for sharing it!
Is calloc supposed to call malloc? -> link
When I try to allocate memory using calloc, it returns memory blocks with random data, which is not ideal since there are other functions like this one which make use of calloc.