From 0d997f8433e982584a0ab67a6d630d12f4314759 Mon Sep 17 00:00:00 2001
From: jaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>
Date: Thu, 11 Oct 2007 10:50:01 +0000
Subject: fixes so codebase builds in delphi now, after major FFMpeg changse
 for linux.

git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@503 b956fd51-792f-4845-bead-9b4dfca2ff2c
---
 Game/Code/Classes/ULCD.pas        | 16 ++++++++++------
 Game/Code/Classes/UVideo.pas      |  4 ++--
 Game/Code/Screens/UScreenSong.pas |  6 ++++--
 Game/Code/lib/ffmpeg/avcodec.pas  | 21 ++++++++++++++-------
 Game/Code/lib/ffmpeg/avformat.pas | 26 +++++++++++++++++++-------
 Game/Code/lib/ffmpeg/avio.pas     | 17 +++++++++++++----
 Game/Code/lib/ffmpeg/avutil.pas   | 17 ++++++++++++-----
 Game/Code/lib/ffmpeg/opt.pas      | 17 ++++++++++++-----
 Game/Code/lib/ffmpeg/rational.pas | 17 +++++++++++------
 9 files changed, 97 insertions(+), 44 deletions(-)

(limited to 'Game')

diff --git a/Game/Code/Classes/ULCD.pas b/Game/Code/Classes/ULCD.pas
index 52b0f96a..50214ad0 100644
--- a/Game/Code/Classes/ULCD.pas
+++ b/Game/Code/Classes/ULCD.pas
@@ -46,6 +46,7 @@ uses
   {$IFDEF UseSerialPort}
   zlportio,
   {$ENDIF}
+  SDL,
   UTime;
 
 procedure TLCD.WriteCommand(B: Byte);
@@ -64,7 +65,7 @@ begin
     zlioportwrite(Data, 0, B and $F0);
     zlioportwrite(Control, 0, $03);
 
-    TimeSleep(0.1);
+    SDL_Delay( 100 );
 
     zlioportwrite(Control, 0, $02);
     zlioportwrite(Data, 0, (B * 16) and $F0);
@@ -74,7 +75,7 @@ begin
   if (B=1) or (B=2) then
     Sleep(2)
   else
-    TimeSleep(0.1);
+    SDL_Delay( 100 );
 {$ENDIF}
 end;
 
@@ -82,23 +83,26 @@ procedure TLCD.WriteData(B: Byte);
 // Wysylanie danych
 begin
 {$IFDEF UseSerialPort} 
-  if not HalfInterface then begin
+  if not HalfInterface then
+  begin
     zlioportwrite(Control, 0, $06);
     zlioportwrite(Data, 0, B);
     zlioportwrite(Control, 0, $07);
-  end else begin
+  end
+  else
+  begin
     zlioportwrite(Control, 0, $06);
     zlioportwrite(Data, 0, B and $F0);
     zlioportwrite(Control, 0, $07);
 
-    TimeSleep(0.1);
+    SDL_Delay( 100 );
 
     zlioportwrite(Control, 0, $06);
     zlioportwrite(Data, 0, (B * 16) and $F0);
     zlioportwrite(Control, 0, $07);
   end;
 
-  TimeSleep(0.1);
+  SDL_Delay( 100 );
   Inc(Position);
 {$ENDIF}
 end;
diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas
index d3cd4ac7..2dd745fd 100644
--- a/Game/Code/Classes/UVideo.pas
+++ b/Game/Code/Classes/UVideo.pas
@@ -89,14 +89,14 @@ var
 implementation
 
 {$ifdef DebugDisplay}
-{$ifNdef win32}
+//{$ifNdef win32}
 
 procedure showmessage( aMessage : String );
 begin
   writeln( aMessage );
 end;
 
-{$endif}
+//{$endif}
 {$ENDIF}
 
 { ------------------------------------------------------------------------------
diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas
index b5a34f46..0bf411c1 100644
--- a/Game/Code/Screens/UScreenSong.pas
+++ b/Game/Code/Screens/UScreenSong.pas
@@ -1766,7 +1766,7 @@ begin
            ( assigned( Theme.Song ) ) AND
            ( i < length( Data )     ) THEN
         begin
-          if single( Data[i] ) > single( 1 ) then
+          if single( Data[i] ) > 1  then
           begin
             lTmp := Single(Data[i]) * Theme.Song.Equalizer.Length;
             if lTmp > Pos then
@@ -1774,8 +1774,10 @@ begin
           end;
         end;
       except
+        {$IFDEF FPC}
         on E:EInvalidOp do
-          writeln( 'UScreenSong - DOH !!!! ('+inttostr(i)+' '+ inttostr( integer( single( Data[i] ) ) )+' * '+ ')' );
+          writeln( 'UScreenSong - DOH !!!! ('+inttostr(i)+' '+ inttostr( integer( Data[i] ) )+' * '+ ')' );
+        {$ENDIF}
       end
       
     end;
diff --git a/Game/Code/lib/ffmpeg/avcodec.pas b/Game/Code/lib/ffmpeg/avcodec.pas
index c82bc329..9c232fff 100644
--- a/Game/Code/lib/ffmpeg/avcodec.pas
+++ b/Game/Code/lib/ffmpeg/avcodec.pas
@@ -22,11 +22,13 @@ in the source codes *)
 
 unit avcodec;
 
-{$LINKLIB libavutil}
-{$LINKLIB libavcodec}
-{$MODE DELPHI } (* CAT *)
-{$PACKENUM 4}    (* every enum type variables uses 4 bytes, CAT *)
-{$PACKRECORDS C}    (* GCC compatible, Record Packing, CAT *)
+{$IFDEF FPC}
+  {$LINKLIB libavutil}
+  {$LINKLIB libavcodec}
+  {$MODE DELPHI } (* CAT *)
+  {$PACKENUM 4}    (* every enum type variables uses 4 bytes, CAT *)
+  {$PACKRECORDS C}    (* GCC compatible, Record Packing, CAT *)
+{$ENDIF}
 
 interface
 
@@ -34,8 +36,13 @@ uses
   avutil, rational, opt;  // CAT
 
 const
-(* version numbers are changed by The Creative CAT *)
-  av__format = 'libavformat.51';
+{$IFDEF win32}
+  av__format = 'avformat-50.dll';
+{$ELSE}
+  av__format = 'libavformat.so';   // .0d
+//  av__format = 'libavformat.51';
+{$ENDIF}
+
 
   LIBAVUTIL_VERSION_INT   =  ((51 shl 16) + (12 shl 8) + 1);
   LIBAVUTIL_VERSION       = '51.12.1';
diff --git a/Game/Code/lib/ffmpeg/avformat.pas b/Game/Code/lib/ffmpeg/avformat.pas
index 7fd009e9..26ff0d9b 100644
--- a/Game/Code/lib/ffmpeg/avformat.pas
+++ b/Game/Code/lib/ffmpeg/avformat.pas
@@ -22,19 +22,31 @@ in the source codes *)
 
 unit avformat;
 
-{$LINKLIB libavutil}
-{$LINKLIB libavformat}
-{$MODE DELPHI } (* CAT *)
-{$PACKENUM 4}    (* every enum type variables uses 4 bytes, CAT *)
-{$PACKRECORDS C}    (* GCC compatible, Record Packing, CAT *)
+{$IFDEF FPC}
+  {$LINKLIB libavutil}
+  {$LINKLIB libavformat}
+  {$MODE DELPHI } (* CAT *)
+  {$PACKENUM 4}    (* every enum type variables uses 4 bytes, CAT *)
+  {$PACKRECORDS C}    (* GCC compatible, Record Packing, CAT *)
+{$ENDIF}
 
 interface
 
 uses
-  avcodec, avio, rational, avutil; (* CAT *)
+  avcodec,
+  avio,
+  rational,
+  avutil; (* CAT *)
 
 const
-  av__format = 'libavformat.51'; (* CAT *)
+
+
+{$IFDEF win32}
+  av__format = 'avformat-50.dll';
+{$ELSE}
+  av__format = 'libavformat.so';   // .0d
+  //av__format = 'libavformat.51'; (* CAT *)
+{$ENDIF}
 
   LIBAVUTIL_VERSION_INT   =  ((51 shl 16) + (12 shl 8) + 1);
   LIBAVUTIL_VERSION       = '51.12.1';
diff --git a/Game/Code/lib/ffmpeg/avio.pas b/Game/Code/lib/ffmpeg/avio.pas
index f1abea3e..5e40bd4e 100644
--- a/Game/Code/lib/ffmpeg/avio.pas
+++ b/Game/Code/lib/ffmpeg/avio.pas
@@ -22,15 +22,24 @@ For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT
 in the source codes *)
 
 unit avio;
-{$MODE DELPHI } (* CAT *)
-{$PACKENUM 4}    (* every enum type variables uses 4 bytes, CAT *)
-{$PACKRECORDS C}    (* GCC compatible, Record Packing, CAT *)
+{$IFDEF FPC}
+  {$MODE DELPHI } (* CAT *)
+  {$PACKENUM 4}    (* every enum type variables uses 4 bytes, CAT *)
+  {$PACKRECORDS C}    (* GCC compatible, Record Packing, CAT *)
+{$ENDIF}
 
 interface       (* Widows unit is deleted by CAT *)
 
 const
 (* version numbers are changed by The Creative CAT *)
-  av__format = 'libavformat.51';
+
+{$IFDEF win32}
+  av__format = 'avformat-50.dll';
+{$ELSE}
+  av__format = 'libavformat.so';   // .0d
+//av__format = 'libavformat.51';
+{$ENDIF}
+
 
   URL_RDONLY = 0;
   URL_WRONLY = 1;
diff --git a/Game/Code/lib/ffmpeg/avutil.pas b/Game/Code/lib/ffmpeg/avutil.pas
index 5b5d6762..8d4fe2f7 100644
--- a/Game/Code/lib/ffmpeg/avutil.pas
+++ b/Game/Code/lib/ffmpeg/avutil.pas
@@ -20,15 +20,22 @@ For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT
 in the source codes *)
 
 unit avutil;
-{$MODE DELPHI}
-{$PACKENUM 4}    (* every enum type variables uses 4 bytes, CAT *)
-{$PACKRECORDS C}    (* GCC compatible, Record Packing, CAT *)
+{$IFDEF FPC}
+  {$MODE DELPHI}
+  {$PACKENUM 4}    (* every enum type variables uses 4 bytes, CAT *)
+  {$PACKRECORDS C}    (* GCC compatible, Record Packing, CAT *)
+{$ENDIF}
 
 interface
 
 const
-(* version numbers are changed by The Creative CAT *)
-  av__util = 'libavutil.49';
+{$IFDEF win32}
+  av__util = 'avutil-49.dll';
+{$ELSE}
+  av__util = 'libavutil.so';   // .0d
+//  av__util = 'libavutil.49';
+{$ENDIF}
+
 
   LIBAVUTIL_VERSION_INT   =  ((49 shl 16) + (4 shl 8) + 1);
   LIBAVUTIL_VERSION       = '49.4.1';
diff --git a/Game/Code/lib/ffmpeg/opt.pas b/Game/Code/lib/ffmpeg/opt.pas
index 0acead1f..e70d77ad 100644
--- a/Game/Code/lib/ffmpeg/opt.pas
+++ b/Game/Code/lib/ffmpeg/opt.pas
@@ -21,9 +21,11 @@ For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT
 in the source codes *)
 
 unit opt;
-{$MODE DELPHI} (* CAT *)
-{$PACKENUM 4}    (* every enum type variables uses 4 bytes, CAT *)
-{$PACKRECORDS C}    (* GCC compatible, Record Packing, CAT *)
+{$IFDEF FPC}
+  {$MODE DELPHI} (* CAT *)
+  {$PACKENUM 4}    (* every enum type variables uses 4 bytes, CAT *)
+  {$PACKRECORDS C}    (* GCC compatible, Record Packing, CAT *)
+{$ENDIF}
 
 interface
 
@@ -43,8 +45,13 @@ type
   );
 
 const
-(* version numbers are changed by The Creative CAT *)
-  av__codec = 'libavcodec.51';
+
+{$IFDEF win32}
+  av__codec = 'avcodec-51.dll';
+{$ELSE}
+  av__codec = 'avcodec.so'; // .0d
+  // av__codec = 'libavcodec.51';
+{$ENDIF}
 
 
   AV_OPT_FLAG_ENCODING_PARAM  = 1;   ///< a generic parameter which can be set by the user for muxing or encoding
diff --git a/Game/Code/lib/ffmpeg/rational.pas b/Game/Code/lib/ffmpeg/rational.pas
index bd2cc94f..8fb3cbd8 100644
--- a/Game/Code/lib/ffmpeg/rational.pas
+++ b/Game/Code/lib/ffmpeg/rational.pas
@@ -21,16 +21,21 @@ For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT
 in the source codes *)
 
 unit rational;
-{$MODE DELPHI}  (* CAT *)
-{$PACKENUM 4}    (* every enum type variables uses 4 bytes, CAT *)
-{$PACKRECORDS C}    (* GCC compatible, Record Packing, CAT *)
+{$IFDEF FPC}
+  {$MODE DELPHI}  (* CAT *)
+  {$PACKENUM 4}    (* every enum type variables uses 4 bytes, CAT *)
+  {$PACKRECORDS C}    (* GCC compatible, Record Packing, CAT *)
+{$ENDIF}
 
 interface		(* unit windows is deleted by CAT *)
 
 const
-(* version numbers are changed by The Creative CAT *)
-  av__util = 'libavutil.49';
-
+  {$IFDEF win32}
+    av__util = 'avutil-49.dll';
+  {$ELSE}
+    av__util = 'libavutil.so';  // .0d
+//    av__util = 'libavutil.49';
+  {$ENDIF}
 type
 
 (*
-- 
cgit v1.2.3