-
-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa0591c
commit 733683d
Showing
9 changed files
with
120 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/***************************************************************************** | ||
* | ||
* PROJECT: Multi Theft Auto | ||
* LICENSE: See LICENSE in the top level directory | ||
* | ||
* Multi Theft Auto is available from https://www.multitheftauto.com/ | ||
* | ||
*****************************************************************************/ | ||
|
||
#include "StdInc.h" | ||
#include "CTxdPoolSA.h" | ||
#include "CGameSA.h" | ||
#include "CKeyGenSA.h" | ||
|
||
extern CGameSA* pGame; | ||
|
||
CTxdPoolSA::CTxdPoolSA() | ||
{ | ||
m_ppTxdPoolInterface = (CPoolSAInterface<CTextureDictonarySAInterface>**)0xC8800C; | ||
} | ||
|
||
std::uint32_t CTxdPoolSA::AllocateTextureDictonarySlot(std::uint32_t uiSlotId, std::string& strTxdName) | ||
{ | ||
CTextureDictonarySAInterface* pTxd = (*m_ppTxdPoolInterface)->AllocateAt(uiSlotId); | ||
if (!pTxd) | ||
return -1; | ||
|
||
strTxdName.resize(24); | ||
|
||
pTxd->usUsagesCount = 0; | ||
pTxd->hash = pGame->GetKeyGen()->GetUppercaseKey(strTxdName.c_str()); | ||
pTxd->rwTexDictonary = nullptr; | ||
pTxd->usParentIndex = -1; | ||
|
||
return (*m_ppTxdPoolInterface)->GetObjectIndex(pTxd); | ||
} | ||
|
||
void CTxdPoolSA::RemoveTextureDictonarySlot(std::uint32_t uiTxdId) | ||
{ | ||
if (!(*m_ppTxdPoolInterface)->IsContains(uiTxdId)) | ||
return; | ||
|
||
typedef std::uint32_t(__cdecl * Function_TxdReleaseSlot)(std::uint32_t uiTxdId); | ||
((Function_TxdReleaseSlot)(0x731E90))(uiTxdId); | ||
|
||
(*m_ppTxdPoolInterface)->Release(uiTxdId); | ||
} | ||
|
||
bool CTxdPoolSA::IsFreeTextureDictonarySlot(std::uint32_t uiTxdId) | ||
{ | ||
return (*m_ppTxdPoolInterface)->IsEmpty(uiTxdId); | ||
} | ||
|
||
std::uint16_t CTxdPoolSA::GetFreeTextureDictonarySlot() | ||
{ | ||
return (*m_ppTxdPoolInterface)->GetFreeSlot(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/***************************************************************************** | ||
* | ||
* PROJECT: Multi Theft Auto | ||
* LICENSE: See LICENSE in the top level directory | ||
* | ||
* Multi Theft Auto is available from https://www.multitheftauto.com/ | ||
* | ||
*****************************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include <game/CTxdPool.h> | ||
#include "CPoolSAInterface.h" | ||
#include "CBuildingSA.h" | ||
#include "CTextureDictonarySA.h" | ||
|
||
class CTxdPoolSA final : public CTxdPool | ||
{ | ||
public: | ||
CTxdPoolSA(); | ||
~CTxdPoolSA() = default; | ||
|
||
std::uint32_t AllocateTextureDictonarySlot(std::uint32_t uiSlotID, std::string& strTxdName); | ||
void RemoveTextureDictonarySlot(std::uint32_t uiTxdId); | ||
bool IsFreeTextureDictonarySlot(std::uint32_t uiTxdId); | ||
|
||
std::uint16_t GetFreeTextureDictonarySlot(); | ||
|
||
private: | ||
CPoolSAInterface<CTextureDictonarySAInterface>** m_ppTxdPoolInterface; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/***************************************************************************** | ||
* | ||
* PROJECT: Multi Theft Auto | ||
* LICENSE: See LICENSE in the top level directory | ||
* | ||
* Multi Theft Auto is available from https://www.multitheftauto.com/ | ||
* | ||
*****************************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include "Common.h" | ||
|
||
class CTxdPool | ||
{ | ||
public: | ||
virtual std::uint32_t AllocateTextureDictonarySlot(std::uint32_t uiSlotID, std::string& strTxdName) = 0; | ||
virtual void RemoveTextureDictonarySlot(std::uint32_t uiTxdID) = 0; | ||
virtual bool IsFreeTextureDictonarySlot(std::uint32_t uiTxdID) = 0; | ||
|
||
virtual std::uint16_t GetFreeTextureDictonarySlot() = 0; | ||
}; |