|
1 /* |
|
2 * Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Binary output. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <windows.h> |
|
19 |
|
20 #include "SDCGlobals.h" |
|
21 #include "SDCBinOutput.h" |
|
22 #include "AknsConstants.hrh" |
|
23 #include "SDCException.h" |
|
24 |
|
25 // Make std namespace available for compatibility |
|
26 namespace std {} |
|
27 using namespace std; |
|
28 |
|
29 // CLASS DECLARATION |
|
30 |
|
31 class TPos |
|
32 { |
|
33 public: |
|
34 TPos( CSDCBinOutput* aBinOutput ) |
|
35 { |
|
36 iPosition = aBinOutput->iOutputPos; |
|
37 } |
|
38 |
|
39 void Go( CSDCBinOutput* aBinOutput ) |
|
40 { |
|
41 iOriginalPosition = aBinOutput->iOutputPos; |
|
42 aBinOutput->iOutputPos = iPosition; |
|
43 } |
|
44 |
|
45 void Back( CSDCBinOutput* aBinOutput ) |
|
46 { |
|
47 aBinOutput->iOutputPos = iOriginalPosition; |
|
48 } |
|
49 |
|
50 int BackwardsDelta() |
|
51 { |
|
52 return iOriginalPosition-iPosition; |
|
53 } |
|
54 |
|
55 public: |
|
56 int iPosition; |
|
57 int iOriginalPosition; |
|
58 }; |
|
59 |
|
60 ////////////////////////////////////////////////////////////////////// |
|
61 // Construction/Destruction |
|
62 ////////////////////////////////////////////////////////////////////// |
|
63 |
|
64 CSDCBinOutput::CSDCBinOutput() |
|
65 { |
|
66 iOutputPos = 0; |
|
67 } |
|
68 |
|
69 CSDCBinOutput::~CSDCBinOutput() |
|
70 { |
|
71 } |
|
72 |
|
73 ////////////////////////////////////////////////////////////////////// |
|
74 // Other methods |
|
75 ////////////////////////////////////////////////////////////////////// |
|
76 |
|
77 void CSDCBinOutput::Output( CSDCData* aData, const char* aBaseName, const char* aBinFilename, const bool aStubOnly ) |
|
78 { |
|
79 iData = aData; |
|
80 strcpy( iBaseName, aBaseName ); |
|
81 |
|
82 PrepareSkinDescriptor( aStubOnly ); |
|
83 |
|
84 if( iOutputPos != iOutputVector.size() ) throw CSDCException( ESDCUnknownError, "Internal binary output size does not match" ); |
|
85 |
|
86 FILE* file = fopen( aBinFilename, "wb" ); |
|
87 if( !file ) throw CSDCException( ESDCFileOpenError, "Can not open target binary file for writing" ); |
|
88 int i; |
|
89 for( i=0; i<iOutputVector.size(); i++ ) |
|
90 { |
|
91 fputc( iOutputVector[i], file ); |
|
92 } |
|
93 fclose( file ); |
|
94 } |
|
95 |
|
96 void CSDCBinOutput::PrepareSkinDescriptor( const bool aStubOnly ) |
|
97 { |
|
98 TPos startPos( this ); |
|
99 |
|
100 AppendBytes( 1*4 + 2*2 ); |
|
101 WriteUint( 0 ); // Length |
|
102 WriteUint16( 0 ); // Type |
|
103 WriteUint16( 1 ); // Version |
|
104 |
|
105 AppendBytes( 3*4 + 1*2 + 2*4 ); |
|
106 WriteInt( iData->iPid.iPID1 ); // SkinPID1 |
|
107 WriteInt( iData->iPid.iPID2 ); // SkinPID2 |
|
108 WriteInt( 0 ); // SkinCF |
|
109 WriteUint16( (unsigned short int)iData->iSkinType ); // SkinType |
|
110 WriteInt( iData->iPalettePid.iPID1 ); // ColorSchemePID1 |
|
111 WriteInt( iData->iPalettePid.iPID2 ); // ColorSchemePID2 |
|
112 |
|
113 AppendBytes( 1*1 ); // Protection |
|
114 if( iData->iProtection == 1 ) |
|
115 { |
|
116 WriteByte( 0x01 ); |
|
117 } |
|
118 else |
|
119 { |
|
120 WriteByte( 0x00 ); |
|
121 } |
|
122 |
|
123 AppendBytes( 1*1 ); // ContentFlags |
|
124 if( (iData->iAppIconDefVector.size()>0) && (!iData->IsScalable()) ) |
|
125 { |
|
126 WriteByte( 1 ); |
|
127 } |
|
128 else |
|
129 { |
|
130 WriteByte( 0 ); |
|
131 } |
|
132 AppendBytes( 1*2 + 1*4 ); |
|
133 WriteUint16( 0 ); // Reserved2 |
|
134 WriteInt( 0 ); // Reserved3 |
|
135 |
|
136 int chunksN = 0; |
|
137 AppendBytes( 1*4 ); |
|
138 TPos chunksNPos( this ); |
|
139 WriteInt( 0 ); // ChunksN |
|
140 |
|
141 PrepareInformation(); |
|
142 chunksN++; |
|
143 |
|
144 int i; |
|
145 |
|
146 for( i=0; i<iData->iTargetDeviceVector.size(); i++ ) |
|
147 { |
|
148 TSDCTargetDeviceEntry* entry = iData->iTargetDeviceVector[i]; |
|
149 PrepareTargetDevice( entry->iDeviceName ); |
|
150 chunksN++; |
|
151 } |
|
152 |
|
153 for( i=0; i<iData->iNameVector.size(); i++ ) |
|
154 { |
|
155 TSDCNameEntry* entry = iData->iNameVector[i]; |
|
156 PrepareName( entry->iLanguageID, entry->iName ); |
|
157 chunksN++; |
|
158 } |
|
159 |
|
160 if( (iData->iAHOverridePid.iPID1!=0) && (iData->iAHOverridePid.iPID2!=0) ) |
|
161 { |
|
162 PrepareLanguageOverride( 0x01, iData->iAHOverridePid ); |
|
163 chunksN++; |
|
164 } |
|
165 |
|
166 if( !iData->IsScalable() ) |
|
167 { |
|
168 for( i=0; i<iData->iBitmapDefVector.size(); i++ ) |
|
169 { |
|
170 TSDCBitmapDef* entry = iData->iBitmapDefVector[i]; |
|
171 if( (entry->iIID.iMajor == EAknsMajorSkin) && |
|
172 (entry->iIID.iMinor == EAknsMinorWallpaper) ) |
|
173 { |
|
174 PrepareWallpaper( 0x00, entry ); |
|
175 chunksN++; |
|
176 PrepareWallpaper( 0x01, entry ); |
|
177 chunksN++; |
|
178 } |
|
179 if( (entry->iIID.iMajor == EAknsMajorPinboard) && |
|
180 (entry->iIID.iMinor == EAknsMinorQsnFrPinbCenterWp) ) |
|
181 { |
|
182 PrepareWallpaper( 0x02, entry ); |
|
183 chunksN++; |
|
184 } |
|
185 } |
|
186 } |
|
187 |
|
188 if( !aStubOnly ) |
|
189 { |
|
190 char buf[512]; |
|
191 strcpy( buf, iBaseName ); |
|
192 strcat( buf, ".mbm" ); |
|
193 PrepareFilename( 0, buf ); |
|
194 chunksN++; |
|
195 |
|
196 if( iData->IsScalable() ) |
|
197 { |
|
198 strcpy( buf, iBaseName ); |
|
199 strcat( buf, ".mif" ); |
|
200 PrepareFilename( 1, buf ); |
|
201 chunksN++; |
|
202 } |
|
203 |
|
204 PrepareNormalClass( 0 ); |
|
205 chunksN++; |
|
206 |
|
207 if( !iData->IsScalable() ) |
|
208 { |
|
209 PrepareAppIconClass(); |
|
210 chunksN++; |
|
211 } |
|
212 |
|
213 // Release 2.6 specifics |
|
214 PrepareEncapsulatedNormalClass( 0x0206 ); |
|
215 chunksN++; |
|
216 |
|
217 // Release 2.7 specifics |
|
218 PrepareEncapsulatedNormalClass( 0x0207 ); |
|
219 chunksN++; |
|
220 |
|
221 // Release 2.8 specifics |
|
222 PrepareEncapsulatedNormalClass( 0x0208 ); |
|
223 chunksN++; |
|
224 |
|
225 // Release 3.0 specifics |
|
226 PrepareEncapsulatedNormalClass( 0x0300 ); |
|
227 chunksN++; |
|
228 |
|
229 // Non-mirrored |
|
230 PrepareEncapsulatedNormalClass( 0x00010000 ); |
|
231 chunksN++; |
|
232 |
|
233 // Mirrored |
|
234 PrepareEncapsulatedNormalClass( 0x00020000 ); |
|
235 chunksN++; |
|
236 |
|
237 for (int count = 0;count < iData->iLanguageVector.size(); count++) |
|
238 { |
|
239 // Language |
|
240 PrepareEncapsulatedNormalClass( iData->iLanguageVector[count] ); |
|
241 chunksN++; |
|
242 } |
|
243 } |
|
244 |
|
245 chunksNPos.Go( this ); |
|
246 WriteInt( chunksN ); |
|
247 chunksNPos.Back( this ); |
|
248 |
|
249 AppendBytes( 1*1 ); |
|
250 WriteByte( 0xf5 ); |
|
251 |
|
252 startPos.Go( this ); |
|
253 WriteUint( startPos.BackwardsDelta() ); |
|
254 startPos.Back( this ); |
|
255 } |
|
256 |
|
257 void CSDCBinOutput::PrepareTargetDevice( const wchar_t* aDeviceName ) |
|
258 { |
|
259 TPos startPos( this ); |
|
260 |
|
261 AppendBytes( 1*4 + 2*2 ); |
|
262 WriteUint( 0 ); // Length |
|
263 WriteUint16( 14 ); // Type |
|
264 WriteUint16( 1 ); // Version |
|
265 |
|
266 AppendBytes( 1*2 ); |
|
267 WriteUint16( wcslen( aDeviceName ) ); |
|
268 |
|
269 for( int i=0; i<wcslen( aDeviceName ); i++ ) |
|
270 { |
|
271 AppendBytes( 2 ); |
|
272 WriteUint16( aDeviceName[i] ); |
|
273 } |
|
274 |
|
275 AppendBytes( 1*1 ); |
|
276 WriteByte( 0xf5 ); |
|
277 |
|
278 startPos.Go( this ); |
|
279 WriteUint( startPos.BackwardsDelta() ); |
|
280 startPos.Back( this ); |
|
281 } |
|
282 |
|
283 void CSDCBinOutput::PrepareName( const short int aLanguage, const wchar_t* aName ) |
|
284 { |
|
285 TPos startPos( this ); |
|
286 |
|
287 AppendBytes( 1*4 + 2*2 ); |
|
288 WriteUint( 0 ); // Length |
|
289 WriteUint16( 1 ); // Type |
|
290 WriteUint16( 1 ); // Version |
|
291 |
|
292 AppendBytes( 2*2 ); |
|
293 WriteInt16( aLanguage ); |
|
294 WriteUint16( wcslen( aName ) ); |
|
295 |
|
296 for( int i=0; i<wcslen( aName ); i++ ) |
|
297 { |
|
298 AppendBytes( 2 ); |
|
299 WriteUint16( aName[i] ); |
|
300 } |
|
301 |
|
302 AppendBytes( 1*1 ); |
|
303 WriteByte( 0xf5 ); |
|
304 |
|
305 startPos.Go( this ); |
|
306 WriteUint( startPos.BackwardsDelta() ); |
|
307 startPos.Back( this ); |
|
308 } |
|
309 |
|
310 void CSDCBinOutput::PrepareInformation() |
|
311 { |
|
312 TPos startPos( this ); |
|
313 int i; |
|
314 |
|
315 AppendBytes( 1*4 + 2*2 ); |
|
316 WriteUint( 0 ); // Length |
|
317 WriteUint16( 11 ); // Type |
|
318 WriteUint16( 2 ); // Version |
|
319 |
|
320 AppendBytes( 2*4 ); |
|
321 SYSTEMTIME sysTime; |
|
322 GetSystemTime( &sysTime ); |
|
323 FILETIME fileTime; |
|
324 SystemTimeToFileTime( &sysTime, &fileTime ); |
|
325 WriteInt( fileTime.dwHighDateTime ); |
|
326 WriteInt( fileTime.dwLowDateTime ); |
|
327 |
|
328 AppendBytes( 2*4 ); |
|
329 WriteInt( (gVersionMajor<<16) | gVersionMinor ); |
|
330 WriteInt( 0 ); |
|
331 |
|
332 AppendBytes( 1*2 ); |
|
333 WriteUint16( wcslen( iData->iAuthor ) ); |
|
334 for( i=0; i<wcslen( iData->iAuthor ); i++ ) |
|
335 { |
|
336 AppendBytes( 2 ); |
|
337 WriteUint16( iData->iAuthor[i] ); |
|
338 } |
|
339 |
|
340 AppendBytes( 1*2 ); |
|
341 WriteUint16( wcslen( iData->iCopyright ) ); |
|
342 for( i=0; i<wcslen( iData->iCopyright ); i++ ) |
|
343 { |
|
344 AppendBytes( 2 ); |
|
345 WriteUint16( iData->iCopyright[i] ); |
|
346 } |
|
347 |
|
348 AppendBytes( 2*1 ); |
|
349 WriteByte( gPlatformMajor ); |
|
350 WriteByte( gPlatformMinor ); |
|
351 |
|
352 AppendBytes( 1*2 ); |
|
353 WriteUint16( wcslen( iData->iTool ) ); |
|
354 for( i=0; i<wcslen( iData->iTool ); i++ ) |
|
355 { |
|
356 AppendBytes( 2 ); |
|
357 WriteUint16( iData->iTool[i] ); |
|
358 } |
|
359 |
|
360 AppendBytes( 1*1 ); |
|
361 WriteByte( 0xf5 ); |
|
362 |
|
363 startPos.Go( this ); |
|
364 WriteUint( startPos.BackwardsDelta() ); |
|
365 startPos.Back( this ); |
|
366 } |
|
367 |
|
368 void CSDCBinOutput::PrepareLanguageOverride( const unsigned char aOverrideType, const TSDCPID aOverridePid ) |
|
369 { |
|
370 TPos startPos( this ); |
|
371 |
|
372 AppendBytes( 1*4 + 2*2 ); |
|
373 WriteUint( 0 ); // Length |
|
374 WriteUint16( 9 ); // Type |
|
375 WriteUint16( 1 ); // Version |
|
376 |
|
377 AppendBytes( 1*1 + 2*4 ); |
|
378 WriteByte( aOverrideType ); |
|
379 WriteInt( aOverridePid.iPID1 ); |
|
380 WriteInt( aOverridePid.iPID2 ); |
|
381 |
|
382 AppendBytes( 1*1 ); |
|
383 WriteByte( 0xf5 ); |
|
384 |
|
385 startPos.Go( this ); |
|
386 WriteUint( startPos.BackwardsDelta() ); |
|
387 startPos.Back( this ); |
|
388 } |
|
389 |
|
390 void CSDCBinOutput::PrepareWallpaper( const unsigned char aWpType, const TSDCBitmapDef* aBitmapDef ) |
|
391 { |
|
392 TPos startPos( this ); |
|
393 |
|
394 AppendBytes( 1*4 + 2*2 ); |
|
395 WriteUint( 0 ); // Length |
|
396 WriteUint16( 10 ); // Type |
|
397 WriteUint16( 1 ); // Version |
|
398 |
|
399 char buf[512]; |
|
400 strcpy( buf, iBaseName ); |
|
401 strcat( buf, ".mbm" ); |
|
402 |
|
403 AppendBytes( 1*1 + 1*2 ); |
|
404 WriteByte( aWpType ); |
|
405 WriteUint16( strlen( buf ) ); |
|
406 |
|
407 for( int i=0; i<strlen( buf ); i++ ) |
|
408 { |
|
409 AppendBytes( 2 ); |
|
410 WriteUint16( (short int)buf[i] ); |
|
411 } |
|
412 |
|
413 AppendBytes( 1*4 ); |
|
414 WriteInt( aBitmapDef->iMBMIndex ); |
|
415 |
|
416 AppendBytes( 1*1 ); |
|
417 WriteByte( 0xf5 ); |
|
418 |
|
419 startPos.Go( this ); |
|
420 WriteUint( startPos.BackwardsDelta() ); |
|
421 startPos.Back( this ); |
|
422 } |
|
423 |
|
424 void CSDCBinOutput::PrepareFilename( const int aId, const char* aFilename ) |
|
425 { |
|
426 TPos startPos( this ); |
|
427 |
|
428 AppendBytes( 1*4 + 2*2 ); |
|
429 WriteUint( 0 ); // Length |
|
430 WriteUint16( 2 ); // Type |
|
431 WriteUint16( 1 ); // Version |
|
432 |
|
433 AppendBytes( 1*4 + 1*2 ); |
|
434 WriteInt( aId ); |
|
435 WriteUint16( strlen( aFilename ) ); |
|
436 |
|
437 for( int i=0; i<strlen( aFilename ); i++ ) |
|
438 { |
|
439 AppendBytes( 2 ); |
|
440 WriteUint16( (short int)aFilename[i] ); |
|
441 } |
|
442 |
|
443 AppendBytes( 1*1 ); |
|
444 WriteByte( 0xf5 ); |
|
445 |
|
446 startPos.Go( this ); |
|
447 WriteUint( startPos.BackwardsDelta() ); |
|
448 startPos.Back( this ); |
|
449 } |
|
450 |
|
451 void CSDCBinOutput::PrepareEncapsulatedNormalClass( const int aRestriction ) |
|
452 { |
|
453 TPos restStartPos( this ); |
|
454 if( aRestriction ) |
|
455 { |
|
456 AppendBytes( 1*4 + 2*2 ); |
|
457 WriteUint( 0 ); // Length |
|
458 |
|
459 if( aRestriction==0x0206 ) |
|
460 { |
|
461 // 2.6 release restriction |
|
462 WriteUint16( 13 ); // Type |
|
463 WriteUint16( 1 ); // Version |
|
464 |
|
465 AppendBytes( 2*1 ); |
|
466 WriteByte( (aRestriction&0xff00) >> 8 ); // PlatformMajor |
|
467 WriteByte( aRestriction&0xff ); // PlatformMinor |
|
468 } |
|
469 else if( aRestriction<0x0010000 ) |
|
470 { |
|
471 // Only generic release restriction |
|
472 WriteUint16( 18 ); // Type |
|
473 WriteUint16( 1 ); // Version |
|
474 |
|
475 AppendBytes( 2*1 ); |
|
476 WriteByte( (aRestriction&0xff00) >> 8 ); // PlatformMajor |
|
477 WriteByte( aRestriction&0xff ); // PlatformMinor |
|
478 |
|
479 AppendBytes( 2*4 ); |
|
480 WriteInt( 0 ); // Reserved1 |
|
481 WriteInt( 0 ); // Reserved2 |
|
482 } |
|
483 else if (aRestriction>=0x30000) |
|
484 { |
|
485 // language restriction |
|
486 WriteUint16( 15 ); // Type |
|
487 WriteUint16( 1 ); // Version |
|
488 |
|
489 AppendBytes( 2*2 ); |
|
490 WriteUint16( 0 ) ; // GeneralR |
|
491 WriteUint16( aRestriction&0xffff ); // LanguageR |
|
492 } |
|
493 else |
|
494 { |
|
495 // Layout restriction |
|
496 WriteUint16( 15 ); // Type |
|
497 WriteUint16( 1 ); // Version |
|
498 |
|
499 AppendBytes( 2*2 ); |
|
500 WriteUint16( (aRestriction&0xffff0000) >> 16 ); // GeneralR |
|
501 WriteUint16( 0 ); // LanguageR |
|
502 } |
|
503 |
|
504 AppendBytes( 1*4 ); |
|
505 WriteInt( 1 ); // ChunksN |
|
506 } |
|
507 |
|
508 PrepareNormalClass( aRestriction ); |
|
509 |
|
510 if( aRestriction ) |
|
511 { |
|
512 AppendBytes( 1*1 ); |
|
513 WriteByte( 0xf5 ); |
|
514 |
|
515 restStartPos.Go( this ); |
|
516 WriteUint( restStartPos.BackwardsDelta() ); |
|
517 restStartPos.Back( this ); |
|
518 } |
|
519 } |
|
520 |
|
521 void CSDCBinOutput::PrepareNormalClass( const int aRestriction ) |
|
522 { |
|
523 TPos startPos( this ); |
|
524 |
|
525 AppendBytes( 1*4 + 2*2 ); |
|
526 WriteUint( 0 ); // Length |
|
527 WriteUint16( 3 ); // Type |
|
528 WriteUint16( 1 ); // Version |
|
529 |
|
530 AppendBytes( 1*1 ); |
|
531 WriteByte( 0 ); // Class |
|
532 |
|
533 int chunksN = 0; |
|
534 AppendBytes( 1*4 ); |
|
535 TPos chunksNPos( this ); |
|
536 WriteInt( 0 ); // ChunksN |
|
537 |
|
538 int i; |
|
539 for( i=0; i<iData->iBitmapDefVector.size(); i++ ) |
|
540 { |
|
541 if( iData->iBitmapDefVector[i]->iRestriction != aRestriction ) continue; |
|
542 |
|
543 if( (iData->iBitmapDefVector[i]->iAppIconBitmap==false) || iData->IsScalable() ) |
|
544 { |
|
545 PrepareBitmap( iData->iBitmapDefVector[i] ); |
|
546 chunksN++; |
|
547 } |
|
548 } |
|
549 if( iData->IsScalable() ) for( i=0; i<iData->iAppIconDefVector.size(); i++ ) |
|
550 { |
|
551 TSDCAppIconDef* entry = iData->iAppIconDefVector[i]; |
|
552 |
|
553 if( entry->iRestriction != aRestriction ) continue; |
|
554 |
|
555 TSDCImageAttributes attributes; |
|
556 attributes.iAttributeFlags = ESDCImageAttributeNone; |
|
557 attributes.iAlignmentFlags = ESDCImageAlignNone; |
|
558 attributes.iCoordX = 0; |
|
559 attributes.iCoordY = 0; |
|
560 attributes.iSizeW = 0; |
|
561 attributes.iSizeH = 0; |
|
562 PrepareImageTable( entry->iIID, entry->iIcons, attributes ); |
|
563 chunksN++; |
|
564 } |
|
565 for( i=0; i<iData->iFrameDefVector.size(); i++ ) |
|
566 { |
|
567 TSDCFrameDef* entry = iData->iFrameDefVector[i]; |
|
568 |
|
569 if( entry->iRestriction != aRestriction ) continue; |
|
570 |
|
571 TSDCImageAttributes attributes; |
|
572 attributes.iAttributeFlags = ESDCImageAttributeNone; |
|
573 attributes.iAlignmentFlags = ESDCImageAlignNone; |
|
574 attributes.iCoordX = 0; |
|
575 attributes.iCoordY = 0; |
|
576 attributes.iSizeW = 0; |
|
577 attributes.iSizeH = 0; |
|
578 PrepareImageTable( entry->iIID, entry->iElements, attributes ); |
|
579 chunksN++; |
|
580 } |
|
581 for( i=0; i<iData->iColorTableDefVector.size(); i++ ) |
|
582 { |
|
583 if( iData->iColorTableDefVector[i]->iRestriction != aRestriction ) continue; |
|
584 |
|
585 PrepareColorTable( iData->iColorTableDefVector[i] ); |
|
586 chunksN++; |
|
587 } |
|
588 for( i=0; i<iData->iBmpAnimDefVector.size(); i++ ) |
|
589 { |
|
590 if( iData->iBmpAnimDefVector[i]->iRestriction != aRestriction ) continue; |
|
591 |
|
592 TSDCImageAttributes attributes; |
|
593 attributes.iAttributeFlags = ESDCImageAttributeNone; |
|
594 attributes.iAlignmentFlags = ESDCImageAlignNone; |
|
595 attributes.iCoordX = 0; |
|
596 attributes.iCoordY = 0; |
|
597 attributes.iSizeW = 0; |
|
598 attributes.iSizeH = 0; |
|
599 PrepareBmpAnim( iData->iBmpAnimDefVector[i], attributes ); |
|
600 chunksN++; |
|
601 } |
|
602 for( i=0; i<iData->iStringDefVector.size(); i++ ) |
|
603 { |
|
604 if( iData->iStringDefVector[i]->iRestriction != aRestriction ) continue; |
|
605 |
|
606 PrepareString( iData->iStringDefVector[i] ); |
|
607 chunksN++; |
|
608 } |
|
609 if( iData->IsScalable() ) for( i=0; i<iData->iScalableItemDefVector.size(); i++ ) |
|
610 { |
|
611 if( iData->iScalableItemDefVector[i]->iRestriction != aRestriction ) continue; |
|
612 |
|
613 PrepareScalableItem( iData->iScalableItemDefVector[i] ); |
|
614 chunksN++; |
|
615 } |
|
616 if( iData->IsScalable() ) for( i=0; i<iData->iAnimationDefVector.size(); i++ ) |
|
617 { |
|
618 if( iData->iAnimationDefVector[i]->iRestriction != aRestriction ) continue; |
|
619 |
|
620 PrepareAnimation( iData->iAnimationDefVector[i] ); |
|
621 chunksN++; |
|
622 } |
|
623 |
|
624 chunksNPos.Go( this ); |
|
625 WriteInt( chunksN ); |
|
626 chunksNPos.Back( this ); |
|
627 |
|
628 AppendBytes( 1*1 ); |
|
629 WriteByte( 0xf5 ); |
|
630 |
|
631 startPos.Go( this ); |
|
632 WriteUint( startPos.BackwardsDelta() ); |
|
633 startPos.Back( this ); |
|
634 } |
|
635 |
|
636 void CSDCBinOutput::PrepareAppIconClass() |
|
637 { |
|
638 TPos startPos( this ); |
|
639 |
|
640 AppendBytes( 1*4 + 2*2 ); |
|
641 WriteUint( 0 ); // Length |
|
642 WriteUint16( 3 ); // Type |
|
643 WriteUint16( 1 ); // Version |
|
644 |
|
645 AppendBytes( 1*1 ); |
|
646 WriteByte( 1 ); // Class |
|
647 |
|
648 int chunksN = 0; |
|
649 AppendBytes( 1*4 ); |
|
650 TPos chunksNPos( this ); |
|
651 WriteInt( 0 ); // ChunksN |
|
652 |
|
653 int i; |
|
654 for( i=0; i<iData->iBitmapDefVector.size(); i++ ) |
|
655 { |
|
656 if( iData->iBitmapDefVector[i]->iAppIconBitmap == true ) |
|
657 { |
|
658 if( iData->iBitmapDefVector[i]->iRestriction ) |
|
659 throw CSDCException( ESDCContentError, "Application icon bitmap contains restrictions" ); |
|
660 PrepareBitmap( iData->iBitmapDefVector[i] ); |
|
661 chunksN++; |
|
662 } |
|
663 } |
|
664 for( i=0; i<iData->iAppIconDefVector.size(); i++ ) |
|
665 { |
|
666 TSDCAppIconDef* entry = iData->iAppIconDefVector[i]; |
|
667 if( entry->iRestriction ) |
|
668 throw CSDCException( ESDCContentError, "Application icon contains restrictions" ); |
|
669 TSDCImageAttributes attributes; |
|
670 attributes.iAttributeFlags = ESDCImageAttributeNone; |
|
671 attributes.iAlignmentFlags = ESDCImageAlignNone; |
|
672 attributes.iCoordX = 0; |
|
673 attributes.iCoordY = 0; |
|
674 attributes.iSizeW = 0; |
|
675 attributes.iSizeH = 0; |
|
676 PrepareImageTable( entry->iIID, entry->iIcons, attributes ); |
|
677 chunksN++; |
|
678 } |
|
679 |
|
680 chunksNPos.Go( this ); |
|
681 WriteInt( chunksN ); |
|
682 chunksNPos.Back( this ); |
|
683 |
|
684 AppendBytes( 1*1 ); |
|
685 WriteByte( 0xf5 ); |
|
686 |
|
687 startPos.Go( this ); |
|
688 WriteUint( startPos.BackwardsDelta() ); |
|
689 startPos.Back( this ); |
|
690 } |
|
691 |
|
692 void CSDCBinOutput::PrepareBitmap( const TSDCBitmapDef* aBitmapDef ) |
|
693 { |
|
694 TPos startPos( this ); |
|
695 |
|
696 AppendBytes( 1*4 + 2*2 ); |
|
697 WriteUint( 0 ); // Length |
|
698 WriteUint16( 4 ); // Type |
|
699 WriteUint16( 1 ); // Version |
|
700 |
|
701 AppendBytes( 5*4 ); |
|
702 WriteInt( aBitmapDef->iIID.iMajor ); |
|
703 WriteInt( aBitmapDef->iIID.iMinor ); |
|
704 if( aBitmapDef->iMBMIndex>=16384 ) |
|
705 { |
|
706 WriteInt( 1 ); // FilenameID |
|
707 } |
|
708 else |
|
709 { |
|
710 WriteInt( 0 ); // FilenameID |
|
711 } |
|
712 WriteInt( aBitmapDef->iMBMIndex ); |
|
713 WriteInt( aBitmapDef->iMaskMBMIndex ); |
|
714 |
|
715 PrepareAttributes( aBitmapDef->iAttributes ); |
|
716 |
|
717 AppendBytes( 1*1 ); |
|
718 WriteByte( 0xf5 ); |
|
719 |
|
720 startPos.Go( this ); |
|
721 WriteUint( startPos.BackwardsDelta() ); |
|
722 startPos.Back( this ); |
|
723 } |
|
724 |
|
725 void CSDCBinOutput::PrepareColorTable( const TSDCColorTableDef* aColorTableDef ) |
|
726 { |
|
727 TPos startPos( this ); |
|
728 |
|
729 AppendBytes( 1*4 + 2*2 ); |
|
730 WriteUint( 0 ); // Length |
|
731 WriteUint16( 5 ); // Type |
|
732 WriteUint16( 1 ); // Version |
|
733 |
|
734 AppendBytes( 2*4 + 1*1 ); |
|
735 WriteInt( aColorTableDef->iIID.iMajor ); |
|
736 WriteInt( aColorTableDef->iIID.iMinor ); |
|
737 WriteByte( aColorTableDef->iColors.size() ); |
|
738 |
|
739 for( int i=0; i<aColorTableDef->iColors.size(); i++ ) |
|
740 { |
|
741 AppendBytes( 1*2 + 1*4 ); |
|
742 WriteInt16( (short int)aColorTableDef->iColors[i].iIndex ); |
|
743 WriteUint( aColorTableDef->iColors[i].iRgb ); |
|
744 } |
|
745 |
|
746 TSDCImageAttributes attributes; |
|
747 attributes.iAttributeFlags = ESDCImageAttributeNone; |
|
748 if( iData->IsScalable() ) { |
|
749 attributes.iAttributeFlags |= ESDCImageAttributeNBC; |
|
750 } |
|
751 attributes.iAlignmentFlags = ESDCImageAlignNone; |
|
752 attributes.iCoordX = 0; |
|
753 attributes.iCoordY = 0; |
|
754 attributes.iSizeW = 0; |
|
755 attributes.iSizeH = 0; |
|
756 PrepareAttributes( attributes ); |
|
757 |
|
758 AppendBytes( 1*1 ); |
|
759 WriteByte( 0xf5 ); |
|
760 |
|
761 startPos.Go( this ); |
|
762 WriteUint( startPos.BackwardsDelta() ); |
|
763 startPos.Back( this ); |
|
764 } |
|
765 |
|
766 void CSDCBinOutput::PrepareBmpAnim( const TSDCBmpAnimDef* aBmpAnimDef, const TSDCImageAttributes& aAttributes ) |
|
767 { |
|
768 TPos startPos( this ); |
|
769 |
|
770 AppendBytes( 1*4 + 2*2 ); |
|
771 WriteUint( 0 ); // Length |
|
772 WriteUint16( 8 ); // Type |
|
773 WriteUint16( 1 ); // Version |
|
774 |
|
775 AppendBytes( 2*4 + 1*2 + 3*1 ); |
|
776 WriteInt( aBmpAnimDef->iIID.iMajor ); |
|
777 WriteInt( aBmpAnimDef->iIID.iMinor ); |
|
778 WriteInt16( (short int)aBmpAnimDef->iInterval ); |
|
779 WriteByte( (unsigned char)aBmpAnimDef->iPlayMode ); |
|
780 WriteByte( (unsigned char)aBmpAnimDef->iFlash ); |
|
781 WriteByte( (unsigned char)aBmpAnimDef->iFrames.size() ); |
|
782 |
|
783 for( int i=0; i<aBmpAnimDef->iFrames.size(); i++ ) |
|
784 { |
|
785 AppendBytes( 2*4 + 3*2 ); |
|
786 WriteInt( aBmpAnimDef->iFrames[i].iIID.iMajor ); |
|
787 WriteInt( aBmpAnimDef->iFrames[i].iIID.iMinor ); |
|
788 WriteInt16( (short int)aBmpAnimDef->iFrames[i].iTime ); |
|
789 WriteInt16( (short int)aBmpAnimDef->iFrames[i].iPosX ); |
|
790 WriteInt16( (short int)aBmpAnimDef->iFrames[i].iPosY ); |
|
791 } |
|
792 |
|
793 PrepareAttributes( aAttributes ); |
|
794 |
|
795 AppendBytes( 1*1 ); |
|
796 WriteByte( 0xf5 ); |
|
797 |
|
798 startPos.Go( this ); |
|
799 WriteUint( startPos.BackwardsDelta() ); |
|
800 startPos.Back( this ); |
|
801 } |
|
802 |
|
803 void CSDCBinOutput::PrepareString( const TSDCStringDef* aStringDef ) |
|
804 { |
|
805 TPos startPos( this ); |
|
806 |
|
807 AppendBytes( 1*4 + 2*2 ); |
|
808 WriteUint( 0 ); // Length |
|
809 WriteUint16( 12 ); // Type |
|
810 WriteUint16( 1 ); // Version |
|
811 |
|
812 AppendBytes( 2*4 + 1*2 ); |
|
813 WriteInt( aStringDef->iIID.iMajor ); |
|
814 WriteInt( aStringDef->iIID.iMinor ); |
|
815 WriteUint16( wcslen( aStringDef->iString ) ); |
|
816 |
|
817 for( int i=0; i<wcslen( aStringDef->iString ); i++ ) |
|
818 { |
|
819 AppendBytes( 2 ); |
|
820 WriteUint16( aStringDef->iString[i] ); |
|
821 } |
|
822 |
|
823 AppendBytes( 1*1 ); |
|
824 WriteByte( 0xf5 ); |
|
825 |
|
826 startPos.Go( this ); |
|
827 WriteUint( startPos.BackwardsDelta() ); |
|
828 startPos.Back( this ); |
|
829 } |
|
830 |
|
831 void CSDCBinOutput::PrepareScalableItem( const TSDCScalableItemDef* aItemDef ) |
|
832 { |
|
833 TPos startPos( this ); |
|
834 |
|
835 AppendBytes( 1*4 + 2*2 ); |
|
836 WriteUint( 0 ); // Length |
|
837 WriteUint16( 16 ); // Type |
|
838 WriteUint16( 1 ); // Version |
|
839 |
|
840 AppendBytes( 2*4 ); |
|
841 WriteInt( aItemDef->iIID.iMajor ); |
|
842 WriteInt( aItemDef->iIID.iMinor ); |
|
843 |
|
844 AppendBytes( 2*4 ); |
|
845 WriteInt( aItemDef->iRefIID.iMajor ); |
|
846 WriteInt( aItemDef->iRefIID.iMinor ); |
|
847 |
|
848 AppendBytes( 2*1 ); |
|
849 WriteByte( (aItemDef->iInput&0xff00) >> 8 ); |
|
850 WriteByte( aItemDef->iInput&0xff ); |
|
851 |
|
852 AppendBytes( 2*1 ); |
|
853 WriteByte( (aItemDef->iOutput&0xff00) >> 8 ); |
|
854 WriteByte( aItemDef->iOutput&0xff ); |
|
855 |
|
856 AppendBytes( 1*4 ); |
|
857 WriteUint( 0 ); // Reserved |
|
858 |
|
859 AppendBytes( 1*2 ); |
|
860 WriteUint16( aItemDef->iCommands.size() ); |
|
861 |
|
862 for( int i=0; i<aItemDef->iCommands.size(); i++ ) |
|
863 { |
|
864 PrepareEffectCommand( aItemDef->iCommands[i] ); |
|
865 } |
|
866 |
|
867 AppendBytes( 1*1 ); |
|
868 WriteByte( 0xf5 ); |
|
869 |
|
870 startPos.Go( this ); |
|
871 WriteUint( startPos.BackwardsDelta() ); |
|
872 startPos.Back( this ); |
|
873 } |
|
874 |
|
875 void CSDCBinOutput::PrepareAnimation( const TSDCAnimationDef* aItemDef ) |
|
876 { |
|
877 TPos startPos( this ); |
|
878 |
|
879 AppendBytes( 1*4 + 2*2 ); |
|
880 WriteUint( 0 ); // Length |
|
881 WriteUint16( 19 ); // Type |
|
882 WriteUint16( 1 ); // Version |
|
883 |
|
884 AppendBytes( 2*4 ); |
|
885 WriteInt( aItemDef->iIID.iMajor ); |
|
886 WriteInt( aItemDef->iIID.iMinor ); |
|
887 |
|
888 AppendBytes( 2*4 ); |
|
889 if( aItemDef->iMorphing ) |
|
890 { |
|
891 WriteByte( 1 ); |
|
892 } |
|
893 else |
|
894 { |
|
895 WriteByte( 0 ); |
|
896 } |
|
897 WriteByte( 0 ); // Reserved |
|
898 WriteUint16( 0 ); // Reserved |
|
899 WriteInt( 0 ); // Reserved |
|
900 |
|
901 AppendBytes( 2*1 ); |
|
902 WriteByte( (aItemDef->iInput&0xff00) >> 8 ); |
|
903 WriteByte( aItemDef->iInput&0xff ); |
|
904 |
|
905 AppendBytes( 2*1 ); |
|
906 WriteByte( (aItemDef->iOutput&0xff00) >> 8 ); |
|
907 WriteByte( aItemDef->iOutput&0xff ); |
|
908 |
|
909 AppendBytes( 1*4 ); |
|
910 WriteUint( aItemDef->iMinInterval ); |
|
911 |
|
912 AppendBytes( 1*2 ); |
|
913 WriteUint16( aItemDef->iPreprocessCommands.size() ); |
|
914 int i; |
|
915 for( i=0; i<aItemDef->iPreprocessCommands.size(); i++ ) |
|
916 { |
|
917 PrepareEffectCommand( aItemDef->iPreprocessCommands[i] ); |
|
918 } |
|
919 |
|
920 AppendBytes( 1*2 ); |
|
921 WriteUint16( aItemDef->iAnimCommands.size() ); |
|
922 for( i=0; i<aItemDef->iAnimCommands.size(); i++ ) |
|
923 { |
|
924 PrepareEffectCommand( aItemDef->iAnimCommands[i] ); |
|
925 } |
|
926 |
|
927 AppendBytes( 1*2 ); |
|
928 WriteUint16( aItemDef->iValues.size() ); |
|
929 for( i=0; i<aItemDef->iValues.size(); i++ ) |
|
930 { |
|
931 PrepareAnimParamGroup( aItemDef->iValues[i] ); |
|
932 } |
|
933 |
|
934 AppendBytes( 1*2 ); |
|
935 WriteUint16( aItemDef->iTimingModels.size() ); |
|
936 for( i=0; i<aItemDef->iTimingModels.size(); i++ ) |
|
937 { |
|
938 PrepareAnimParamGroup( aItemDef->iTimingModels[i] ); |
|
939 } |
|
940 |
|
941 AppendBytes( 1*2 ); |
|
942 WriteUint16( aItemDef->iSizeBoundParams.size() ); |
|
943 for( i=0; i<aItemDef->iSizeBoundParams.size(); i++ ) |
|
944 { |
|
945 PrepareAnimParamGroup( aItemDef->iSizeBoundParams[i] ); |
|
946 } |
|
947 |
|
948 AppendBytes( 1*1 ); |
|
949 WriteByte( 0xf5 ); |
|
950 |
|
951 startPos.Go( this ); |
|
952 WriteUint( startPos.BackwardsDelta() ); |
|
953 startPos.Back( this ); |
|
954 } |
|
955 |
|
956 void CSDCBinOutput::PrepareImageTable( const TSDCIID& aIID, const vector<TSDCIID> aImages, const TSDCImageAttributes& aAttributes ) |
|
957 { |
|
958 TPos startPos( this ); |
|
959 |
|
960 AppendBytes( 1*4 + 2*2 ); |
|
961 WriteUint( 0 ); // Length |
|
962 WriteUint16( 6 ); // Type |
|
963 WriteUint16( 1 ); // Version |
|
964 |
|
965 AppendBytes( 2*4 + 1*1 ); |
|
966 WriteInt( aIID.iMajor ); |
|
967 WriteInt( aIID.iMinor ); |
|
968 WriteByte( (unsigned char)aImages.size() ); |
|
969 |
|
970 for( int i=0; i<aImages.size(); i++ ) |
|
971 { |
|
972 AppendBytes( 2*4 ); |
|
973 WriteInt( aImages[i].iMajor ); |
|
974 WriteInt( aImages[i].iMinor ); |
|
975 } |
|
976 |
|
977 PrepareAttributes( aAttributes ); |
|
978 |
|
979 AppendBytes( 1*1 ); |
|
980 WriteByte( 0xf5 ); |
|
981 |
|
982 startPos.Go( this ); |
|
983 WriteUint( startPos.BackwardsDelta() ); |
|
984 startPos.Back( this ); |
|
985 } |
|
986 |
|
987 void CSDCBinOutput::PrepareAttributes( const TSDCImageAttributes& aAttributes ) |
|
988 { |
|
989 TPos startPos( this ); |
|
990 |
|
991 AppendBytes( 1*4 + 2*2 ); |
|
992 WriteUint( 0 ); // Length |
|
993 WriteUint16( 7 ); // Type |
|
994 WriteUint16( 2 ); // Version |
|
995 |
|
996 AppendBytes( 2*1 + 4*2 ); |
|
997 WriteByte( (unsigned char)(aAttributes.iAttributeFlags&0xff) ); |
|
998 WriteByte( (unsigned char)(aAttributes.iAlignmentFlags&0xff) ); |
|
999 WriteInt16( (short int)aAttributes.iCoordX ); |
|
1000 WriteInt16( (short int)aAttributes.iCoordY ); |
|
1001 WriteInt16( (short int)aAttributes.iSizeW ); |
|
1002 WriteInt16( (short int)aAttributes.iSizeH ); |
|
1003 |
|
1004 AppendBytes( 1*2 + 1*4 ); |
|
1005 WriteUint16( (unsigned short)((aAttributes.iAttributeFlags&0xffff00)>>8) ); |
|
1006 WriteUint( 0 ); // Reserved |
|
1007 |
|
1008 AppendBytes( 1*1 ); |
|
1009 WriteByte( 0xf5 ); |
|
1010 |
|
1011 startPos.Go( this ); |
|
1012 WriteUint( startPos.BackwardsDelta() ); |
|
1013 startPos.Back( this ); |
|
1014 } |
|
1015 |
|
1016 void CSDCBinOutput::PrepareParamVector( const vector<TSDCEffectParameter>& aParameters ) |
|
1017 { |
|
1018 for( int i=0; i<aParameters.size(); i++ ) |
|
1019 { |
|
1020 int type = aParameters[i].iType; |
|
1021 |
|
1022 TPos paramPos( this ); |
|
1023 |
|
1024 AppendBytes( 1*2 + 1*1 ); |
|
1025 WriteUint16( 0 ); // ParamLength |
|
1026 WriteByte( 0 ); // Reserved |
|
1027 |
|
1028 if( type == 0 || type == 3 ) |
|
1029 { |
|
1030 AppendBytes( 1*1 ); |
|
1031 WriteByte( type ); // ParamType |
|
1032 } |
|
1033 else if( type == 1 || type == 4 ) // String or raw data |
|
1034 { |
|
1035 AppendBytes( 1*1 ); |
|
1036 WriteByte( 1 ); // ParamType |
|
1037 } |
|
1038 else if( type == 2 ) |
|
1039 { |
|
1040 AppendBytes( 1*1 ); |
|
1041 WriteByte( 2 ); // ParamType |
|
1042 } |
|
1043 else |
|
1044 { |
|
1045 throw CSDCException( ESDCContentError, "Unknown parameter type in scalable item effect" ); |
|
1046 } |
|
1047 |
|
1048 AppendBytes( 1*2 ); |
|
1049 WriteUint16( wcslen(aParameters[i].iName) ); // ParamNameLen |
|
1050 |
|
1051 for( int b=0; b<wcslen(aParameters[i].iName); b++ ) |
|
1052 { |
|
1053 AppendBytes( 1*2 ); |
|
1054 WriteUint16( aParameters[i].iName[b] ); |
|
1055 } |
|
1056 |
|
1057 if( type == 0 || type == 3 ) // Number or named reference |
|
1058 { |
|
1059 AppendBytes( 1*4 ); |
|
1060 WriteInt( aParameters[i].iNumber ); |
|
1061 } |
|
1062 else if( type == 1 ) // String |
|
1063 { |
|
1064 AppendBytes( 1*2 ); |
|
1065 WriteUint16( wcslen(aParameters[i].iString) ); |
|
1066 |
|
1067 for( int a=0; a<wcslen(aParameters[i].iString); a++ ) |
|
1068 { |
|
1069 AppendBytes( 1*2 ); |
|
1070 WriteUint16( aParameters[i].iString[a] ); |
|
1071 } |
|
1072 } |
|
1073 else if( type == 2 ) // Graphics |
|
1074 { |
|
1075 AppendBytes( 3*4 ); |
|
1076 WriteInt( aParameters[i].iBmpIndex ); |
|
1077 WriteInt( aParameters[i].iMaskIndex ); |
|
1078 if( aParameters[i].iBmpIndex>=16384 ) |
|
1079 { |
|
1080 WriteInt( 1 ); // FilenameID |
|
1081 } |
|
1082 else |
|
1083 { |
|
1084 WriteInt( 0 ); // FilenameID |
|
1085 } |
|
1086 } |
|
1087 else if( type == 4 ) // Raw data |
|
1088 { |
|
1089 AppendBytes( 1*2 ); |
|
1090 WriteUint16( aParameters[i].iRawDataCount ); |
|
1091 |
|
1092 for( int a=0; a<aParameters[i].iRawDataCount; a++ ) |
|
1093 { |
|
1094 AppendBytes( 1*2 ); |
|
1095 WriteUint16( aParameters[i].iString[a] ); |
|
1096 } |
|
1097 } |
|
1098 |
|
1099 paramPos.Go( this ); |
|
1100 WriteUint16( paramPos.BackwardsDelta() ); |
|
1101 paramPos.Back( this ); |
|
1102 } |
|
1103 } |
|
1104 |
|
1105 void CSDCBinOutput::PrepareEffectCommand( const TSDCEffectCommand& aCommand ) |
|
1106 { |
|
1107 TPos startPos( this ); |
|
1108 |
|
1109 AppendBytes( 1*4 + 2*2 ); |
|
1110 WriteUint( 0 ); // Length |
|
1111 WriteUint16( 17 ); // Type |
|
1112 WriteUint16( 1 ); // Version |
|
1113 |
|
1114 AppendBytes( 1*4 ); |
|
1115 WriteInt( aCommand.iUid ); |
|
1116 |
|
1117 AppendBytes( 6*1 ); |
|
1118 WriteByte( (aCommand.iInputA&0xff00) >> 8 ); |
|
1119 WriteByte( aCommand.iInputA&0xff ); |
|
1120 WriteByte( (aCommand.iInputB&0xff00) >> 8 ); |
|
1121 WriteByte( aCommand.iInputB&0xff ); |
|
1122 WriteByte( (aCommand.iOutput&0xff00) >> 8 ); |
|
1123 WriteByte( aCommand.iOutput&0xff ); |
|
1124 |
|
1125 AppendBytes( 1*2 ); |
|
1126 WriteUint16( aCommand.iParameters.size() ); |
|
1127 |
|
1128 PrepareParamVector( aCommand.iParameters ); |
|
1129 |
|
1130 AppendBytes( 1*1 ); |
|
1131 WriteByte( 0xf5 ); |
|
1132 |
|
1133 startPos.Go( this ); |
|
1134 WriteUint( startPos.BackwardsDelta() ); |
|
1135 startPos.Back( this ); |
|
1136 } |
|
1137 |
|
1138 void CSDCBinOutput::PrepareAnimParamGroup( const TSDCAnimParamGroup& aParamGroup ) |
|
1139 { |
|
1140 TPos startPos( this ); |
|
1141 |
|
1142 AppendBytes( 1*4 + 2*2 ); |
|
1143 WriteUint( 0 ); // Length |
|
1144 WriteUint16( 20 ); // Type |
|
1145 WriteUint16( 1 ); // Version |
|
1146 |
|
1147 AppendBytes( 1*4 ); |
|
1148 WriteUint( aParamGroup.iValueA ); |
|
1149 |
|
1150 AppendBytes( 1*4 ); |
|
1151 WriteUint( aParamGroup.iValueB ); |
|
1152 |
|
1153 AppendBytes( 1*2 ); |
|
1154 WriteUint16( aParamGroup.iParameters.size() ); |
|
1155 |
|
1156 PrepareParamVector( aParamGroup.iParameters ); |
|
1157 |
|
1158 AppendBytes( 1*1 ); |
|
1159 WriteByte( 0xf5 ); |
|
1160 |
|
1161 startPos.Go( this ); |
|
1162 WriteUint( startPos.BackwardsDelta() ); |
|
1163 startPos.Back( this ); |
|
1164 } |
|
1165 |
|
1166 void CSDCBinOutput::AppendBytes( const int aNumberOfBytes ) |
|
1167 { |
|
1168 for( int i=0; i<aNumberOfBytes; i++ ) |
|
1169 iOutputVector.push_back(0); |
|
1170 } |
|
1171 |
|
1172 void CSDCBinOutput::WriteByte( const unsigned char aByte ) |
|
1173 { |
|
1174 iOutputVector.at(iOutputPos++) = aByte; |
|
1175 } |
|
1176 |
|
1177 void CSDCBinOutput::WriteInt( const int aInt ) |
|
1178 { |
|
1179 WriteUint( (unsigned int)aInt ); |
|
1180 } |
|
1181 |
|
1182 void CSDCBinOutput::WriteUint( const unsigned int aUint ) |
|
1183 { |
|
1184 unsigned char* p = (unsigned char*)(&aUint); |
|
1185 iOutputVector.at(iOutputPos++) = p[0]; |
|
1186 iOutputVector.at(iOutputPos++) = p[1]; |
|
1187 iOutputVector.at(iOutputPos++) = p[2]; |
|
1188 iOutputVector.at(iOutputPos++) = p[3]; |
|
1189 } |
|
1190 |
|
1191 void CSDCBinOutput::WriteInt16( const short int aInt ) |
|
1192 { |
|
1193 WriteUint16( (unsigned short int)aInt ); |
|
1194 } |
|
1195 |
|
1196 void CSDCBinOutput::WriteUint16( const short unsigned int aUint ) |
|
1197 { |
|
1198 unsigned char* p = (unsigned char*)(&aUint); |
|
1199 iOutputVector.at(iOutputPos++) = p[0]; |
|
1200 iOutputVector.at(iOutputPos++) = p[1]; |
|
1201 } |
|
1202 |
|
1203 // End of file |