mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 15:52:53 +00:00
Remove manually crafted rawfile loading code to make room for the generated code
This commit is contained in:
parent
3220722d41
commit
4b2479faa0
@ -1,70 +0,0 @@
|
|||||||
#include "rawfile_load_db2.h"
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
using namespace T6;
|
|
||||||
|
|
||||||
RawFileLoader::RawFileLoader(IZoneScriptStringProvider* scriptStringProvider, Zone* zone, IZoneInputStream* stream)
|
|
||||||
: AssetLoader(ASSET_TYPE_RAWFILE, scriptStringProvider, zone, stream){}
|
|
||||||
|
|
||||||
void RawFileLoader::LoadRawFile(RawFile* pRawFile, const bool atStreamStart)
|
|
||||||
{
|
|
||||||
assert(pRawFile != nullptr);
|
|
||||||
|
|
||||||
if(atStreamStart)
|
|
||||||
m_stream->Load<RawFile>();
|
|
||||||
|
|
||||||
m_stream->PushBlock(XFILE_BLOCK_VIRTUAL);
|
|
||||||
|
|
||||||
LoadXString(&pRawFile->name);
|
|
||||||
|
|
||||||
if(pRawFile->buffer != nullptr)
|
|
||||||
{
|
|
||||||
assert(pRawFile->buffer == PTR_FOLLOWING);
|
|
||||||
|
|
||||||
pRawFile->buffer = m_stream->Alloc<const char>(16);
|
|
||||||
m_stream->Load<const char>(pRawFile->len + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_stream->PopBlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
void RawFileLoader::LoadRawFileAsset(RawFile** pPtr)
|
|
||||||
{
|
|
||||||
assert(pPtr != nullptr);
|
|
||||||
*pPtr = static_cast<RawFile*>(LinkAsset(GetRawFileName(*pPtr), *pPtr));
|
|
||||||
}
|
|
||||||
|
|
||||||
void RawFileLoader::LoadRawFilePtr(RawFile** pPtr)
|
|
||||||
{
|
|
||||||
assert(pPtr != nullptr);
|
|
||||||
|
|
||||||
m_stream->PushBlock(XFILE_BLOCK_TEMP);
|
|
||||||
|
|
||||||
if(*pPtr != nullptr)
|
|
||||||
{
|
|
||||||
if(*pPtr == PTR_FOLLOWING || *pPtr == PTR_INSERT)
|
|
||||||
{
|
|
||||||
RawFile** toInsert = nullptr;
|
|
||||||
if(*pPtr == PTR_INSERT)
|
|
||||||
toInsert = m_stream->InsertPointer<RawFile>();
|
|
||||||
|
|
||||||
*pPtr = m_stream->Alloc<RawFile>();
|
|
||||||
LoadRawFile(*pPtr, true);
|
|
||||||
LoadRawFileAsset(pPtr);
|
|
||||||
|
|
||||||
if(toInsert != nullptr)
|
|
||||||
*toInsert = *pPtr;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*pPtr = m_stream->ConvertOffsetToAlias(*pPtr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_stream->PopBlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string RawFileLoader::GetRawFileName(RawFile* pRawFile)
|
|
||||||
{
|
|
||||||
return pRawFile->name;
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include "Loading/AssetLoader.h"
|
|
||||||
#include "Game/T6/T6.h"
|
|
||||||
|
|
||||||
namespace T6
|
|
||||||
{
|
|
||||||
class RawFileLoader final : public AssetLoader
|
|
||||||
{
|
|
||||||
void LoadRawFile(RawFile* pRawFile, bool atStreamStart);
|
|
||||||
void LoadRawFileAsset(RawFile** pPtr);
|
|
||||||
|
|
||||||
public:
|
|
||||||
RawFileLoader(IZoneScriptStringProvider* scriptStringProvider, Zone* zone, IZoneInputStream* stream);
|
|
||||||
|
|
||||||
void LoadRawFilePtr(RawFile** pPtr);
|
|
||||||
static std::string GetRawFileName(RawFile* pRawFile);
|
|
||||||
};
|
|
||||||
}
|
|
@ -67,7 +67,6 @@
|
|||||||
<ClInclude Include="Game\T6\XAssets\gen\xglobals\xglobals_load_db.h" />
|
<ClInclude Include="Game\T6\XAssets\gen\xglobals\xglobals_load_db.h" />
|
||||||
<ClInclude Include="Game\T6\XAssets\gen\xmodel\xmodel_load_db.h" />
|
<ClInclude Include="Game\T6\XAssets\gen\xmodel\xmodel_load_db.h" />
|
||||||
<ClInclude Include="Game\T6\XAssets\gen\zbarrierdef\zbarrierdef_load_db.h" />
|
<ClInclude Include="Game\T6\XAssets\gen\zbarrierdef\zbarrierdef_load_db.h" />
|
||||||
<ClInclude Include="Game\T6\XAssets\rawfile\rawfile_load_db2.h" />
|
|
||||||
<ClInclude Include="Loading\AssetLoader.h" />
|
<ClInclude Include="Loading\AssetLoader.h" />
|
||||||
<ClInclude Include="Loading\ContentLoader.h" />
|
<ClInclude Include="Loading\ContentLoader.h" />
|
||||||
<ClInclude Include="Loading\Exception\BlockOverflowException.h" />
|
<ClInclude Include="Loading\Exception\BlockOverflowException.h" />
|
||||||
@ -162,7 +161,6 @@
|
|||||||
<ClCompile Include="Game\T6\XAssets\gen\xglobals\xglobals_load_db.cpp" />
|
<ClCompile Include="Game\T6\XAssets\gen\xglobals\xglobals_load_db.cpp" />
|
||||||
<ClCompile Include="Game\T6\XAssets\gen\xmodel\xmodel_load_db.cpp" />
|
<ClCompile Include="Game\T6\XAssets\gen\xmodel\xmodel_load_db.cpp" />
|
||||||
<ClCompile Include="Game\T6\XAssets\gen\zbarrierdef\zbarrierdef_load_db.cpp" />
|
<ClCompile Include="Game\T6\XAssets\gen\zbarrierdef\zbarrierdef_load_db.cpp" />
|
||||||
<ClCompile Include="Game\T6\XAssets\rawfile\rawfile_load_db2.cpp" />
|
|
||||||
<ClCompile Include="Loading\AssetLoader.cpp" />
|
<ClCompile Include="Loading\AssetLoader.cpp" />
|
||||||
<ClCompile Include="Loading\ContentLoader.cpp" />
|
<ClCompile Include="Loading\ContentLoader.cpp" />
|
||||||
<ClCompile Include="Loading\Exception\BlockOverflowException.cpp" />
|
<ClCompile Include="Loading\Exception\BlockOverflowException.cpp" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user