mgr.inz.Player I post too much Reputation: 218 Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Tue Jul 24, 2012 4:43 am Post subject: Re: Need help: Create new custom data type |
|
|
@Csimbi
I made something similar, for structure with floats. I think I can adapt it to doubles.
Stay tuned (approx. few hours).
Edit:
here:
Code: | alloc(TypeName,256)
alloc(ByteSize,4)
alloc(UsesFloat,4)
alloc(PreferedAlignment,4)
alloc(ConvertRoutine,1024)
label(SKIP)
TypeName:
db 'CustomType_for_Csimbi',0
ByteSize:
dd (int)40 // struct has 40 bytes
UsesFloat:
db 01
PreferedAlignment:
db 04
//double dValue; //0x00
//double dKey1; //0x08
//double dKey2; //0x10
//double dChecksum; // Irrelevant //0x18
//double dZero; // 0 or 1; 0: valid, 1:invalid //0x20
//dSearchVal = dKey1 - dKey2 + dValue;
define(dValue ,eax+00)
define(dKey1 ,eax+08)
define(dKey2 ,eax+10)
define(dZero_1,eax+20)
define(dZero_2,eax+24)
ConvertRoutine:
push ebp
mov ebp,esp
mov eax,[ebp+8] //place the address that contains the bytes into eax
cmp dword ptr [dZero_1],0
jne SKIP
cmp dword ptr [dZero_2],0
jne SKIP
finit
push eax
fld qword ptr [dKey1]
fadd qword ptr [dValue]
fsub qword ptr [dKey2]
fstp dword ptr [esp] // store and convert to float
pop eax
//(I used qword three times because values are "double". I used dword at the end because UsesFloat is used)
pop ebp
ret 4
SKIP:
mov eax,7fffffff // gives NaN, CE will skip it
pop ebp
ret 4 |
I tested it with this
Code: | [ENABLE]
globalalloc(testing,2048)
testing:
dq (double)123.0
dq (double)50.0
dq (double)40.0
dq (double)44
dq (double)1.0
dq (double)123.0
dq (double)50.0
dq (double)40.0
dq (double)44
dq (double)0.0
[DISABLE]
dealloc(testing) |
Searching for value 133.0
results:
It finds second structure at "testing+28",
structure at "testing+00" is skipped. _________________ Dark Souls II Item Swap and Item List
My Borderlands2 tables
Recent CheatEngine builds
|
|