aboutsummaryrefslogtreecommitdiffstats
path: root/src/base/UFiles.pas
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-11-17 15:25:54 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-11-17 15:25:54 +0000
commitec75bc2b03e707c479f3605ffc1a8d9fe38c165b (patch)
tree9876ee5882c391a769549ae8bbac13fd8a1a2e5b /src/base/UFiles.pas
parente5f4cb8047ce1d3f0392218c8c195aa6f4133d26 (diff)
downloadusdx-ec75bc2b03e707c479f3605ffc1a8d9fe38c165b.tar.gz
usdx-ec75bc2b03e707c479f3605ffc1a8d9fe38c165b.tar.xz
usdx-ec75bc2b03e707c479f3605ffc1a8d9fe38c165b.zip
header tags that are not supported are written to the end of the songheader when saving in editor
fixed header reader ending in infinite loop when there is a header line w/o Colon git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1943 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--src/base/UFiles.pas22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/base/UFiles.pas b/src/base/UFiles.pas
index a46d4e0d..2820a08c 100644
--- a/src/base/UFiles.pas
+++ b/src/base/UFiles.pas
@@ -102,6 +102,22 @@ var
SaveSong := ssrEncodingError;
end;
+ procedure WriteCustomTags;
+ var
+ I: integer;
+ Line: RawByteString;
+ begin
+ for I := 0 to High(Song.CustomTags) do
+ begin
+ Line := EncodeToken(Song.CustomTags[I].Content);
+ if (Length(Song.CustomTags[I].Tag) > 0) then
+ Line := EncodeToken(Song.CustomTags[I].Tag) + ':' + Line;
+
+ SongFile.WriteLine('#' + Line);
+ end;
+
+ end;
+
begin
// Relative := true; // override (idea - use shift+S to save with relative)
Result := ssrOK;
@@ -109,6 +125,9 @@ begin
try
SongFile := TMemTextFileStream.Create(Name, fmCreate);
try
+ // to-do: should we really write the BOM?
+ // it causes problems w/ older versions
+ // e.g. usdx 1.0.1a or ultrastar < 0.7.0
if (Song.Encoding = encUTF8) then
SongFile.WriteString(UTF8_BOM);
@@ -136,6 +155,9 @@ begin
SongFile.WriteLine('#BPM:' + FloatToStr(Song.BPM[0].BPM / 4));
SongFile.WriteLine('#GAP:' + FloatToStr(Song.GAP));
+ // write custom header tags
+ WriteCustomTags;
+
RelativeSubTime := 0;
for B := 1 to High(Song.BPM) do
SongFile.WriteLine('B ' + FloatToStr(Song.BPM[B].StartBeat) + ' '