settings file and save/restore ui state

This commit is contained in:
2019-04-14 18:03:41 +02:00
parent ada1afbac2
commit a8d475fbfb
15 changed files with 596 additions and 38 deletions

View File

@@ -1,5 +1,6 @@
#pragma once
#include <codecvt>
#include "asset.h"
class BinaryStream
{
@@ -70,6 +71,7 @@ public:
BinaryStreamReader() = default;
~BinaryStreamReader();
void init(uint8_t* data_ptr, size_t size, ByteOrder byte_order = ByteOrder::Host);
bool load(const std::string& path, ByteOrder byte_order = ByteOrder::Host);
size_t pos();
void skip(size_t bytes);
// snap to the next 4-alignment
@@ -127,6 +129,7 @@ private:
uint8_t *m_ptr = nullptr;
uint8_t *m_cur = nullptr;
size_t m_size = 0;
Asset m_asset;
};
class BinaryStreamWriter : public BinaryStream
@@ -137,6 +140,7 @@ public:
BinaryStreamWriter() = default;
~BinaryStreamWriter() = default;
void init(ByteOrder byte_order = ByteOrder::Host);
bool save(const std::string& path) const;
void skip(size_t bytes, uint8_t fill = 0);
// snap to the next 4-alignment
void snap();