@@ -1387,6 +1387,92 @@ void _declspec(naked) HOOK_CVolumetricShadowMgr_Update()
13871387 }
13881388}
13891389
1390+ struct CStreamingInfo
1391+ {
1392+ DWORD gta_hash;
1393+ WORD chain_next;
1394+ uchar flg;
1395+ uchar archiveId;
1396+ DWORD offsetInBlocks;
1397+ DWORD sizeInBlocks;
1398+ DWORD reqload;
1399+ };
1400+
1401+ CStreamingInfo* GetStreamingInfoFromModelId ( uint id )
1402+ {
1403+ CStreamingInfo* pItemInfo = (CStreamingInfo*)(0x8E4CC0 );
1404+ return pItemInfo + id;
1405+ }
1406+
1407+ // ////////////////////////////////////////////////////////////////////////////////////////
1408+ //
1409+ // CAnimManager_CreateAnimAssocGroups
1410+ //
1411+ // A model (usually 7) has to be loaded for this to work
1412+ //
1413+ // ////////////////////////////////////////////////////////////////////////////////////////
1414+ void OnMY_CAnimManager_CreateAnimAssocGroups ( uint uiModelId )
1415+ {
1416+ CModelInfo* pModelInfo = pGameInterface->GetModelInfo ( uiModelId );
1417+ bool bIsLoaded = ( pModelInfo->IsLoaded () != 0 );
1418+ bool bHasRwObject = ( pModelInfo->GetInterface ()->pRwObject != NULL );
1419+ int iRefCount = pModelInfo->GetRefCount ();
1420+ CStreamingInfo* pStreamingInfo = GetStreamingInfoFromModelId ( uiModelId );
1421+
1422+ if ( !bIsLoaded || !bHasRwObject || pStreamingInfo->reqload != 1 )
1423+ {
1424+ AddReportLog ( 7440 , SString ( " CAnimManager_CreateAnimAssocGroups: Unexpected id:%d bIsLoaded:%d bHasRwObject:%d iRefCount:%d"
1425+ " gta_hash:%08x chain_next:%04x flg:%02x arch:%d offset:%d size:%d reqload:%d"
1426+ , uiModelId, bIsLoaded, bHasRwObject, iRefCount
1427+ , pStreamingInfo->gta_hash
1428+ , pStreamingInfo->chain_next
1429+ , pStreamingInfo->flg
1430+ , pStreamingInfo->archiveId
1431+ , pStreamingInfo->offsetInBlocks
1432+ , pStreamingInfo->sizeInBlocks
1433+ , pStreamingInfo->reqload
1434+ ) );
1435+
1436+ pModelInfo->Request ( BLOCKING, " AnimAssocGroups" );
1437+
1438+ bIsLoaded = ( pModelInfo->IsLoaded () != 0 );
1439+ bHasRwObject = ( pModelInfo->GetInterface ()->pRwObject != NULL );
1440+ AddReportLog ( 7441 , SString ( " CAnimManager_CreateAnimAssocGroups: Load result id:%d bIsLoaded:%d bHasRwObject:%d iRefCount:%d"
1441+ " gta_hash:%08x chain_next:%04x flg:%02x arch:%d offset:%d size:%d reqload:%d"
1442+ , uiModelId, bIsLoaded, bHasRwObject, iRefCount
1443+ , pStreamingInfo->gta_hash
1444+ , pStreamingInfo->chain_next
1445+ , pStreamingInfo->flg
1446+ , pStreamingInfo->archiveId
1447+ , pStreamingInfo->offsetInBlocks
1448+ , pStreamingInfo->sizeInBlocks
1449+ , pStreamingInfo->reqload
1450+ ) );
1451+ }
1452+ }
1453+
1454+
1455+ // Hook info
1456+ #define HOOKPOS_CAnimManager_CreateAnimAssocGroups 0x4D3D52
1457+ #define HOOKSIZE_CAnimManager_CreateAnimAssocGroups 5
1458+ #define HOOKCHECK_CAnimManager_CreateAnimAssocGroups 0x8B
1459+ DWORD RETURN_CAnimManager_CreateAnimAssocGroups = 0x4D3D59 ;
1460+ void _declspec (naked) HOOK_CAnimManager_CreateAnimAssocGroups ()
1461+ {
1462+ _asm
1463+ {
1464+ pushad
1465+ push eax
1466+ call OnMY_CAnimManager_CreateAnimAssocGroups
1467+ add esp, 4 *1
1468+ popad
1469+
1470+ // Replaced code
1471+ mov eax, 0x0A9B0C8 [eax*4 ]
1472+ jmp RETURN_CAnimManager_CreateAnimAssocGroups
1473+ }
1474+ }
1475+
13901476
13911477// ////////////////////////////////////////////////////////////////////////////////////////
13921478//
@@ -1432,4 +1518,5 @@ void CMultiplayerSA::InitHooks_CrashFixHacks ( void )
14321518 EZHookInstall ( ResetFurnitureObjectCounter );
14331519 EZHookInstallChecked ( CVolumetricShadowMgr_Render );
14341520 EZHookInstallChecked ( CVolumetricShadowMgr_Update );
1521+ EZHookInstallChecked ( CAnimManager_CreateAnimAssocGroups );
14351522}
0 commit comments