From 1df4ec21cdf891aa4302b2fda620069d8d765a70 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sun, 30 Sep 2007 06:35:59 +0000 Subject: updated USDX-Lazaurs Resource compiler.. it now reads the Ultrastar.rc file and builds based on that. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@452 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/USDXResCompiler.exe | Bin 0 -> 401920 bytes Tools/USDXResCompiler.lpi | 53 ++++++++++++++++++++++++++--- Tools/USDXResCompiler.lpr | 76 ++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 123 insertions(+), 6 deletions(-) create mode 100644 Game/Code/USDXResCompiler.exe diff --git a/Game/Code/USDXResCompiler.exe b/Game/Code/USDXResCompiler.exe new file mode 100644 index 00000000..6b0137be Binary files /dev/null and b/Game/Code/USDXResCompiler.exe differ diff --git a/Tools/USDXResCompiler.lpi b/Tools/USDXResCompiler.lpi index 942073ad..ef82c2c4 100644 --- a/Tools/USDXResCompiler.lpi +++ b/Tools/USDXResCompiler.lpi @@ -36,10 +36,10 @@ - - + + - + @@ -52,7 +52,52 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tools/USDXResCompiler.lpr b/Tools/USDXResCompiler.lpr index 38f4a1e5..6fc98efc 100644 --- a/Tools/USDXResCompiler.lpr +++ b/Tools/USDXResCompiler.lpr @@ -14,6 +14,11 @@ procedure AddFile( aResName, aResType, aFile : string ); var lTmpStream : TmemoryStream; begin + if aFile[1] = '"' then + begin + aFile := copy( aFile, 2, length( aFile ) - 2 ); + end; + if not fileexists( aFile ) then begin writeln( 'SKIPED' + ' ( '+aFile+' ) File not found' ); @@ -31,12 +36,77 @@ begin freeandnil( lTmpStream ); end; end; + +procedure addresourceline( aRCLine : String ); +var + lName : String; + lType : String; + lFile : String; + lTmp , + lTmp2 : Integer; +begin + if trim( aRCLine ) = '' then + exit; + + if aRCLine[1] = '#' then + exit; + + if ( aRCLine[1] = '/' ) AND + ( aRCLine[2] = '/' ) THEN + exit; + + // find 2nd column... and put it in lTmp + lTmp := pos( ' ', aRcLine ); + lTmp2 := pos( #9, aRcLine ); + if lTmp2 < lTmp then + lTmp := lTmp2; - + // Name = Start to lTmp + lName := trim( copy( aRcLine, 1, lTmp ) ); + + // Type = lTmp to first " + lTmp2 := pos( '"', aRcLine ); + lType := trim( copy( aRcLine, lTmp, lTmp2-lTmp ) ); + + // File = " to end of line + lFile := trim( copy( aRcLine, lTmp2, maxint ) ); + +(* + writeln( aRcLine ); + writeln( lName ); + writeln( lType ); + writeln( lFile ); + writeln( '' ); +*) + AddFile( lName , lType , lFile ); + +end; + + +var + lRCFile : TStringList; + iCount : Integer; begin + if not fileexists( paramstr(1) ) then + begin + writeln( 'MUST Specify Delphi format RC File' ); + exit; + end; + lRCFile := TStringList.create(); lResourceFile := TMemoryStream.create(); try + lRCFile.loadfromfile( paramstr(1) ); + + if trim( lRCFile.text ) = '' then + exit; + + for iCount := 0 to lRCFile.count -1 do + begin + addresourceline( lRCFile[ iCount ] ); + end; + +(* AddFile( 'Font', 'TEX', '..\Fonts\Normal\eurostar_regular.png' ); AddFile( 'Font', 'FNT', '..\Fonts\Normal\eurostar_regular.dat' ); @@ -75,11 +145,13 @@ begin AddFile( 'OUTRO_BG', 'TEX', '..\Graphics\outro-bg.png' ); AddFile( 'OUTRO_ESC', 'TEX', '..\Graphics\outro-esc.png' ); AddFile( 'OUTRO_EXD', 'TEX', '..\Graphics\outro-exit-dark.png' ); - +*) finally lResourceFile.SaveToFile( 'UltraStar.lrs' ); freeandnil( lResourceFile ); + + freeandnil( lRCFile ); end; end. -- cgit v1.2.3