new puzzle tool
This commit is contained in:
@@ -23,6 +23,26 @@ namespace Gen
|
||||
}
|
||||
return isOk;
|
||||
}
|
||||
bool Save(const PlacedPuzzleCardFlags::Enum* obj, uint32_t count, Serializer& serializer)
|
||||
{
|
||||
bool isOk = true;
|
||||
for (uint32_t i = 0; i < count; ++i)
|
||||
{
|
||||
auto val = (uint8_t)obj[i];
|
||||
isOk = Save(&val, 1, serializer) && isOk;
|
||||
}
|
||||
return isOk;
|
||||
}
|
||||
bool Load(PlacedPuzzleCardFlags::Enum* obj, uint32_t count, Deserializer& serializer)
|
||||
{
|
||||
bool isOk = true;
|
||||
for (int32_t i = 0; i < count; ++i)
|
||||
{
|
||||
uint8_t& val = (uint8_t&)obj[i];
|
||||
isOk = Load(&val, 1, serializer) && isOk;
|
||||
}
|
||||
return isOk;
|
||||
}
|
||||
bool Save(const EMaterial::Enum* obj, uint32_t count, Serializer& serializer)
|
||||
{
|
||||
bool isOk = true;
|
||||
@@ -291,6 +311,7 @@ namespace Gen
|
||||
}
|
||||
|
||||
// Failed to resolve hash, the type definition chaned since the file was saved! try to match by name.
|
||||
*obj = {};
|
||||
int32_t nameMatchIdx = serializer.TypeBuf.FindDefByName(typeName);
|
||||
if (nameMatchIdx < 0)
|
||||
{
|
||||
@@ -311,11 +332,11 @@ namespace Gen
|
||||
{
|
||||
const bx::StringView memberName = {&serializer.MemberNameBuf[matchedDef.MemberNameIndices[i].Offset], matchedDef.MemberNameIndices[i].Size};
|
||||
const char* memberTypeName = serializer.TypeBuf.Defs[matchedDef.ChildIndices[i]].Name;
|
||||
if (bx::strCmp(memberName, "x") == 0 && bx::strCmp(memberTypeName, "float") == 0)
|
||||
if (bx::strCmp(memberName, "x") == 0 && bx::strCmp(memberTypeName, "f32") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(Vec2, x);
|
||||
}
|
||||
if (bx::strCmp(memberName, "y") == 0 && bx::strCmp(memberTypeName, "float") == 0)
|
||||
if (bx::strCmp(memberName, "y") == 0 && bx::strCmp(memberTypeName, "f32") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(Vec2, y);
|
||||
}
|
||||
@@ -391,6 +412,7 @@ namespace Gen
|
||||
}
|
||||
|
||||
// Failed to resolve hash, the type definition chaned since the file was saved! try to match by name.
|
||||
*obj = {};
|
||||
int32_t nameMatchIdx = serializer.TypeBuf.FindDefByName(typeName);
|
||||
if (nameMatchIdx < 0)
|
||||
{
|
||||
@@ -411,15 +433,15 @@ namespace Gen
|
||||
{
|
||||
const bx::StringView memberName = {&serializer.MemberNameBuf[matchedDef.MemberNameIndices[i].Offset], matchedDef.MemberNameIndices[i].Size};
|
||||
const char* memberTypeName = serializer.TypeBuf.Defs[matchedDef.ChildIndices[i]].Name;
|
||||
if (bx::strCmp(memberName, "x") == 0 && bx::strCmp(memberTypeName, "float") == 0)
|
||||
if (bx::strCmp(memberName, "x") == 0 && bx::strCmp(memberTypeName, "f32") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(Vec3, x);
|
||||
}
|
||||
if (bx::strCmp(memberName, "y") == 0 && bx::strCmp(memberTypeName, "float") == 0)
|
||||
if (bx::strCmp(memberName, "y") == 0 && bx::strCmp(memberTypeName, "f32") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(Vec3, y);
|
||||
}
|
||||
if (bx::strCmp(memberName, "z") == 0 && bx::strCmp(memberTypeName, "float") == 0)
|
||||
if (bx::strCmp(memberName, "z") == 0 && bx::strCmp(memberTypeName, "f32") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(Vec3, z);
|
||||
}
|
||||
@@ -503,6 +525,7 @@ namespace Gen
|
||||
}
|
||||
|
||||
// Failed to resolve hash, the type definition chaned since the file was saved! try to match by name.
|
||||
*obj = {};
|
||||
int32_t nameMatchIdx = serializer.TypeBuf.FindDefByName(typeName);
|
||||
if (nameMatchIdx < 0)
|
||||
{
|
||||
@@ -523,19 +546,19 @@ namespace Gen
|
||||
{
|
||||
const bx::StringView memberName = {&serializer.MemberNameBuf[matchedDef.MemberNameIndices[i].Offset], matchedDef.MemberNameIndices[i].Size};
|
||||
const char* memberTypeName = serializer.TypeBuf.Defs[matchedDef.ChildIndices[i]].Name;
|
||||
if (bx::strCmp(memberName, "x") == 0 && bx::strCmp(memberTypeName, "float") == 0)
|
||||
if (bx::strCmp(memberName, "x") == 0 && bx::strCmp(memberTypeName, "f32") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(Vec4, x);
|
||||
}
|
||||
if (bx::strCmp(memberName, "y") == 0 && bx::strCmp(memberTypeName, "float") == 0)
|
||||
if (bx::strCmp(memberName, "y") == 0 && bx::strCmp(memberTypeName, "f32") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(Vec4, y);
|
||||
}
|
||||
if (bx::strCmp(memberName, "z") == 0 && bx::strCmp(memberTypeName, "float") == 0)
|
||||
if (bx::strCmp(memberName, "z") == 0 && bx::strCmp(memberTypeName, "f32") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(Vec4, z);
|
||||
}
|
||||
if (bx::strCmp(memberName, "w") == 0 && bx::strCmp(memberTypeName, "float") == 0)
|
||||
if (bx::strCmp(memberName, "w") == 0 && bx::strCmp(memberTypeName, "f32") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(Vec4, w);
|
||||
}
|
||||
@@ -619,6 +642,7 @@ namespace Gen
|
||||
}
|
||||
|
||||
// Failed to resolve hash, the type definition chaned since the file was saved! try to match by name.
|
||||
*obj = {};
|
||||
int32_t nameMatchIdx = serializer.TypeBuf.FindDefByName(typeName);
|
||||
if (nameMatchIdx < 0)
|
||||
{
|
||||
@@ -639,7 +663,7 @@ namespace Gen
|
||||
{
|
||||
const bx::StringView memberName = {&serializer.MemberNameBuf[matchedDef.MemberNameIndices[i].Offset], matchedDef.MemberNameIndices[i].Size};
|
||||
const char* memberTypeName = serializer.TypeBuf.Defs[matchedDef.ChildIndices[i]].Name;
|
||||
if (bx::strCmp(memberName, "M") == 0 && bx::strCmp(memberTypeName, "float") == 0)
|
||||
if (bx::strCmp(memberName, "M") == 0 && bx::strCmp(memberTypeName, "f32") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(Mat3, M);
|
||||
}
|
||||
@@ -705,6 +729,7 @@ namespace Gen
|
||||
}
|
||||
|
||||
// Failed to resolve hash, the type definition chaned since the file was saved! try to match by name.
|
||||
*obj = {};
|
||||
int32_t nameMatchIdx = serializer.TypeBuf.FindDefByName(typeName);
|
||||
if (nameMatchIdx < 0)
|
||||
{
|
||||
@@ -725,7 +750,7 @@ namespace Gen
|
||||
{
|
||||
const bx::StringView memberName = {&serializer.MemberNameBuf[matchedDef.MemberNameIndices[i].Offset], matchedDef.MemberNameIndices[i].Size};
|
||||
const char* memberTypeName = serializer.TypeBuf.Defs[matchedDef.ChildIndices[i]].Name;
|
||||
if (bx::strCmp(memberName, "M") == 0 && bx::strCmp(memberTypeName, "float") == 0)
|
||||
if (bx::strCmp(memberName, "M") == 0 && bx::strCmp(memberTypeName, "f32") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(Mat4, M);
|
||||
}
|
||||
@@ -799,6 +824,7 @@ namespace Gen
|
||||
}
|
||||
|
||||
// Failed to resolve hash, the type definition chaned since the file was saved! try to match by name.
|
||||
*obj = {};
|
||||
int32_t nameMatchIdx = serializer.TypeBuf.FindDefByName(typeName);
|
||||
if (nameMatchIdx < 0)
|
||||
{
|
||||
@@ -925,6 +951,7 @@ namespace Gen
|
||||
}
|
||||
|
||||
// Failed to resolve hash, the type definition chaned since the file was saved! try to match by name.
|
||||
*obj = {};
|
||||
int32_t nameMatchIdx = serializer.TypeBuf.FindDefByName(typeName);
|
||||
if (nameMatchIdx < 0)
|
||||
{
|
||||
@@ -945,7 +972,7 @@ namespace Gen
|
||||
{
|
||||
const bx::StringView memberName = {&serializer.MemberNameBuf[matchedDef.MemberNameIndices[i].Offset], matchedDef.MemberNameIndices[i].Size};
|
||||
const char* memberTypeName = serializer.TypeBuf.Defs[matchedDef.ChildIndices[i]].Name;
|
||||
if (bx::strCmp(memberName, "Idx") == 0 && bx::strCmp(memberTypeName, "uint32_t") == 0)
|
||||
if (bx::strCmp(memberName, "Idx") == 0 && bx::strCmp(memberTypeName, "u32") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(AssetHandle, Idx);
|
||||
}
|
||||
@@ -1013,6 +1040,7 @@ namespace Gen
|
||||
}
|
||||
|
||||
// Failed to resolve hash, the type definition chaned since the file was saved! try to match by name.
|
||||
*obj = {};
|
||||
int32_t nameMatchIdx = serializer.TypeBuf.FindDefByName(typeName);
|
||||
if (nameMatchIdx < 0)
|
||||
{
|
||||
@@ -1033,7 +1061,7 @@ namespace Gen
|
||||
{
|
||||
const bx::StringView memberName = {&serializer.MemberNameBuf[matchedDef.MemberNameIndices[i].Offset], matchedDef.MemberNameIndices[i].Size};
|
||||
const char* memberTypeName = serializer.TypeBuf.Defs[matchedDef.ChildIndices[i]].Name;
|
||||
if (bx::strCmp(memberName, "ModelIdx") == 0 && bx::strCmp(memberTypeName, "uint16_t") == 0)
|
||||
if (bx::strCmp(memberName, "ModelIdx") == 0 && bx::strCmp(memberTypeName, "u16") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(ModelHandle, ModelIdx);
|
||||
}
|
||||
@@ -1111,6 +1139,7 @@ namespace Gen
|
||||
}
|
||||
|
||||
// Failed to resolve hash, the type definition chaned since the file was saved! try to match by name.
|
||||
*obj = {};
|
||||
int32_t nameMatchIdx = serializer.TypeBuf.FindDefByName(typeName);
|
||||
if (nameMatchIdx < 0)
|
||||
{
|
||||
@@ -1131,7 +1160,7 @@ namespace Gen
|
||||
{
|
||||
const bx::StringView memberName = {&serializer.MemberNameBuf[matchedDef.MemberNameIndices[i].Offset], matchedDef.MemberNameIndices[i].Size};
|
||||
const char* memberTypeName = serializer.TypeBuf.Defs[matchedDef.ChildIndices[i]].Name;
|
||||
if (bx::strCmp(memberName, "TextureIdx") == 0 && bx::strCmp(memberTypeName, "uint16_t") == 0)
|
||||
if (bx::strCmp(memberName, "TextureIdx") == 0 && bx::strCmp(memberTypeName, "u16") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(TextureHandle, TextureIdx);
|
||||
}
|
||||
@@ -1209,6 +1238,7 @@ namespace Gen
|
||||
}
|
||||
|
||||
// Failed to resolve hash, the type definition chaned since the file was saved! try to match by name.
|
||||
*obj = {};
|
||||
int32_t nameMatchIdx = serializer.TypeBuf.FindDefByName(typeName);
|
||||
if (nameMatchIdx < 0)
|
||||
{
|
||||
@@ -1229,11 +1259,11 @@ namespace Gen
|
||||
{
|
||||
const bx::StringView memberName = {&serializer.MemberNameBuf[matchedDef.MemberNameIndices[i].Offset], matchedDef.MemberNameIndices[i].Size};
|
||||
const char* memberTypeName = serializer.TypeBuf.Defs[matchedDef.ChildIndices[i]].Name;
|
||||
if (bx::strCmp(memberName, "X") == 0 && bx::strCmp(memberTypeName, "int8_t") == 0)
|
||||
if (bx::strCmp(memberName, "X") == 0 && bx::strCmp(memberTypeName, "i8") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(PuzPos, X);
|
||||
}
|
||||
if (bx::strCmp(memberName, "Y") == 0 && bx::strCmp(memberTypeName, "int8_t") == 0)
|
||||
if (bx::strCmp(memberName, "Y") == 0 && bx::strCmp(memberTypeName, "i8") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(PuzPos, Y);
|
||||
}
|
||||
@@ -1307,6 +1337,7 @@ namespace Gen
|
||||
}
|
||||
|
||||
// Failed to resolve hash, the type definition chaned since the file was saved! try to match by name.
|
||||
*obj = {};
|
||||
int32_t nameMatchIdx = serializer.TypeBuf.FindDefByName(typeName);
|
||||
if (nameMatchIdx < 0)
|
||||
{
|
||||
@@ -1331,7 +1362,7 @@ namespace Gen
|
||||
{
|
||||
WriteDestinations[i] = offsetof(CardSocket, Model);
|
||||
}
|
||||
if (bx::strCmp(memberName, "ConnectionDirection") == 0 && bx::strCmp(memberTypeName, "uint8_t") == 0)
|
||||
if (bx::strCmp(memberName, "ConnectionDirection") == 0 && bx::strCmp(memberTypeName, "u8") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(CardSocket, ConnectionDirection);
|
||||
}
|
||||
@@ -1419,6 +1450,7 @@ namespace Gen
|
||||
}
|
||||
|
||||
// Failed to resolve hash, the type definition chaned since the file was saved! try to match by name.
|
||||
*obj = {};
|
||||
int32_t nameMatchIdx = serializer.TypeBuf.FindDefByName(typeName);
|
||||
if (nameMatchIdx < 0)
|
||||
{
|
||||
@@ -1585,6 +1617,7 @@ namespace Gen
|
||||
}
|
||||
|
||||
// Failed to resolve hash, the type definition chaned since the file was saved! try to match by name.
|
||||
*obj = {};
|
||||
int32_t nameMatchIdx = serializer.TypeBuf.FindDefByName(typeName);
|
||||
if (nameMatchIdx < 0)
|
||||
{
|
||||
@@ -1605,7 +1638,7 @@ namespace Gen
|
||||
{
|
||||
const bx::StringView memberName = {&serializer.MemberNameBuf[matchedDef.MemberNameIndices[i].Offset], matchedDef.MemberNameIndices[i].Size};
|
||||
const char* memberTypeName = serializer.TypeBuf.Defs[matchedDef.ChildIndices[i]].Name;
|
||||
if (bx::strCmp(memberName, "Idx") == 0 && bx::strCmp(memberTypeName, "uint16_t") == 0)
|
||||
if (bx::strCmp(memberName, "Idx") == 0 && bx::strCmp(memberTypeName, "u16") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(StaticPuzzleCardHandle, Idx);
|
||||
}
|
||||
@@ -1677,6 +1710,7 @@ namespace Gen
|
||||
}
|
||||
|
||||
// Failed to resolve hash, the type definition chaned since the file was saved! try to match by name.
|
||||
*obj = {};
|
||||
int32_t nameMatchIdx = serializer.TypeBuf.FindDefByName(typeName);
|
||||
if (nameMatchIdx < 0)
|
||||
{
|
||||
@@ -1795,6 +1829,7 @@ namespace Gen
|
||||
}
|
||||
|
||||
// Failed to resolve hash, the type definition chaned since the file was saved! try to match by name.
|
||||
*obj = {};
|
||||
int32_t nameMatchIdx = serializer.TypeBuf.FindDefByName(typeName);
|
||||
if (nameMatchIdx < 0)
|
||||
{
|
||||
@@ -1895,6 +1930,7 @@ namespace Gen
|
||||
}
|
||||
|
||||
// Failed to resolve hash, the type definition chaned since the file was saved! try to match by name.
|
||||
*obj = {};
|
||||
int32_t nameMatchIdx = serializer.TypeBuf.FindDefByName(typeName);
|
||||
if (nameMatchIdx < 0)
|
||||
{
|
||||
@@ -1919,11 +1955,11 @@ namespace Gen
|
||||
{
|
||||
WriteDestinations[i] = offsetof(PuzzleCardStack, RefCard);
|
||||
}
|
||||
if (bx::strCmp(memberName, "MaxAvailableCount") == 0 && bx::strCmp(memberTypeName, "uint8_t") == 0)
|
||||
if (bx::strCmp(memberName, "MaxAvailableCount") == 0 && bx::strCmp(memberTypeName, "u8") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(PuzzleCardStack, MaxAvailableCount);
|
||||
}
|
||||
if (bx::strCmp(memberName, "UsedCount") == 0 && bx::strCmp(memberTypeName, "uint8_t") == 0)
|
||||
if (bx::strCmp(memberName, "UsedCount") == 0 && bx::strCmp(memberTypeName, "u8") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(PuzzleCardStack, UsedCount);
|
||||
}
|
||||
@@ -1979,7 +2015,7 @@ namespace Gen
|
||||
isOk = Save(&obj[i].RefCard, 1, serializer) && isOk;
|
||||
isOk = Save(&obj[i].Position, 1, serializer) && isOk;
|
||||
isOk = Save(&obj[i].Rotation, 1, serializer) && isOk;
|
||||
isOk = Save(&obj[i].IsLocked, 1, serializer) && isOk;
|
||||
isOk = Save(&obj[i].Flags, 1, serializer) && isOk;
|
||||
}
|
||||
return isOk;
|
||||
}
|
||||
@@ -1999,7 +2035,7 @@ namespace Gen
|
||||
isOk = Load(&obj[i].RefCard, 1, serializer) && isOk;
|
||||
isOk = Load(&obj[i].Position, 1, serializer) && isOk;
|
||||
isOk = Load(&obj[i].Rotation, 1, serializer) && isOk;
|
||||
isOk = Load(&obj[i].IsLocked, 1, serializer) && isOk;
|
||||
isOk = Load(&obj[i].Flags, 1, serializer) && isOk;
|
||||
}
|
||||
// if we're not ok here, something went really wrong
|
||||
assert(isOk);
|
||||
@@ -2007,6 +2043,7 @@ namespace Gen
|
||||
}
|
||||
|
||||
// Failed to resolve hash, the type definition chaned since the file was saved! try to match by name.
|
||||
*obj = {};
|
||||
int32_t nameMatchIdx = serializer.TypeBuf.FindDefByName(typeName);
|
||||
if (nameMatchIdx < 0)
|
||||
{
|
||||
@@ -2035,13 +2072,13 @@ namespace Gen
|
||||
{
|
||||
WriteDestinations[i] = offsetof(PlacedPuzzleCard, Position);
|
||||
}
|
||||
if (bx::strCmp(memberName, "Rotation") == 0 && bx::strCmp(memberTypeName, "uint8_t") == 0)
|
||||
if (bx::strCmp(memberName, "Rotation") == 0 && bx::strCmp(memberTypeName, "u8") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(PlacedPuzzleCard, Rotation);
|
||||
}
|
||||
if (bx::strCmp(memberName, "IsLocked") == 0 && bx::strCmp(memberTypeName, "bool") == 0)
|
||||
if (bx::strCmp(memberName, "Flags") == 0 && bx::strCmp(memberTypeName, "PlacedPuzzleCardFlags") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(PlacedPuzzleCard, IsLocked);
|
||||
WriteDestinations[i] = offsetof(PlacedPuzzleCard, Flags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2081,9 +2118,9 @@ namespace Gen
|
||||
isOk = Load(fieldPtr, 1, serializer) && isOk;
|
||||
continue;
|
||||
}
|
||||
if (bx::strCmp(memberName, "IsLocked") == 0)
|
||||
if (bx::strCmp(memberName, "Flags") == 0)
|
||||
{
|
||||
auto* fieldPtr = reinterpret_cast<bool*>(objBasePtr + WriteDestinations[j]);
|
||||
auto* fieldPtr = reinterpret_cast<PlacedPuzzleCardFlags::Enum*>(objBasePtr + WriteDestinations[j]);
|
||||
isOk = Load(fieldPtr, 1, serializer) && isOk;
|
||||
continue;
|
||||
}
|
||||
@@ -2105,6 +2142,7 @@ namespace Gen
|
||||
isOk = Save(&obj[i].AvailableCardCount, 1, serializer) && isOk;
|
||||
isOk = Save(obj[i].AvailableCards, 16, serializer) && isOk;
|
||||
isOk = Save(obj[i].PlacedCards, 256, serializer) && isOk;
|
||||
isOk = Save(obj[i].InitialPlacedCards, 256, serializer) && isOk;
|
||||
isOk = Save(obj[i].BackgroundTiles, 1024, serializer) && isOk;
|
||||
isOk = Save(&obj[i].GoalPositionCount, 1, serializer) && isOk;
|
||||
isOk = Save(obj[i].GoalPositions, 16, serializer) && isOk;
|
||||
@@ -2131,6 +2169,7 @@ namespace Gen
|
||||
isOk = Load(&obj[i].AvailableCardCount, 1, serializer) && isOk;
|
||||
isOk = Load(obj[i].AvailableCards, 16, serializer) && isOk;
|
||||
isOk = Load(obj[i].PlacedCards, 256, serializer) && isOk;
|
||||
isOk = Load(obj[i].InitialPlacedCards, 256, serializer) && isOk;
|
||||
isOk = Load(obj[i].BackgroundTiles, 1024, serializer) && isOk;
|
||||
isOk = Load(&obj[i].GoalPositionCount, 1, serializer) && isOk;
|
||||
isOk = Load(obj[i].GoalPositions, 16, serializer) && isOk;
|
||||
@@ -2141,6 +2180,7 @@ namespace Gen
|
||||
}
|
||||
|
||||
// Failed to resolve hash, the type definition chaned since the file was saved! try to match by name.
|
||||
*obj = {};
|
||||
int32_t nameMatchIdx = serializer.TypeBuf.FindDefByName(typeName);
|
||||
if (nameMatchIdx < 0)
|
||||
{
|
||||
@@ -2161,23 +2201,23 @@ namespace Gen
|
||||
{
|
||||
const bx::StringView memberName = {&serializer.MemberNameBuf[matchedDef.MemberNameIndices[i].Offset], matchedDef.MemberNameIndices[i].Size};
|
||||
const char* memberTypeName = serializer.TypeBuf.Defs[matchedDef.ChildIndices[i]].Name;
|
||||
if (bx::strCmp(memberName, "ID") == 0 && bx::strCmp(memberTypeName, "uint16_t") == 0)
|
||||
if (bx::strCmp(memberName, "ID") == 0 && bx::strCmp(memberTypeName, "u16") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(PuzzleData, ID);
|
||||
}
|
||||
if (bx::strCmp(memberName, "PuzzleName") == 0 && bx::strCmp(memberTypeName, "char") == 0)
|
||||
if (bx::strCmp(memberName, "PuzzleName") == 0 && bx::strCmp(memberTypeName, "str") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(PuzzleData, PuzzleName);
|
||||
}
|
||||
if (bx::strCmp(memberName, "WidthTiles") == 0 && bx::strCmp(memberTypeName, "uint8_t") == 0)
|
||||
if (bx::strCmp(memberName, "WidthTiles") == 0 && bx::strCmp(memberTypeName, "u8") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(PuzzleData, WidthTiles);
|
||||
}
|
||||
if (bx::strCmp(memberName, "HeightTiles") == 0 && bx::strCmp(memberTypeName, "uint8_t") == 0)
|
||||
if (bx::strCmp(memberName, "HeightTiles") == 0 && bx::strCmp(memberTypeName, "u8") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(PuzzleData, HeightTiles);
|
||||
}
|
||||
if (bx::strCmp(memberName, "AvailableCardCount") == 0 && bx::strCmp(memberTypeName, "uint32_t") == 0)
|
||||
if (bx::strCmp(memberName, "AvailableCardCount") == 0 && bx::strCmp(memberTypeName, "u32") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(PuzzleData, AvailableCardCount);
|
||||
}
|
||||
@@ -2189,11 +2229,15 @@ namespace Gen
|
||||
{
|
||||
WriteDestinations[i] = offsetof(PuzzleData, PlacedCards);
|
||||
}
|
||||
if (bx::strCmp(memberName, "InitialPlacedCards") == 0 && bx::strCmp(memberTypeName, "PlacedPuzzleCard") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(PuzzleData, InitialPlacedCards);
|
||||
}
|
||||
if (bx::strCmp(memberName, "BackgroundTiles") == 0 && bx::strCmp(memberTypeName, "PuzzleElementType") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(PuzzleData, BackgroundTiles);
|
||||
}
|
||||
if (bx::strCmp(memberName, "GoalPositionCount") == 0 && bx::strCmp(memberTypeName, "uint32_t") == 0)
|
||||
if (bx::strCmp(memberName, "GoalPositionCount") == 0 && bx::strCmp(memberTypeName, "u32") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(PuzzleData, GoalPositionCount);
|
||||
}
|
||||
@@ -2263,6 +2307,12 @@ namespace Gen
|
||||
isOk = Load(fieldPtr, 256, serializer) && isOk;
|
||||
continue;
|
||||
}
|
||||
if (bx::strCmp(memberName, "InitialPlacedCards") == 0)
|
||||
{
|
||||
auto* fieldPtr = reinterpret_cast<PlacedPuzzleCard*>(objBasePtr + WriteDestinations[j]);
|
||||
isOk = Load(fieldPtr, 256, serializer) && isOk;
|
||||
continue;
|
||||
}
|
||||
if (bx::strCmp(memberName, "BackgroundTiles") == 0)
|
||||
{
|
||||
auto* fieldPtr = reinterpret_cast<PuzzleElementType::Enum*>(objBasePtr + WriteDestinations[j]);
|
||||
@@ -2329,6 +2379,7 @@ namespace Gen
|
||||
}
|
||||
|
||||
// Failed to resolve hash, the type definition chaned since the file was saved! try to match by name.
|
||||
*obj = {};
|
||||
int32_t nameMatchIdx = serializer.TypeBuf.FindDefByName(typeName);
|
||||
if (nameMatchIdx < 0)
|
||||
{
|
||||
@@ -2373,7 +2424,7 @@ namespace Gen
|
||||
{
|
||||
WriteDestinations[i] = offsetof(SavedEntityRenderData, Model);
|
||||
}
|
||||
if (bx::strCmp(memberName, "Visible") == 0 && bx::strCmp(memberTypeName, "bool") == 0)
|
||||
if (bx::strCmp(memberName, "Visible") == 0 && bx::strCmp(memberTypeName, "b") == 0)
|
||||
{
|
||||
WriteDestinations[i] = offsetof(SavedEntityRenderData, Visible);
|
||||
}
|
||||
@@ -2483,6 +2534,7 @@ namespace Gen
|
||||
}
|
||||
|
||||
// Failed to resolve hash, the type definition chaned since the file was saved! try to match by name.
|
||||
*obj = {};
|
||||
int32_t nameMatchIdx = serializer.TypeBuf.FindDefByName(typeName);
|
||||
if (nameMatchIdx < 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user