Renamed CUniqueID to CAssetID and heavily modified the implementation to drop 128-bit support and use a u64 internally instead of a u8[16]
This commit is contained in:
parent
9341c11ac8
commit
5f1b5da430
|
@ -0,0 +1,93 @@
|
|||
#include "CAssetID.h"
|
||||
#include "TString.h"
|
||||
#include <random>
|
||||
|
||||
CAssetID::CAssetID()
|
||||
: mLength(eInvalidIDLength)
|
||||
, mID(0xFFFFFFFFFFFFFFFF)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CAssetID::CAssetID(u64 ID)
|
||||
: mID(ID)
|
||||
{
|
||||
// This constructor is intended to be used with both 32-bit and 64-bit input values
|
||||
// 64-bit - check for valid content in upper 32 bits (at least one bit set + one bit unset)
|
||||
if ((ID & 0xFFFFFFFF00000000) && (~ID & 0xFFFFFFFF00000000))
|
||||
mLength = e64Bit;
|
||||
|
||||
// 32-bit
|
||||
else
|
||||
{
|
||||
mLength = e32Bit;
|
||||
mID &= 0xFFFFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
CAssetID::CAssetID(u64 ID, EIDLength Length)
|
||||
: mID(ID)
|
||||
, mLength(Length)
|
||||
{
|
||||
if (Length == e32Bit)
|
||||
mID &= 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
CAssetID::CAssetID(const char* pkID)
|
||||
{
|
||||
*this = CAssetID::FromString(pkID);
|
||||
}
|
||||
|
||||
CAssetID::CAssetID(IInputStream& rInput, EIDLength Length)
|
||||
: mLength(Length)
|
||||
{
|
||||
if (Length == e32Bit) mID = (u64) rInput.ReadLong();
|
||||
else mID = rInput.ReadLongLong();
|
||||
}
|
||||
|
||||
TString CAssetID::ToString() const
|
||||
{
|
||||
if (mLength == e32Bit)
|
||||
return TString::FromInt32(ToLong(), 8, 16);
|
||||
else
|
||||
return TString::FromInt64(ToLongLong(), 8, 16);
|
||||
}
|
||||
|
||||
bool CAssetID::IsValid() const
|
||||
{
|
||||
if (mLength == e32Bit)
|
||||
return (*this != skInvalidID32);
|
||||
|
||||
else if (mLength == e64Bit)
|
||||
return (*this != skInvalidID64);
|
||||
|
||||
else return false;
|
||||
}
|
||||
|
||||
// ************ STATIC ************
|
||||
CAssetID CAssetID::FromString(const TString& rkString)
|
||||
{
|
||||
// If the input is a hex ID in string form, then preserve it... otherwise, generate an ID by hashing the string
|
||||
TString Name = rkString.GetFileName(false);
|
||||
u32 NameLength = Name.Length();
|
||||
|
||||
if (Name.IsHexString())
|
||||
{
|
||||
if (NameLength == 8) return CAssetID(Name.ToInt32());
|
||||
if (NameLength == 16) return CAssetID(Name.ToInt64());
|
||||
}
|
||||
|
||||
return CAssetID(rkString.Hash64());
|
||||
}
|
||||
|
||||
CAssetID CAssetID::RandomID()
|
||||
{
|
||||
CAssetID ID;
|
||||
ID.mLength = e64Bit;
|
||||
ID.mID = (u64(rand()) << 32) | rand();
|
||||
return ID;
|
||||
}
|
||||
|
||||
// ************ STATIC MEMBER INITIALIZATION ************
|
||||
CAssetID CAssetID::skInvalidID32 = CAssetID((u64) -1, e32Bit);
|
||||
CAssetID CAssetID::skInvalidID64 = CAssetID((u64) -1, e64Bit);
|
|
@ -0,0 +1,55 @@
|
|||
#ifndef CASSETID_H
|
||||
#define CASSETID_H
|
||||
|
||||
#include "TString.h"
|
||||
#include "types.h"
|
||||
#include <FileIO/FileIO.h>
|
||||
|
||||
enum EIDLength
|
||||
{
|
||||
e32Bit = 4,
|
||||
e64Bit = 8,
|
||||
eInvalidIDLength = 0
|
||||
};
|
||||
|
||||
class CAssetID
|
||||
{
|
||||
EIDLength mLength;
|
||||
u64 mID;
|
||||
|
||||
public:
|
||||
CAssetID();
|
||||
CAssetID(u64 ID);
|
||||
CAssetID(u64 ID, EIDLength Length);
|
||||
CAssetID(const char* pkID);
|
||||
CAssetID(IInputStream& rInput, EIDLength Length);
|
||||
TString ToString() const;
|
||||
bool IsValid() const;
|
||||
\
|
||||
// Operators
|
||||
inline void operator=(const u64& rkInput) { *this = CAssetID(rkInput); }
|
||||
inline void operator=(const char *pkInput) { *this = CAssetID(pkInput); }
|
||||
inline bool operator==(const CAssetID& rkOther) const { return mLength == rkOther.mLength && mID == rkOther.mID; }
|
||||
inline bool operator!=(const CAssetID& rkOther) const { return mLength != rkOther.mLength || mID != rkOther.mID; }
|
||||
inline bool operator>(const CAssetID& rkOther) const { return mID > rkOther.mID; }
|
||||
inline bool operator>=(const CAssetID& rkOther) const { return mID >= rkOther.mID; }
|
||||
inline bool operator<(const CAssetID& rkOther) const { return mID < rkOther.mID; }
|
||||
inline bool operator<=(const CAssetID& rkOther) const { return mID <= rkOther.mID; }
|
||||
inline bool operator==(u64 Other) const { return mID == Other; }
|
||||
inline bool operator!=(u64 Other) const { return mID != Other; }
|
||||
|
||||
// Accessors
|
||||
inline u32 ToLong() const { return (u32) mID; }
|
||||
inline u64 ToLongLong() const { return mID; }
|
||||
inline EIDLength Length() const { return mLength; }
|
||||
inline void SetLength(EIDLength Length) { mLength = Length; }
|
||||
|
||||
// Static
|
||||
static CAssetID FromString(const TString& rkString);
|
||||
static CAssetID RandomID();
|
||||
|
||||
static CAssetID skInvalidID32;
|
||||
static CAssetID skInvalidID64;
|
||||
};
|
||||
|
||||
#endif // CASSETID_H
|
|
@ -1,324 +0,0 @@
|
|||
#include "CUniqueID.h"
|
||||
#include "TString.h"
|
||||
|
||||
#include <iomanip>
|
||||
#include <random>
|
||||
#include <sstream>
|
||||
|
||||
// this class probably isn't optimized! this may not be the best way to do things
|
||||
using IOUtil::kSystemEndianness;
|
||||
using IOUtil::eLittleEndian;
|
||||
using IOUtil::eBigEndian;
|
||||
|
||||
CUniqueID::CUniqueID()
|
||||
: mLength(eInvalidUIDLength)
|
||||
{
|
||||
memset(mID, 0, 16);
|
||||
}
|
||||
|
||||
CUniqueID::CUniqueID(u64 ID)
|
||||
{
|
||||
// This constructor is intended to be used with both 32-bit and 64-bit input values
|
||||
memset(mID, 0, 16);
|
||||
|
||||
// 64-bit - check for valid content in upper 32 bits (at least one bit set + one bit unset)
|
||||
if ((ID & 0xFFFFFFFF00000000) && (~ID & 0xFFFFFFFF00000000))
|
||||
{
|
||||
memcpy(&mID, &ID, 8);
|
||||
mLength = e64Bit;
|
||||
}
|
||||
|
||||
// 32-bit
|
||||
else
|
||||
{
|
||||
memcpy(mID, &ID, 4);
|
||||
mLength = e32Bit;
|
||||
}
|
||||
|
||||
// Reverse for Big Endian
|
||||
if (kSystemEndianness == eBigEndian)
|
||||
Reverse();
|
||||
}
|
||||
|
||||
CUniqueID::CUniqueID(u64 ID, EUIDLength Length)
|
||||
{
|
||||
// This constructor shouldn't be used for 128-bit
|
||||
memset(mID, 0, 16);
|
||||
|
||||
// 64-bit
|
||||
if (Length == e64Bit || Length == e128Bit)
|
||||
{
|
||||
memcpy(&mID, &ID, 8);
|
||||
mLength = e64Bit;
|
||||
}
|
||||
|
||||
// 32-bit
|
||||
else
|
||||
{
|
||||
memcpy(mID, &ID, 4);
|
||||
mLength = e32Bit;
|
||||
}
|
||||
|
||||
// Reverse for Big Endian
|
||||
if (kSystemEndianness == eBigEndian)
|
||||
Reverse();
|
||||
}
|
||||
|
||||
CUniqueID::CUniqueID(u64 Part1, u64 Part2)
|
||||
{
|
||||
// Constructor for 128-bit IDs
|
||||
memcpy(&mID[0], &Part1, 8);
|
||||
memcpy(&mID[8], &Part2, 8);
|
||||
mLength = e128Bit;
|
||||
}
|
||||
|
||||
CUniqueID::CUniqueID(const char* pkID)
|
||||
{
|
||||
*this = CUniqueID::FromString(pkID);
|
||||
}
|
||||
|
||||
CUniqueID::CUniqueID(IInputStream& rInput, EUIDLength Length)
|
||||
{
|
||||
memset(mID, 0, 16);
|
||||
rInput.ReadBytes(&mID[16 - Length], Length);
|
||||
|
||||
if (Length != e128Bit)
|
||||
if (kSystemEndianness == eLittleEndian)
|
||||
Reverse();
|
||||
|
||||
mLength = Length;
|
||||
}
|
||||
|
||||
u32 CUniqueID::ToLong() const
|
||||
{
|
||||
if (kSystemEndianness == eLittleEndian)
|
||||
return *((u32*) mID);
|
||||
else
|
||||
return *((u32*) &mID[12]);
|
||||
}
|
||||
|
||||
u64 CUniqueID::ToLongLong() const
|
||||
{
|
||||
if (kSystemEndianness == eLittleEndian)
|
||||
return *((u64*) mID);
|
||||
else
|
||||
return *((u64*) &mID[8]);
|
||||
}
|
||||
|
||||
TString CUniqueID::ToString() const
|
||||
{
|
||||
switch (mLength)
|
||||
{
|
||||
case e32Bit:
|
||||
return TString::FromInt32(ToLong(), 8);
|
||||
|
||||
case e64Bit:
|
||||
return TString::FromInt64(ToLongLong(), 16);
|
||||
|
||||
case e128Bit:
|
||||
// todo: TString should have a "FromInt128" function
|
||||
std::stringstream Ret;
|
||||
Ret << std::hex << std::setfill('0');
|
||||
|
||||
for (u32 iByte = 0; iByte < 16; iByte++)
|
||||
Ret << std::setw(2) << (u32) mID[iByte];
|
||||
|
||||
return Ret.str();
|
||||
}
|
||||
|
||||
return "INVALID ID LENGTH";
|
||||
}
|
||||
|
||||
void CUniqueID::Reverse()
|
||||
{
|
||||
std::reverse(mID, &mID[16]);
|
||||
}
|
||||
|
||||
EUIDLength CUniqueID::Length() const
|
||||
{
|
||||
return mLength;
|
||||
}
|
||||
|
||||
void CUniqueID::SetLength(EUIDLength Length)
|
||||
{
|
||||
mLength = Length;
|
||||
}
|
||||
|
||||
bool CUniqueID::IsValid() const
|
||||
{
|
||||
if (mLength == e32Bit)
|
||||
return (*this != skInvalidID32);
|
||||
|
||||
else if (mLength == e64Bit)
|
||||
return (*this != skInvalidID64);
|
||||
|
||||
else if (mLength == e128Bit)
|
||||
return (*this != skInvalidID128);
|
||||
|
||||
else return false;
|
||||
}
|
||||
|
||||
// ************ OPERATORS ************
|
||||
void CUniqueID::operator=(const u64& rkInput)
|
||||
{
|
||||
*this = CUniqueID(rkInput);
|
||||
}
|
||||
|
||||
void CUniqueID::operator=(const char* pkInput)
|
||||
{
|
||||
*this = CUniqueID(pkInput);
|
||||
}
|
||||
|
||||
bool CUniqueID::operator==(const CUniqueID& rkOther) const
|
||||
{
|
||||
return ((mLength == rkOther.mLength) &&
|
||||
(memcmp(mID, rkOther.mID, 16) == 0));
|
||||
}
|
||||
|
||||
bool CUniqueID::operator!=(const CUniqueID& rkOther) const
|
||||
{
|
||||
return (!(*this == rkOther));
|
||||
}
|
||||
|
||||
bool CUniqueID::operator>(const CUniqueID& rkOther) const
|
||||
{
|
||||
if (mLength != rkOther.mLength)
|
||||
return mLength > rkOther.mLength;
|
||||
|
||||
switch (mLength)
|
||||
{
|
||||
case e32Bit:
|
||||
return (ToLong() > rkOther.ToLong());
|
||||
|
||||
case e64Bit:
|
||||
return (ToLongLong() > rkOther.ToLongLong());
|
||||
|
||||
case e128Bit:
|
||||
for (u32 iByte = 0; iByte < 16; iByte++)
|
||||
if (mID[iByte] != rkOther.mID[iByte])
|
||||
return (mID[iByte] > rkOther.mID[iByte]);
|
||||
return false;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool CUniqueID::operator>=(const CUniqueID& rkOther) const
|
||||
{
|
||||
return ((*this == rkOther) || (*this > rkOther));
|
||||
}
|
||||
|
||||
bool CUniqueID::operator<(const CUniqueID& rkOther) const
|
||||
{
|
||||
if (mLength != rkOther.mLength)
|
||||
return mLength < rkOther.mLength;
|
||||
|
||||
switch (mLength)
|
||||
{
|
||||
case e32Bit:
|
||||
return (ToLong() < rkOther.ToLong());
|
||||
|
||||
case e64Bit:
|
||||
return (ToLongLong() < rkOther.ToLongLong());
|
||||
|
||||
case e128Bit:
|
||||
for (u32 iByte = 0; iByte < 16; iByte++)
|
||||
if (mID[iByte] != rkOther.mID[iByte])
|
||||
return (mID[iByte] < rkOther.mID[iByte]);
|
||||
return false;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool CUniqueID::operator<=(const CUniqueID& rkOther) const
|
||||
{
|
||||
return ((*this == rkOther) || (*this < rkOther));
|
||||
}
|
||||
|
||||
bool CUniqueID::operator==(u64 Other) const
|
||||
{
|
||||
return (*this == CUniqueID(Other));
|
||||
}
|
||||
|
||||
bool CUniqueID::operator!=(u64 Other) const
|
||||
{
|
||||
return (!(*this == Other));
|
||||
}
|
||||
|
||||
// ************ STATIC ************
|
||||
CUniqueID CUniqueID::FromString(const TString& rkString)
|
||||
{
|
||||
// If the input is a hex ID in string form, then preserve it... otherwise, generate an ID by hashing the string
|
||||
TString Name = rkString.GetFileName(false);
|
||||
u32 NameLength = Name.Length();
|
||||
|
||||
if (Name.IsHexString())
|
||||
{
|
||||
if (NameLength == 8)
|
||||
{
|
||||
CUniqueID ID;
|
||||
ID.mLength = e32Bit;
|
||||
|
||||
u32 LongID = Name.ToInt32();
|
||||
|
||||
if (kSystemEndianness == eLittleEndian)
|
||||
memcpy(ID.mID, &LongID, 4);
|
||||
else
|
||||
memcpy(&ID.mID[12], &LongID, 4);
|
||||
|
||||
return ID;
|
||||
}
|
||||
|
||||
else if (NameLength == 16)
|
||||
{
|
||||
CUniqueID ID;
|
||||
ID.mLength = e64Bit;
|
||||
|
||||
u64 LongID = Name.ToInt64();
|
||||
|
||||
if (kSystemEndianness == eLittleEndian)
|
||||
memcpy(ID.mID, &LongID, 8);
|
||||
else
|
||||
memcpy(&ID.mID[8], &LongID, 8);
|
||||
|
||||
return ID;
|
||||
}
|
||||
|
||||
else if (NameLength == 32)
|
||||
{
|
||||
CUniqueID ID;
|
||||
ID.mLength = e128Bit;
|
||||
Name.ToInt128((char*) ID.mID);
|
||||
return ID;
|
||||
}
|
||||
}
|
||||
|
||||
return CUniqueID(rkString.Hash64());
|
||||
}
|
||||
|
||||
CUniqueID CUniqueID::FromData(void *pData, EUIDLength Length)
|
||||
{
|
||||
CUniqueID ID;
|
||||
ID.mLength = Length;
|
||||
memcpy(ID.mID, pData, Length);
|
||||
return ID;
|
||||
}
|
||||
|
||||
CUniqueID CUniqueID::RandomID()
|
||||
{
|
||||
CUniqueID ID;
|
||||
ID.mLength = e128Bit;
|
||||
|
||||
for (u32 iByte = 0; iByte < 16; iByte++)
|
||||
ID.mID[iByte] = rand() & 0xFF;
|
||||
|
||||
return ID;
|
||||
}
|
||||
|
||||
// ************ STATIC MEMBER INITIALIZATION ************
|
||||
CUniqueID CUniqueID::skInvalidID32 = CUniqueID((u32) -1, e32Bit);
|
||||
CUniqueID CUniqueID::skInvalidID64 = CUniqueID((u64) -1, e64Bit);
|
||||
CUniqueID CUniqueID::skInvalidID128 = CUniqueID((u64) -1, (u64) -1);
|
|
@ -1,58 +0,0 @@
|
|||
#ifndef CUNIQUEID_H
|
||||
#define CUNIQUEID_H
|
||||
|
||||
#include "TString.h"
|
||||
#include "types.h"
|
||||
#include <FileIO/FileIO.h>
|
||||
|
||||
enum EUIDLength
|
||||
{
|
||||
e32Bit = 4,
|
||||
e64Bit = 8,
|
||||
e128Bit = 16,
|
||||
eInvalidUIDLength = 0
|
||||
};
|
||||
|
||||
class CUniqueID
|
||||
{
|
||||
EUIDLength mLength;
|
||||
u8 mID[16];
|
||||
|
||||
public:
|
||||
CUniqueID();
|
||||
CUniqueID(u64 ID);
|
||||
CUniqueID(u64 ID, EUIDLength Length);
|
||||
CUniqueID(u64 Part1, u64 Part2);
|
||||
CUniqueID(const char* pkID);
|
||||
CUniqueID(IInputStream& rInput, EUIDLength Length);
|
||||
u32 ToLong() const;
|
||||
u64 ToLongLong() const;
|
||||
TString ToString() const;
|
||||
void Reverse();
|
||||
EUIDLength Length() const;
|
||||
void SetLength(EUIDLength Length);
|
||||
bool IsValid() const;
|
||||
|
||||
// Operators
|
||||
void operator=(const u64& rkInput);
|
||||
void operator=(const char *pkInput);
|
||||
bool operator==(const CUniqueID& rkOther) const;
|
||||
bool operator!=(const CUniqueID& rkOther) const;
|
||||
bool operator>(const CUniqueID& rkOther) const;
|
||||
bool operator>=(const CUniqueID& rkOther) const;
|
||||
bool operator<(const CUniqueID& rkOther) const;
|
||||
bool operator<=(const CUniqueID& rkOther) const;
|
||||
bool operator==(u64 Other) const;
|
||||
bool operator!=(u64 Other) const;
|
||||
|
||||
// Static
|
||||
static CUniqueID FromString(const TString& rkString);
|
||||
static CUniqueID FromData(void *pkData, EUIDLength Length);
|
||||
static CUniqueID RandomID();
|
||||
|
||||
static CUniqueID skInvalidID32;
|
||||
static CUniqueID skInvalidID64;
|
||||
static CUniqueID skInvalidID128;
|
||||
};
|
||||
|
||||
#endif // CUNIQUEID_H
|
|
@ -64,7 +64,6 @@ HEADERS += \
|
|||
CHashFNV1A.h \
|
||||
CompressionUtil.h \
|
||||
CTimer.h \
|
||||
CUniqueID.h \
|
||||
EKeyInputs.h \
|
||||
EMouseInputs.h \
|
||||
ETransformSpace.h \
|
||||
|
@ -74,14 +73,15 @@ HEADERS += \
|
|||
Log.h \
|
||||
FileUtil.h \
|
||||
AssertMacro.h \
|
||||
CScopedTimer.h
|
||||
CScopedTimer.h \
|
||||
CAssetID.h
|
||||
|
||||
# Source Files
|
||||
SOURCES += \
|
||||
CColor.cpp \
|
||||
CompressionUtil.cpp \
|
||||
CTimer.cpp \
|
||||
CUniqueID.cpp \
|
||||
TString.cpp \
|
||||
Log.cpp \
|
||||
FileUtil.cpp
|
||||
FileUtil.cpp \
|
||||
CAssetID.cpp
|
||||
|
|
|
@ -8,12 +8,12 @@ EDependencyNodeType CResourceDependency::Type() const
|
|||
return eDNT_ResourceDependency;
|
||||
}
|
||||
|
||||
void CResourceDependency::Read(IInputStream& rFile, EUIDLength IDLength)
|
||||
void CResourceDependency::Read(IInputStream& rFile, EIDLength IDLength)
|
||||
{
|
||||
mID = CUniqueID(rFile, IDLength);
|
||||
mID = CAssetID(rFile, IDLength);
|
||||
}
|
||||
|
||||
void CResourceDependency::Write(IOutputStream& rFile, EUIDLength IDLength) const
|
||||
void CResourceDependency::Write(IOutputStream& rFile, EIDLength IDLength) const
|
||||
{
|
||||
if (IDLength == e32Bit)
|
||||
rFile.WriteLong(mID.ToLong());
|
||||
|
@ -27,13 +27,13 @@ EDependencyNodeType CAnimSetDependency::Type() const
|
|||
return eDNT_AnimSet;
|
||||
}
|
||||
|
||||
void CAnimSetDependency::Read(IInputStream& rFile, EUIDLength IDLength)
|
||||
void CAnimSetDependency::Read(IInputStream& rFile, EIDLength IDLength)
|
||||
{
|
||||
CResourceDependency::Read(rFile, IDLength);
|
||||
mUsedChar = rFile.ReadLong();
|
||||
}
|
||||
|
||||
void CAnimSetDependency::Write(IOutputStream& rFile, EUIDLength IDLength) const
|
||||
void CAnimSetDependency::Write(IOutputStream& rFile, EIDLength IDLength) const
|
||||
{
|
||||
CResourceDependency::Write(rFile, IDLength);
|
||||
rFile.WriteLong(mUsedChar);
|
||||
|
@ -65,9 +65,9 @@ EDependencyNodeType CDependencyTree::Type() const
|
|||
return eDNT_Root;
|
||||
}
|
||||
|
||||
void CDependencyTree::Read(IInputStream& rFile, EUIDLength IDLength)
|
||||
void CDependencyTree::Read(IInputStream& rFile, EIDLength IDLength)
|
||||
{
|
||||
mID = CUniqueID(rFile, IDLength);
|
||||
mID = CAssetID(rFile, IDLength);
|
||||
|
||||
u32 NumDepends = rFile.ReadLong();
|
||||
mReferencedResources.reserve(NumDepends);
|
||||
|
@ -80,7 +80,7 @@ void CDependencyTree::Read(IInputStream& rFile, EUIDLength IDLength)
|
|||
}
|
||||
}
|
||||
|
||||
void CDependencyTree::Write(IOutputStream& rFile, EUIDLength IDLength) const
|
||||
void CDependencyTree::Write(IOutputStream& rFile, EIDLength IDLength) const
|
||||
{
|
||||
if (IDLength == e32Bit)
|
||||
rFile.WriteLong(mID.ToLong());
|
||||
|
@ -98,7 +98,7 @@ u32 CDependencyTree::NumDependencies() const
|
|||
return mReferencedResources.size();
|
||||
}
|
||||
|
||||
bool CDependencyTree::HasDependency(const CUniqueID& rkID)
|
||||
bool CDependencyTree::HasDependency(const CAssetID& rkID)
|
||||
{
|
||||
for (u32 iDep = 0; iDep < mReferencedResources.size(); iDep++)
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ bool CDependencyTree::HasDependency(const CUniqueID& rkID)
|
|||
return false;
|
||||
}
|
||||
|
||||
CUniqueID CDependencyTree::DependencyByIndex(u32 Index) const
|
||||
CAssetID CDependencyTree::DependencyByIndex(u32 Index) const
|
||||
{
|
||||
ASSERT(Index >= 0 && Index < mReferencedResources.size());
|
||||
return mReferencedResources[Index]->ID();
|
||||
|
@ -117,12 +117,12 @@ CUniqueID CDependencyTree::DependencyByIndex(u32 Index) const
|
|||
|
||||
void CDependencyTree::AddDependency(CResource *pRes)
|
||||
{
|
||||
if (!pRes || HasDependency(pRes->ResID())) return;
|
||||
CResourceDependency *pDepend = new CResourceDependency(pRes->ResID());
|
||||
if (!pRes || HasDependency(pRes->ID())) return;
|
||||
CResourceDependency *pDepend = new CResourceDependency(pRes->ID());
|
||||
mReferencedResources.push_back(pDepend);
|
||||
}
|
||||
|
||||
void CDependencyTree::AddDependency(const CUniqueID& rkID)
|
||||
void CDependencyTree::AddDependency(const CAssetID& rkID)
|
||||
{
|
||||
if (!rkID.IsValid() || HasDependency(rkID)) return;
|
||||
CResourceDependency *pDepend = new CResourceDependency(rkID);
|
||||
|
@ -135,7 +135,7 @@ EDependencyNodeType CAnimSetDependencyTree::Type() const
|
|||
return eDNT_AnimSet;
|
||||
}
|
||||
|
||||
void CAnimSetDependencyTree::Read(IInputStream& rFile, EUIDLength IDLength)
|
||||
void CAnimSetDependencyTree::Read(IInputStream& rFile, EIDLength IDLength)
|
||||
{
|
||||
CDependencyTree::Read(rFile, IDLength);
|
||||
u32 NumChars = rFile.ReadLong();
|
||||
|
@ -145,7 +145,7 @@ void CAnimSetDependencyTree::Read(IInputStream& rFile, EUIDLength IDLength)
|
|||
mCharacterOffsets.push_back( rFile.ReadLong() );
|
||||
}
|
||||
|
||||
void CAnimSetDependencyTree::Write(IOutputStream& rFile, EUIDLength IDLength) const
|
||||
void CAnimSetDependencyTree::Write(IOutputStream& rFile, EIDLength IDLength) const
|
||||
{
|
||||
CDependencyTree::Write(rFile, IDLength);
|
||||
rFile.WriteLong(mCharacterOffsets.size());
|
||||
|
@ -166,7 +166,7 @@ EDependencyNodeType CScriptInstanceDependencyTree::Type() const
|
|||
return eDNT_ScriptInstance;
|
||||
}
|
||||
|
||||
void CScriptInstanceDependencyTree::Read(IInputStream& rFile, EUIDLength IDLength)
|
||||
void CScriptInstanceDependencyTree::Read(IInputStream& rFile, EIDLength IDLength)
|
||||
{
|
||||
mObjectType = rFile.ReadLong();
|
||||
u32 NumDepends = rFile.ReadLong();
|
||||
|
@ -174,7 +174,7 @@ void CScriptInstanceDependencyTree::Read(IInputStream& rFile, EUIDLength IDLengt
|
|||
|
||||
for (u32 iDep = 0; iDep < NumDepends; iDep++)
|
||||
{
|
||||
CUniqueID ID(rFile, IDLength);
|
||||
CAssetID ID(rFile, IDLength);
|
||||
CResourceEntry *pEntry = gpResourceStore->FindEntry(ID);
|
||||
|
||||
if (pEntry && pEntry->ResourceType() == eAnimSet && pEntry->Game() <= eEchoes)
|
||||
|
@ -193,7 +193,7 @@ void CScriptInstanceDependencyTree::Read(IInputStream& rFile, EUIDLength IDLengt
|
|||
}
|
||||
}
|
||||
|
||||
void CScriptInstanceDependencyTree::Write(IOutputStream& rFile, EUIDLength IDLength) const
|
||||
void CScriptInstanceDependencyTree::Write(IOutputStream& rFile, EIDLength IDLength) const
|
||||
{
|
||||
rFile.WriteLong(mObjectType);
|
||||
rFile.WriteLong(mDependencies.size());
|
||||
|
@ -202,7 +202,7 @@ void CScriptInstanceDependencyTree::Write(IOutputStream& rFile, EUIDLength IDLen
|
|||
mDependencies[iDep]->Write(rFile, IDLength);
|
||||
}
|
||||
|
||||
bool CScriptInstanceDependencyTree::HasDependency(const CUniqueID& rkID)
|
||||
bool CScriptInstanceDependencyTree::HasDependency(const CAssetID& rkID)
|
||||
{
|
||||
if (!rkID.IsValid()) return false;
|
||||
|
||||
|
@ -235,7 +235,7 @@ void CScriptInstanceDependencyTree::ParseStructDependencies(CScriptInstanceDepen
|
|||
|
||||
else if (pProp->Type() == eFileProperty)
|
||||
{
|
||||
CUniqueID ID = static_cast<TFileProperty*>(pProp)->Get().ID();
|
||||
CAssetID ID = static_cast<TFileProperty*>(pProp)->Get().ID();
|
||||
|
||||
if (ID.IsValid() && !pTree->HasDependency(ID))
|
||||
{
|
||||
|
@ -247,7 +247,7 @@ void CScriptInstanceDependencyTree::ParseStructDependencies(CScriptInstanceDepen
|
|||
else if (pProp->Type() == eCharacterProperty)
|
||||
{
|
||||
TCharacterProperty *pChar = static_cast<TCharacterProperty*>(pProp);
|
||||
CUniqueID ID = pChar->Get().ID();
|
||||
CAssetID ID = pChar->Get().ID();
|
||||
|
||||
if (ID.IsValid() && !pTree->HasDependency(ID))
|
||||
pTree->mDependencies.push_back( CAnimSetDependency::BuildDependency(pChar) );
|
||||
|
@ -267,7 +267,7 @@ EDependencyNodeType CAreaDependencyTree::Type() const
|
|||
return eDNT_Area;
|
||||
}
|
||||
|
||||
void CAreaDependencyTree::Read(IInputStream& rFile, EUIDLength IDLength)
|
||||
void CAreaDependencyTree::Read(IInputStream& rFile, EIDLength IDLength)
|
||||
{
|
||||
// Base dependency list contains non-script dependencies (world geometry textures + PATH/PTLA/EGMC)
|
||||
CDependencyTree::Read(rFile, IDLength);
|
||||
|
@ -288,7 +288,7 @@ void CAreaDependencyTree::Read(IInputStream& rFile, EUIDLength IDLength)
|
|||
mLayerOffsets.push_back( rFile.ReadLong() );
|
||||
}
|
||||
|
||||
void CAreaDependencyTree::Write(IOutputStream& rFile, EUIDLength IDLength) const
|
||||
void CAreaDependencyTree::Write(IOutputStream& rFile, EIDLength IDLength) const
|
||||
{
|
||||
CDependencyTree::Write(rFile, IDLength);
|
||||
rFile.WriteLong(mScriptInstances.size());
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "CResourceEntry.h"
|
||||
#include <FileIO/FileIO.h>
|
||||
#include <Common/AssertMacro.h>
|
||||
#include <Common/CUniqueID.h>
|
||||
#include <Common/CAssetID.h>
|
||||
|
||||
class CScriptLayer;
|
||||
class CScriptObject;
|
||||
|
@ -28,26 +28,26 @@ class IDependencyNode
|
|||
public:
|
||||
virtual ~IDependencyNode() {}
|
||||
virtual EDependencyNodeType Type() const = 0;
|
||||
virtual void Read(IInputStream& rFile, EUIDLength IDLength) = 0;
|
||||
virtual void Write(IOutputStream& rFile, EUIDLength IDLength) const = 0;
|
||||
virtual void Read(IInputStream& rFile, EIDLength IDLength) = 0;
|
||||
virtual void Write(IOutputStream& rFile, EIDLength IDLength) const = 0;
|
||||
};
|
||||
|
||||
// Node representing a single resource dependency.
|
||||
class CResourceDependency : public IDependencyNode
|
||||
{
|
||||
CUniqueID mID;
|
||||
CAssetID mID;
|
||||
|
||||
public:
|
||||
CResourceDependency() {}
|
||||
CResourceDependency(const CUniqueID& rkID) : mID(rkID) {}
|
||||
CResourceDependency(const CAssetID& rkID) : mID(rkID) {}
|
||||
|
||||
virtual EDependencyNodeType Type() const;
|
||||
virtual void Read(IInputStream& rFile, EUIDLength IDLength);
|
||||
virtual void Write(IOutputStream& rFile, EUIDLength IDLength) const;
|
||||
virtual void Read(IInputStream& rFile, EIDLength IDLength);
|
||||
virtual void Write(IOutputStream& rFile, EIDLength IDLength) const;
|
||||
|
||||
// Accessors
|
||||
inline CUniqueID ID() const { return mID; }
|
||||
inline void SetID(const CUniqueID& rkID) { mID = rkID; }
|
||||
inline CAssetID ID() const { return mID; }
|
||||
inline void SetID(const CAssetID& rkID) { mID = rkID; }
|
||||
};
|
||||
|
||||
// Node representing a single animset dependency contained in a script object. Indicates which character is being used.
|
||||
|
@ -60,8 +60,8 @@ public:
|
|||
CAnimSetDependency() : CResourceDependency(), mUsedChar(-1) {}
|
||||
|
||||
virtual EDependencyNodeType Type() const;
|
||||
virtual void Read(IInputStream& rFile, EUIDLength IDLength);
|
||||
virtual void Write(IOutputStream& rFile, EUIDLength IDLength) const;
|
||||
virtual void Read(IInputStream& rFile, EIDLength IDLength);
|
||||
virtual void Write(IOutputStream& rFile, EIDLength IDLength) const;
|
||||
|
||||
// Accessors
|
||||
inline u32 UsedChar() const { return mUsedChar; }
|
||||
|
@ -75,26 +75,26 @@ public:
|
|||
class CDependencyTree : public IDependencyNode
|
||||
{
|
||||
protected:
|
||||
CUniqueID mID;
|
||||
CAssetID mID;
|
||||
std::vector<CResourceDependency*> mReferencedResources;
|
||||
|
||||
public:
|
||||
CDependencyTree(const CUniqueID& rkID) : mID(rkID) {}
|
||||
CDependencyTree(const CAssetID& rkID) : mID(rkID) {}
|
||||
~CDependencyTree();
|
||||
|
||||
virtual EDependencyNodeType Type() const;
|
||||
virtual void Read(IInputStream& rFile, EUIDLength IDLength);
|
||||
virtual void Write(IOutputStream& rFile, EUIDLength IDLength) const;
|
||||
virtual void Read(IInputStream& rFile, EIDLength IDLength);
|
||||
virtual void Write(IOutputStream& rFile, EIDLength IDLength) const;
|
||||
|
||||
u32 NumDependencies() const;
|
||||
bool HasDependency(const CUniqueID& rkID);
|
||||
CUniqueID DependencyByIndex(u32 Index) const;
|
||||
void AddDependency(const CUniqueID& rkID);
|
||||
bool HasDependency(const CAssetID& rkID);
|
||||
CAssetID DependencyByIndex(u32 Index) const;
|
||||
void AddDependency(const CAssetID& rkID);
|
||||
void AddDependency(CResource *pRes);
|
||||
|
||||
// Accessors
|
||||
inline void SetID(const CUniqueID& rkID) { mID = rkID; }
|
||||
inline CUniqueID ID() const { return mID; }
|
||||
inline void SetID(const CAssetID& rkID) { mID = rkID; }
|
||||
inline CAssetID ID() const { return mID; }
|
||||
|
||||
};
|
||||
|
||||
|
@ -105,10 +105,10 @@ protected:
|
|||
std::vector<u32> mCharacterOffsets;
|
||||
|
||||
public:
|
||||
CAnimSetDependencyTree(const CUniqueID& rkID) : CDependencyTree(rkID) {}
|
||||
CAnimSetDependencyTree(const CAssetID& rkID) : CDependencyTree(rkID) {}
|
||||
virtual EDependencyNodeType Type() const;
|
||||
virtual void Read(IInputStream& rFile, EUIDLength IDLength);
|
||||
virtual void Write(IOutputStream& rFile, EUIDLength IDLength) const;
|
||||
virtual void Read(IInputStream& rFile, EIDLength IDLength);
|
||||
virtual void Write(IOutputStream& rFile, EIDLength IDLength) const;
|
||||
};
|
||||
|
||||
// Node representing a script object. Indicates the type of object.
|
||||
|
@ -122,9 +122,9 @@ public:
|
|||
~CScriptInstanceDependencyTree();
|
||||
|
||||
virtual EDependencyNodeType Type() const;
|
||||
virtual void Read(IInputStream& rFile, EUIDLength IDLength);
|
||||
virtual void Write(IOutputStream& rFile, EUIDLength IDLength) const;
|
||||
bool HasDependency(const CUniqueID& rkID);
|
||||
virtual void Read(IInputStream& rFile, EIDLength IDLength);
|
||||
virtual void Write(IOutputStream& rFile, EIDLength IDLength) const;
|
||||
bool HasDependency(const CAssetID& rkID);
|
||||
|
||||
// Accessors
|
||||
u32 NumDependencies() const { return mDependencies.size(); }
|
||||
|
@ -142,12 +142,12 @@ protected:
|
|||
std::vector<u32> mLayerOffsets;
|
||||
|
||||
public:
|
||||
CAreaDependencyTree(const CUniqueID& rkID) : CDependencyTree(rkID) {}
|
||||
CAreaDependencyTree(const CAssetID& rkID) : CDependencyTree(rkID) {}
|
||||
~CAreaDependencyTree();
|
||||
|
||||
virtual EDependencyNodeType Type() const;
|
||||
virtual void Read(IInputStream& rFile, EUIDLength IDLength);
|
||||
virtual void Write(IOutputStream& rFile, EUIDLength IDLength) const;
|
||||
virtual void Read(IInputStream& rFile, EIDLength IDLength);
|
||||
virtual void Write(IOutputStream& rFile, EIDLength IDLength) const;
|
||||
|
||||
void AddScriptLayer(CScriptLayer *pLayer);
|
||||
};
|
||||
|
|
|
@ -50,7 +50,7 @@ bool CGameExporter::Export()
|
|||
return true;
|
||||
}
|
||||
|
||||
void CGameExporter::LoadResource(const CUniqueID& rkID, std::vector<u8>& rBuffer)
|
||||
void CGameExporter::LoadResource(const CAssetID& rkID, std::vector<u8>& rBuffer)
|
||||
{
|
||||
SResourceInstance *pInst = FindResourceInstance(rkID);
|
||||
if (pInst) LoadResource(*pInst, rBuffer);
|
||||
|
@ -168,7 +168,7 @@ void CGameExporter::LoadPaks()
|
|||
{
|
||||
#if LOAD_PAKS
|
||||
SCOPED_TIMER(LoadPaks);
|
||||
EUIDLength IDLength = (Game() < eCorruptionProto ? e32Bit : e64Bit);
|
||||
EIDLength IDLength = (Game() < eCorruptionProto ? e32Bit : e64Bit);
|
||||
|
||||
for (auto It = mPaks.begin(); It != mPaks.end(); It++)
|
||||
{
|
||||
|
@ -202,7 +202,7 @@ void CGameExporter::LoadPaks()
|
|||
for (u32 iName = 0; iName < NumNamedResources; iName++)
|
||||
{
|
||||
CFourCC ResType = Pak.ReadLong();
|
||||
CUniqueID ResID(Pak, IDLength);
|
||||
CAssetID ResID(Pak, IDLength);
|
||||
u32 NameLen = Pak.ReadLong();
|
||||
TString Name = Pak.ReadString(NameLen);
|
||||
pCollection->AddResource(Name, ResID, ResType);
|
||||
|
@ -215,7 +215,7 @@ void CGameExporter::LoadPaks()
|
|||
{
|
||||
bool Compressed = (Pak.ReadLong() == 1);
|
||||
CFourCC ResType = Pak.ReadLong();
|
||||
CUniqueID ResID(Pak, IDLength);
|
||||
CAssetID ResID(Pak, IDLength);
|
||||
u32 ResSize = Pak.ReadLong();
|
||||
u32 ResOffset = Pak.ReadLong();
|
||||
|
||||
|
@ -263,7 +263,7 @@ void CGameExporter::LoadPaks()
|
|||
{
|
||||
TString Name = Pak.ReadString();
|
||||
CFourCC ResType = Pak.ReadLong();
|
||||
CUniqueID ResID(Pak, IDLength);
|
||||
CAssetID ResID(Pak, IDLength);
|
||||
pCollection->AddResource(Name, ResID, ResType);
|
||||
SetResourcePath(ResID.ToLongLong(), PakName + L"\\", Name.ToUTF16());
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ void CGameExporter::LoadPaks()
|
|||
{
|
||||
bool Compressed = (Pak.ReadLong() == 1);
|
||||
CFourCC Type = Pak.ReadLong();
|
||||
CUniqueID ResID(Pak, IDLength);
|
||||
CAssetID ResID(Pak, IDLength);
|
||||
u32 Size = Pak.ReadLong();
|
||||
u32 Offset = DataStart + Pak.ReadLong();
|
||||
|
||||
|
@ -461,7 +461,7 @@ void CGameExporter::ExportWorlds()
|
|||
TWideString AreaDir = WorldDir + TWideString::FromInt32(iArea, 2, 10) + L"_" + FileUtil::SanitizeName(GameAreaName, true) + L"\\";
|
||||
FileUtil::CreateDirectory(mCookedDir + AreaDir);
|
||||
|
||||
CUniqueID AreaID = pWorld->AreaResourceID(iArea);
|
||||
CAssetID AreaID = pWorld->AreaResourceID(iArea);
|
||||
SResourceInstance *pInst = FindResourceInstance(AreaID);
|
||||
ASSERT(pInst != nullptr);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "CGameProject.h"
|
||||
#include "CResourceStore.h"
|
||||
#include <Common/CUniqueID.h>
|
||||
#include <Common/CAssetID.h>
|
||||
#include <Common/Flags.h>
|
||||
#include <Common/TString.h>
|
||||
#include <Common/types.h>
|
||||
|
@ -30,7 +30,7 @@ class CGameExporter
|
|||
struct SResourceInstance
|
||||
{
|
||||
TWideString PakFile;
|
||||
CUniqueID ResourceID;
|
||||
CAssetID ResourceID;
|
||||
CFourCC ResourceType;
|
||||
u32 PakOffset;
|
||||
u32 PakSize;
|
||||
|
@ -49,7 +49,7 @@ class CGameExporter
|
|||
public:
|
||||
CGameExporter(const TString& rkInputDir, const TString& rkOutputDir);
|
||||
bool Export();
|
||||
void LoadResource(const CUniqueID& rkID, std::vector<u8>& rBuffer);
|
||||
void LoadResource(const CAssetID& rkID, std::vector<u8>& rBuffer);
|
||||
|
||||
protected:
|
||||
void CopyDiscData();
|
||||
|
@ -61,21 +61,21 @@ protected:
|
|||
void ExportResource(SResourceInstance& rRes);
|
||||
|
||||
// Convenience Functions
|
||||
inline SResourceInstance* FindResourceInstance(const CUniqueID& rkID)
|
||||
inline SResourceInstance* FindResourceInstance(const CAssetID& rkID)
|
||||
{
|
||||
u64 IntegralID = rkID.ToLongLong();
|
||||
auto Found = mResourceMap.find(IntegralID);
|
||||
return (Found == mResourceMap.end() ? nullptr : &Found->second);
|
||||
}
|
||||
|
||||
inline SResourcePath* FindResourcePath(const CUniqueID& rkID)
|
||||
inline SResourcePath* FindResourcePath(const CAssetID& rkID)
|
||||
{
|
||||
u64 IntegralID = rkID.ToLongLong();
|
||||
auto Found = mResourcePaths.find(IntegralID);
|
||||
return (Found == mResourcePaths.end() ? nullptr : &Found->second);
|
||||
}
|
||||
|
||||
inline void SetResourcePath(const CUniqueID& rkID, const TWideString& rkDir, const TWideString& rkName)
|
||||
inline void SetResourcePath(const CAssetID& rkID, const TWideString& rkDir, const TWideString& rkName)
|
||||
{
|
||||
SetResourcePath(rkID.ToLongLong(), rkDir, rkName);
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ void CGameProject::SetActive()
|
|||
}
|
||||
}
|
||||
|
||||
void CGameProject::GetWorldList(std::list<CUniqueID>& rOut) const
|
||||
void CGameProject::GetWorldList(std::list<CAssetID>& rOut) const
|
||||
{
|
||||
for (u32 iPkg = 0; iPkg < mPackages.size(); iPkg++)
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "CResourceStore.h"
|
||||
#include "Core/Resource/EGame.h"
|
||||
#include <Common/FileUtil.h>
|
||||
#include <Common/CUniqueID.h>
|
||||
#include <Common/CAssetID.h>
|
||||
#include <Common/TString.h>
|
||||
#include <Common/types.h>
|
||||
|
||||
|
@ -47,7 +47,7 @@ public:
|
|||
bool Load(const TWideString& rkPath);
|
||||
void Save();
|
||||
void SetActive();
|
||||
void GetWorldList(std::list<CUniqueID>& rOut) const;
|
||||
void GetWorldList(std::list<CAssetID>& rOut) const;
|
||||
|
||||
// Directory Handling
|
||||
inline TWideString ProjectRoot() const { return mProjectRoot; }
|
||||
|
|
|
@ -43,7 +43,7 @@ void CPackage::Load()
|
|||
|
||||
else
|
||||
{
|
||||
CUniqueID ID = CUniqueID::FromString(pIDElem->GetText());
|
||||
CAssetID ID = CAssetID::FromString(pIDElem->GetText());
|
||||
TString Name = pNameElem->GetText();
|
||||
CFourCC Type = CFourCC(pTypeElem->GetText());
|
||||
pCollection->AddResource(Name, ID, Type);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef CPACKAGE
|
||||
#define CPACKAGE
|
||||
|
||||
#include <Common/CAssetID.h>
|
||||
#include <Common/CFourCC.h>
|
||||
#include <Common/CUniqueID.h>
|
||||
#include <Common/TString.h>
|
||||
|
||||
class CGameProject;
|
||||
|
@ -10,7 +10,7 @@ class CGameProject;
|
|||
struct SNamedResource
|
||||
{
|
||||
TString Name;
|
||||
CUniqueID ID;
|
||||
CAssetID ID;
|
||||
CFourCC Type;
|
||||
};
|
||||
|
||||
|
@ -27,7 +27,7 @@ public:
|
|||
inline u32 NumResources() const { return mNamedResources.size(); }
|
||||
inline const SNamedResource& ResourceByIndex(u32 Idx) const { return mNamedResources[Idx]; }
|
||||
|
||||
inline void AddResource(const TString& rkName, const CUniqueID& rkID, const CFourCC& rkType)
|
||||
inline void AddResource(const TString& rkName, const CAssetID& rkID, const CFourCC& rkType)
|
||||
{
|
||||
mNamedResources.push_back( SNamedResource { rkName, rkID, rkType } );
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "Core/Resource/Factory/CTextureDecoder.h"
|
||||
#include "Core/Resource/Factory/CWorldLoader.h"
|
||||
|
||||
CResourceEntry::CResourceEntry(CResourceStore *pStore, const CUniqueID& rkID,
|
||||
CResourceEntry::CResourceEntry(CResourceStore *pStore, const CAssetID& rkID,
|
||||
const TWideString& rkDir, const TWideString& rkFilename,
|
||||
EResType Type, bool Transient /*= false*/)
|
||||
: mpResource(nullptr)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "CVirtualDirectory.h"
|
||||
#include "Core/Resource/EResType.h"
|
||||
#include <Common/CUniqueID.h>
|
||||
#include <Common/CAssetID.h>
|
||||
#include <Common/Flags.h>
|
||||
#include <Common/types.h>
|
||||
|
||||
|
@ -26,7 +26,7 @@ class CResourceEntry
|
|||
CResource *mpResource;
|
||||
CResourceStore *mpStore;
|
||||
CDependencyTree *mpDependencies;
|
||||
CUniqueID mID;
|
||||
CAssetID mID;
|
||||
EResType mType;
|
||||
EGame mGame;
|
||||
CVirtualDirectory *mpDirectory;
|
||||
|
@ -37,7 +37,7 @@ class CResourceEntry
|
|||
mutable TWideString mCachedUppercaseName; // This is used to speed up case-insensitive sorting and filtering.
|
||||
|
||||
public:
|
||||
CResourceEntry(CResourceStore *pStore, const CUniqueID& rkID,
|
||||
CResourceEntry(CResourceStore *pStore, const CAssetID& rkID,
|
||||
const TWideString& rkDir, const TWideString& rkFilename,
|
||||
EResType Type, bool Transient = false);
|
||||
~CResourceEntry();
|
||||
|
@ -68,7 +68,7 @@ public:
|
|||
inline bool IsLoaded() const { return mpResource != nullptr; }
|
||||
inline CResource* Resource() const { return mpResource; }
|
||||
inline CDependencyTree* Dependencies() const { return mpDependencies; }
|
||||
inline CUniqueID ID() const { return mID; }
|
||||
inline CAssetID ID() const { return mID; }
|
||||
inline EGame Game() const { return mGame; }
|
||||
inline CVirtualDirectory* Directory() const { return mpDirectory; }
|
||||
inline TWideString Name() const { return mName; }
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
class CResourceIterator
|
||||
{
|
||||
CResourceStore *mpStore;
|
||||
std::map<CUniqueID, CResourceEntry*>::iterator mIter;
|
||||
std::map<CAssetID, CResourceEntry*>::iterator mIter;
|
||||
CResourceEntry *mpCurEntry;
|
||||
|
||||
public:
|
||||
|
|
|
@ -56,7 +56,7 @@ void CResourceStore::LoadResourceDatabase(const TString& rkPath)
|
|||
|
||||
if (pID && pType && pDir && pName)
|
||||
{
|
||||
CUniqueID ID = CUniqueID::FromString(pID->GetText());
|
||||
CAssetID ID = CAssetID::FromString(pID->GetText());
|
||||
EResType Type = CResource::ResTypeForExtension(pType->GetText());
|
||||
TWideString FileDir = pDir->GetText();
|
||||
TWideString FileName = pName->GetText();
|
||||
|
@ -186,7 +186,7 @@ CVirtualDirectory* CResourceStore::GetVirtualDirectory(const TWideString& rkPath
|
|||
else return nullptr;
|
||||
}
|
||||
|
||||
CResourceEntry* CResourceStore::FindEntry(const CUniqueID& rkID) const
|
||||
CResourceEntry* CResourceStore::FindEntry(const CAssetID& rkID) const
|
||||
{
|
||||
if (!rkID.IsValid()) return nullptr;
|
||||
auto Found = mResourceEntries.find(rkID);
|
||||
|
@ -194,12 +194,12 @@ CResourceEntry* CResourceStore::FindEntry(const CUniqueID& rkID) const
|
|||
else return Found->second;
|
||||
}
|
||||
|
||||
bool CResourceStore::IsResourceRegistered(const CUniqueID& rkID) const
|
||||
bool CResourceStore::IsResourceRegistered(const CAssetID& rkID) const
|
||||
{
|
||||
return FindEntry(rkID) == nullptr;
|
||||
}
|
||||
|
||||
CResourceEntry* CResourceStore::RegisterResource(const CUniqueID& rkID, EResType Type, const TWideString& rkDir, const TWideString& rkFileName)
|
||||
CResourceEntry* CResourceStore::RegisterResource(const CAssetID& rkID, EResType Type, const TWideString& rkDir, const TWideString& rkFileName)
|
||||
{
|
||||
CResourceEntry *pEntry = FindEntry(rkID);
|
||||
|
||||
|
@ -226,12 +226,12 @@ CResourceEntry* CResourceStore::RegisterResource(const CUniqueID& rkID, EResType
|
|||
|
||||
CResourceEntry* CResourceStore::RegisterTransientResource(EResType Type, const TWideString& rkDir /*= L""*/, const TWideString& rkFileName /*= L""*/)
|
||||
{
|
||||
CResourceEntry *pEntry = new CResourceEntry(this, CUniqueID::RandomID(), rkDir, rkFileName, Type, true);
|
||||
CResourceEntry *pEntry = new CResourceEntry(this, CAssetID::RandomID(), rkDir, rkFileName, Type, true);
|
||||
mResourceEntries[pEntry->ID()] = pEntry;
|
||||
return pEntry;
|
||||
}
|
||||
|
||||
CResourceEntry* CResourceStore::RegisterTransientResource(EResType Type, const CUniqueID& rkID, const TWideString& rkDir /*=L ""*/, const TWideString& rkFileName /*= L""*/)
|
||||
CResourceEntry* CResourceStore::RegisterTransientResource(EResType Type, const CAssetID& rkID, const TWideString& rkDir /*=L ""*/, const TWideString& rkFileName /*= L""*/)
|
||||
{
|
||||
CResourceEntry *pEntry = FindEntry(rkID);
|
||||
|
||||
|
@ -244,7 +244,7 @@ CResourceEntry* CResourceStore::RegisterTransientResource(EResType Type, const C
|
|||
return pEntry;
|
||||
}
|
||||
|
||||
CResource* CResourceStore::LoadResource(const CUniqueID& rkID, const CFourCC& rkType)
|
||||
CResource* CResourceStore::LoadResource(const CAssetID& rkID, const CFourCC& rkType)
|
||||
{
|
||||
if (!rkID.IsValid()) return nullptr;
|
||||
|
||||
|
@ -305,7 +305,7 @@ CResource* CResourceStore::LoadResource(const TString& rkPath)
|
|||
// Construct ID from string, check if resource is loaded already
|
||||
TWideString Dir = FileUtil::MakeAbsolute(TWideString(rkPath.GetFileDirectory()));
|
||||
TString Name = rkPath.GetFileName(false);
|
||||
CUniqueID ID = (Name.IsHexString() ? Name.ToInt64() : rkPath.Hash64());
|
||||
CAssetID ID = (Name.IsHexString() ? Name.ToInt64() : rkPath.Hash64());
|
||||
auto Find = mLoadedResources.find(ID);
|
||||
|
||||
if (Find != mLoadedResources.end())
|
||||
|
@ -350,7 +350,7 @@ void CResourceStore::TrackLoadedResource(CResourceEntry *pEntry)
|
|||
mLoadedResources[pEntry->ID()] = pEntry;
|
||||
}
|
||||
|
||||
CFourCC CResourceStore::ResourceTypeByID(const CUniqueID& rkID, const TStringList& rkPossibleTypes) const
|
||||
CFourCC CResourceStore::ResourceTypeByID(const CAssetID& rkID, const TStringList& rkPossibleTypes) const
|
||||
{
|
||||
if (!rkID.IsValid()) return eInvalidResType;
|
||||
if (rkPossibleTypes.size() == 1) return CFourCC(rkPossibleTypes.front());
|
||||
|
@ -420,7 +420,7 @@ void CResourceStore::DestroyUnreferencedResources()
|
|||
|
||||
bool CResourceStore::DeleteResourceEntry(CResourceEntry *pEntry)
|
||||
{
|
||||
CUniqueID ID = pEntry->ID();
|
||||
CAssetID ID = pEntry->ID();
|
||||
|
||||
if (pEntry->IsLoaded())
|
||||
{
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
#include "CVirtualDirectory.h"
|
||||
#include "Core/Resource/EResType.h"
|
||||
#include <Common/CAssetID.h>
|
||||
#include <Common/CFourCC.h>
|
||||
#include <Common/CUniqueID.h>
|
||||
#include <Common/TString.h>
|
||||
#include <Common/types.h>
|
||||
#include <map>
|
||||
|
@ -21,8 +21,8 @@ class CResourceStore
|
|||
CGameProject *mpProj;
|
||||
CVirtualDirectory *mpProjectRoot;
|
||||
std::vector<CVirtualDirectory*> mTransientRoots;
|
||||
std::map<CUniqueID, CResourceEntry*> mResourceEntries;
|
||||
std::map<CUniqueID, CResourceEntry*> mLoadedResources;
|
||||
std::map<CAssetID, CResourceEntry*> mResourceEntries;
|
||||
std::map<CAssetID, CResourceEntry*> mLoadedResources;
|
||||
|
||||
// Directory to look for transient resources in
|
||||
TWideString mTransientLoadDir;
|
||||
|
@ -48,16 +48,16 @@ public:
|
|||
void CloseActiveProject();
|
||||
CVirtualDirectory* GetVirtualDirectory(const TWideString& rkPath, bool Transient, bool AllowCreate);
|
||||
|
||||
bool IsResourceRegistered(const CUniqueID& rkID) const;
|
||||
CResourceEntry* RegisterResource(const CUniqueID& rkID, EResType Type, const TWideString& rkDir, const TWideString& rkFileName);
|
||||
CResourceEntry* FindEntry(const CUniqueID& rkID) const;
|
||||
bool IsResourceRegistered(const CAssetID& rkID) const;
|
||||
CResourceEntry* RegisterResource(const CAssetID& rkID, EResType Type, const TWideString& rkDir, const TWideString& rkFileName);
|
||||
CResourceEntry* FindEntry(const CAssetID& rkID) const;
|
||||
CResourceEntry* RegisterTransientResource(EResType Type, const TWideString& rkDir = L"", const TWideString& rkFileName = L"");
|
||||
CResourceEntry* RegisterTransientResource(EResType Type, const CUniqueID& rkID, const TWideString& rkDir = L"", const TWideString& rkFileName = L"");
|
||||
CResourceEntry* RegisterTransientResource(EResType Type, const CAssetID& rkID, const TWideString& rkDir = L"", const TWideString& rkFileName = L"");
|
||||
|
||||
CResource* LoadResource(const CUniqueID& rkID, const CFourCC& rkType);
|
||||
CResource* LoadResource(const CAssetID& rkID, const CFourCC& rkType);
|
||||
CResource* LoadResource(const TString& rkPath);
|
||||
void TrackLoadedResource(CResourceEntry *pEntry);
|
||||
CFourCC ResourceTypeByID(const CUniqueID& rkID, const TStringList& rkPossibleTypes) const;
|
||||
CFourCC ResourceTypeByID(const CAssetID& rkID, const TStringList& rkPossibleTypes) const;
|
||||
void DestroyUnreferencedResources();
|
||||
bool DeleteResourceEntry(CResourceEntry *pEntry);
|
||||
void SetTransientLoadDir(const TString& rkDir);
|
||||
|
|
|
@ -34,7 +34,7 @@ CGameArea::~CGameArea()
|
|||
CDependencyTree* CGameArea::BuildDependencyTree() const
|
||||
{
|
||||
// Base dependencies
|
||||
CAreaDependencyTree *pTree = new CAreaDependencyTree(ResID());
|
||||
CAreaDependencyTree *pTree = new CAreaDependencyTree(ID());
|
||||
|
||||
for (u32 iMat = 0; iMat < mpMaterialSet->NumMaterials(); iMat++)
|
||||
{
|
||||
|
|
|
@ -106,7 +106,7 @@ void CAnimationParameters::Write(IOutputStream& rSCLY)
|
|||
|
||||
else
|
||||
{
|
||||
rSCLY.WriteLongLong(CUniqueID::skInvalidID64.ToLongLong());
|
||||
rSCLY.WriteLongLong(CAssetID::skInvalidID64.ToLongLong());
|
||||
rSCLY.WriteLong(0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
|
||||
// Accessors
|
||||
inline EGame Version() const { return mGame; }
|
||||
inline CUniqueID ID() const { return mCharacter.ID(); }
|
||||
inline CAssetID ID() const { return mCharacter.ID(); }
|
||||
inline CAnimSet* AnimSet() const { return (CAnimSet*) mCharacter.Load(); }
|
||||
inline u32 CharacterIndex() const { return mCharIndex; }
|
||||
inline u32 AnimIndex() const { return mAnimIndex; }
|
||||
|
|
|
@ -6,21 +6,21 @@
|
|||
class CDependencyGroup : public CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eDependencyGroup)
|
||||
std::set<CUniqueID> mDependencies;
|
||||
std::set<CAssetID> mDependencies;
|
||||
|
||||
public:
|
||||
CDependencyGroup(CResourceEntry *pEntry = 0) : CResource(pEntry) {}
|
||||
inline void AddDependency(const CUniqueID& rkID) { mDependencies.insert(rkID); }
|
||||
inline void AddDependency(CResource *pRes) { if (pRes) mDependencies.insert(pRes->ResID()); }
|
||||
inline void RemoveDependency(const CUniqueID& rkID) { mDependencies.erase(rkID); }
|
||||
inline void AddDependency(const CAssetID& rkID) { mDependencies.insert(rkID); }
|
||||
inline void AddDependency(CResource *pRes) { if (pRes) mDependencies.insert(pRes->ID()); }
|
||||
inline void RemoveDependency(const CAssetID& rkID) { mDependencies.erase(rkID); }
|
||||
inline void Clear() { mDependencies.clear(); }
|
||||
inline bool HasDependency(const CUniqueID& rkID) const { return mDependencies.find(rkID) != mDependencies.end(); }
|
||||
inline bool HasDependency(const CAssetID& rkID) const { return mDependencies.find(rkID) != mDependencies.end(); }
|
||||
inline u32 NumDependencies() const { return mDependencies.size(); }
|
||||
inline CUniqueID DependencyByIndex(u32 Index) const { return *std::next(mDependencies.begin(), Index); }
|
||||
inline CAssetID DependencyByIndex(u32 Index) const { return *std::next(mDependencies.begin(), Index); }
|
||||
|
||||
CDependencyTree* BuildDependencyTree() const
|
||||
{
|
||||
CDependencyTree *pTree = new CDependencyTree(ResID());
|
||||
CDependencyTree *pTree = new CDependencyTree(ID());
|
||||
|
||||
for (auto DepIt = mDependencies.begin(); DepIt != mDependencies.end(); DepIt++)
|
||||
pTree->AddDependency(*DepIt);
|
||||
|
|
|
@ -24,7 +24,7 @@ inline float PtsToFloat(s32 Pt)
|
|||
|
||||
CDependencyTree* CFont::BuildDependencyTree() const
|
||||
{
|
||||
CDependencyTree *pOut = new CDependencyTree(ResID());
|
||||
CDependencyTree *pOut = new CDependencyTree(ID());
|
||||
pOut->AddDependency(mpFontTexture);
|
||||
return pOut;
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
#include "Core/GameProject/CDependencyTree.h"
|
||||
#include "Core/GameProject/CResourceEntry.h"
|
||||
#include "Core/GameProject/CResourceStore.h"
|
||||
#include <Common/CAssetID.h>
|
||||
#include <Common/CFourCC.h>
|
||||
#include <Common/CUniqueID.h>
|
||||
#include <Common/types.h>
|
||||
#include <Common/TString.h>
|
||||
|
||||
|
@ -40,12 +40,12 @@ public:
|
|||
}
|
||||
|
||||
virtual ~CResource() {}
|
||||
virtual CDependencyTree* BuildDependencyTree() const { return new CDependencyTree(ResID()); }
|
||||
virtual CDependencyTree* BuildDependencyTree() const { return new CDependencyTree(ID()); }
|
||||
|
||||
inline CResourceEntry* Entry() const { return mpEntry; }
|
||||
inline TString Source() const { return mpEntry ? mpEntry->CookedAssetPath(true).GetFileName() : ""; }
|
||||
inline TString FullSource() const { return mpEntry ? mpEntry->CookedAssetPath(true) : ""; }
|
||||
inline CUniqueID ResID() const { return mpEntry ? mpEntry->ID() : CUniqueID::skInvalidID64; }
|
||||
inline CAssetID ID() const { return mpEntry ? mpEntry->ID() : CAssetID::skInvalidID64; }
|
||||
inline EGame Game() const { return mpEntry ? mpEntry->Game() : eUnknownVersion; }
|
||||
inline bool IsReferenced() const { return mRefCount > 0; }
|
||||
inline void SetGame(EGame Game) { if (mpEntry) mpEntry->SetGame(Game); }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "CResource.h"
|
||||
#include "Core/GameProject/CResourceStore.h"
|
||||
#include <Common/CUniqueID.h>
|
||||
#include <Common/CAssetID.h>
|
||||
#include <Common/CFourCC.h>
|
||||
#include <Common/FileUtil.h>
|
||||
|
||||
|
@ -23,25 +23,25 @@ public:
|
|||
mIsValidPath = FileUtil::Exists(rkPath);
|
||||
}
|
||||
|
||||
CResourceInfo(const CUniqueID& rkID, CFourCC Type)
|
||||
CResourceInfo(const CAssetID& rkID, CFourCC Type)
|
||||
: mIsPath(false), mIsValidPath(false)
|
||||
{
|
||||
mPath = rkID.ToString() + "." + Type.ToString();
|
||||
}
|
||||
|
||||
inline CUniqueID ID() const
|
||||
inline CAssetID ID() const
|
||||
{
|
||||
TString FileName = mPath.GetFileName(false);
|
||||
|
||||
if (!mIsPath)
|
||||
return CUniqueID::FromString(FileName);
|
||||
return CAssetID::FromString(FileName);
|
||||
|
||||
else
|
||||
{
|
||||
if (FileName.IsHexString() && (FileName.Size() == 8 || FileName.Size() == 16))
|
||||
return CUniqueID::FromString(FileName);
|
||||
return CAssetID::FromString(FileName);
|
||||
else
|
||||
return CUniqueID::skInvalidID64;
|
||||
return CAssetID::skInvalidID64;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
if (Game() >= eEchoesDemo)
|
||||
Log::Warning("CScan::BuildDependencyTree not handling Echoes/Corruption dependencies");
|
||||
|
||||
CDependencyTree *pTree = new CDependencyTree(ResID());
|
||||
CDependencyTree *pTree = new CDependencyTree(ID());
|
||||
pTree->AddDependency(mpFrame);
|
||||
pTree->AddDependency(mpStringTable);
|
||||
return pTree;
|
||||
|
|
|
@ -19,7 +19,7 @@ CWorld::~CWorld()
|
|||
|
||||
CDependencyTree* CWorld::BuildDependencyTree() const
|
||||
{
|
||||
CDependencyTree *pTree = new CDependencyTree(ResID());
|
||||
CDependencyTree *pTree = new CDependencyTree(ID());
|
||||
|
||||
for (u32 iArea = 0; iArea < mAreas.size(); iArea++)
|
||||
{
|
||||
|
|
|
@ -47,7 +47,7 @@ void CMaterialCooker::WriteMatSetPrime(IOutputStream& rOut)
|
|||
{
|
||||
CTexture *pTex = pMat->Pass(iPass)->Texture();
|
||||
if (pTex)
|
||||
mTextureIDs.push_back(pTex->ResID().ToLong());
|
||||
mTextureIDs.push_back(pTex->ID().ToLong());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ void CMaterialCooker::WriteMaterialPrime(IOutputStream& rOut)
|
|||
if (pPassTex != nullptr)
|
||||
{
|
||||
TexFlags |= (1 << iPass);
|
||||
u32 TexID = pPassTex->ResID().ToLong();
|
||||
u32 TexID = pPassTex->ID().ToLong();
|
||||
|
||||
for (u32 iTex = 0; iTex < mTextureIDs.size(); iTex++)
|
||||
{
|
||||
|
|
|
@ -602,7 +602,7 @@ void CAreaLoader::ReadEGMC()
|
|||
{
|
||||
Log::FileWrite(mpMREA->GetSourceString(), "Reading EGMC");
|
||||
mpSectionMgr->ToSection(mEGMCBlockNum);
|
||||
CUniqueID EGMC(*mpMREA, (mVersion <= eEchoes ? e32Bit : e64Bit));
|
||||
CAssetID EGMC(*mpMREA, (mVersion <= eEchoes ? e32Bit : e64Bit));
|
||||
mpArea->mpPoiToWorldMap = gpResourceStore->LoadResource(EGMC, "EGMC");
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ CDependencyGroup* CDependencyGroupLoader::LoadDGRP(IInputStream& rDGRP, CResourc
|
|||
|
||||
u32 NumDependencies = rDGRP.ReadLong();
|
||||
EGame Game = VersionTest(rDGRP, NumDependencies);
|
||||
EUIDLength IDLength = (Game < eCorruptionProto ? e32Bit : e64Bit);
|
||||
EIDLength IDLength = (Game < eCorruptionProto ? e32Bit : e64Bit);
|
||||
|
||||
CDependencyGroup *pGroup = new CDependencyGroup(pEntry);
|
||||
pGroup->SetGame(Game);
|
||||
|
@ -40,7 +40,7 @@ CDependencyGroup* CDependencyGroupLoader::LoadDGRP(IInputStream& rDGRP, CResourc
|
|||
for (u32 iDep = 0; iDep < NumDependencies; iDep++)
|
||||
{
|
||||
rDGRP.Seek(0x4, SEEK_CUR); // Skip dependency type
|
||||
CUniqueID AssetID(rDGRP, IDLength);
|
||||
CAssetID AssetID(rDGRP, IDLength);
|
||||
pGroup->AddDependency(AssetID);
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ void CScriptLoader::ReadProperty(IProperty *pProp, u32 Size, IInputStream& rSCLY
|
|||
{
|
||||
TFileProperty *pFileCast = static_cast<TFileProperty*>(pProp);
|
||||
|
||||
CUniqueID ResID = (mVersion < eCorruptionProto ? rSCLY.ReadLong() : rSCLY.ReadLongLong());
|
||||
CAssetID ResID = (mVersion < eCorruptionProto ? rSCLY.ReadLong() : rSCLY.ReadLongLong());
|
||||
const TStringList& rkExtensions = static_cast<CFileTemplate*>(pTemp)->Extensions();
|
||||
|
||||
CResourceInfo Info(ResID, CFourCC(!rkExtensions.empty() ? rkExtensions.front() : "UNKN"));
|
||||
|
|
|
@ -32,7 +32,7 @@ CModel::~CModel()
|
|||
|
||||
CDependencyTree* CModel::BuildDependencyTree() const
|
||||
{
|
||||
CDependencyTree *pTree = new CDependencyTree(ResID());
|
||||
CDependencyTree *pTree = new CDependencyTree(ID());
|
||||
|
||||
for (u32 iSet = 0; iSet < mMaterialSets.size(); iSet++)
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
private:
|
||||
CWorldEditor *mpEditor;
|
||||
CUniqueID mAreaID;
|
||||
CAssetID mAreaID;
|
||||
QVector<SCopiedNode> mCopiedNodes;
|
||||
EGame mGame;
|
||||
|
||||
|
@ -45,7 +45,7 @@ public:
|
|||
|
||||
CNodeCopyMimeData(CWorldEditor *pEditor)
|
||||
: mpEditor(pEditor)
|
||||
, mAreaID(pEditor->ActiveArea()->ResID())
|
||||
, mAreaID(pEditor->ActiveArea()->ID())
|
||||
, mGame(pEditor->CurrentGame())
|
||||
{
|
||||
CNodeSelection *pSelection = pEditor->Selection();
|
||||
|
@ -100,7 +100,7 @@ public:
|
|||
return -1;
|
||||
}
|
||||
|
||||
CUniqueID AreaID() const { return mAreaID; }
|
||||
CAssetID AreaID() const { return mAreaID; }
|
||||
EGame Game() const { return mGame; }
|
||||
const QVector<SCopiedNode>& CopiedNodes() const { return mCopiedNodes; }
|
||||
};
|
||||
|
|
|
@ -89,14 +89,14 @@ void CProjectOverviewDialog::SetupWorldsList()
|
|||
{
|
||||
ASSERT(mpProject != nullptr && mpProject->IsActive());
|
||||
|
||||
std::list<CUniqueID> WorldIDs;
|
||||
std::list<CAssetID> WorldIDs;
|
||||
mpProject->GetWorldList(WorldIDs);
|
||||
mWorldEntries.clear();
|
||||
mpUI->WorldsList->clear();
|
||||
|
||||
for (auto It = WorldIDs.begin(); It != WorldIDs.end(); It++)
|
||||
{
|
||||
CUniqueID ID = *It;
|
||||
CAssetID ID = *It;
|
||||
CResourceEntry *pEntry = gpResourceStore->FindEntry(ID);
|
||||
|
||||
if (!pEntry)
|
||||
|
|
|
@ -192,7 +192,7 @@ void CStartWindow::on_LaunchWorldEditorButton_clicked()
|
|||
{
|
||||
Log::ClearErrorLog();
|
||||
|
||||
CUniqueID AreaID = mpWorld->AreaResourceID(mSelectedAreaIndex);
|
||||
CAssetID AreaID = mpWorld->AreaResourceID(mSelectedAreaIndex);
|
||||
TString AreaPath = mpWorld->Entry()->CookedAssetPath().GetFileDirectory() + AreaID.ToString() + ".MREA";
|
||||
TResPtr<CGameArea> pArea = gpResourceStore->LoadResource(AreaPath);
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ void CPasteNodesCommand::redo()
|
|||
pLink->SetReceiver(pNewTarget->InstanceID());
|
||||
}
|
||||
|
||||
else if (mpMimeData->AreaID() != pArea->ResID() || pArea->InstanceByID(pLink->ReceiverID()) == nullptr)
|
||||
else if (mpMimeData->AreaID() != pArea->ID() || pArea->InstanceByID(pLink->ReceiverID()) == nullptr)
|
||||
{
|
||||
CScriptObject *pSender = pLink->Sender();
|
||||
CScriptObject *pReceiver = pLink->Receiver();
|
||||
|
|
Loading…
Reference in New Issue