Skip to content

Match & link CTeamAiMgr - #519

Merged
henriquegemignani merged 3 commits into
mainfrom
match/team-ai-linkage
Sep 15, 2026
Merged

henriquegemignani merged 3 commits into
mainfrom
match/team-ai-linkage

Conversation

@encounter

Copy link
Copy Markdown
Member

No description provided.

@decomp-dev

decomp-dev Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Report for GM8E01_48 (ecb33dd - 71f82a1)

No changes

Report for GM8E01_00 (ecb33dd - 71f82a1)

📈 Linked code: 46.01% (+0.37%, +14712 bytes)
📈 Linked data: 16.51% (+0.00%, +56 bytes)

No changes

Report for GM8P01_00 (ecb33dd - 71f82a1)

📈 Matched code: 69.22% (+0.24%, +9380 bytes)
📈 Linked code: 19.39% (+0.35%, +13892 bytes)
📈 Matched data: 65.93% (+0.00%, +32 bytes)
📈 Linked data: 27.32% (+0.01%, +48 bytes)

✅ 26 new matches
Unit Item Bytes Before After
main/MetroidPrime/Enemies/CTeamAiMgr rstl::__sort3<CTeamAiRole, CRoleSorter>(CTeamAiRole&, CTeamAiRole&, CTeamAiRole&, CRoleSorter) +492 0.00% 100.00%
main/MetroidPrime/Enemies/CTeamAiMgr rstl::__insertion_sort<rstl::pointer_iterator<CTeamAiRole, rstl::vector<CTeamAiRole, rstl::rmemory_allocator>, rstl::rmemory_allocator>, CRoleSorter>(rstl::pointer_iterator<CTeamAiRole, rstl::vector<CTeamAiRole, rstl::rmemory_allocator>, rstl::rmemory_allocator>, rstl::pointer_iterator<CTeamAiRole, rstl::vector<CTeamAiRole, rstl::rmemory_allocator>, rstl::rmemory_allocator>, CRoleSorter) +304 0.00% 100.00%
main/MetroidPrime/Enemies/CTeamAiMgr CRoleSorter::operator()(const CTeamAiRole&, const CTeamAiRole&) const +264 0.00% 100.00%
main/MetroidPrime/Enemies/CTeamAiMgr rstl::swap<CTeamAiRole>(CTeamAiRole&, CTeamAiRole&) +224 0.00% 100.00%
main/MetroidPrime/Enemies/CTeamAiMgr rstl::lower_bound<rstl::const_pointer_iterator<CTeamAiRole, rstl::vector<CTeamAiRole, rstl::rmemory_allocator>, rstl::rmemory_allocator>, CTeamAiRole>(rstl::const_pointer_iterator<CTeamAiRole, rstl::vector<CTeamAiRole, rstl::rmemory_allocator>, rstl::rmemory_allocator>, rstl::const_pointer_iterator<CTeamAiRole, rstl::vector<CTeamAiRole, rstl::rmemory_allocator>, rstl::rmemory_allocator>, const CTeamAiRole&) +200 0.00% 100.00%
main/MetroidPrime/Enemies/CTeamAiMgr rstl::lower_bound<rstl::pointer_iterator<CTeamAiRole, rstl::vector<CTeamAiRole, rstl::rmemory_allocator>, rstl::rmemory_allocator>, CTeamAiRole>(rstl::pointer_iterator<CTeamAiRole, rstl::vector<CTeamAiRole, rstl::rmemory_allocator>, rstl::rmemory_allocator>, rstl::pointer_iterator<CTeamAiRole, rstl::vector<CTeamAiRole, rstl::rmemory_allocator>, rstl::rmemory_allocator>, const CTeamAiRole&) +200 0.00% 100.00%
main/MetroidPrime/Enemies/CTeamAiMgr rstl::lower_bound<rstl::pointer_iterator<TUniqueId, rstl::vector<TUniqueId, rstl::rmemory_allocator>, rstl::rmemory_allocator>, TUniqueId>(rstl::pointer_iterator<TUniqueId, rstl::vector<TUniqueId, rstl::rmemory_allocator>, rstl::rmemory_allocator>, rstl::pointer_iterator<TUniqueId, rstl::vector<TUniqueId, rstl::rmemory_allocator>, rstl::rmemory_allocator>, const TUniqueId&) +192 0.00% 100.00%
main/MetroidPrime/Enemies/CTeamAiMgr rstl::lower_bound<rstl::const_pointer_iterator<TUniqueId, rstl::vector<TUniqueId, rstl::rmemory_allocator>, rstl::rmemory_allocator>, TUniqueId>(rstl::const_pointer_iterator<TUniqueId, rstl::vector<TUniqueId, rstl::rmemory_allocator>, rstl::rmemory_allocator>, rstl::const_pointer_iterator<TUniqueId, rstl::vector<TUniqueId, rstl::rmemory_allocator>, rstl::rmemory_allocator>, const TUniqueId&) +192 0.00% 100.00%
main/MetroidPrime/Enemies/CTeamAiMgr rstl::vector<CTeamAiRole, rstl::rmemory_allocator>::~vector() +140 0.00% 100.00%
main/MetroidPrime/Enemies/CTeamAiMgr CTeamAiMgr::AssignRoles(CTeamAiRole::ETeamAiRole, unsigned int) +136 0.00% 100.00%
main/MetroidPrime/Enemies/CTeamAiMgr CTeamAiMgr::~CTeamAiMgr() +136 0.00% 100.00%
main/MetroidPrime/Enemies/CTeamAiMgr rstl::__distance<rstl::const_pointer_iterator<CTeamAiRole, rstl::vector<CTeamAiRole, rstl::rmemory_allocator>, rstl::rmemory_allocator>>(rstl::const_pointer_iterator<CTeamAiRole, rstl::vector<CTeamAiRole, rstl::rmemory_allocator>, rstl::rmemory_allocator>, rstl::const_pointer_iterator<CTeamAiRole, rstl::vector<CTeamAiRole, rstl::rmemory_allocator>, rstl::rmemory_allocator>, rstl::random_access_iterator_tag) +40 0.00% 100.00%
main/Kyoto/CResLoader rstl::vector<rstl::pair<rstl::basic_string<char, rstl::char_traits<char>, rstl::rmemory_allocator>, SObjectTag>, rstl::rmemory_allocator>::insert_into<rstl::const_pointer_iterator<rstl::pair<rstl::basic_string<char, rstl::char_traits<char>, rstl::rmemory_allocator>, SObjectTag>, rstl::vector<rstl::pair<rstl::basic_string<char, rstl::char_traits<char>, rstl::rmemory_allocator>, SObjectTag>, rstl::rmemory_allocator>, rstl::rmemory_allocator>>(rstl::pointer_iterator<rstl::pair<rstl::basic_string<char, rstl::char_traits<char>, rstl::rmemory_allocator>, SObjectTag>, rstl::vector<rstl::pair<rstl::basic_string<char, rstl::char_traits<char>, rstl::rmemory_allocator>, SObjectTag>, rstl::rmemory_allocator>, rstl::rmemory_allocator>, int, rstl::const_pointer_iterator<rstl::pair<rstl::basic_string<char, rstl::char_traits<char>, rstl::rmemory_allocator>, SObjectTag>, rstl::vector<rstl::pair<rstl::basic_string<char, rstl::char_traits<char>, rstl::rmemory_allocator>, SObjectTag>, rstl::rmemory_allocator>, rstl::rmemory_allocator>) +40 94.72% 100.00%
main/MetroidPrime/Enemies/CTeamAiMgr .data +32 0.00% 100.00%
main/MetroidPrime/Enemies/CTeamAiMgr rstl::__advance<rstl::pointer_iterator<CTeamAiRole, rstl::vector<CTeamAiRole, rstl::rmemory_allocator>, rstl::rmemory_allocator>, int>(rstl::pointer_iterator<CTeamAiRole, rstl::vector<CTeamAiRole, rstl::rmemory_allocator>, rstl::rmemory_allocator>&, int, rstl::random_access_iterator_tag) +20 0.00% 100.00%
main/MetroidPrime/Enemies/CTeamAiMgr rstl::__advance<rstl::const_pointer_iterator<TUniqueId, rstl::vector<TUniqueId, rstl::rmemory_allocator>, rstl::rmemory_allocator>, int>(rstl::const_pointer_iterator<TUniqueId, rstl::vector<TUniqueId, rstl::rmemory_allocator>, rstl::rmemory_allocator>&, int, rstl::random_access_iterator_tag) +20 0.00% 100.00%
main/MetroidPrime/CAnimationDatabaseGame rstl::vector<CPrimitive, rstl::rmemory_allocator>::insert_into<rstl::red_black_tree<CPrimitive, CPrimitive, 0, rstl::identity<CPrimitive>, rstl::less<CPrimitive>, rstl::rmemory_allocator>::iterator>(rstl::pointer_iterator<CPrimitive, rstl::vector<CPrimitive, rstl::rmemory_allocator>, rstl::rmemory_allocator>, int, rstl::red_black_tree<CPrimitive, CPrimitive, 0, rstl::identity<CPrimitive>, rstl::less<CPrimitive>, rstl::rmemory_allocator>::iterator) +9 98.97% 100.00%
main/MetroidPrime/Enemies/CTeamAiMgr rstl::vector<CTeamAiRole, rstl::rmemory_allocator>::insert_into<rstl::const_counting_iterator<CTeamAiRole>>(rstl::pointer_iterator<CTeamAiRole, rstl::vector<CTeamAiRole, rstl::rmemory_allocator>, rstl::rmemory_allocator>, int, rstl::const_counting_iterator<CTeamAiRole>) +9 98.56% 100.00%
main/MetroidPrime/CMemoryCard rstl::vector<rstl::pair<unsigned int, CSaveWorldMemory>, rstl::rmemory_allocator>::insert_into<rstl::const_counting_iterator<rstl::pair<unsigned int, CSaveWorldMemory>>>(rstl::pointer_iterator<rstl::pair<unsigned int, CSaveWorldMemory>, rstl::vector<rstl::pair<unsigned int, CSaveWorldMemory>, rstl::rmemory_allocator>, rstl::rmemory_allocator>, int, rstl::const_counting_iterator<rstl::pair<unsigned int, CSaveWorldMemory>>) +9 98.57% 100.00%
main/Kyoto/Animation/CPASAnimState rstl::vector<CPASAnimInfo, rstl::rmemory_allocator>::insert_into<rstl::const_counting_iterator<CPASAnimInfo>>(rstl::pointer_iterator<CPASAnimInfo, rstl::vector<CPASAnimInfo, rstl::rmemory_allocator>, rstl::rmemory_allocator>, int, rstl::const_counting_iterator<CPASAnimInfo>) +9 98.78% 100.00%
main/Kyoto/Animation/CPASDatabase rstl::vector<CPASAnimState, rstl::rmemory_allocator>::insert_into<rstl::const_counting_iterator<CPASAnimState>>(rstl::pointer_iterator<CPASAnimState, rstl::vector<CPASAnimState, rstl::rmemory_allocator>, rstl::rmemory_allocator>, int, rstl::const_counting_iterator<CPASAnimState>) +9 98.57% 100.00%
main/MetroidPrime/CMapWorldInfo rstl::vector<rstl::pair<TEditorId, bool>, rstl::rmemory_allocator>::insert_into<rstl::const_counting_iterator<rstl::pair<TEditorId, bool>>>(rstl::pointer_iterator<rstl::pair<TEditorId, bool>, rstl::vector<rstl::pair<TEditorId, bool>, rstl::rmemory_allocator>, rstl::rmemory_allocator>, int, rstl::const_counting_iterator<rstl::pair<TEditorId, bool>>) +7 98.98% 100.00%
main/MetroidPrime/Player/CPlayerEnergyDrain rstl::vector<CEnergyDrainSource, rstl::rmemory_allocator>::insert_into<rstl::const_counting_iterator<CEnergyDrainSource>>(rstl::pointer_iterator<CEnergyDrainSource, rstl::vector<CEnergyDrainSource, rstl::rmemory_allocator>, rstl::rmemory_allocator>, int, rstl::const_counting_iterator<CEnergyDrainSource>) +7 98.98% 100.00%
main/MetroidPrime/ScriptObjects/CFishCloud rstl::vector<CFishCloud::CModifierSource, rstl::rmemory_allocator>::insert_into<rstl::const_counting_iterator<CFishCloud::CModifierSource>>(rstl::pointer_iterator<CFishCloud::CModifierSource, rstl::vector<CFishCloud::CModifierSource, rstl::rmemory_allocator>, rstl::rmemory_allocator>, int, rstl::const_counting_iterator<CFishCloud::CModifierSource>) +7 99.15% 100.00%
main/MetroidPrime/Enemies/CTeamAiMgr rstl::vector<TUniqueId, rstl::rmemory_allocator>::insert_into<rstl::const_counting_iterator<TUniqueId>>(rstl::pointer_iterator<TUniqueId, rstl::vector<TUniqueId, rstl::rmemory_allocator>, rstl::rmemory_allocator>, int, rstl::const_counting_iterator<TUniqueId>) +7 98.90% 100.00%
main/MetroidPrime/ScriptObjects/CScriptSpecialFunction rstl::vector<float, rstl::rmemory_allocator>::insert_into<rstl::const_counting_iterator<float>>(rstl::pointer_iterator<float, rstl::vector<float, rstl::rmemory_allocator>, rstl::rmemory_allocator>, int, rstl::const_counting_iterator<float>) +6 98.88% 100.00%

Report for GM8J01_00 (ecb33dd - 71f82a1)

No changes

Report for GM8E01_02 (ecb33dd - 71f82a1)

No changes

Report for GM8E01_01 (ecb33dd - 71f82a1)

📈 Linked code: 42.09% (+0.37%, +14712 bytes)
📈 Linked data: 15.95% (+0.00%, +56 bytes)

No changes

Comment thread include/rstl/vector.hpp
x0_allocator.allocate(newData, newCapacity);
long atIdx = at - begin();
#if VERSION >= VERSION_GM8P_00 && VERSION != VERSION_GM8E_02
T* const newItems = newData;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

hmmm

@henriquegemignani henriquegemignani Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

bot:

This was an under-explained MWCC register-allocation workaround. I tested roughly 60 alternatives, including direct indexing, pointer/iterator destinations, normal copy helpers, declaration/loop order, and returning the allocation from a helper. None preserved both PAL insertions and both affected USA02 bodies. The const alias gives PAL's TUniqueId/CTeamAiRole insertions 100%/100%; removing it gives 98.89706%/98.56115%. Applying const to USA02 worsens the original float-vector comparison from 93.171425% to 92.171425%, and FishCloud's modifier vector from 95.40659% to 94.63736%.

I retained the explicit qualifier with a short explanation rather than hiding it in a helper. A cleaner natural expression remains unresolved. In 3cc022a I also removed the unsupported USA02 destructor exception: plain >= preserves its generated object exactly. All six configured builds and complete DOL/REL hashes pass; PAL and USA02 regression reports are empty. Audit evidence.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Follow-up in 71f82a1: the destructor guard is now removed entirely. The initial implicit test kept TypesMatch before Think, which moved PAL's destructor/vtable into TypesMatch.cpp. Moving the cast declaration after Think lets MWCC generate both in CTeamAiMgr with exact PAL code/data/relocations and no version condition. All six full builds/hashes pass; all 4,138 generated objects retain allocated bytes and relocations, with zero function regressions. The vector qualifier remains a separate unresolved item. Updated evidence.

@henriquegemignani
henriquegemignani merged commit ad63532 into main Sep 15, 2026
6 checks passed
@henriquegemignani
henriquegemignani deleted the match/team-ai-linkage branch September 15, 2026 19:21
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.

2 participants