33 lines
784 B
C++
33 lines
784 B
C++
#include "Global.h"
|
|
#include "Log.h"
|
|
#include "Serial.h"
|
|
#include "bx/bx.h"
|
|
#include "bx/file.h"
|
|
#include "bx/filepath.h"
|
|
|
|
void SerializeStruct(void* data, uint64_t size, const char* path)
|
|
{
|
|
bx::Error err;
|
|
bx::FilePath filePath{path};
|
|
bx::FileWriter writer;
|
|
if (writer.open(filePath, false, &err))
|
|
{
|
|
if (!writer.write(data, size, &err))
|
|
{
|
|
LOG_ERROR("Failed to write to file %s: %s", path, err.getMessage().getCPtr());
|
|
writer.close();
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
LOG_ERROR("Failed to open file %s: %s", path, err.getMessage().getCPtr());
|
|
return;
|
|
}
|
|
LOG("Successful serialization");
|
|
}
|
|
|
|
void DeserializeStruct(void* data, SerializationHeader& expectedHeader, const char* path)
|
|
{
|
|
}
|