ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/oup/current/Tools/TxmpReplace.pas
(Generate patch)

Comparing oup/current/Tools/TxmpReplace.pas (file contents):
Revision 192 by alloc, Thu May 24 17:48:18 2007 UTC vs.
Revision 193 by alloc, Sat May 26 14:24:55 2007 UTC

# Line 56 | Line 56 | begin
56  
57    OniImage_Old.LoadFromTXMP(ConnectionID, fileid);
58    old_size := OniImage_Old.GetImageSize(True);
59 <  OniImage_Old.DrawOnCanvas(image_txmppreview.Canvas, 0);
59 >  OniImage_Old.DrawOnCanvas(image_txmppreview.Canvas, 2);
60  
61    check_fading.Checked := OniImage_Old.HasMipMaps;
62   //  check_transparency.Checked := (depthbyte and $04) > 0;
# Line 73 | Line 73 | begin
73    if opend.Execute then
74    begin
75      OniImage_New.LoadFromFile(opend.FileName);
76 <    OniImage_New.DrawOnCanvas(image_bmppreview.Canvas, 0);
76 >    OniImage_New.DrawOnCanvas(image_bmppreview.Canvas, 1);
77      group_options.Enabled := True;
78    end;
79   end;
# Line 88 | Line 88 | var
88    oldfading: Byte;
89    datbyte: Word;
90    mem: TMemoryStream;
91 +  new_storetype: Byte;
92   begin
93    if filelist.ItemIndex >= 0 then
94    begin
# Line 114 | Line 115 | begin
115  
116      mem := TMemoryStream.Create;
117  
118 +    case OniImage_New.Format of
119 +      ifA1R5G5B5: new_storetype := 2;
120 +      ifA4R4G4B4: new_storetype := 0;
121 +      ifA8R8G8B8:
122 +        begin
123 +          new_storetype := 8;
124 +          OniImage_New.Format := ifX8R8G8B8;
125 +        end;
126 +      ifX8R8G8B8: new_storetype := 8;
127 +      ifDXT1: new_storetype := 9;
128 +    else
129 +      OniImage_New.Format := ifX8R8G8B8;
130 +      new_storetype := 8;
131 +    end;
132 +
133      OniImage_New.SaveDataToStream(check_fading.Checked, TStream(mem));
134  
135      newsize := mem.Size;
# Line 121 | Line 137 | begin
137  
138      if (newsize > old_size) and (ConManager.Connection[ConnectionID].Backend = DB_ONI) then
139        new_rawaddr := ConManager.Connection[ConnectionID].AppendRawFile(
140 <        not (ConManager.Connection[ConnectionID].DataOS = DOS_WIN),
125 <        mem.Size, mem)
140 >        not (ConManager.Connection[ConnectionID].DataOS = DOS_WIN), mem)
141      else
142      begin
143        new_rawaddr := old_rawaddr;
# Line 141 | Line 156 | begin
156      ConManager.Connection[ConnectionID].UpdateDatFilePart(fileid, $8C, 2, @datbyte);
157      datbyte := OniImage_New.Height[1];
158      ConManager.Connection[ConnectionID].UpdateDatFilePart(fileid, $8E, 2, @datbyte);
159 <    case OniImage_New.Format of
145 <      ifA1R5G5B5: datbyte := 2;
146 <      ifA4R4G4B4: datbyte := 0;
147 <      ifA8R8G8B8:
148 <        begin
149 <          datbyte := 8;
150 <          OniImage_New.Format := ifX8R8G8B8;
151 <        end;
152 <      ifX8R8G8B8: datbyte := 8;
153 <      ifDXT1: datbyte := 9;
154 <    else
155 <      OniImage_New.Format := ifX8R8G8B8;
156 <      datbyte := 8;
157 <    end;
158 <    ConManager.Connection[ConnectionID].UpdateDatFilePart(fileid, $90, 1, @datbyte);
159 >    ConManager.Connection[ConnectionID].UpdateDatFilePart(fileid, $90, 1, @new_storetype);
160      if not (ConManager.Connection[ConnectionID].DataOS = DOS_WIN) then
161        ConManager.Connection[ConnectionID].UpdateDatFilePart(fileid, $A0, 4, @new_rawaddr)
162      else

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)