History

Pack TonTyp struct (apparently needed for some systems)

Olav Sørensen committed 5 years ago

Commit 57717501 parent df904331 file · +30 −34Browse files

Unified · Split

src/ft2_replayer.h+30−34
@@ -55,15 +55,16 @@ enum · 54 unmodified lines
55#define MAX_SAMPLE_LEN 0x3FFFFFFF55#define MAX_SAMPLE_LEN 0x3FFFFFFF
56#define PROG_NAME_STR "Fasttracker II clone"56#define PROG_NAME_STR "Fasttracker II clone"
57 57
58/* Some of the following structs must be packed (e.g. not padded) since they58/* Some of the following structs MUST be packed!
59** are loaded directly into with fread and stuff.59** Please do NOT edit these structs unless you
60** absolutely know what you are doing!
60*/61*/
61 62
62#ifdef _MSC_VER63#ifdef _MSC_VER
63#pragma pack(push)64#pragma pack(push)
64#pragma pack(1)65#pragma pack(1)
65#endif66#endif
66typedef struct songHeaderTyp_t // DO NOT TOUCH!67typedef struct songHeaderTyp_t
67{68{
68 char sig[17], name[21], progName[20];69 char sig[17], name[21], progName[20];
69 uint16_t ver;70 uint16_t ver;
@@ -76,7 +77,7 @@ __attribute__ ((packed)) · 6 unmodified lines
76#endif77#endif
77songHeaderTyp;78songHeaderTyp;
78 79
79typedef struct patternHeaderTyp_t // DO NOT TOUCH!80typedef struct patternHeaderTyp_t
80{81{
81 int32_t patternHeaderSize;82 int32_t patternHeaderSize;
82 uint8_t typ;83 uint8_t typ;
@@ -112,7 +113,7 @@ __attribute__ ((packed)) · 29 unmodified lines
112#endif113#endif
113songMOD31HeaderTyp;114songMOD31HeaderTyp;
114 115
115typedef struct sampleHeaderTyp_t // DO NOT TOUCH!116typedef struct sampleHeaderTyp_t
116{117{
117 int32_t len, repS, repL;118 int32_t len, repS, repL;
118 uint8_t vol;119 uint8_t vol;
@@ -127,7 +128,7 @@ __attribute__ ((packed)) · 8 unmodified lines
127#endif128#endif
128sampleHeaderTyp;129sampleHeaderTyp;
129 130
130typedef struct instrHeaderTyp_t // DO NOT TOUCH!131typedef struct instrHeaderTyp_t
131{132{
132 uint32_t instrSize;133 uint32_t instrSize;
133 char name[22];134 char name[22];
@@ -153,6 +154,29 @@ __attribute__ ((packed)) · 19 unmodified lines
153#endif154#endif
154instrHeaderTyp;155instrHeaderTyp;
155 156
157typedef struct tonTyp_t // must be packed on some systems, even though it consists of bytes only
158{
159 uint8_t ton, instr, vol, effTyp, eff;
160}
161#ifdef __GNUC__
162__attribute__ ((packed))
163#endif
164tonTyp;
165
166typedef struct syncedChannel_t // used for audio/video sync queue (pack to save RAM)
167{
168 uint8_t status;
169 uint8_t pianoNoteNr;
170 uint8_t sampleNr, instrNr;
171 uint16_t smpStartPos;
172 uint8_t vol;
173 double dHz;
174}
175#ifdef __GNUC__
176__attribute__ ((packed))
177#endif
178syncedChannel_t;
179
156#ifdef _MSC_VER180#ifdef _MSC_VER
157#pragma pack(pop)181#pragma pack(pop)
158#endif182#endif
@@ -226,34 +250,6 @@ typedef struct songTyp_t · 67 unmodified lines
226 uint64_t musicTime64;250 uint64_t musicTime64;
227} songTyp;251} songTyp;
228 252
229typedef struct tonTyp_t
230{
231 uint8_t ton, instr, vol, effTyp, eff;
232} tonTyp;
233
234#ifdef _MSC_VER
235#pragma pack(push)
236#pragma pack(1)
237#endif
238
239typedef struct syncedChannel_t // used for audio/video sync queue
240{
241 uint8_t status;
242 uint8_t pianoNoteNr;
243 uint8_t sampleNr, instrNr;
244 uint16_t smpStartPos;
245 uint8_t vol;
246 double dHz;
247}
248#ifdef __GNUC__
249__attribute__ ((packed))
250#endif
251syncedChannel_t;
252
253#ifdef _MSC_VER
254#pragma pack(pop)
255#endif
256
257double getSampleC4Rate(sampleTyp *s);253double getSampleC4Rate(sampleTyp *s);
258 254
259void setNewSongPos(int32_t pos);255void setNewSongPos(int32_t pos);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t