Skip to content

Commit 7611b0a

Browse files
committed
Crash fix test #3
1 parent 3fbf3bd commit 7611b0a

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

MTA10/multiplayer_sa/CMultiplayerSA_CrashFixHacks.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1409,9 +1409,10 @@ CStreamingInfo* GetStreamingInfoFromModelId ( uint id )
14091409
// CAnimManager_CreateAnimAssocGroups
14101410
//
14111411
// A model (usually 7) has to be loaded for this to work
1412+
// Return model id to use
14121413
//
14131414
//////////////////////////////////////////////////////////////////////////////////////////
1414-
void OnMY_CAnimManager_CreateAnimAssocGroups( uint uiModelId )
1415+
uint OnMY_CAnimManager_CreateAnimAssocGroups( uint uiModelId )
14151416
{
14161417
CModelInfo* pModelInfo = pGameInterface->GetModelInfo( uiModelId );
14171418
CBaseModelInfoSAInterface* pModelInfoSAInterface = pModelInfo->GetInterface();
@@ -1437,6 +1438,17 @@ void OnMY_CAnimManager_CreateAnimAssocGroups( uint uiModelId )
14371438
, pStreamingInfo->reqload
14381439
) );
14391440

1441+
// Change to use model 9
1442+
uiModelId = 9;
1443+
1444+
pModelInfo = pGameInterface->GetModelInfo( uiModelId );
1445+
pModelInfoSAInterface = pModelInfo->GetInterface();
1446+
bIsLoaded = ( pModelInfo->IsLoaded() != 0 );
1447+
bHasRwObject = ( pModelInfo->GetInterface()->pRwObject != NULL );
1448+
iRefCount = pModelInfo->GetRefCount();
1449+
usNumberOfRefs = pModelInfoSAInterface->usNumberOfRefs;
1450+
pStreamingInfo = GetStreamingInfoFromModelId( uiModelId );
1451+
14401452
pModelInfo->Request( BLOCKING, "AnimAssocGroups" );
14411453

14421454
uint uiTimeTaken = 0;
@@ -1476,6 +1488,8 @@ void OnMY_CAnimManager_CreateAnimAssocGroups( uint uiModelId )
14761488
}
14771489
}
14781490
}
1491+
1492+
return uiModelId;
14791493
}
14801494

14811495

@@ -1491,9 +1505,12 @@ void _declspec(naked) HOOK_CAnimManager_CreateAnimAssocGroups()
14911505
pushad
14921506
push eax
14931507
call OnMY_CAnimManager_CreateAnimAssocGroups
1508+
mov [esp+0], eax // Put result temp
14941509
add esp, 4*1
14951510
popad
14961511

1512+
mov eax, [esp-32-4*1] // Get result temp
1513+
14971514
// Replaced code
14981515
mov eax, 0x0A9B0C8[eax*4]
14991516
jmp RETURN_CAnimManager_CreateAnimAssocGroups

0 commit comments

Comments
 (0)