diff --git a/Client.bin/CentrED.dat b/Client.bin/CentrED.dat
deleted file mode 100644
index 0c5266c..0000000
Binary files a/Client.bin/CentrED.dat and /dev/null differ
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.