diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp')
| -rw-r--r-- | Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp b/Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp new file mode 100644 index 00000000..0906802d --- /dev/null +++ b/Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp @@ -0,0 +1,72 @@ + + +#include "stdafx.h" + + + +TLSStoragePS3* TLSStoragePS3::m_pInstance = NULL; + +BOOL TLSStoragePS3::m_activeList[sc_maxSlots]; +__thread LPVOID TLSStoragePS3::m_values[sc_maxSlots]; + + + +TLSStoragePS3::TLSStoragePS3() +{ + for(int i=0;i<sc_maxSlots; i++) + { + m_activeList[i] = false; + m_values[i] = NULL; + } +} + +TLSStoragePS3* TLSStoragePS3::Instance() +{ + if ( m_pInstance == 0 ) // Is this the first time? + { + m_pInstance = new TLSStoragePS3; // Create the singleton instance. + } + return m_pInstance; +} + + +int TLSStoragePS3::Alloc() +{ + for(int i=0; i<sc_maxSlots; i++) + { + if(m_activeList[i] == false) + { + m_activeList[i] = true; + m_values[i] = NULL; + return i; + } + } + assert(0); // we've ran out of slots + return -1; +} + +BOOL TLSStoragePS3::Free( DWORD _index ) +{ + if(m_activeList[_index] == false) + return false; // not been allocated + + m_activeList[_index] = false; + m_values[_index] = NULL; + return true; +} + +BOOL TLSStoragePS3::SetValue( DWORD _index, LPVOID _val ) +{ + if(m_activeList[_index] == false) + return false; + m_values[_index] = _val; + return true; +} + +LPVOID TLSStoragePS3::GetValue( DWORD _index ) +{ + if(m_activeList[_index] == false) + return NULL; + return m_values[_index]; +} + |
