giga-refactor, part 1
work on loading - NOT WORKING
This commit is contained in:
parent
dc0eda0445
commit
94044ef210
3 changed files with 868 additions and 596 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -20,6 +20,7 @@
|
|||
#include "engine.h"
|
||||
#include "../ta-log.h"
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <chrono>
|
||||
|
||||
static DivCompatFlags defaultFlags;
|
||||
|
|
@ -952,6 +953,23 @@ bool DivCompatFlags::areDefaults() {
|
|||
return (*this==defaultFlags);
|
||||
}
|
||||
|
||||
bool DivCompatFlags::readData(SafeReader& reader) {
|
||||
DivConfig c;
|
||||
unsigned char magic[4];
|
||||
|
||||
reader.read(magic,4);
|
||||
if (memcmp(magic,"CFLG",4)!=0) {
|
||||
return false;
|
||||
}
|
||||
reader.readI();
|
||||
|
||||
String data=reader.readString();
|
||||
c.loadFromMemory(data.c_str());
|
||||
|
||||
// TODO: this
|
||||
return true;
|
||||
}
|
||||
|
||||
#define CHECK_AND_STORE_BOOL(_x) \
|
||||
if (_x!=defaultFlags._x) { \
|
||||
c.set(#_x,_x); \
|
||||
|
|
|
|||
|
|
@ -160,6 +160,20 @@ enum DivEffectType: unsigned short {
|
|||
DIV_EFFECT_FILTER
|
||||
};
|
||||
|
||||
enum DivFileElementType: unsigned char {
|
||||
DIV_ELEMENT_END=0,
|
||||
DIV_ELEMENT_SUBSONG,
|
||||
DIV_ELEMENT_CHIP_FLAGS,
|
||||
DIV_ELEMENT_ASSET_DIR,
|
||||
DIV_ELEMENT_INSTRUMENT,
|
||||
DIV_ELEMENT_WAVETABLE,
|
||||
DIV_ELEMENT_SAMPLE,
|
||||
DIV_ELEMENT_PATTERN,
|
||||
DIV_ELEMENT_COMPAT_FLAGS,
|
||||
DIV_ELEMENT_COMMENTS,
|
||||
DIV_ELEMENT_GROOVE
|
||||
};
|
||||
|
||||
struct DivGroovePattern {
|
||||
unsigned char val[16];
|
||||
unsigned char len;
|
||||
|
|
@ -349,6 +363,7 @@ struct DivCompatFlags {
|
|||
|
||||
void setDefaults();
|
||||
bool areDefaults();
|
||||
bool readData(SafeReader& reader);
|
||||
void putData(SafeWriter* w);
|
||||
|
||||
bool operator==(const DivCompatFlags& other) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue