Skip to content

Conversation

@colinator27
Copy link
Member

Description

Refactors all of the list classes inheriting from UndertaleListBase<T>, which itself is no longer an abstract class, and has been renamed to UndertaleObservableList<T>. This allows data models to take advantage of observable collections for lists that need to unserialize using InternalAdd() (for performance purposes), when those lists have an irregular format in the WAD that the other lists can't handle. This functionality is currently unused in this PR, but will be taken advantage of in at least UndertaleGameObject in a future project system PR, for the list of physics vertices.

In general, I took to cleaning up and commenting all of the list code, as well as moving try/catch statements outside of loops to reduce their overhead. I have no idea if this has any noticeable impact on performance, but if it does, it's probably marginally faster now.

Caveats

There's probably an extremely small chance something has been broken with these changes, but I ran through my whole game test suite and everything saved/loaded identically byte-for-byte, as usual (and the tool operates as normal).

Notes

It's a little bit hacky how the base observable list has to use reflection to get and modify an internal member of Collection<T>, but it was already that way previously, and I'm not sure if we have any better alternatives. Perhaps a future PR could address that, if there is another way.

@github-actions
Copy link

github-actions bot commented Mar 24, 2025

@Miepee Miepee merged commit f9c17d7 into master Mar 28, 2025
5 checks passed
@colinator27 colinator27 deleted the list-refactor branch March 29, 2025 00:01
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.

3 participants