Skip to content

REResource Issue(s) #1448

@Ridog8

Description

@Ridog8

Issue:
The issue is best exemplified with hair meshes in MHWilds, but other games have had similar problems that I've tested such as RE4R. Creating and setting mesh and material resource (etc..) holders. Doing so will cause any mix of the following: Invisible meshes, missing materials, invisible objects that are unrelated to what you are even setting the resource for, and rarely vertex explosions.
I suspect problems with memory management or garbage collection for resources. This is an issue I've been investigating/trying to fix from Lua for about the course of a year. So far, what I've found is that creating resources early is the best way to go, which makes sense to set them only by the time they are available/ready to be set. However, I think the issue runs deeper than this. I've tried many different ways of actually constructing the resource and resource holder but all of these have seem to never fully resolved the issues.
To describe what happens with the most stable solution that I've tested which is creating these resources early and using add_ref() for both the resource holder and resource, upon switching the mesh/material/etc.. the first couple times will work correctly. As in, they aren't experiencing any of the issues I mentioned earlier. However, upon setting these a couple more times, usually materials are the first to stop working incorrectly. These can cause invoke errors in the function to set the material when switching back and forth to it while the material is not working correctly. Sometimes the mesh can turn invisible too, and upon switching back and forth it will rarely show back up. What is usually the last step in this, is that these eventually lead to a crash with 'null pointer read'. And sometimes the game aborting with 'heap allocation failed'. The memory addresses for both the resource and holder seem to stay stable. However, just throwing out a guess maybe they are removed by the GC, despite using add_ref() for them.
I have a mod that can be used to test these issues and this behavior specifically, which allow you to change hair on an npc in Wilds using a combo box so you can see the effects of the issues. I can provide a link to this if need be.

Version:
Any at the moment that I've tested. (Sorry not sure which ones I have tested but the latest would still have the issue).

Crash logs, dumps:

CrashLogsAndRefLog.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions