MacOS stability fixes. Some code review. Other fixes.

This commit is contained in:
meffi@lab313.ru
2014-04-21 00:23:36 +00:00
parent 83bedc86af
commit 066eba1353
8 changed files with 200 additions and 201 deletions

View File

@@ -21,7 +21,9 @@
</i18n>
<VersionInfo>
<UseVersionInfo Value="True"/>
<AutoIncrementBuild Value="True"/>
<MajorVersionNr Value="1"/>
<RevisionNr Value="67"/>
<StringTable CompanyName="Lab 313" FileDescription="The best TIMs tool ever!:)" ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1">
@@ -128,7 +130,15 @@
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<RelocatableUnit Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2Set"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>

View File

@@ -1,134 +1,138 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<PathDelim Value="\"/>
<Version Value="9"/>
<BuildModes Active="Default"/>
<Units Count="13">
<Unit0>
<Filename Value="tim2view.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="tim2view"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="3"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="46" Y="9"/>
<UsageCount Value="32"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="umain.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmMain"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="umain"/>
<EditorIndex Value="0"/>
<WindowIndex Value="0"/>
<TopLine Value="108"/>
<CursorPos X="65" Y="113"/>
<UsageCount Value="32"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="edc.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="edc"/>
<UsageCount Value="32"/>
</Unit2>
<Unit3>
<Filename Value="ecc.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ecc"/>
<UsageCount Value="32"/>
</Unit3>
<Unit4>
<Filename Value="ucommon.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ucommon"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="35" Y="6"/>
<UsageCount Value="32"/>
</Unit4>
<Unit5>
<Filename Value="utim.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="utim"/>
<EditorIndex Value="2"/>
<WindowIndex Value="0"/>
<TopLine Value="311"/>
<CursorPos X="7" Y="323"/>
<UsageCount Value="32"/>
<Loaded Value="True"/>
</Unit5>
<Unit6>
<Filename Value="ucdimage.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ucdimage"/>
<WindowIndex Value="0"/>
<TopLine Value="81"/>
<CursorPos X="95" Y="89"/>
<UsageCount Value="32"/>
</Unit6>
<Unit7>
<Filename Value="usettings.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="usettings"/>
<WindowIndex Value="0"/>
<TopLine Value="17"/>
<CursorPos X="76" Y="31"/>
<UsageCount Value="32"/>
</Unit7>
<Unit8>
<Filename Value="uscanresult.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uscanresult"/>
<EditorIndex Value="4"/>
<WindowIndex Value="0"/>
<TopLine Value="52"/>
<CursorPos X="64" Y="25"/>
<UsageCount Value="32"/>
<Loaded Value="True"/>
</Unit8>
<Unit9>
<Filename Value="uscanthread.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uscanthread"/>
<EditorIndex Value="1"/>
<WindowIndex Value="0"/>
<TopLine Value="79"/>
<CursorPos X="75" Y="120"/>
<UsageCount Value="32"/>
<Loaded Value="True"/>
</Unit9>
<Unit10>
<Filename Value="ucpucount.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ucpucount"/>
<UsageCount Value="32"/>
</Unit10>
<Unit11>
<Filename Value="udrawtim.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="udrawtim"/>
<WindowIndex Value="0"/>
<TopLine Value="220"/>
<CursorPos X="30" Y="233"/>
<UsageCount Value="32"/>
</Unit11>
<Unit12>
<Filename Value="bgrabitmap\bgrabitmap.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="BGRABitmap"/>
<UsageCount Value="32"/>
</Unit12>
</Units>
<General>
<ActiveWindowIndexAtStart Value="0"/>
</General>
</ProjectSession>
<EditorMacros Count="0"/>
</CONFIG>
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<PathDelim Value="\"/>
<Version Value="9"/>
<BuildModes Active="Default"/>
<Units Count="13">
<Unit0>
<Filename Value="tim2view.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="tim2view"/>
<EditorIndex Value="5"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="52" Y="16"/>
<UsageCount Value="33"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="umain.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmMain"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="umain"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="0"/>
<WindowIndex Value="0"/>
<TopLine Value="242"/>
<CursorPos X="87" Y="265"/>
<UsageCount Value="33"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="edc.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="edc"/>
<UsageCount Value="33"/>
</Unit2>
<Unit3>
<Filename Value="ecc.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ecc"/>
<UsageCount Value="33"/>
</Unit3>
<Unit4>
<Filename Value="ucommon.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ucommon"/>
<EditorIndex Value="1"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="56" Y="12"/>
<UsageCount Value="33"/>
<Loaded Value="True"/>
</Unit4>
<Unit5>
<Filename Value="utim.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="utim"/>
<EditorIndex Value="3"/>
<WindowIndex Value="0"/>
<TopLine Value="285"/>
<CursorPos X="31" Y="299"/>
<UsageCount Value="33"/>
<Loaded Value="True"/>
</Unit5>
<Unit6>
<Filename Value="ucdimage.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ucdimage"/>
<WindowIndex Value="0"/>
<TopLine Value="81"/>
<CursorPos X="95" Y="89"/>
<UsageCount Value="33"/>
</Unit6>
<Unit7>
<Filename Value="usettings.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="usettings"/>
<WindowIndex Value="0"/>
<TopLine Value="17"/>
<CursorPos X="76" Y="31"/>
<UsageCount Value="33"/>
</Unit7>
<Unit8>
<Filename Value="uscanresult.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uscanresult"/>
<EditorIndex Value="6"/>
<WindowIndex Value="0"/>
<TopLine Value="16"/>
<CursorPos X="64" Y="25"/>
<UsageCount Value="33"/>
<Loaded Value="True"/>
</Unit8>
<Unit9>
<Filename Value="uscanthread.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uscanthread"/>
<EditorIndex Value="2"/>
<WindowIndex Value="0"/>
<TopLine Value="79"/>
<CursorPos X="75" Y="120"/>
<UsageCount Value="33"/>
<Loaded Value="True"/>
</Unit9>
<Unit10>
<Filename Value="ucpucount.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ucpucount"/>
<UsageCount Value="33"/>
</Unit10>
<Unit11>
<Filename Value="udrawtim.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="udrawtim"/>
<EditorIndex Value="4"/>
<WindowIndex Value="0"/>
<TopLine Value="40"/>
<CursorPos X="21" Y="45"/>
<UsageCount Value="33"/>
<Loaded Value="True"/>
</Unit11>
<Unit12>
<Filename Value="bgrabitmap\bgrabitmap.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="BGRABitmap"/>
<UsageCount Value="33"/>
</Unit12>
</Units>
<General>
<ActiveWindowIndexAtStart Value="0"/>
</General>
</ProjectSession>
<EditorMacros Count="0"/>
</CONFIG>

Binary file not shown.

View File

@@ -3,7 +3,7 @@ unit ucommon;
interface
const
cProgramName = 'Tim2View SVN.r65 by [Lab 313] (for ' +
cProgramName = 'Tim2View SVN.r67 by [Lab 313] (for ' +
{$IFDEF Linux}'Linux' + {$IFEND}
{$IFDEF Darwin}'Mac OS X' + {$IFEND}
{$IFDEF Windows}'Windows' + {$IFEND}
@@ -14,7 +14,6 @@ const
cAutoExtractionTimFormat = '%s_%.6d_%.2db' + '.tim';
cAutoExtractionPngFormat = '%s_%.6d_%.2db_%.2dc' + '.png';
cCLUTGridColsCount = 32;
sStatusBarScanningFile = 'Scanning File...';
sStatusBarTimsExtracting = 'TIMs Extracting...';

View File

@@ -34,7 +34,7 @@ begin
if (TIM^.HEAD^.bBPP in [cTIM4NC, cTIM8NC]) then
begin
Randomize;
for I := 1 to cRandomPaletteSize do
for I := 1 to $100 do
Result^[I - 1] := GetCLUTColor(TIM, CLUT_NUM, I - 1);
Exit;
@@ -51,7 +51,7 @@ var
P24: Integer;
begin
New(Result);
OFFSET := cTIMHeadSize + GetTIMCLUTSize(TIM) + cIMAGEHeadSize;
OFFSET := SizeOf(TTIMHeader) + GetTIMCLUTSize(TIM) + SizeOf(TIMAGEHeader);
RW := GetTimRealWidth(TIM);
case TIM^.HEAD^.bBPP of
@@ -227,7 +227,7 @@ var
COLS, Colors: Integer;
begin
Colors := GetTimColorsCount(TIM);
COLS := Min(Colors, cCLUTGridColsCount);
COLS := Min(Colors, 32);
Rect := Grid^.CellRect(X, Y);
if (Y * COLS + X) >= Colors then
@@ -277,7 +277,7 @@ var
X, Y, ROWS, COLS, COLORS: Integer;
begin
COLORS := GetTimColorsCount(TIM);
COLS := Min(COLORS, cCLUTGridColsCount);
COLS := Min(COLORS, 32);
Grid^.ColCount := COLS;
ROWS := Ceil(COLORS / COLS);

View File

@@ -1,13 +1,14 @@
object frmMain: TfrmMain
Left = 1017
Left = 561
Height = 590
Top = 147
Top = 213
Width = 780
HorzScrollBar.Page = 780
HorzScrollBar.Range = 489
VertScrollBar.Page = 570
VertScrollBar.Range = 344
ActiveControl = pnlList
AllowDropFiles = True
AutoScroll = True
ClientHeight = 570
ClientWidth = 780
Color = clBtnFace
@@ -580,6 +581,7 @@ object frmMain: TfrmMain
Top = 28
Width = 253
Align = alClient
AutoWidthLastColumn = True
Columns = <
item
Caption = '# / 0'
@@ -598,16 +600,16 @@ object frmMain: TfrmMain
item
Alignment = taCenter
Caption = 'CLUTs'
Width = 57
Width = 84
end>
ColumnClick = False
GridLines = True
HideSelection = False
OwnerData = True
PopupMenu = pmList
ReadOnly = True
RowSelect = True
TabOrder = 0
ToolTips = False
ViewStyle = vsReport
OnData = lvListData
OnSelectItem = lvListSelectItem
@@ -813,13 +815,11 @@ object frmMain: TfrmMain
item
Width = 50
end
item
Width = 50
end
item
Width = 50
end>
SimplePanel = False
SizeGrip = False
end
object dlgOpenFile: TOpenDialog
Title = 'Please, select File...'

View File

@@ -254,6 +254,7 @@ begin
SetTimsListCount(SelectedScanResult.Count);
actReturnFocus.Execute;
if lvList.Items.Count = 0 then Exit;
lvList.ItemIndex := 0;
lvList.Items[0].Focused := True;
lvList.Items[0].Selected := True;
@@ -261,7 +262,7 @@ end;
procedure TfrmMain.actAboutExecute(Sender: TObject);
begin
Application.MessageBox('Some "about strings" should be here!:)', 'About', MB_OK + MB_ICONINFORMATION);
Application.MessageBox(cProgramName + #13 + 'Some "about strings" should be here!:)', 'About', MB_OK + MB_ICONINFORMATION);
end;
procedure TfrmMain.actAssocTimsExecute(Sender: TObject);
@@ -646,6 +647,7 @@ end;
function TfrmMain.FGetSelectedScanResult: TScanResult;
begin
if cbbFiles.ItemIndex = -1 then Exit;
Result := ScanResults[cbbFiles.ItemIndex];
end;
@@ -902,23 +904,9 @@ begin
end;
procedure TfrmMain.SetCLUTListToNoCLUT;
var
I: Integer;
begin
if cbbCLUT.Items.Count > 0 then
begin
cbbCLUT.Items.BeginUpdate;
for I := 0 to cbbCLUT.Items.Count - 2 do
cbbCLUT.Items.Delete(I);
cbbCLUT.Items[0] := sThisTimHasNoClut;
cbbCLUT.Items.EndUpdate;
end
else
cbbCLUT.Items.Add(sThisTimHasNoClut);
cbbCLUT.Items.Clear;
cbbCLUT.Items.Add(sThisTimHasNoClut);
cbbCLUT.ItemIndex := 0;
end;
@@ -954,7 +942,6 @@ procedure TfrmMain.ShowTimInfo(ShowInfo: Boolean);
var
I: Integer;
TIM: PTIM;
ScanRes: TScanResult;
TimInfo: TTimInfo;
begin
for I := 1 to sbMain.Panels.Count do
@@ -962,15 +949,16 @@ begin
if not ShowInfo then Exit;
ScanRes := SelectedScanResult;
TimInfo := SelectedTimInfo;
TIM := SelectedTim;
I := 0;
sbMain.Panels[I].Text := Format('Position: 0x%x', [TimInfo.Position]);
sbMain.Panels[I].Text := Format('Pos: 0x%x', [TimInfo.Position]);
sbMain.Panels[I].Width := Canvas.GetTextWidth(sbMain.Panels[I].Text) + 8; Inc(I);
sbMain.Panels[I].Text := Format('Version: %d', [GetTimVersion(TIM)]);
sbMain.Panels[I].Text := Format('Ver: %d', [GetTimVersion(TIM)]);
sbMain.Panels[I].Width := Canvas.GetTextWidth(sbMain.Panels[I].Text) + 8; Inc(I);
sbMain.Panels[I].Text := Format('Good: %s', [TIMIsGoodStr(TIM)]);
sbMain.Panels[I].Width := Canvas.GetTextWidth(sbMain.Panels[I].Text) + 8; Inc(I);
if TIMHasCLUT(TIM) then
@@ -978,20 +966,16 @@ begin
sbMain.Panels[I].Alignment := taRightJustify;
sbMain.Panels[I].Text := 'CLUT:';
sbMain.Panels[I].Width := Canvas.GetTextWidth(sbMain.Panels[I].Text) + 20; Inc(I);
sbMain.Panels[I].Text := Format('VRAM.X: %d', [GetTimClutVRAMX(TIM)]);
sbMain.Panels[I].Text := Format('X/Y: %dx%d', [GetTimClutVRAMX(TIM), GetTimClutVRAMY(TIM)]);
sbMain.Panels[I].Width := Canvas.GetTextWidth(sbMain.Panels[I].Text) + 8; Inc(I);
sbMain.Panels[I].Text := Format('VRAM.Y: %d', [GetTimClutVRAMY(TIM)]);
sbMain.Panels[I].Width := Canvas.GetTextWidth(sbMain.Panels[I].Text) + 8; Inc(I);
sbMain.Panels[I].Text := Format('Colors/CLUT: %d', [GetTimColorsCount(TIM)]);
sbMain.Panels[I].Text := Format('Colors: %d', [GetTimColorsCount(TIM)]);
sbMain.Panels[I].Width := Canvas.GetTextWidth(sbMain.Panels[I].Text) + 8; Inc(I);
end;
sbMain.Panels[I].Alignment := taRightJustify;
sbMain.Panels[I].Text := 'IMAGE:';
sbMain.Panels[I].Width := Canvas.GetTextWidth(sbMain.Panels[I].Text) + 20; Inc(I);
sbMain.Panels[I].Text := Format('VRAM.X: %d', [GetTimImageVRAMX(TIM)]);
sbMain.Panels[I].Width := Canvas.GetTextWidth(sbMain.Panels[I].Text) + 8; Inc(I);
sbMain.Panels[I].Text := Format('VRAM.Y: %d', [GetTimImageVRAMY(TIM)]);
sbMain.Panels[I].Text := Format('X/Y: %dx%d', [GetTimImageVRAMX(TIM), GetTimImageVRAMY(TIM)]);
sbMain.Panels[I].Width := Canvas.GetTextWidth(sbMain.Panels[I].Text) + 8; Inc(I);
FreeTIM(TIM);

View File

@@ -26,16 +26,6 @@ const
cTIMNOCLUT = [cTIM4NC, cTIM8NC, cTIM16NC, cTIM24NC, cTIMMix];
cTIMBpp = [cTIM4C, cTIM8C, cTIM16C, cTIM24C, cTIM4NC, cTIM8NC, cTIM16NC, cTIM24NC, cTIMMix];
cCLUTColorsMax = 1024;
cCLUTCountMax = 512;
cIMAGEWidthMax = 1024;
cIMAGEHeightMax = 1024;
cCLUTHeadSize = $0C;
cIMAGEHeadSize = $0C;
cTIMHeadSize = 8;
cRandomPaletteSize = $100;
cTIMMaxSize = cTIMHeadSize + cCLUTColorsMax * cCLUTCountMax * 2 + cCLUTHeadSize + cIMAGEWidthMax * cIMAGEHeightMax * 2 + cIMAGEHeadSize;
type
TTIMHeader = packed record // TIM Header (8 bytes)
bMagic: byte; // $10 (1 byte)
@@ -46,7 +36,6 @@ type
// variants:
// [$08, $09, $0A, $0B, $02, $03, $00, $01]
end;
PTIMHeader = ^TTIMHeader;
type
@@ -57,7 +46,6 @@ type
wColorsCount: word; // Number of CLUT Colors (2 bytes)
wClutsCount: word; // Count of Palettes (2 bytes)
end;
PCLUTHeader = ^TCLUTHeader;
type
@@ -68,9 +56,17 @@ type
wWidth: word; // Image Width (not Real) (2 bytes)
wHeight: word; // Image Height (Real) (2 bytes)
end;
PIMAGEHeader = ^TIMAGEHeader;
//Constants
const
cCLUTColorsMax = 1024;
cCLUTCountMax = 512;
cIMAGEWidthMax = 1024;
cIMAGEHeightMax = 1024;
cTIMMaxSize = SizeOf(TTIMHeader) + cCLUTColorsMax * cCLUTCountMax * 2 + SizeOf(TCLUTHeader) + cIMAGEWidthMax * cIMAGEHeightMax * 2 + SizeOf(TIMAGEHeader);
//Constants
type
TTIMDataArray = array [0 .. cTIMMaxSize - 1] of byte;
PTIMDataArray = ^TTIMDataArray;
@@ -114,6 +110,7 @@ function GetTimWidth(TIM: PTIM): word;
function GetTimRealWidth(TIM: PTIM): word;
function GetTimHeight(TIM: PTIM): word;
function TIMIsGood(TIM: PTIM): Boolean;
function TIMIsGoodStr(TIM: PTIM): string;
function LoadTimFromBuf(BUFFER: pointer; var TIM: PTIM; var Position: Integer): Boolean;
function LoadTimFromFile(const FileName: string; var Position: Integer; ImageScan: Boolean; dwSize: Integer): PTIM;
procedure SaveTimToFile(const FileName: string; TIM: PTIM);
@@ -170,7 +167,7 @@ begin
CLUT_OFFSET := CLUT_NUM * GetTimColorsCount(TIM) * 2;
Move(TIM^.DATA^[cTIMHeadSize + cCLUTHeadSize + COLOR_NUM * 2 + CLUT_OFFSET], COLOR, 2);
Move(TIM^.DATA^[SizeOf(TTIMHeader) + SizeOf(TCLUTHeader) + COLOR_NUM * 2 + CLUT_OFFSET], COLOR, 2);
Result := ConvertTIMColor(COLOR);
end;
@@ -184,7 +181,7 @@ begin
CLUT_OFFSET := CLUT_NUM * GetTimColorsCount(TIM) * 2;
COLOR_TO_WRITE := ConvertCLUTColor(COLOR);
Move(COLOR_TO_WRITE, TIM^.DATA^[cTIMHeadSize + cCLUTHeadSize + COLOR_NUM * 2 + CLUT_OFFSET], 2);
Move(COLOR_TO_WRITE, TIM^.DATA^[SizeOf(TTIMHeader) + SizeOf(TCLUTHeader) + COLOR_NUM * 2 + CLUT_OFFSET], 2);
end;
function GetTimHeight(TIM: PTIM): word;
@@ -197,17 +194,17 @@ begin
Result := 0;
if not TIMHasCLUT(TIM) then Exit;
Result := TIM^.CLUT^.wColorsCount * TIM^.CLUT^.wClutsCount * 2 + cCLUTHeadSize;
Result := TIM^.CLUT^.wColorsCount * TIM^.CLUT^.wClutsCount * 2 + SizeOf(TCLUTHeader);
end;
function GetTIMIMAGESize(TIM: PTIM): Integer;
begin
Result := TIM^.IMAGE^.wWidth * TIM^.IMAGE^.wHeight * 2 + cIMAGEHeadSize;
Result := TIM^.IMAGE^.wWidth * TIM^.IMAGE^.wHeight * 2 + SizeOf(TIMAGEHeader);
end;
function GetTIMSize(TIM: PTIM): Integer;
begin
Result := GetTIMCLUTSize(TIM) + GetTIMIMAGESize(TIM) + cTIMHeadSize;
Result := GetTIMCLUTSize(TIM) + GetTIMIMAGESize(TIM) + SizeOf(TTIMHeader);
end;
function CheckVersion(TIM: PTIM): Boolean;
@@ -292,12 +289,17 @@ end;
procedure ClearTIM(TIM: PTIM);
begin
FillChar(TIM^.HEAD^, cTIMHeadSize, 0);
FillChar(TIM^.CLUT^, cCLUTHeadSize, 0);
FillChar(TIM^.IMAGE^, cIMAGEHeadSize, 0);
FillChar(TIM^.HEAD^, SizeOf(TTIMHeader), 0);
FillChar(TIM^.CLUT^, SizeOf(TCLUTHeader), 0);
FillChar(TIM^.IMAGE^, SizeOf(TIMAGEHeader), 0);
FillChar(TIM^.DATA^, cTIMMaxSize, 0);
end;
function TIMIsGoodStr(TIM: PTIM): string;
begin
if TIMIsGood(TIM) then Result := 'Yes' else Result := 'No';
end;
function LoadTimFromBuf(BUFFER: pointer; var TIM: PTIM; var Position: Integer): Boolean;
var
P: Integer;
@@ -311,18 +313,18 @@ begin
if TIM = nil then TIM := CreateTIM;
Move(PBytesArray(BUFFER)^[P], TIM^.HEAD^, cTIMHeadSize);
Move(PBytesArray(BUFFER)^[P], TIM^.HEAD^, SizeOf(TTIMHeader));
if not CheckHEAD(TIM) then Exit;
Inc(P, cTIMHeadSize);
Inc(P, SizeOf(TTIMHeader));
if TIMHasCLUT(TIM) then
begin
Move(PBytesArray(BUFFER)^[P], TIM^.CLUT^, cCLUTHeadSize);
Move(PBytesArray(BUFFER)^[P], TIM^.CLUT^, SizeOf(TCLUTHeader));
if not CheckCLUT(TIM) then Exit;
Inc(P, GetTIMCLUTSize(TIM));
end;
Move(PBytesArray(BUFFER)^[P], TIM^.IMAGE^, cIMAGEHeadSize);
Move(PBytesArray(BUFFER)^[P], TIM^.IMAGE^, SizeOf(TIMAGEHeader));
if not CheckIMAGE(TIM) then Exit;
if not CheckTIMSize(TIM) then Exit;