aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-18 11:16:30 +0000
committerjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-18 11:16:30 +0000
commite3fc5e2c58302159b79e0e25e183aa3e75397a41 (patch)
treebb3a3d66b990231ada3e445c2ba623f15018a5b9
parent7e2e8a8f5a195ac0c49dcb941d065dd9bf0e0256 (diff)
downloadusdx-e3fc5e2c58302159b79e0e25e183aa3e75397a41.tar.gz
usdx-e3fc5e2c58302159b79e0e25e183aa3e75397a41.tar.xz
usdx-e3fc5e2c58302159b79e0e25e183aa3e75397a41.zip
added switches.inc , which will contain compiler directives used
( at least ) for porting to linux. this file now contains compiler directive UseSerialPort, which is conditionally set depending on the compiler. at this point lazarus will not use the serial port ( LCD or Light ) units. however this functionality should be maintained at this point in delphi. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@390 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--Game/Code/Classes/ULCD.pas18
-rw-r--r--Game/Code/Classes/ULight.pas9
-rw-r--r--Game/Code/Classes/UMain.pas14
-rw-r--r--Game/Code/Screens/UScreenSong.pas11
-rw-r--r--Game/Code/UltraStar.dpr3
-rw-r--r--Game/Code/switches.inc5
6 files changed, 51 insertions, 9 deletions
diff --git a/Game/Code/Classes/ULCD.pas b/Game/Code/Classes/ULCD.pas
index a3cdac73..52b0f96a 100644
--- a/Game/Code/Classes/ULCD.pas
+++ b/Game/Code/Classes/ULCD.pas
@@ -1,6 +1,7 @@
unit ULCD;
interface
+{$I switches.inc}
type
TLCD = class
@@ -41,16 +42,24 @@ const
implementation
uses
- SysUtils, zlportio, UTime;
+ SysUtils,
+ {$IFDEF UseSerialPort}
+ zlportio,
+ {$ENDIF}
+ UTime;
procedure TLCD.WriteCommand(B: Byte);
// Wysylanie komend sterujacych
begin
- if not HalfInterface then begin
+{$IFDEF UseSerialPort}
+ if not HalfInterface then
+ begin
zlioportwrite(Control, 0, $02);
zlioportwrite(Data, 0, B);
zlioportwrite(Control, 0, $03);
- end else begin
+ end
+ else
+ begin
zlioportwrite(Control, 0, $02);
zlioportwrite(Data, 0, B and $F0);
zlioportwrite(Control, 0, $03);
@@ -66,11 +75,13 @@ begin
Sleep(2)
else
TimeSleep(0.1);
+{$ENDIF}
end;
procedure TLCD.WriteData(B: Byte);
// Wysylanie danych
begin
+{$IFDEF UseSerialPort}
if not HalfInterface then begin
zlioportwrite(Control, 0, $06);
zlioportwrite(Data, 0, B);
@@ -89,6 +100,7 @@ begin
TimeSleep(0.1);
Inc(Position);
+{$ENDIF}
end;
procedure TLCD.WriteString(S: string);
diff --git a/Game/Code/Classes/ULight.pas b/Game/Code/Classes/ULight.pas
index 1fc4aba8..b9c7af9e 100644
--- a/Game/Code/Classes/ULight.pas
+++ b/Game/Code/Classes/ULight.pas
@@ -1,5 +1,6 @@
unit ULight;
interface
+{$I switches.inc}
type
TLight = class
@@ -30,7 +31,11 @@ const
implementation
uses
- SysUtils, zlportio, UTime;
+ SysUtils,
+ {$IFDEF UseSerialPort}
+ zlportio,
+ {$ENDIF}
+ UTime;
constructor TLight.Create;
begin
@@ -45,8 +50,10 @@ end;
procedure TLight.SetState(State: integer);
begin
+ {$IFDEF UseSerialPort}
if Enabled then
PortWriteB($378, State);
+ {$ENDIF}
end;
procedure TLight.AutoSetState;
diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas
index 43010bde..e89b4785 100644
--- a/Game/Code/Classes/UMain.pas
+++ b/Game/Code/Classes/UMain.pas
@@ -1,8 +1,16 @@
unit UMain;
interface
+{$I switches.inc}
+
uses SDL, UGraphic, UMusic, URecord, UTime, SysUtils, UDisplay, UIni, ULog, ULyrics, UScreenSing,
- OpenGL12, zlportio {you can disable it and all PortWriteB calls}, ULCD, ULight, UThemes{, UScreenPopup};
+ OpenGL12,
+
+ {$IFDEF UseSerialPort}
+ zlportio {you can disable it and all PortWriteB calls},
+ {$ENDIF}
+
+ ULCD, ULight, UThemes{, UScreenPopup};
type
TPlayer = record
@@ -512,7 +520,9 @@ begin
if (TempBeat mod 4 <> 0) then Music.PlayHihat;*)
end;
- //PortWriteB($378, LPT_1 + LPT_2 * 2); // 0 zapala
+ {$IFDEF UseSerialPort}
+ // PortWriteB($378, LPT_1 + LPT_2 * 2); // 0 zapala
+ {$ENDIF}
end;
procedure NewBeatD(Sender: TScreenSing);
diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas
index 38266797..2d10c9dc 100644
--- a/Game/Code/Screens/UScreenSong.pas
+++ b/Game/Code/Screens/UScreenSong.pas
@@ -1,6 +1,7 @@
unit UScreenSong;
interface
+{$I switches.inc}
uses
UMenu, SDL, UMusic, UFiles, UTime, UDisplay, USongs, SysUtils, ULog, UThemes, UTexture, ULanguage,
@@ -344,9 +345,13 @@ begin
end;
SDLK_RETURN:
begin
- if Length(Songs.Song) > 0 then begin
-// PortWriteB($378, 0);
- if CatSongs.Song[Interaction].Main then begin // clicked on Category Button
+ if Length(Songs.Song) > 0 then
+ begin
+ {$IFDEF UseSerialPort}
+ // PortWriteB($378, 0);
+ {$ENDIF}
+ if CatSongs.Song[Interaction].Main then
+ begin // clicked on Category Button
//Show Cat in Top Left Mod
ShowCatTL (Interaction);
diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr
index bef33632..df4846b3 100644
--- a/Game/Code/UltraStar.dpr
+++ b/Game/Code/UltraStar.dpr
@@ -3,6 +3,7 @@ program UltraStar;
{$DEFINE TRANSLATE}
{$R 'UltraStar.res' 'UltraStar.rc'}
+{$I switches.inc}
uses
//------------------------------
@@ -26,8 +27,10 @@ uses
MidiFile in 'lib\midi\MidiFile.PAS',
Delphmcb in 'lib\midi\Delphmcb.PAS',
+ {$IFDEF UseSerialPort}
zlportio in 'lib\zlportio\zlportio.pas',
ddkint in 'lib\zlportio\ddkint.pas',
+ {$ENDIF}
avcodec in 'lib\ffmpeg\avcodec.pas',
avformat in 'lib\ffmpeg\avformat.pas',
diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc
new file mode 100644
index 00000000..b980e754
--- /dev/null
+++ b/Game/Code/switches.inc
@@ -0,0 +1,5 @@
+{$IFDEF FPC}
+ {$UNDEF UseSerialPort}
+{$ELSE}
+ {$DEFINE UseSerialPort}
+{$ENDIF}