diff options
Diffstat (limited to '')
-rw-r--r-- | Tools/USDXResCompiler.lpi | 200 | ||||
-rw-r--r-- | Tools/USDXResCompiler.lpr | 316 |
2 files changed, 235 insertions, 281 deletions
diff --git a/Tools/USDXResCompiler.lpi b/Tools/USDXResCompiler.lpi index ef82c2c4..c48a0e88 100644 --- a/Tools/USDXResCompiler.lpi +++ b/Tools/USDXResCompiler.lpi @@ -1,124 +1,76 @@ -<?xml version="1.0"?>
-<CONFIG>
- <ProjectOptions>
- <PathDelim Value="\"/>
- <Version Value="5"/>
- <General>
- <MainUnit Value="0"/>
- <IconPath Value="./"/>
- <TargetFileExt Value=".exe"/>
- <ActiveEditorIndexAtStart Value="0"/>
- </General>
- <VersionInfo>
- <ProjectVersion Value=""/>
- <Language Value=""/>
- <CharSet Value=""/>
- </VersionInfo>
- <PublishOptions>
- <Version Value="2"/>
- <IgnoreBinaries Value="False"/>
- <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
- <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
- </PublishOptions>
- <RunParams>
- <local>
- <FormatVersion Value="1"/>
- <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
- </local>
- </RunParams>
- <RequiredPackages Count="1">
- <Item1>
- <PackageName Value="lcl"/>
- </Item1>
- </RequiredPackages>
- <Units Count="2">
- <Unit0>
- <Filename Value="USDXResCompiler.lpr"/>
- <IsPartOfProject Value="True"/>
- <UnitName Value="USDXResCompiler"/>
- <CursorPos X="78" Y="36"/>
- <TopLine Value="2"/>
- <EditorIndex Value="0"/>
- <UsageCount Value="24"/>
- <Loaded Value="True"/>
- </Unit0>
- <Unit1>
- <Filename Value="..\..\..\..\lazarus\lcl\lresources.pp"/>
- <UnitName Value="LResources"/>
- <CursorPos X="31" Y="55"/>
- <TopLine Value="36"/>
- <EditorIndex Value="1"/>
- <UsageCount Value="10"/>
- <Loaded Value="True"/>
- </Unit1>
- </Units>
- <JumpHistory Count="11" HistoryIndex="10">
- <Position1>
- <Filename Value="USDXResCompiler.lpr"/>
- <Caret Line="39" Column="10" TopLine="15"/>
- </Position1>
- <Position2>
- <Filename Value="USDXResCompiler.lpr"/>
- <Caret Line="86" Column="27" TopLine="47"/>
- </Position2>
- <Position3>
- <Filename Value="USDXResCompiler.lpr"/>
- <Caret Line="47" Column="37" TopLine="20"/>
- </Position3>
- <Position4>
- <Filename Value="USDXResCompiler.lpr"/>
- <Caret Line="43" Column="39" TopLine="23"/>
- </Position4>
- <Position5>
- <Filename Value="USDXResCompiler.lpr"/>
- <Caret Line="45" Column="39" TopLine="25"/>
- </Position5>
- <Position6>
- <Filename Value="USDXResCompiler.lpr"/>
- <Caret Line="47" Column="20" TopLine="30"/>
- </Position6>
- <Position7>
- <Filename Value="USDXResCompiler.lpr"/>
- <Caret Line="35" Column="28" TopLine="11"/>
- </Position7>
- <Position8>
- <Filename Value="USDXResCompiler.lpr"/>
- <Caret Line="47" Column="19" TopLine="27"/>
- </Position8>
- <Position9>
- <Filename Value="USDXResCompiler.lpr"/>
- <Caret Line="37" Column="26" TopLine="7"/>
- </Position9>
- <Position10>
- <Filename Value="USDXResCompiler.lpr"/>
- <Caret Line="63" Column="17" TopLine="29"/>
- </Position10>
- <Position11>
- <Filename Value="USDXResCompiler.lpr"/>
- <Caret Line="66" Column="29" TopLine="34"/>
- </Position11>
- </JumpHistory>
- </ProjectOptions>
- <CompilerOptions>
- <Version Value="5"/>
- <PathDelim Value="\"/>
- <CodeGeneration>
- <Generate Value="Faster"/>
- </CodeGeneration>
- <Other>
- <CompilerPath Value="$(CompPath)"/>
- </Other>
- </CompilerOptions>
- <Debugging>
- <BreakPoints Count="2">
- <Item1>
- <Source Value="USDXResCompiler.lpr"/>
- <Line Value="14"/>
- </Item1>
- <Item2>
- <Source Value="USDXResCompiler.lpr"/>
- <Line Value="18"/>
- </Item2>
- </BreakPoints>
- </Debugging>
-</CONFIG>
+<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <PathDelim Value="/"/> + <Version Value="5"/> + <General> + <MainUnit Value="0"/> + <IconPath Value="./"/> + <TargetFileExt Value=".exe"/> + <ActiveEditorIndexAtStart Value="0"/> + </General> + <VersionInfo> + <ProjectVersion Value=""/> + <Language Value=""/> + <CharSet Value=""/> + </VersionInfo> + <PublishOptions> + <Version Value="2"/> + <IgnoreBinaries Value="False"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="lcl"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="USDXResCompiler.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="USDXResCompiler"/> + <CursorPos X="48" Y="74"/> + <TopLine Value="42"/> + <EditorIndex Value="0"/> + <UsageCount Value="24"/> + <Loaded Value="True"/> + </Unit0> + <Unit1> + <Filename Value="../../../../lazarus/lcl/lresources.pp"/> + <UnitName Value="LResources"/> + <CursorPos X="31" Y="55"/> + <TopLine Value="36"/> + <UsageCount Value="10"/> + </Unit1> + </Units> + <JumpHistory Count="0" HistoryIndex="-1"/> + </ProjectOptions> + <CompilerOptions> + <Version Value="5"/> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <BreakPoints Count="2"> + <Item1> + <Source Value="USDXResCompiler.lpr"/> + <Line Value="14"/> + </Item1> + <Item2> + <Source Value="USDXResCompiler.lpr"/> + <Line Value="18"/> + </Item2> + </BreakPoints> + </Debugging> +</CONFIG> diff --git a/Tools/USDXResCompiler.lpr b/Tools/USDXResCompiler.lpr index 6fc98efc..8e6e7921 100644 --- a/Tools/USDXResCompiler.lpr +++ b/Tools/USDXResCompiler.lpr @@ -1,157 +1,159 @@ -program USDXResCompiler;
-
-{$mode objfpc}{$H+}
-
-uses
- Classes,
- SysUtils,
- LResources;
-
-var
- lResourceFile : TMemoryStream;
-
-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' );
- exit;
- end;
-
- lTmpStream := TmemoryStream.create();
- try
- lTmpStream.loadfromfile( aFile );
- lTmpStream.position := 0;
-
- BinaryToLazarusResourceCode(lTmpStream, lResourceFile, aResName, aResType);
- writeln( 'ADDED - ' + aResType + ' : ' + aResName + ' ( '+aFile+' )' );
- finally
- 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' );
-
- AddFile( 'FontB', 'TEX', '..\Fonts\Bold\eurostar_regular_bold.png' );
- AddFile( 'FontB', 'FNT', '..\Fonts\Bold\eurostar_regular_bold.dat' );
-
- AddFile( 'FontO', 'TEX', '..\Fonts\Outline 1\Outline 1.PNG' );
- AddFile( 'FontO', 'FNT', '..\Fonts\Outline 1\Outline 1.dat' );
-
- AddFile( 'FontO2', 'TEX', '..\Fonts\Outline 2\Outline 2.PNG' );
- AddFile( 'FontO2', 'FNT', '..\Fonts\Outline 2\Outline 2.dat' );
-
- AddFile( 'MAINICON', 'ICON', '..\Graphics\ustar-icon_v01.ico' );
-
-
- AddFile( 'CRDTS_BG', 'TEX', '..\Graphics\credits_v5_bg.png' );
- AddFile( 'CRDTS_OVL', 'TEX', '..\Graphics\credits_v5_overlay.png' );
- AddFile( 'CRDTS_blindguard', 'TEX', '..\Graphics\names_blindguard.png' );
- AddFile( 'CRDTS_blindy', 'TEX', '..\Graphics\names_blindy.png' );
- AddFile( 'CRDTS_canni', 'TEX', '..\Graphics\names_canni.png' );
- AddFile( 'CRDTS_commandio', 'TEX', '..\Graphics\names_commandio.png' );
- AddFile( 'CRDTS_lazyjoker', 'TEX', '..\Graphics\names_lazyjoker.png' );
- AddFile( 'CRDTS_mog', 'TEX', '..\Graphics\names_mog.png' );
- AddFile( 'CRDTS_mota', 'TEX', '..\Graphics\names_mota.png' );
- AddFile( 'CRDTS_skillmaste', 'TEX', '..\Graphics\names_skillmaster.png' );
- AddFile( 'CRDTS_whiteshark', 'TEX', '..\Graphics\names_whiteshark.png' );
- AddFile( 'INTRO_L01', 'TEX', '..\Graphics\intro-l-01.png' );
- AddFile( 'INTRO_L02', 'TEX', '..\Graphics\intro-l-02.png' );
- AddFile( 'INTRO_L03', 'TEX', '..\Graphics\intro-l-03.png' );
- AddFile( 'INTRO_L04', 'TEX', '..\Graphics\intro-l-04.png' );
- AddFile( 'INTRO_L05', 'TEX', '..\Graphics\intro-l-05.png' );
- AddFile( 'INTRO_L06', 'TEX', '..\Graphics\intro-l-06.png' );
- AddFile( 'INTRO_L07', 'TEX', '..\Graphics\intro-l-07.png' );
- AddFile( 'INTRO_L08', 'TEX', '..\Graphics\intro-l-08.png' );
- AddFile( 'INTRO_L09', 'TEX', '..\Graphics\intro-l-09.png' );
- 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.
-
+program USDXResCompiler; + +{$mode objfpc}{$H+} + +uses + Classes, + SysUtils, + LResources; + +var + lResourceFile : TMemoryStream; + +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' ); + exit; + end; + + lTmpStream := TmemoryStream.create(); + try + lTmpStream.loadfromfile( aFile ); + lTmpStream.position := 0; + + BinaryToLazarusResourceCode(lTmpStream, lResourceFile, aResName, aResType); + writeln( 'ADDED - ' + aResType + ' : ' + aResName + ' ( '+aFile+' )' ); + finally + 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 ) ); + + lFile := StringReplace( lFile, '\', PathDelim ,[rfReplaceAll] ); + +(* + 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' ); + + AddFile( 'FontB', 'TEX', '..\Fonts\Bold\eurostar_regular_bold.png' ); + AddFile( 'FontB', 'FNT', '..\Fonts\Bold\eurostar_regular_bold.dat' ); + + AddFile( 'FontO', 'TEX', '..\Fonts\Outline 1\Outline 1.PNG' ); + AddFile( 'FontO', 'FNT', '..\Fonts\Outline 1\Outline 1.dat' ); + + AddFile( 'FontO2', 'TEX', '..\Fonts\Outline 2\Outline 2.PNG' ); + AddFile( 'FontO2', 'FNT', '..\Fonts\Outline 2\Outline 2.dat' ); + + AddFile( 'MAINICON', 'ICON', '..\Graphics\ustar-icon_v01.ico' ); + + + AddFile( 'CRDTS_BG', 'TEX', '..\Graphics\credits_v5_bg.png' ); + AddFile( 'CRDTS_OVL', 'TEX', '..\Graphics\credits_v5_overlay.png' ); + AddFile( 'CRDTS_blindguard', 'TEX', '..\Graphics\names_blindguard.png' ); + AddFile( 'CRDTS_blindy', 'TEX', '..\Graphics\names_blindy.png' ); + AddFile( 'CRDTS_canni', 'TEX', '..\Graphics\names_canni.png' ); + AddFile( 'CRDTS_commandio', 'TEX', '..\Graphics\names_commandio.png' ); + AddFile( 'CRDTS_lazyjoker', 'TEX', '..\Graphics\names_lazyjoker.png' ); + AddFile( 'CRDTS_mog', 'TEX', '..\Graphics\names_mog.png' ); + AddFile( 'CRDTS_mota', 'TEX', '..\Graphics\names_mota.png' ); + AddFile( 'CRDTS_skillmaste', 'TEX', '..\Graphics\names_skillmaster.png' ); + AddFile( 'CRDTS_whiteshark', 'TEX', '..\Graphics\names_whiteshark.png' ); + AddFile( 'INTRO_L01', 'TEX', '..\Graphics\intro-l-01.png' ); + AddFile( 'INTRO_L02', 'TEX', '..\Graphics\intro-l-02.png' ); + AddFile( 'INTRO_L03', 'TEX', '..\Graphics\intro-l-03.png' ); + AddFile( 'INTRO_L04', 'TEX', '..\Graphics\intro-l-04.png' ); + AddFile( 'INTRO_L05', 'TEX', '..\Graphics\intro-l-05.png' ); + AddFile( 'INTRO_L06', 'TEX', '..\Graphics\intro-l-06.png' ); + AddFile( 'INTRO_L07', 'TEX', '..\Graphics\intro-l-07.png' ); + AddFile( 'INTRO_L08', 'TEX', '..\Graphics\intro-l-08.png' ); + AddFile( 'INTRO_L09', 'TEX', '..\Graphics\intro-l-09.png' ); + 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. + |