Advertisement
Guest User

Fixes access violation in Adler32CRC and other bugs

a guest
Jun 19th, 2014
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 22.74 KB | None | 0 0
  1. Index: Common/BGRABitmap/bgrafilters.pas
  2. ===================================================================
  3. --- Common/BGRABitmap/bgrafilters.pas   (revision 6392)
  4. +++ Common/BGRABitmap/bgrafilters.pas   (working copy)
  5. @@ -93,7 +93,7 @@
  6.    end;
  7.  
  8.  var
  9. -  xb, yb: integer;
  10. +  xb, yb: longint;
  11.    diag1, diag2, h1, h2, v1, v2: TSmartDiff;
  12.    c:      TBGRAPixel;
  13.    temp, median: TBGRACustomBitmap;
  14. @@ -203,10 +203,10 @@
  15.          //same color?
  16.          if diag1.cd < 0.3 then
  17.          begin
  18. -          c := MergeBGRA(bmp.GetPixel(xb, yb), bmp.GetPixel(xb + 1, yb + 1));
  19. +          c := MergeBGRA(bmp.GetPixel(longint(xb), longint(yb)), bmp.GetPixel(longint(xb + 1), longint(yb + 1)));
  20.            //restore
  21.            Result.SetPixel(xb * 3 + 2, yb * 3 + 2, bmp.GetPixel(xb, yb));
  22. -          Result.SetPixel(xb * 3 + 3, yb * 3 + 3, bmp.GetPixel(xb + 1, yb + 1));
  23. +          Result.SetPixel(xb * 3 + 3, yb * 3 + 3, bmp.GetPixel(longint(xb + 1), longint(yb + 1)));
  24.  
  25.            if (diag1.sd < h1.sd) and (diag1.sd < v2.sd) then
  26.              Result.SetPixel(xb * 3 + 3, yb * 3 + 2, c);
  27. @@ -245,8 +245,8 @@
  28.  const
  29.    nbpix = 8;
  30.  var
  31. -  yb, xb:   integer;
  32. -  dx, dy, n, j: integer;
  33. +  yb, xb:   longint;
  34. +  dx, dy, n, j: longint;
  35.    a_pixels: array[0..nbpix - 1] of TBGRAPixel;
  36.    sumR, sumG, sumB, sumA, RGBdiv, nbA: cardinal;
  37.    tempPixel, refPixel: TBGRAPixel;
  38. @@ -276,7 +276,7 @@
  39.          for dx := -1 to 1 do
  40.            if (dx <> 0) or (dy <> 0) then
  41.            begin
  42. -            a_pixels[n] := bmp.GetPixel(xb + dx, yb + dy);
  43. +            a_pixels[n] := bmp.GetPixel(longint(xb + dx), longint(yb + dy));
  44.              Inc(n);
  45.            end;
  46.  
  47. @@ -644,10 +644,10 @@
  48.      for xb := bounds.Left to bounds.Right - 1 do
  49.      begin
  50.        c[0] := bmp.getPixel(xb, yb);
  51. -      c[1] := bmp.getPixel(xb + idx1, yb + idy1);
  52. -      c[2] := bmp.getPixel(xb + idx2, yb + idy2);
  53. -      c[3] := bmp.getPixel(xb + idx3, yb + idy3);
  54. -      c[4] := bmp.getPixel(xb + idx4, yb + idy4);
  55. +      c[1] := bmp.getPixel(longint(xb + idx1), longint(yb + idy1));
  56. +      c[2] := bmp.getPixel(longint(xb + idx2), longint(yb + idy2));
  57. +      c[3] := bmp.getPixel(longint(xb + idx3), longint(yb + idy3));
  58. +      c[4] := bmp.getPixel(longint(xb + idx4), longint(yb + idy4));
  59.  
  60.        sumR   := 0;
  61.        sumG   := 0;
  62. @@ -1392,7 +1392,7 @@
  63.        for dy := -1 to 1 do
  64.          for dx := -1 to 1 do
  65.          begin
  66. -          a_pixels[n] := bmp.GetPixel(xb + dx, yb + dy);
  67. +          a_pixels[n] := bmp.GetPixel(longint(xb + dx), longint(yb + dy));
  68.            if a_pixels[n].alpha = 0 then
  69.              a_pixels[n] := BGRAPixelTransparent;
  70.            Inc(n);
  71. Index: Common/KromUtils.pas
  72. ===================================================================
  73. --- Common/KromUtils.pas    (revision 6392)
  74. +++ Common/KromUtils.pas    (working copy)
  75. @@ -519,19 +519,24 @@
  76.  
  77.  function Adler32CRC(S: TMemoryStream): Cardinal;
  78.  var
  79. -  i, A, B: Cardinal;
  80. +  i, A, B, OP: Cardinal;
  81. +  buf: byte;
  82.  begin
  83.    A := 1;
  84.    B := 0; // A is initialized to 1, B to 0
  85. -
  86. +  // remember original position
  87. +  OP := S.Position;
  88. +  S.Position := 0;
  89.    // We need to MOD B within cos it may overflow in files larger than 65kb, A overflows with files larger than 16mb
  90.    if S.Size <> 0 then
  91.      for i := 0 to S.Size - 1 do
  92.      begin
  93. -      inc(A, pbyte(Cardinal(S.Memory) + i)^);
  94. +      S.Read(buf, SizeOf(byte)); // increases position
  95. +      inc(A, buf);
  96.        B := (B + A) mod 65521; // 65521 (the largest prime number smaller than 2^16)
  97.      end;
  98.    A := A mod 65521;
  99. +  S.Position := OP;
  100.    Result := B + A shl 16; // reverse order for smaller numbers
  101.  end;
  102.  
  103. Index: Utils/RXXPacker/RXXPacker.dpr
  104. ===================================================================
  105. --- Utils/RXXPacker/RXXPacker.dpr   (revision 6392)
  106. +++ Utils/RXXPacker/RXXPacker.dpr   (working copy)
  107. @@ -1,7 +1,7 @@
  108.  program RXXPacker;
  109.  {$I ..\..\KaM_Remake.inc}
  110.  uses
  111. -  Forms,
  112. +  Forms, lazopenglcontext,
  113.    {$IFDEF FPC}Interfaces,{$ENDIF}
  114.    RXXPackerForm in 'RXXPackerForm.pas' {RXXForm1},
  115.    KM_PNG in '..\..\src\KM_PNG.pas',
  116. Index: Utils/RXXPacker/RXXPacker.lpi
  117. ===================================================================
  118. --- Utils/RXXPacker/RXXPacker.lpi   (revision 6392)
  119. +++ Utils/RXXPacker/RXXPacker.lpi   (working copy)
  120. @@ -29,22 +29,23 @@
  121.          <FormatVersion Value="1"/>
  122.        </local>
  123.      </RunParams>
  124. -    <RequiredPackages Count="1">
  125. +    <RequiredPackages Count="2">
  126.        <Item1>
  127. +        <PackageName Value="LazOpenGLContext"/>
  128. +      </Item1>
  129. +      <Item2>
  130.          <PackageName Value="LCL"/>
  131. -      </Item1>
  132. +      </Item2>
  133.      </RequiredPackages>
  134. -    <Units Count="13">
  135. +    <Units Count="18">
  136.        <Unit0>
  137.          <Filename Value="RXXPacker.dpr"/>
  138.          <IsPartOfProject Value="True"/>
  139.          <UnitName Value="RXXPacker"/>
  140. -        <EditorIndex Value="6"/>
  141.          <WindowIndex Value="0"/>
  142.          <TopLine Value="1"/>
  143.          <CursorPos X="46" Y="16"/>
  144. -        <UsageCount Value="31"/>
  145. -        <Loaded Value="True"/>
  146. +        <UsageCount Value="33"/>
  147.          <DefaultSyntaxHighlighter Value="Delphi"/>
  148.        </Unit0>
  149.        <Unit1>
  150. @@ -54,13 +55,10 @@
  151.          <HasResources Value="True"/>
  152.          <ResourceBaseClass Value="Form"/>
  153.          <UnitName Value="RXXPackerForm"/>
  154. -        <EditorIndex Value="0"/>
  155.          <WindowIndex Value="0"/>
  156. -        <TopLine Value="1"/>
  157. -        <CursorPos X="48" Y="13"/>
  158. -        <UsageCount Value="31"/>
  159. -        <Loaded Value="True"/>
  160. -        <LoadedDesigner Value="True"/>
  161. +        <TopLine Value="115"/>
  162. +        <CursorPos X="29" Y="189"/>
  163. +        <UsageCount Value="33"/>
  164.          <DefaultSyntaxHighlighter Value="Delphi"/>
  165.        </Unit1>
  166.        <Unit2>
  167. @@ -75,13 +73,10 @@
  168.        <Unit3>
  169.          <Filename Value="..\..\KM_ResourceSprites.pas"/>
  170.          <UnitName Value="KM_ResourceSprites"/>
  171. -        <IsVisibleTab Value="True"/>
  172. -        <EditorIndex Value="7"/>
  173.          <WindowIndex Value="0"/>
  174.          <TopLine Value="401"/>
  175.          <CursorPos X="110" Y="430"/>
  176.          <UsageCount Value="15"/>
  177. -        <Loaded Value="True"/>
  178.          <DefaultSyntaxHighlighter Value="Delphi"/>
  179.        </Unit3>
  180.        <Unit4>
  181. @@ -104,12 +99,10 @@
  182.        <Unit6>
  183.          <Filename Value="..\..\Common\pngimage\zlibpas.pas"/>
  184.          <UnitName Value="zlibpas"/>
  185. -        <EditorIndex Value="5"/>
  186.          <WindowIndex Value="0"/>
  187.          <TopLine Value="24"/>
  188.          <CursorPos X="38" Y="39"/>
  189.          <UsageCount Value="15"/>
  190. -        <Loaded Value="True"/>
  191.          <DefaultSyntaxHighlighter Value="Delphi"/>
  192.        </Unit6>
  193.        <Unit7>
  194. @@ -124,45 +117,37 @@
  195.        <Unit8>
  196.          <Filename Value="..\..\KM_ResourceSpritesEdit.pas"/>
  197.          <UnitName Value="KM_ResourceSpritesEdit"/>
  198. -        <EditorIndex Value="3"/>
  199.          <WindowIndex Value="0"/>
  200.          <TopLine Value="400"/>
  201.          <CursorPos X="64" Y="421"/>
  202.          <UsageCount Value="15"/>
  203. -        <Loaded Value="True"/>
  204.          <DefaultSyntaxHighlighter Value="Delphi"/>
  205.        </Unit8>
  206.        <Unit9>
  207.          <Filename Value="..\..\Common\KM_PNG.pas"/>
  208.          <UnitName Value="KM_PNG"/>
  209. -        <EditorIndex Value="1"/>
  210.          <WindowIndex Value="0"/>
  211.          <TopLine Value="1"/>
  212.          <CursorPos X="43" Y="7"/>
  213.          <UsageCount Value="15"/>
  214. -        <Loaded Value="True"/>
  215.          <DefaultSyntaxHighlighter Value="Delphi"/>
  216.        </Unit9>
  217.        <Unit10>
  218.          <Filename Value="..\..\Common\BGRABitmap\bgradefaultbitmap.pas"/>
  219.          <UnitName Value="BGRADefaultBitmap"/>
  220. -        <EditorIndex Value="2"/>
  221.          <WindowIndex Value="0"/>
  222. -        <TopLine Value="22"/>
  223. +        <TopLine Value="1"/>
  224.          <CursorPos X="1" Y="1"/>
  225.          <UsageCount Value="15"/>
  226. -        <Loaded Value="True"/>
  227.          <DefaultSyntaxHighlighter Value="Delphi"/>
  228.        </Unit10>
  229.        <Unit11>
  230.          <Filename Value="..\..\Common\BGRABitmap\bgrabitmaptypes.pas"/>
  231.          <UnitName Value="BGRABitmapTypes"/>
  232. -        <EditorIndex Value="4"/>
  233.          <WindowIndex Value="0"/>
  234. -        <TopLine Value="106"/>
  235. -        <CursorPos X="3" Y="39"/>
  236. +        <TopLine Value="228"/>
  237. +        <CursorPos X="15" Y="238"/>
  238.          <UsageCount Value="12"/>
  239. -        <Loaded Value="True"/>
  240.          <DefaultSyntaxHighlighter Value="Delphi"/>
  241.        </Unit11>
  242.        <Unit12>
  243. @@ -174,127 +159,176 @@
  244.          <UsageCount Value="10"/>
  245.          <DefaultSyntaxHighlighter Value="Delphi"/>
  246.        </Unit12>
  247. +      <Unit13>
  248. +        <Filename Value="..\..\Common\BGRABitmap\bgrafilters.pas"/>
  249. +        <UnitName Value="BGRAFilters"/>
  250. +        <WindowIndex Value="0"/>
  251. +        <TopLine Value="1385"/>
  252. +        <CursorPos X="74" Y="1395"/>
  253. +        <UsageCount Value="10"/>
  254. +        <DefaultSyntaxHighlighter Value="Delphi"/>
  255. +      </Unit13>
  256. +      <Unit14>
  257. +        <Filename Value="..\..\..\..\..\usr\share\fpcsrc\packages\fcl-image\src\fpimage.pp"/>
  258. +        <UnitName Value="FPimage"/>
  259. +        <WindowIndex Value="0"/>
  260. +        <TopLine Value="90"/>
  261. +        <CursorPos X="16" Y="112"/>
  262. +        <UsageCount Value="10"/>
  263. +      </Unit14>
  264. +      <Unit15>
  265. +        <Filename Value="..\..\src\KM_Render.pas"/>
  266. +        <UnitName Value="KM_Render"/>
  267. +        <WindowIndex Value="0"/>
  268. +        <TopLine Value="1"/>
  269. +        <CursorPos X="35" Y="6"/>
  270. +        <UsageCount Value="10"/>
  271. +        <DefaultSyntaxHighlighter Value="Delphi"/>
  272. +      </Unit15>
  273. +      <Unit16>
  274. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  275. +        <UnitName Value="KromUtils"/>
  276. +        <IsVisibleTab Value="True"/>
  277. +        <EditorIndex Value="0"/>
  278. +        <WindowIndex Value="0"/>
  279. +        <TopLine Value="519"/>
  280. +        <CursorPos X="1" Y="536"/>
  281. +        <UsageCount Value="11"/>
  282. +        <Loaded Value="True"/>
  283. +        <DefaultSyntaxHighlighter Value="Delphi"/>
  284. +      </Unit16>
  285. +      <Unit17>
  286. +        <Filename Value="..\..\src\res\KM_ResHouses.pas"/>
  287. +        <UnitName Value="KM_ResHouses"/>
  288. +        <EditorIndex Value="1"/>
  289. +        <WindowIndex Value="0"/>
  290. +        <TopLine Value="778"/>
  291. +        <CursorPos X="27" Y="798"/>
  292. +        <UsageCount Value="11"/>
  293. +        <Loaded Value="True"/>
  294. +        <DefaultSyntaxHighlighter Value="Delphi"/>
  295. +      </Unit17>
  296.      </Units>
  297.      <JumpHistory Count="30" HistoryIndex="29">
  298.        <Position1>
  299. -        <Filename Value="..\..\Common\BGRABitmap\bgradefaultbitmap.pas"/>
  300. -        <Caret Line="631" Column="20" TopLine="596"/>
  301. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  302. +        <Caret Line="529" Column="1" TopLine="516"/>
  303.        </Position1>
  304.        <Position2>
  305. -        <Filename Value="..\..\Common\BGRABitmap\bgradefaultbitmap.pas"/>
  306. -        <Caret Line="633" Column="22" TopLine="598"/>
  307. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  308. +        <Caret Line="539" Column="20" TopLine="519"/>
  309.        </Position2>
  310.        <Position3>
  311. -        <Filename Value="..\..\Common\BGRABitmap\bgradefaultbitmap.pas"/>
  312. -        <Caret Line="3621" Column="49" TopLine="3586"/>
  313. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  314. +        <Caret Line="525" Column="1" TopLine="519"/>
  315.        </Position3>
  316.        <Position4>
  317. -        <Filename Value="..\..\Common\BGRABitmap\bgradefaultbitmap.pas"/>
  318. -        <Caret Line="1" Column="1" TopLine="1"/>
  319. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  320. +        <Caret Line="526" Column="1" TopLine="519"/>
  321.        </Position4>
  322.        <Position5>
  323. -        <Filename Value="..\..\KM_ResourceSprites.pas"/>
  324. -        <Caret Line="389" Column="21" TopLine="368"/>
  325. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  326. +        <Caret Line="528" Column="1" TopLine="519"/>
  327.        </Position5>
  328.        <Position6>
  329. -        <Filename Value="..\..\KM_ResourceSprites.pas"/>
  330. -        <Caret Line="388" Column="29" TopLine="368"/>
  331. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  332. +        <Caret Line="529" Column="1" TopLine="519"/>
  333.        </Position6>
  334.        <Position7>
  335. -        <Filename Value="..\..\Common\KM_PNG.pas"/>
  336. -        <Caret Line="1" Column="1" TopLine="1"/>
  337. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  338. +        <Caret Line="531" Column="1" TopLine="519"/>
  339.        </Position7>
  340.        <Position8>
  341. -        <Filename Value="..\..\Common\KM_PNG.pas"/>
  342. -        <Caret Line="41" Column="10" TopLine="20"/>
  343. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  344. +        <Caret Line="532" Column="1" TopLine="519"/>
  345.        </Position8>
  346.        <Position9>
  347. -        <Filename Value="..\..\Common\KM_PNG.pas"/>
  348. -        <Caret Line="1" Column="1" TopLine="1"/>
  349. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  350. +        <Caret Line="534" Column="1" TopLine="519"/>
  351.        </Position9>
  352.        <Position10>
  353. -        <Filename Value="..\..\Common\KM_PNG.pas"/>
  354. -        <Caret Line="54" Column="7" TopLine="20"/>
  355. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  356. +        <Caret Line="535" Column="1" TopLine="519"/>
  357.        </Position10>
  358.        <Position11>
  359. -        <Filename Value="..\..\Common\KM_PNG.pas"/>
  360. -        <Caret Line="41" Column="26" TopLine="14"/>
  361. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  362. +        <Caret Line="536" Column="1" TopLine="519"/>
  363.        </Position11>
  364.        <Position12>
  365. -        <Filename Value="..\..\Common\KM_PNG.pas"/>
  366. -        <Caret Line="40" Column="53" TopLine="20"/>
  367. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  368. +        <Caret Line="532" Column="1" TopLine="519"/>
  369.        </Position12>
  370.        <Position13>
  371. -        <Filename Value="..\..\Common\KM_PNG.pas"/>
  372. -        <Caret Line="39" Column="27" TopLine="20"/>
  373. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  374. +        <Caret Line="534" Column="1" TopLine="519"/>
  375.        </Position13>
  376.        <Position14>
  377. -        <Filename Value="..\..\Common\BGRABitmap\bgradefaultbitmap.pas"/>
  378. -        <Caret Line="1" Column="1" TopLine="22"/>
  379. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  380. +        <Caret Line="535" Column="1" TopLine="519"/>
  381.        </Position14>
  382.        <Position15>
  383. -        <Filename Value="..\..\Common\BGRABitmap\bgrabitmaptypes.pas"/>
  384. -        <Caret Line="1" Column="1" TopLine="10"/>
  385. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  386. +        <Caret Line="536" Column="1" TopLine="519"/>
  387.        </Position15>
  388.        <Position16>
  389. -        <Filename Value="..\..\Common\KM_PNG.pas"/>
  390. -        <Caret Line="39" Column="27" TopLine="20"/>
  391. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  392. +        <Caret Line="532" Column="1" TopLine="519"/>
  393.        </Position16>
  394.        <Position17>
  395. -        <Filename Value="..\..\Common\KM_PNG.pas"/>
  396. -        <Caret Line="41" Column="30" TopLine="20"/>
  397. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  398. +        <Caret Line="534" Column="1" TopLine="519"/>
  399.        </Position17>
  400.        <Position18>
  401. -        <Filename Value="..\..\Common\KM_PNG.pas"/>
  402. -        <Caret Line="1" Column="1" TopLine="1"/>
  403. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  404. +        <Caret Line="535" Column="1" TopLine="519"/>
  405.        </Position18>
  406.        <Position19>
  407. -        <Filename Value="..\..\Common\KM_PNG.pas"/>
  408. -        <Caret Line="41" Column="56" TopLine="20"/>
  409. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  410. +        <Caret Line="536" Column="1" TopLine="519"/>
  411.        </Position19>
  412.        <Position20>
  413. -        <Filename Value="..\..\Common\KM_PNG.pas"/>
  414. -        <Caret Line="104" Column="36" TopLine="77"/>
  415. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  416. +        <Caret Line="532" Column="1" TopLine="519"/>
  417.        </Position20>
  418.        <Position21>
  419. -        <Filename Value="..\..\Common\KM_PNG.pas"/>
  420. -        <Caret Line="43" Column="66" TopLine="20"/>
  421. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  422. +        <Caret Line="534" Column="1" TopLine="519"/>
  423.        </Position21>
  424.        <Position22>
  425. -        <Filename Value="..\..\KM_ResourceSpritesEdit.pas"/>
  426. -        <Caret Line="28" Column="80" TopLine="25"/>
  427. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  428. +        <Caret Line="535" Column="1" TopLine="519"/>
  429.        </Position22>
  430.        <Position23>
  431. -        <Filename Value="..\..\KM_ResourceSpritesEdit.pas"/>
  432. -        <Caret Line="5" Column="1" TopLine="1"/>
  433. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  434. +        <Caret Line="536" Column="1" TopLine="519"/>
  435.        </Position23>
  436.        <Position24>
  437. -        <Filename Value="..\..\KM_ResourceSprites.pas"/>
  438. -        <Caret Line="447" Column="72" TopLine="415"/>
  439. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  440. +        <Caret Line="532" Column="1" TopLine="519"/>
  441.        </Position24>
  442.        <Position25>
  443. -        <Filename Value="..\..\KM_ResourceSprites.pas"/>
  444. -        <Caret Line="689" Column="1" TopLine="668"/>
  445. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  446. +        <Caret Line="534" Column="1" TopLine="519"/>
  447.        </Position25>
  448.        <Position26>
  449. -        <Filename Value="..\..\KM_ResourceSprites.pas"/>
  450. -        <Caret Line="465" Column="75" TopLine="432"/>
  451. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  452. +        <Caret Line="535" Column="1" TopLine="519"/>
  453.        </Position26>
  454.        <Position27>
  455. -        <Filename Value="..\..\KM_ResourceSpritesEdit.pas"/>
  456. -        <Caret Line="268" Column="3" TopLine="300"/>
  457. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  458. +        <Caret Line="536" Column="1" TopLine="519"/>
  459.        </Position27>
  460.        <Position28>
  461. -        <Filename Value="..\..\KM_ResourceSprites.pas"/>
  462. -        <Caret Line="192" Column="64" TopLine="171"/>
  463. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  464. +        <Caret Line="532" Column="1" TopLine="519"/>
  465.        </Position28>
  466.        <Position29>
  467. -        <Filename Value="..\..\KM_ResourceSprites.pas"/>
  468. -        <Caret Line="372" Column="1" TopLine="361"/>
  469. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  470. +        <Caret Line="534" Column="1" TopLine="519"/>
  471.        </Position29>
  472.        <Position30>
  473. -        <Filename Value="..\..\KM_ResourceSprites.pas"/>
  474. -        <Caret Line="374" Column="3" TopLine="353"/>
  475. +        <Filename Value="..\..\Common\KromUtils.pas"/>
  476. +        <Caret Line="535" Column="1" TopLine="519"/>
  477.        </Position30>
  478.      </JumpHistory>
  479.    </ProjectOptions>
  480. Index: Utils/RXXPacker/RXXPackerForm.lfm
  481. ===================================================================
  482. --- Utils/RXXPacker/RXXPackerForm.lfm   (revision 6392)
  483. +++ Utils/RXXPacker/RXXPackerForm.lfm   (working copy)
  484. @@ -14,12 +14,12 @@
  485.    OnCreate = FormCreate
  486.    OnDestroy = FormDestroy
  487.    Position = poDesktopCenter
  488. -  LCLVersion = '0.9.30.2'
  489. +  LCLVersion = '1.0.8.0'
  490.    object Label1: TLabel
  491.      Left = 16
  492.      Height = 14
  493.      Top = 176
  494. -    Width = 32
  495. +    Width = 38
  496.      Caption = 'Label1'
  497.      ParentColor = False
  498.    end
  499. @@ -41,6 +41,8 @@
  500.      Anchors = [akTop, akLeft, akRight, akBottom]
  501.      ItemHeight = 0
  502.      MultiSelect = True
  503. +    ScrollWidth = 255
  504.      TabOrder = 1
  505. +    TopIndex = -1
  506.    end
  507.  end
  508. Index: Utils/RXXPacker/RXXPackerForm.pas
  509. ===================================================================
  510. --- Utils/RXXPacker/RXXPackerForm.pas   (revision 6392)
  511. +++ Utils/RXXPacker/RXXPackerForm.pas   (working copy)
  512. @@ -3,7 +3,8 @@
  513.  interface
  514.  uses
  515.    Classes, Controls, Dialogs,
  516. -  ExtCtrls, Forms, Graphics, Spin, StdCtrls, SysUtils, TypInfo, Windows,
  517. +  ExtCtrls, Forms, Graphics, Spin, StdCtrls, SysUtils, TypInfo,
  518. +  LclIntf, // GetTickCount
  519.    {$IFDEF FPC} LResources, {$ENDIF}
  520.    KM_Defaults, KM_Log, KM_Pics, KM_ResPalettes, KM_ResSprites, KM_ResSpritesEdit;
  521.  
  522. @@ -34,7 +35,7 @@
  523.  var
  524.    RT: TRXType;
  525.  begin
  526. -  ExeDir := ExtractFilePath(Application.ExeName) + '..\..\';
  527. +  ExeDir := ExtractFilePath(Application.ExeName) + '..' + PathDelim + '..' + PathDelim;
  528.  
  529.    Caption := 'RXX Packer (' + GAME_REVISION + ')';
  530.  
  531. @@ -42,7 +43,7 @@
  532.    gLog := TKMLog.Create(ExeDir + 'RXXPacker.log');
  533.  
  534.    fPalettes := TKMPalettes.Create;
  535. -  fPalettes.LoadPalettes(ExeDir + 'data\gfx\');
  536. +  fPalettes.LoadPalettes(ExeDir + 'data' + PathDelim + 'gfx' + PathDelim);
  537.  
  538.    for RT := Low(TRXType) to High(TRXType) do
  539.      ListBox1.Items.Add(GetEnumName(TypeInfo(TRXType), Integer(RT)));
  540. @@ -89,8 +90,8 @@
  541.    btnPackRXX.Enabled := False;
  542.    Tick := GetTickCount;
  543.  
  544. -  Assert(DirectoryExists(ExeDir + 'SpriteResource\'),
  545. -         'Cannot find ' + ExeDir + 'SpriteResource\ folder.'+#10#13+
  546. +  Assert(DirectoryExists(ExeDir + 'SpriteResource' + PathDelim),
  547. +         'Cannot find ' + ExeDir + 'SpriteResource' + PathDelim + ' folder.'+#10#13+
  548.           'Please make sure this folder exists.');
  549.  
  550.    for I := 0 to ListBox1.Items.Count - 1 do
  551. @@ -97,10 +98,10 @@
  552.    if ListBox1.Selected[I] then
  553.    begin
  554.      RT := TRXType(I);
  555. -    RXName := ExeDir + 'SpriteResource\' + RXInfo[RT].FileName + '.rx';
  556. +    RXName := ExeDir + 'SpriteResource' + PathDelim + RXInfo[RT].FileName + '.rx';
  557.      Assert((RT = rxTiles) or FileExists(RXName),
  558.             'Cannot find ' + RXName + ' file.'+#10#13+
  559. -           'Please copy the file from your KaM\data\gfx\res\ folder.');
  560. +           'Please copy the file from your KaM' + PathDelim + 'data' + PathDelim + 'gfx' + PathDelim + 'res' + PathDelim + ' folder.');
  561.  
  562.      SpritePack := TKMSpritePackEdit.Create(RT, fPalettes);
  563.      try
  564. @@ -108,11 +109,11 @@
  565.        if RT <> rxTiles then
  566.        begin
  567.          SpritePack.LoadFromRXFile(RXName);
  568. -        SpritePack.OverloadFromFolder(ExeDir + 'SpriteResource\');
  569. +        SpritePack.OverloadFromFolder(ExeDir + 'SpriteResource' + PathDelim);
  570.        end
  571.        else
  572. -      if DirectoryExists(ExeDir + 'SpriteResource\') then
  573. -        SpritePack.LoadFromFolder(ExeDir + 'SpriteResource\');
  574. +      if DirectoryExists(ExeDir + 'SpriteResource' + PathDelim) then
  575. +        SpritePack.LoadFromFolder(ExeDir + 'SpriteResource' + PathDelim);
  576.  
  577.        //Tiles must stay the same size as they can't use pivots
  578.        if RT <> rxTiles then
  579. @@ -132,7 +133,7 @@
  580.        //  SpritePack.SoftWater(nil);
  581.  
  582.        //Save
  583. -      SpritePack.SaveToRXXFile(ExeDir + 'Data\Sprites\' + RXInfo[RT].FileName + '.rxx');
  584. +      SpritePack.SaveToRXXFile(ExeDir + 'Data' + PathDelim + 'Sprites' + PathDelim + RXInfo[RT].FileName + '.rxx');
  585.  
  586.        //Generate alpha shadows for the following sprite packs
  587.        if RT in [rxHouses,rxUnits,rxGui,rxTrees] then
  588. @@ -174,7 +175,7 @@
  589.          else
  590.            SpritePack.SoftenShadows;
  591.  
  592. -        SpritePack.SaveToRXXFile(ExeDir + 'Data\Sprites\' + RXInfo[RT].FileName + '_a.rxx');
  593. +        SpritePack.SaveToRXXFile(ExeDir + 'Data' + PathDelim + 'Sprites' + PathDelim + RXInfo[RT].FileName + '_a.rxx');
  594.        end;
  595.      finally
  596.        SpritePack.Free;
  597. Index: src/KM_Render.pas
  598. ===================================================================
  599. --- src/KM_Render.pas   (revision 6392)
  600. +++ src/KM_Render.pas   (working copy)
  601. @@ -282,4 +282,4 @@
  602.  end;
  603.  
  604.  
  605. -end.
  606. +end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement