Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order functions in binary up to the end of Helicopter; refactor vector/matrix classes #1309

Merged
merged 19 commits into from
Jan 4, 2025

Conversation

foxtacles
Copy link
Member

@foxtacles foxtacles commented Jan 3, 2025

This PR attemps to order functions in the recomp binary according to how we find them in the original. To make this work, I had to extensively refactor the vector/matrix classes and separate declaration from definition.

The order now looks like:

0001:00000000   0001:00000000          0  fun  110     Score::Score
0001:00000070   0001:00000070          0  fun  25      MxEntity::Create
0001:00000090   0001:00000090          0  fun  10      LegoEntity::SetWorldSpeed
0001:000000a0   0001:000000a0          0  fun  1       LegoWorld::VTable0x60
0001:000000b0   0001:000000b0          0  fun  3       Score::VTable0x5c
0001:000000c0   0001:000000c0          0  fun  6       Score::ClassName
0001:000000d0   0001:000000d0          0  fun  266     Score::IsA
0001:000001e0   0001:000001e0          0  fun  30      Score::`scalar deleting destructor'
0001:00000200   0001:00000200          0  fun  159     Score::~Score
0001:000002a0   0001:000002a0          0  fun  148     Score::Create
0001:00000340   0001:00000340          0  fun  202     Score::DeleteScript
0001:00000410   0001:00000410          0  fun  244     Score::Notify
0001:00000510   0001:00000510          0  fun  110     Score::FUN_10001510
0001:00000580   0001:00000580          0  fun  326     Score::ReadyWorld
0001:000006d0   0001:000006d0          0  fun  688     Score::FUN_100016d0
0001:00000980   0001:00000980          0  fun  73      Score::Enable
0001:000009d0   0001:000009d0          0  fun  744     Score::Paint
0001:00000cc0   0001:00000cc0          0  fun  90      _Tree<char const *,pair<char const * const,LegoTextureInfo *>,map<char const *,LegoTextureInfo *,LegoContainerInfoComparator,allocator<LegoTextureInfo *> >::_Kfn,LegoContainerInfoComparator,allocator<LegoTextureInfo *> >::_Lbound
0001:00000d20   0001:00000d20          0  fun  275     Score::FillArea
0001:00000e40   0001:00000e40          0  fun  22      Score::Escape
0001:00000e60   0001:00000e60          0  fun  259     Helicopter::Helicopter
0001:00000f70   0001:00000f70          0  fun  3       MxCore::Tickle
0001:00000f80   0001:00000f80          0  fun  29      Vector2::AddImpl
0001:00000fa0   0001:00000fa0          0  fun  28      Vector2::AddImpl
0001:00000fc0   0001:00000fc0          0  fun  29      Vector2::SubImpl
0001:00000fe0   0001:00000fe0          0  fun  29      Vector2::MulImpl
0001:00001000   0001:00001000          0  fun  28      Vector2::MulImpl
0001:00001020   0001:00001020          0  fun  28      Vector2::DivImpl
0001:00001040   0001:00001040          0  fun  23      Vector2::DotImpl
0001:00001060   0001:00001060          0  fun  10      Vector2::SetData
0001:00001070   0001:00001070          0  fun  20      Vector2::EqualsImpl
0001:00001090   0001:00001090          0  fun  4       Vector2::GetData
0001:000010a0   0001:000010a0          0  fun  4       Vector2::GetData
0001:000010b0   0001:000010b0          0  fun  17      Vector2::Clear
0001:000010d0   0001:000010d0          0  fun  18      Vector2::Dot
0001:000010f0   0001:000010f0          0  fun  24      Vector2::Dot
0001:00001110   0001:00001110          0  fun  21      Vector2::Dot
0001:00001130   0001:00001130          0  fun  21      Vector2::Dot
0001:00001150   0001:00001150          0  fun  16      Vector2::LenSquared
0001:00001160   0001:00001160          0  fun  81      Vector2::Unitize
0001:000011c0   0001:000011c0          0  fun  12      Vector2::operator+=
0001:000011d0   0001:000011d0          0  fun  13      Vector2::operator+=
0001:000011e0   0001:000011e0          0  fun  16      Vector2::operator+=
0001:000011f0   0001:000011f0          0  fun  13      Vector2::operator-=
0001:00001200   0001:00001200          0  fun  16      Vector2::operator-=
0001:00001210   0001:00001210          0  fun  13      Vector2::operator*=
0001:00001220   0001:00001220          0  fun  16      Vector2::operator*=
0001:00001230   0001:00001230          0  fun  13      Vector2::operator*=
0001:00001240   0001:00001240          0  fun  13      Vector2::operator/=
0001:00001250   0001:00001250          0  fun  13      Vector2::operator=
0001:00001260   0001:00001260          0  fun  16      Vector2::operator=
0001:00001270   0001:00001270          0  fun  68      Vector3::EqualsCrossImpl
0001:000012c0   0001:000012c0          0  fun  24      Vector3::EqualsCross
0001:000012e0   0001:000012e0          0  fun  21      Vector3::EqualsCross
0001:00001300   0001:00001300          0  fun  21      Vector3::EqualsCross
0001:00001320   0001:00001320          0  fun  21      Matrix4::Equals
0001:00001340   0001:00001340          0  fun  24      Matrix4::Equals
0001:00001360   0001:00001360          0  fun  10      Matrix4::SetData
0001:00001370   0001:00001370          0  fun  10      Matrix4::SetData
0001:000013a0   0001:000013a0          0  fun  20      Matrix4::Element
0001:000013c0   0001:000013c0          0  fun  20      Matrix4::Element
0001:000013e0   0001:000013e0          0  fun  15      Matrix4::Clear
0001:000013f0   0001:000013f0          0  fun  38      Matrix4::SetIdentity
0001:00001420   0001:00001420          0  fun  12      Matrix4::operator=
0001:00001430   0001:00001430          0  fun  40      Matrix4::operator+=
0001:00001460   0001:00001460          0  fun  51      Matrix4::TranslateBy
0001:000014a0   0001:000014a0          0  fun  39      Matrix4::SetTranslation
0001:000014d0   0001:000014d0          0  fun  95      Matrix4::Product
0001:00001530   0001:00001530          0  fun  24      Matrix4::Product
0001:00001550   0001:00001550          0  fun  444     Matrix4::ToQuaternion
0001:00001710   0001:00001710          0  fun  310     Matrix4::FromQuaternion
0001:00001850   0001:00001850          0  fun  12      MxMatrix::operator=
0001:00001860   0001:00001860          0  fun  12      MxMatrix::operator=
0001:00001870   0001:00001870          0  fun  55      Vector4::AddImpl
0001:000018b0   0001:000018b0          0  fun  56      Vector4::AddImpl
0001:000018f0   0001:000018f0          0  fun  55      Vector4::SubImpl
0001:00001930   0001:00001930          0  fun  55      Vector4::MulImpl
0001:00001970   0001:00001970          0  fun  52      Vector4::MulImpl
0001:000019b0   0001:000019b0          0  fun  52      Vector4::DivImpl
0001:000019f0   0001:000019f0          0  fun  39      Vector4::DotImpl
0001:00001a20   0001:00001a20          0  fun  32      Vector4::EqualsImpl
0001:00001a40   0001:00001a40          0  fun  151     Vector4::SetMatrixProduct
0001:00001ae0   0001:00001ae0          0  fun  24      Vector4::SetMatrixProduct
0001:00001b00   0001:00001b00          0  fun  17      Vector4::Clear
0001:00001b20   0001:00001b20          0  fun  32      Vector4::LenSquared
0001:00001b40   0001:00001b40          0  fun  40      Vector4::Fill
0001:00001b70   0001:00001b70          0  fun  121     Vector4::NormalizeQuaternion
0001:00001bf0   0001:00001bf0          0  fun  205     Vector4::EqualsHamiltonProduct
0001:00001cc0   0001:00001cc0          0  fun  4       LegoActor::GetSoundFrequencyFactor
0001:00001cd0   0001:00001cd0          0  fun  10      LegoActor::SetSoundFrequencyFactor
0001:00001ce0   0001:00001ce0          0  fun  10      LegoActor::VTable0x58
0001:00001cf0   0001:00001cf0          0  fun  4       LegoActor::VTable0x5c
0001:00001d00   0001:00001d00          0  fun  4       LegoActor::GetActorId
0001:00001d10   0001:00001d10          0  fun  10      LegoActor::SetActorId
0001:00001d20   0001:00001d20          0  fun  13      LegoPathActor::SetUserNavFlag
0001:00001d30   0001:00001d30          0  fun  7       LegoPathActor::GetUserNavFlag
0001:00001d40   0001:00001d40          0  fun  5       LegoPathActor::VTable0x90
0001:00001d50   0001:00001d50          0  fun  5       LegoPathActor::HitActor
0001:00001d60   0001:00001d60          0  fun  3       LegoPathActor::VTable0xa0
0001:00001d70   0001:00001d70          0  fun  13      LegoPathActor::SetMaxLinearVel
0001:00001d80   0001:00001d80          0  fun  7       LegoPathActor::GetMaxLinearVel
0001:00001d90   0001:00001d90          0  fun  7       LegoPathActor::VTable0xb4
0001:00001da0   0001:00001da0          0  fun  7       LegoPathActor::VTable0xb8
0001:00001db0   0001:00001db0          0  fun  13      LegoPathActor::VTable0xbc
0001:00001dc0   0001:00001dc0          0  fun  13      LegoPathActor::VTable0xc0
0001:00001dd0   0001:00001dd0          0  fun  1       LegoPathActor::VTable0xc4
0001:00001de0   0001:00001de0          0  fun  13      LegoPathActor::VTable0xc8
0001:00001df0   0001:00001df0          0  fun  3       IslePathActor::HandleNotification0
0001:00001e00   0001:00001e00          0  fun  5       IslePathActor::HandlePathStruct
0001:00001e10   0001:00001e10          0  fun  93      IslePathActor::~IslePathActor
0001:00001e70   0001:00001e70          0  fun  3       IslePathActor::HandleClick
0001:00001e80   0001:00001e80          0  fun  5       IslePathActor::HandleControl
0001:00001e90   0001:00001e90          0  fun  5       IslePathActor::HandleEndAnim
0001:00001ea0   0001:00001ea0          0  fun  6       IslePathActor::ClassName
0001:00001eb0   0001:00001eb0          0  fun  318     IslePathActor::IsA
0001:00001ff0   0001:00001ff0          0  fun  117     IslePathActor::`scalar deleting destructor'
0001:00002070   0001:00002080         16  fun  6       Helicopter::ClassName
0001:00002080   0001:00002090         16  fun  370     Helicopter::IsA
0001:00002200   0001:00002070       -400  fun  16      Mx4DPointFloat::operator=
0001:00002210   0001:00002210          0  fun  30      Helicopter::`scalar deleting destructor'
0001:00002230   0001:00002230          0  fun  132     Helicopter::~Helicopter
0001:000022c0   0001:000022c0          0  fun  85      Helicopter::Create
0001:00002320   0001:00002320          0  fun  55      Helicopter::CreateState
0001:00002360   0001:00002360          0  fun  274     Helicopter::Exit
0001:00002480   0001:00002480          0  fun  350     Helicopter::HandleClick
0001:000025e0   0001:000025e0          0  fun  1148    Helicopter::HandleControl
0001:00002a60   0001:00002a60          0  fun  42      Vector3::AddImpl
0001:00002a90   0001:00002a90          0  fun  42      Vector3::AddImpl
0001:00002ac0   0001:00002ac0          0  fun  42      Vector3::SubImpl
0001:00002af0   0001:00002af0          0  fun  42      Vector3::MulImpl
0001:00002b20   0001:00002b20          0  fun  40      Vector3::MulImpl
0001:00002b50   0001:00002b50          0  fun  40      Vector3::DivImpl
0001:00002b80   0001:00002b80          0  fun  31      Vector3::DotImpl
0001:00002ba0   0001:00002ba0          0  fun  26      Vector3::EqualsImpl
0001:00002bc0   0001:00002bc0          0  fun  14      Vector3::Clear
0001:00002bd0   0001:00002bd0          0  fun  24      Vector3::LenSquared
0001:00002bf0   0001:00002bf0          0  fun  32      Vector3::Fill
0001:00002c10   0001:00002c10          0  fun  16      Mx3DPointFloat::operator=
0001:00002c20   0001:00002c20          0  fun  618     Helicopter::HandleEndAnim
0001:00002e90   0001:00002e90          0  fun  66      Helicopter::VTable0x74
0001:00002ee0   0001:00002ee0          0  fun  440     Helicopter::Animate
0001:000030a0   0001:000030a0          0  fun  496     MxQuaternionTransformer::Interpolate
0001:000032a0   0001:00003290        -16  fun  607     Helicopter::FUN_100042a0
0001:00003500   0001:00003510         16  fun  18      Matrix4::Matrix4
0001:00003520   0001:00003530         16  fun  248     MxQuaternionTransformer::NormalizeDirection
0001:00003620   0001:00003630         16  fun  24      MxQuaternionTransformer::SetEnd
0001:00003640   0001:00003650         16  fun  41      Helicopter::FUN_10004640
0001:00003670   0001:00003680         16  fun  41      Helicopter::FUN_10004670

There is one anomaly around the beginning of the Helicopter class, where Mx4DPointFloat::operator= appears to be situated in between Helicopter::IsA and the scalar ddtor. I haven't found a way to fix that yet.

The other inaccuracy in order is because of Helicopter::FUN_100042a0, which isn't fully matching and has some incorrect inlining. This should line up once the function is fully matched.

Before this can be merged, we still need to figure out the detection of the function annotation of Matrix4::GetData (@disinvite )

@foxtacles foxtacles merged commit c54805f into isledecomp:master Jan 4, 2025
12 checks passed
@foxtacles foxtacles deleted the exppp branch January 4, 2025 22:07
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.

1 participant