add hashes

This commit is contained in:
Asuro
2025-03-12 22:29:52 +01:00
parent ffad8f8460
commit f3f994fd8b
7 changed files with 114 additions and 12 deletions

View File

@@ -17,6 +17,17 @@ namespace Generated
return Err.isOk();
}
template <typename T> bool WriteT(const char* _4cc, const T& data)
{
Writer.write(_4cc, 4, &Err);
if (!Err.isOk()) return false;
uint32_t hash = data.Hash;
Writer.write(&hash, sizeof(hash), &Err);
uint32_t size = sizeof(T);
Writer.write(&size, sizeof(size), &Err);
return Err.isOk() && Save(&data, 1, *this);
}
bool Write(const void* data, uint32_t size)
{
Writer.write(data, size, &Err);