@@ -215,26 +215,23 @@ void _declspec(naked) HOOK_CStreamingLoadRequestedModels()
215215// Speeds up clothes a bit, but is only part of a solution - The actual files from inside player.img are still loaded each time
216216//
217217
218- uint32_t g_pPlayerImgEntries = 0xBBCDC8 ;
219- uint16_t g_nPlayerImgSize = 0x226 ;
218+ std:: uint32_t g_playerImgEntries = 0xBBCDC8 ;
219+ std:: uint16_t g_playerImgSize = 0x226 ;
220220
221221bool _cdecl IsPlayerImgDirLoaded ()
222222{
223223 // When player.img dir is loaded, it looks this this:
224224 // 0x00BC12C0 00bbcdc8 00000226
225225 DWORD* ptr1 = (DWORD*)0xBC12C0 ;
226- if (ptr1[0 ] == g_pPlayerImgEntries && ptr1[1 ] == g_nPlayerImgSize)
227- {
228- return true ;
229- }
230- return false ;
226+
227+ return ptr1[0 ] == g_playerImgEntries && ptr1[1 ] == g_playerImgSize;
231228}
232229
233230// Hook info
234231#define HOOKSIZE_LoadingPlayerImgDir 5
235- #define HOOKPOS_LoadingPlayerImgDir 0x5A69E3 // 005A69D6 -> CClothesBuilder::CreateSkinnedClump -> playerImgEntries
236- DWORD RETURN_LoadingPlayerImgDirA = 0x5A69E8 ; // push 00000226 { 550 }
237- DWORD RETURN_LoadingPlayerImgDirB = 0x5A6A06 ; // return of CreateSkinnedClump function
232+ #define HOOKPOS_LoadingPlayerImgDir 0x5A69E3 // 005A69D6 -> CClothesBuilder::CreateSkinnedClump -> playerImgEntries
233+ static constexpr std:: uintptr_t RETURN_LoadingPlayerImgDirA = 0x5A69E8 ; // push 00000226 { 550 }
234+ static constexpr std:: uintptr_t RETURN_LoadingPlayerImgDirB = 0x5A6A06 ; // return of CreateSkinnedClump function
238235
239236void _declspec (naked) HOOK_LoadingPlayerImgDir()
240237{
@@ -248,7 +245,7 @@ void _declspec(naked) HOOK_LoadingPlayerImgDir()
248245 popad
249246
250247 // Standard code to load img directory
251- mov eax, g_pPlayerImgEntries
248+ mov eax, g_playerImgEntries
252249 push eax
253250 jmp RETURN_LoadingPlayerImgDirA
254251
@@ -264,24 +261,22 @@ void _declspec(naked) HOOK_LoadingPlayerImgDir()
264261// Setup clothing directory size
265262//
266263// ////////////////////////////////////////////////////////////////////////////////////////
267- bool _cdecl SetClothingDirectorySize (int iCapacity )
264+ bool SetClothingDirectorySize (int directorySize )
268265{
269- DirectoryInfoSA* clothesDirectory = (DirectoryInfoSA*)malloc (sizeof (DirectoryInfoSA) * iCapacity );
266+ DirectoryInfoSA* clothesDirectory = (DirectoryInfoSA*)malloc (sizeof (DirectoryInfoSA) * directorySize );
270267
271- if (clothesDirectory)
272- {
273- // CClothesBuilder::LoadCdDirectory(void)
274- MemPut<uint32_t >(0x5A4190 + 1 , reinterpret_cast <uint32_t >(clothesDirectory)); // push offset _playerImgEntries; headers
275- MemPut<uint16_t >(0x5A4195 + 1 , iCapacity); // push 550 ; count
276- MemPut<uint16_t >(0x5A69E8 + 1 , iCapacity); // push 550 ; count
268+ if (!clothesDirectory)
269+ return false ;
277270
278- g_pPlayerImgEntries = reinterpret_cast <uint32_t >(clothesDirectory);
279- g_nPlayerImgSize = iCapacity;
271+ // CClothesBuilder::LoadCdDirectory(void)
272+ MemPut<uint32_t >(0x5A4190 + 1 , reinterpret_cast <uint32_t >(clothesDirectory)); // push offset _playerImgEntries; headers
273+ MemPut<uint16_t >(0x5A4195 + 1 , directorySize); // push 550 ; count
274+ MemPut<uint16_t >(0x5A69E8 + 1 , directorySize); // push 550 ; count
280275
281- return true ;
282- }
276+ g_playerImgEntries = reinterpret_cast < uint32_t >(clothesDirectory) ;
277+ g_playerImgSize = directorySize;
283278
284- return false ;
279+ return true ;
285280}
286281
287282// ////////////////////////////////////////////////////////////////////////////////////////
0 commit comments