From 484bd5523f816d0e268cf28dfd3c063f2395b2aa Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sun, 10 May 2015 18:20:40 +0200 Subject: [PATCH] * Migrated resources from custom resource manager to windows/lazarus resources (requires windres now!) * Bumped version to 0.7 --- Client.bin/CentrED.dat | Bin 9990 -> 0 bytes Client/Assets.rc | 5 ++ Client/CentrED.lpi | 13 ++--- Client/CentrED.lpr | 1 + Client/ResourceList.txt | 5 -- Client/UOverlayUI.pas | 22 +++++--- Client/UResourceManager.pas | 105 ------------------------------------ Client/UfrmMain.pas | 22 ++++++-- ResourceBuilder.pas | 69 ------------------------ 9 files changed, 43 insertions(+), 199 deletions(-) delete mode 100644 Client.bin/CentrED.dat create mode 100644 Client/Assets.rc delete mode 100644 Client/ResourceList.txt delete mode 100644 Client/UResourceManager.pas delete mode 100644 ResourceBuilder.pas diff --git a/Client.bin/CentrED.dat b/Client.bin/CentrED.dat deleted file mode 100644 index 0c5266cae740df7452ad7f6e0c08304556f2f583..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9990 zcmeI1c|26#`@rwWWXqCjXc-16q!N=Q%tb{+)@&gvRLEGfhb(EVA!JL6%Fdt_t(K(K zTA~G!Wm5KKe)n9T@66BV_4U{9-`{<`?wos{_j#W4JkNQ~x%YyFAV?57FS9_90~UfZ zI3Vaf9)ivx_YlMhe$ZnRvbAY4i2tEuOfkr z!T_NR5CLSD86b=S!hsB87)7l_FlZP<12ursOALAuP}Cu2zsn373Md9xUM@n7L^EU| zpd0Ey2tx)XCns-3`^7S4jDBcT=&p0K}ynS41ks}TC*tlR~@5;ivnihqB7<>Wflu6L#qSTU{)I{L#G=B6vp7F3@v69L@@v= zLkkxLkqm&!&`k^l;S7MvnEMjCg3&IhjJcCB_Xbpk?tK?Q{?IFQXGGP|D_K^MG3IV6 z4M`)lorI^21B5dGDvM`;NCrSE(gp!QIs>4xr7aPFOa?$@XthBAWHSINTiR>^$YB6fwzM+?kjnr| zmCwl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_;ee#r#%U`ql0A&G3P4YAtU(}6bsP9! z#~KCzgR>%lOxlitSdig?Dc}tNz!aGzfm!Y@(i?QZ!IB^trn@+J$z38W1tDT~hF3%c zK!_0062Ija||E=UIhaU(k`Y35C8xIC6jh9*8oWb z9jGK3X0CuKkgHUrrIGev814c+x&i>C1ZWW91Isl)N`QtD ze2_WkKm!CQjkIJ~6N4;GHnc?1L6N8p03c~G*B}67KXJCqkoWK+g)?Mxu2oPuzVLfKrfd&ZB3Tcht zBg?%40RmHGSf3dO7!(}QNJ~>SV5S5B;8g_BAQ>*#0FeU?D#?iHF3`*8=a_VL;#LFq@}5v zGc^DJaa;!)Bn#%?0Dw5MkdsQXWCjQTh~oxw(n!aauMaREYmgHMTQN5oFb^P((@0B% zt(R*605piO4RfNv7{C(0O>p^xTSXn06=!X zASadNvs?pY7HH5&zRLlK8~_~bN2mWM?Z6ZW5C9_V&-4la5Jv~n8o>d}mjM7^85qHV X%QZk8K!XeiG1te^G%d{_P4#~OC<7cO diff --git a/Client/Assets.rc b/Client/Assets.rc new file mode 100644 index 0000000..fbc2ba4 --- /dev/null +++ b/Client/Assets.rc @@ -0,0 +1,5 @@ +LEFTTOPARROW RCDATA "Overlay/LeftTopArrow.tga" +TOPARROW RCDATA "Overlay/TopArrow.tga" +VIRTUALLAYER RCDATA "Overlay/VirtualLayer.tga" +DEJAVU RCDATA "GLFont/DejaVu.png" +DEJAVUDAT RCDATA "GLFont/DejaVu.fnt" \ No newline at end of file diff --git a/Client/CentrED.lpi b/Client/CentrED.lpi index a4cc2a6..28f0ba2 100644 --- a/Client/CentrED.lpi +++ b/Client/CentrED.lpi @@ -16,10 +16,10 @@ - - - - + + + + @@ -327,7 +327,6 @@ - @@ -335,7 +334,6 @@ - @@ -455,12 +453,10 @@ - - @@ -564,7 +560,6 @@ - diff --git a/Client/CentrED.lpr b/Client/CentrED.lpr index 9733d44..8aaaaaa 100644 --- a/Client/CentrED.lpr +++ b/Client/CentrED.lpr @@ -37,6 +37,7 @@ uses Forms, UdmNetwork; {$R CentrED.res} +{$R Assets.rc} // Beware: you need 'windres', which is part of mingw-binutils on *nix! function GetApplicationName: String; begin diff --git a/Client/ResourceList.txt b/Client/ResourceList.txt deleted file mode 100644 index 42f9920..0000000 --- a/Client/ResourceList.txt +++ /dev/null @@ -1,5 +0,0 @@ -Overlay/LeftTopArrow.tga -Overlay/TopArrow.tga -Overlay/VirtualLayer.tga -GLFont/DejaVu.png -GLFont/DejaVu.fnt diff --git a/Client/UOverlayUI.pas b/Client/UOverlayUI.pas index 5817786..809f07b 100644 --- a/Client/UOverlayUI.pas +++ b/Client/UOverlayUI.pas @@ -78,9 +78,6 @@ type implementation -uses - UResourceManager; - { TGLArrow } constructor TGLArrow.Create(AGraphic: TSingleImage); @@ -172,12 +169,19 @@ constructor TOverlayUI.Create; var i: Integer; arrow: TSingleImage; + resStream: TResourceStream; begin inherited Create; FActiveArrow := -1; FVisible := False; - - arrow := TSingleImage.CreateFromStream(ResourceManager.GetResource(0)); + + resStream := TResourceStream.Create(HINSTANCE, 'LEFTTOPARROW', RT_RCDATA); + try + arrow := TSingleImage.CreateFromStream(resStream); + finally + resStream.Free; + end; + for i := 0 to 3 do begin FArrows[2*i] := TGLArrow.Create(arrow); @@ -186,7 +190,13 @@ begin end; arrow.Free; - arrow := TSingleImage.CreateFromStream(ResourceManager.GetResource(1)); + resStream := TResourceStream.Create(HINSTANCE, 'TOPARROW', RT_RCDATA); + try + arrow := TSingleImage.CreateFromStream(resStream); + finally + resStream.Free; + end; + for i := 0 to 3 do begin FArrows[2*i+1] := TGLArrow.Create(arrow); diff --git a/Client/UResourceManager.pas b/Client/UResourceManager.pas deleted file mode 100644 index 9857dbd..0000000 --- a/Client/UResourceManager.pas +++ /dev/null @@ -1,105 +0,0 @@ -(* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at - * http://www.opensource.org/licenses/cddl1.php. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at - * http://www.opensource.org/licenses/cddl1.php. If applicable, - * add the following below this CDDL HEADER, with the fields enclosed - * by brackets "[]" replaced with your own identifying * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Portions Copyright 2009 Andreas Schneider - *) -unit UResourceManager; - -{$mode objfpc}{$H+} - -interface - -uses - Classes, SysUtils; - -type - - { TResourceManager } - - TResourceManager = class - constructor Create(AFileName: string); - destructor Destroy; override; - protected - FFileStream: TFileStream; - FCount: Integer; - FLookupTable: array of Cardinal; - FCurrentResource: Integer; - FResourceStream: TMemoryStream; - public - function GetResource(AIndex: Integer): TStream; - end; - -var - ResourceManager: TResourceManager; - -implementation - -{ TResourceManager } - -constructor TResourceManager.Create(AFileName: string); -begin - inherited Create; - FFileStream := TFileStream.Create(AFileName, fmOpenRead or fmShareDenyWrite); - FFileStream.Position := 0; - FFileStream.Read(FCount, SizeOf(Integer)); - SetLength(FLookupTable, FCount); - FFileStream.Read(FLookupTable[0], FCount * SizeOf(Cardinal)); - FCurrentResource := -1; -end; - -destructor TResourceManager.Destroy; -begin - FreeAndNil(FFileStream); - FreeAndNil(FResourceStream); - inherited Destroy; -end; - -function TResourceManager.GetResource(AIndex: Integer): TStream; -var - size: Cardinal; -begin - if AIndex <> FCurrentResource then - begin - FFileStream.Position := FLookupTable[AIndex]; - FResourceStream.Free; - FResourceStream := TMemoryStream.Create; - FFileStream.Read(size, SizeOf(Cardinal)); - FResourceStream.CopyFrom(FFileStream, size); - FCurrentResource := AIndex; - end; - FResourceStream.Position := 0; - Result := FResourceStream; -end; - -initialization -begin - ResourceManager := TResourceManager.Create(ChangeFileExt(ParamStr(0), '.dat')); -end; - -finalization -begin - if ResourceManager <> nil then FreeAndNil(ResourceManager); -end; - -end. - diff --git a/Client/UfrmMain.pas b/Client/UfrmMain.pas index 18d7ad9..d3c4542 100644 --- a/Client/UfrmMain.pas +++ b/Client/UfrmMain.pas @@ -408,7 +408,7 @@ uses UfrmAccountControl, UGraphicHelper, ImagingComponents, UfrmDrawSettings, UfrmBoundaries, UfrmElevateSettings, UfrmConfirmation, UfrmMoveSettings, UfrmAbout, UPacketHandlers, UfrmHueSettings, UfrmRadar, UfrmLargeScaleCommand, - UfrmLogin, UResourceManager, UfrmVirtualLayer, UfrmFilter, UfrmRegionControl, + UfrmLogin, UfrmVirtualLayer, UfrmFilter, UfrmRegionControl, Logging, LConvEncoding, LCLType, UfrmLightlevel, UfrmChangePassword; type @@ -889,6 +889,8 @@ begin end; procedure TfrmMain.FormCreate(Sender: TObject); +var + resStream: TResourceStream; begin FAppDir := IncludeTrailingPathDelimiter(ExtractFilePath(Application.ExeName)); FConfigDir := GetAppConfigDir(False); @@ -940,11 +942,21 @@ begin RegisterPacketHandler($0C, TPacketHandler.Create(0, @OnClientHandlingPacket)); - FVLayerImage := TSingleImage.CreateFromStream(ResourceManager.GetResource(2)); + resStream := nil; + try + resStream := TResourceStream.Create(HINSTANCE, 'VIRTUALLAYER', RT_RCDATA); + FVLayerImage := TSingleImage.CreateFromStream(resStream); + FreeAndNil(resStream); - FGLFont := TGLFont.Create; - FGLFont.LoadImage(ResourceManager.GetResource(3)); - FGLFont.LoadFontInfo(ResourceManager.GetResource(4)); + FGLFont := TGLFont.Create; + resStream := TResourceStream.Create(HINSTANCE, 'DEJAVU', RT_RCDATA); + FGLFont.LoadImage(resStream); + FreeAndNil(resStream); + resStream := TResourceStream.Create(HINSTANCE, 'DEJAVUDAT', RT_RCDATA); + FGLFont.LoadFontInfo(resStream); + finally + FreeAndNil(resStream); + end; FVirtualTiles := TWorldItemList.Create(True); FUndoList := TPacketList.Create(True); diff --git a/ResourceBuilder.pas b/ResourceBuilder.pas deleted file mode 100644 index 3ada35b..0000000 --- a/ResourceBuilder.pas +++ /dev/null @@ -1,69 +0,0 @@ -(* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at - * http://www.opensource.org/licenses/cddl1.php. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at - * http://www.opensource.org/licenses/cddl1.php. If applicable, - * add the following below this CDDL HEADER, with the fields enclosed - * by brackets "[]" replaced with your own identifying * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Portions Copyright 2007 Andreas Schneider - *) -program ResourceBuilder; - -{$mode objfpc}{$H+} - -uses - SysUtils, Classes; - -var - fileList: TStringList; - infile, outfile: TFileStream; - i, count: Integer; - size: Cardinal; - lookupTable: array of Cardinal; - -begin - if ParamCount <> 2 then - begin - writeln('Usage: ResourceBuilder '); - halt; - end; - - fileList := TStringList.Create; - fileList.LoadFromFile(ParamStr(1)); - outfile := TFileStream.Create(ParamStr(2), fmCreate); - count := fileList.Count; - outfile.Write(count, SizeOf(Integer)); - SetLength(lookupTable, count); - outfile.Write(lookupTable[0], count * SizeOf(Cardinal)); - for i := 0 to count - 1 do - begin - lookupTable[i] := outfile.Position; - writeln(i, ': ', fileList.Strings[i]); - infile := TFileStream.Create(fileList.Strings[i], fmOpenRead); - infile.Position := 0; - size := infile.Size; - outfile.Write(size, SizeOf(Cardinal)); - outfile.CopyFrom(infile, infile.Size); - infile.Free; - end; - outfile.Position := SizeOf(Integer); - outfile.Write(lookupTable[0], count * SizeOf(Cardinal)); - outfile.Free; - fileList.Free; -end.