Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nifly handling of invalid targets in NIF files #45

Closed
hakasapl opened this issue Aug 4, 2024 · 3 comments
Closed

nifly handling of invalid targets in NIF files #45

hakasapl opened this issue Aug 4, 2024 · 3 comments

Comments

@hakasapl
Copy link

hakasapl commented Aug 4, 2024

Hi,

I've been using this library in ParallaxGen (thank you by the way!).

In some people's Skyrim load order they have the SMIM mod which includes a mesh that has an invalid target on it (ie. when I try to open it in nifskope, do nothing, and save it, I get an error about that). The mesh in particular in SMIM if you wanted to take a look is meshes\traps\whiterundragontrap\whiterundragontrap01.nif.

When this mesh goes through parallaxgen (and therefore nifly), it gets saved successfully with no issues. The result mesh instead of having an invalid target at that same block, it just has no target. This causes game crashes in Skyrim. Don't ask me why but an invalid link pointing to nothing seems to work, while removing that link causes crashes on that specific block.

So my question is, can I control that with nifly? ie. can I tell nifly to keep the invalid link in place? Or, is there a mechanism I can figure out if an invalid link exists in the original mesh through nifly? I don't think this a bug with nifly, it's an issue with the original mod.

I have sortblocks set to true in this case.

Thank you!

@hakasapl
Copy link
Author

Quick update: Looks like in debug mode a debug assertion fails with a broken link while PrettySortBlocks() is called. Vector subscript out of range error. In release mode there is no exception but seems like the behavior would be unpredictable anyway without the assertion.

@ousnius
Copy link
Owner

ousnius commented Aug 30, 2024

@hakasapl The way to fix the SMIM mesh would be to change the invalid link "Inherit Object" from index 339 to 334 using NifSkope, as that's what it's supposed to point to when comparing with the vanilla file. It's in the block "325 BSPSysInheritVelocityModifier".

I don't know the effect the invalid link (or correcting it) has in the game. My guess is something about where the particle effects are supposed to go.

That said, I fixed the undefined behavior/assert with commit 2f518af. In my tests with the file, it keeps the incorrect pointer index now.

@hakasapl
Copy link
Author

hakasapl commented Sep 4, 2024

Awesome, thanks! Yeah I fixed that mesh like the way you said and it works great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants