aboutsummaryrefslogtreecommitdiffstats
path: root/Game
diff options
context:
space:
mode:
authorjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-18 10:47:12 +0000
committerjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-18 10:47:12 +0000
commit12a7652fe6cf20441dec4aae8156978bf751861f (patch)
tree6c2d3c5ac6a91660f4f15595780617811e8a0169 /Game
parent5a778181e947cfb883f85d3239f6d1f1714dacc8 (diff)
downloadusdx-12a7652fe6cf20441dec4aae8156978bf751861f.tar.gz
usdx-12a7652fe6cf20441dec4aae8156978bf751861f.tar.xz
usdx-12a7652fe6cf20441dec4aae8156978bf751861f.zip
pngimage is NOT ( yet ) lazarus compatible
It might compile, however the object files are in borland obj format to use this, it will need to be in GCC object file format format Or we can use the lazarus / freepascal png unit if we decide that pngimage IS required ( and we cant use the lazarus unit ) then we should investigate how this developer went with the port. http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=viewtopic&t=3206 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@388 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game')
-rw-r--r--Game/Code/lib/PngImage/lazarustest.lpi239
-rw-r--r--Game/Code/lib/PngImage/lazarustest.lpr15
-rw-r--r--Game/Code/lib/PngImage/pngimage.pas58
-rw-r--r--Game/Code/lib/PngImage/pngzlib.pas41
4 files changed, 309 insertions, 44 deletions
diff --git a/Game/Code/lib/PngImage/lazarustest.lpi b/Game/Code/lib/PngImage/lazarustest.lpi
new file mode 100644
index 00000000..4dec8a9e
--- /dev/null
+++ b/Game/Code/lib/PngImage/lazarustest.lpi
@@ -0,0 +1,239 @@
+<?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>
+ <Units Count="8">
+ <Unit0>
+ <Filename Value="lazarustest.lpr"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="lazarustest"/>
+ <CursorPos X="49" Y="11"/>
+ <TopLine Value="1"/>
+ <EditorIndex Value="0"/>
+ <UsageCount Value="23"/>
+ <Loaded Value="True"/>
+ </Unit0>
+ <Unit1>
+ <Filename Value="delphi\bass.pas"/>
+ <UnitName Value="Bass"/>
+ <CursorPos X="12" Y="539"/>
+ <TopLine Value="589"/>
+ <UsageCount Value="10"/>
+ </Unit1>
+ <Unit2>
+ <Filename Value="avformat.pas"/>
+ <UnitName Value="avformat"/>
+ <CursorPos X="38" Y="594"/>
+ <TopLine Value="567"/>
+ <UsageCount Value="10"/>
+ </Unit2>
+ <Unit3>
+ <Filename Value="avcodec.pas"/>
+ <UnitName Value="avcodec"/>
+ <CursorPos X="3" Y="1796"/>
+ <TopLine Value="1775"/>
+ <UsageCount Value="11"/>
+ </Unit3>
+ <Unit4>
+ <Filename Value="avio.pas"/>
+ <UnitName Value="avio"/>
+ <CursorPos X="1" Y="1"/>
+ <TopLine Value="1"/>
+ <UsageCount Value="11"/>
+ </Unit4>
+ <Unit5>
+ <Filename Value="pngimage.pas"/>
+ <UnitName Value="pngimage"/>
+ <CursorPos X="20" Y="133"/>
+ <TopLine Value="121"/>
+ <EditorIndex Value="1"/>
+ <UsageCount Value="10"/>
+ <Loaded Value="True"/>
+ </Unit5>
+ <Unit6>
+ <Filename Value="pngzlib.pas"/>
+ <UnitName Value="pngzlib"/>
+ <CursorPos X="6" Y="111"/>
+ <TopLine Value="91"/>
+ <EditorIndex Value="3"/>
+ <UsageCount Value="10"/>
+ <Loaded Value="True"/>
+ </Unit6>
+ <Unit7>
+ <Filename Value="pnglang.pas"/>
+ <UnitName Value="pnglang"/>
+ <CursorPos X="1" Y="1"/>
+ <TopLine Value="1"/>
+ <EditorIndex Value="2"/>
+ <UsageCount Value="10"/>
+ <Loaded Value="True"/>
+ </Unit7>
+ </Units>
+ <JumpHistory Count="30" HistoryIndex="29">
+ <Position1>
+ <Filename Value="pngimage.pas"/>
+ <Caret Line="4037" Column="16" TopLine="4017"/>
+ </Position1>
+ <Position2>
+ <Filename Value="lazarustest.lpr"/>
+ <Caret Line="19" Column="1" TopLine="1"/>
+ </Position2>
+ <Position3>
+ <Filename Value="lazarustest.lpr"/>
+ <Caret Line="6" Column="1" TopLine="1"/>
+ </Position3>
+ <Position4>
+ <Filename Value="lazarustest.lpr"/>
+ <Caret Line="4" Column="1" TopLine="1"/>
+ </Position4>
+ <Position5>
+ <Filename Value="pngzlib.pas"/>
+ <Caret Line="8" Column="30" TopLine="1"/>
+ </Position5>
+ <Position6>
+ <Filename Value="pngzlib.pas"/>
+ <Caret Line="38" Column="37" TopLine="18"/>
+ </Position6>
+ <Position7>
+ <Filename Value="pngzlib.pas"/>
+ <Caret Line="52" Column="16" TopLine="31"/>
+ </Position7>
+ <Position8>
+ <Filename Value="lazarustest.lpr"/>
+ <Caret Line="6" Column="1" TopLine="1"/>
+ </Position8>
+ <Position9>
+ <Filename Value="pngzlib.pas"/>
+ <Caret Line="124" Column="82" TopLine="86"/>
+ </Position9>
+ <Position10>
+ <Filename Value="pngzlib.pas"/>
+ <Caret Line="1" Column="1" TopLine="1"/>
+ </Position10>
+ <Position11>
+ <Filename Value="pngzlib.pas"/>
+ <Caret Line="103" Column="6" TopLine="83"/>
+ </Position11>
+ <Position12>
+ <Filename Value="pngzlib.pas"/>
+ <Caret Line="104" Column="6" TopLine="84"/>
+ </Position12>
+ <Position13>
+ <Filename Value="pngzlib.pas"/>
+ <Caret Line="105" Column="6" TopLine="85"/>
+ </Position13>
+ <Position14>
+ <Filename Value="pngzlib.pas"/>
+ <Caret Line="106" Column="6" TopLine="86"/>
+ </Position14>
+ <Position15>
+ <Filename Value="pngzlib.pas"/>
+ <Caret Line="107" Column="6" TopLine="87"/>
+ </Position15>
+ <Position16>
+ <Filename Value="pngzlib.pas"/>
+ <Caret Line="108" Column="6" TopLine="88"/>
+ </Position16>
+ <Position17>
+ <Filename Value="pngzlib.pas"/>
+ <Caret Line="109" Column="6" TopLine="89"/>
+ </Position17>
+ <Position18>
+ <Filename Value="pngzlib.pas"/>
+ <Caret Line="110" Column="6" TopLine="90"/>
+ </Position18>
+ <Position19>
+ <Filename Value="pngimage.pas"/>
+ <Caret Line="4037" Column="62" TopLine="4017"/>
+ </Position19>
+ <Position20>
+ <Filename Value="pnglang.pas"/>
+ <Caret Line="275" Column="31" TopLine="255"/>
+ </Position20>
+ <Position21>
+ <Filename Value="lazarustest.lpr"/>
+ <Caret Line="19" Column="1" TopLine="1"/>
+ </Position21>
+ <Position22>
+ <Filename Value="pngimage.pas"/>
+ <Caret Line="1" Column="1" TopLine="1"/>
+ </Position22>
+ <Position23>
+ <Filename Value="lazarustest.lpr"/>
+ <Caret Line="19" Column="1" TopLine="1"/>
+ </Position23>
+ <Position24>
+ <Filename Value="pngimage.pas"/>
+ <Caret Line="1" Column="1" TopLine="1"/>
+ </Position24>
+ <Position25>
+ <Filename Value="pngimage.pas"/>
+ <Caret Line="139" Column="10" TopLine="119"/>
+ </Position25>
+ <Position26>
+ <Filename Value="pngimage.pas"/>
+ <Caret Line="138" Column="1" TopLine="119"/>
+ </Position26>
+ <Position27>
+ <Filename Value="pngimage.pas"/>
+ <Caret Line="146" Column="38" TopLine="121"/>
+ </Position27>
+ <Position28>
+ <Filename Value="pngimage.pas"/>
+ <Caret Line="141" Column="2" TopLine="121"/>
+ </Position28>
+ <Position29>
+ <Filename Value="lazarustest.lpr"/>
+ <Caret Line="11" Column="20" TopLine="1"/>
+ </Position29>
+ <Position30>
+ <Filename Value="lazarustest.lpr"/>
+ <Caret Line="14" Column="1" TopLine="1"/>
+ </Position30>
+ </JumpHistory>
+ </ProjectOptions>
+ <CompilerOptions>
+ <Version Value="5"/>
+ <PathDelim Value="\"/>
+ <CodeGeneration>
+ <Generate Value="Faster"/>
+ </CodeGeneration>
+ <Other>
+ <CompilerPath Value="$(CompPath)"/>
+ </Other>
+ </CompilerOptions>
+ <Debugging>
+ <Exceptions Count="2">
+ <Item1>
+ <Name Value="ECodetoolError"/>
+ </Item1>
+ <Item2>
+ <Name Value="EFOpenError"/>
+ </Item2>
+ </Exceptions>
+ </Debugging>
+</CONFIG>
diff --git a/Game/Code/lib/PngImage/lazarustest.lpr b/Game/Code/lib/PngImage/lazarustest.lpr
new file mode 100644
index 00000000..f567b6cb
--- /dev/null
+++ b/Game/Code/lib/PngImage/lazarustest.lpr
@@ -0,0 +1,15 @@
+program lazarustest;
+
+uses
+ pngimage in 'pngimage.pas',
+ pnglang in 'pnglang.pas',
+ pngzlib in 'pngzlib.pas',
+ sysutils;
+
+begin
+ writeln( 'pngimage is NOT lazarus compatible' );
+ writeln( 'It might compile ( not link though ), however the object files are in borland obj format' );
+ writeln( 'to use this, it will need to be in GCC object file format format' );
+ writeln( 'Or we can use the lazarus / freepascal png unit' );
+end.
+
diff --git a/Game/Code/lib/PngImage/pngimage.pas b/Game/Code/lib/PngImage/pngimage.pas
index ec712737..ecd52c5b 100644
--- a/Game/Code/lib/PngImage/pngimage.pas
+++ b/Game/Code/lib/PngImage/pngimage.pas
@@ -109,8 +109,15 @@ unit pngimage;
interface
+{$IFDEF FPC}
+ {$MODE DELPHI}
+{$ENDIF}
+
{Triggers avaliable (edit the fields bellow)}
+{$IFNDef FPC}
{$DEFINE UseDelphi} //Disable fat vcl units (perfect to small apps)
+{$ENDIF}
+
{$DEFINE ErrorOnUnknownCritical} //Error when finds an unknown critical chunk
{$DEFINE CheckCRC} //Enables CRC checking
{$DEFINE RegisterGraphic} //Registers TPNGObject to use with TPicture
@@ -122,8 +129,17 @@ interface
uses
- Windows {$IFDEF UseDelphi}, Classes, Graphics, SysUtils{$ENDIF} {$IFDEF Debug},
- dialogs{$ENDIF}, pngzlib, pnglang;
+ Windows,
+ {$IFDEF UseDelphi}
+ Classes,
+ Graphics,
+ SysUtils,
+ {$ENDIF}
+ {$IFDEF Debug}
+ dialogs,
+ {$ENDIF}
+ pngzlib,
+ pnglang;
{$IFNDEF UseDelphi}
const
@@ -1249,8 +1265,7 @@ begin
if Output = nil then
GetMem(Output, OutputSize) else ReallocMem(Output, OutputSize);
{Copies the new data}
- CopyMemory(Ptr(Longint(Output) + OutputSize - total_out),
- @Buffer, total_out);
+ CopyMemory(pointer(Longint(Output) + OutputSize - total_out), @Buffer, total_out);
end {if (InflateRet = Z_STREAM_END) or (InflateRet = 0)}
{Now tests for errors}
else if InflateRet < 0 then
@@ -1309,8 +1324,7 @@ begin
GetMem(Output, OutputSize) else ReallocMem(Output, OutputSize);
{Copies the new data}
- CopyMemory(Ptr(Longint(Output) + OutputSize - total_out),
- @Buffer, total_out);
+ CopyMemory(Pointer(Longint(Output) + OutputSize - total_out), @Buffer, total_out);
end {if (InflateRet = Z_STREAM_END) or (InflateRet = 0)}
{Now tests for errors}
else if DeflateRet < 0 then
@@ -1676,7 +1690,7 @@ function TStream.GetSize: Longint;
function TResourceStream.Read(var Buffer; Count: Integer): Cardinal;
begin
//Returns data
- CopyMemory(@Buffer, Ptr(Longint(Memory) + Position), Count);
+ CopyMemory(@Buffer, pointer(Longint(Memory) + Position), Count);
//Update position
inc(Position, Count);
//Returns
@@ -1938,9 +1952,9 @@ begin
if Keyword <> '' then
CopyMemory(Data, @fKeyword[1], Length(Keyword));
{Compression method 0 (inflate/deflate)}
- pByte(Ptr(Longint(Data) + Length(Keyword) + 1))^ := 0;
+ pByte(pointer(Longint(Data) + Length(Keyword) + 1))^ := 0;
if OutputSize > 0 then
- CopyMemory(Ptr(Longint(Data) + Length(Keyword) + 2), Output, OutputSize);
+ CopyMemory(pointer(Longint(Data) + Length(Keyword) + 2), Output, OutputSize);
{Let ancestor calculate crc and save}
Result := SaveData(Stream);
@@ -1969,8 +1983,7 @@ begin
{Get text}
fKeyword := PChar(Data);
SetLength(fText, Size - Length(fKeyword) - 1);
- CopyMemory(@fText[1], Ptr(Longint(Data) + Length(fKeyword) + 1),
- Length(fText));
+ CopyMemory(@fText[1], pointer(Longint(Data) + Length(fKeyword) + 1), Length(fText));
end;
{Saving the chunk to a stream}
@@ -1984,8 +1997,7 @@ begin
if Keyword <> '' then
CopyMemory(Data, @fKeyword[1], Length(Keyword));
if Text <> '' then
- CopyMemory(Ptr(Longint(Data) + Length(Keyword) + 1), @fText[1],
- Length(Text));
+ CopyMemory(pointer(Longint(Data) + Length(Keyword) + 1), @fText[1], Length(Text));
{Let ancestor calculate crc and save}
Result := inherited SaveToStream(Stream);
end;
@@ -2819,12 +2831,10 @@ begin
{Get current row index}
CurrentRow := RowStart[CurrentPass];
{Get a pointer to the current row image data}
- Data := Ptr(Longint(Header.ImageData) + Header.BytesPerRow *
- (ImageHeight - 1 - CurrentRow));
- Trans := Ptr(Longint(Header.ImageAlpha) + ImageWidth * CurrentRow);
+ Data := pointer(Longint(Header.ImageData) + Header.BytesPerRow * (ImageHeight - 1 - CurrentRow));
+ Trans := pointer(Longint(Header.ImageAlpha) + ImageWidth * CurrentRow);
{$IFDEF Store16bits}
- Extra := Ptr(Longint(Header.ExtraImageData) + Header.BytesPerRow *
- (ImageHeight - 1 - CurrentRow));
+ Extra := pointer(Longint(Header.ExtraImageData) + Header.BytesPerRow * (ImageHeight - 1 - CurrentRow));
{$ENDIF}
if Row_Bytes > 0 then {There must have bytes for this interlaced pass}
@@ -3808,9 +3818,8 @@ begin
{Get current row index}
CurrentRow := RowStart[CurrentPass];
{Get a pointer to the current row image data}
- Data := Ptr(Longint(Header.ImageData) + Header.BytesPerRow *
- (ImageHeight - 1 - CurrentRow));
- Trans := Ptr(Longint(Header.ImageAlpha) + ImageWidth * CurrentRow);
+ Data := pointer(Longint(Header.ImageData) + Header.BytesPerRow * (ImageHeight - 1 - CurrentRow));
+ Trans := pointer(Longint(Header.ImageAlpha) + ImageWidth * CurrentRow);
{Process all the image rows}
if Row_Bytes > 0 then
@@ -4021,9 +4030,9 @@ begin
FOR j := 0 TO fCount - 1 DO
with BitmapInfo.bmiColors[j] do
begin
- DataPtr^ := Owner.InverseGamma[rgbRed]; inc(DataPtr);
+ DataPtr^ := Owner.InverseGamma[rgbRed] ; inc(DataPtr);
DataPtr^ := Owner.InverseGamma[rgbGreen]; inc(DataPtr);
- DataPtr^ := Owner.InverseGamma[rgbBlue]; inc(DataPtr);
+ DataPtr^ := Owner.InverseGamma[rgbBlue] ; inc(DataPtr);
end {with BitmapInfo};
{Let ancestor do the rest of the work}
@@ -5100,8 +5109,7 @@ begin
(X mod (8 div DataDepth)) * DataDepth));
{Setting the new pixel}
- ByteData^ := ByteData^ or (ValEntry shl ((8 - DataDepth) -
- (X mod (8 div DataDepth)) * DataDepth));
+ ByteData^ := ByteData^ or (ValEntry shl ((8 - DataDepth) - (X mod (8 div DataDepth)) * DataDepth));
end {with png.Header}
end;
diff --git a/Game/Code/lib/PngImage/pngzlib.pas b/Game/Code/lib/PngImage/pngzlib.pas
index 12324f2c..3155946a 100644
--- a/Game/Code/lib/PngImage/pngzlib.pas
+++ b/Game/Code/lib/PngImage/pngzlib.pas
@@ -6,6 +6,10 @@
unit pngzlib;
+{$IFDEF FPC}
+ {$MODE DELPHI}
+{$ENDIF}
+
interface
type
@@ -35,14 +39,12 @@ type
reserved: Integer; // reserved for future use
end;
-function inflateInit_(var strm: TZStreamRec; version: PChar;
- recsize: Integer): Integer; forward;
-function inflate(var strm: TZStreamRec; flush: Integer): Integer; forward;
-function inflateEnd(var strm: TZStreamRec): Integer; forward;
-function deflateInit_(var strm: TZStreamRec; level: Integer; version: PChar;
- recsize: Integer): Integer; forward;
-function deflate(var strm: TZStreamRec; flush: Integer): Integer; forward;
-function deflateEnd(var strm: TZStreamRec): Integer; forward;
+function inflateInit_(var strm: TZStreamRec; version: PChar; recsize: Integer): Integer; // forward;
+function inflate(var strm: TZStreamRec; flush: Integer): Integer; //forward;
+function inflateEnd(var strm: TZStreamRec): Integer; //forward;
+function deflateInit_(var strm: TZStreamRec; level: Integer; version: PChar; recsize: Integer): Integer; //forward;
+function deflate(var strm: TZStreamRec; flush: Integer): Integer; //forward;
+function deflateEnd(var strm: TZStreamRec): Integer; //forward;
const
zlib_version = '1.1.4';
@@ -97,15 +99,17 @@ const
implementation
-{$L obj\deflate.obj}
-{$L obj\trees.obj}
-{$L obj\inflate.obj}
-{$L obj\inftrees.obj}
-{$L obj\adler32.obj}
-{$L obj\infblock.obj}
-{$L obj\infcodes.obj}
-{$L obj\infutil.obj}
-{$L obj\inffast.obj}
+{$IFNDef FPC}
+ {$L obj\deflate.obj}
+ {$L obj\trees.obj}
+ {$L obj\inflate.obj}
+ {$L obj\inftrees.obj}
+ {$L obj\adler32.obj}
+ {$L obj\infblock.obj}
+ {$L obj\infcodes.obj}
+ {$L obj\infutil.obj}
+ {$L obj\inffast.obj}
+{$ENDIF}
procedure _tr_init; external;
procedure _tr_tally; external;
@@ -146,8 +150,7 @@ function deflate(var strm: TZStreamRec; flush: Integer): Integer; external;
function deflateEnd(var strm: TZStreamRec): Integer; external;
// inflate decompresses data
-function inflateInit_(var strm: TZStreamRec; version: PChar;
- recsize: Integer): Integer; external;
+function inflateInit_(var strm: TZStreamRec; version: PChar; recsize: Integer): Integer; external;
function inflate(var strm: TZStreamRec; flush: Integer): Integer; external;
function inflateEnd(var strm: TZStreamRec): Integer; external;
function inflateReset(var strm: TZStreamRec): Integer; external;