mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-20 02:15:32 +00:00
Renaming things in FileIO to match PWE's naming conventions
This commit is contained in:
@@ -15,7 +15,7 @@ CAnimationParameters::CAnimationParameters()
|
||||
mUnknown4 = 0;
|
||||
}
|
||||
|
||||
CAnimationParameters::CAnimationParameters(CInputStream& SCLY, EGame game)
|
||||
CAnimationParameters::CAnimationParameters(IInputStream& SCLY, EGame game)
|
||||
{
|
||||
mGame = game;
|
||||
mpCharSet = nullptr;
|
||||
|
||||
@@ -19,7 +19,7 @@ class CAnimationParameters
|
||||
|
||||
public:
|
||||
CAnimationParameters();
|
||||
CAnimationParameters(CInputStream& SCLY, EGame game);
|
||||
CAnimationParameters(IInputStream& SCLY, EGame game);
|
||||
CModel* GetCurrentModel(s32 nodeIndex = -1);
|
||||
|
||||
// Getters
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef CLIGHT_H
|
||||
#define CLIGHT_H
|
||||
|
||||
#include <FileIO/CInputStream.h>
|
||||
#include <FileIO/IInputStream.h>
|
||||
#include <Common/CColor.h>
|
||||
#include <Math/CVector3f.h>
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <Common/CColor.h>
|
||||
#include <Common/EnumUtil.h>
|
||||
#include <Common/types.h>
|
||||
#include <FileIO/CInputStream.h>
|
||||
#include <FileIO/IInputStream.h>
|
||||
|
||||
class CMaterialSet;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "CMaterial.h"
|
||||
#include "CTexture.h"
|
||||
#include "EFormatVersion.h"
|
||||
#include <FileIO/CInputStream.h>
|
||||
#include <FileIO/IInputStream.h>
|
||||
|
||||
class CMaterialSet
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ CPakFile::CPakFile()
|
||||
pak = nullptr;
|
||||
}
|
||||
|
||||
CPakFile::CPakFile(CInputStream* pakfile)
|
||||
CPakFile::CPakFile(IInputStream* pakfile)
|
||||
{
|
||||
pak = pakfile;
|
||||
if (!pak->IsValid()) return;
|
||||
@@ -154,7 +154,7 @@ bool CPakFile::decompress(u8 *src, u32 src_len, u8 *dst, u32 dst_len)
|
||||
while ((src < src_end) && (dst < dst_end)) {
|
||||
short block_size;
|
||||
memcpy(&block_size, src, 2);
|
||||
if (IOUtil::SystemEndianness == IOUtil::LittleEndian) IOUtil::SwapBytes(block_size);
|
||||
if (IOUtil::kSystemEndianness == IOUtil::eLittleEndian) IOUtil::SwapBytes(block_size);
|
||||
src += 2;
|
||||
|
||||
ret = lzo1x_decompress(src, block_size, dst, &decmp, LZO1X_MEM_DECOMPRESS);
|
||||
|
||||
@@ -13,13 +13,13 @@ private:
|
||||
u32 version;
|
||||
std::vector<SNamedResource> NamedResTable;
|
||||
std::vector<SResInfo> ResInfoTable;
|
||||
CInputStream* pak;
|
||||
IInputStream* pak;
|
||||
|
||||
bool decompress(u8 *src, u32 src_len, u8 *dst, u32 dst_len);
|
||||
|
||||
public:
|
||||
CPakFile();
|
||||
CPakFile(CInputStream* pakfile);
|
||||
CPakFile(IInputStream* pakfile);
|
||||
~CPakFile();
|
||||
|
||||
std::vector<SNamedResource> getNamedResources();
|
||||
|
||||
@@ -62,7 +62,7 @@ void CResCache::SetFolder(TString path)
|
||||
|
||||
void CResCache::SetPak(const TString& path)
|
||||
{
|
||||
CFileInStream *pakfile = new CFileInStream(path.ToStdString(), IOUtil::BigEndian);
|
||||
CFileInStream *pakfile = new CFileInStream(path.ToStdString(), IOUtil::eBigEndian);
|
||||
if (!pakfile->IsValid())
|
||||
{
|
||||
Log::Error("Couldn't load pak file: " + path);
|
||||
@@ -115,7 +115,7 @@ CResource* CResCache::GetResource(CUniqueID ResID, CFourCC type)
|
||||
else
|
||||
{
|
||||
Source = mResSource.Path + ResID.ToString() + "." + type.ToString();
|
||||
CFileInStream file(Source.ToStdString(), IOUtil::BigEndian);
|
||||
CFileInStream file(Source.ToStdString(), IOUtil::eBigEndian);
|
||||
if (!file.IsValid())
|
||||
{
|
||||
Log::Error("Couldn't open resource: " + ResID.ToString() + "." + type.ToString());
|
||||
@@ -129,7 +129,7 @@ CResource* CResCache::GetResource(CUniqueID ResID, CFourCC type)
|
||||
if (!pBuffer) return nullptr;
|
||||
|
||||
// Load resource
|
||||
CMemoryInStream mem(pBuffer->data(), pBuffer->size(), IOUtil::BigEndian);
|
||||
CMemoryInStream mem(pBuffer->data(), pBuffer->size(), IOUtil::eBigEndian);
|
||||
mem.SetSourceString(*Source.GetFileName());
|
||||
CResource *Res = nullptr;
|
||||
bool SupportedFormat = true;
|
||||
@@ -170,7 +170,7 @@ CResource* CResCache::GetResource(const TString& ResPath)
|
||||
if (got != mResourceCache.end())
|
||||
return got->second;
|
||||
|
||||
CFileInStream file(ResPath.ToStdString(), IOUtil::BigEndian);
|
||||
CFileInStream file(ResPath.ToStdString(), IOUtil::eBigEndian);
|
||||
if (!file.IsValid())
|
||||
{
|
||||
Log::Error("Couldn't open resource: " + ResPath);
|
||||
|
||||
@@ -156,7 +156,7 @@ float CTexture::ReadTexelAlpha(const CVector2f& TexCoord)
|
||||
|
||||
if (mTexelFormat == eDXT1 && mBufferExists)
|
||||
{
|
||||
CMemoryInStream Buffer(mImgDataBuffer, mImgDataSize, IOUtil::SystemEndianness);
|
||||
CMemoryInStream Buffer(mImgDataBuffer, mImgDataSize, IOUtil::kSystemEndianness);
|
||||
|
||||
// 8 bytes per 4x4 16-pixel block, left-to-right top-to-bottom
|
||||
u32 BlockIdxX = TexelX / 4;
|
||||
@@ -190,7 +190,7 @@ float CTexture::ReadTexelAlpha(const CVector2f& TexCoord)
|
||||
return 1.f;
|
||||
}
|
||||
|
||||
bool CTexture::WriteDDS(COutputStream& out)
|
||||
bool CTexture::WriteDDS(IOutputStream& out)
|
||||
{
|
||||
if (!out.IsValid()) return false;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
void Bind(u32 GLTextureUnit);
|
||||
void Resize(u32 Width, u32 Height);
|
||||
float ReadTexelAlpha(const CVector2f& TexCoord);
|
||||
bool WriteDDS(COutputStream& out);
|
||||
bool WriteDDS(IOutputStream& out);
|
||||
|
||||
// Getters
|
||||
ETexelFormat TexelFormat();
|
||||
|
||||
@@ -6,7 +6,7 @@ CMaterialCooker::CMaterialCooker()
|
||||
mpMat = nullptr;
|
||||
}
|
||||
|
||||
void CMaterialCooker::WriteMatSetPrime(COutputStream& Out)
|
||||
void CMaterialCooker::WriteMatSetPrime(IOutputStream& Out)
|
||||
{
|
||||
// Gather texture list from the materials before starting
|
||||
mTextureIDs.clear();
|
||||
@@ -64,13 +64,13 @@ void CMaterialCooker::WriteMatSetPrime(COutputStream& Out)
|
||||
Out.Seek(MatsEnd, SEEK_SET);
|
||||
}
|
||||
|
||||
void CMaterialCooker::WriteMatSetCorruption(COutputStream&)
|
||||
void CMaterialCooker::WriteMatSetCorruption(IOutputStream&)
|
||||
{
|
||||
// Not using parameter 1 (COutputStream& - Out)
|
||||
// Not using parameter 1 (IOutputStream& - Out)
|
||||
// todo
|
||||
}
|
||||
|
||||
void CMaterialCooker::WriteMaterialPrime(COutputStream& Out)
|
||||
void CMaterialCooker::WriteMaterialPrime(IOutputStream& Out)
|
||||
{
|
||||
// Gather data from the passes before we start writing
|
||||
u32 TexFlags = 0;
|
||||
@@ -320,14 +320,14 @@ void CMaterialCooker::WriteMaterialPrime(COutputStream& Out)
|
||||
// Done!
|
||||
}
|
||||
|
||||
void CMaterialCooker::WriteMaterialCorruption(COutputStream&)
|
||||
void CMaterialCooker::WriteMaterialCorruption(IOutputStream&)
|
||||
{
|
||||
// Not using parameter 1 (COutputStream& - Out)
|
||||
// Not using parameter 1 (IOutputStream& - Out)
|
||||
// todo
|
||||
}
|
||||
|
||||
// ************ STATIC ************
|
||||
void CMaterialCooker::WriteCookedMatSet(CMaterialSet *pSet, EGame Version, COutputStream &Out)
|
||||
void CMaterialCooker::WriteCookedMatSet(CMaterialSet *pSet, EGame Version, IOutputStream &Out)
|
||||
{
|
||||
CMaterialCooker Cooker;
|
||||
Cooker.mpSet = pSet;
|
||||
@@ -344,7 +344,7 @@ void CMaterialCooker::WriteCookedMatSet(CMaterialSet *pSet, EGame Version, COutp
|
||||
}
|
||||
}
|
||||
|
||||
void CMaterialCooker::WriteCookedMaterial(CMaterial *pMat, EGame Version, COutputStream &Out)
|
||||
void CMaterialCooker::WriteCookedMaterial(CMaterial *pMat, EGame Version, IOutputStream &Out)
|
||||
{
|
||||
CMaterialCooker Cooker;
|
||||
Cooker.mpMat = pMat;
|
||||
|
||||
@@ -14,14 +14,14 @@ class CMaterialCooker
|
||||
std::vector<u64> mMaterialHashes;
|
||||
|
||||
CMaterialCooker();
|
||||
void WriteMatSetPrime(COutputStream& Out);
|
||||
void WriteMatSetCorruption(COutputStream& Out);
|
||||
void WriteMaterialPrime(COutputStream& Out);
|
||||
void WriteMaterialCorruption(COutputStream& Out);
|
||||
void WriteMatSetPrime(IOutputStream& Out);
|
||||
void WriteMatSetCorruption(IOutputStream& Out);
|
||||
void WriteMaterialPrime(IOutputStream& Out);
|
||||
void WriteMaterialCorruption(IOutputStream& Out);
|
||||
|
||||
public:
|
||||
static void WriteCookedMatSet(CMaterialSet *pSet, EGame Version, COutputStream& Out);
|
||||
static void WriteCookedMaterial(CMaterial *pMat, EGame Version, COutputStream& Out);
|
||||
static void WriteCookedMatSet(CMaterialSet *pSet, EGame Version, IOutputStream& Out);
|
||||
static void WriteCookedMaterial(CMaterial *pMat, EGame Version, IOutputStream& Out);
|
||||
};
|
||||
|
||||
#endif // CMATERIALCOOKER_H
|
||||
|
||||
@@ -60,11 +60,11 @@ void CModelCooker::GenerateSurfaceData()
|
||||
mNumVertices = mVertices.size();
|
||||
}
|
||||
|
||||
void CModelCooker::WriteEditorModel(COutputStream& /*Out*/)
|
||||
void CModelCooker::WriteEditorModel(IOutputStream& /*Out*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CModelCooker::WriteModelPrime(COutputStream& Out)
|
||||
void CModelCooker::WriteModelPrime(IOutputStream& Out)
|
||||
{
|
||||
GenerateSurfaceData();
|
||||
|
||||
@@ -232,7 +232,7 @@ void CModelCooker::WriteModelPrime(COutputStream& Out)
|
||||
// Done!
|
||||
}
|
||||
|
||||
void CModelCooker::WriteCookedModel(CModel *pModel, EGame Version, COutputStream& CMDL)
|
||||
void CModelCooker::WriteCookedModel(CModel *pModel, EGame Version, IOutputStream& CMDL)
|
||||
{
|
||||
CModelCooker Cooker;
|
||||
Cooker.mpModel = pModel;
|
||||
@@ -249,7 +249,7 @@ void CModelCooker::WriteCookedModel(CModel *pModel, EGame Version, COutputStream
|
||||
}
|
||||
}
|
||||
|
||||
void CModelCooker::WriteUncookedModel(CModel* /*pModel*/, COutputStream& /*EMDL*/)
|
||||
void CModelCooker::WriteUncookedModel(CModel* /*pModel*/, IOutputStream& /*EMDL*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -18,12 +18,12 @@ class CModelCooker
|
||||
|
||||
CModelCooker();
|
||||
void GenerateSurfaceData();
|
||||
void WriteEditorModel(COutputStream& Out);
|
||||
void WriteModelPrime(COutputStream& Out);
|
||||
void WriteEditorModel(IOutputStream& Out);
|
||||
void WriteModelPrime(IOutputStream& Out);
|
||||
|
||||
public:
|
||||
static void WriteCookedModel(CModel *pModel, EGame Version, COutputStream& Out);
|
||||
static void WriteUncookedModel(CModel *pModel, COutputStream& Out);
|
||||
static void WriteCookedModel(CModel *pModel, EGame Version, IOutputStream& Out);
|
||||
static void WriteUncookedModel(CModel *pModel, IOutputStream& Out);
|
||||
static u32 GetCMDLVersion(EGame Version);
|
||||
};
|
||||
|
||||
|
||||
@@ -13,20 +13,20 @@ void CSectionMgrOut::SetSectionCount(u32 Count)
|
||||
mSectionSizes.resize(Count);
|
||||
}
|
||||
|
||||
void CSectionMgrOut::Init(const COutputStream& OutputStream)
|
||||
void CSectionMgrOut::Init(const IOutputStream& OutputStream)
|
||||
{
|
||||
mCurSectionStart = OutputStream.Tell();
|
||||
mCurSectionIndex = 0;
|
||||
}
|
||||
|
||||
void CSectionMgrOut::AddSize(COutputStream& OutputStream)
|
||||
void CSectionMgrOut::AddSize(IOutputStream& OutputStream)
|
||||
{
|
||||
mSectionSizes[mCurSectionIndex] = OutputStream.Tell() - mCurSectionStart;
|
||||
mCurSectionIndex++;
|
||||
mCurSectionStart = OutputStream.Tell();
|
||||
}
|
||||
|
||||
void CSectionMgrOut::WriteSizes(COutputStream& OutputStream)
|
||||
void CSectionMgrOut::WriteSizes(IOutputStream& OutputStream)
|
||||
{
|
||||
for (u32 iSec = 0; iSec < mSectionCount; iSec++)
|
||||
OutputStream.WriteLong(mSectionSizes[iSec]);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define CBLOCKMGROUT_H
|
||||
|
||||
#include <Common/types.h>
|
||||
#include <FileIO/COutputStream.h>
|
||||
#include <FileIO/IOutputStream.h>
|
||||
#include <vector>
|
||||
|
||||
// Small class to manage file sections for CMDL/MREA output
|
||||
@@ -16,9 +16,9 @@ class CSectionMgrOut
|
||||
public:
|
||||
CSectionMgrOut();
|
||||
void SetSectionCount(u32 Count);
|
||||
void Init(const COutputStream& OutputStream);
|
||||
void AddSize(COutputStream& OutputStream);
|
||||
void WriteSizes(COutputStream& OutputStream);
|
||||
void Init(const IOutputStream& OutputStream);
|
||||
void AddSize(IOutputStream& OutputStream);
|
||||
void WriteSizes(IOutputStream& OutputStream);
|
||||
};
|
||||
|
||||
#endif // CBLOCKMGROUT_H
|
||||
|
||||
@@ -6,7 +6,7 @@ CTextureEncoder::CTextureEncoder()
|
||||
mpTexture = nullptr;
|
||||
}
|
||||
|
||||
void CTextureEncoder::WriteTXTR(COutputStream& TXTR)
|
||||
void CTextureEncoder::WriteTXTR(IOutputStream& TXTR)
|
||||
{
|
||||
// Only DXT1->CMPR supported at the moment
|
||||
TXTR.WriteLong(mOutputFormat);
|
||||
@@ -16,7 +16,7 @@ void CTextureEncoder::WriteTXTR(COutputStream& TXTR)
|
||||
|
||||
u32 MipW = mpTexture->Width() / 4;
|
||||
u32 MipH = mpTexture->Height() / 4;
|
||||
CMemoryInStream Image(mpTexture->mImgDataBuffer, mpTexture->mImgDataSize, IOUtil::LittleEndian);
|
||||
CMemoryInStream Image(mpTexture->mImgDataBuffer, mpTexture->mImgDataSize, IOUtil::eLittleEndian);
|
||||
u32 MipOffset = Image.Tell();
|
||||
|
||||
for (u32 iMip = 0; iMip < mpTexture->mNumMipMaps; iMip++)
|
||||
@@ -45,7 +45,7 @@ void CTextureEncoder::DetermineBestOutputFormat()
|
||||
// todo
|
||||
}
|
||||
|
||||
void CTextureEncoder::ReadSubBlockCMPR(CInputStream& Source, COutputStream& Dest)
|
||||
void CTextureEncoder::ReadSubBlockCMPR(IInputStream& Source, IOutputStream& Dest)
|
||||
{
|
||||
Dest.WriteShort(Source.ReadShort());
|
||||
Dest.WriteShort(Source.ReadShort());
|
||||
@@ -58,7 +58,7 @@ void CTextureEncoder::ReadSubBlockCMPR(CInputStream& Source, COutputStream& Dest
|
||||
}
|
||||
|
||||
// ************ STATIC ************
|
||||
void CTextureEncoder::EncodeTXTR(COutputStream& TXTR, CTexture *pTex)
|
||||
void CTextureEncoder::EncodeTXTR(IOutputStream& TXTR, CTexture *pTex)
|
||||
{
|
||||
if (pTex->mTexelFormat != eDXT1)
|
||||
{
|
||||
@@ -73,7 +73,7 @@ void CTextureEncoder::EncodeTXTR(COutputStream& TXTR, CTexture *pTex)
|
||||
Encoder.WriteTXTR(TXTR);
|
||||
}
|
||||
|
||||
void CTextureEncoder::EncodeTXTR(COutputStream& TXTR, CTexture *pTex, ETexelFormat /*OutputFormat*/)
|
||||
void CTextureEncoder::EncodeTXTR(IOutputStream& TXTR, CTexture *pTex, ETexelFormat /*OutputFormat*/)
|
||||
{
|
||||
// todo: support for encoding a specific format
|
||||
EncodeTXTR(TXTR, pTex);
|
||||
|
||||
@@ -13,13 +13,13 @@ class CTextureEncoder
|
||||
ETexelFormat mOutputFormat;
|
||||
|
||||
CTextureEncoder();
|
||||
void WriteTXTR(COutputStream& TXTR);
|
||||
void WriteTXTR(IOutputStream& TXTR);
|
||||
void DetermineBestOutputFormat();
|
||||
void ReadSubBlockCMPR(CInputStream& Source, COutputStream& Dest);
|
||||
void ReadSubBlockCMPR(IInputStream& Source, IOutputStream& Dest);
|
||||
|
||||
public:
|
||||
static void EncodeTXTR(COutputStream& TXTR, CTexture *pTex);
|
||||
static void EncodeTXTR(COutputStream& TXTR, CTexture *pTex, ETexelFormat OutputFormat);
|
||||
static void EncodeTXTR(IOutputStream& TXTR, CTexture *pTex);
|
||||
static void EncodeTXTR(IOutputStream& TXTR, CTexture *pTex, ETexelFormat OutputFormat);
|
||||
static ETexelFormat GetGXFormat(ETexelFormat Format);
|
||||
static ETexelFormat GetFormat(ETexelFormat Format);
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ CAnimSetLoader::CAnimSetLoader()
|
||||
{
|
||||
}
|
||||
|
||||
CAnimSet* CAnimSetLoader::LoadCorruptionCHAR(CInputStream& CHAR)
|
||||
CAnimSet* CAnimSetLoader::LoadCorruptionCHAR(IInputStream& CHAR)
|
||||
{
|
||||
// For now, we only read enough to fetch the model
|
||||
CHAR.Seek(0x1, SEEK_CUR);
|
||||
@@ -18,7 +18,7 @@ CAnimSet* CAnimSetLoader::LoadCorruptionCHAR(CInputStream& CHAR)
|
||||
return set;
|
||||
}
|
||||
|
||||
CAnimSet* CAnimSetLoader::LoadReturnsCHAR(CInputStream& CHAR)
|
||||
CAnimSet* CAnimSetLoader::LoadReturnsCHAR(IInputStream& CHAR)
|
||||
{
|
||||
// For now, we only read enough to fetch the model
|
||||
CHAR.Seek(0x16, SEEK_CUR);
|
||||
@@ -32,7 +32,7 @@ CAnimSet* CAnimSetLoader::LoadReturnsCHAR(CInputStream& CHAR)
|
||||
return set;
|
||||
}
|
||||
|
||||
void CAnimSetLoader::LoadPASDatabase(CInputStream& PAS4)
|
||||
void CAnimSetLoader::LoadPASDatabase(IInputStream& PAS4)
|
||||
{
|
||||
// For now, just parse the data; don't store it
|
||||
PAS4.Seek(0x4, SEEK_CUR); // Skipping PAS4 FourCC
|
||||
@@ -72,7 +72,7 @@ void CAnimSetLoader::LoadPASDatabase(CInputStream& PAS4)
|
||||
}
|
||||
|
||||
// ************ STATIC ************
|
||||
CAnimSet* CAnimSetLoader::LoadANCS(CInputStream& ANCS)
|
||||
CAnimSet* CAnimSetLoader::LoadANCS(IInputStream& ANCS)
|
||||
{
|
||||
if (!ANCS.IsValid()) return nullptr;
|
||||
Log::Write("Loading " + ANCS.GetSourceString());
|
||||
@@ -169,7 +169,7 @@ CAnimSet* CAnimSetLoader::LoadANCS(CInputStream& ANCS)
|
||||
return loader.set;
|
||||
}
|
||||
|
||||
CAnimSet* CAnimSetLoader::LoadCHAR(CInputStream &CHAR)
|
||||
CAnimSet* CAnimSetLoader::LoadCHAR(IInputStream &CHAR)
|
||||
{
|
||||
if (!CHAR.IsValid()) return nullptr;
|
||||
Log::Write("Loading " + CHAR.GetSourceString());
|
||||
|
||||
@@ -12,13 +12,13 @@ class CAnimSetLoader
|
||||
EGame mVersion;
|
||||
|
||||
CAnimSetLoader();
|
||||
CAnimSet* LoadCorruptionCHAR(CInputStream& CHAR);
|
||||
CAnimSet* LoadReturnsCHAR(CInputStream& CHAR);
|
||||
void LoadPASDatabase(CInputStream& PAS4);
|
||||
CAnimSet* LoadCorruptionCHAR(IInputStream& CHAR);
|
||||
CAnimSet* LoadReturnsCHAR(IInputStream& CHAR);
|
||||
void LoadPASDatabase(IInputStream& PAS4);
|
||||
|
||||
public:
|
||||
static CAnimSet* LoadANCS(CInputStream& ANCS);
|
||||
static CAnimSet* LoadCHAR(CInputStream& CHAR);
|
||||
static CAnimSet* LoadANCS(IInputStream& ANCS);
|
||||
static CAnimSet* LoadCHAR(IInputStream& CHAR);
|
||||
};
|
||||
|
||||
#endif // CCHARACTERLOADER_H
|
||||
|
||||
@@ -478,7 +478,7 @@ void CAreaLoader::Decompress()
|
||||
}
|
||||
|
||||
TString Source = mpMREA->GetSourceString();
|
||||
mpMREA = new CMemoryInStream(mDecmpBuffer, mTotalDecmpSize, IOUtil::BigEndian);
|
||||
mpMREA = new CMemoryInStream(mDecmpBuffer, mTotalDecmpSize, IOUtil::eBigEndian);
|
||||
mpMREA->SetSourceString(Source.ToStdString());
|
||||
mBlockMgr->SetInputStream(mpMREA);
|
||||
mHasDecompressedBuffer = true;
|
||||
@@ -540,7 +540,7 @@ void CAreaLoader::SetUpObjects()
|
||||
}
|
||||
|
||||
// ************ STATIC ************
|
||||
CGameArea* CAreaLoader::LoadMREA(CInputStream& MREA)
|
||||
CGameArea* CAreaLoader::LoadMREA(IInputStream& MREA)
|
||||
{
|
||||
CAreaLoader Loader;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class CAreaLoader
|
||||
|
||||
// Area data
|
||||
TResPtr<CGameArea> mpArea;
|
||||
CInputStream *mpMREA;
|
||||
IInputStream *mpMREA;
|
||||
CBlockMgrIn *mBlockMgr;
|
||||
EGame mVersion;
|
||||
u32 mNumMeshes;
|
||||
@@ -78,7 +78,7 @@ class CAreaLoader
|
||||
void SetUpObjects();
|
||||
|
||||
public:
|
||||
static CGameArea* LoadMREA(CInputStream& MREA);
|
||||
static CGameArea* LoadMREA(IInputStream& MREA);
|
||||
static EGame GetFormatVersion(u32 version);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "CBlockMgrIn.h"
|
||||
|
||||
CBlockMgrIn::CBlockMgrIn(unsigned long count, CInputStream* src)
|
||||
CBlockMgrIn::CBlockMgrIn(unsigned long count, IInputStream* src)
|
||||
{
|
||||
mpInputStream = src;
|
||||
mBlockCount = count;
|
||||
@@ -52,7 +52,7 @@ long CBlockMgrIn::CurrentBlockSize()
|
||||
return mBlockSizes[mCurBlock];
|
||||
}
|
||||
|
||||
void CBlockMgrIn::SetInputStream(CInputStream *in)
|
||||
void CBlockMgrIn::SetInputStream(IInputStream *in)
|
||||
{
|
||||
mpInputStream = in;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#ifndef CBLOCKMGRIN_H
|
||||
#define CBLOCKMGRIN_H
|
||||
|
||||
#include <FileIO/CInputStream.h>
|
||||
#include <FileIO/IInputStream.h>
|
||||
#include <vector>
|
||||
|
||||
// The purpose of this class is to keep track of data block navigation - required to read CMDL and MREA files correctly
|
||||
class CBlockMgrIn
|
||||
{
|
||||
CInputStream *mpInputStream;
|
||||
IInputStream *mpInputStream;
|
||||
unsigned long mBlockCount;
|
||||
std::vector<unsigned long> mBlockSizes;
|
||||
unsigned long mCurBlock;
|
||||
@@ -15,14 +15,14 @@ class CBlockMgrIn
|
||||
unsigned long mBlocksStart;
|
||||
|
||||
public:
|
||||
CBlockMgrIn(unsigned long count, CInputStream* src);
|
||||
CBlockMgrIn(unsigned long count, IInputStream* src);
|
||||
void Init();
|
||||
void ToBlock(unsigned long block);
|
||||
void ToNextBlock();
|
||||
long NextOffset();
|
||||
long CurrentBlock();
|
||||
long CurrentBlockSize();
|
||||
void SetInputStream(CInputStream *in);
|
||||
void SetInputStream(IInputStream *in);
|
||||
};
|
||||
|
||||
#endif // CBLOCKMGRIN_H
|
||||
|
||||
@@ -6,25 +6,22 @@ CCollisionLoader::CCollisionLoader()
|
||||
{
|
||||
}
|
||||
|
||||
CCollisionMesh::CCollisionOctree* CCollisionLoader::ParseOctree(CInputStream&)
|
||||
CCollisionMesh::CCollisionOctree* CCollisionLoader::ParseOctree(IInputStream& /*src*/)
|
||||
{
|
||||
// Not using: Parameter 1 (CInputStream& - src)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CCollisionMesh::CCollisionOctree::SBranch* CCollisionLoader::ParseOctreeBranch(CInputStream&)
|
||||
CCollisionMesh::CCollisionOctree::SBranch* CCollisionLoader::ParseOctreeBranch(IInputStream& /*src*/)
|
||||
{
|
||||
// Not using: Parameter 1 (CInputStream& - src)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CCollisionMesh::CCollisionOctree::SLeaf* CCollisionLoader::ParseOctreeLeaf(CInputStream&)
|
||||
CCollisionMesh::CCollisionOctree::SLeaf* CCollisionLoader::ParseOctreeLeaf(IInputStream& /*src*/)
|
||||
{
|
||||
// Not using: Parameter 1 (CInputStream& - src)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CCollisionLoader::ParseOBBNode(CInputStream& DCLN)
|
||||
void CCollisionLoader::ParseOBBNode(IInputStream& DCLN)
|
||||
{
|
||||
bool b = false;
|
||||
|
||||
@@ -39,7 +36,7 @@ void CCollisionLoader::ParseOBBNode(CInputStream& DCLN)
|
||||
DCLN.Seek(numFaces * 2, SEEK_CUR);
|
||||
}
|
||||
|
||||
void CCollisionLoader::ReadPropertyFlags(CInputStream& src)
|
||||
void CCollisionLoader::ReadPropertyFlags(IInputStream& src)
|
||||
{
|
||||
CCollisionMesh::SCollisionProperties property;
|
||||
|
||||
@@ -64,7 +61,7 @@ void CCollisionLoader::ReadPropertyFlags(CInputStream& src)
|
||||
mProperties.push_back(property);
|
||||
}
|
||||
|
||||
void CCollisionLoader::LoadCollisionIndices(CInputStream &file, bool buildAABox)
|
||||
void CCollisionLoader::LoadCollisionIndices(IInputStream &file, bool buildAABox)
|
||||
{
|
||||
// Properties
|
||||
u32 propSetCount = file.ReadLong();
|
||||
@@ -131,7 +128,7 @@ void CCollisionLoader::LoadCollisionIndices(CInputStream &file, bool buildAABox)
|
||||
}
|
||||
|
||||
// ************ STATIC ************
|
||||
CCollisionMeshGroup* CCollisionLoader::LoadAreaCollision(CInputStream& MREA)
|
||||
CCollisionMeshGroup* CCollisionLoader::LoadAreaCollision(IInputStream& MREA)
|
||||
{
|
||||
if (!MREA.IsValid()) return nullptr;
|
||||
CCollisionLoader loader;
|
||||
@@ -162,7 +159,7 @@ CCollisionMeshGroup* CCollisionLoader::LoadAreaCollision(CInputStream& MREA)
|
||||
return loader.mpGroup;
|
||||
}
|
||||
|
||||
CCollisionMeshGroup* CCollisionLoader::LoadDCLN(CInputStream &DCLN)
|
||||
CCollisionMeshGroup* CCollisionLoader::LoadDCLN(IInputStream &DCLN)
|
||||
{
|
||||
if (!DCLN.IsValid()) return nullptr;
|
||||
|
||||
|
||||
@@ -13,16 +13,16 @@ class CCollisionLoader
|
||||
std::vector<CCollisionMesh::SCollisionProperties> mProperties;
|
||||
|
||||
CCollisionLoader();
|
||||
CCollisionMesh::CCollisionOctree* ParseOctree(CInputStream& src);
|
||||
CCollisionMesh::CCollisionOctree::SBranch* ParseOctreeBranch(CInputStream& src);
|
||||
CCollisionMesh::CCollisionOctree::SLeaf* ParseOctreeLeaf(CInputStream& src);
|
||||
void ParseOBBNode(CInputStream& DCLN);
|
||||
void ReadPropertyFlags(CInputStream& src);
|
||||
void LoadCollisionIndices(CInputStream& file, bool buildAABox);
|
||||
CCollisionMesh::CCollisionOctree* ParseOctree(IInputStream& src);
|
||||
CCollisionMesh::CCollisionOctree::SBranch* ParseOctreeBranch(IInputStream& src);
|
||||
CCollisionMesh::CCollisionOctree::SLeaf* ParseOctreeLeaf(IInputStream& src);
|
||||
void ParseOBBNode(IInputStream& DCLN);
|
||||
void ReadPropertyFlags(IInputStream& src);
|
||||
void LoadCollisionIndices(IInputStream& file, bool buildAABox);
|
||||
|
||||
public:
|
||||
static CCollisionMeshGroup* LoadAreaCollision(CInputStream& MREA);
|
||||
static CCollisionMeshGroup* LoadDCLN(CInputStream& DCLN);
|
||||
static CCollisionMeshGroup* LoadAreaCollision(IInputStream& MREA);
|
||||
static CCollisionMeshGroup* LoadDCLN(IInputStream& DCLN);
|
||||
static EGame GetFormatVersion(u32 version);
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ CFontLoader::CFontLoader()
|
||||
{
|
||||
}
|
||||
|
||||
CFont* CFontLoader::LoadFont(CInputStream& FONT)
|
||||
CFont* CFontLoader::LoadFont(IInputStream& FONT)
|
||||
{
|
||||
// If I seek past a value without reading it, then it's because I don't know what it is
|
||||
mpFont->mUnknown = FONT.ReadLong();
|
||||
@@ -79,7 +79,7 @@ CFont* CFontLoader::LoadFont(CInputStream& FONT)
|
||||
return mpFont;
|
||||
}
|
||||
|
||||
CFont* CFontLoader::LoadFONT(CInputStream& FONT)
|
||||
CFont* CFontLoader::LoadFONT(IInputStream& FONT)
|
||||
{
|
||||
if (!FONT.IsValid()) return nullptr;
|
||||
Log::Write("Loading " + FONT.GetSourceString());
|
||||
|
||||
@@ -11,10 +11,10 @@ class CFontLoader
|
||||
EGame mVersion;
|
||||
|
||||
CFontLoader();
|
||||
CFont* LoadFont(CInputStream& FONT);
|
||||
CFont* LoadFont(IInputStream& FONT);
|
||||
|
||||
public:
|
||||
static CFont* LoadFONT(CInputStream& FONT);
|
||||
static CFont* LoadFONT(IInputStream& FONT);
|
||||
static EGame GetFormatVersion(u32 Version);
|
||||
};
|
||||
|
||||
|
||||
@@ -591,7 +591,7 @@ CMaterial* CMaterialLoader::LoadAssimpMaterial(const aiMaterial *pAiMat)
|
||||
}
|
||||
|
||||
// ************ STATIC ************
|
||||
CMaterialSet* CMaterialLoader::LoadMaterialSet(CInputStream& Mat, EGame Version)
|
||||
CMaterialSet* CMaterialLoader::LoadMaterialSet(IInputStream& Mat, EGame Version)
|
||||
{
|
||||
CMaterialLoader Loader;
|
||||
Loader.mpSet = new CMaterialSet();
|
||||
|
||||
@@ -12,7 +12,7 @@ class CMaterialLoader
|
||||
{
|
||||
// Material data
|
||||
CMaterialSet *mpSet;
|
||||
CInputStream *mpFile;
|
||||
IInputStream *mpFile;
|
||||
EGame mVersion;
|
||||
std::vector<TResPtr<CTexture>> mTextures;
|
||||
bool mHasOPAC;
|
||||
@@ -38,7 +38,7 @@ class CMaterialLoader
|
||||
|
||||
// Static
|
||||
public:
|
||||
static CMaterialSet* LoadMaterialSet(CInputStream& Mat, EGame Version);
|
||||
static CMaterialSet* LoadMaterialSet(IInputStream& Mat, EGame Version);
|
||||
static CMaterialSet* ImportAssimpMaterials(const aiScene *pScene, EGame targetVersion);
|
||||
};
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ CModelLoader::~CModelLoader()
|
||||
{
|
||||
}
|
||||
|
||||
void CModelLoader::LoadWorldMeshHeader(CInputStream &Model)
|
||||
void CModelLoader::LoadWorldMeshHeader(IInputStream &Model)
|
||||
{
|
||||
// I don't really have any need for most of this data, so
|
||||
Model.Seek(0x34, SEEK_CUR);
|
||||
@@ -20,7 +20,7 @@ void CModelLoader::LoadWorldMeshHeader(CInputStream &Model)
|
||||
mpBlockMgr->ToNextBlock();
|
||||
}
|
||||
|
||||
void CModelLoader::LoadAttribArrays(CInputStream& Model)
|
||||
void CModelLoader::LoadAttribArrays(IInputStream& Model)
|
||||
{
|
||||
// Positions
|
||||
if (mFlags & eShortPositions) // Shorts (DKCR only)
|
||||
@@ -105,7 +105,7 @@ void CModelLoader::LoadAttribArrays(CInputStream& Model)
|
||||
}
|
||||
}
|
||||
|
||||
void CModelLoader::LoadSurfaceOffsets(CInputStream& Model)
|
||||
void CModelLoader::LoadSurfaceOffsets(IInputStream& Model)
|
||||
{
|
||||
mSurfaceCount = Model.ReadLong();
|
||||
mSurfaceOffsets.resize(mSurfaceCount);
|
||||
@@ -116,7 +116,7 @@ void CModelLoader::LoadSurfaceOffsets(CInputStream& Model)
|
||||
mpBlockMgr->ToNextBlock();
|
||||
}
|
||||
|
||||
SSurface* CModelLoader::LoadSurface(CInputStream& Model)
|
||||
SSurface* CModelLoader::LoadSurface(IInputStream& Model)
|
||||
{
|
||||
SSurface *pSurf = new SSurface;
|
||||
|
||||
@@ -228,7 +228,7 @@ SSurface* CModelLoader::LoadSurface(CInputStream& Model)
|
||||
return pSurf;
|
||||
}
|
||||
|
||||
void CModelLoader::LoadSurfaceHeaderPrime(CInputStream& Model, SSurface *pSurf)
|
||||
void CModelLoader::LoadSurfaceHeaderPrime(IInputStream& Model, SSurface *pSurf)
|
||||
{
|
||||
pSurf->CenterPoint = CVector3f(Model);
|
||||
pSurf->MaterialID = Model.ReadLong();
|
||||
@@ -252,7 +252,7 @@ void CModelLoader::LoadSurfaceHeaderPrime(CInputStream& Model, SSurface *pSurf)
|
||||
Model.SeekToBoundary(32);
|
||||
}
|
||||
|
||||
void CModelLoader::LoadSurfaceHeaderDKCR(CInputStream& Model, SSurface *pSurf)
|
||||
void CModelLoader::LoadSurfaceHeaderDKCR(IInputStream& Model, SSurface *pSurf)
|
||||
{
|
||||
pSurf->CenterPoint = CVector3f(Model);
|
||||
Model.Seek(0xE, SEEK_CUR);
|
||||
@@ -375,7 +375,7 @@ SSurface* CModelLoader::LoadAssimpMesh(const aiMesh *pMesh, CMaterialSet *pSet)
|
||||
}
|
||||
|
||||
// ************ STATIC ************
|
||||
CModel* CModelLoader::LoadCMDL(CInputStream& CMDL)
|
||||
CModel* CModelLoader::LoadCMDL(IInputStream& CMDL)
|
||||
{
|
||||
CModelLoader Loader;
|
||||
Log::Write("Loading " + CMDL.GetSourceString());
|
||||
@@ -486,7 +486,7 @@ CModel* CModelLoader::LoadCMDL(CInputStream& CMDL)
|
||||
return pModel;
|
||||
}
|
||||
|
||||
CModel* CModelLoader::LoadWorldModel(CInputStream& MREA, CBlockMgrIn& BlockMgr, CMaterialSet& MatSet, EGame Version)
|
||||
CModel* CModelLoader::LoadWorldModel(IInputStream& MREA, CBlockMgrIn& BlockMgr, CMaterialSet& MatSet, EGame Version)
|
||||
{
|
||||
CModelLoader Loader;
|
||||
Loader.mpBlockMgr = &BlockMgr;
|
||||
@@ -519,7 +519,7 @@ CModel* CModelLoader::LoadWorldModel(CInputStream& MREA, CBlockMgrIn& BlockMgr,
|
||||
return pModel;
|
||||
}
|
||||
|
||||
CModel* CModelLoader::LoadCorruptionWorldModel(CInputStream &MREA, CBlockMgrIn &BlockMgr, CMaterialSet &MatSet, u32 HeaderSecNum, u32 GPUSecNum, EGame Version)
|
||||
CModel* CModelLoader::LoadCorruptionWorldModel(IInputStream &MREA, CBlockMgrIn &BlockMgr, CMaterialSet &MatSet, u32 HeaderSecNum, u32 GPUSecNum, EGame Version)
|
||||
{
|
||||
CModelLoader Loader;
|
||||
Loader.mpBlockMgr = &BlockMgr;
|
||||
|
||||
@@ -45,19 +45,19 @@ private:
|
||||
|
||||
CModelLoader();
|
||||
~CModelLoader();
|
||||
void LoadWorldMeshHeader(CInputStream& Model);
|
||||
void LoadAttribArrays(CInputStream& Model);
|
||||
void LoadAttribArraysDKCR(CInputStream& Model);
|
||||
void LoadSurfaceOffsets(CInputStream& Model);
|
||||
SSurface* LoadSurface(CInputStream& Model);
|
||||
void LoadSurfaceHeaderPrime(CInputStream& Model, SSurface *pSurf);
|
||||
void LoadSurfaceHeaderDKCR(CInputStream& Model, SSurface *pSurf);
|
||||
void LoadWorldMeshHeader(IInputStream& Model);
|
||||
void LoadAttribArrays(IInputStream& Model);
|
||||
void LoadAttribArraysDKCR(IInputStream& Model);
|
||||
void LoadSurfaceOffsets(IInputStream& Model);
|
||||
SSurface* LoadSurface(IInputStream& Model);
|
||||
void LoadSurfaceHeaderPrime(IInputStream& Model, SSurface *pSurf);
|
||||
void LoadSurfaceHeaderDKCR(IInputStream& Model, SSurface *pSurf);
|
||||
SSurface* LoadAssimpMesh(const aiMesh *pMesh, CMaterialSet *pSet);
|
||||
|
||||
public:
|
||||
static CModel* LoadCMDL(CInputStream& CMDL);
|
||||
static CModel* LoadWorldModel(CInputStream& MREA, CBlockMgrIn& BlockMgr, CMaterialSet& MatSet, EGame Version);
|
||||
static CModel* LoadCorruptionWorldModel(CInputStream& MREA, CBlockMgrIn& BlockMgr, CMaterialSet& MatSet, u32 HeaderSecNum, u32 GPUSecNum, EGame Version);
|
||||
static CModel* LoadCMDL(IInputStream& CMDL);
|
||||
static CModel* LoadWorldModel(IInputStream& MREA, CBlockMgrIn& BlockMgr, CMaterialSet& MatSet, EGame Version);
|
||||
static CModel* LoadCorruptionWorldModel(IInputStream& MREA, CBlockMgrIn& BlockMgr, CMaterialSet& MatSet, u32 HeaderSecNum, u32 GPUSecNum, EGame Version);
|
||||
static CModel* ImportAssimpNode(const aiNode *pNode, const aiScene *pScene, CMaterialSet& matSet);
|
||||
static EGame GetFormatVersion(u32 Version);
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ CScanLoader::CScanLoader()
|
||||
{
|
||||
}
|
||||
|
||||
CScan* CScanLoader::LoadScanMP1(CInputStream &SCAN)
|
||||
CScan* CScanLoader::LoadScanMP1(IInputStream &SCAN)
|
||||
{
|
||||
// Basic support at the moment - don't read animation/scan image data
|
||||
SCAN.Seek(0x4, SEEK_CUR); // Skip FRME ID
|
||||
@@ -18,7 +18,7 @@ CScan* CScanLoader::LoadScanMP1(CInputStream &SCAN)
|
||||
return mpScan;
|
||||
}
|
||||
|
||||
CScan* CScanLoader::LoadScanMP2(CInputStream& SCAN)
|
||||
CScan* CScanLoader::LoadScanMP2(IInputStream& SCAN)
|
||||
{
|
||||
// The SCAN format in MP2 embeds a SNFO object using the same format as SCLY
|
||||
// However since the contents of the file are consistent there's no need to delegate to CScriptLoader
|
||||
@@ -72,7 +72,7 @@ CScan* CScanLoader::LoadScanMP2(CInputStream& SCAN)
|
||||
return mpScan;
|
||||
}
|
||||
|
||||
void CScanLoader::LoadParamsMP2(CInputStream& SCAN)
|
||||
void CScanLoader::LoadParamsMP2(IInputStream& SCAN)
|
||||
{
|
||||
// Function begins after the SNFO property count
|
||||
for (u32 iProp = 0; iProp < 20; iProp++)
|
||||
@@ -103,7 +103,7 @@ void CScanLoader::LoadParamsMP2(CInputStream& SCAN)
|
||||
mpScan->mVersion = eEchoes;
|
||||
}
|
||||
|
||||
void CScanLoader::LoadParamsMP3(CInputStream& SCAN)
|
||||
void CScanLoader::LoadParamsMP3(IInputStream& SCAN)
|
||||
{
|
||||
// Function begins after the SNFO property count
|
||||
// Function is near-identical to the MP2 one, but when I add support
|
||||
@@ -137,7 +137,7 @@ void CScanLoader::LoadParamsMP3(CInputStream& SCAN)
|
||||
}
|
||||
|
||||
// ************ STATIC/PUBLIC ************
|
||||
CScan* CScanLoader::LoadSCAN(CInputStream &SCAN)
|
||||
CScan* CScanLoader::LoadSCAN(IInputStream &SCAN)
|
||||
{
|
||||
if (!SCAN.IsValid()) return nullptr;
|
||||
Log::Write("Loading " + SCAN.GetSourceString());
|
||||
|
||||
@@ -10,13 +10,13 @@ class CScanLoader
|
||||
EGame mVersion;
|
||||
|
||||
CScanLoader();
|
||||
CScan* LoadScanMP1(CInputStream& SCAN);
|
||||
CScan* LoadScanMP2(CInputStream& SCAN);
|
||||
void LoadParamsMP2(CInputStream& SCAN);
|
||||
void LoadParamsMP3(CInputStream& SCAN);
|
||||
CScan* LoadScanMP1(IInputStream& SCAN);
|
||||
CScan* LoadScanMP2(IInputStream& SCAN);
|
||||
void LoadParamsMP2(IInputStream& SCAN);
|
||||
void LoadParamsMP3(IInputStream& SCAN);
|
||||
|
||||
public:
|
||||
static CScan* LoadSCAN(CInputStream& SCAN);
|
||||
static CScan* LoadSCAN(IInputStream& SCAN);
|
||||
};
|
||||
|
||||
#endif // CSCANLOADER_H
|
||||
|
||||
@@ -10,7 +10,7 @@ CScriptLoader::CScriptLoader()
|
||||
mpObj = nullptr;
|
||||
}
|
||||
|
||||
CPropertyStruct* CScriptLoader::LoadStructMP1(CInputStream& SCLY, CStructTemplate *pTemp)
|
||||
CPropertyStruct* CScriptLoader::LoadStructMP1(IInputStream& SCLY, CStructTemplate *pTemp)
|
||||
{
|
||||
u32 structStart = SCLY.Tell();
|
||||
CPropertyStruct *propStruct = new CPropertyStruct();
|
||||
@@ -143,7 +143,7 @@ CPropertyStruct* CScriptLoader::LoadStructMP1(CInputStream& SCLY, CStructTemplat
|
||||
return propStruct;
|
||||
}
|
||||
|
||||
CScriptObject* CScriptLoader::LoadObjectMP1(CInputStream& SCLY)
|
||||
CScriptObject* CScriptLoader::LoadObjectMP1(IInputStream& SCLY)
|
||||
{
|
||||
u32 objStart = SCLY.Tell();
|
||||
u8 type = SCLY.ReadByte();
|
||||
@@ -192,7 +192,7 @@ CScriptObject* CScriptLoader::LoadObjectMP1(CInputStream& SCLY)
|
||||
return mpObj;
|
||||
}
|
||||
|
||||
CScriptLayer* CScriptLoader::LoadLayerMP1(CInputStream &SCLY)
|
||||
CScriptLayer* CScriptLoader::LoadLayerMP1(IInputStream &SCLY)
|
||||
{
|
||||
u32 LayerStart = SCLY.Tell();
|
||||
|
||||
@@ -215,7 +215,7 @@ CScriptLayer* CScriptLoader::LoadLayerMP1(CInputStream &SCLY)
|
||||
return mpLayer;
|
||||
}
|
||||
|
||||
void CScriptLoader::LoadStructMP2(CInputStream& SCLY, CPropertyStruct *pStruct, CStructTemplate *pTemp)
|
||||
void CScriptLoader::LoadStructMP2(IInputStream& SCLY, CPropertyStruct *pStruct, CStructTemplate *pTemp)
|
||||
{
|
||||
// Verify property count
|
||||
u32 propCount = pTemp->Count();
|
||||
@@ -417,7 +417,7 @@ void CScriptLoader::LoadStructMP2(CInputStream& SCLY, CPropertyStruct *pStruct,
|
||||
}
|
||||
}
|
||||
|
||||
CScriptObject* CScriptLoader::LoadObjectMP2(CInputStream& SCLY)
|
||||
CScriptObject* CScriptLoader::LoadObjectMP2(IInputStream& SCLY)
|
||||
{
|
||||
u32 ObjStart = SCLY.Tell();
|
||||
u32 ObjectID = SCLY.ReadLong();
|
||||
@@ -464,7 +464,7 @@ CScriptObject* CScriptLoader::LoadObjectMP2(CInputStream& SCLY)
|
||||
return mpObj;
|
||||
}
|
||||
|
||||
CScriptLayer* CScriptLoader::LoadLayerMP2(CInputStream& SCLY)
|
||||
CScriptLayer* CScriptLoader::LoadLayerMP2(IInputStream& SCLY)
|
||||
{
|
||||
CFourCC SCLY_Magic(SCLY);
|
||||
|
||||
@@ -496,7 +496,7 @@ CScriptLayer* CScriptLoader::LoadLayerMP2(CInputStream& SCLY)
|
||||
return mpLayer;
|
||||
}
|
||||
|
||||
CScriptLayer* CScriptLoader::LoadLayer(CInputStream &SCLY, CGameArea *pArea, EGame version)
|
||||
CScriptLayer* CScriptLoader::LoadLayer(IInputStream &SCLY, CGameArea *pArea, EGame version)
|
||||
{
|
||||
if (!SCLY.IsValid()) return nullptr;
|
||||
|
||||
|
||||
@@ -17,18 +17,18 @@ class CScriptLoader
|
||||
|
||||
CScriptLoader();
|
||||
|
||||
CPropertyStruct* LoadStructMP1(CInputStream& SCLY, CStructTemplate *tmp);
|
||||
CScriptObject* LoadObjectMP1(CInputStream& SCLY);
|
||||
CScriptLayer* LoadLayerMP1(CInputStream& SCLY);
|
||||
CPropertyStruct* LoadStructMP1(IInputStream& SCLY, CStructTemplate *tmp);
|
||||
CScriptObject* LoadObjectMP1(IInputStream& SCLY);
|
||||
CScriptLayer* LoadLayerMP1(IInputStream& SCLY);
|
||||
|
||||
void LoadStructMP2(CInputStream& SCLY, CPropertyStruct *pStruct, CStructTemplate *pTemp);
|
||||
CScriptObject* LoadObjectMP2(CInputStream& SCLY);
|
||||
CScriptLayer* LoadLayerMP2(CInputStream& SCLY);
|
||||
void LoadStructMP2(IInputStream& SCLY, CPropertyStruct *pStruct, CStructTemplate *pTemp);
|
||||
CScriptObject* LoadObjectMP2(IInputStream& SCLY);
|
||||
CScriptLayer* LoadLayerMP2(IInputStream& SCLY);
|
||||
|
||||
void SetupAttribs();
|
||||
|
||||
public:
|
||||
static CScriptLayer* LoadLayer(CInputStream& SCLY, CGameArea *pArea, EGame version);
|
||||
static CScriptLayer* LoadLayer(IInputStream& SCLY, CGameArea *pArea, EGame version);
|
||||
};
|
||||
|
||||
#endif // CSCRIPTLOADER_H
|
||||
|
||||
@@ -5,7 +5,7 @@ CStringLoader::CStringLoader()
|
||||
{
|
||||
}
|
||||
|
||||
void CStringLoader::LoadPrimeDemoSTRG(CInputStream& STRG)
|
||||
void CStringLoader::LoadPrimeDemoSTRG(IInputStream& STRG)
|
||||
{
|
||||
// This function starts at 0x4 in the file - right after the size
|
||||
// This STRG version only supports one language per file
|
||||
@@ -32,7 +32,7 @@ void CStringLoader::LoadPrimeDemoSTRG(CInputStream& STRG)
|
||||
}
|
||||
}
|
||||
|
||||
void CStringLoader::LoadPrimeSTRG(CInputStream& STRG)
|
||||
void CStringLoader::LoadPrimeSTRG(IInputStream& STRG)
|
||||
{
|
||||
// This function starts at 0x8 in the file, after magic/version
|
||||
// Header
|
||||
@@ -80,7 +80,7 @@ void CStringLoader::LoadPrimeSTRG(CInputStream& STRG)
|
||||
}
|
||||
}
|
||||
|
||||
void CStringLoader::LoadCorruptionSTRG(CInputStream& STRG)
|
||||
void CStringLoader::LoadCorruptionSTRG(IInputStream& STRG)
|
||||
{
|
||||
// This function starts at 0x8 in the file, after magic/version
|
||||
// Header
|
||||
@@ -126,7 +126,7 @@ void CStringLoader::LoadCorruptionSTRG(CInputStream& STRG)
|
||||
}
|
||||
}
|
||||
|
||||
void CStringLoader::LoadNameTable(CInputStream& STRG)
|
||||
void CStringLoader::LoadNameTable(IInputStream& STRG)
|
||||
{
|
||||
// Name table header
|
||||
u32 NameCount = STRG.ReadLong();
|
||||
@@ -158,7 +158,7 @@ void CStringLoader::LoadNameTable(CInputStream& STRG)
|
||||
}
|
||||
|
||||
// ************ STATIC ************
|
||||
CStringTable* CStringLoader::LoadSTRG(CInputStream& STRG)
|
||||
CStringTable* CStringLoader::LoadSTRG(IInputStream& STRG)
|
||||
{
|
||||
// Verify that this is a valid STRG
|
||||
if (!STRG.IsValid()) return nullptr;
|
||||
|
||||
@@ -12,13 +12,13 @@ class CStringLoader
|
||||
EGame mVersion;
|
||||
|
||||
CStringLoader();
|
||||
void LoadPrimeDemoSTRG(CInputStream& STRG);
|
||||
void LoadPrimeSTRG(CInputStream& STRG);
|
||||
void LoadCorruptionSTRG(CInputStream& STRG);
|
||||
void LoadNameTable(CInputStream& STRG);
|
||||
void LoadPrimeDemoSTRG(IInputStream& STRG);
|
||||
void LoadPrimeSTRG(IInputStream& STRG);
|
||||
void LoadCorruptionSTRG(IInputStream& STRG);
|
||||
void LoadNameTable(IInputStream& STRG);
|
||||
|
||||
public:
|
||||
static CStringTable* LoadSTRG(CInputStream& STRG);
|
||||
static CStringTable* LoadSTRG(IInputStream& STRG);
|
||||
static EGame GetFormatVersion(u32 Version);
|
||||
};
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ CTexture* CTextureDecoder::CreateTexture()
|
||||
}
|
||||
|
||||
// ************ STATIC ************
|
||||
CTexture* CTextureDecoder::LoadTXTR(CInputStream& TXTR)
|
||||
CTexture* CTextureDecoder::LoadTXTR(IInputStream& TXTR)
|
||||
{
|
||||
CTextureDecoder Decoder;
|
||||
Decoder.ReadTXTR(TXTR);
|
||||
@@ -98,7 +98,7 @@ CTexture* CTextureDecoder::LoadTXTR(CInputStream& TXTR)
|
||||
return Decoder.CreateTexture();
|
||||
}
|
||||
|
||||
CTexture* CTextureDecoder::DoFullDecode(CInputStream &TXTR)
|
||||
CTexture* CTextureDecoder::DoFullDecode(IInputStream &TXTR)
|
||||
{
|
||||
CTextureDecoder Decoder;
|
||||
Decoder.ReadTXTR(TXTR);
|
||||
@@ -109,7 +109,7 @@ CTexture* CTextureDecoder::DoFullDecode(CInputStream &TXTR)
|
||||
return pTexture;
|
||||
}
|
||||
|
||||
CTexture* CTextureDecoder::LoadDDS(CInputStream &DDS)
|
||||
CTexture* CTextureDecoder::LoadDDS(IInputStream &DDS)
|
||||
{
|
||||
CTextureDecoder Decoder;
|
||||
Decoder.ReadDDS(DDS);
|
||||
@@ -124,7 +124,7 @@ CTexture* CTextureDecoder::DoFullDecode(CTexture*)
|
||||
}
|
||||
|
||||
// ************ READ ************
|
||||
void CTextureDecoder::ReadTXTR(CInputStream& TXTR)
|
||||
void CTextureDecoder::ReadTXTR(IInputStream& TXTR)
|
||||
{
|
||||
// Read TXTR header
|
||||
Log::Write("Loading " + TXTR.GetSourceString());
|
||||
@@ -144,12 +144,12 @@ void CTextureDecoder::ReadTXTR(CInputStream& TXTR)
|
||||
mPalettes.resize(PaletteEntryCount * 2);
|
||||
TXTR.ReadBytes(mPalettes.data(), mPalettes.size());
|
||||
|
||||
mPaletteInput.SetData(mPalettes.data(), mPalettes.size(), IOUtil::BigEndian);
|
||||
mPaletteInput.SetData(mPalettes.data(), mPalettes.size(), IOUtil::eBigEndian);
|
||||
}
|
||||
else mHasPalettes = false;
|
||||
}
|
||||
|
||||
void CTextureDecoder::ReadDDS(CInputStream& DDS)
|
||||
void CTextureDecoder::ReadDDS(IInputStream& DDS)
|
||||
{
|
||||
Log::Write("Loading " + DDS.GetSourceString());
|
||||
|
||||
@@ -202,7 +202,7 @@ void CTextureDecoder::ReadDDS(CInputStream& DDS)
|
||||
}
|
||||
|
||||
// ************ DECODE ************
|
||||
void CTextureDecoder::PartialDecodeGXTexture(CInputStream& TXTR)
|
||||
void CTextureDecoder::PartialDecodeGXTexture(IInputStream& TXTR)
|
||||
{
|
||||
// Get image data size, create output buffer
|
||||
u32 ImageStart = TXTR.Tell();
|
||||
@@ -214,7 +214,7 @@ void CTextureDecoder::PartialDecodeGXTexture(CInputStream& TXTR)
|
||||
if ((mHasPalettes) && (mPaletteFormat == ePalette_RGB5A3)) mDataBufferSize *= 2;
|
||||
mpDataBuffer = new u8[mDataBufferSize];
|
||||
|
||||
CMemoryOutStream Out(mpDataBuffer, mDataBufferSize, IOUtil::SystemEndianness);
|
||||
CMemoryOutStream Out(mpDataBuffer, mDataBufferSize, IOUtil::kSystemEndianness);
|
||||
|
||||
// Initializing more stuff before we start the mipmap loop
|
||||
u32 MipW = mWidth, MipH = mHeight;
|
||||
@@ -275,7 +275,7 @@ void CTextureDecoder::PartialDecodeGXTexture(CInputStream& TXTR)
|
||||
}
|
||||
}
|
||||
|
||||
void CTextureDecoder::FullDecodeGXTexture(CInputStream& TXTR)
|
||||
void CTextureDecoder::FullDecodeGXTexture(IInputStream& TXTR)
|
||||
{
|
||||
// Get image data size, create output buffer
|
||||
u32 ImageStart = TXTR.Tell();
|
||||
@@ -286,7 +286,7 @@ void CTextureDecoder::FullDecodeGXTexture(CInputStream& TXTR)
|
||||
mDataBufferSize = ImageSize * (32 / gskSourceBpp[mTexelFormat]);
|
||||
mpDataBuffer = new u8[mDataBufferSize];
|
||||
|
||||
CMemoryOutStream Out(mpDataBuffer, mDataBufferSize, IOUtil::SystemEndianness);
|
||||
CMemoryOutStream Out(mpDataBuffer, mDataBufferSize, IOUtil::kSystemEndianness);
|
||||
|
||||
// Initializing more stuff before we start the mipmap loop
|
||||
u32 MipW = mWidth, MipH = mHeight;
|
||||
@@ -359,7 +359,7 @@ void CTextureDecoder::FullDecodeGXTexture(CInputStream& TXTR)
|
||||
}
|
||||
}
|
||||
|
||||
void CTextureDecoder::DecodeDDS(CInputStream &DDS)
|
||||
void CTextureDecoder::DecodeDDS(IInputStream &DDS)
|
||||
{
|
||||
// Get image data size, create output buffer
|
||||
u32 ImageStart = DDS.Tell();
|
||||
@@ -373,7 +373,7 @@ void CTextureDecoder::DecodeDDS(CInputStream &DDS)
|
||||
else mDataBufferSize *= 4;
|
||||
mpDataBuffer = new u8[mDataBufferSize];
|
||||
|
||||
CMemoryOutStream Out(mpDataBuffer, mDataBufferSize, IOUtil::SystemEndianness);
|
||||
CMemoryOutStream Out(mpDataBuffer, mDataBufferSize, IOUtil::kSystemEndianness);
|
||||
|
||||
// Initializing more stuff before we start the mipmap loop
|
||||
u32 MipW = mWidth, MipH = mHeight;
|
||||
@@ -470,7 +470,7 @@ void CTextureDecoder::DecodeDDS(CInputStream &DDS)
|
||||
}
|
||||
|
||||
// ************ READ PIXELS (PARTIAL DECODE) ************
|
||||
void CTextureDecoder::ReadPixelsI4(CInputStream& src, COutputStream& dst)
|
||||
void CTextureDecoder::ReadPixelsI4(IInputStream& src, IOutputStream& dst)
|
||||
{
|
||||
u8 px = src.ReadByte();
|
||||
dst.WriteByte(Extend4to8(px >> 4));
|
||||
@@ -479,14 +479,14 @@ void CTextureDecoder::ReadPixelsI4(CInputStream& src, COutputStream& dst)
|
||||
dst.WriteByte(Extend4to8(px));
|
||||
}
|
||||
|
||||
void CTextureDecoder::ReadPixelI8(CInputStream& src, COutputStream& dst)
|
||||
void CTextureDecoder::ReadPixelI8(IInputStream& src, IOutputStream& dst)
|
||||
{
|
||||
u8 px = src.ReadByte();
|
||||
dst.WriteByte(px);
|
||||
dst.WriteByte(px);
|
||||
}
|
||||
|
||||
void CTextureDecoder::ReadPixelIA4(CInputStream& src, COutputStream& dst)
|
||||
void CTextureDecoder::ReadPixelIA4(IInputStream& src, IOutputStream& dst)
|
||||
{
|
||||
// this can be left as-is for DDS conversion, but opengl doesn't support two components in one byte...
|
||||
u8 byte = src.ReadByte();
|
||||
@@ -495,12 +495,12 @@ void CTextureDecoder::ReadPixelIA4(CInputStream& src, COutputStream& dst)
|
||||
dst.WriteShort((l << 8) | a);
|
||||
}
|
||||
|
||||
void CTextureDecoder::ReadPixelIA8(CInputStream& src, COutputStream& dst)
|
||||
void CTextureDecoder::ReadPixelIA8(IInputStream& src, IOutputStream& dst)
|
||||
{
|
||||
dst.WriteShort(src.ReadShort());
|
||||
}
|
||||
|
||||
void CTextureDecoder::ReadPixelsC4(CInputStream& src, COutputStream& dst)
|
||||
void CTextureDecoder::ReadPixelsC4(IInputStream& src, IOutputStream& dst)
|
||||
{
|
||||
// This isn't how C4 works, but due to the way Retro packed font textures (which use C4)
|
||||
// this is the only way to get them to decode correctly for now.
|
||||
@@ -529,7 +529,7 @@ void CTextureDecoder::ReadPixelsC4(CInputStream& src, COutputStream& dst)
|
||||
}
|
||||
}
|
||||
|
||||
void CTextureDecoder::ReadPixelC8(CInputStream& src, COutputStream& dst)
|
||||
void CTextureDecoder::ReadPixelC8(IInputStream& src, IOutputStream& dst)
|
||||
{
|
||||
// DKCR fonts use C8 :|
|
||||
u8 index = src.ReadByte();
|
||||
@@ -549,13 +549,13 @@ void CTextureDecoder::ReadPixelC8(CInputStream& src, COutputStream& dst)
|
||||
else if (mPaletteFormat == ePalette_RGB5A3) ReadPixelRGB5A3(mPaletteInput, dst);
|
||||
}
|
||||
|
||||
void CTextureDecoder::ReadPixelRGB565(CInputStream& src, COutputStream& dst)
|
||||
void CTextureDecoder::ReadPixelRGB565(IInputStream& src, IOutputStream& dst)
|
||||
{
|
||||
// RGB565 can be used as-is.
|
||||
dst.WriteShort(src.ReadShort());
|
||||
}
|
||||
|
||||
void CTextureDecoder::ReadPixelRGB5A3(CInputStream& src, COutputStream& dst)
|
||||
void CTextureDecoder::ReadPixelRGB5A3(IInputStream& src, IOutputStream& dst)
|
||||
{
|
||||
u16 px = src.ReadShort();
|
||||
u8 r, g, b, a;
|
||||
@@ -580,7 +580,7 @@ void CTextureDecoder::ReadPixelRGB5A3(CInputStream& src, COutputStream& dst)
|
||||
dst.WriteLong(c);
|
||||
}
|
||||
|
||||
void CTextureDecoder::ReadPixelRGBA8(CInputStream& src, COutputStream& dst)
|
||||
void CTextureDecoder::ReadPixelRGBA8(IInputStream& src, IOutputStream& dst)
|
||||
{
|
||||
u16 ar = src.ReadShort();
|
||||
src.Seek(0x1E, SEEK_CUR);
|
||||
@@ -590,7 +590,7 @@ void CTextureDecoder::ReadPixelRGBA8(CInputStream& src, COutputStream& dst)
|
||||
dst.WriteLong(px);
|
||||
}
|
||||
|
||||
void CTextureDecoder::ReadSubBlockCMPR(CInputStream& src, COutputStream& dst)
|
||||
void CTextureDecoder::ReadSubBlockCMPR(IInputStream& src, IOutputStream& dst)
|
||||
{
|
||||
dst.WriteShort(src.ReadShort());
|
||||
dst.WriteShort(src.ReadShort());
|
||||
@@ -629,7 +629,7 @@ CColor CTextureDecoder::DecodePixelIA8(u16 Short)
|
||||
return CColor::Integral(Lum, Lum, Lum, Alpha);
|
||||
}
|
||||
|
||||
CColor CTextureDecoder::DecodePixelC4(u8 Byte, u8 WhichPixel, CInputStream& PaletteStream)
|
||||
CColor CTextureDecoder::DecodePixelC4(u8 Byte, u8 WhichPixel, IInputStream& PaletteStream)
|
||||
{
|
||||
if (WhichPixel == 1) Byte >>= 4;
|
||||
Byte &= 0xF;
|
||||
@@ -641,7 +641,7 @@ CColor CTextureDecoder::DecodePixelC4(u8 Byte, u8 WhichPixel, CInputStream& Pale
|
||||
else return CColor::skTransparentBlack;
|
||||
}
|
||||
|
||||
CColor CTextureDecoder::DecodePixelC8(u8 Byte, CInputStream& PaletteStream)
|
||||
CColor CTextureDecoder::DecodePixelC8(u8 Byte, IInputStream& PaletteStream)
|
||||
{
|
||||
PaletteStream.Seek(Byte * 2, SEEK_SET);
|
||||
if (mPaletteFormat == ePalette_IA8) return DecodePixelIA8(PaletteStream.ReadShort());
|
||||
@@ -678,7 +678,7 @@ CColor CTextureDecoder::DecodePixelRGB5A3(u16 Short)
|
||||
}
|
||||
}
|
||||
|
||||
void CTextureDecoder::DecodeSubBlockCMPR(CInputStream& src, COutputStream& dst, u16 Width)
|
||||
void CTextureDecoder::DecodeSubBlockCMPR(IInputStream& src, IOutputStream& dst, u16 Width)
|
||||
{
|
||||
CColor Palettes[4];
|
||||
u16 PaletteA = src.ReadShort();
|
||||
@@ -713,7 +713,7 @@ void CTextureDecoder::DecodeSubBlockCMPR(CInputStream& src, COutputStream& dst,
|
||||
}
|
||||
}
|
||||
|
||||
void CTextureDecoder::DecodeBlockBC1(CInputStream& src, COutputStream& dst, u32 Width)
|
||||
void CTextureDecoder::DecodeBlockBC1(IInputStream& src, IOutputStream& dst, u32 Width)
|
||||
{
|
||||
// Very similar to the CMPR subblock function, but unfortunately a slight
|
||||
// difference in the order the pixel indices are read requires a separate function
|
||||
@@ -750,7 +750,7 @@ void CTextureDecoder::DecodeBlockBC1(CInputStream& src, COutputStream& dst, u32
|
||||
}
|
||||
}
|
||||
|
||||
void CTextureDecoder::DecodeBlockBC2(CInputStream& src, COutputStream& dst, u32 Width)
|
||||
void CTextureDecoder::DecodeBlockBC2(IInputStream& src, IOutputStream& dst, u32 Width)
|
||||
{
|
||||
CColor CPalettes[4];
|
||||
u16 PaletteA = src.ReadShort();
|
||||
@@ -785,7 +785,7 @@ void CTextureDecoder::DecodeBlockBC2(CInputStream& src, COutputStream& dst, u32
|
||||
}
|
||||
}
|
||||
|
||||
void CTextureDecoder::DecodeBlockBC3(CInputStream& src, COutputStream& dst, u32 Width)
|
||||
void CTextureDecoder::DecodeBlockBC3(IInputStream& src, IOutputStream& dst, u32 Width)
|
||||
{
|
||||
CColor Palettes[4];
|
||||
u16 PaletteA = src.ReadShort();
|
||||
@@ -820,7 +820,7 @@ void CTextureDecoder::DecodeBlockBC3(CInputStream& src, COutputStream& dst, u32
|
||||
}
|
||||
}
|
||||
|
||||
CColor CTextureDecoder::DecodeDDSPixel(CInputStream& /*DDS*/)
|
||||
CColor CTextureDecoder::DecodeDDSPixel(IInputStream& /*DDS*/)
|
||||
{
|
||||
return CColor::skWhite;
|
||||
}
|
||||
|
||||
@@ -38,48 +38,48 @@ class CTextureDecoder
|
||||
CTexture* CreateTexture();
|
||||
|
||||
// Read
|
||||
void ReadTXTR(CInputStream& TXTR);
|
||||
void ReadDDS(CInputStream& DDS);
|
||||
void ReadTXTR(IInputStream& TXTR);
|
||||
void ReadDDS(IInputStream& DDS);
|
||||
|
||||
// Decode
|
||||
void PartialDecodeGXTexture(CInputStream& TXTR);
|
||||
void FullDecodeGXTexture(CInputStream& TXTR);
|
||||
void DecodeDDS(CInputStream& DDS);
|
||||
void PartialDecodeGXTexture(IInputStream& TXTR);
|
||||
void FullDecodeGXTexture(IInputStream& TXTR);
|
||||
void DecodeDDS(IInputStream& DDS);
|
||||
|
||||
// Decode Pixels (preserve compression)
|
||||
void ReadPixelsI4(CInputStream& src, COutputStream& dst);
|
||||
void ReadPixelI8(CInputStream& src, COutputStream& dst);
|
||||
void ReadPixelIA4(CInputStream& src, COutputStream& dst);
|
||||
void ReadPixelIA8(CInputStream& src, COutputStream& dst);
|
||||
void ReadPixelsC4(CInputStream& src, COutputStream& dst);
|
||||
void ReadPixelC8(CInputStream& src, COutputStream& dst);
|
||||
void ReadPixelRGB565(CInputStream& src, COutputStream& dst);
|
||||
void ReadPixelRGB5A3(CInputStream& src, COutputStream& dst);
|
||||
void ReadPixelRGBA8(CInputStream& src, COutputStream& dst);
|
||||
void ReadSubBlockCMPR(CInputStream& src, COutputStream& dst);
|
||||
void ReadPixelsI4(IInputStream& src, IOutputStream& dst);
|
||||
void ReadPixelI8(IInputStream& src, IOutputStream& dst);
|
||||
void ReadPixelIA4(IInputStream& src, IOutputStream& dst);
|
||||
void ReadPixelIA8(IInputStream& src, IOutputStream& dst);
|
||||
void ReadPixelsC4(IInputStream& src, IOutputStream& dst);
|
||||
void ReadPixelC8(IInputStream& src, IOutputStream& dst);
|
||||
void ReadPixelRGB565(IInputStream& src, IOutputStream& dst);
|
||||
void ReadPixelRGB5A3(IInputStream& src, IOutputStream& dst);
|
||||
void ReadPixelRGBA8(IInputStream& src, IOutputStream& dst);
|
||||
void ReadSubBlockCMPR(IInputStream& src, IOutputStream& dst);
|
||||
|
||||
// Decode Pixels (convert to RGBA8)
|
||||
CColor DecodePixelI4(u8 Byte, u8 WhichPixel);
|
||||
CColor DecodePixelI8(u8 Byte);
|
||||
CColor DecodePixelIA4(u8 Byte);
|
||||
CColor DecodePixelIA8(u16 Short);
|
||||
CColor DecodePixelC4(u8 Byte, u8 WhichPixel, CInputStream& PaletteStream);
|
||||
CColor DecodePixelC8(u8 Byte, CInputStream& PaletteStream);
|
||||
CColor DecodePixelC4(u8 Byte, u8 WhichPixel, IInputStream& PaletteStream);
|
||||
CColor DecodePixelC8(u8 Byte, IInputStream& PaletteStream);
|
||||
CColor DecodePixelRGB565(u16 Short);
|
||||
CColor DecodePixelRGB5A3(u16 Short);
|
||||
CColor DecodePixelRGBA8(CInputStream& src, COutputStream& dst);
|
||||
void DecodeSubBlockCMPR(CInputStream& src, COutputStream& dst, u16 Width);
|
||||
CColor DecodePixelRGBA8(IInputStream& src, IOutputStream& dst);
|
||||
void DecodeSubBlockCMPR(IInputStream& src, IOutputStream& dst, u16 Width);
|
||||
|
||||
void DecodeBlockBC1(CInputStream& src, COutputStream& dst, u32 Width);
|
||||
void DecodeBlockBC2(CInputStream& src, COutputStream& dst, u32 Width);
|
||||
void DecodeBlockBC3(CInputStream& src, COutputStream& dst, u32 Width);
|
||||
CColor DecodeDDSPixel(CInputStream& DDS);
|
||||
void DecodeBlockBC1(IInputStream& src, IOutputStream& dst, u32 Width);
|
||||
void DecodeBlockBC2(IInputStream& src, IOutputStream& dst, u32 Width);
|
||||
void DecodeBlockBC3(IInputStream& src, IOutputStream& dst, u32 Width);
|
||||
CColor DecodeDDSPixel(IInputStream& DDS);
|
||||
|
||||
// Static
|
||||
public:
|
||||
static CTexture* LoadTXTR(CInputStream& TXTR);
|
||||
static CTexture* LoadDDS(CInputStream& DDS);
|
||||
static CTexture* DoFullDecode(CInputStream& TXTR);
|
||||
static CTexture* LoadTXTR(IInputStream& TXTR);
|
||||
static CTexture* LoadDDS(IInputStream& DDS);
|
||||
static CTexture* DoFullDecode(IInputStream& TXTR);
|
||||
static CTexture* DoFullDecode(CTexture *pTexture);
|
||||
|
||||
// Utility
|
||||
|
||||
@@ -7,7 +7,7 @@ CWorldLoader::CWorldLoader()
|
||||
{
|
||||
}
|
||||
|
||||
void CWorldLoader::LoadPrimeMLVL(CInputStream& MLVL)
|
||||
void CWorldLoader::LoadPrimeMLVL(IInputStream& MLVL)
|
||||
{
|
||||
/**
|
||||
* This function loads MLVL files from Prime 1/2
|
||||
@@ -218,7 +218,7 @@ void CWorldLoader::LoadPrimeMLVL(CInputStream& MLVL)
|
||||
// todo: Layer ID support for MP3
|
||||
}
|
||||
|
||||
void CWorldLoader::LoadReturnsMLVL(CInputStream& MLVL)
|
||||
void CWorldLoader::LoadReturnsMLVL(IInputStream& MLVL)
|
||||
{
|
||||
mpWorld->mpWorldName = gResCache.GetResource(MLVL.ReadLongLong(), "STRG");
|
||||
|
||||
@@ -280,7 +280,7 @@ void CWorldLoader::LoadReturnsMLVL(CInputStream& MLVL)
|
||||
// todo: Layer ID support
|
||||
}
|
||||
|
||||
CWorld* CWorldLoader::LoadMLVL(CInputStream& MLVL)
|
||||
CWorld* CWorldLoader::LoadMLVL(IInputStream& MLVL)
|
||||
{
|
||||
if (!MLVL.IsValid()) return nullptr;
|
||||
Log::Write("Loading " + MLVL.GetSourceString());
|
||||
|
||||
@@ -13,11 +13,11 @@ class CWorldLoader
|
||||
EGame mVersion;
|
||||
|
||||
CWorldLoader();
|
||||
void LoadPrimeMLVL(CInputStream& MLVL);
|
||||
void LoadReturnsMLVL(CInputStream& MLVL);
|
||||
void LoadPrimeMLVL(IInputStream& MLVL);
|
||||
void LoadReturnsMLVL(IInputStream& MLVL);
|
||||
|
||||
public:
|
||||
static CWorld* LoadMLVL(CInputStream& MLVL);
|
||||
static CWorld* LoadMLVL(IInputStream& MLVL);
|
||||
static EGame GetFormatVersion(u32 Version);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user