hedgewars/SDLh.pas
changeset 6284 f571ba93d9db
parent 6283 6ec7bf51e04f
child 6285 2c3a6bece643
equal deleted inserted replaced
6283:6ec7bf51e04f 6284:f571ba93d9db
   293 
   293 
   294 /////////////////////////////////////////////////////////////////
   294 /////////////////////////////////////////////////////////////////
   295 ///////////////////////  TYPE DEFINITIONS ///////////////////////
   295 ///////////////////////  TYPE DEFINITIONS ///////////////////////
   296 /////////////////////////////////////////////////////////////////
   296 /////////////////////////////////////////////////////////////////
   297 
   297 
       
   298 // two important reference points for the wanderers of this area
       
   299 // http://www.freepascal.org/docs-html/ref/refsu5.html
       
   300 // http://www.freepascal.org/docs-html/prog/progsu144.html
       
   301 
   298 type
   302 type
   299 {$IFDEF SDL13}
   303 {$IFDEF SDL13}
   300     PSDL_Window   = Pointer;
   304     PSDL_Window   = Pointer;
   301     PSDL_Renderer = Pointer;
   305     PSDL_Renderer = Pointer;
   302     PSDL_Texture  = Pointer;
   306     PSDL_Texture  = Pointer;
   318         end;
   322         end;
   319 
   323 
   320     PSDL_PixelFormat = ^TSDL_PixelFormat;
   324     PSDL_PixelFormat = ^TSDL_PixelFormat;
   321     TSDL_PixelFormat = record
   325     TSDL_PixelFormat = record
   322 {$IFDEF SDL13}
   326 {$IFDEF SDL13}
   323         format: Longword;
   327         format: LongWord;
   324         palette: Pointer;   // actually it is a PSDL_Palette
   328         palette: Pointer;
   325         BitsPerPixel : Byte;
   329         BitsPerPixel : Byte;
   326         BytesPerPixel: Byte;
   330         BytesPerPixel: Byte;
   327         padding: array[0..1] of Byte;
   331         padding: array[0..1] of Byte;
   328         RMask : Longword;
   332         RMask : LongWord;
   329         GMask : Longword;
   333         GMask : LongWord;
   330         BMask : Longword;
   334         BMask : LongWord;
   331         AMask : Longword;
   335         AMask : LongWord;
   332         Rloss : Byte;
   336         Rloss : Byte;
   333         Gloss : Byte;
   337         Gloss : Byte;
   334         Bloss : Byte;
   338         Bloss : Byte;
   335         Aloss : Byte;
   339         Aloss : Byte;
   336         Rshift: Byte;
   340         Rshift: Byte;
   349         Aloss : Byte;
   353         Aloss : Byte;
   350         Rshift: Byte;
   354         Rshift: Byte;
   351         Gshift: Byte;
   355         Gshift: Byte;
   352         Bshift: Byte;
   356         Bshift: Byte;
   353         Ashift: Byte;
   357         Ashift: Byte;
   354         RMask : Longword;
   358         RMask : LongWord;
   355         GMask : Longword;
   359         GMask : LongWord;
   356         BMask : Longword;
   360         BMask : LongWord;
   357         AMask : Longword;
   361         AMask : LongWord;
   358         colorkey: Longword;
   362         colorkey: LongWord;
   359         alpha: Byte;
   363         alpha: Byte;
   360 {$ENDIF}
   364 {$ENDIF}
   361         end;
   365         end;
   362 
   366 
   363     SDL_eventaction = (SDL_ADDEVENT = 0, SDL_PEEPEVENT, SDL_GETEVENT);
   367     SDL_eventaction = (SDL_ADDEVENT = 0, SDL_PEEPEVENT, SDL_GETEVENT);
   364 
   368 
   365     PSDL_Surface = ^TSDL_Surface;
   369     PSDL_Surface = ^TSDL_Surface;
   366     TSDL_Surface = record
   370     T SDL_Surface = record
   367         flags : Longword;
   371         flags : LongWord;
   368         format: PSDL_PixelFormat;
   372         format: PSDL_PixelFormat;
   369         w, h  : LongInt;
   373         w, h  : LongInt;
   370         pitch : Word;
   374         pitch : {$IFDEF SDL13}LongInt{$ELSE}Word{$ENDIF};
   371         pixels: Pointer;
   375         pixels: Pointer;
   372         offset: LongInt;
   376         offset: LongInt;
   373 {$IFDEF SDL13}
   377 {$IFDEF SDL13}
   374         userdata: Pointer;
   378         userdata: Pointer;
   375         locked: LongInt;
   379         locked: LongInt;
   381         end;
   385         end;
   382 
   386 
   383 
   387 
   384     PSDL_Color = ^TSDL_Color;
   388     PSDL_Color = ^TSDL_Color;
   385     TSDL_Color = record
   389     TSDL_Color = record
   386         case byte of
   390         case Byte of
   387             0: ( r: Byte;
   391             0: ( r: Byte;
   388                  g: Byte;
   392                  g: Byte;
   389                  b: Byte;
   393                  b: Byte;
   390                  unused: Byte; );
   394                  unused: Byte; );
   391             1: ( value: Longword; );
   395             1: ( value: LongWord; );
   392         end;
   396         end;
   393 
   397 
   394 
   398 
   395     PSDL_RWops = ^TSDL_RWops;
   399     PSDL_RWops = ^TSDL_RWops;
   396     TSeek  = function( context: PSDL_RWops; offset: LongInt; whence: LongInt ): LongInt; cdecl;
   400     TSeek  = function( context: PSDL_RWops; offset: LongInt; whence: LongInt ): LongInt; cdecl;
   397     TRead  = function( context: PSDL_RWops; Ptr: Pointer; size: LongInt; maxnum : LongInt ): LongInt;  cdecl;
   401     TRead  = function( context: PSDL_RWops; Ptr: Pointer; size: LongInt; maxnum : LongInt ): LongInt;  cdecl;
   398     TWrite = function( context: PSDL_RWops; Ptr: Pointer; size: LongInt; num: LongInt ): LongInt; cdecl;
   402     TWrite = function( context: PSDL_RWops; Ptr: Pointer; size: LongInt; num: LongInt ): LongInt; cdecl;
   399     TClose = function( context: PSDL_RWops ): LongInt; cdecl;
   403     TClose = function( context: PSDL_RWops ): LongInt; cdecl;
   400 
   404 
   401     TStdio = record
   405     TStdio = record
   402         autoclose: {$IFDEF SDL13}boolean{$ELSE}LongInt{$ENDIF};
   406         autoclose: {$IFDEF SDL13}Boolean{$ELSE}LongInt{$ENDIF};
   403         fp: pointer;
   407         fp: Pointer;
   404         end;
   408         end;
   405 
   409 
   406     TMem = record
   410     TMem = record
   407         base: PByte;
   411         base: PByte;
   408         here: PByte;
   412         here: PByte;
   416     TSDL_RWops = record
   420     TSDL_RWops = record
   417         seek: TSeek;
   421         seek: TSeek;
   418         read: TRead;
   422         read: TRead;
   419         write: TWrite;
   423         write: TWrite;
   420         close: TClose;
   424         close: TClose;
   421         type_: Longword;
   425         type_: LongWord;
   422         case Byte of
   426         case Byte of
   423             0: (stdio: TStdio);
   427             0: (stdio: TStdio);
   424             1: (mem: TMem);
   428             1: (mem: TMem);
   425             2: (unknown: TUnknown);
   429             2: (unknown: TUnknown);
   426             end;
   430             end;
   430 
   434 
   431 {$IFDEF SDL13}
   435 {$IFDEF SDL13}
   432     TSDL_KeySym = record
   436     TSDL_KeySym = record
   433         scancode: LongInt;
   437         scancode: LongInt;
   434         sym: LongInt;
   438         sym: LongInt;
   435         modifier: Smallint;
   439         modifier: Word;
   436         unicode: LongInt;
   440         unicode: LongWord;
   437         end;
   441         end;
   438 
   442 
   439     TSDL_WindowEvent = record
   443     TSDL_WindowEvent = record
   440         type_: LongInt;
   444         type_: LongWord;
   441         windowID: LongInt;
   445         windowID: LongWord;
   442         event: byte;
   446         event: Byte;
   443         padding1, padding2, padding3: byte;
   447         padding1, padding2, padding3: Byte;
   444         data1, data2: LongInt;
   448         data1, data2: LongInt;
   445         end;
   449         end;
   446 
   450 
   447     // available in sdl12 but not exposed
   451     // available in sdl12 but not exposed
   448     TSDL_TextEditingEvent = record
   452     TSDL_TextEditingEvent = record
   449         type_: LongInt;
   453         type_: LongWord;
   450         windowID: LongInt;
   454         windowID: LongWord;
   451         text: array[0..31] of Byte;
   455         text: array[0..31] of Byte;
   452         start, lenght: LongInt;
   456         start, lenght: LongInt;
   453         end;
   457         end;
   454 
   458 
   455     // available in sdl12 but not exposed
   459     // available in sdl12 but not exposed
   456     TSDL_TextInputEvent = record
   460     TSDL_TextInputEvent = record
   457         type_: LongInt;
   461         type_: LongWord;
   458         windowID: LongInt;
   462         windowID: LongWord;
   459         text: array[0..31] of Byte;
   463         text: array[0..31] of Byte;
   460         end;
   464         end;
   461 
   465 
   462     TSDL_TouchFingerEvent = record
   466     TSDL_TouchFingerEvent = record
   463         type_: Longword;
   467         type_: LongWord;
   464         windowId: Longword;
   468         windowId: LongWord;
   465         touchId: Int64;
   469         touchId: Int64;
   466         fingerId: Int64;
   470         fingerId: Int64;
   467         state, padding1, padding2, padding3: Byte;
   471         state, padding1, padding2, padding3: Byte;
   468         x,y: Word;
   472         x, y: Word;
   469         dx,dy: Smallint;
   473         dx, dy: SmallInt;
   470         pressure: Word;
   474         pressure: Word;
   471         end;
   475         end;
   472 
   476 
   473     TSDL_TouchButtonEvent = record
   477     TSDL_TouchButtonEvent = record
   474         type_: Longword;
   478         type_: LongWord;
   475         windowId: Longword;
   479         windowId: LongWord;
   476         touchId: Int64;
   480         touchId: Int64;
   477         state, button, padding1, padding2: Byte;
   481         state, button, padding1, padding2: Byte;
   478         end;
   482         end;
   479 
   483 
   480     TSDL_MultiGestureEvent = record
   484     TSDL_MultiGestureEvent = record
   481         type_: Longword;
   485         type_: LongWord;
   482         windowId: Longword;
   486         windowId: LongWord;
   483         touchId: Int64;
   487         touchId: Int64;
   484         dTheta,dDist,x,y: Single;
   488         dTheta, dDist, x, y: Single;
   485         numFingers, padding: Word;
   489         numFingers, padding: Word;
   486         end;
   490         end;
   487 
   491 
   488     TSDL_DollarGestureEvent = record
   492     TSDL_DollarGestureEvent = record
   489         type_: Longword;
   493         type_: LongWord;
   490         windowId: Longword;
   494         windowId: LongWord;
   491         touchId: Int64;
   495         touchId: Int64;
   492         gesturedId: Int64;
   496         gesturedId: Int64;
   493         numFingers: Longword;
   497         numFingers: LongWord;
   494         error: Single;
   498         error: Single;
   495         end;
   499         end;
   496 
   500 
   497     TSDL_SysWMEvent = record
   501     TSDL_SysWMEvent = record
   498         type_: LongInt;
   502         type_: LongWord;
   499         msg: pointer;
   503         msg: Pointer;
   500         end;
   504         end;
   501 {$ELSE}
   505 {$ELSE}
   502     TSDL_KeySym = record
   506     TSDL_KeySym = record
   503         scancode: Byte;
   507         scancode: Byte;
   504         sym: Longword;
   508         sym: LongWord;
   505         modifier: Longword;
   509         modifier: LongWord;
   506         unicode: Word;
   510         unicode: Word;
   507         end;
   511         end;
   508 
   512 
   509     // these two are present in sdl1.3 but only for backward compatibility
       
   510     // and in 1.3 type_ is LongInt, not byte
       
   511     TSDL_ActiveEvent = record
   513     TSDL_ActiveEvent = record
   512         type_: byte;
   514         type_: Byte;
   513         gain: byte;
   515         gain: Byte;
   514         state: byte;
   516         state: Byte;
   515         end;
   517         end;
   516 
   518 
   517     TSDL_ResizeEvent = record
   519     TSDL_ResizeEvent = record
   518         type_: Byte;
   520         type_: Byte;
   519         w, h: LongInt;
   521         w, h: LongInt;
   520         end;
   522         end;
   521 {$ENDIF}
   523 {$ENDIF}
   522 
   524 
   523     TSDL_KeyboardEvent = record
   525     TSDL_KeyboardEvent = record
   524 {$IFDEF SDL13}
   526 {$IFDEF SDL13}
   525         type_: LongInt;
   527         type_: LongWord;
   526         windowID: LongInt;
   528         windowID: LongWord;
   527         state, repeat_, padding2, padding3: byte;
   529         state, repeat_, padding2, padding3: Byte;
   528 {$ELSE}
   530 {$ELSE}
   529         type_: byte;
   531         type_, which, state: Byte;
   530         which: byte;
       
   531         state: byte;
       
   532 {$ENDIF}
   532 {$ENDIF}
   533         keysym: TSDL_KeySym;
   533         keysym: TSDL_KeySym;
   534         end;
   534         end;
   535 
   535 
   536     TSDL_MouseMotionEvent = record
   536     TSDL_MouseMotionEvent = record
   537 {$IFDEF SDL13}
   537 {$IFDEF SDL13}
   538         type_: LongInt;
   538         type_: LongWord;
   539         windowID: LongInt;
   539         windowID: LongWord;
   540         state, padding1, padding2, padding3: byte;
   540         state, padding1, padding2, padding3: Byte;
   541         x, y, z, xrel, yrel : LongInt;
   541         x, y, z, xrel, yrel : LongInt;
   542 {$ELSE}
   542 {$ELSE}
   543         type_: byte;
   543         type_, which, state: Byte;
   544         which: byte;
   544         x, y, xrel, yrel : Word;
   545         state: byte;
       
   546         x, y, xrel, yrel : word;
       
   547 {$ENDIF}
   545 {$ENDIF}
   548         end;
   546         end;
   549 
   547 
   550     TSDL_MouseButtonEvent = record
   548     TSDL_MouseButtonEvent = record
   551 {$IFDEF SDL13}
   549 {$IFDEF SDL13}
   552         type_: LongInt;
   550         type_: LongWord;
   553         windowID: LongInt;
   551         windowID: LongWord;
       
   552         buttonm, state, padding1, padding2: Byte;
   554         x, y: LongInt;
   553         x, y: LongInt;
   555         padding1: byte;
   554 {$ELSE}
   556 {$ELSE}
   555         type_, which, button, state: Byte;
   557         type_,
   556         x, y: Word;
   558         which,
       
   559         button,
       
   560         state: byte;
       
   561         x, y: word;
       
   562 {$ENDIF}
   557 {$ENDIF}
   563         end;
   558         end;
   564 
   559 
   565     TSDL_MouseWheelEvent = record
   560     TSDL_MouseWheelEvent = record
   566         type_: LongInt;
   561         type_: LongWord;
   567 {$IFDEF SDL13}
   562 {$IFDEF SDL13}
   568         windowID: LongInt;
   563         windowID: LongWord;
   569 {$ELSE}
   564 {$ELSE}
   570         which: Byte;
   565         which: Byte;
   571 {$ENDIF}
   566 {$ENDIF}
   572         x, y: LongInt;
   567         x, y: LongInt;
   573         end;
   568         end;
   574 
   569 
   575     TSDL_JoyAxisEvent = record
   570     TSDL_JoyAxisEvent = record
   576         type_: {$IFDEF SDL13}LongInt{$ELSE}Byte{$ENDIF};
   571         type_: {$IFDEF SDL13}LongWord{$ELSE}Byte{$ENDIF};
   577         which: Byte;
   572         which: Byte;
   578         axis: Byte;
   573         axis: Byte;
   579 {$IFDEF SDL13}
   574 {$IFDEF SDL13}
   580         padding1, padding2: Byte;
   575         padding1, padding2: Byte;
   581         value: LongInt;
   576         value: LongInt;
   582 {$ELSE}
   577 {$ELSE}
   583         value: Smallint;
   578         value: SmallInt;
   584 {$ENDIF}
   579 {$ENDIF}
   585         end;
   580         end;
   586 
   581 
   587     TSDL_JoyBallEvent = record
   582     TSDL_JoyBallEvent = record
   588         type_: {$IFDEF SDL13}LongInt{$ELSE}Byte{$ENDIF};
   583         type_: {$IFDEF SDL13}LongWord{$ELSE}Byte{$ENDIF};
   589         which: Byte;
   584         which: Byte;
   590         ball: Byte;
   585         ball: Byte;
   591 {$IFDEF SDL13}
   586 {$IFDEF SDL13}
   592         padding1, padding2: Byte;
   587         padding1, padding2: Byte;
   593         xrel, yrel: LongInt;
   588         xrel, yrel: LongInt;
   594 {$ELSE}
   589 {$ELSE}
   595         xrel, yrel: Smallint;
   590         xrel, yrel: SmallInt;
   596 {$ENDIF}
   591 {$ENDIF}
   597         end;
   592         end;
   598 
   593 
   599     TSDL_JoyHatEvent = record
   594     TSDL_JoyHatEvent = record
   600         type_: {$IFDEF SDL13}LongInt{$ELSE}Byte{$ENDIF};
   595         type_: {$IFDEF SDL13}LongWord{$ELSE}Byte{$ENDIF};
   601         which: Byte;
   596         which: Byte;
   602         hat: Byte;
   597         hat: Byte;
   603         value: Byte;
   598         value: Byte;
   604 {$IFDEF SDL13}
   599 {$IFDEF SDL13}
   605         padding1: Byte;
   600         padding1: Byte;
   606 {$ENDIF}
   601 {$ENDIF}
   607         end;
   602         end;
   608 
   603 
   609     TSDL_JoyButtonEvent = record
   604     TSDL_JoyButtonEvent = record
   610         type_: {$IFDEF SDL13}LongInt{$ELSE}Byte{$ENDIF};
   605         type_: {$IFDEF SDL13}LongWord{$ELSE}Byte{$ENDIF};
   611         which: Byte;
   606         which: Byte;
   612         button: Byte;
   607         button: Byte;
   613         state: Byte;
   608         state: Byte;
   614 {$IFDEF SDL13}
   609 {$IFDEF SDL13}
   615         padding1: Byte;
   610         padding1: Byte;
   616 {$ENDIF}
   611 {$ENDIF}
   617         end;
   612         end;
   618 
   613 
   619     TSDL_QuitEvent = record
   614     TSDL_QuitEvent = record
   620         type_: {$IFDEF SDL13}LongInt{$ELSE}Byte{$ENDIF};
   615         type_: {$IFDEF SDL13}LongWord{$ELSE}Byte{$ENDIF};
   621         end;
   616         end;
   622 
   617 
   623     TSDL_UserEvent = record
   618     TSDL_UserEvent = record
   624 {$IFDEF SDL13}
   619 {$IFDEF SDL13}
   625         type_: LongInt;
   620         type_: LongWord;
   626         windowID: LongInt;
   621         windowID: LongWord;
   627 {$ELSE}
   622 {$ELSE}
   628         type_: Byte;
   623         type_: Byte;
   629 {$ENDIF}
   624 {$ENDIF}
   630         code: LongInt;
   625         code: LongInt;
   631         data1, data2: Pointer;
   626         data1, data2: Pointer;
   661             SDL_MULTIGESTURE: (mgesture: TSDL_MultiGestureEvent);
   656             SDL_MULTIGESTURE: (mgesture: TSDL_MultiGestureEvent);
   662             SDL_DOLLARGESTURE: (dgesture: TSDL_DollarGestureEvent);
   657             SDL_DOLLARGESTURE: (dgesture: TSDL_DollarGestureEvent);
   663             SDL_ALLEVENTS: (foo: shortstring);
   658             SDL_ALLEVENTS: (foo: shortstring);
   664 {$ELSE}
   659 {$ELSE}
   665         case Byte of
   660         case Byte of
   666             SDL_NOEVENT: (type_: byte);
   661             SDL_NOEVENT: (type_: Byte);
   667             SDL_ACTIVEEVENT: (active: TSDL_ActiveEvent);
   662             SDL_ACTIVEEVENT: (active: TSDL_ActiveEvent);
   668             SDL_KEYDOWN,
   663             SDL_KEYDOWN,
   669             SDL_KEYUP: (key: TSDL_KeyboardEvent);
   664             SDL_KEYUP: (key: TSDL_KeyboardEvent);
   670             SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent);
   665             SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent);
   671             SDL_MOUSEBUTTONDOWN,
   666             SDL_MOUSEBUTTONDOWN,
   717         SDL_GL_SWAP_CONTROL
   712         SDL_GL_SWAP_CONTROL
   718 {$ENDIF}
   713 {$ENDIF}
   719         );
   714         );
   720 
   715 
   721 {$IFDEF SDL13}
   716 {$IFDEF SDL13}
   722     TSDL_ArrayByteOrder = (  // array component order, low byte -> high byte
   717     TSDL_ArrayByteOrder = (  // array component order, low Byte -> high Byte
   723         SDL_ARRAYORDER_NONE,
   718         SDL_ARRAYORDER_NONE,
   724         SDL_ARRAYORDER_RGB,
   719         SDL_ARRAYORDER_RGB,
   725         SDL_ARRAYORDER_RGBA,
   720         SDL_ARRAYORDER_RGBA,
   726         SDL_ARRAYORDER_ARGB,
   721         SDL_ARRAYORDER_ARGB,
   727         SDL_ARRAYORDER_BGR,
   722         SDL_ARRAYORDER_BGR,
   741             end;
   736             end;
   742 
   737 
   743     {* SDL_mixer *}
   738     {* SDL_mixer *}
   744     PMixChunk = ^TMixChunk;
   739     PMixChunk = ^TMixChunk;
   745     TMixChunk = record
   740     TMixChunk = record
   746         allocated: Longword;
   741         allocated: LongWord;
   747         abuf     : PByte;
   742         abuf     : PByte;
   748         alen     : Longword;
   743         alen     : LongWord;
   749         volume   : PByte;
   744         volume   : PByte;
   750         end;
   745         end;
   751     TMusic = (MUS_CMD, MUS_WAV, MUS_MOD, MUS_MID, MUS_OGG, MUS_MP3);
   746     TMusic = (MUS_CMD, MUS_WAV, MUS_MOD, MUS_MID, MUS_OGG, MUS_MP3);
   752     TMix_Fading = (MIX_NO_FADING, MIX_FADING_OUT, MIX_FADING_IN);
   747     TMix_Fading = (MIX_NO_FADING, MIX_FADING_OUT, MIX_FADING_IN);
   753 
   748 
   754     TMidiSong = record
   749     TMidiSong = record
   755                samples : LongInt;
   750                samples : LongInt;
   756                events  : pointer;
   751                events  : Pointer;
   757                end;
   752                end;
   758 
   753 
   759     TMusicUnion = record
   754     TMusicUnion = record
   760         case Byte of
   755         case Byte of
   761              0: ( midi : TMidiSong );
   756              0: ( midi : TMidiSong );
   762              1: ( ogg  : pointer);
   757              1: ( ogg  : Pointer);
   763              end;
   758              end;
   764 
   759 
   765     PMixMusic = ^TMixMusic;
   760     PMixMusic = ^TMixMusic;
   766     TMixMusic = record
   761     TMixMusic = record
   767                  end;
   762                  end;
   768 
   763 
   769     {* SDL_net *}
   764     {* SDL_net *}
   770     TIPAddress = record
   765     TIPAddress = record
   771                   host: Longword;
   766                   host: LongWord;
   772                   port: Word;
   767                   port: Word;
   773                   end;
   768                   end;
   774 
   769 
   775     PTCPSocket = ^TTCPSocket;
   770     PTCPSocket = ^TTCPSocket;
   776     TTCPSocket = record
   771     TTCPSocket = record
   792 /////////////////////  FUNCTION DEFINITIONS /////////////////////
   787 /////////////////////  FUNCTION DEFINITIONS /////////////////////
   793 /////////////////////////////////////////////////////////////////
   788 /////////////////////////////////////////////////////////////////
   794 
   789 
   795 
   790 
   796 {* SDL *}
   791 {* SDL *}
   797 function  SDL_Init(flags: Longword): LongInt; cdecl; external SDLLibName;
   792 function  SDL_Init(flags: LongWord): LongInt; cdecl; external SDLLibName;
   798 function  SDL_InitSubSystem(flags: LongWord): LongInt; cdecl; external SDLLibName;
   793 function  SDL_InitSubSystem(flags: LongWord): LongInt; cdecl; external SDLLibName;
   799 procedure SDL_Quit; cdecl; external SDLLibName;
   794 procedure SDL_Quit; cdecl; external SDLLibName;
   800 
   795 
   801 procedure SDL_Delay(msec: Longword); cdecl; external SDLLibName;
   796 procedure SDL_Delay(msec: LongWord); cdecl; external SDLLibName;
   802 function  SDL_GetTicks: Longword; cdecl; external SDLLibName;
   797 function  SDL_GetTicks: LongWord; cdecl; external SDLLibName;
   803 
   798 
   804 function  SDL_MustLock(Surface: PSDL_Surface): Boolean;
   799 function  SDL_MustLock(Surface: PSDL_Surface): Boolean;
   805 function  SDL_LockSurface(Surface: PSDL_Surface): LongInt; cdecl; external SDLLibName;
   800 function  SDL_LockSurface(Surface: PSDL_Surface): LongInt; cdecl; external SDLLibName;
   806 procedure SDL_UnlockSurface(Surface: PSDL_Surface); cdecl; external SDLLibName;
   801 procedure SDL_UnlockSurface(Surface: PSDL_Surface); cdecl; external SDLLibName;
   807 
   802 
   808 function  SDL_GetError: PChar; cdecl; external SDLLibName;
   803 function  SDL_GetError: PChar; cdecl; external SDLLibName;
   809 
   804 
   810 function  SDL_SetVideoMode(width, height, bpp: LongInt; flags: Longword): PSDL_Surface; cdecl; external SDLLibName;
   805 function  SDL_SetVideoMode(width, height, bpp: LongInt; flags: LongWord): PSDL_Surface; cdecl; external SDLLibName;
   811 function  SDL_CreateRGBSurface(flags: Longword; Width, Height, Depth: LongInt; RMask, GMask, BMask, AMask: Longword): PSDL_Surface; cdecl; external SDLLibName;
   806 function  SDL_CreateRGBSurface(flags: LongWord; Width, Height, Depth: LongInt; RMask, GMask, BMask, AMask: LongWord): PSDL_Surface; cdecl; external SDLLibName;
   812 function  SDL_CreateRGBSurfaceFrom(pixels: Pointer; width, height, depth, pitch: LongInt; RMask, GMask, BMask, AMask: Longword): PSDL_Surface; cdecl; external SDLLibName;
   807 function  SDL_CreateRGBSurfaceFrom(pixels: Pointer; width, height, depth, pitch: LongInt; RMask, GMask, BMask, AMask: LongWord): PSDL_Surface; cdecl; external SDLLibName;
   813 procedure SDL_FreeSurface(Surface: PSDL_Surface); cdecl; external SDLLibName;
   808 procedure SDL_FreeSurface(Surface: PSDL_Surface); cdecl; external SDLLibName;
   814 function  SDL_SetColorKey(surface: PSDL_Surface; flag, key: Longword): LongInt; cdecl; external SDLLibName;
   809 function  SDL_SetColorKey(surface: PSDL_Surface; flag, key: LongWord): LongInt; cdecl; external SDLLibName;
   815 function  SDL_SetAlpha(surface: PSDL_Surface; flag, key: Longword): LongInt; cdecl; external SDLLibName;
   810 function  SDL_SetAlpha(surface: PSDL_Surface; flag, key: LongWord): LongInt; cdecl; external SDLLibName;
   816 function  SDL_ConvertSurface(src: PSDL_Surface; fmt: PSDL_PixelFormat; flags: LongInt): PSDL_Surface; cdecl; external SDLLibName;
   811 function  SDL_ConvertSurface(src: PSDL_Surface; fmt: PSDL_PixelFormat; flags: LongInt): PSDL_Surface; cdecl; external SDLLibName;
   817 
   812 
   818 function  SDL_UpperBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): LongInt; cdecl; external SDLLibName;
   813 function  SDL_UpperBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): LongInt; cdecl; external SDLLibName;
   819 function  SDL_FillRect(dst: PSDL_Surface; dstrect: PSDL_Rect; color: Longword): LongInt; cdecl; external SDLLibName;
   814 function  SDL_FillRect(dst: PSDL_Surface; dstrect: PSDL_Rect; color: LongWord): LongInt; cdecl; external SDLLibName;
   820 procedure SDL_UpdateRect(Screen: PSDL_Surface; x, y: LongInt; w, h: Longword); cdecl; external SDLLibName;
   815 procedure SDL_UpdateRect(Screen: PSDL_Surface; x, y: LongInt; w, h: LongWord); cdecl; external SDLLibName;
   821 function  SDL_Flip(Screen: PSDL_Surface): LongInt; cdecl; external SDLLibName;
   816 function  SDL_Flip(Screen: PSDL_Surface): LongInt; cdecl; external SDLLibName;
   822 
   817 
   823 procedure SDL_GetRGB(pixel: Longword; fmt: PSDL_PixelFormat; r, g, b: PByte); cdecl; external SDLLibName;
   818 procedure SDL_GetRGB(pixel: LongWord; fmt: PSDL_PixelFormat; r, g, b: PByte); cdecl; external SDLLibName;
   824 procedure SDL_GetRGBA(pixel: Longword; fmt: PSDL_PixelFormat; r, g, b, a: PByte); cdecl; external SDLLibName;
   819 procedure SDL_GetRGBA(pixel: LongWord; fmt: PSDL_PixelFormat; r, g, b, a: PByte); cdecl; external SDLLibName;
   825 function  SDL_MapRGB(format: PSDL_PixelFormat; r, g, b: Byte): Longword; cdecl; external SDLLibName;
   820 function  SDL_MapRGB(format: PSDL_PixelFormat; r, g, b: Byte): LongWord; cdecl; external SDLLibName;
   826 function  SDL_MapRGBA(format: PSDL_PixelFormat; r, g, b, a: Byte): Longword; cdecl; external SDLLibName;
   821 function  SDL_MapRGBA(format: PSDL_PixelFormat; r, g, b, a: Byte): LongWord; cdecl; external SDLLibName;
   827 
   822 
   828 function  SDL_DisplayFormat(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName;
   823 function  SDL_DisplayFormat(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName;
   829 function  SDL_DisplayFormatAlpha(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName;
   824 function  SDL_DisplayFormatAlpha(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName;
   830 
   825 
   831 function  SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; cdecl; external SDLLibName;
   826 function  SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; cdecl; external SDLLibName;
   832 function  SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: LongInt): LongInt; cdecl; external SDLLibName;
   827 function  SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: LongInt): LongInt; cdecl; external SDLLibName;
   833 
   828 
   834 {$IFDEF SDL13}
   829 {$IFDEF SDL13}
   835 function  SDL_CreateWindow(title: PChar; x,y,w,h, flags: LongInt): PSDL_Window; cdecl; external SDLLibName;
   830 function  SDL_CreateWindow(title: PChar; x,y,w,h: LongInt; flags: LongWord): PSDL_Window; cdecl; external SDLLibName;
   836 function  SDL_CreateRenderer(window: PSDL_Window; index, flags: LongInt): PSDL_Renderer; cdecl; external SDLLibName;
   831 function  SDL_CreateRenderer(window: PSDL_Window; index: LongInt; flags: LongWord): PSDL_Renderer; cdecl; external SDLLibName;
   837 function  SDL_DestroyWindow(window: PSDL_Window): LongInt; cdecl; external SDLLibName;
   832 function  SDL_DestroyWindow(window: PSDL_Window): LongInt; cdecl; external SDLLibName;
   838 function  SDL_DestroyRenderer(renderer: PSDL_Renderer): LongInt; cdecl; external SDLLibName;
   833 function  SDL_DestroyRenderer(renderer: PSDL_Renderer): LongInt; cdecl; external SDLLibName;
   839 procedure SDL_SetWindowSize(window: PSDL_Window; w, h: LongInt); cdecl; external SDLLibName;
   834 procedure SDL_SetWindowSize(window: PSDL_Window; w, h: LongInt); cdecl; external SDLLibName;
   840 function  SDL_GetCurrentVideoDriver:Pchar; cdecl; external SDLLibName;
   835 function  SDL_GetCurrentVideoDriver:Pchar; cdecl; external SDLLibName;
   841 
   836 
   846 
   841 
   847 procedure SDL_VideoQuit; cdecl; external SDLLibName;
   842 procedure SDL_VideoQuit; cdecl; external SDLLibName;
   848 function  SDL_GetNumVideoDisplays: LongInt; cdecl; external SDLLibName;
   843 function  SDL_GetNumVideoDisplays: LongInt; cdecl; external SDLLibName;
   849 procedure SDL_ShowWindow(window: PSDL_Window); cdecl; external SDLLibName;
   844 procedure SDL_ShowWindow(window: PSDL_Window); cdecl; external SDLLibName;
   850 
   845 
   851 function  SDL_SetRenderDrawColor(renderer: PSDL_Renderer; r,g,b,a: byte): LongInt; cdecl; external SDLLibName;
   846 function  SDL_SetRenderDrawColor(renderer: PSDL_Renderer; r,g,b,a: Byte): LongInt; cdecl; external SDLLibName;
   852 function  SDL_GetRenderer(window: PSDL_Window): PSDL_Renderer; cdecl; external SDLLibName;
   847 function  SDL_GetRenderer(window: PSDL_Window): PSDL_Renderer; cdecl; external SDLLibName;
   853 function  SDL_RenderFillRect(renderer: PSDL_Renderer; rect: PSDL_Rect): LongInt; cdecl; external SDLLibName;
   848 function  SDL_RenderFillRect(renderer: PSDL_Renderer; rect: PSDL_Rect): LongInt; cdecl; external SDLLibName;
   854 function  SDL_RenderClear(renderer: PSDL_Renderer): LongInt; cdecl; external SDLLibName;
   849 function  SDL_RenderClear(renderer: PSDL_Renderer): LongInt; cdecl; external SDLLibName;
   855 procedure SDL_RenderPresent(renderer: PSDL_Renderer); cdecl; external SDLLibName;
   850 procedure SDL_RenderPresent(renderer: PSDL_Renderer); cdecl; external SDLLibName;
   856 function  SDL_RenderReadPixels(renderer: PSDL_Renderer; rect: PSDL_Rect; format: LongInt; pixels: pointer; pitch: LongInt): LongInt; cdecl; external SDLLibName;
   851 function  SDL_RenderReadPixels(renderer: PSDL_Renderer; rect: PSDL_Rect; format: LongInt; pixels: Pointer; pitch: LongInt): LongInt; cdecl; external SDLLibName;
   857 function  SDL_RenderSetViewport(window: PSDL_Window; rect: PSDL_Rect): LongInt; cdecl; external SDLLibName;
   852 function  SDL_RenderSetViewport(window: PSDL_Window; rect: PSDL_Rect): LongInt; cdecl; external SDLLibName;
   858 
   853 
   859 function  SDL_SelectMouse(index: LongInt): LongInt; cdecl; external SDLLibName;
       
   860 function  SDL_GetRelativeMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   854 function  SDL_GetRelativeMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   861 function  SDL_GetNumMice: LongInt; cdecl; external SDLLibName;
   855 function  SDL_PixelFormatEnumToMasks(format: TSDL_ArrayByteOrder; bpp: PLongInt; Rmask, Gmask, Bmask, Amask: PLongInt): Boolean; cdecl; external SDLLibName;
   862 function  SDL_PixelFormatEnumToMasks(format: TSDL_ArrayByteOrder; bpp: PLongInt; Rmask, Gmask, Bmask, Amask: PLongInt): boolean; cdecl; external SDLLibName;
       
   863 
   856 
   864 procedure SDL_WarpMouseInWindow(window: PSDL_Window; x, y: LongInt); cdecl; external SDLLibName;
   857 procedure SDL_WarpMouseInWindow(window: PSDL_Window; x, y: LongInt); cdecl; external SDLLibName;
   865 function  SDL_SetHint(name, value: PChar): boolean; cdecl; external SDLLibName;
   858 function  SDL_SetHint(name, value: PChar): Boolean; cdecl; external SDLLibName;
   866 procedure SDL_StartTextInput; cdecl; external SDLLibName;
   859 procedure SDL_StartTextInput; cdecl; external SDLLibName;
   867 
   860 
   868 function  SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: SDL_eventaction; minType, maxType: LongInt): LongInt; cdecl; external SDLLibName;
   861 function  SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: SDL_eventaction; minType, maxType: LongWord): LongInt; cdecl; external SDLLibName;
   869 {$ELSE}
   862 {$ELSE}
   870 function  SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: SDL_eventaction; mask: Longword): LongInt; cdecl; external SDLLibName;
   863 function  SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: SDL_eventaction; mask: LongWord): LongInt; cdecl; external SDLLibName;
   871 {$ENDIF}
   864 {$ENDIF}
   872 
   865 
   873 function  SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   866 function  SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   874 function  SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName;
   867 function  SDL_GetKeyName(key: LongWord): PChar; cdecl; external SDLLibName;
   875 
   868 
   876 procedure SDL_PumpEvents; cdecl; external SDLLibName;
   869 procedure SDL_PumpEvents; cdecl; external SDLLibName;
   877 function  SDL_PollEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName;
   870 function  SDL_PollEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName;
   878 function  SDL_WaitEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName;
   871 function  SDL_WaitEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName;
   879 procedure SDL_SetEventFilter( filter : TSDL_EventFilter ); cdecl; external SDLLibName;
   872 procedure SDL_SetEventFilter(filter: TSDL_EventFilter); cdecl; external SDLLibName;
   880 
   873 
   881 function  SDL_ShowCursor(toggle: LongInt): LongInt; cdecl; external SDLLibName;
   874 function  SDL_ShowCursor(toggle: LongInt): LongInt; cdecl; external SDLLibName;
   882 
   875 
   883 procedure SDL_WM_SetIcon(icon: PSDL_Surface; mask : byte); cdecl; external SDLLibName;
   876 procedure SDL_WM_SetIcon(icon: PSDL_Surface; mask : Byte); cdecl; external SDLLibName;
   884 procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName;
   877 procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName;
   885 function  SDL_WM_ToggleFullScreen(surface: PSDL_Surface): LongInt; cdecl; external SDLLibName;
   878 function  SDL_WM_ToggleFullScreen(surface: PSDL_Surface): LongInt; cdecl; external SDLLibName;
   886 
   879 
   887 function  SDL_CreateMutex: PSDL_mutex; cdecl; external SDLLibName;
   880 function  SDL_CreateMutex: PSDL_mutex; cdecl; external SDLLibName;
   888 procedure SDL_DestroyMutex(mutex: PSDL_mutex); cdecl; external SDLLibName;
   881 procedure SDL_DestroyMutex(mutex: PSDL_mutex); cdecl; external SDLLibName;
   915 {$ENDIF}
   908 {$ENDIF}
   916 
   909 
   917 {* Compatibility between SDL-1.2 and SDL-1.3 *}
   910 {* Compatibility between SDL-1.2 and SDL-1.3 *}
   918 procedure SDL_WarpMouse(x, y: Word); {$IFNDEF SDL13}cdecl; external SDLLibName;{$ENDIF}
   911 procedure SDL_WarpMouse(x, y: Word); {$IFNDEF SDL13}cdecl; external SDLLibName;{$ENDIF}
   919 function  SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName {$IFDEF SDL13} name 'SDL_GetKeyboardState'{$ENDIF};
   912 function  SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName {$IFDEF SDL13} name 'SDL_GetKeyboardState'{$ENDIF};
   920 function  SDL_AllocFormat(format: Longword): PSDL_PixelFormat; {$IFDEF SDL13}cdecl; external SDLLibName;{$ENDIF}
   913 function  SDL_AllocFormat(format: LongWord): PSDL_PixelFormat; {$IFDEF SDL13}cdecl; external SDLLibName;{$ENDIF}
   921 procedure SDL_FreeFormat(pixelformat: PSDL_PixelFormat); {$IFDEF SDL13}cdecl; external SDLLibName;{$ENDIF}
   914 procedure Boolean(pixelformat: PSDL_PixelFormat); {$IFDEF SDL13}cdecl; external SDLLibName;{$ENDIF}
   922 function  SDL_VideoDriverName(namebuf: PChar; maxlen: LongInt): PChar; {$IFNDEF SDL13}cdecl; external SDLLibName;{$ENDIF}
   915 function  SDL_VideoDriverName(namebuf: PChar; maxlen: LongInt): PChar; {$IFNDEF SDL13}cdecl; external SDLLibName;{$ENDIF}
   923 function  SDL_EnableUNICODE(enable: LongInt): LongInt; {$IFNDEF SDL13}cdecl; external SDLLibName;{$ENDIF}
   916 function  SDL_EnableUNICODE(enable: LongInt): LongInt; {$IFNDEF SDL13}cdecl; external SDLLibName;{$ENDIF}
   924 function  SDL_EnableKeyRepeat(delay_, interval: LongInt): LongInt; {$IFNDEF SDL13}cdecl; external SDLLibName;{$ENDIF}
   917 function  SDL_EnableKeyRepeat(delay_, interval: LongInt): LongInt; {$IFNDEF SDL13}cdecl; external SDLLibName;{$ENDIF}
   925 
   918 
   926 (*  SDL_ttf  *)
   919 (*  SDL_ttf  *)
   991 procedure SDLNet_FreeSocketSet(_set: PSDLNet_SocketSet); cdecl; external SDL_NetLibName;
   984 procedure SDLNet_FreeSocketSet(_set: PSDLNet_SocketSet); cdecl; external SDL_NetLibName;
   992 function  SDLNet_AddSocket(_set: PSDLNet_SocketSet; sock: PTCPSocket): LongInt; cdecl; external SDL_NetLibName;
   985 function  SDLNet_AddSocket(_set: PSDLNet_SocketSet; sock: PTCPSocket): LongInt; cdecl; external SDL_NetLibName;
   993 function  SDLNet_CheckSockets(_set: PSDLNet_SocketSet; timeout: LongInt): LongInt; cdecl; external SDL_NetLibName;
   986 function  SDLNet_CheckSockets(_set: PSDLNet_SocketSet; timeout: LongInt): LongInt; cdecl; external SDL_NetLibName;
   994 
   987 
   995 
   988 
   996 procedure SDLNet_Write16(value: Word; buf: pointer);
   989 procedure SDLNet_Write16(value: Word; buf: Pointer);
   997 procedure SDLNet_Write32(value: LongWord; buf: pointer);
   990 procedure SDLNet_Write32(value: LongWord; buf: Pointer);
   998 function  SDLNet_Read16(buf: pointer): Word;
   991 function  SDLNet_Read16(buf: Pointer): Word;
   999 function  SDLNet_Read32(buf: pointer): LongWord;
   992 function  SDLNet_Read32(buf: Pointer): LongWord;
  1000 
   993 
  1001 implementation
   994 implementation
  1002 uses strings, uVariables;
   995 uses strings, uVariables;
  1003 
   996 
  1004 {$IFDEF SDL13}
   997 {$IFDEF SDL13}
  1030 function SDL_EnableKeyRepeat(delay_, interval: LongInt): LongInt;
  1023 function SDL_EnableKeyRepeat(delay_, interval: LongInt): LongInt;
  1031 begin
  1024 begin
  1032     exit(0);
  1025     exit(0);
  1033 end;
  1026 end;
  1034 {$ELSE}
  1027 {$ELSE}
  1035 function SDL_AllocFormat(format: Longword): PSDL_PixelFormat;
  1028 function SDL_AllocFormat(format: LongWord): PSDL_PixelFormat;
  1036 const conversionFormat: TSDL_PixelFormat = (
  1029 const conversionFormat: TSDL_PixelFormat = (
  1037         palette: nil; BitsPerPixel: 32; BytesPerPixel: 4;
  1030         palette: nil; BitsPerPixel: 32; BytesPerPixel: 4;
  1038         Rloss: 0; Gloss: 0; Bloss: 0; Aloss: 0;
  1031         Rloss: 0; Gloss: 0; Bloss: 0; Aloss: 0;
  1039         Rshift: RShift; Gshift: GShift; Bshift: BShift; Ashift: AShift;
  1032         Rshift: RShift; Gshift: GShift; Bshift: BShift; Ashift: AShift;
  1040         RMask: RMask; GMask: GMask; BMask: BMask; AMask: AMask;
  1033         RMask: RMask; GMask: GMask; BMask: BMask; AMask: AMask;
  1080 procedure IMG_Quit;
  1073 procedure IMG_Quit;
  1081 begin
  1074 begin
  1082 end;
  1075 end;
  1083 {$ENDIF}
  1076 {$ENDIF}
  1084 
  1077 
  1085 procedure SDLNet_Write16(value: Word; buf: pointer);
  1078 procedure SDLNet_Write16(value: Word; buf: Pointer);
  1086 begin
  1079 begin
  1087     PByteArray(buf)^[1]:= value;
  1080     PByteArray(buf)^[1]:= value;
  1088     PByteArray(buf)^[0]:= value shr 8
  1081     PByteArray(buf)^[0]:= value shr 8
  1089 end;
  1082 end;
  1090 
  1083 
  1091 procedure SDLNet_Write32(value: LongWord; buf: pointer);
  1084 procedure SDLNet_Write32(value: LongWord; buf: Pointer);
  1092 begin
  1085 begin
  1093     PByteArray(buf)^[3]:= value;
  1086     PByteArray(buf)^[3]:= value;
  1094     PByteArray(buf)^[2]:= value shr  8;
  1087     PByteArray(buf)^[2]:= value shr  8;
  1095     PByteArray(buf)^[1]:= value shr 16;
  1088     PByteArray(buf)^[1]:= value shr 16;
  1096     PByteArray(buf)^[0]:= value shr 24
  1089     PByteArray(buf)^[0]:= value shr 24
  1097 end;
  1090 end;
  1098 
  1091 
  1099 function SDLNet_Read16(buf: pointer): Word;
  1092 function SDLNet_Read16(buf: Pointer): Word;
  1100 begin
  1093 begin
  1101     SDLNet_Read16:= PByteArray(buf)^[1] or
  1094     SDLNet_Read16:= PByteArray(buf)^[1] or
  1102                  (PByteArray(buf)^[0] shl 8)
  1095                  (PByteArray(buf)^[0] shl 8)
  1103 end;
  1096 end;
  1104 
  1097 
  1105 function SDLNet_Read32(buf: pointer): LongWord;
  1098 function SDLNet_Read32(buf: Pointer): LongWord;
  1106 begin
  1099 begin
  1107     SDLNet_Read32:=  PByteArray(buf)^[3] or
  1100     SDLNet_Read32:=  PByteArray(buf)^[3] or
  1108                   (PByteArray(buf)^[2] shl  8) or
  1101                   (PByteArray(buf)^[2] shl  8) or
  1109                   (PByteArray(buf)^[1] shl 16) or
  1102                   (PByteArray(buf)^[1] shl 16) or
  1110                   (PByteArray(buf)^[0] shl 24)
  1103                   (PByteArray(buf)^[0] shl 24)