Skip to content

Commit 6d818fa

Browse files
committed
Fix AWorldMesh leak
1 parent 067fc73 commit 6d818fa

8 files changed

Lines changed: 25 additions & 9 deletions

File tree

OpenBarnyard/Source/Assets/AModelLoader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,13 +515,13 @@ TTMDBase::Material* AModelLoader::FindMaterialInModel( const TCHAR* a_szName )
515515
}
516516

517517
// $Barnyard: FUNCTION 006528c0
518-
TBOOL AModelLoader::AModelLoaderLoadTMDCallback( TModel* a_pModel )
518+
TBOOL __stdcall AModelLoader::AModelLoaderLoadTMDCallback( TModel* a_pModel )
519519
{
520520
return TFALSE;
521521
}
522522

523523
// $Barnyard: FUNCTION 006114d0
524-
TBOOL AModelLoader::AModelLoaderLoadTRBCallback( TModel* a_pModel )
524+
TBOOL __stdcall AModelLoader::AModelLoaderLoadTRBCallback( TModel* a_pModel )
525525
{
526526
TPROFILER_SCOPE();
527527

OpenBarnyard/Source/Assets/AModelLoader.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ class AModelLoader
7979
static void InitialiseGrassLayersTextures();
8080

8181
private:
82-
static TBOOL AModelLoaderLoadTMDCallback( Toshi::TModel* a_pModel );
83-
static TBOOL AModelLoaderLoadTRBCallback( Toshi::TModel* a_pModel );
82+
static TBOOL __stdcall AModelLoaderLoadTMDCallback( Toshi::TModel* a_pModel );
83+
static TBOOL __stdcall AModelLoaderLoadTRBCallback( Toshi::TModel* a_pModel );
8484

8585
inline static MaterialNode ms_oNodesAlloc[ MAX_NUM_ALLOCATED_MATERIALS ];
8686
inline static Toshi::T2DList<MaterialNode> ms_oFreeMaterials;

OpenBarnyard/Source/Platform/Windows/ARenderer_Win.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,10 +359,10 @@ TBOOL ARenderer::OnCreate()
359359
TRenderContext* pRenderContext = m_pViewport->GetRenderContext();
360360
pRenderContext->SetFogColor(
361361
TVector4(
362-
0.5568628,
363-
0.64705884,
364-
0.7529412,
365-
0.0
362+
0.5568628f,
363+
0.64705884f,
364+
0.7529412f,
365+
0.0f
366366
)
367367
);
368368
pRenderContext->SetFogDistance( 60.0f, 160.0f );

OpenBarnyard/Source/Render/AWorldShader/AWorldMesh.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,13 @@ void AWorldMesh::DestroyResource()
123123
m_uiFlags = 0;
124124
m_uiMaxVertices = 0;
125125
}
126+
127+
// $Barnyard: FUNCTION 005f8bd0
128+
AWorldMesh::SubMesh::~SubMesh()
129+
{
130+
if ( pIndexPool )
131+
{
132+
TRenderInterface::GetSingleton()->DestroyResource( pIndexPool );
133+
pIndexPool = TNULL;
134+
}
135+
}

OpenBarnyard/Source/Render/AWorldShader/AWorldMesh.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ class AWorldMesh : public Toshi::TMesh
1010

1111
struct SubMesh
1212
{
13+
~SubMesh();
14+
1315
TMesh* pAssociatedMesh = 0;
1416
TUINT16 uiUnk2 = 0;
1517
TUINT16 uiNumVertices = 0;

SDK/BYSpeedrunHelper/Source/ABYSpeedrunHelper.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,8 @@ class ABYSpeedrunHelper : public AModInstance
537537
ImGui::Checkbox( "Show reachable waypoints", &g_oSettings.bShowReachableWaypoints );
538538
ImGui::Checkbox( "Show unreachable waypoints", &g_oSettings.bShowUnreachableWaypoints );
539539
ImGui::Checkbox( "Show reached waypoints", &g_oSettings.bShowReachedWaypoints );
540+
541+
bDrawnUI = TTRUE;
540542
}
541543

542544
if ( bDrawnUI )

SDK/BYSpeedrunHelper/Source/AModSettings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct AModSettingsProperties
3636
// Not saved:
3737
TBOOL bShowBikeRaceDebug = TFALSE;
3838
TBOOL bShowWaypoints = TTRUE;
39-
TBOOL bShowOnlyMaxReachableWaypoint = TTRUE;
39+
TBOOL bShowOnlyMaxReachableWaypoint = TFALSE;
4040
TBOOL bShowReachedWaypoints = TTRUE;
4141
TBOOL bShowReachableWaypoints = TTRUE;
4242
TBOOL bShowUnreachableWaypoints = TTRUE;

Toshi/Source/Render/TTMDWin.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ enum EShaderType : TUINT
4242
ST_WORLD,
4343
ST_UNKNOWN2,
4444
ST_GRASS,
45+
ST_UNKNOWN3,
46+
ST_FOB
4547
};
4648

4749
struct TRBLODHeader

0 commit comments

Comments
 (0)