Skip to content

Commit cd5b740

Browse files
committed
Added workaround for Visual Studio inline bug
1 parent 7e23ac1 commit cd5b740

14 files changed

+61
-2
lines changed

Client/game_sa/CAudioEngineSA.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ VOID CAudioEngineSA::UpdateAmbientSoundSettings(void)
426426
MemPut<BYTE>(0x507814, 0x33); // No gunfire
427427
}
428428

429+
__declspec(noinline)
429430
bool _cdecl IsAmbientSoundGeneralEnabled(void)
430431
{
431432
if (pGame)
@@ -505,6 +506,7 @@ bool CAudioEngineSA::OnWorldSound(CAESound* pAESound)
505506

506507
////////////////////////////////////////////////////////////////////////////////////////////////
507508
// Return false to skip sound
509+
__declspec(noinline)
508510
bool _cdecl On_CAESoundManager_RequestNewSound(CAESound* pAESound)
509511
{
510512
return g_pAudioSA->OnWorldSound(pAESound);

Client/game_sa/CCameraSA.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ void CCameraSA::GetCameraClip(bool &bObjects, bool &bVehicles)
568568
bVehicles = bCameraClipVehicles;
569569
}
570570

571+
__declspec(noinline)
571572
void _cdecl DoCameraCollisionDetectionPokes()
572573
{
573574
if (!bCameraClipObjects)

Client/game_sa/CFxSystemSA.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ bool CFxSystemSA::HasCustomDrawDistance(void)
123123
// Poke new draw distance for the FxSystem
124124
//
125125
//////////////////////////////////////////////////////////////////////////////////////////
126+
__declspec(noinline)
126127
void OnMY_FxSystem_c_Update_MidA_Pre(CFxSystemSAInterface* pFxSystemSAInterface)
127128
{
128129
CFxSystemSA* pFxSystemSA = pGame->GetFxManagerSA()->GetFxSystem(pFxSystemSAInterface);
@@ -138,6 +139,7 @@ void OnMY_FxSystem_c_Update_MidA_Pre(CFxSystemSAInterface* pFxSystemSAInterface)
138139
ms_fUsingDrawDistance = 0;
139140
}
140141

142+
__declspec(noinline)
141143
void OnMY_FxSystem_c_Update_MidA_Post(void)
142144
{
143145
if (ms_pUsingFxSystemSAInterface)
@@ -189,6 +191,7 @@ void _declspec(naked) HOOK_FxSystem_c_Update_MidA()
189191
// Poke new draw distances for each emitter
190192
//
191193
//////////////////////////////////////////////////////////////////////////////////////////
194+
__declspec(noinline)
192195
void OnMY_FxSystem_c_Update_MidB_Pre(CFxEmitterSAInterface* pFxEmitterSAInterface)
193196
{
194197
if (ms_fUsingDrawDistance)
@@ -206,6 +209,7 @@ void OnMY_FxSystem_c_Update_MidB_Pre(CFxEmitterSAInterface* pFxEmitterSAInterfac
206209
}
207210
}
208211

212+
__declspec(noinline)
209213
void OnMY_FxSystem_c_Update_MidB_Post(void)
210214
{
211215
if (ms_pUsingFxEmitterSAInterface)

Client/game_sa/CHandlingManagerSA.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ CHandlingEntrySA* CHandlingManagerSA::m_pOriginalEntries[HT_MAX];
2727

2828
DWORD m_dwStore_Calculate = 0;
2929

30+
__declspec(noinline)
3031
void DumpHandlingData(tHandlingDataSA* pData)
3132
{
3233
unsigned int iCounter = pData->iVehicleID;

Client/game_sa/CModelInfoSA.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,7 @@ void CModelInfoSA::MakePedModel(char* szTexture)
11891189
// Skip loading GTA collision model if we have replaced it
11901190
//
11911191
//////////////////////////////////////////////////////////////////////////////////////////
1192+
__declspec(noinline)
11921193
bool OnMY_CFileLoader_LoadCollisionFile_Mid(int iModelId)
11931194
{
11941195
if (MapContains(CModelInfoSA::ms_ReplacedColModels, iModelId))
@@ -1235,6 +1236,7 @@ void _declspec(naked) HOOK_CFileLoader_LoadCollisionFile_Mid()
12351236
// Ignore extra characters in dff frame name
12361237
//
12371238
//////////////////////////////////////////////////////////////////////////////////////////
1239+
__declspec(noinline)
12381240
void OnMY_NodeNameStreamRead(RwStream* stream, char* pDest, uint uiSize)
12391241
{
12401242
// Calc sizes

Client/game_sa/CPedSA.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,6 +1745,7 @@ ePedState CPedSA::GetPedState()
17451745
// Check if they have already been applied.
17461746
//
17471747
////////////////////////////////////////////////////////////////
1748+
__declspec(noinline)
17481749
int _cdecl OnCPed_PreRenderAfterTest(CPedSAInterface* pPedInterface)
17491750
{
17501751
if (pPedInterface->pedFlags.bCalledPreRender)

Client/game_sa/CPlayerPedSA.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ int GetAnimPose(int iAnim)
492492
// Returns anim to use
493493
//
494494
////////////////////////////////////////////////////////////////
495+
__declspec(noinline)
495496
int _cdecl OnCPlayerPed_ProcessAnimGroups_Mid(CPlayerPedSAInterface *pPlayerPedSAInterface, int iReqMoveAnim)
496497
{
497498
CPed *pPed = pGame->GetPools()->GetPed((DWORD *)pPlayerPedSAInterface);
@@ -553,6 +554,7 @@ void _declspec(naked) HOOK_CPlayerPed_ProcessAnimGroups_Mid()
553554
// Returns MOVE_PLAYER, MOVE_PLAYER_F or MOVE_PLAYER_M
554555
//
555556
////////////////////////////////////////////////////////////////
557+
__declspec(noinline)
556558
int _cdecl OnCClothes_GetDefaultPlayerMotionGroup(int iReqMoveAnim)
557559
{
558560
CPed *pPed = g_pCore->GetMultiplayer()->GetContextSwitchedPed();

Client/game_sa/CRenderWareSA.ClothesReplacing.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ bool CRenderWareSA::HasClothesReplacementChanged(void)
110110
// then maybe switch to replacement txd file data
111111
//
112112
////////////////////////////////////////////////////////////////
113+
__declspec(noinline)
113114
bool _cdecl OnCStreaming_RequestModel_Mid(int flags, SImgGTAItemInfo* pImgGTAInfo)
114115
{
115116
// Check is player.img

Client/game_sa/CRenderWareSA.ShaderSupport.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ static CMappedArray<STxdStreamEvent> ms_txdStreamEventList;
6868
////////////////////////////////////////////////////////////////
6969
// Txd created
7070
////////////////////////////////////////////////////////////////
71+
__declspec(noinline)
7172
void _cdecl OnStreamingAddedTxd(DWORD dwTxdId)
7273
{
7374
ushort usTxdId = (ushort)dwTxdId;
@@ -101,6 +102,7 @@ void _declspec(naked) HOOK_CTxdStore_SetupTxdParent()
101102
////////////////////////////////////////////////////////////////
102103
// Txd remove
103104
////////////////////////////////////////////////////////////////
105+
__declspec(noinline)
104106
void _cdecl OnStreamingRemoveTxd(DWORD dwTxdId)
105107
{
106108
ushort usTxdId = (ushort)dwTxdId - 20000;
@@ -668,6 +670,7 @@ void CRenderWareSA::SetGTAVertexShadersEnabled(bool bEnable)
668670
// Check each created texture, so we can add special ones to the shader system
669671
//
670672
//////////////////////////////////////////////////////////////////////////////////////////
673+
__declspec(noinline)
671674
void OnMY_RwTextureSetName(DWORD dwAddrCalledFrom, RwTexture* pTexture, const char* szName)
672675
{
673676
SString strReplacementName;
@@ -715,6 +718,7 @@ void _declspec(naked) HOOK_RwTextureSetName()
715718
// Check each destroyed texture, so we can remove special ones from the shader system
716719
//
717720
//////////////////////////////////////////////////////////////////////////////////////////
721+
__declspec(noinline)
718722
void OnMY_RwTextureDestroy_Mid(RwTexture* pTexture)
719723
{
720724
pGame->GetRenderWareSA()->SpecialRemovedTexture(pTexture);
@@ -750,6 +754,7 @@ void _declspec(naked) HOOK_RwTextureDestroy_Mid()
750754
// Classify what is going on here
751755
//
752756
//////////////////////////////////////////////////////////////////////////////////////////
757+
__declspec(noinline)
753758
void OnMY_RwIm3DRenderIndexedPrimitive_Pre(DWORD dwAddrCalledFrom)
754759
{
755760
if (dwAddrCalledFrom == ADDR_CVehicle_DoHeadLightBeam_RenderPrimitive || dwAddrCalledFrom == ADDR_CHeli_SearchLightCone_RenderPrimitive ||
@@ -763,6 +768,7 @@ void OnMY_RwIm3DRenderIndexedPrimitive_Pre(DWORD dwAddrCalledFrom)
763768
}
764769
}
765770

771+
__declspec(noinline)
766772
void OnMY_RwIm3DRenderIndexedPrimitive_Post(DWORD dwAddrCalledFrom)
767773
{
768774
CRenderWareSA::ms_iRenderingType = RT_NONE;
@@ -811,11 +817,13 @@ void _declspec(naked) HOOK_RwIm3DRenderIndexedPrimitive()
811817
// Note that RwIm3DRenderPrimitive is being called to render something
812818
//
813819
//////////////////////////////////////////////////////////////////////////////////////////
820+
__declspec(noinline)
814821
void OnMY_RwIm3DRenderPrimitive_Pre(DWORD dwAddrCalledFrom)
815822
{
816823
CRenderWareSA::ms_iRenderingType = RT_3DNI;
817824
}
818825

826+
__declspec(noinline)
819827
void OnMY_RwIm3DRenderPrimitive_Post(DWORD dwAddrCalledFrom)
820828
{
821829
CRenderWareSA::ms_iRenderingType = RT_NONE;
@@ -864,11 +872,13 @@ void _declspec(naked) HOOK_RwIm3DRenderPrimitive()
864872
// Note that RwIm2DRenderIndexedPrimitive is being called to render something
865873
//
866874
//////////////////////////////////////////////////////////////////////////////////////////
875+
__declspec(noinline)
867876
void OnMY_RwIm2DRenderIndexedPrimitive_Pre(DWORD dwAddrCalledFrom)
868877
{
869878
CRenderWareSA::ms_iRenderingType = RT_2DI;
870879
}
871880

881+
__declspec(noinline)
872882
void OnMY_RwIm2DRenderIndexedPrimitive_Post(DWORD dwAddrCalledFrom)
873883
{
874884
CRenderWareSA::ms_iRenderingType = RT_NONE;
@@ -919,11 +929,13 @@ void _declspec(naked) HOOK_RwIm2DRenderIndexedPrimitive()
919929
// Note that RwIm2DRenderPrimitive is being called to render something
920930
//
921931
//////////////////////////////////////////////////////////////////////////////////////////
932+
__declspec(noinline)
922933
void OnMY_RwIm2DRenderPrimitive_Pre(DWORD dwAddrCalledFrom)
923934
{
924935
CRenderWareSA::ms_iRenderingType = RT_2DNI;
925936
}
926937

938+
__declspec(noinline)
927939
void OnMY_RwIm2DRenderPrimitive_Post(DWORD dwAddrCalledFrom)
928940
{
929941
CRenderWareSA::ms_iRenderingType = RT_NONE;

Client/game_sa/CSettingsSA.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ void CSettingsSA::SetVolumetricShadowsSuspended(bool bSuspended)
332332
DWORD dwFxQualityValue = 0;
333333
WORD usCallingForVehicleModel = 0;
334334

335+
__declspec(noinline)
335336
void _cdecl MaybeAlterFxQualityValue(DWORD dwAddrCalledFrom)
336337
{
337338
// Handle all calls from CVolumetricShadowMgr
@@ -829,6 +830,7 @@ int CSettingsSA::OnSelectDevice(void)
829830
// * Choose whether to show the device selection dialog box
830831
//
831832
//////////////////////////////////////////////////////////////////////////////////////////
833+
__declspec(noinline)
832834
int OnMY_SelectDevice(void)
833835
{
834836
CSettingsSA* gameSettings = (CSettingsSA*)pGame->GetSettings();

Client/game_sa/CTaskManagementSystemSA.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,11 @@ CTask* CTaskManagementSystemSA::CreateAppropriateTask(CTaskSAInterface* pTaskInt
242242
}
243243

244244
// HOOKS
245+
__declspec(noinline)
246+
void OnMY_Task_Operator_Delete(CTaskSAInterface* pTaskInterface)
247+
{
248+
((CTaskManagementSystemSA*)(pGame->GetTaskManagementSystem()))->RemoveTask(pTempTaskInterface);
249+
}
245250

246251
VOID _declspec(naked) HOOK_CTask_Operator_Delete()
247252
{
@@ -253,7 +258,7 @@ VOID _declspec(naked) HOOK_CTask_Operator_Delete()
253258
pushad
254259
}
255260

256-
((CTaskManagementSystemSA*)(pGame->GetTaskManagementSystem()))->RemoveTask(pTempTaskInterface);
261+
OnMY_Task_Operator_Delete(pTempTaskInterface);
257262

258263
// Continue on our merry way....
259264
_asm

Client/game_sa/CTasksSA.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ CTaskSimpleFight* CTasksSA::CreateTaskSimpleFight(CEntity* pTargetEntity, int nC
303303
// Detect when GTA will start the 'be hit' task
304304
//
305305
////////////////////////////////////////////////////////////////
306+
__declspec(noinline)
306307
void _cdecl OnCEventHandler_ComputeDamageResponse_Mid(CPedSAInterface* pPedVictim, CPedSAInterface* pPedAttacker, ePedPieceTypes hitBodyPart, int hitBodySide,
307308
int weaponId)
308309
{

Client/game_sa/CTextSA.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ void CTextSA::SetText(char* szKey, char* szValue)
4343
}
4444
}
4545

46+
__declspec(noinline)
4647
char* GetReplacementText(char* szKey)
4748
{
4849
// NOTE: This is really slow (0.8% of program time spent here) so needs to be

Client/multiplayer_sa/premake5.lua

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,28 @@ project "Multiplayer SA"
3232
flags { "ExcludeFromBuild" }
3333

3434
filter "system:not windows"
35-
flags { "ExcludeFromBuild" }
35+
flags { "ExcludeFromBuild" }
36+
37+
filter { "configurations:Release or configurations:Nightly",
38+
"files:CMultiplayerSA.cpp" .. " or " ..
39+
"files:CMultiplayerSA_1.3.cpp" .. " or " ..
40+
"files:CMultiplayerSA_ClothesCache.cpp" .. " or " ..
41+
"files:CMultiplayerSA_ClothesMemFix.cpp" .. " or " ..
42+
"files:CMultiplayerSA_ClothesSpeedUp.cpp" .. " or " ..
43+
"files:CMultiplayerSA_CrashFixHacks.cpp" .. " or " ..
44+
"files:CMultiplayerSA_Direct3D.cpp" .. " or " ..
45+
"files:CMultiplayerSA_Files.cpp" .. " or " ..
46+
"files:CMultiplayerSA_FixBadAnimId.cpp" .. " or " ..
47+
"files:CMultiplayerSA_FixLineOfSightArgs.cpp" .. " or " ..
48+
"files:CMultiplayerSA_HookDestructors.cpp" .. " or " ..
49+
"files:CMultiplayerSA_LicensePlate.cpp" .. " or " ..
50+
"files:CMultiplayerSA_ObjectLODSystem.cpp" .. " or " ..
51+
"files:CMultiplayerSA_Rendering.cpp" .. " or " ..
52+
"files:CMultiplayerSA_RwResources.cpp" .. " or " ..
53+
"files:CMultiplayerSA_VehicleDamage.cpp" .. " or " ..
54+
"files:CMultiplayerSA_VehicleLights.cpp" .. " or " ..
55+
"files:CMultiplayerSA_Weapons.cpp" .. " or " ..
56+
"files:CPopulationSA.cpp" .. " or " ..
57+
"files:multiplayer_keysync.cpp" .. " or " ..
58+
"files:multiplayer_shotsync.cpp" }
59+
buildoptions { "/Ob1" } -- Expand only functions marked as inline

0 commit comments

Comments
 (0)