Subversion Repositories filter_foundry

Rev

Rev 186 | Rev 189 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 186 Rev 187
Line 120... Line 120...
120
        p += offsetof(PIProperty, propertyData) + prop->propertyLength;
120
        p += offsetof(PIProperty, propertyData) + prop->propertyLength;
121
 
121
 
122
        return p - (char*)pipl;  // figure how many bytes were added
122
        return p - (char*)pipl;  // figure how many bytes were added
123
}
123
}
124
 
124
 
-
 
125
void _aete_write_byte(void** aeteptr, uint8_t val) {
-
 
126
        uint8_t* tmp = *((uint8_t**)aeteptr);
-
 
127
        *tmp = val;
-
 
128
        *aeteptr = (void*)((unsigned char*)tmp + 1);
-
 
129
}
125
#define AETE_WRITE_BYTE(i) *((uint8_t*)aeteptr) = (i); (byte*)aeteptr += 1
130
#define AETE_WRITE_BYTE(i) _aete_write_byte(&aeteptr, (i));
-
 
131
 
-
 
132
void _aete_write_word(void** aeteptr, uint16_t val) {
-
 
133
        uint16_t* tmp = *((uint16_t**)aeteptr);
-
 
134
        *tmp = val;
-
 
135
        *aeteptr = (void*)((unsigned char*)tmp + 2);
-
 
136
}
126
#define AETE_WRITE_WORD(i) *((uint16_t*)aeteptr) = (i); (byte*)aeteptr += 2
137
#define AETE_WRITE_WORD(i) _aete_write_word(&aeteptr, (i));
-
 
138
 
-
 
139
void _aete_write_dword(void** aeteptr, uint32_t val) {
-
 
140
        uint32_t* tmp = *((uint32_t**)aeteptr);
-
 
141
        *tmp = val;
-
 
142
        *aeteptr = (void*)((unsigned char*)tmp + 4);
-
 
143
}
127
#define AETE_WRITE_DWORD(i) *((uint32_t*)aeteptr) = (i); (byte*)aeteptr += 4
144
#define AETE_WRITE_DWORD(i) _aete_write_dword(&aeteptr, (i));
-
 
145
 
-
 
146
void _aete_write_pstr(void** aeteptr, char* str) {
-
 
147
        char* tmp;
-
 
148
 
-
 
149
        assert(strlen(str) <= 255);
-
 
150
 
-
 
151
        _aete_write_byte(aeteptr, (uint8_t)strlen(str));
-
 
152
 
-
 
153
        tmp = *((char**)aeteptr);
-
 
154
        strcpy(tmp, str);
-
 
155
        *aeteptr = (void*)((unsigned char*)tmp + strlen(str));
-
 
156
}
128
#define AETE_WRITE_STR(s) assert(strlen((s))<=255); AETE_WRITE_BYTE((uint8_t)strlen((s))); strcpy((char*)aeteptr, (s)); (byte*)aeteptr += strlen((s))
157
#define AETE_WRITE_PSTR(s) _aete_write_pstr(&aeteptr, (s));
-
 
158
 
-
 
159
void _aete_align_word(void** aeteptr) {
129
#ifdef MAC_ENV
160
        #ifdef MAC_ENV
130
#define AETE_ALIGN_WORD() (byte*)aeteptr += (intptr_t)aeteptr & 1
161
        unsigned char* tmp = *((unsigned char**)aeteptr);
131
#else
162
        tmp += (intptr_t)tmp & 1;
132
#define AETE_ALIGN_WORD() /*nothing*/
163
        *aeteptr = (void*)tmp;
133
#endif
164
        #endif
-
 
165
}
-
 
166
#define AETE_ALIGN_WORD() _aete_align_word(&aeteptr);
134
 
167
 
135
void* _aete_property(void* aeteptr, PARM_T *pparm, int ctlidx, int mapidx, OSType key) {
168
void* _aete_property(void* aeteptr, PARM_T *pparm, int ctlidx, int mapidx, OSType key) {
136
        char tmp[256];
169
        char tmp[256];
137
 
170
 
138
        if (pparm->ctl_used[ctlidx] || pparm->map_used[mapidx]) {
171
        if (pparm->ctl_used[ctlidx] || pparm->map_used[mapidx]) {
Line 140... Line 173...
140
                        if (ctlidx & 1) {
173
                        if (ctlidx & 1) {
141
                                sprintf(tmp, "... %s", (char*)pparm->map[mapidx]);
174
                                sprintf(tmp, "... %s", (char*)pparm->map[mapidx]);
142
                        } else {
175
                        } else {
143
                                sprintf(tmp, "%s ...", (char*)pparm->map[mapidx]);
176
                                sprintf(tmp, "%s ...", (char*)pparm->map[mapidx]);
144
                        }
177
                        }
145
                        AETE_WRITE_STR(tmp);
178
                        AETE_WRITE_PSTR(tmp);
146
                } else {
179
                } else {
147
                        AETE_WRITE_STR((char*)pparm->ctl[ctlidx]);
180
                        AETE_WRITE_PSTR((char*)pparm->ctl[ctlidx]);
148
                }
181
                }
149
                AETE_ALIGN_WORD();
182
                AETE_ALIGN_WORD();
150
                AETE_WRITE_DWORD(key);
183
                AETE_WRITE_DWORD(key);
151
                AETE_WRITE_DWORD(typeSInt32);
184
                AETE_WRITE_DWORD(typeSInt32);
152
                AETE_WRITE_STR("");
185
                AETE_WRITE_PSTR("");
153
                AETE_ALIGN_WORD();
186
                AETE_ALIGN_WORD();
154
                AETE_WRITE_WORD(0x8000); /* FLAGS_1_OPT_PARAM / flagsOptionalSingleParameter */
187
                AETE_WRITE_WORD(0x8000); /* FLAGS_1_OPT_PARAM / flagsOptionalSingleParameter */
155
        }
188
        }
156
 
189
 
157
        return aeteptr;
190
        return aeteptr;
Line 177... Line 210...
177
        AETE_WRITE_BYTE(0x00); /* aete version */
210
        AETE_WRITE_BYTE(0x00); /* aete version */
178
        AETE_WRITE_WORD(english); /* language specifiers */
211
        AETE_WRITE_WORD(english); /* language specifiers */
179
        AETE_WRITE_WORD(roman);
212
        AETE_WRITE_WORD(roman);
180
        AETE_WRITE_WORD(1); /* 1 suite */
213
        AETE_WRITE_WORD(1); /* 1 suite */
181
        {
214
        {
182
                AETE_WRITE_STR(/*"Telegraphics"*/(char*)pparm->author); /* vendor suite name */
215
                AETE_WRITE_PSTR(/*"Telegraphics"*/(char*)pparm->author); /* vendor suite name */
183
                AETE_WRITE_STR(""); /* optional description */
216
                AETE_WRITE_PSTR(""); /* optional description */
184
                AETE_ALIGN_WORD();
217
                AETE_ALIGN_WORD();
185
                AETE_WRITE_DWORD(plugInSuiteID); /* suite ID */
218
                AETE_WRITE_DWORD(plugInSuiteID); /* suite ID */
186
                AETE_WRITE_WORD(1); /* suite code, must be 1. Attention: Filters like 'Pointillize' have set this to 0! */
219
                AETE_WRITE_WORD(1); /* suite code, must be 1. Attention: Filters like 'Pointillize' have set this to 0! */
187
                AETE_WRITE_WORD(1); /* suite level, must be 1. Attention: Filters like 'Pointillize' have set this to 0! */
220
                AETE_WRITE_WORD(1); /* suite level, must be 1. Attention: Filters like 'Pointillize' have set this to 0! */
188
                AETE_WRITE_WORD(1); /* 1 event (structure for filters) */
221
                AETE_WRITE_WORD(1); /* 1 event (structure for filters) */
189
                {
222
                {
190
                        AETE_WRITE_STR(/*"FilterFoundry"*/(char*)pparm->title); /* event name */
223
                        AETE_WRITE_PSTR(/*"FilterFoundry"*/(char*)pparm->title); /* event name */
191
                        AETE_WRITE_STR(""); /* event description */
224
                        AETE_WRITE_PSTR(""); /* event description */
192
                        AETE_ALIGN_WORD();
225
                        AETE_ALIGN_WORD();
193
                        AETE_WRITE_DWORD(plugInClassID); /* event class */
226
                        AETE_WRITE_DWORD(plugInClassID); /* event class */
194
                        AETE_WRITE_DWORD(/*plugInEventID*/event_id); /* event ID */
227
                        AETE_WRITE_DWORD(/*plugInEventID*/event_id); /* event ID */
195
                        /* NO_REPLY: */
228
                        /* NO_REPLY: */
196
                        AETE_WRITE_DWORD(noReply); /* noReply='null' */
229
                        AETE_WRITE_DWORD(noReply); /* noReply='null' */
197
                        AETE_WRITE_STR(""); /* reply description */
230
                        AETE_WRITE_PSTR(""); /* reply description */
198
                        AETE_ALIGN_WORD();
231
                        AETE_ALIGN_WORD();
199
                        AETE_WRITE_WORD(0);
232
                        AETE_WRITE_WORD(0);
200
                        /* IMAGE_DIRECT_PARAM: */
233
                        /* IMAGE_DIRECT_PARAM: */
201
                        AETE_WRITE_DWORD(typeImageReference); /* typeImageReference='#ImR' */
234
                        AETE_WRITE_DWORD(typeImageReference); /* typeImageReference='#ImR' */
202
                        AETE_WRITE_STR(""); /* direct parm description */
235
                        AETE_WRITE_PSTR(""); /* direct parm description */
203
                        AETE_ALIGN_WORD();
236
                        AETE_ALIGN_WORD();
204
                        AETE_WRITE_WORD(0xB000);
237
                        AETE_WRITE_WORD(0xB000);
205
 
238
 
206
                        numprops = 0;
239
                        numprops = 0;
207
                        if (pparm->ctl_used[0] || pparm->map_used[0]) numprops++;
240
                        if (pparm->ctl_used[0] || pparm->map_used[0]) numprops++;
Line 214... Line 247...
214
                        if (pparm->ctl_used[7] || pparm->map_used[3]) numprops++;
247
                        if (pparm->ctl_used[7] || pparm->map_used[3]) numprops++;
215
                        AETE_WRITE_WORD(numprops);
248
                        AETE_WRITE_WORD(numprops);
216
                        {
249
                        {
217
                                // Standalone filters don't need RGBA expressions
250
                                // Standalone filters don't need RGBA expressions
218
                                /*
251
                                /*
219
                                AETE_WRITE_STR("R");
252
                                AETE_WRITE_PSTR("R");
220
                                AETE_ALIGN_WORD();
253
                                AETE_ALIGN_WORD();
221
                                AETE_WRITE_DWORD(PARAM_R_KEY);
254
                                AETE_WRITE_DWORD(PARAM_R_KEY);
222
                                AETE_WRITE_DWORD(typeText);
255
                                AETE_WRITE_DWORD(typeText);
223
                                AETE_WRITE_STR("R channel expression");
256
                                AETE_WRITE_PSTR("R channel expression");
224
                                AETE_ALIGN_WORD();
257
                                AETE_ALIGN_WORD();
225
                                AETE_WRITE_WORD(0x8000);
258
                                AETE_WRITE_WORD(0x8000);
226
 
259
 
227
                                AETE_WRITE_STR("G");
260
                                AETE_WRITE_PSTR("G");
228
                                AETE_ALIGN_WORD();
261
                                AETE_ALIGN_WORD();
229
                                AETE_WRITE_DWORD(PARAM_G_KEY);
262
                                AETE_WRITE_DWORD(PARAM_G_KEY);
230
                                AETE_WRITE_DWORD(typeText);
263
                                AETE_WRITE_DWORD(typeText);
231
                                AETE_WRITE_STR("G channel expression");
264
                                AETE_WRITE_PSTR("G channel expression");
232
                                AETE_ALIGN_WORD();
265
                                AETE_ALIGN_WORD();
233
                                AETE_WRITE_WORD(0x8000);
266
                                AETE_WRITE_WORD(0x8000);
234
 
267
 
235
                                AETE_WRITE_STR("B");
268
                                AETE_WRITE_PSTR("B");
236
                                AETE_ALIGN_WORD();
269
                                AETE_ALIGN_WORD();
237
                                AETE_WRITE_DWORD(PARAM_B_KEY);
270
                                AETE_WRITE_DWORD(PARAM_B_KEY);
238
                                AETE_WRITE_DWORD(typeText);
271
                                AETE_WRITE_DWORD(typeText);
239
                                AETE_WRITE_STR("B channel expression");
272
                                AETE_WRITE_PSTR("B channel expression");
240
                                AETE_ALIGN_WORD();
273
                                AETE_ALIGN_WORD();
241
                                AETE_WRITE_WORD(0x8000);
274
                                AETE_WRITE_WORD(0x8000);
242
 
275
 
243
                                AETE_WRITE_STR("A");
276
                                AETE_WRITE_PSTR("A");
244
                                AETE_ALIGN_WORD();
277
                                AETE_ALIGN_WORD();
245
                                AETE_WRITE_DWORD(PARAM_A_KEY);
278
                                AETE_WRITE_DWORD(PARAM_A_KEY);
246
                                AETE_WRITE_DWORD(typeText);
279
                                AETE_WRITE_DWORD(typeText);
247
                                AETE_WRITE_STR("A channel expression");
280
                                AETE_WRITE_PSTR("A channel expression");
248
                                AETE_ALIGN_WORD();
281
                                AETE_ALIGN_WORD();
249
                                AETE_WRITE_WORD(0x8000);
282
                                AETE_WRITE_WORD(0x8000);
250
                                */
283
                                */
251
 
284
 
252
                                aeteptr = _aete_property(aeteptr, pparm, 0, 0, PARAM_CTL0_KEY);
285
                                aeteptr = _aete_property(aeteptr, pparm, 0, 0, PARAM_CTL0_KEY);