Moved EGame to Common

This commit is contained in:
parax0 2016-08-13 01:43:55 -06:00
parent de18044ae0
commit 74574c318e
45 changed files with 57 additions and 57 deletions

View File

@ -80,7 +80,8 @@ HEADERS += \
CAssetID.h \
Serialization/IArchive.h \
Serialization/CXMLWriter.h \
Serialization/CXMLReader.h
Serialization/CXMLReader.h \
EGame.h
# Source Files
SOURCES += \

View File

@ -1,7 +1,6 @@
#ifndef EGAME_H
#define EGAME_H
// Global version enum that can be easily shared between loaders
enum EGame
{
ePrimeDemo,
@ -11,7 +10,7 @@ enum EGame
eCorruptionProto,
eCorruption,
eReturns,
eUnknownVersion = -1
eUnknownGame = -1
};
#endif // EGAME_H

View File

@ -80,7 +80,7 @@ void CGameExporter::CopyDiscData()
continue;
// Hack to determine game
if (Game() == eUnknownVersion)
if (Game() == eUnknownGame)
{
TWideString Name = FullPath.GetFileName(false);
if (Name == L"MetroidCWP") SetGame(ePrimeDemo);
@ -107,7 +107,7 @@ void CGameExporter::CopyDiscData()
#endif
}
ASSERT(Game() != eUnknownVersion);
ASSERT(Game() != eUnknownGame);
mpProject->SetGame(Game());
mpProject->SetProjectName(CMasterTemplate::FindGameName(Game()));
}

View File

@ -3,9 +3,9 @@
#include "CPackage.h"
#include "CResourceStore.h"
#include "Core/Resource/EGame.h"
#include <Common/FileUtil.h>
#include <Common/CAssetID.h>
#include <Common/EGame.h>
#include <Common/FileUtil.h>
#include <Common/TString.h>
#include <Common/types.h>
@ -29,12 +29,12 @@ class CGameProject
public:
CGameProject()
: mGame(eUnknownVersion)
: mGame(eUnknownGame)
, mProjectName("Unnamed Project")
{}
CGameProject(const TWideString& rkProjRootDir)
: mGame(eUnknownVersion)
: mGame(eUnknownGame)
, mProjectName("Unnamed Project")
, mProjectRoot(rkProjRootDir)
, mResourceDBPath(L"ResourceDB.rdb")

View File

@ -25,7 +25,7 @@ CResourceEntry::CResourceEntry(CResourceStore *pStore, const CAssetID& rkID,
mpDirectory = mpStore->GetVirtualDirectory(rkDir, Transient, true);
if (mpDirectory) mpDirectory->AddChild(L"", this);
mGame = ((Transient || !mpStore->ActiveProject()) ? eUnknownVersion : mpStore->ActiveProject()->Game());
mGame = ((Transient || !mpStore->ActiveProject()) ? eUnknownGame : mpStore->ActiveProject()->Game());
}
CResourceEntry::~CResourceEntry()

View File

@ -3,9 +3,9 @@
#include "CAnimSet.h"
#include "CResourceInfo.h"
#include "EGame.h"
#include "TResPtr.h"
#include "Core/Resource/Model/CModel.h"
#include <Common/EGame.h>
class CAnimationParameters
{

View File

@ -17,7 +17,7 @@ CMaterial::CMaterial()
, mShaderStatus(eNoShader)
, mRecalcHash(true)
, mEnableBloom(false)
, mVersion(eUnknownVersion)
, mVersion(eUnknownGame)
, mOptions(eNoSettings)
, mVtxDesc(eNoAttributes)
, mBlendSrcFac(GL_ONE)

View File

@ -3,13 +3,13 @@
#include "CMaterialPass.h"
#include "CTexture.h"
#include "EGame.h"
#include "TResPtr.h"
#include "Core/Resource/Model/EVertexAttribute.h"
#include "Core/Render/FRenderOptions.h"
#include "Core/OpenGL/CShader.h"
#include <Common/CColor.h>
#include <Common/EGame.h>
#include <Common/Flags.h>
#include <Common/types.h>
#include <FileIO/IInputStream.h>

View File

@ -3,8 +3,8 @@
#include "CMaterial.h"
#include "CTexture.h"
#include "EGame.h"
#include <FileIO/IInputStream.h>
#include <Common/EGame.h>
class CMaterialSet
{

View File

@ -124,7 +124,7 @@ TString GetResourceRawExtension(EResType Type, EGame /*Game*/)
TString GetResourceCookedExtension(EResType Type, EGame Game)
{
if (Game == eUnknownVersion)
if (Game == eUnknownGame)
Game = ePrime;
u32 GameTypeID = GetGameTypeID(Game, Type);
@ -151,7 +151,7 @@ TString GetResourceCookedExtension(EResType Type, EGame Game)
public: \
CResourceTypeRegistrant__##CookedExtension() \
{ \
ASSERT(FirstGame != eUnknownVersion); \
ASSERT(FirstGame != eUnknownGame); \
\
/* Register extension with resource type (should be consistent across all games) */ \
u32 IntExt = CFourCC(#CookedExtension).ToLong(); \

View File

@ -48,7 +48,7 @@ public:
inline TString Source() const { return mpEntry ? mpEntry->CookedAssetPath(true).GetFileName() : ""; }
inline TString FullSource() const { return mpEntry ? mpEntry->CookedAssetPath(true) : ""; }
inline CAssetID ID() const { return mpEntry ? mpEntry->ID() : CAssetID::skInvalidID64; }
inline EGame Game() const { return mpEntry ? mpEntry->Game() : eUnknownVersion; }
inline EGame Game() const { return mpEntry ? mpEntry->Game() : eUnknownGame; }
inline bool IsReferenced() const { return mRefCount > 0; }
inline void SetGame(EGame Game) { if (mpEntry) mpEntry->SetGame(Game); }
inline void Lock() { mRefCount++; }

View File

@ -3,8 +3,8 @@
#include "CResource.h"
#include "CStringTable.h"
#include "EGame.h"
#include "TResPtr.h"
#include <Common/EGame.h>
class CScan : public CResource
{

View File

@ -4,7 +4,7 @@
CWorld::CWorld(CResourceEntry *pEntry /*= 0*/)
: CResource(pEntry)
, mWorldVersion(eUnknownVersion)
, mWorldVersion(eUnknownGame)
, mpWorldName(nullptr)
, mpDarkWorldName(nullptr)
, mpSaveWorld(nullptr)

View File

@ -3,8 +3,8 @@
#include "CSectionMgrOut.h"
#include "Core/Resource/Area/CGameArea.h"
#include "Core/Resource/EGame.h"
#include <FileIO/FileIO.h>
#include <Common/EGame.h>
class CAreaCooker
{

View File

@ -3,7 +3,7 @@
#include "Core/Resource/CMaterial.h"
#include "Core/Resource/CMaterialSet.h"
#include "Core/Resource/EGame.h"
#include <Common/EGame.h>
class CMaterialCooker
{

View File

@ -2,8 +2,8 @@
#define CMODELCOOKER_H
#include "Core/Resource/Model/CModel.h"
#include "Core/Resource/EGame.h"
#include <FileIO/FileIO.h>
#include <Common/EGame.h>
class CModelCooker
{

View File

@ -1,10 +1,10 @@
#ifndef CSCRIPTCOOKER_H
#define CSCRIPTCOOKER_H
#include "Core/Resource/EGame.h"
#include "Core/Resource/Script/CScriptLayer.h"
#include "Core/Resource/Script/CScriptObject.h"
#include <FileIO/FileIO.h>
#include <Common/EGame.h>
class CScriptCooker
{

View File

@ -2,7 +2,7 @@
#define CWORLDCOOKER_H
#include "Core/Resource/CWorld.h"
#include "Core/Resource/EGame.h"
#include <Common/EGame.h>
#include <Common/types.h>
class CWorldCooker

View File

@ -1,7 +1,7 @@
#ifndef ERESTYPE
#define ERESTYPE
#include "EGame.h"
#include <Common/EGame.h>
#include <Common/TString.h>
enum EResType

View File

@ -232,7 +232,7 @@ CAnimSet* CAnimSetLoader::LoadANCS(IInputStream& rANCS, CResourceEntry *pEntry)
rANCS.Seek(0x4, SEEK_CUR); // Skipping node self-index
u16 Unknown1 = rANCS.ReadShort();
if (iNode == 0 && Loader.mVersion == eUnknownVersion)
if (iNode == 0 && Loader.mVersion == eUnknownGame)
{
Loader.mVersion = (Unknown1 == 0xA) ? eEchoes : ePrime; // Best version indicator we know of unfortunately
Loader.pSet->SetGame(Loader.mVersion);

View File

@ -2,7 +2,7 @@
#define CCHARACTERLOADER_H
#include "Core/Resource/CAnimSet.h"
#include "Core/Resource/EGame.h"
#include <Common/EGame.h>
class CAnimSetLoader
{

View File

@ -75,7 +75,7 @@ void CAnimationLoader::ReadUncompressedANIM()
NumBoneChannels++;
}
if (mGame == eUnknownVersion)
if (mGame == eUnknownGame)
{
mGame = UncompressedCheckVersion();
mpAnim->SetGame(mGame);
@ -211,7 +211,7 @@ void CAnimationLoader::ReadCompressedANIM()
// Header
mpInput->Seek(0x4, SEEK_CUR); // Skip alloc size
if (mGame == eUnknownVersion)
if (mGame == eUnknownGame)
{
mGame = (mpInput->PeekShort() == 0x0101 ? eEchoes : ePrime);
mpAnim->SetGame(mGame);

View File

@ -3,7 +3,7 @@
#include "Core/Resource/TResPtr.h"
#include "Core/Resource/CAnimation.h"
#include "Core/Resource/EGame.h"
#include <Common/EGame.h>
class CAnimationLoader
{

View File

@ -749,6 +749,6 @@ EGame CAreaLoader::GetFormatVersion(u32 Version)
case 0x1D: return eCorruptionProto;
case 0x1E: return eCorruption;
case 0x20: return eReturns;
default: return eUnknownVersion;
default: return eUnknownGame;
}
}

View File

@ -5,7 +5,7 @@
#include "Core/GameProject/CResourceStore.h"
#include "Core/Resource/Area/CGameArea.h"
#include "Core/Resource/Script/CLink.h"
#include "Core/Resource/EGame.h"
#include <Common/EGame.h>
#include <FileIO/FileIO.h>

View File

@ -207,6 +207,6 @@ EGame CCollisionLoader::GetFormatVersion(u32 Version)
case 0x3: return ePrime;
case 0x4: return eEchoes;
case 0x5: return eReturns;
default: return eUnknownVersion;
default: return eUnknownGame;
}
}

View File

@ -3,7 +3,7 @@
#include "Core/Resource/CCollisionMesh.h"
#include "Core/Resource/CCollisionMeshGroup.h"
#include "Core/Resource/EGame.h"
#include <Common/EGame.h>
class CCollisionLoader
{

View File

@ -2,7 +2,7 @@
#define CDEPENDENCYGROUPLOADER_H
#include "Core/Resource/CDependencyGroup.h"
#include "Core/Resource/EGame.h"
#include <Common/EGame.h>
class CDependencyGroupLoader
{

View File

@ -92,7 +92,7 @@ CFont* CFontLoader::LoadFONT(IInputStream& rFONT, CResourceEntry *pEntry)
u32 FileVersion = rFONT.ReadLong();
EGame Version = GetFormatVersion(FileVersion);
if (Version == eUnknownVersion)
if (Version == eUnknownGame)
{
Log::FileError(rFONT.GetSourceString(), "Unsupported FONT version: " + TString::HexString(FileVersion, 0));
return nullptr;
@ -113,6 +113,6 @@ EGame CFontLoader::GetFormatVersion(u32 Version)
case 2: return ePrime;
case 4: return eEchoes;
case 5: return eCorruption;
default: return eUnknownVersion;
default: return eUnknownGame;
}
}

View File

@ -3,7 +3,7 @@
#include "Core/GameProject/CResourceStore.h"
#include "Core/Resource/CFont.h"
#include "Core/Resource/EGame.h"
#include <Common/EGame.h>
class CFontLoader
{

View File

@ -3,7 +3,7 @@
#include "Core/GameProject/CResourceStore.h"
#include "Core/Resource/CMaterialSet.h"
#include "Core/Resource/EGame.h"
#include <Common/EGame.h>
#include <FileIO/FileIO.h>
#include <assimp/scene.h>

View File

@ -446,7 +446,7 @@ CModel* CModelLoader::LoadCMDL(IInputStream& rCMDL, CResourceEntry *pEntry)
// The rest is common to all CMDL versions
Loader.mVersion = GetFormatVersion(Version);
if (Loader.mVersion == eUnknownVersion)
if (Loader.mVersion == eUnknownGame)
{
Log::FileError(rCMDL.GetSourceString(), "Unsupported CMDL version: " + TString::HexString(Magic, 0));
return nullptr;
@ -644,6 +644,6 @@ EGame CModelLoader::GetFormatVersion(u32 Version)
case 0x4: return eEchoes;
case 0x5: return eCorruption;
case 0xA: return eReturns;
default: return eUnknownVersion;
default: return eUnknownGame;
}
}

View File

@ -5,7 +5,7 @@
#include "Core/GameProject/CResourceStore.h"
#include "Core/Resource/Model/CBasicModel.h"
#include "Core/Resource/Model/CModel.h"
#include "Core/Resource/EGame.h"
#include <Common/EGame.h>
#include <Common/Flags.h>
#include <FileIO/FileIO.h>

View File

@ -2,7 +2,7 @@
#define CSCANLOADER_H
#include "Core/Resource/CScan.h"
#include "Core/Resource/EGame.h"
#include <Common/EGame.h>
class CScanLoader
{

View File

@ -56,7 +56,7 @@ CSkeleton* CSkeletonLoader::LoadCINF(IInputStream& rCINF, CResourceEntry *pEntry
// rotation value in MP2. The max bone count is 100 so the linked bone count will not be higher
// than that. Additionally, every bone links to its parent at least and every skeleton (as far as I
// know) has at least two bones so the linked bone count will never be 0.
if (Game == eUnknownVersion)
if (Game == eUnknownGame)
{
u32 Check = rCINF.PeekLong();
Game = ((Check > 100 || Check == 0) ? eEchoes : ePrime);

View File

@ -2,8 +2,8 @@
#define CSKELETONLOADER_H
#include "Core/Resource/CSkeleton.h"
#include "Core/Resource/EGame.h"
#include "Core/Resource/TResPtr.h"
#include <Common/EGame.h>
class CSkeletonLoader
{

View File

@ -160,7 +160,7 @@ CStringTable* CStringLoader::LoadSTRG(IInputStream& rSTRG, CResourceEntry *pEntr
if (!rSTRG.IsValid()) return nullptr;
u32 Magic = rSTRG.ReadLong();
EGame Version = eUnknownVersion;
EGame Version = eUnknownGame;
if (Magic != 0x87654321)
{
@ -185,7 +185,7 @@ CStringTable* CStringLoader::LoadSTRG(IInputStream& rSTRG, CResourceEntry *pEntr
u32 FileVersion = rSTRG.ReadLong();
Version = GetFormatVersion(FileVersion);
if (FileVersion == eUnknownVersion)
if (FileVersion == eUnknownGame)
{
Log::FileError(rSTRG.GetSourceString(), "Unsupported STRG version: " + TString::HexString(FileVersion, 0));
return nullptr;
@ -212,6 +212,6 @@ EGame CStringLoader::GetFormatVersion(u32 Version)
case 0x0: return ePrime;
case 0x1: return eEchoes;
case 0x3: return eCorruption;
default: return eUnknownVersion;
default: return eUnknownGame;
}
}

View File

@ -3,8 +3,8 @@
#include "Core/GameProject/CResourceStore.h"
#include "Core/Resource/CStringTable.h"
#include "Core/Resource/EGame.h"
#include "Core/Resource/TResPtr.h"
#include <Common/EGame.h>
class CStringLoader
{

View File

@ -293,7 +293,7 @@ CWorld* CWorldLoader::LoadMLVL(IInputStream& rMLVL, CResourceEntry *pEntry)
u32 FileVersion = rMLVL.ReadLong();
EGame Version = GetFormatVersion(FileVersion);
if (Version == eUnknownVersion)
if (Version == eUnknownGame)
{
Log::FileError(rMLVL.GetSourceString(), "Unsupported MLVL version: " + TString::HexString(FileVersion, 2));
return nullptr;
@ -324,6 +324,6 @@ EGame CWorldLoader::GetFormatVersion(u32 Version)
case 0x17: return eEchoes;
case 0x19: return eCorruption;
case 0x1B: return eReturns;
default: return eUnknownVersion;
default: return eUnknownGame;
}
}

View File

@ -3,7 +3,7 @@
#include "Core/GameProject/CResourceStore.h"
#include "Core/Resource/CWorld.h"
#include "Core/Resource/EGame.h"
#include <Common/EGame.h>
#include <FileIO/FileIO.h>

View File

@ -136,7 +136,7 @@ EGame CMasterTemplate::FindGameForName(const TString& rkName)
return pMaster->Game();
}
return eUnknownVersion;
return eUnknownGame;
}
TString CMasterTemplate::PropertyName(u32 PropertyID)

View File

@ -3,7 +3,7 @@
#include "CLink.h"
#include "CScriptTemplate.h"
#include "Core/Resource/EGame.h"
#include <Common/EGame.h>
#include <Common/types.h>
#include <map>

View File

@ -5,7 +5,7 @@
// ************ IPropertyTemplate ************
EGame IPropertyTemplate::Game() const
{
return (mpMasterTemplate ? mpMasterTemplate->Game() : eUnknownVersion);
return (mpMasterTemplate ? mpMasterTemplate->Game() : eUnknownGame);
}
bool IPropertyTemplate::IsInVersion(u32 Version) const

View File

@ -1,9 +1,9 @@
#ifndef CPAKTOOLDIALOG
#define CPAKTOOLDIALOG
#include <Common/EGame.h>
#include <Common/Log.h>
#include <Common/types.h>
#include <Core/Resource/EGame.h>
#include "Editor/UICommon.h"
#include <QDir>

View File

@ -59,7 +59,7 @@ public:
bool HasAnyScriptNodesSelected() const;
inline CGameArea* ActiveArea() const { return mpArea; }
inline EGame CurrentGame() const { return mpArea ? mpArea->Version() : eUnknownVersion; }
inline EGame CurrentGame() const { return mpArea ? mpArea->Version() : eUnknownGame; }
inline CLinkDialog* LinkDialog() const { return mpLinkDialog; }
CSceneViewport* Viewport() const;