mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-21 02:39:17 +00:00
Merge branch 'master' of https://github.com/arukibree/primeworldeditor
This commit is contained in:
@@ -102,11 +102,11 @@ namespace CompressionUtil
|
||||
else return true;
|
||||
}
|
||||
|
||||
bool DecompressLZO(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32& rTotalOut)
|
||||
bool DecompressLZO(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32 DstLen, uint32& rTotalOut)
|
||||
{
|
||||
#if USE_LZOKAY
|
||||
size_t TotalOut = rTotalOut;
|
||||
lzokay::EResult Result = lzokay::decompress(pSrc, (size_t) SrcLen, pDst, TotalOut);
|
||||
size_t TotalOut;
|
||||
lzokay::EResult Result = lzokay::decompress(pSrc, (size_t) SrcLen, pDst, DstLen, TotalOut);
|
||||
rTotalOut = TotalOut;
|
||||
|
||||
if (Result < lzokay::EResult::Success)
|
||||
@@ -172,7 +172,7 @@ namespace CompressionUtil
|
||||
// No zlib magic - this is LZO
|
||||
else
|
||||
{
|
||||
bool Success = DecompressLZO(pSrc, Size, pDst, TotalOut);
|
||||
bool Success = DecompressLZO(pSrc, Size, pDst, (uint32) (pDstEnd - pDst), TotalOut);
|
||||
if (!Success) return false;
|
||||
}
|
||||
|
||||
@@ -220,8 +220,9 @@ namespace CompressionUtil
|
||||
bool CompressLZO(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32 DstLen, uint32& rTotalOut)
|
||||
{
|
||||
#if USE_LZOKAY
|
||||
rTotalOut = DstLen;
|
||||
lzokay::EResult Result = lzokay::compress(pSrc, (size_t) SrcLen, pDst, (size_t&) rTotalOut);
|
||||
size_t TotalOut;
|
||||
lzokay::EResult Result = lzokay::compress(pSrc, (size_t) SrcLen, pDst, DstLen, TotalOut);
|
||||
rTotalOut = TotalOut;
|
||||
|
||||
if (Result < lzokay::EResult::Success)
|
||||
{
|
||||
|
||||
@@ -16,6 +16,19 @@ enum class ELinkType
|
||||
Outgoing
|
||||
};
|
||||
|
||||
class CInstanceID
|
||||
{
|
||||
uint32 mId = 0;
|
||||
public:
|
||||
operator uint32() const { return mId; }
|
||||
CInstanceID() = default;
|
||||
CInstanceID(uint32 id) : mId(id) {}
|
||||
CInstanceID& operator=(uint32 id) { mId = id; return *this; }
|
||||
uint8 Layer() const { return uint8((mId >> 26u) & 0x3fu); }
|
||||
uint16 Area() const { return uint16((mId >> 16u) & 0x3ffu); }
|
||||
uint16 Id() const { return uint16(mId & 0xffffu); }
|
||||
};
|
||||
|
||||
class CScriptObject
|
||||
{
|
||||
friend class CScriptLoader;
|
||||
@@ -26,7 +39,7 @@ class CScriptObject
|
||||
CScriptLayer *mpLayer;
|
||||
uint32 mVersion;
|
||||
|
||||
uint32 mInstanceID;
|
||||
CInstanceID mInstanceID;
|
||||
std::vector<CLink*> mOutLinks;
|
||||
std::vector<CLink*> mInLinks;
|
||||
std::vector<char> mPropertyData;
|
||||
@@ -75,7 +88,7 @@ public:
|
||||
CScriptLayer* Layer() const { return mpLayer; }
|
||||
uint32 Version() const { return mVersion; }
|
||||
uint32 ObjectTypeID() const { return mpTemplate->ObjectID(); }
|
||||
uint32 InstanceID() const { return mInstanceID; }
|
||||
CInstanceID InstanceID() const { return mInstanceID; }
|
||||
uint32 NumLinks(ELinkType Type) const { return (Type == ELinkType::Incoming ? mInLinks.size() : mOutLinks.size()); }
|
||||
CLink* Link(ELinkType Type, uint32 Index) const { return (Type == ELinkType::Incoming ? mInLinks[Index] : mOutLinks[Index]); }
|
||||
void* PropertyData() const { return (void*) mPropertyData.data(); }
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
virtual void Destruct(void* pData) const
|
||||
{
|
||||
RevertToDefault(pData);
|
||||
TTypedProperty::Destruct(pData);
|
||||
_GetInternalArray(pData).~SScriptArray();
|
||||
}
|
||||
|
||||
virtual bool MatchesDefault(void* pData) const
|
||||
|
||||
@@ -280,7 +280,8 @@ CDependencyTree* CStringTable::BuildDependencyTree() const
|
||||
{
|
||||
if (Game() >= EGame::CorruptionProto)
|
||||
{
|
||||
ASSERT(ParamString.StartsWith("0x"));
|
||||
if (!ParamString.StartsWith("0x"))
|
||||
continue;
|
||||
ParamString = ParamString.ChopFront(2);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user