Skip to content

Commit b52a7ac

Browse files
committed
Complete TGUINew and TGUIDelete
1 parent 743c550 commit b52a7ac

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

OpenJPOG/Source/Movie/ABINKMoviePlayer.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,14 @@ void ABINKMoviePlayer::BinkSleep(TINT a_iMicroseconds)
249249
static U64 s_iFrequency = 1000;
250250
static S32 s_bFrequencyAquired = 0;
251251

252-
if (!s_bFrequencyAquired)
253-
{
252+
if (!s_bFrequencyAquired) {
254253
s_bFrequencyAquired = 1;
255254
QueryPerformanceFrequency((LARGE_INTEGER *)&s_iFrequency);
256255
}
257256

258257
s_iTotalSleep += a_iMicroseconds;
259258

260-
if ((s_iTotalSleep - s_iSleepForward) > 1000)
261-
{
259+
if ((s_iTotalSleep - s_iSleepForward) > 1000) {
262260
U64 start, end;
263261
s_iTotalSleep -= s_iSleepForward;
264262

Toshi/Include/TGui/TGUIMemory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class TGUIINTERFACE_EXPORTS TGUIMemory
1414
};
1515

1616
void *TOSHI_API TGUINew(TUINT a_uiSize);
17-
void *TOSHI_API TGUIDelete(void *a_pMemory);
17+
void TOSHI_API TGUIDelete(void *a_pMemory);
1818
void TOSHI_API TGUISetUseMemoryPile(TBOOL a_bEnable);
1919

2020
TOSHI_NAMESPACE_END

Toshi/Source/TGui/TGUIMemory.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@ TPile TGUIMemory::ms_oMemoryPile = TPile(0x8000, 0x100000, 0);
99
void *TOSHI_API TGUINew(TUINT a_uiSize)
1010
{
1111
if (TGUIMemory::ms_bAllocUsePile) {
12+
TGUIMemory::ms_oMemoryPile.RawAlloc(a_uiSize, 4);
1213
}
1314
return tmalloc(a_uiSize, TNULL, -1);
1415
}
1516

16-
void *TOSHI_API TGUIDelete(void *a_pMemory)
17+
void TOSHI_API TGUIDelete(void *a_pMemory)
1718
{
18-
return TNULL;
19+
if (!TGUIMemory::ms_oMemoryPile.RawIsInside(a_pMemory)) {
20+
tfree(a_pMemory);
21+
}
1922
}
2023

2124
void TOSHI_API TGUISetUseMemoryPile(TBOOL a_bEnable)

0 commit comments

Comments
 (0)