| 41 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 42 | 
   | 
 implementation | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 43 | 
   | 
 {$R *.dfm} | 
 
 
 
 
 
 
 
 
 
 
 
 | 44 | 
 < | 
 uses Main, ConnectionManager, ImagingTypes; | 
 
 
 
 
 
 
 
 
 
 | 44 | 
 > | 
 uses Main, ConnectionManager, ImagingTypes, TXMP; | 
 
 
 
 
 
 
 
 
 
 
 
 | 45 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 46 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 47 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 48 | 
   | 
 procedure TForm_TxmpReplace.SelectFile(fileinfo: TFileInfo); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 49 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 | 50 | 
 – | 
   mem:  TMemoryStream; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 50 | 
   | 
   fadingbyte, depthbyte, storebyte: Byte; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 51 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 52 | 
   | 
   fileid := fileinfo.ID; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 78 | 
   | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 79 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 80 | 
   | 
 procedure TForm_TxmpReplace.btn_loadClick(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 | 82 | 
 – | 
 var | 
 
 
 
 
 
 
 
 
 
 | 83 | 
 – | 
   mem:   TMemoryStream; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 81 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 82 | 
   | 
   if opend.Execute then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 83 | 
   | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 98 | 
   | 
   datbyte: Word; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 99 | 
   | 
   mem: TMemoryStream; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 100 | 
   | 
   new_storetype: Byte; | 
 
 
 
 
 
 
 
 
 
 
 
 | 101 | 
 < | 
   formatinfo: TImageFormatInfo; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 101 | 
 > | 
   i: Integer; | 
 
 
 
 
 
 | 102 | 
 > | 
 const | 
 
 
 
 
 
 | 103 | 
 > | 
   powers: array[0..8] of Integer = (1, 2, 4, 8, 16, 32, 64, 128, 256); | 
 
 
 
 
 
 
 
 
 
 
 
 | 104 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 105 | 
   | 
   if filelist.ItemIndex >= 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 106 | 
   | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 110 | 
   | 
     else | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 111 | 
   | 
       ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $9C, 4, @old_rawaddr); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 112 | 
   | 
  | 
 
 
 
 
 
 
 
 
 | 113 | 
 + | 
     if (OniImage_New.Width[1] > 256) or (OniImage_New.Height[1] > 256) then | 
 
 
 
 
 
 
 
 
 | 114 | 
 + | 
     begin | 
 
 
 
 
 
 
 
 
 | 115 | 
 + | 
       ShowMessage('Widht and height have to be smaller than or equal to 256.'); | 
 
 
 
 
 
 
 
 
 | 116 | 
 + | 
       Exit; | 
 
 
 
 
 
 
 
 
 | 117 | 
 + | 
     end; | 
 
 
 
 
 
 
 
 
 | 118 | 
 + | 
     for i := 0 to High(powers) do | 
 
 
 
 
 
 
 
 
 | 119 | 
 + | 
       if OniImage_New.Width[1] = powers[i] then | 
 
 
 
 
 
 
 
 
 | 120 | 
 + | 
         Break; | 
 
 
 
 
 
 
 
 
 | 121 | 
 + | 
     if i = Length(powers) then | 
 
 
 
 
 
 
 
 
 | 122 | 
 + | 
     begin | 
 
 
 
 
 
 
 
 
 | 123 | 
 + | 
       ShowMessage('Width has to be a power of 2 (1, 2, 4, 8, 16 ...)'); | 
 
 
 
 
 
 
 
 
 | 124 | 
 + | 
       Exit; | 
 
 
 
 
 
 
 
 
 | 125 | 
 + | 
     end; | 
 
 
 
 
 
 
 
 
 | 126 | 
 + | 
     for i := 0 to High(powers) do | 
 
 
 
 
 
 
 
 
 | 127 | 
 + | 
       if OniImage_New.Height[1] = powers[i] then | 
 
 
 
 
 
 
 
 
 | 128 | 
 + | 
         Break; | 
 
 
 
 
 
 
 
 
 | 129 | 
 + | 
     if i = Length(powers) then | 
 
 
 
 
 
 
 
 
 | 130 | 
 + | 
     begin | 
 
 
 
 
 
 
 
 
 | 131 | 
 + | 
       ShowMessage('Height has to be a power of 2 (1, 2, 4, 8, 16 ...)'); | 
 
 
 
 
 
 
 
 
 | 132 | 
 + | 
       Exit; | 
 
 
 
 
 
 
 
 
 | 133 | 
 + | 
     end; | 
 
 
 
 
 
 
 
 
 | 134 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 135 | 
   | 
     if (OniImage_Old.Width[1] <> OniImage_New.Width[1]) or | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 136 | 
   | 
       (OniImage_Old.Height[1] <> OniImage_New.Height[1]) then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 137 | 
   | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 224 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 225 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 226 | 
   | 
 procedure TForm_TxmpReplace.FormCreate(Sender: TObject); | 
 
 
 
 
 
 
 
 
 | 227 | 
 + | 
 var | 
 
 
 
 
 
 
 
 
 | 228 | 
 + | 
   TXMP: TFile_TXMP; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 229 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 230 | 
   | 
   inherited; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 231 | 
   | 
   OniImage_Old := TOniImage.Create; |