Skip to content

Commit db75cd6

Browse files
committed
Removed IFP mutexes from CClientGame and CClientPed
They were not needed. I used them because I was in doubt whether GTA:SA is using a secondary thread. I confirmed that it's not using another thread with the help of SharedUtil::IsMainThread() method. - Suggested by Jusonex
1 parent c54b854 commit db75cd6

File tree

4 files changed

+0
-22
lines changed

4 files changed

+0
-22
lines changed

Client/mods/deathmatch/logic/CClientGame.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6785,13 +6785,11 @@ void CClientGame::CopyStaticAssociationProperties(std::unique_ptr<CAnimBlendStat
67856785

67866786
void CClientGame::InsertIFPPointerToMap(const unsigned int u32BlockNameHash, const std::shared_ptr<CClientIFP>& pIFP)
67876787
{
6788-
std::lock_guard<std::mutex> mutexGuardedLock(m_MutexOfIfpPointersMap);
67896788
m_mapOfIfpPointers[u32BlockNameHash] = pIFP;
67906789
}
67916790

67926791
std::shared_ptr<CClientIFP> CClientGame::GetIFPPointerFromMap(const unsigned int u32BlockNameHash)
67936792
{
6794-
std::lock_guard<std::mutex> mutexGuardedLock(m_MutexOfIfpPointersMap);
67956793
auto it = m_mapOfIfpPointers.find(u32BlockNameHash);
67966794
if (it != m_mapOfIfpPointers.end())
67976795
{
@@ -6802,25 +6800,21 @@ std::shared_ptr<CClientIFP> CClientGame::GetIFPPointerFromMap(const unsigned int
68026800

68036801
void CClientGame::RemoveIFPPointerFromMap(const unsigned int u32BlockNameHash)
68046802
{
6805-
std::lock_guard<std::mutex> mutexGuardedLock(m_MutexOfIfpPointersMap);
68066803
m_mapOfIfpPointers.erase(u32BlockNameHash);
68076804
}
68086805

68096806
void CClientGame::InsertPedPointerToSet(CClientPed* pPed)
68106807
{
6811-
std::lock_guard<std::mutex> mutexGuardedLock(m_MutexOfPedPointersSet);
68126808
m_setOfPedPointers.insert(pPed);
68136809
}
68146810

68156811
void CClientGame::RemovePedPointerFromSet(CClientPed* pPed)
68166812
{
6817-
std::lock_guard<std::mutex> mutexGuardedLock(m_MutexOfPedPointersSet);
68186813
m_setOfPedPointers.erase(pPed);
68196814
}
68206815

68216816
CClientPed* CClientGame::GetClientPedByClump(const RpClump& Clump)
68226817
{
6823-
std::lock_guard<std::mutex> mutexGuardedLock(m_MutexOfPedPointersSet);
68246818
for (auto& pPed : m_setOfPedPointers)
68256819
{
68266820
CEntity* pEntity = pPed->GetGameEntity();
@@ -6841,7 +6835,6 @@ CClientPed* CClientGame::GetClientPedByClump(const RpClump& Clump)
68416835

68426836
void CClientGame::OnClientIFPUnload(const std::shared_ptr<CClientIFP>& IFP)
68436837
{
6844-
std::lock_guard<std::mutex> mutexGuardedLock(m_MutexOfPedPointersSet);
68456838
IFP->MarkAsUnloading();
68466839
for (auto& pPed : m_setOfPedPointers)
68476840
{
@@ -6870,12 +6863,10 @@ void CClientGame::OnClientIFPUnload(const std::shared_ptr<CClientIFP>& IFP)
68706863

68716864
void CClientGame::InsertAnimationAssociationToMap(CAnimBlendAssociationSAInterface* pAnimAssociation, const std::shared_ptr<CIFPAnimations>& pIFPAnimations)
68726865
{
6873-
std::lock_guard<std::mutex> mutexGuardedLock(m_MutexOfAnimationAssociationsMap);
68746866
m_mapOfCustomAnimationAssociations[pAnimAssociation] = pIFPAnimations;
68756867
}
68766868

68776869
void CClientGame::RemoveAnimationAssociationFromMap(CAnimBlendAssociationSAInterface* pAnimAssociation)
68786870
{
6879-
std::lock_guard<std::mutex> mutexGuardedLock(m_MutexOfAnimationAssociationsMap);
68806871
m_mapOfCustomAnimationAssociations.erase(pAnimAssociation);
68816872
}

Client/mods/deathmatch/logic/CClientGame.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -831,13 +831,8 @@ class CClientGame
831831

832832
// (unsigned int) Key is the hash of custom block name that is supplied to engineLoadIFP
833833
std::map<unsigned int, std::shared_ptr<CClientIFP> > m_mapOfIfpPointers;
834-
mutable std::mutex m_MutexOfIfpPointersMap;
835-
836834
std::set<CClientPed*> m_setOfPedPointers;
837-
mutable std::mutex m_MutexOfPedPointersSet;
838-
839835
AnimAssociations_type m_mapOfCustomAnimationAssociations;
840-
mutable std::mutex m_MutexOfAnimationAssociationsMap;
841836
};
842837

843838
extern CClientGame* g_pClientGame;

Client/mods/deathmatch/logic/CClientPed.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6041,20 +6041,16 @@ void CClientPed::ReplaceAnimation(CAnimBlendHierarchy* pInternalAnimHierarchy, c
60416041
SReplacedAnimation replacedAnimation;
60426042
replacedAnimation.pIFP = pIFP;
60436043
replacedAnimation.pAnimationHierarchy = pCustomAnimHierarchy;
6044-
6045-
std::lock_guard<std::mutex> mutexGuardedLock(m_MutexOfReplacedAnimationsMap);
60466044
m_mapOfReplacedAnimations[pInternalAnimHierarchy->GetInterface()] = replacedAnimation;
60476045
}
60486046

60496047
void CClientPed::RestoreAnimation(CAnimBlendHierarchy* pInternalAnimHierarchy)
60506048
{
6051-
std::lock_guard<std::mutex> mutexGuardedLock(m_MutexOfReplacedAnimationsMap);
60526049
m_mapOfReplacedAnimations.erase(pInternalAnimHierarchy->GetInterface());
60536050
}
60546051

60556052
void CClientPed::RestoreAnimations(const std::shared_ptr<CClientIFP>& IFP)
60566053
{
6057-
std::lock_guard<std::mutex> mutexGuardedLock(m_MutexOfReplacedAnimationsMap);
60586054
for (auto const& x : m_mapOfReplacedAnimations)
60596055
{
60606056
if (std::addressof(*IFP.get()) == std::addressof(*x.second.pIFP.get()))
@@ -6066,7 +6062,6 @@ void CClientPed::RestoreAnimations(const std::shared_ptr<CClientIFP>& IFP)
60666062

60676063
void CClientPed::RestoreAnimations(CAnimBlock& animationBlock)
60686064
{
6069-
std::lock_guard<std::mutex> mutexGuardedLock(m_MutexOfReplacedAnimationsMap);
60706065
const size_t cAnimations = animationBlock.GetAnimationCount();
60716066
for (size_t i = 0; i < cAnimations; i++)
60726067
{
@@ -6077,13 +6072,11 @@ void CClientPed::RestoreAnimations(CAnimBlock& animationBlock)
60776072

60786073
void CClientPed::RestoreAllAnimations(void)
60796074
{
6080-
std::lock_guard<std::mutex> mutexGuardedLock(m_MutexOfReplacedAnimationsMap);
60816075
m_mapOfReplacedAnimations.clear();
60826076
}
60836077

60846078
SReplacedAnimation* CClientPed::GetReplacedAnimation(CAnimBlendHierarchySAInterface* pInternalHierarchyInterface)
60856079
{
6086-
std::lock_guard<std::mutex> mutexGuardedLock(m_MutexOfReplacedAnimationsMap);
60876080
CClientPed::ReplacedAnim_type::iterator it;
60886081
it = m_mapOfReplacedAnimations.find(pInternalHierarchyInterface);
60896082
if (it != m_mapOfReplacedAnimations.end())

Client/mods/deathmatch/logic/CClientPed.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,6 @@ class CClientPed : public CClientStreamElement, public CAntiCheatModule
708708

709709
// Key: Internal GTA animation, Value: Custom Animation
710710
ReplacedAnim_type m_mapOfReplacedAnimations;
711-
mutable std::mutex m_MutexOfReplacedAnimationsMap;
712711
};
713712

714713
#endif

0 commit comments

Comments
 (0)