aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UFiles.pas
diff options
context:
space:
mode:
authorjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-12 12:43:38 +0000
committerjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-12 12:43:38 +0000
commit6e7b96ca3a7d47b0441bed904a9b8bb25c3223de (patch)
tree2c0fa5010e7e8c37000d7fdd52d9e919e3f0555a /Game/Code/Classes/UFiles.pas
parent08ad90ec9f574c7dc153c8d40169f3a58c9beb9a (diff)
downloadusdx-6e7b96ca3a7d47b0441bed904a9b8bb25c3223de.tar.gz
usdx-6e7b96ca3a7d47b0441bed904a9b8bb25c3223de.tar.xz
usdx-6e7b96ca3a7d47b0441bed904a9b8bb25c3223de.zip
* added missed dependency PNGImage.
* moved FUNCTION InitializePaths(), from uFiles to uMain as this is a more sane location for it. * updated files that used UFiles to point to UMain, and removed uFiles where its not needed. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@385 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes/UFiles.pas')
-rw-r--r--Game/Code/Classes/UFiles.pas113
1 files changed, 56 insertions, 57 deletions
diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas
index e6982a1a..008061a4 100644
--- a/Game/Code/Classes/UFiles.pas
+++ b/Game/Code/Classes/UFiles.pas
@@ -2,9 +2,12 @@ unit UFiles;
interface
-uses USongs, SysUtils, ULog, UMusic;
+uses SysUtils,
+ ULog,
+ UMusic,
+ USongs;
-procedure InitializePaths; //Function sets All Absolute Paths eg. for Songs
+//procedure InitializePaths; //Function sets All Absolute Paths eg. for Songs
function ReadTXTHeader(var Song: TSong): boolean; //Reads Standard TXT Header
function AnalyseFile(var Song: TSong): boolean; //Analyse Song File and Read Header
procedure ClearSong(var Song: TSong); //Clears Song Header values
@@ -13,12 +16,13 @@ procedure ClearSong(var Song: TSong); //Clears Song Header values
procedure ResetSingTemp;
procedure ParseNote(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string);
procedure NewSentence(NrCzesciP: integer; Param1, Param2: integer);
-function LoadSong(Name: string): boolean;
-function SaveSong(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean;
+function LoadSong(Name: string): boolean;
+function SaveSong(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean;
var
+{*
//Absolute Paths
GamePath: string;
SoundPath: string;
@@ -30,6 +34,7 @@ var
LanguagesPath: string;
PluginPath: string;
PlayListPath: string;
+*}
SongFile: TextFile; // all procedures in this unit operates on this file
FileLineNo: integer; //Line which is readed at Last, for error reporting
@@ -41,57 +46,51 @@ var
MultBPM: integer = 4;
implementation
-uses TextGL, UIni, UMain;
+uses TextGL,
+ UIni,
+ UMain;
+{*
//--------------------
// Function sets all Absolute Paths e.g. Song Path and makes sure the Directorys exist
//--------------------
procedure InitializePaths;
-var
- Writeable: Boolean;
-begin
- GamePath := ExtractFilePath(ParamStr(0));
-
- SoundPath := GamePath + 'Sounds\';
- SongPath := GamePath + 'Songs\';
- LogPath := GamePath;
- ThemePath := GamePath + 'Themes\';
- ScreenshotsPath := GamePath + 'Screenshots\';
- CoversPath := GamePath + 'Covers\';
- LanguagesPath := GamePath + 'Languages\';
- PluginPath := GamePath + 'Plugins\';
- PlaylistPath := GamePath + 'Playlists\';
-
- //After Setting Paths, make sure that Paths exist
- If not DirectoryExists(SoundPath) then
- Writeable := ForceDirectories(SoundPath);
-
- If Writeable And (not DirectoryExists(SongPath)) then
- Writeable := ForceDirectories(SongPath);
-
- If Writeable And (not DirectoryExists(ThemePath)) then
- Writeable := ForceDirectories(ThemePath);
- If Writeable And (not DirectoryExists(ScreenshotsPath)) then
- Writeable := ForceDirectories(ScreenshotsPath);
-
- If Writeable And (not DirectoryExists(CoversPath)) then
- Writeable := ForceDirectories(CoversPath);
-
- If Writeable And (not DirectoryExists(LanguagesPath)) then
- Writeable := ForceDirectories(LanguagesPath);
-
- If Writeable And (not DirectoryExists(PluginPath)) then
- Writeable := ForceDirectories(PluginPath);
+ // Initialize a Path Variable
+ // After Setting Paths, make sure that Paths exist
+ function initialize_path( out aPathVar : String; const aLocation : String ): boolean;
+ var
+ lWriteable: Boolean;
+ begin
+ aPathVar := aLocation;
+
+ If DirectoryExists(aPathVar) then
+ lWriteable := ForceDirectories(aPathVar)
+ else
+ lWriteable := false;
- If Writeable And (not DirectoryExists(PlaylistPath)) then
- Writeable := ForceDirectories(PlaylistPath);
+ if not Writeable then
+ Log.LogError('Error: Dir ('+ aLocation +') is Readonly');
+
+ result := lWriteable;
+ end;
- if not Writeable then
- Log.LogError('Error: Dir is Readonly');
+begin
+ GamePath := ExtractFilePath(ParamStr(0));
+
+ initialize_path( LogPath , GamePath );
+ initialize_path( SoundPath , GamePath + 'Sounds\' );
+ initialize_path( SongPath , GamePath + 'Songs\' );
+ initialize_path( ThemePath , GamePath + 'Themes\' );
+ initialize_path( ScreenshotsPath , GamePath + 'Screenshots\');
+ initialize_path( CoversPath , GamePath + 'Covers\' );
+ initialize_path( LanguagesPath , GamePath + 'Languages\' );
+ initialize_path( PluginPath , GamePath + 'Plugins\' );
+ initialize_path( PlaylistPath , GamePath + 'Playlists\' );
DecimalSeparator := ',';
end;
+*}
//--------------------
// Clears Song Header values
@@ -99,29 +98,29 @@ end;
procedure ClearSong(var Song: TSong);
begin
//Main Information
- Song.Title := '';
+ Song.Title := '';
Song.Artist := '';
//Sortings:
- Song.Genre := 'Unknown';
- Song.Edition := 'Unknown';
+ Song.Genre := 'Unknown';
+ Song.Edition := 'Unknown';
Song.Language := 'Unknown'; //Language Patch
//Required Information
- Song.Mp3 := '';
- Song.BPM := 0;
- Song.GAP := 0;
- Song.Start := 0;
+ Song.Mp3 := '';
+ Song.BPM := 0;
+ Song.GAP := 0;
+ Song.Start := 0;
Song.Finish := 0;
//Additional Information
Song.Background := '';
- Song.Cover := '';
- Song.Video := '';
- Song.VideoGAP := 0;
- Song.NotesGAP := 0;
+ Song.Cover := '';
+ Song.Video := '';
+ Song.VideoGAP := 0;
+ Song.NotesGAP := 0;
Song.Resolution := 4;
- Song.Creator := '';
+ Song.Creator := '';
end;
//--------------------
@@ -791,4 +790,4 @@ begin
CloseFile(SongFile);
end;
-end. \ No newline at end of file
+end.