7 |
|
|
8 |
|
type |
9 |
|
TFile_TXMP = class(TFile) |
10 |
– |
protected |
11 |
– |
procedure InitDatLinks; override; |
12 |
– |
procedure InitRawList; override; |
10 |
|
public |
11 |
|
procedure InitDataFields; override; |
12 |
|
end; |
105 |
|
end; |
106 |
|
|
107 |
|
|
111 |
– |
procedure TFile_TXMP.InitDatLinks; |
112 |
– |
begin |
113 |
– |
SetLength(FDatLinks, 2); |
114 |
– |
FDatLinks[0].SrcOffset := $94; |
115 |
– |
FDatLinks[0].DestID := GetDatLinkValue(FFileStream, $94); |
116 |
– |
FDatLinks[0].PosDestExts := '*'; |
117 |
– |
FDatLinks[1].SrcOffset := $98; |
118 |
– |
FDatLinks[1].DestID := GetDatLinkValue(FFileStream, $98); |
119 |
– |
FDatLinks[1].PosDestExts := 'TXMP'; |
120 |
– |
end; |
121 |
– |
|
122 |
– |
|
123 |
– |
procedure TFile_TXMP.InitRawList; |
124 |
– |
var |
125 |
– |
link_pc: Integer; |
126 |
– |
link_mac: Integer; |
127 |
– |
x, y: Word; |
128 |
– |
storetype: Byte; |
129 |
– |
datasize: Integer; |
130 |
– |
mipmap: Byte; |
131 |
– |
|
132 |
– |
function GetImgSize(w,h, storetype: Integer): Integer; |
133 |
– |
begin |
134 |
– |
case storetype of |
135 |
– |
0, 1, 2: |
136 |
– |
Result := w*h*2; |
137 |
– |
8: |
138 |
– |
Result := w*h*4; |
139 |
– |
9: |
140 |
– |
Result := Max(1, w div 4) * Max(1, h div 4) * 8; |
141 |
– |
else |
142 |
– |
Result := -1; |
143 |
– |
end; |
144 |
– |
end; |
145 |
– |
|
146 |
– |
begin |
147 |
– |
ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $88, SizeOf(mipmap), @mipmap); |
148 |
– |
ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $8C, SizeOf(x), @x); |
149 |
– |
ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $8E, SizeOf(y), @y); |
150 |
– |
ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $90, SizeOf(storetype), @storetype); |
151 |
– |
ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $9C, 4, @link_pc); |
152 |
– |
ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $A0, 4, @link_mac); |
153 |
– |
|
154 |
– |
datasize := GetImgSize(x, y, storetype); |
155 |
– |
if (mipmap and $01) > 0 then |
156 |
– |
begin |
157 |
– |
repeat |
158 |
– |
x := Max(x div 2, 1); |
159 |
– |
y := Max(y div 2, 1); |
160 |
– |
datasize := datasize + GetImgSize(x, y, storetype); |
161 |
– |
until (x = 1) and (y = 1); |
162 |
– |
end; |
163 |
– |
|
164 |
– |
SetLength(FRawParts, 1); |
165 |
– |
if ConManager.Connection[FConnectionID].DataOS = DOS_WIN then |
166 |
– |
begin |
167 |
– |
FRawParts[0].SrcOffset := $9C; |
168 |
– |
FRawParts[0].RawAddr := link_pc; |
169 |
– |
end |
170 |
– |
else |
171 |
– |
begin |
172 |
– |
FRawParts[0].SrcOffset := $A0; |
173 |
– |
FRawParts[0].RawAddr := link_mac; |
174 |
– |
end; |
175 |
– |
FRawParts[0].RawSize := datasize; |
176 |
– |
FRawParts[0].LocSep := not (ConManager.Connection[FConnectionID].DataOS = DOS_WIN); |
177 |
– |
end; |
178 |
– |
|
108 |
|
end. |
109 |
|
|