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

mgr.inz.Player