|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
RandName Newbie cheater Reputation: 0
Joined: 19 Jun 2015 Posts: 22
|
Posted: Tue Jun 30, 2015 11:26 am Post subject: Custom Float Type (Lua Script) |
|
|
Hello together,
I am really bad with asm so I need help with creating a custom (float) type for a lua script of mine.
The "encryption" is as follows:
First there is a pointer which points to two addresses.
The value of the two addresses have to be xored against each other.
It would look something like this: xor(readInteger(pointer), readInteger(pointer+4))
The result now gets converted to a float value (hex->float).
Code: | xoredVal = bXor(readInteger(valPtr), readInteger(valPtr + 4))
val = hex2float(xoredVal)
|
So my question is now, whether it is possible to realize this by creating a custom type.
And if it is possible, how?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Tue Jun 30, 2015 12:50 pm Post subject: |
|
|
it's "possible" but it's going to be really really really really really really really really really really really really slow when done like that
it might be easier(and a lot faster) to just use a 8 byte custom type, split the 8 bytes up into 2 4 byte values, xor the 2 values and convert that to float.
anyhow, for using the pointer method:
Code: |
--Note: keep the function base name unique.
typename="Pointer to xored value type" --shown as the typename in ce
bytecount=4 --number of bytes of this type
functionbasename="customvaluetype3"
function customvaluetype3_bytestovalue(b1,b2,b3,b4)
local pointer=byteTableToDword({b1,b2,b3,b4})
local v1=readInteger(pointer)
local v2=readInteger(pointer+4)
if (v1~=nil) and (v2~=nil) then
local v=bXor(v1,v2)
local bt=dwordToByteTable(v)
return byteTableToFloat(bt)
else
return 0
end
end
function customvaluetype3_valuetobytes(i)
--return the bytes to write (usually only used when you change the value)
error('not supported')
--return 0,0,0,0
end
return typename,bytecount,functionbasename
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|