Skip to content

container: Implement StrTreeMap::ForEachConstContext#227

Merged
MonsterDruide1 merged 2 commits intoopen-ead:masterfrom
german77:treeMapForEach
Dec 20, 2025
Merged

container: Implement StrTreeMap::ForEachConstContext#227
MonsterDruide1 merged 2 commits intoopen-ead:masterfrom
german77:treeMapForEach

Conversation

@german77
Copy link
Contributor

@german77 german77 commented Nov 13, 2025

Based on the symbols generated by ResourceSystem::removeCategory in SMO it seems like the current implementation is not correct as it never generates the ForEachConstContext namespace nor the Delegate1 functions. This implementation lines up as well with other sead repositories like @aboood40091 and @stupidestmodder

While this implementation creates the right matching symbols I haven't been able to get a full match on the caller function as it appears that there's another variant of the ForEach function that allows you to provide a custom caller class https://decomp.me/scratch/R5MuA

It also seems like BOTW has been creating custom classes that pretty much reassemble this behavior but with pseudo random function names and namespaces and are very likely to break with this change. https://github.com/search?q=repo%3Azeldaret%2Fbotw+.ForEach&type=code

  • _ZN4sead10StrTreeMapILi156EPN2al8ResourceEE19ForEachConstContextIPFvRNS_14SafeStringBaseIcEES3_EE4callEPNS_11TreeMapNodeIS7_EE
  • _ZN4sead11TreeMapImplINS_14SafeStringBaseIcEEE7forEachINS_9Delegate1INS_10StrTreeMapILi156EPN2al8ResourceEE19ForEachConstContextIPFvRS2_S9_EEEPNS_11TreeMapNodeIS2_EEEEEEvSI_RKT_
  • _ZN4sead9Delegate1INS_10StrTreeMapILi156EPN2al8ResourceEE19ForEachConstContextIPFvRNS_14SafeStringBaseIcEES4_EEEPNS_11TreeMapNodeIS8_EEE6invokeESF_
  • _ZNK4sead9Delegate1INS_10StrTreeMapILi156EPN2al8ResourceEE19ForEachConstContextIPFvRNS_14SafeStringBaseIcEES4_EEEPNS_11TreeMapNodeIS8_EEE5cloneEPNS_4HeapE

This change is Reviewable

Copy link
Contributor

@Fuzzy2319 Fuzzy2319 left a comment

Choose a reason for hiding this comment

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

I taked a look at TreeMapImpl::forEach. Since the function is recursive, I think it could be simplyfied like this. But that doesn't seems to help getting a match.
image.png

Reviewable status: 0 of 1 files reviewed, all discussions resolved

@aboood40091
Copy link
Contributor

... as it appears that there's another variant of the ForEach function that allows you to provide a custom caller class

What if they just directly call the underlying TreeMapImpl::forEach function? It is public, after all.

@german77
Copy link
Contributor Author

Makes no difference

@aboood40091
Copy link
Contributor

I taked a look at TreeMapImpl::forEach. Since the function is recursive, I think it could be simplyfied like this. But that doesn't seems to help getting a match. image.png

Reviewable status: 0 of 1 files reviewed, all discussions resolved

Your simplification is wrong BTW, since you don't process mRight anymore.

Also, I just realized that the existing open-ead implementation uses a loop.

Why not do it the way I'm doing it?
image

I checked the scratch and that doesn't make an improvement (it remains the same), but at least this is much cleaner.

Copy link
Contributor

@MonsterDruide1 MonsterDruide1 left a comment

Choose a reason for hiding this comment

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

Handled that suggestion in #231 - please check there and comment your thoughts, @aboood40091.

@MonsterDruide1 reviewed 1 of 1 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @german77)

@MonsterDruide1 MonsterDruide1 merged commit fcb74cb into open-ead:master Dec 20, 2025
4 checks passed
@german77 german77 deleted the treeMapForEach branch December 27, 2025 14:03
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