aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UMain.pas
diff options
context:
space:
mode:
authoreddie-0815 <eddie-0815@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-11-20 21:02:37 +0000
committereddie-0815 <eddie-0815@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-11-20 21:02:37 +0000
commitce484ce148d1db51ddb3cda575786f0871843cb3 (patch)
tree16380707a09822ce266bc5a3e7c8427273289073 /Game/Code/Classes/UMain.pas
parent34b0cb8bd025b40f52cff91bd9c29cd02faee7c2 (diff)
downloadusdx-ce484ce148d1db51ddb3cda575786f0871843cb3.tar.gz
usdx-ce484ce148d1db51ddb3cda575786f0871843cb3.tar.xz
usdx-ce484ce148d1db51ddb3cda575786f0871843cb3.zip
Changed Platform from Interface to Class.
Added TerminateIfAlreadyRunning and GetGamePath to UPlatform.pas. Fixed a bug in THookManager.Create ("SpacetoAllocate-1"). git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@617 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--Game/Code/Classes/UMain.pas55
1 files changed, 5 insertions, 50 deletions
diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas
index c11b68d9..019e638a 100644
--- a/Game/Code/Classes/UMain.pas
+++ b/Game/Code/Classes/UMain.pas
@@ -125,7 +125,7 @@ implementation
uses USongs, UJoystick, math, UCommandLine, ULanguage, SDL_ttf,
USkins, UCovers, UCatCovers, UDataBase, UPlaylist, UDLLManager,
- UParty, UCore, UGraphicClasses, UPluginDefs;
+ UParty, UCore, UGraphicClasses, UPluginDefs, UPlatform;
const
Version = 'UltraStar Deluxe V 1.10 Alpha Build';
@@ -133,36 +133,14 @@ const
Procedure Main;
var
WndTitle: string;
- hWnd: THandle;
- I: Integer;
begin
try
WndTitle := Version;
- {$IFDEF MSWINDOWS}
- //------------------------------
- //Start more than One Time Prevention
- //------------------------------
- hWnd:= FindWindow(nil, PChar(WndTitle));
- //Programm already started
- if (hWnd <> 0) then
- begin
- I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Continue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO);
- if (I = IDYes) then
- begin
- I := 1;
- repeat
- Inc(I);
- hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I)));
- until (hWnd = 0);
- WndTitle := WndTitle + ' Instance ' + InttoStr(I);
- end
- else
- Exit;
- end;
- {$ENDIF}
-
+ if Platform.TerminateIfAlreadyRunning( {var} WndTitle) then
+ Exit;
+
//------------------------------
//StartUp - Create Classes and Load Files
//------------------------------
@@ -1008,25 +986,6 @@ begin
Player[PlayerNum].ScoreTotalI := 0;
end;
-{$IFDEF DARWIN}
-// Mac applications are packaged in directories.
-// We have to cut the last two directories
-// to get the application directory.
-Function GetGamePath : String;
-var
- x,
- i : integer;
-begin
- Result := ExtractFilePath(ParamStr(0));
- for x := 0 to 2 do begin
- i := Length(Result);
- repeat
- Delete( Result, i, 1);
- i := Length(Result);
- until (i = 0) or (Result[i] = '/');
- end;
-end;
-{$ENDIF}
//--------------------
// Function sets all Absolute Paths e.g. Song Path and makes sure the Directorys exist
@@ -1062,11 +1021,7 @@ procedure InitializePaths;
begin
-{$IFDEF DARWIN}
- GamePath := GetGamePath;
-{$ELSE}
- GamePath := ExtractFilePath(ParamStr(0));
-{$ENDIF}
+ GamePath := Platform.GetGamePath;
initialize_path( LogPath , GamePath );
initialize_path( SoundPath , GamePath + 'Sounds' + PathDelim );