Skip to content

Fixes and improvements for "Find all references" feature - #2467

Open
VladiStep wants to merge 11 commits into
UnderminersTeam:masterfrom
VladiStep:findReferencesBytecode14
Open

VladiStep wants to merge 11 commits into
UnderminersTeam:masterfrom
VladiStep:findReferencesBytecode14

Conversation

@VladiStep

@VladiStep VladiStep commented Aug 23, 2026

Copy link
Copy Markdown
Member

Description

  1. It turns out that I missed that the audio groups are introduced in GameMaker versions with bytecode 14+.
    So this type showed for such versions in the referenceable asset list, and this caused the null reference exception.
    This PR fixes that.
  2. Added a GameVersion constructor that accepts UndertaleGeneralInfo (and it also has the LTS 2022 logic).
  3. Improved performance of "Find unreferenced assets" by adding early returns/breaks for tracks (void ProcessTrack() ...), so it stops as soon as it finds a one reference inside a track.
  4. Changed the GameVersion type to readonly record struct for better performance.
  5. Simplified the bytecode version checking (comparison) in GameVersion by adding a proper support for that (instead of doing (bytecodeVersion, uint.MaxValue, uint.MaxValue)).
  6. Added PredicateDelegate for a better readability of PredicateForVersion.
  7. Now UndertaleBackground uses BeforeVersion (as it should) instead of using null names.
  8. Made the version comparison more readable by changing the operands order.
  9. Simplified asset type filtering for YYC.
  10. Removed now redundant PredicateForVersion.DisableForLTS2022 property and check.
  11. Minor code changes (made early continue in a loop).
  12. Treat LTS 2022 GM version as 2022.9, as it's actually like that internally; fixes The color strings from the layer effect properties are ignored by "Find all references" if it's LTS 2022 #2475
  13. Fixed a (theoretically possible) bug when GetReferenceableTypes() can return stale results for games with same GM version, but different YYC types (first loaded game data has code, second - doesn't).
  14. Fixed an error for YYC games when you try to find unreferenced assets - it tried to access data.Code (fixes The "Find unreferenced assets" feature is broken for YYC games #2477).
  15. Sort the results by group names and each asset list by asset ID - closes The asset references ("Find all references" & "Find unreferenced assets") are not quite ordered #2478.

Caveats

None, I guess.

Notes

Closes (partially) #2319 (the error part)

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown

@VladiStep
VladiStep force-pushed the findReferencesBytecode14 branch from 606ddc6 to b1e8385 Compare August 23, 2026 21:31
@VladiStep

VladiStep commented Aug 23, 2026

Copy link
Copy Markdown
Member Author

Okay, it seems the HashSetTypesOverride custom type needs to be modified so that it returns true only if the requested type is supported in the current GameMaker version

@VladiStep VladiStep changed the title A fix of audio groups type in the "Find object references" for bytecode 13 and older A fix and some improvements for "Find all references" feature Aug 25, 2026
@VladiStep

Copy link
Copy Markdown
Member Author

I also need to rewrite GameVersion so it properly supports the bytecode version.
At least because GetReferenceableTypes() will ignore audio groups in the current implementation

1) Change `GameVersion` to `readonly record struct` for additional performance.
2) Add bytecode version support for that; simplify bytecode/GameMaker version comparison, use a proper constuctor for a bytecode version-only.
@VladiStep
VladiStep force-pushed the findReferencesBytecode14 branch from 44ed597 to d4e7254 Compare August 25, 2026 22:30
1) Use `BeforeVersion` for `UndertaleBackground` instead of using `null` names.
2) Add an explanation for new `GameVersion(gameInfo)`.
3) Make the version comparison more readable by changing the operands order.
4) Finish reimplementing `HashSetTypesOverride`.
5) Simplify asset type filtering for YYC.
6) Remove now redundant `PredicateForVersion.DisableForLTS2022` property and check.
7) Add another `GetReferencesOfObject()` overload that designed for a singular usage (not in batch).
8) Minor code changes (make early `continue`).
@VladiStep

Copy link
Copy Markdown
Member Author

It looks finished, but I need to test it properly - at least make sure, that the performance is the same

@VladiStep VladiStep changed the title A fix and some improvements for "Find all references" feature Some fixes and improvements for "Find all references" feature Aug 27, 2026
… games with same GM version, but different YYC types
@VladiStep

Copy link
Copy Markdown
Member Author

Well, at least it has the same performance, I didn't notice visible speed and/or memory allocation changes for "Find unreferenced assets" for Deltarune Chapter 5 - it's ~1 m. 20 s. for my PC.

@VladiStep
VladiStep force-pushed the findReferencesBytecode14 branch from 06dc011 to 1fd6bec Compare August 29, 2026 00:20
@VladiStep
VladiStep force-pushed the findReferencesBytecode14 branch from 1fd6bec to d7aa0dc Compare August 29, 2026 00:20
…dictionary by group names and each its asset list by asset ID (address UnderminersTeam#2478)
@VladiStep VladiStep changed the title Some fixes and improvements for "Find all references" feature Fixes and improvements for "Find all references" feature Aug 29, 2026
@VladiStep

Copy link
Copy Markdown
Member Author

Okay, I think it's ready for review.

@VladiStep
VladiStep marked this pull request as ready for review August 29, 2026 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant