[nostalgia/core] Update TypeStore::loadDescriptor to take type version
This commit is contained in:
parent
ca64f95be3
commit
8d01882ed5
@ -7,5 +7,6 @@ O1;net.drinkingtea.ox.DescriptorType;2;{
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.core.Palette"
|
"typeName" : "net.drinkingtea.nostalgia.core.Palette",
|
||||||
|
"typeVersion" : 1
|
||||||
}
|
}
|
@ -15,13 +15,16 @@ O1;net.drinkingtea.ox.DescriptorType;2;{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldName" : "subsheets",
|
"fieldName" : "subsheets",
|
||||||
|
"subscriptLevels" : 1,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet"
|
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldName" : "pixels",
|
"fieldName" : "pixels",
|
||||||
|
"subscriptLevels" : 1,
|
||||||
"typeName" : "B:uint8_t"
|
"typeName" : "B:uint8_t"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet"
|
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet",
|
||||||
|
"typeVersion" : 1
|
||||||
}
|
}
|
@ -15,5 +15,6 @@ O1;net.drinkingtea.ox.DescriptorType;2;{
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet"
|
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet",
|
||||||
|
"typeVersion" : 2
|
||||||
}
|
}
|
@ -15,5 +15,6 @@ O1;net.drinkingtea.ox.DescriptorType;2;{
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"primitiveType" : 6,
|
"primitiveType" : 6,
|
||||||
"typeName" : "net.drinkingtea.ox.FileAddress.Data"
|
"typeName" : "net.drinkingtea.ox.FileAddress.Data",
|
||||||
|
"typeVersion" : 1
|
||||||
}
|
}
|
@ -11,5 +11,6 @@ O1;net.drinkingtea.ox.DescriptorType;2;{
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.ox.FileAddress"
|
"typeName" : "net.drinkingtea.ox.FileAddress",
|
||||||
|
"typeVersion" : 1
|
||||||
}
|
}
|
@ -3,3 +3,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "typestore.hpp"
|
#include "typestore.hpp"
|
||||||
|
|
||||||
|
namespace nostalgia::core {
|
||||||
|
|
||||||
|
ox::Result<ox::UniquePtr<ox::DescriptorType>> TypeStore::loadDescriptor(const ox::String &name, int version) noexcept {
|
||||||
|
constexpr auto descPath = "/.nostalgia/type_descriptors";
|
||||||
|
auto path = ox::sfmt("{}/{};{}", descPath, name, version);
|
||||||
|
oxRequire(buff, m_fs->read(path));
|
||||||
|
auto dt = ox::make_unique<ox::DescriptorType>();
|
||||||
|
oxReturnError(ox::readClaw<ox::DescriptorType>(buff, dt.get()));
|
||||||
|
return dt;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -20,14 +20,7 @@ class TypeStore: public ox::TypeStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ox::Result<ox::UniquePtr<ox::DescriptorType>> loadDescriptor(const ox::String &name) noexcept override {
|
ox::Result<ox::UniquePtr<ox::DescriptorType>> loadDescriptor(const ox::String &name, int version) noexcept override;
|
||||||
constexpr auto descPath = "/.nostalgia/type_descriptors";
|
|
||||||
auto path = ox::sfmt("{}/{}", descPath, name);
|
|
||||||
oxRequire(buff, m_fs->read(path));
|
|
||||||
auto dt = ox::make_unique<ox::DescriptorType>();
|
|
||||||
oxReturnError(ox::readClaw<ox::DescriptorType>(buff, dt.get()));
|
|
||||||
return dt;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user