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

Really preserve ObjIDs. #280

Merged
merged 3 commits into from
Oct 19, 2023
Merged

Really preserve ObjIDs. #280

merged 3 commits into from
Oct 19, 2023

Conversation

Hoikas
Copy link
Member

@Hoikas Hoikas commented Oct 19, 2023

Previously, when a uoid is read in from the stream, the ObjID from the stream is discarded and reassigned to the value we already know. If the key is not already known, then the next sequential ID is given. If we want to preserve IDs, then we probably want to preserve all IDs, even those mid-stream. This is most apparent when diffing PRPs. IDs of zero are special values to the game client that mean "always look this up by name." This situation exists in the wild, right now, on MOULa's BahroCave_District_YeeshaCave.prp. When this file is read, libHSPlasma assigns sequential IDs to the plMipmap references in the layers if the Textures PRP is not already loaded. If the common PRP_as_Text.py is used to diff the PRP, a comparison is made against a random/junk value, resulting in a spurious looking change. See H-uru/moul-assets#244 for an example of the confusion.

Previously, when a uoid is read in from the stream, the ObjID from the
stream is discarded and reassigned to the value we already know. If the
key is not already known, then the next sequential ID is given. If we
want to preserve IDs, then we probably want to preserve *all* IDs, even
those mid-stream. This is most apparent when diffing PRPs. IDs of zero
are special values to the game client that mean "always look this up by
name." This situation exists in the wild, right now, on MOULa's
BahroCave_District_YeeshaCave.prp. When this file is read, libHSPlasma
assigns sequential IDs to the `plMipmap` references in the layers if the
Textures PRP is not already loaded. If the common PRP_as_Text.py is used
to diff the PRP, a comparison is made against a random/junk value,
resulting in a spurious looking change. See H-uru/moul-assets#244 for an
example of the confusion.
* \param preserve Preserve keyed object IDs
* \sa getPreserveObjIDs()
*/
void setPreserveObjIDs(bool preserve) { preserveIDs = preserve; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, the original reason I didn't expose this except in the constructor was to ensure we couldn't end up in a situation where we had files open with both preserved key IDs and resequenced key IDs in the same ResMgr session.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was thinking that as well - but I noticed that setVer already had a similar disclaimer, so I felt this was OK.... especially considering it would require re-allocating the res manager it pyResManager__init__() if this function didn't exist.

core/ResManager/plResManager.h Outdated Show resolved Hide resolved
Co-authored-by: Joseph Davies <deledrius@gmail.com>
@zrax zrax merged commit bba1f7e into H-uru:master Oct 19, 2023
9 checks passed
@Hoikas Hoikas deleted the preserve_obj_ids branch October 19, 2023 23:37
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

Successfully merging this pull request may close these issues.

4 participants