aboutsummaryrefslogtreecommitdiffstats
path: root/Game
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Game/Code/Classes/UConfig.pas164
-rw-r--r--Game/Code/UltraStar.dpr2
-rw-r--r--Game/Code/config-win.inc70
-rw-r--r--Game/Code/switches.inc11
4 files changed, 244 insertions, 3 deletions
diff --git a/Game/Code/Classes/UConfig.pas b/Game/Code/Classes/UConfig.pas
new file mode 100644
index 00000000..51e9348e
--- /dev/null
+++ b/Game/Code/Classes/UConfig.pas
@@ -0,0 +1,164 @@
+unit UConfig;
+
+// -------------------------------------------------------------------
+// Note on version comparison (for developers only):
+// -------------------------------------------------------------------
+// Delphi (in contrast to FPC) DOESN'T support MACROS. So we
+// can't define a macro like VERSION_MAJOR(version) to extract
+// parts of the version-number or to create version numbers for
+// comparison purposes as with a MAKE_VERSION(maj, min, rev) macro.
+// So we have to define constants for every part of the version here.
+//
+// In addition FPC (in contrast to delphi) DOES NOT support floating-
+// point numbers in $IF compiler-directives (e.g. {$IF VERSION > 1.23})
+// It also DOESN'T support arithmetic operations so we aren't able to
+// compare versions this way (brackets aren't supported too):
+// {$IF VERSION > ((VER_MAJ*2)+(VER_MIN*23)+(VER_REL*1))}
+//
+// Hence we have to use fixed numbers in the directives. At least
+// Pascal allows leading 0s so 0005 equals 5 (octals are
+// preceded by & and not by 0 in FPC).
+// We also fix the count of digits for each part of the version number
+// to 3 (aaaiiirrr with aaa=major, iii=minor, rrr=release version)
+//
+// A check for a library with at least a version of 2.5.11 would look
+// like this:
+// {$IF LIB_VERSION >= 002005011}
+//
+// If you just need to check the major version do this:
+// {$IF LIB_VERSION_MAJOR >= 23}
+//
+// IMPORTANT:
+// Because this unit must be included in a uses-section it is
+// not possible to use the version-numbers in this uses-clause.
+// Example:
+// interface
+// uses
+// versions, // include this file
+// {$IF USE_UNIT_XYZ}xyz;{$IFEND} // Error: USE_UNIT_XYZ not defined
+// const
+// {$IF USE_UNIT_XYZ}test = 2;{$IFEND} // OK
+// uses
+// {$IF USE_UNIT_XYZ}xyz;{$IFEND} // OK
+//
+// Even if this file was an include-file no constants could be declared
+// before the interface's uses clause.
+// In FPC macros {$DEFINE VER:= 3} could be used to declare the version-numbers
+// but this is incompatible to Delphi. In addition macros do not allow expand
+// arithmetic expressions. Although you can define
+// {$DEFINE FPC_VER:= FPC_VERSION*1000000+FPC_RELEASE*1000+FPC_PATCH}
+// the following check would fail:
+// {$IF FPC_VERSION_INT >= 002002000}
+// would fail because FPC_VERSION_INT is interpreted as a string.
+//
+// PLEASE consider this if you use version numbers in $IF compiler-
+// directives. Otherwise you might break portability.
+// -------------------------------------------------------------------
+
+interface
+
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
+{$I switches.inc}
+
+uses
+ Sysutils;
+
+const
+ // include config-file
+ {$DEFINE IncludeConstants}
+ {$IF Defined(MSWindows)}
+ {$I ../config-win.inc}
+ {$ELSEIF Defined(Linux)}
+ {$I ../config-linux.inc}
+ {$ELSEIF Defined(Darwin)}
+ {$I ../config-macosx.inc}
+ {$ELSE}
+ {$MESSAGE Fatal 'Unknown OS'}
+ {$IFEND}
+
+{* Libraries *}
+
+ VERSION_MAJOR = 1000000;
+ VERSION_MINOR = 1000;
+ VERSION_RELEASE = 1;
+
+ (*
+ * FPC_VERSION is already defined as a macro by FPC itself.
+ * You should use the built-in macros
+ * FPC_VERSION (=PPC_MAJOR)
+ * FPC_RELEASE (=PPC_MINOR)
+ * FPC_PATCH (=PPC_RELEASE)
+ * instead of the PPC_* ones defined here.
+ * This way Windows users do not need to set this.
+ *
+ * Note: It might be necessary to enable macros ({$MACRO ON} or -Sm)
+ * first if you want to use the FPC_* macros.
+ * In FPC 2.2.0 they work even without macros being enabled but
+ * this might be different in other versions.
+ *
+ * Example (Check for version >= 2.0.1):
+ * {$IF (FPC_VERSION > 2) or ((FPC_VERSION = 2) and
+ * ( (FPC_RELEASE > 0) or ((FPC_RELEASE = 0) and
+ * (FPC_PATCH >= 1)) ))}
+ * {$DEFINE FPC_VER_201_PLUS}
+ * {$ENDIF}
+ *
+ * IMPORTANT: do NOT check this way:
+ * {$IF (FPC_VERSION >= 2) and (FPC_RELEASE >= 0) and (FPC_PATCH >= 1)}
+ * ...
+ * In this case version 3.0.0 does not match because Patch 0 is less than 1.
+ *)
+
+ //PPC_VERSION_MAJOR = @PPC_VERSION_MAJOR@;
+ //PPC_VERSION_MINOR = @PPC_VERSION_MINOR@;
+ //PPC_VERSION_RELEASE = @PPC_VERSION_RELEASE@;
+ //PPC_VERSION = (PPC_VERSION_MAJOR * VERSION_MAJOR) +
+ // (PPC_VERSION_MINOR * VERSION_MINOR) +
+ // (PPC_VERSION_RELEASE * VERSION_RELEASE);
+
+ {$IFDEF LAZARUS}
+ LAZARUS_VERSION = (LAZARUS_VERSION_MAJOR * VERSION_MAJOR) +
+ (LAZARUS_VERSION_MINOR * VERSION_MINOR) +
+ (LAZARUS_VERSION_RELEASE * VERSION_RELEASE);
+ {$ENDIF}
+
+ {$IFDEF HaveFFMpeg}
+
+ LIBAVCODEC_VERSION = (LIBAVCODEC_VERSION_MAJOR * VERSION_MAJOR) +
+ (LIBAVCODEC_VERSION_MINOR * VERSION_MINOR) +
+ (LIBAVCODEC_VERSION_RELEASE * VERSION_RELEASE);
+
+ LIBAVFORMAT_VERSION = (LIBAVFORMAT_VERSION_MAJOR * VERSION_MAJOR) +
+ (LIBAVFORMAT_VERSION_MINOR * VERSION_MINOR) +
+ (LIBAVFORMAT_VERSION_RELEASE * VERSION_RELEASE);
+
+ LIBAVUTIL_VERSION = (LIBAVUTIL_VERSION_MAJOR * VERSION_MAJOR) +
+ (LIBAVUTIL_VERSION_MINOR * VERSION_MINOR) +
+ (LIBAVUTIL_VERSION_RELEASE * VERSION_RELEASE);
+
+ {$ENDIF}
+
+ {$IFDEF HaveSWScale}
+ LIBSWSCALE_VERSION = (LIBSWSCALE_VERSION_MAJOR * VERSION_MAJOR) +
+ (LIBSWSCALE_VERSION_MINOR * VERSION_MINOR) +
+ (LIBSWSCALE_VERSION_RELEASE * VERSION_RELEASE);
+ {$ENDIF}
+
+ {$IFDEF HaveProjectM}
+ PROJECTM_VERSION = (PROJECTM_VERSION_MAJOR * VERSION_MAJOR) +
+ (PROJECTM_VERSION_MINOR * VERSION_MINOR) +
+ (PROJECTM_VERSION_RELEASE * VERSION_RELEASE);
+ {$ENDIF}
+
+ {$IFDEF HavePortaudio}
+ PORTAUDIO_VERSION = (PORTAUDIO_VERSION_MAJOR * VERSION_MAJOR) +
+ (PORTAUDIO_VERSION_MINOR * VERSION_MINOR) +
+ (PORTAUDIO_VERSION_RELEASE * VERSION_RELEASE);
+ {$ENDIF}
+
+implementation
+
+end.
diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr
index e2242d1b..18a825eb 100644
--- a/Game/Code/UltraStar.dpr
+++ b/Game/Code/UltraStar.dpr
@@ -78,6 +78,8 @@ uses
//------------------------------
//Includes - Classes
//------------------------------
+ UConfig in 'Classes\UConfig.pas',
+
UCommon in 'Classes\UCommon.pas',
UGraphic in 'Classes\UGraphic.pas',
UTexture in 'Classes\UTexture.pas',
diff --git a/Game/Code/config-win.inc b/Game/Code/config-win.inc
new file mode 100644
index 00000000..5791c579
--- /dev/null
+++ b/Game/Code/config-win.inc
@@ -0,0 +1,70 @@
+{*****************************************************************
+ * Configuration file for UltraStar Deluxe 1.1
+ *****************************************************************}
+
+{* Misc options *}
+
+{$DEFINE DEBUG}
+
+{* Libraries *}
+
+{$IF Defined(LAZARUS) and Defined(IncludeConstants)}
+ LAZARUS_VERSION_MAJOR = 0;
+ LAZARUS_VERSION_MINOR = 9;
+ LAZARUS_VERSION_RELEASE = 24;
+{$IFEND}
+
+{$DEFINE HaveFFMpeg}
+{$IF Defined(HaveFFMpeg) and Defined(IncludeConstants)}
+ av__codec = 'avcodec-51';
+ LIBAVCODEC_VERSION_MAJOR = 51;
+ LIBAVCODEC_VERSION_MINOR = 16;
+ LIBAVCODEC_VERSION_RELEASE = 0;
+
+ av__format = 'avformat-50';
+ LIBAVFORMAT_VERSION_MAJOR = 50;
+ LIBAVFORMAT_VERSION_MINOR = 5;
+ LIBAVFORMAT_VERSION_RELEASE = 0;
+
+ av__util = 'avutil-49';
+ LIBAVUTIL_VERSION_MAJOR = 49;
+ LIBAVUTIL_VERSION_MINOR = 0;
+ LIBAVUTIL_VERSION_RELEASE = 0;
+{$IFEND}
+
+{$DEFINE HaveSWScale}
+{$IF Defined(HaveSWScale) and Defined(IncludeConstants)}
+ sw__scale = 'swscale-0';
+ LIBSWSCALE_VERSION_MAJOR = 0;
+ LIBSWSCALE_VERSION_MINOR = 5;
+ LIBSWSCALE_VERSION_RELEASE = 0;
+{$IFEND}
+
+// define this for versions of ProjectM < 1.0 (use C-Interface)
+{$DEFINE HaveProjectM_0_9}
+// define this for versions of ProjectM >= 1.0 (use C++-Interface)
+{$UNDEF HaveProjectM_1_0_PLUS}
+{$IF Defined(HaveProjectM_0_9) or Defined(HaveProjectM_1_0_PLUS)}
+ {$DEFINE HaveProjectM}
+{$IFEND}
+{$IF Defined(HaveProjectM) and Defined(IncludeConstants)}
+ libprojectM = 'libprojectM';
+ // Note: Un/Define HaveProjectM_0_9 or HaveProjectM_1_0_PLUS accordingly
+ PROJECTM_VERSION_MAJOR = 0;
+ PROJECTM_VERSION_MINOR = 98;
+ PROJECTM_VERSION_RELEASE = 0;
+{$IFEND}
+
+{$UNDEF HavePortaudio}
+{$IF Defined(HavePortaudio) and Defined(IncludeConstants)}
+ libportaudio = 'portaudio_x86';
+ PORTAUDIO_VERSION_MAJOR = 19;
+ PORTAUDIO_VERSION_MINOR = 0;
+ PORTAUDIO_VERSION_RELEASE = 0;
+{$IFEND}
+
+{$UNDEF HavePortmixer}
+{$IF Defined(HavePortmixer) and Defined(IncludeConstants)}
+ libportmixer = 'portmixer';
+{$IFEND}
+
diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc
index fc21a373..29828712 100644
--- a/Game/Code/switches.inc
+++ b/Game/Code/switches.inc
@@ -32,6 +32,8 @@
{$IFDEF win32}
+ {$I config-win.inc}
+
{$DEFINE UseBASSPlayback}
{$DEFINE UseBASSInput}
@@ -39,9 +41,12 @@
//{$DEFINE UsePortaudioPlayback}
//{$DEFINE UsePortaudioInput}
//{$DEFINE UsePortmixer}
-
- {$DEFINE UseProjectM_0_9}
- //{$DEFINE UseProjectM_1_0}
+
+ {$IF Defined(HaveProjectM_0_9)}
+ {$DEFINE UseProjectM_0_9}
+ {$ELSEIF Defined(HaveProjectM_1_0_PLUS)}
+ {$DEFINE UseProjectM_1_0}
+ {$IFEND}
{$IFDEF DEBUG}
{$IFNDEF DARWIN}