Advertisement
Guest User

usesDouble (mgr.inz.Player)

a guest
Jul 27th, 2012
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 23.45 KB | None | 0 0
  1. Index: byteinterpreter.pas
  2. ===================================================================
  3. --- byteinterpreter.pas (wersja 1481)
  4. +++ byteinterpreter.pas (kopia robocza)
  5. @@ -101,6 +101,8 @@
  6.            begin
  7.              if customtype.scriptUsesFloat then
  8.                customtype.ConvertFloatToData(s, ba)
  9. +            else if customtype.scriptUsesDouble then
  10. +              customtype.ConvertDoubleToData(d, ba)
  11.              else
  12.                customtype.ConvertIntegerToData(v, ba);
  13.  
  14. @@ -271,12 +273,14 @@
  15.            if ReadProcessMemory(processhandle,pointer(address),buf2,customtype.bytesize,x) then
  16.            begin
  17.              try
  18. -              if showashexadecimal and (customtype.scriptUsesFloat=false) then
  19. +              if showashexadecimal and (customtype.scriptUsesFloat=false) and (customtype.scriptUsesDouble=false) then
  20.                  result:=inttohex(customtype.ConvertDataToInteger(buf2),8)
  21.                else
  22.                begin
  23.                  if customtype.scriptUsesFloat then
  24.                    result:=FloatToStr(customtype.ConvertDataToFloat(buf2))
  25. +                else if customtype.scriptUsesDouble then
  26. +                  result:=FloatToStr(customtype.ConvertDataToDouble(buf2))
  27.                  else
  28.                    result:=IntToStr(customtype.ConvertDataToInteger(buf2));
  29.                end;
  30. Index: CustomTypeHandler.pas
  31. ===================================================================
  32. --- CustomTypeHandler.pas   (wersja 1481)
  33. +++ CustomTypeHandler.pas   (kopia robocza)
  34. @@ -10,8 +10,8 @@
  35.  uses
  36.    {windows, }dialogs, Classes, SysUtils,cefuncproc, autoassembler, lua, lauxlib, lualib, luahandler;
  37.  
  38. -type TConversionRoutine=function(data: pointer):integer; stdcall;
  39. -type TReverseConversionRoutine=procedure(i: integer; output: pointer); stdcall;
  40. +type TConversionRoutine=function(data: pointer):qword; stdcall;
  41. +type TReverseConversionRoutine=procedure(i: qword; output: pointer); stdcall;
  42.  
  43.  
  44.  type
  45. @@ -34,6 +34,7 @@
  46.      currentscript: tstringlist;
  47.      fCustomTypeType: TCustomTypeType; //plugins set this to cttPlugin
  48.      fScriptUsesFloat: boolean;
  49. +    fScriptUsesDouble: boolean;
  50.  
  51.  
  52.  
  53. @@ -46,6 +47,8 @@
  54.      preferedAlignment: integer;
  55.  
  56.      //these 4 functions are just to make it easier
  57. +    procedure ConvertToData(d: double; output: pointer); overload;
  58. +    function ConvertFromData(data: pointer): double; overload;
  59.      procedure ConvertToData(f: single; output: pointer); overload;
  60.      function ConvertFromData(data: pointer): single; overload;
  61.      procedure ConvertToData(i: integer; output: pointer); overload;
  62. @@ -61,6 +64,8 @@
  63.      procedure ConvertFloatToData(f: single; output: pointer);
  64.      procedure ConvertFloatToDataLua(f: single; output: pbytearray);
  65.  
  66. +    function ConvertDataToDouble(data: pointer): double;
  67. +    procedure ConvertDoubleToData(d: double; output: pointer);
  68.  
  69.  
  70.      function getScript:string;
  71. @@ -77,6 +82,7 @@
  72.      property CustomTypeType: TCustomTypeType read fCustomTypeType;
  73.      property script: string read getScript write setScript;
  74.      property scriptUsesFloat: boolean read fScriptUsesFloat;
  75. +    property scriptUsesDouble: boolean read fScriptUsesDouble;
  76.    end;
  77.    PCustomType=^TCustomType;
  78.  
  79. @@ -404,6 +410,41 @@
  80.    result:=f;
  81.  end;
  82.  
  83. +procedure TCustomType.ConvertDoubleToData(d: double; output: pointer);
  84. +var i: qword;
  85. +begin
  86. +  i:=pqword(@d)^; //convert the d to a qword without conversion
  87. +  if assigned(reverseroutine) then reverseroutine(i,output)
  88. +end;
  89. +
  90. +function TCustomType.ConvertDataToDouble(data: pointer): double;
  91. +var
  92. +  i: qword;
  93. +  d: double absolute i;
  94. +begin
  95. +  if assigned(routine) then
  96. +  begin
  97. +    i:=routine(data);
  98. +
  99. +    if not fScriptUsesDouble then //the result is in integer format ,
  100. +      d:=i; //convert the integer to double
  101. +  end
  102. +  else
  103. +    d:=0;
  104. +
  105. +  result:=d;
  106. +end;
  107. +
  108. +procedure TCustomType.ConvertToData(d: double; output: pointer);
  109. +begin
  110. +  ConvertDoubleToData(d, output);
  111. +end;
  112. +
  113. +function TCustomType.ConvertFromData(data: pointer): double;
  114. +begin
  115. +  result:=ConvertDataToDouble(data);
  116. +end;
  117. +
  118.  procedure TCustomType.ConvertToData(f: single; output: pointer);
  119.  begin
  120.    ConvertFloatToData(f, output);
  121. @@ -455,6 +496,7 @@
  122.    oldfunctiontypename: string;
  123.    newpreferedalignment, oldpreferedalignment: integer;
  124.    oldScriptUsesFloat, newScriptUsesFloat: boolean;
  125. +  oldScriptUsesDouble, newScriptUsesDouble: boolean;
  126.    newroutine, oldroutine: TConversionRoutine;
  127.    newreverseroutine, oldreverseroutine: TReverseConversionRoutine;
  128.    newbytesize, oldbytesize: integer;
  129. @@ -467,6 +509,7 @@
  130.    oldbytesize:=bytesize;
  131.    oldpreferedalignment:=preferedalignment;
  132.    oldScriptUsesFloat:=fScriptUsesFloat;
  133. +  oldScriptUsesDouble:=fScriptUsesDouble;
  134.  
  135.    setlength(oldallocarray, length(c));
  136.    for i:=0 to length(c)-1 do
  137. @@ -486,6 +529,7 @@
  138.          begin
  139.            newpreferedalignment:=-1;
  140.            newScriptUsesFloat:=false;
  141. +          newScriptUsesDouble:=false;
  142.  
  143.            //find alloc "ConvertRoutine"
  144.            for i:=0 to length(c)-1 do
  145. @@ -505,6 +549,9 @@
  146.              if uppercase(c[i].varname)='USESFLOAT' then
  147.                newScriptUsesFloat:=pbyte(c[i].address)^<>0;
  148.  
  149. +            if uppercase(c[i].varname)='USESDOUBLE' then
  150. +              newScriptUsesDouble:=pbyte(c[i].address)^<>0;
  151. +
  152.              if uppercase(c[i].varname)='CONVERTBACKROUTINE' then
  153.                newreverseroutine:=pointer(c[i].address);
  154.            end;
  155. @@ -524,6 +571,7 @@
  156.  
  157.            preferedAlignment:=newpreferedalignment;
  158.            fScriptUsesFloat:=newScriptUsesFloat;
  159. +          fScriptUsesDouble:=newScriptUsesDouble;
  160.  
  161.            fCustomTypeType:=cttAutoAssembler;
  162.            if currentscript<>nil then
  163. @@ -625,6 +673,7 @@
  164.        bytesize:=oldbytesize;
  165.        preferedAlignment:=oldpreferedalignment;
  166.        fScriptUsesFloat:=oldScriptUsesFloat;
  167. +      fScriptUsesDouble:=oldScriptUsesDouble;
  168.  
  169.        setlength(c,length(oldallocarray));
  170.        for i:=0 to length(oldallocarray)-1 do
  171. Index: MainUnit.pas
  172. ===================================================================
  173. --- MainUnit.pas    (wersja 1481)
  174. +++ MainUnit.pas    (kopia robocza)
  175. @@ -2048,7 +2050,7 @@
  176.        if (vartype.ItemIndex in [5, 6, 9]) or (vartype.ItemIndex >= 11) then //float/all, custom
  177.        begin
  178.          ct:=TCustomtype(vartype.Items.Objects[vartype.itemindex]);
  179. -        if (ct=nil) or (ct.scriptUsesFloat) then
  180. +        if (ct=nil) or (ct.scriptUsesFloat) or (ct.scriptUsesDouble) then
  181.          begin
  182.            //handle as a float value
  183.            if oldindex = 0 then
  184. Index: MemoryRecordUnit.pas
  185. ===================================================================
  186. --- MemoryRecordUnit.pas    (wersja 1481)
  187. +++ MemoryRecordUnit.pas    (kopia robocza)
  188. @@ -1473,6 +1473,8 @@
  189.          begin
  190.            if customtype.scriptUsesFloat then
  191.              result:=FloatToStr(customtype.ConvertDataToFloat(buf))
  192. +          else if customtype.scriptUsesDouble then
  193. +            result:=FloatToStr(customtype.ConvertDataToDouble(buf))
  194.            else
  195.              if showashex then result:=inttohex(customtype.ConvertDataToInteger(buf),8) else if showassigned then result:=inttostr(integer(customtype.ConvertDataToInteger(buf))) else result:=inttostr(customtype.ConvertDataToInteger(buf));
  196.          end
  197. @@ -1661,6 +1663,8 @@
  198.          Begin
  199.            if customtype.scriptUsesFloat then
  200.              customtype.ConvertFloatToData(strtofloat(currentValue), ps)
  201. +          else if customtype.scriptUsesDouble then
  202. +            customtype.ConvertDoubleToData(strtofloat(currentValue), pd)
  203.            else
  204.              customtype.ConvertIntegerToData(strtoint(currentValue), pdw);
  205.  
  206. Index: memscan.pas
  207. ===================================================================
  208. --- memscan.pas (wersja 1481)
  209. +++ memscan.pas (kopia robocza)
  210. @@ -62,6 +62,7 @@
  211.      function DoubleScan(minf,maxf: double; buf: pointer; var startoffset: integer): boolean;
  212.      function CustomScan(ct: Tcustomtype; value: integer; buf: pointer; var startoffset: integer): boolean;
  213.      function CustomScanFloat(ct: Tcustomtype; minf, maxf: single; buf: pointer; var startoffset: integer): boolean;
  214. +    function CustomScanDouble(ct: Tcustomtype; minf, maxf: single; buf: pointer; var startoffset: integer): boolean;
  215.  
  216.      function StringScan(st: pchar; buf: Pbytearray; var startoffset: integer): boolean;
  217.      function WideStringScan(st: pwidechar; buf: Pbytearray; var startoffset: integer): boolean;
  218. @@ -291,6 +292,19 @@
  219.      function CustomFloatUnChanged(newvalue,oldvalue: pointer): boolean;
  220.  
  221.  
  222. +    function CustomDoubleExact(newvalue,oldvalue: pointer): boolean;
  223. +    function CustomDoubleBetween(newvalue,oldvalue: pointer): boolean;
  224. +    function CustomDoubleBetweenPercentage(newvalue,oldvalue: pointer): boolean;
  225. +    function CustomDoubleBiggerThan(newvalue,oldvalue: pointer): boolean;
  226. +    function CustomDoubleSmallerThan(newvalue,oldvalue: pointer): boolean;
  227. +    function CustomDoubleIncreasedValue(newvalue,oldvalue: pointer): boolean;
  228. +    function CustomDoubleIncreasedValueBy(newvalue,oldvalue: pointer): boolean;
  229. +    function CustomDoubleIncreasedValueByPercentage(newvalue,oldvalue: pointer): boolean;
  230. +    function CustomDoubleDecreasedValue(newvalue,oldvalue: pointer): boolean;
  231. +    function CustomDoubleDecreasedValueBy(newvalue,oldvalue: pointer): boolean;
  232. +    function CustomDoubleDecreasedValueByPercentage(newvalue,oldvalue: pointer): boolean;
  233. +    function CustomDoubleChanged(newvalue,oldvalue: pointer): boolean;
  234. +    function CustomDoubleUnChanged(newvalue,oldvalue: pointer): boolean;
  235.  
  236.      //following types only have exact: Array of byte, binary and string
  237.      function ArrayOfByteExact(newvalue,oldvalue: pointer):boolean;
  238. @@ -809,6 +823,11 @@
  239.            f:=groupdata[i].customType.ConvertDataToFloat(newvalue);
  240.            result:=groupdata[i].wildcard or ((f>groupdata[i].minfvalue) and (f<groupdata[i].maxfvalue));
  241.          end
  242. +        else if groupdata[i].customType.scriptUsesDouble then
  243. +        begin
  244. +          f:=groupdata[i].customType.ConvertDataToDouble(newvalue);
  245. +          result:=groupdata[i].wildcard or ((f>groupdata[i].minfvalue) and (f<groupdata[i].maxfvalue));
  246. +        end
  247.          else
  248.            result:=groupdata[i].wildcard or (groupdata[i].customType.ConvertDataToInteger(newvalue)=groupdata[i].valuei);
  249.  
  250. @@ -1041,7 +1060,39 @@
  251.  
  252.  end;
  253.  
  254. +function TGroupData.CustomScanDouble(ct: Tcustomtype; minf, maxf: single; buf: pointer; var startoffset: integer): boolean;
  255. +var current: pointer;
  256. +  i: integer;
  257. +  align: integer;
  258. +  f: single;
  259. +begin
  260. +  result:=false;
  261. +  if outoforder_aligned then
  262. +    align:=4
  263. +  else
  264. +    align:=1;
  265.  
  266. +  current:=buf;
  267. +  inc(current, startoffset);
  268. +  i:=startoffset;
  269. +
  270. +  while i<(blocksize-ct.bytesize-1) do
  271. +  begin
  272. +    f:=ct.ConvertDataToDouble(current);
  273. +    if (f>minf) and (f<maxf) then
  274. +    begin
  275. +      startoffset:=i+1;
  276. +      result:=true;
  277. +      exit;
  278. +    end;
  279. +
  280. +    inc(current,align);
  281. +    inc(i,align);
  282. +  end;
  283. +
  284. +end;
  285. +
  286. +
  287.  function TGroupData.StringScan(st: pchar; buf: Pbytearray; var startoffset: integer): boolean;
  288.  var i: integer;
  289.  begin
  290. @@ -1199,6 +1250,8 @@
  291.  
  292.            if groupdata[i].customtype.scriptUsesFloat then
  293.              result:=CustomScanFloat(groupdata[i].customtype, groupdata[i].minfvalue, groupdata[i].maxfvalue, newvalue, currentoffset)
  294. +          else if groupdata[i].customtype.scriptUsesDouble then
  295. +            result:=CustomScanDouble(groupdata[i].customtype, groupdata[i].minfvalue, groupdata[i].maxfvalue, newvalue, currentoffset)
  296.            else
  297.              result:=CustomScan(groupdata[i].customtype, groupdata[i].valuei, newvalue, currentoffset);
  298.  
  299. @@ -1237,6 +1290,8 @@
  300.  
  301.        if customtype.scriptUsesFloat then
  302.          customtypesmatch[j]:=customtypesmatch[j] and CustomFloatExact(newvalue,oldvalue)
  303. +      else if customtype.scriptUsesDouble then
  304. +        customtypesmatch[j]:=customtypesmatch[j] and CustomDoubleExact(newvalue,oldvalue)
  305.        else
  306.          customtypesmatch[j]:=customtypesmatch[j] and CustomExact(newvalue,oldvalue)
  307.      end;
  308. @@ -1280,6 +1335,8 @@
  309.  
  310.        if customtype.scriptUsesFloat then
  311.          customtypesmatch[j]:=customtypesmatch[j] and CustomFloatBetween(newvalue,oldvalue)
  312. +      else if customtype.scriptUsesDouble then
  313. +        customtypesmatch[j]:=customtypesmatch[j] and CustomDoubleBetween(newvalue,oldvalue)
  314.        else
  315.          customtypesmatch[j]:=customtypesmatch[j] and CustomBetween(newvalue,oldvalue)
  316.      end;
  317. @@ -1322,6 +1379,8 @@
  318.  
  319.        if customtype.scriptUsesFloat then
  320.          customtypesmatch[j]:=customtypesmatch[j] and CustomFloatBetweenPercentage(newvalue,oldvalue)
  321. +      else if customtype.scriptUsesDouble then
  322. +        customtypesmatch[j]:=customtypesmatch[j] and CustomDoubleBetweenPercentage(newvalue,oldvalue)
  323.        else
  324.          customtypesmatch[j]:=customtypesmatch[j] and CustomBetweenPercentage(newvalue,oldvalue)
  325.      end;
  326. @@ -1363,6 +1422,8 @@
  327.        customtype:=tcustomtype(customTypes[j]);
  328.        if customtype.scriptUsesFloat then
  329.          customtypesmatch[j]:=customtypesmatch[j] and CustomFloatBiggerThan(newvalue,oldvalue)
  330. +      else if customtype.scriptUsesDouble then
  331. +        customtypesmatch[j]:=customtypesmatch[j] and CustomDoubleBiggerThan(newvalue,oldvalue)
  332.        else
  333.          customtypesmatch[j]:=customtypesmatch[j] and CustomBiggerThan(newvalue,oldvalue)
  334.      end;
  335. @@ -1404,6 +1465,8 @@
  336.        customtype:=tcustomtype(customTypes[j]);
  337.        if customtype.scriptUsesFloat then
  338.          customtypesmatch[j]:=customtypesmatch[j] and CustomFloatSmallerThan(newvalue,oldvalue)
  339. +      else if customtype.scriptUsesDouble then
  340. +        customtypesmatch[j]:=customtypesmatch[j] and CustomDoubleSmallerThan(newvalue,oldvalue)
  341.        else
  342.          customtypesmatch[j]:=customtypesmatch[j] and CustomSmallerThan(newvalue,oldvalue)
  343.      end;
  344. @@ -1445,6 +1508,8 @@
  345.        customtype:=tcustomtype(customTypes[j]);
  346.        if customtype.scriptUsesFloat then
  347.          customtypesmatch[j]:=customtypesmatch[j] and CustomFloatIncreasedValue(newvalue,oldvalue)
  348. +      else if customtype.scriptUsesDouble then
  349. +        customtypesmatch[j]:=customtypesmatch[j] and CustomDoubleIncreasedValue(newvalue,oldvalue)
  350.        else
  351.          customtypesmatch[j]:=customtypesmatch[j] and CustomIncreasedValue(newvalue,oldvalue)
  352.      end;
  353. @@ -1486,6 +1551,8 @@
  354.        customtype:=tcustomtype(customTypes[j]);
  355.        if customtype.scriptUsesFloat then
  356.          customtypesmatch[j]:=customtypesmatch[j] and CustomFloatIncreasedValueBy(newvalue,oldvalue)
  357. +      else if customtype.scriptUsesDouble then
  358. +        customtypesmatch[j]:=customtypesmatch[j] and CustomDoubleIncreasedValueBy(newvalue,oldvalue)
  359.        else
  360.          customtypesmatch[j]:=customtypesmatch[j] and CustomIncreasedValueBy(newvalue,oldvalue)
  361.      end;
  362. @@ -1527,6 +1594,8 @@
  363.        customtype:=tcustomtype(customTypes[j]);
  364.        if customtype.scriptUsesFloat then
  365.          customtypesmatch[j]:=customtypesmatch[j] and CustomFloatIncreasedValueByPercentage(newvalue,oldvalue)
  366. +      else if customtype.scriptUsesDouble then
  367. +        customtypesmatch[j]:=customtypesmatch[j] and CustomDoubleIncreasedValueByPercentage(newvalue,oldvalue)
  368.        else
  369.          customtypesmatch[j]:=customtypesmatch[j] and CustomIncreasedValueByPercentage(newvalue,oldvalue)
  370.      end;
  371. @@ -1569,6 +1638,8 @@
  372.        customtype:=tcustomtype(customTypes[j]);
  373.        if customtype.scriptUsesFloat then
  374.          customtypesmatch[j]:=customtypesmatch[j] and CustomFloatDecreasedValue(newvalue,oldvalue)
  375. +      else if customtype.scriptUsesDouble then
  376. +        customtypesmatch[j]:=customtypesmatch[j] and CustomDoubleDecreasedValue(newvalue,oldvalue)
  377.        else
  378.          customtypesmatch[j]:=customtypesmatch[j] and CustomDecreasedValue(newvalue,oldvalue)
  379.      end;
  380. @@ -1610,6 +1681,8 @@
  381.        customtype:=tcustomtype(customTypes[j]);
  382.        if customtype.scriptUsesFloat then
  383.          customtypesmatch[j]:=customtypesmatch[j] and CustomFloatDecreasedValueBy(newvalue,oldvalue)
  384. +      else if customtype.scriptUsesDouble then
  385. +        customtypesmatch[j]:=customtypesmatch[j] and CustomDoubleDecreasedValueBy(newvalue,oldvalue)
  386.        else
  387.          customtypesmatch[j]:=customtypesmatch[j] and CustomDecreasedValueBy(newvalue,oldvalue)
  388.      end;
  389. @@ -1651,6 +1724,8 @@
  390.        customtype:=tcustomtype(customTypes[j]);
  391.        if customtype.scriptUsesFloat then
  392.          customtypesmatch[j]:=customtypesmatch[j] and CustomFloatDecreasedValueByPercentage(newvalue,oldvalue)
  393. +      else if customtype.scriptUsesDouble then
  394. +        customtypesmatch[j]:=customtypesmatch[j] and CustomDoubleDecreasedValueByPercentage(newvalue,oldvalue)
  395.        else
  396.          customtypesmatch[j]:=customtypesmatch[j] and CustomDecreasedValueByPercentage(newvalue,oldvalue)
  397.      end;
  398. @@ -1692,6 +1767,8 @@
  399.        customtype:=tcustomtype(customTypes[j]);
  400.        if customtype.scriptUsesFloat then
  401.          customtypesmatch[j]:=customtypesmatch[j] and CustomFloatChanged(newvalue,oldvalue)
  402. +      else if customtype.scriptUsesDouble then
  403. +        customtypesmatch[j]:=customtypesmatch[j] and CustomDoubleChanged(newvalue,oldvalue)
  404.        else
  405.          customtypesmatch[j]:=customtypesmatch[j] and CustomChanged(newvalue,oldvalue)
  406.      end;
  407. @@ -1733,6 +1810,8 @@
  408.        customtype:=tcustomtype(customTypes[j]);
  409.        if customtype.scriptUsesFloat then
  410.          customtypesmatch[j]:=customtypesmatch[j] and CustomFloatUnchanged(newvalue,oldvalue)
  411. +      else if customtype.scriptUsesDouble then
  412. +        customtypesmatch[j]:=customtypesmatch[j] and CustomDoubleUnchanged(newvalue,oldvalue)
  413.        else
  414.          customtypesmatch[j]:=customtypesmatch[j] and CustomUnchanged(newvalue,oldvalue)
  415.      end;
  416. @@ -2131,6 +2210,100 @@
  417.  end;
  418.  //   ^^^^CustomFloat^^^^
  419.  
  420. +
  421. +//--------------Custom Double-------------
  422. +
  423. +function TScanner.CustomDoubleExact(newvalue,oldvalue: pointer): boolean;
  424. +var d: double;
  425. +begin
  426. +  result:=false;
  427. +  d:=customType.ConvertDataToDouble(newvalue);
  428. +  case roundingtype of
  429. +    rtRounded:
  430. +      result:=(RoundTo(d,-floataccuracy)=svalue);
  431. +
  432. +    rtExtremerounded:
  433. +      result:=(d>minsvalue) and (d<maxsvalue);
  434. +
  435. +    rtTruncated:
  436. +      result:=(d>=svalue) and (d<maxsvalue);
  437. +  end;
  438. +
  439. +end;
  440. +
  441. +function TScanner.CustomDoubleBetween(newvalue,oldvalue: pointer):boolean;
  442. +var d: double;
  443. +begin
  444. +  d:=customType.ConvertDataToDouble(newvalue);
  445. +  result:=(d>=svalue) and (d<=svalue2);
  446. +end;
  447. +
  448. +function TScanner.CustomDoubleBetweenPercentage(newvalue,oldvalue: pointer): boolean;
  449. +var new: double;
  450. +    old: double;
  451. +begin
  452. +  new:=customType.ConvertDataToDouble(newvalue);
  453. +  old:=customType.ConvertDataToDouble(oldvalue);
  454. +  result:=(new>old*svalue) and (new<=old*svalue2);
  455. +end;
  456. +
  457. +function TScanner.CustomDoubleBiggerThan(newvalue,oldvalue: pointer):boolean;
  458. +begin
  459. +  result:=customType.ConvertDataToDouble(newvalue)>svalue;
  460. +end;
  461. +
  462. +function TScanner.CustomDoubleSmallerThan(newvalue,oldvalue: pointer):boolean;
  463. +begin
  464. +  result:=customType.ConvertDataToDouble(newvalue)<svalue;
  465. +end;
  466. +
  467. +function TScanner.CustomDoubleIncreasedValue(newvalue,oldvalue: pointer):boolean;
  468. +begin
  469. +  result:=customType.ConvertDataToDouble(newvalue)>customType.ConvertDataToDouble(oldvalue);
  470. +end;
  471. +
  472. +function TScanner.CustomDoubleIncreasedValueBy(newvalue,oldvalue: pointer):boolean;
  473. +begin
  474. +  result:=RoundTo(customType.ConvertDataToDouble(newvalue),-floataccuracy)=RoundTo(customType.ConvertDataToDouble(oldvalue)+svalue,-floataccuracy);
  475. +end;
  476. +
  477. +function TScanner.CustomDoubleDecreasedValue(newvalue,oldvalue: pointer):boolean;
  478. +begin
  479. +  result:=customType.ConvertDataToDouble(newvalue)<customType.ConvertDataToDouble(oldvalue);
  480. +end;
  481. +
  482. +function TScanner.CustomDoubleDecreasedValueBy(newvalue,oldvalue: pointer):boolean;
  483. +begin
  484. +  result:=RoundTo(customType.ConvertDataToDouble(newvalue),-floataccuracy)=RoundTo(customType.ConvertDataToDouble(oldvalue)-svalue,-floataccuracy);
  485. +end;
  486. +
  487. +function TScanner.CustomDoubleIncreasedValueByPercentage(newvalue,oldvalue: pointer): boolean;
  488. +var new, old: double;
  489. +begin
  490. +  new:=customType.ConvertDataToDouble(newvalue);
  491. +  old:=customType.ConvertDataToDouble(oldvalue);
  492. +  result:=(new>old+old*svalue) and (new<old+old*svalue2);
  493. +end;
  494. +
  495. +function TScanner.CustomDoubleDecreasedValueByPercentage(newvalue,oldvalue: pointer): boolean;
  496. +var new, old: double;
  497. +begin
  498. +  new:=customType.ConvertDataToDouble(newvalue);
  499. +  old:=customType.ConvertDataToDouble(oldvalue);
  500. +  result:=(new>old-old*svalue2) and (new<old-old*svalue);
  501. +end;
  502. +
  503. +function TScanner.CustomDoubleChanged(newvalue,oldvalue: pointer):boolean;
  504. +begin
  505. +  result:=customType.ConvertDataToDouble(newvalue)<>customType.ConvertDataToDouble(oldvalue);
  506. +end;
  507. +
  508. +function TScanner.CustomDoubleUnchanged(newvalue,oldvalue: pointer):boolean;
  509. +begin
  510. +  result:=customType.ConvertDataToDouble(newvalue)=customType.ConvertDataToDouble(oldvalue);
  511. +end;
  512. +//   ^^^^CustomDouble^^^^
  513. +
  514.  //dword:
  515.  function TScanner.DWordExact(newvalue,oldvalue: pointer): boolean;
  516.  begin
  517. @@ -2428,14 +2601,23 @@
  518.  Generic routine for storing results. Use as last resort. E.g custom scans
  519.  }
  520.  var f: single;
  521. +    d: double;
  522.  begin
  523.    //save varsize
  524. -  if (variableType = vtCustom) and (customtype<>nil) and (customtype.scriptUsesFloat) then
  525. +  if (variableType = vtCustom) and (customtype<>nil) then
  526.    begin
  527. -    //check if it's a valid float result
  528. -    f:=customType.ConvertDataToFloat(oldvalue); //get value
  529. -    if isnan(f) or IsInfinite(f) then exit; //check if valid, if not, exit
  530. -
  531. +    if customtype.scriptUsesFloat then
  532. +      begin
  533. +      //check if it's a valid float result
  534. +      f:=customType.ConvertDataToFloat(oldvalue); //get value
  535. +      if isnan(f) or IsInfinite(f) then exit; //check if valid, if not, exit
  536. +      end
  537. +    else if customtype.scriptUsesDouble then
  538. +      begin
  539. +      //check if it's a valid float result
  540. +      d:=customType.ConvertDataToDouble(oldvalue); //get value
  541. +      if isnan(d) or IsInfinite(d) then exit; //check if valid, if not, exit
  542. +      end
  543.    end;
  544.  
  545.    PPtrUintArray(CurrentAddressBuffer)[found]:=address;
  546. @@ -3904,6 +4086,30 @@
  547.            soUnChanged:        checkroutine:=customFloatUnchanged;
  548.          end;
  549.        end
  550. +      else if customType.scriptUsesDouble then
  551. +      begin
  552. +        case scanOption of
  553. +          soExactValue:       checkRoutine:=customDoubleExact;
  554. +          soValueBetween:     if percentage then
  555. +                                checkroutine:=customDoubleBetweenPercentage
  556. +                              else
  557. +                                checkroutine:=customDoubleBetween;
  558. +          soBiggerThan:       checkroutine:=customDoubleBiggerThan;
  559. +          soSmallerThan:      checkroutine:=customDoubleSmallerThan;
  560. +          soIncreasedValue:   checkroutine:=customDoubleIncreasedValue;
  561. +          soIncreasedValueBy: if percentage then
  562. +                                checkroutine:=customDoubleIncreasedValueByPercentage
  563. +                              else
  564. +                                checkroutine:=customDoubleIncreasedValueBy;
  565. +          soDecreasedValue:   checkroutine:=customDoubleDecreasedValue;
  566. +          soDecreasedValueBy: if percentage then
  567. +                                checkroutine:=customDoubleDecreasedValueByPercentage
  568. +                              else
  569. +                                checkroutine:=customDoubleDecreasedValueBy;
  570. +          soChanged:          checkroutine:=customDoubleChanged;
  571. +          soUnChanged:        checkroutine:=customDoubleUnchanged;
  572. +        end;
  573. +      end
  574.        else
  575.        begin
  576.          case scanOption of
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement