Skip to content

Commit 04e4037

Browse files
committed
Revert "Crash fix test"
This reverts commit 41a3f04.
1 parent f7b4468 commit 04e4037

File tree

1 file changed

+0
-130
lines changed

1 file changed

+0
-130
lines changed

MTA10/multiplayer_sa/CMultiplayerSA_CrashFixHacks.cpp

Lines changed: 0 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,136 +1387,6 @@ 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-
// Return model id to use
1413-
//
1414-
//////////////////////////////////////////////////////////////////////////////////////////
1415-
uint OnMY_CAnimManager_CreateAnimAssocGroups( uint uiModelId )
1416-
{
1417-
CModelInfo* pModelInfo = pGameInterface->GetModelInfo( uiModelId );
1418-
CBaseModelInfoSAInterface* pModelInfoSAInterface = pModelInfo->GetInterface();
1419-
bool bIsLoaded = ( pModelInfo->IsLoaded() != 0 );
1420-
bool bHasRwObject = ( pModelInfo->GetInterface()->pRwObject != NULL );
1421-
int iRefCount = pModelInfo->GetRefCount();
1422-
unsigned short usNumberOfRefs = pModelInfoSAInterface->usNumberOfRefs;
1423-
CStreamingInfo* pStreamingInfo = GetStreamingInfoFromModelId( uiModelId );
1424-
1425-
if ( !bIsLoaded || !bHasRwObject || pStreamingInfo->reqload != 1 )
1426-
{
1427-
for( uint i = 0 ; i < 2 ; i++ )
1428-
{
1429-
AddReportLog( 7440, SString( "CAnimManager_CreateAnimAssocGroups: Unexpected id:%d bIsLoaded:%d bHasRwObject:%d iRefCount:%d usNumberOfRefs:%d"
1430-
" gta_hash:%08x chain_next:%04x flg:%02x arch:%d offset:%d size:%d reqload:%d"
1431-
, uiModelId, bIsLoaded, bHasRwObject, iRefCount, usNumberOfRefs
1432-
, pStreamingInfo->gta_hash
1433-
, pStreamingInfo->chain_next
1434-
, pStreamingInfo->flg
1435-
, pStreamingInfo->archiveId
1436-
, pStreamingInfo->offsetInBlocks
1437-
, pStreamingInfo->sizeInBlocks
1438-
, pStreamingInfo->reqload
1439-
) );
1440-
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-
1452-
pModelInfo->Request( BLOCKING, "AnimAssocGroups" );
1453-
1454-
uint uiTimeTaken = 0;
1455-
while( pStreamingInfo->reqload == 2 && uiTimeTaken < 3000 )
1456-
{
1457-
Sleep( 100 );
1458-
uiTimeTaken += 100;
1459-
pGameInterface->GetStreaming()->LoadAllRequestedModels ( true, "AnimAssocGroups" );
1460-
pGameInterface->GetStreaming()->LoadAllRequestedModels ( false, "AnimAssocGroups" );
1461-
}
1462-
1463-
bIsLoaded = ( pModelInfo->IsLoaded() != 0 );
1464-
bHasRwObject = ( pModelInfo->GetInterface()->pRwObject != NULL );
1465-
iRefCount = pModelInfo->GetRefCount();
1466-
usNumberOfRefs = pModelInfoSAInterface->usNumberOfRefs;
1467-
AddReportLog( 7441, SString( "CAnimManager_CreateAnimAssocGroups: Load result id:%d bIsLoaded:%d bHasRwObject:%d iRefCount:%d usNumberOfRefs:%d"
1468-
" gta_hash:%08x chain_next:%04x flg:%02x arch:%d offset:%d size:%d reqload:%d uiTimeTaken:%d"
1469-
, uiModelId, bIsLoaded, bHasRwObject, iRefCount, usNumberOfRefs
1470-
, pStreamingInfo->gta_hash
1471-
, pStreamingInfo->chain_next
1472-
, pStreamingInfo->flg
1473-
, pStreamingInfo->archiveId
1474-
, pStreamingInfo->offsetInBlocks
1475-
, pStreamingInfo->sizeInBlocks
1476-
, pStreamingInfo->reqload
1477-
, uiTimeTaken
1478-
) );
1479-
1480-
if( pStreamingInfo->reqload != 2 )
1481-
break;
1482-
1483-
if ( i == 0 )
1484-
{
1485-
// If still loading, remove and retry
1486-
pModelInfo->ModelAddRef( BLOCKING, "" );
1487-
pModelInfo->RemoveRef();
1488-
}
1489-
}
1490-
}
1491-
1492-
return uiModelId;
1493-
}
1494-
1495-
1496-
// Hook info
1497-
#define HOOKPOS_CAnimManager_CreateAnimAssocGroups 0x4D3D52
1498-
#define HOOKSIZE_CAnimManager_CreateAnimAssocGroups 5
1499-
#define HOOKCHECK_CAnimManager_CreateAnimAssocGroups 0x8B
1500-
DWORD RETURN_CAnimManager_CreateAnimAssocGroups = 0x4D3D59;
1501-
void _declspec(naked) HOOK_CAnimManager_CreateAnimAssocGroups()
1502-
{
1503-
_asm
1504-
{
1505-
pushad
1506-
push eax
1507-
call OnMY_CAnimManager_CreateAnimAssocGroups
1508-
mov [esp+0], eax // Put result temp
1509-
add esp, 4*1
1510-
popad
1511-
1512-
mov eax, [esp-32-4*1] // Get result temp
1513-
1514-
// Replaced code
1515-
mov eax, 0x0A9B0C8[eax*4]
1516-
jmp RETURN_CAnimManager_CreateAnimAssocGroups
1517-
}
1518-
}
1519-
15201390

15211391
//////////////////////////////////////////////////////////////////////////////////////////
15221392
//

0 commit comments

Comments
 (0)