ft2-clone

Fasttracker 2 clone
Log | Files | Refs | README | LICENSE

commit 57717500034008910afdd4c0f2d72bbd574b954f
parent df90433f4e905af4ad16ffb3287475a0cea5e8fb
Author: Olav Sørensen <olav.sorensen@live.no>
Date:   Mon, 15 Mar 2021 10:56:59 +0100

Pack TonTyp struct (apparently needed for some systems)

Diffstat:
Msrc/ft2_replayer.h | 64++++++++++++++++++++++++++++++----------------------------------
1 file changed, 30 insertions(+), 34 deletions(-)

diff --git a/src/ft2_replayer.h b/src/ft2_replayer.h @@ -55,15 +55,16 @@ enum #define MAX_SAMPLE_LEN 0x3FFFFFFF #define PROG_NAME_STR "Fasttracker II clone" -/* Some of the following structs must be packed (e.g. not padded) since they -** are loaded directly into with fread and stuff. +/* Some of the following structs MUST be packed! +** Please do NOT edit these structs unless you +** absolutely know what you are doing! */ #ifdef _MSC_VER #pragma pack(push) #pragma pack(1) #endif -typedef struct songHeaderTyp_t // DO NOT TOUCH! +typedef struct songHeaderTyp_t { char sig[17], name[21], progName[20]; uint16_t ver; @@ -76,7 +77,7 @@ __attribute__ ((packed)) #endif songHeaderTyp; -typedef struct patternHeaderTyp_t // DO NOT TOUCH! +typedef struct patternHeaderTyp_t { int32_t patternHeaderSize; uint8_t typ; @@ -112,7 +113,7 @@ __attribute__ ((packed)) #endif songMOD31HeaderTyp; -typedef struct sampleHeaderTyp_t // DO NOT TOUCH! +typedef struct sampleHeaderTyp_t { int32_t len, repS, repL; uint8_t vol; @@ -127,7 +128,7 @@ __attribute__ ((packed)) #endif sampleHeaderTyp; -typedef struct instrHeaderTyp_t // DO NOT TOUCH! +typedef struct instrHeaderTyp_t { uint32_t instrSize; char name[22]; @@ -153,6 +154,29 @@ __attribute__ ((packed)) #endif instrHeaderTyp; +typedef struct tonTyp_t // must be packed on some systems, even though it consists of bytes only +{ + uint8_t ton, instr, vol, effTyp, eff; +} +#ifdef __GNUC__ +__attribute__ ((packed)) +#endif +tonTyp; + +typedef struct syncedChannel_t // used for audio/video sync queue (pack to save RAM) +{ + uint8_t status; + uint8_t pianoNoteNr; + uint8_t sampleNr, instrNr; + uint16_t smpStartPos; + uint8_t vol; + double dHz; +} +#ifdef __GNUC__ +__attribute__ ((packed)) +#endif +syncedChannel_t; + #ifdef _MSC_VER #pragma pack(pop) #endif @@ -226,34 +250,6 @@ typedef struct songTyp_t uint64_t musicTime64; } songTyp; -typedef struct tonTyp_t -{ - uint8_t ton, instr, vol, effTyp, eff; -} tonTyp; - -#ifdef _MSC_VER -#pragma pack(push) -#pragma pack(1) -#endif - -typedef struct syncedChannel_t // used for audio/video sync queue -{ - uint8_t status; - uint8_t pianoNoteNr; - uint8_t sampleNr, instrNr; - uint16_t smpStartPos; - uint8_t vol; - double dHz; -} -#ifdef __GNUC__ -__attribute__ ((packed)) -#endif -syncedChannel_t; - -#ifdef _MSC_VER -#pragma pack(pop) -#endif - double getSampleC4Rate(sampleTyp *s); void setNewSongPos(int32_t pos);