aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreddie-0815 <eddie-0815@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-01-20 18:15:00 +0000
committereddie-0815 <eddie-0815@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-01-20 18:15:00 +0000
commitfb4154e323aeb2cb3c601a418bd5362253b62134 (patch)
treec112d4fca6c4d8811b5c15bb4905393393d57038
parentfc789bbf80f730d9ffa8ff846b55bb067d401ee2 (diff)
downloadusdx-fb4154e323aeb2cb3c601a418bd5362253b62134.tar.gz
usdx-fb4154e323aeb2cb3c601a418bd5362253b62134.tar.xz
usdx-fb4154e323aeb2cb3c601a418bd5362253b62134.zip
Fixed song loading on OS X (UTF8 filenames). Added switches.inc.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@800 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--Game/Code/Classes/USong.pas107
1 files changed, 66 insertions, 41 deletions
diff --git a/Game/Code/Classes/USong.pas b/Game/Code/Classes/USong.pas
index 728f5055..e5777c75 100644
--- a/Game/Code/Classes/USong.pas
+++ b/Game/Code/Classes/USong.pas
@@ -1,9 +1,15 @@
-unit USong;
-
-interface
-
-uses
- {$IFDEF MSWINDOWS}
+unit USong;
+
+interface
+
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
+{$I switches.inc}
+
+uses
+ {$IFDEF MSWINDOWS}
Windows,
{$ifdef Delphi}
DirWatch,
@@ -29,8 +35,8 @@ uses
PseudoThread,
{$ENDIF}
UCatCovers;
-
-type
+
+type
TSingMode = ( smNormal, smPartyMode, smPlaylistRandom );
@@ -109,33 +115,43 @@ type
function Analyse(): boolean;
procedure clear();
end;
-
-implementation
-
-uses
- TextGL,
- UIni,
- UMusic, // needed for Czesci .. ( whatever that is )
- UMain; //needed for Player
-
-constructor TSong.create( const aFileName : WideString );
+
+implementation
+
+uses
+ TextGL,
+ UIni,
+ UMusic, // needed for Czesci .. ( whatever that is )
+ UMain; //needed for Player
+
+constructor TSong.create( const aFileName : WideString );
begin
- Mult := 1;
- MultBPM := 4;
-
- fFileName := aFileName;
-
- if fileexists( aFileName ) then
- begin
- self.Path := ExtractFilePath( aFileName );
- self.Folder := ExtractFilePath( aFileName );
+
+ Mult := 1;
+
+ MultBPM := 4;
+
+
+ fFileName := aFileName;
+
+
+ if fileexists( aFileName ) then
+
+ begin
+
+ self.Path := ExtractFilePath( aFileName );
+ self.Folder := ExtractFilePath( aFileName );
self.FileName := ExtractFileName( aFileName );
- (*
- if ReadTXTHeader( aFileName ) then
- begin
- LoadSong();
- end
+(*
+
+ if ReadTXTHeader( aFileName ) then
+
+ begin
+
+ LoadSong();
+
+ end
else
begin
Log.LogError('Error Loading SongHeader, abort Song Loading');
@@ -145,9 +161,11 @@ begin
end;
end;
-
- function TSong.LoadSong(): boolean;
- var
+
+
+function TSong.LoadSong(): boolean;
+
+var
TempC: char;
Tekst: string;
CP: integer; // Current Player (0 or 1)
@@ -319,9 +337,11 @@ begin
Result := true;
end;
-
- function TSong.ReadTXTHeader(const aFileName : WideString): boolean;
- var
+
+
+function TSong.ReadTXTHeader(const aFileName : WideString): boolean;
+
+var
Line, Identifier, Value: String;
Temp : word;
Done : byte;
@@ -362,6 +382,11 @@ begin
//Required Attributes
//-----------
+ {$IFDEF UTF8_FILENAMES}
+ if ((Identifier = 'MP3') or (Identifier = 'BACKGROUND') or (Identifier = 'COVER') or (Identifier = 'VIDEO')) then
+ Value := Utf8Encode(Value);
+ {$ENDIF}
+
//Title
if (Identifier = 'TITLE') then
begin
@@ -646,7 +671,7 @@ end;
procedure TSong.clear();
begin
- //Main Information
+ //Main Information
Title := '';
Artist := '';
@@ -675,7 +700,7 @@ begin
NotesGAP := 0;
Resolution := 4;
Creator := '';
-
+
end;
function TSong.Analyse(): boolean;
@@ -705,4 +730,4 @@ end;
-end.
+end.