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
5555 #define MAX_SAMPLE_LEN 0x3FFFFFFF
5656 #define PROG_NAME_STR "Fasttracker II clone"
5757
58−/* Some of the following structs must be packed (e.g. not padded) since they
59−** are loaded directly into with fread and stuff.
58+/* Some of the following structs MUST be packed!
59+** Please do NOT edit these structs unless you
60+** absolutely know what you are doing!
6061 */
6162
6263 #ifdef _MSC_VER
6364 #pragma pack(push)
6465 #pragma pack(1)
6566 #endif
66−typedef struct songHeaderTyp_t // DO NOT TOUCH!
67+typedef struct songHeaderTyp_t
6768 {
6869 char sig[17], name[21], progName[20];
6970 uint16_t ver;
@@ -76,7 +77,7 @@ __attribute__ ((packed)) · 6 unmodified lines
7677 #endif
7778 songHeaderTyp;
7879
79−typedef struct patternHeaderTyp_t // DO NOT TOUCH!
80+typedef struct patternHeaderTyp_t
8081 {
8182 int32_t patternHeaderSize;
8283 uint8_t typ;
@@ -112,7 +113,7 @@ __attribute__ ((packed)) · 29 unmodified lines
112113 #endif
113114 songMOD31HeaderTyp;
114115
115−typedef struct sampleHeaderTyp_t // DO NOT TOUCH!
116+typedef struct sampleHeaderTyp_t
116117 {
117118 int32_t len, repS, repL;
118119 uint8_t vol;
@@ -127,7 +128,7 @@ __attribute__ ((packed)) · 8 unmodified lines
127128 #endif
128129 sampleHeaderTyp;
129130
130−typedef struct instrHeaderTyp_t // DO NOT TOUCH!
131+typedef struct instrHeaderTyp_t
131132 {
132133 uint32_t instrSize;
133134 char name[22];
@@ -153,6 +154,29 @@ __attribute__ ((packed)) · 19 unmodified lines
153154 #endif
154155 instrHeaderTyp;
155156
157+typedef 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
164+tonTyp;
165+
166+typedef 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
178+syncedChannel_t;
179+
156180 #ifdef _MSC_VER
157181 #pragma pack(pop)
158182 #endif
@@ -226,34 +250,6 @@ typedef struct songTyp_t · 67 unmodified lines
226250 uint64_t musicTime64;
227251 } songTyp;
228252
229−typedef 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−
239−typedef 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
251−syncedChannel_t;
252−
253−#ifdef _MSC_VER
254−#pragma pack(pop)
255−#endif
256−
257253 double getSampleC4Rate(sampleTyp *s);
258254
259255 void 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