Tweak skeleton limbs to use OTR path strings for loading DList and improve Alt toggling #3479
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Our skeleton limb resources were loading the raw resource for the specified DList and assigning a pointer to the Gfx instructions when parsing the limb resource. This lead to the issue where the underlying DList resource could be unloaded, but the skeleton limb is not, causing either garbage data to render for the DList or straight up crash.
This situation could happen with the following example:
The proposed changes/fixes here is to instead use the string reference of the DList path, and assign its pointer to the limb's DList. Later on when the limb is rendered,
gSPDisplayList
will recognize the OTR signature and dynamically load the DList resource for either Alt or non-Alt as necessary. This pattern matches roughly with how scene MeshLists are registered, and textures in DLists themselves.To support these changes, I also needed to defer actually toggling the
gAltAssets
CVar to the end of the game frame, similar to how we defer skeleton patching updates. This is necessary as we don't want a skeleton to try to load a DList for the wrong assets mode due to race conditions. Pressing Tab or clicking the checkbox in the menu for it will appropriately handle toggling the actual CVar at the right time.Currently though, it is not advised to set
gAltAssets
via the debug console, as that will set the CVar immediately and potentially cause crashes depending on the used mods. A CVar refactor could mitigate this in the future.Build Artifacts