@@ -1414,16 +1414,20 @@ CStreamingInfo* GetStreamingInfoFromModelId ( uint id )
1414
1414
void OnMY_CAnimManager_CreateAnimAssocGroups ( uint uiModelId )
1415
1415
{
1416
1416
CModelInfo* pModelInfo = pGameInterface->GetModelInfo ( uiModelId );
1417
+ CBaseModelInfoSAInterface* pModelInfoSAInterface = pModelInfo->GetInterface ();
1417
1418
bool bIsLoaded = ( pModelInfo->IsLoaded () != 0 );
1418
1419
bool bHasRwObject = ( pModelInfo->GetInterface ()->pRwObject != NULL );
1419
1420
int iRefCount = pModelInfo->GetRefCount ();
1421
+ unsigned short usNumberOfRefs = pModelInfoSAInterface->usNumberOfRefs ;
1420
1422
CStreamingInfo* pStreamingInfo = GetStreamingInfoFromModelId ( uiModelId );
1421
1423
1422
1424
if ( !bIsLoaded || !bHasRwObject || pStreamingInfo->reqload != 1 )
1423
1425
{
1424
- AddReportLog ( 7440 , SString ( " CAnimManager_CreateAnimAssocGroups: Unexpected id:%d bIsLoaded:%d bHasRwObject:%d iRefCount:%d"
1426
+ for ( uint i = 0 ; i < 2 ; i++ )
1427
+ {
1428
+ AddReportLog ( 7440 , SString ( " CAnimManager_CreateAnimAssocGroups: Unexpected id:%d bIsLoaded:%d bHasRwObject:%d iRefCount:%d usNumberOfRefs:%d"
1425
1429
" gta_hash:%08x chain_next:%04x flg:%02x arch:%d offset:%d size:%d reqload:%d"
1426
- , uiModelId, bIsLoaded, bHasRwObject, iRefCount
1430
+ , uiModelId, bIsLoaded, bHasRwObject, iRefCount, usNumberOfRefs
1427
1431
, pStreamingInfo->gta_hash
1428
1432
, pStreamingInfo->chain_next
1429
1433
, pStreamingInfo->flg
@@ -1435,19 +1439,42 @@ void OnMY_CAnimManager_CreateAnimAssocGroups( uint uiModelId )
1435
1439
1436
1440
pModelInfo->Request ( BLOCKING, " AnimAssocGroups" );
1437
1441
1442
+ uint uiTimeTaken = 0 ;
1443
+ while ( pStreamingInfo->reqload == 2 && uiTimeTaken < 3000 )
1444
+ {
1445
+ Sleep ( 100 );
1446
+ uiTimeTaken += 100 ;
1447
+ pGameInterface->GetStreaming ()->LoadAllRequestedModels ( true , " AnimAssocGroups" );
1448
+ pGameInterface->GetStreaming ()->LoadAllRequestedModels ( false , " AnimAssocGroups" );
1449
+ }
1450
+
1438
1451
bIsLoaded = ( pModelInfo->IsLoaded () != 0 );
1439
1452
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
1453
+ iRefCount = pModelInfo->GetRefCount ();
1454
+ usNumberOfRefs = pModelInfoSAInterface->usNumberOfRefs ;
1455
+ AddReportLog ( 7441 , SString ( " CAnimManager_CreateAnimAssocGroups: Load result id:%d bIsLoaded:%d bHasRwObject:%d iRefCount:%d usNumberOfRefs:%d"
1456
+ " gta_hash:%08x chain_next:%04x flg:%02x arch:%d offset:%d size:%d reqload:%d uiTimeTaken:%d"
1457
+ , uiModelId, bIsLoaded, bHasRwObject, iRefCount, usNumberOfRefs
1443
1458
, pStreamingInfo->gta_hash
1444
1459
, pStreamingInfo->chain_next
1445
1460
, pStreamingInfo->flg
1446
1461
, pStreamingInfo->archiveId
1447
1462
, pStreamingInfo->offsetInBlocks
1448
1463
, pStreamingInfo->sizeInBlocks
1449
1464
, pStreamingInfo->reqload
1465
+ , uiTimeTaken
1450
1466
) );
1467
+
1468
+ if ( pStreamingInfo->reqload != 2 )
1469
+ break ;
1470
+
1471
+ if ( i == 0 )
1472
+ {
1473
+ // If still loading, remove and retry
1474
+ pModelInfo->ModelAddRef ( BLOCKING, " " );
1475
+ pModelInfo->RemoveRef ();
1476
+ }
1477
+ }
1451
1478
}
1452
1479
}
1453
1480
0 commit comments