From e74bd57c12f470257111c1c0530fb38f0fd34414 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sat, 12 Jan 2008 12:31:43 +0000 Subject: bunch of smaller changes... some changes to song loading... Record global changed to singleton object started implementing mic volume display in Settings-Record hope this dosnt break anything.. :P git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@789 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlatform.pas | 74 +++++++++++------------------------------ 1 file changed, 19 insertions(+), 55 deletions(-) (limited to 'Game/Code/Classes/UPlatform.pas') diff --git a/Game/Code/Classes/UPlatform.pas b/Game/Code/Classes/UPlatform.pas index 19a960e7..bfb03d54 100644 --- a/Game/Code/Classes/UPlatform.pas +++ b/Game/Code/Classes/UPlatform.pas @@ -16,7 +16,6 @@ interface uses Classes; type - TDirectoryEntry = Record Name : WideString; IsDirectory : Boolean; @@ -27,33 +26,16 @@ type IPlatform = Interface ['{63A5EBC3-3F4D-4F23-8DFB-B5165FCA23DF}'] - Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; - function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; - - function GetLogPath : WideString; - function GetGameSharedPath : WideString; - function GetGameUserPath : WideString; - end; - - TPlatform = class( TInterfacedOBject, IPlatform ) - - // DirectoryFindFiles returns all files matching the filter. Do not use '*' in the filter. - // If you set ReturnAllSubDirs = true all directories will be returned, if yout set it to false - // directories are completely ignored. - function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; virtual; abstract; - - function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; virtual; - -// function GetGamePath : WideString; virtual; - function GetLogPath : WideString; virtual; - function GetGameSharedPath : WideString; virtual; - function GetGameUserPath : WideString; virtual; - + Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; + function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; + function FindSongFile(Dir, Mask: widestring): widestring; + procedure halt; + function GetLogPath : WideString; + function GetGameSharedPath : WideString; + function GetGameUserPath : WideString; end; - -var - Platform : IPlatform; + function Platform : IPlatform; implementation @@ -69,48 +51,30 @@ uses UPlatformMacOSX; {$ENDIF} -{ TPlatform } -(* -function TPlatform.GetGamePath: WideString; -begin - // Windows and Linux use this: - Result := ExtractFilePath(ParamStr(0)); -end; -*) -function TPlatform.GetLogPath : WideString; -begin - result := ExtractFilePath(ParamStr(0)); -end; - -function TPlatform.GetGameSharedPath : WideString; -begin - result := ExtractFilePath(ParamStr(0)); -end; +// I have modified it to use the Platform_singleton in this location ( in the implementaiton ) +// so that this variable can NOT be overwritten from anywhere else in the application. +// the accessor function platform, emulates all previous calls to work the same way. +var + Platform_singleton : IPlatform; -function TPlatform.GetGameUserPath : WideString; +function Platform : IPlatform; begin - result := ExtractFilePath(ParamStr(0)); + result := Platform_singleton; end; -function TPlatform.TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; -begin - // Linux and Mac don't check for running apps at the moment - Result := false; -end; initialization - {$IFDEF MSWINDOWS} - Platform := TPlatformWindows.Create; + Platform_singleton := TPlatformWindows.Create; {$ENDIF} {$IFDEF LINUX} - Platform := TPlatformLinux.Create; + Platform_singleton := TPlatformLinux.Create; {$ENDIF} {$IFDEF DARWIN} - Platform := TPlatformMacOSX.Create; + Platform_singleton := TPlatformMacOSX.Create; {$ENDIF} finalization - Platform := nil; + Platform_singleton := nil; end. -- cgit v1.2.3