OpenBarnyard
 
Loading...
Searching...
No Matches
AAssetLoader.h
Go to the documentation of this file.
1#pragma once
2#include <File/TTRB.h>
3
12
14{
15public:
16 AAssetLoader() = delete;
17
18 static TBOOL LoadAssetPackFromLibrary( const TCHAR* a_szLibraryName, TBOOL a_bStream );
19 static TBOOL CreateAssetsFromLibrary( const TCHAR* a_szLibraryName );
20
21 // Loads asset file as a specified asset
22 static TBOOL Load( const TCHAR* a_szFileName, AAssetType a_eAssetType, TBOOL a_bStream );
23
24 // Closes asset file
25 static void Close( AAssetType a_eAssetType );
26
27 // Returns address of symbol of specified asset
28 static void* GetSymbolAddress( const TCHAR* a_szFileName, const TCHAR* a_szSymbolName, AAssetType a_eAssetType );
29
30 template <class T>
31 static T* CastSymbol( const TCHAR* a_szFileName, const TCHAR* a_szSymbolName, AAssetType a_eAssetType )
32 {
33 return TSTATICCAST(
34 T,
35 GetSymbolAddress( a_szFileName, a_szSymbolName, a_eAssetType )
36 );
37 }
38
39 // Returns TRB file of specified asset
40 static Toshi::TTRB* GetAssetTRB( AAssetType a_eAssetType )
41 {
42 TASSERT( a_eAssetType < AAssetType_NUMOF );
43 return ms_pTRBFiles[ a_eAssetType ];
44 }
45
46private:
47 inline static Toshi::TTRB* ms_pTRBFiles[ AAssetType_NUMOF ];
48};
TRB (Toshi Relocatable Binary) resource system for the Toshi engine.
#define TASSERT(X,...)
Definition Defines.h:138
#define TSTATICCAST(POINTERTYPE, VALUE)
Definition Defines.h:69
unsigned int TUINT
Definition Typedefs.h:8
char TCHAR
Definition Typedefs.h:20
bool TBOOL
Definition Typedefs.h:6
AAssetType_
Definition AAssetLoader.h:6
@ AAssetType_NUMOF
@ AAssetType_WaveBank
Definition AAssetLoader.h:9
@ AAssetType_Startup
Definition AAssetLoader.h:8
@ AAssetType_AssetPack
Definition AAssetLoader.h:7
TUINT AAssetType
Definition AAssetLoader.h:4
static TBOOL CreateAssetsFromLibrary(const TCHAR *a_szLibraryName)
static TBOOL Load(const TCHAR *a_szFileName, AAssetType a_eAssetType, TBOOL a_bStream)
static void Close(AAssetType a_eAssetType)
AAssetLoader()=delete
static Toshi::TTRB * GetAssetTRB(AAssetType a_eAssetType)
static void * GetSymbolAddress(const TCHAR *a_szFileName, const TCHAR *a_szSymbolName, AAssetType a_eAssetType)
static T * CastSymbol(const TCHAR *a_szFileName, const TCHAR *a_szSymbolName, AAssetType a_eAssetType)
static TBOOL LoadAssetPackFromLibrary(const TCHAR *a_szLibraryName, TBOOL a_bStream)