isle icon indicating copy to clipboard operation
isle copied to clipboard

Explore `BETA10` diffs on overloaded thunks

Open disinvite opened this issue 4 months ago • 2 comments

This requires isledecomp/reccmp#181 to verify. That change provides thunks with a unique name (including the parameter string) if the parent is overloaded.

The list of new BETA10 diffs is:

Increased (1):
0x1003bcbc - LegoAct2::FUN_100516b0 (39.77% -> 40.94%)

Decreased (36):
0x1000cb52 - Act2Actor::Animate(float) (57.49% -> 56.97%)
0x100142f1 - LegoAct2::FUN_100521f0 (69.97% -> 69.35%)
0x10018abf - Act3Cop::Animate(float) (64.62% -> 63.85%)
0x10018c6a - Act3Cop::FUN_10040360 (38.41% -> 38.08%)
0x1001a407 - Act3Brickster::FUN_100417c0 (49.27% -> 49.02%)
0x1001b017 - Act3Brickster::FUN_10042300 (74.15% -> 73.90%)
0x1001db2a - Act3Ammo::FUN_10053b40 (80.75% -> 79.81%)
0x10026ceb - Doors::ParseAction (93.20% -> 92.52%)
0x1002ef2f - Infocenter::InitializeBitmaps (35.84% -> 34.25%)
0x1003b049 - LegoAct2::Notify (34.19% -> 32.21%)
0x1003c990 - BoundingSphere::BoundingSphere(class BoundingSphere const &) (100.00% -> 95.45%)
0x1004152b - LegoAnimationManager::FUN_100605e0 (63.84% -> 63.50%)
0x10041a38 - LegoAnimationManager::FUN_100609f0 (87.60% -> 87.05%)
0x1004293c - LegoAnimationManager::Tickle (44.54% -> 44.26%)
0x10042f41 - LegoAnimationManager::FUN_10062110 (85.71% -> 84.95%)
0x10045daf - LegoAnimationManager::FUN_100648f0 (75.00% -> 72.32%)
0x10074e4f - LegoCharacterManager::CreateActorROI (51.05% -> 49.51%)
0x1007ebbe - LegoEntity::GetWorldPosition (100.00% -> 97.67%)
0x1008114a - LegoExtraActor::HitActor(class LegoPathActor *, unsigned char) (80.86% -> 80.60%)
0x100af35e - LegoPathActor::VTable0x68 (50.00% -> 49.00%)
0x100af899 - LegoPathActor::VTable0x9c (40.72% -> 40.39%)
0x100b0520 - LegoPathActor::VTable0x8c (79.80% -> 79.39%)
0x100b1adc - LegoPathBoundary::Intersect (37.09% -> 36.65%)
0x100b957f - LegoPathController::FUN_1004a380 (76.31% -> 75.61%)
0x100bd4a0 - LegoOrientedEdge::DistanceToMidpoint (100.00% -> 97.67%)
0x100bd540 - LegoOrientedEdge::DistanceBetweenMidpoints (100.00% -> 96.77%)
0x100cd8cf - LegoCarRaceActor::FUN_10080590 (38.46% -> 37.18%)
0x100ce19f - LegoJetskiRaceActor::VTable0x1c(class LegoPathBoundary *, struct LegoEdge *) (53.41% -> 53.18%)
0x100cece0 - LegoCarRaceActor::VTable0x1c (58.37% -> 58.14%)
0x100f5366 - SkateBoard::EnableScenePresentation (75.86% -> 74.48%)
0x101722cd - ViewManager::Remove (75.13% -> 74.07%)
0x101723f5 - ViewManager::RemoveAll (77.48% -> 76.58%)
0x1017297f - ViewManager::ManageVisibilityAndDetailRecursively (57.38% -> 56.83%)
0x101832f7 - LegoWEGEdge::LinkEdgesAndFaces (81.13% -> 80.70%)
0x1018b324 - LegoROI::FUN_100a9410 (62.71% -> 61.96%)
0x1018bbf0 - TimeROI::CalculateWorldVelocity (81.03% -> 79.31%)

Many of those look like this:

; 0x100bd4b6
-call Thunk of 'Mx3DPointFloat::Mx3DPointFloat(class Mx3DPointFloat const &)' (FUNCTION)
+call Thunk of 'Mx3DPointFloat::Mx3DPointFloat(class Vector3 const &)' (FUNCTION)

If we swap the addresses on these annotations in mxgeometry3d.h:

// FUNCTION: LEGO1 0x100343a0
// FUNCTION: BETA10 0x10011600
Mx3DPointFloat(const Mx3DPointFloat& p_other) : Vector3(m_elements) { EqualsImpl(p_other.m_data); }

// FUNCTION: LEGO1 0x10048ed0
// FUNCTION: BETA10 0x100151e0
Mx3DPointFloat(const Vector3& p_other) : Vector3(m_elements) { EqualsImpl(p_other.m_data); }

then the list is reduced to:

Increased (1):
0x1003bcbc - LegoAct2::FUN_100516b0 (39.77% -> 40.94%)

Decreased (16):
0x10018c6a - Act3Cop::FUN_10040360 (38.41% -> 38.24%)
0x1001a407 - Act3Brickster::FUN_100417c0 (49.27% -> 49.14%)
0x10026ceb - Doors::ParseAction (93.20% -> 92.52%)
0x1002ef2f - Infocenter::InitializeBitmaps (35.84% -> 34.25%)
0x1004152b - LegoAnimationManager::FUN_100605e0 (63.84% -> 63.50%)
0x10041a38 - LegoAnimationManager::FUN_100609f0 (87.60% -> 87.05%)
0x100436e2 - LegoAnimationManager::FUN_10062650 (71.70% -> 69.81%)
0x10045daf - LegoAnimationManager::FUN_100648f0 (75.00% -> 72.32%)
0x10074e4f - LegoCharacterManager::CreateActorROI (51.05% -> 50.21%)
0x100af899 - LegoPathActor::VTable0x9c (40.72% -> 40.39%)
0x100b0520 - LegoPathActor::VTable0x8c (79.80% -> 79.59%)
0x100cd8cf - LegoCarRaceActor::FUN_10080590 (38.46% -> 37.82%)
0x100f5366 - SkateBoard::EnableScenePresentation (75.86% -> 74.48%)
0x101722cd - ViewManager::Remove (75.13% -> 74.07%)
0x101723f5 - ViewManager::RemoveAll (77.48% -> 76.58%)
0x1017297f - ViewManager::ManageVisibilityAndDetailRecursively (57.38% -> 56.83%)

but that creates this new diff in LegoAnimationManager::FUN_10062650 and possibly other functions:

; 0x100436ff 
-call Thunk of 'Mx3DPointFloat::Mx3DPointFloat(class Mx3DPointFloat const &)' (FUNCTION)
+lea ecx, [ebp - 0x14]
+call Thunk of 'Mx3DPointFloat::Mx3DPointFloat(class Vector3 const &)' (FUNCTION)

So we need to verify which way the Mx3DPointFloat annotations should go, then check the rest of the spots.

disinvite avatar Jul 31 '25 22:07 disinvite

This should help resolve some of the ambiguity with regards to the usage sites of Vector/Mx3D

foxtacles avatar Jul 31 '25 22:07 foxtacles

I took a closer look, might open a PR, keeping this comment for reference.

All those not mentioned are improved by the address swap.

  • [x] LegoAnimationManager::FUN_10062650: This can be fixed by replacing the argument by an Mx3DPointFloat&
  • [ ] Doors::ParseAction: Hard to tell what the problem is
  • [ ] Infocenter::InitializeBitmaps: Probably MxRect<int>::MxRect<int>(int, int, int, int) vs. MxRect<int>::MxRect<int>(class MxPoint<int> const &, class MxSize<int> const &)
  • [ ] BoundingSphere::BoundingSphere(class BoundingSphere const &): Is that some local code of yours? I don't have that match
  • [ ] LegoAnimationManager::FUN_100605e0: likely MxMatrix::MxMatrix(class Matrix4 const &) vs. MxMatrix::MxMatrix(class MxMatrix const &)
  • [ ] LegoAnimationManager::FUN_100609f0: same
  • [ ] LegoAnimationManager::FUN_100648f0: Vector3::Vector3(float const *) vs. Vector3::Vector3(float *)
  • [ ] LegoPathActor::VTable0x9c: hard to tell
  • [ ] LegoPathActor::VTable0x8c: One Vector3::Vector3(float const *) vs Vector3::Vector3(float *) left
  • [ ] LegoCarRaceActor::FUN_10080590: Vector2::Dot(class Vector2 const &, class Vector2 const &) vs. Vector2::Dot(float const *, float const *)
  • [ ] SkateBoard::EnableScenePresentation: MxNotificationParam::MxNotificationParam(void) vs. MxNotificationParam::MxNotificationParam(enum NotificationId, class MxCore *)

jonschz avatar Sep 06 '25 21:09 jonschz