 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Sat Dec 10, 2016 10:10 pm Post subject: Converting AOB |
|
|
Hi guys,
Code: |
function string.trimstart(s, c)
if (not c) then c = ' '; end
s = string.reverse(s);
s = string.trimend(s, c);
return string.reverse(s);
end
-- desc: Trims the end of a string for whitespace.
function string.trimend(s, c)
if (not c) then c = ' '; end
if (string.sub(s, -1) == c) then
s = string.sub(s, 0, -2);
s = string.trimend(s, c);
end
return s;
end
-- desc: Trims a string of whitespace.
function string.trim(s, c)
if (not c) then c = ' '; end
s = string.trimstart(s, c);
s = string.trimend(s, c);
return s;
end
-- desc: Converts the given string to a hex array string.
function str2hexstr(str)
local ret = '';
for x = 1, #str do
-- Pull a single character from the string..
local val = str:sub(x, x);
-- Convert the character to hex..
local c = string.byte(val);
-- Append to the result..
ret = ret .. string.format('%02X ', c);
end
-- Trim and return the result..
return ret:trim();
end
---- Test
input= 1 --- get input value using CEEdit, identifying as 'String Value"
input=str2hexstr(input)
print(input)
------- result = 31 (as AOB) or AOB string ?
------- Use DEC_HEX
function DEC_HEX(IN)
local B,K,OUT,I,D=16,"0123456789ABCDEF","",0
while IN>0 do
I=I+1
IN,D=math.floor(IN/B),math.mod(IN,B)+1
OUT=string.sub(K,D,D)..OUT
end
return OUT
end
a=DEC_HEX(1)
print(a)
1
|
I know for number = 1 (pushbyte 1), will give AOB = 24 01
I have search for some lua references to convert number to AOB.
Is there any function to do that ?
Thank and regard
|
|
Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sat Dec 10, 2016 10:31 pm Post subject: |
|
|
Code: | wordToByteTable(number): {} - Converts a word to a bytetable
dwordToByteTable(number): {} - Converts a dword to a bytetable
qwordToByteTable(number): {} - Converts a qword to a bytetable
floatToByteTable(number): {} - Converts a float to a bytetable
doubleToByteTable(number): {} - Converts a double to a bytetable
stringToByteTable(string): {} - Converts a string to a bytetable
wideStringToByteTable(string): {} - Converts a string to a widestring and converts that to a bytetable
string.format("%X", number) |
|
|
Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Sun Dec 11, 2016 6:22 am Post subject: |
|
|
Thanks Zanzer,
Test
Code: |
a=1
print(unpack(wordToByteTable(a)))
print(unpack(dwordToByteTable(a)))
print(unpack(qwordToByteTable(a)))
print(unpack(floatToByteTable(a)))
print(unpack(doubleToByteTable(a)))
print(unpack(stringToByteTable(tostring(a))))
print(unpack(wideStringToByteTable(tostring(a))))
print(string.format("%X", a))
1 0
1 0 0 0
1 0 0 0 0 0 0 0
0 0 128 63
0 0 0 0 0 0 240 63
49
49 0
1
|
I just looking for some references to get understand from where pushbyte 1 refer as 24 01 in AVM2 opcode
|
|
Back to top |
|
 |
panraven Grandmaster Cheater
Reputation: 62
Joined: 01 Oct 2008 Posts: 958
|
Posted: Sun Dec 11, 2016 6:43 am Post subject: |
|
|
Corroder wrote: | Thanks Zanzer,
....
I just looking for some references to get understand from where pushbyte 1 refer as 24 01 in AVM2 opcode |
https://konghack.com/content/19-avm2instructions
_________________
- Retarded. |
|
Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
|
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
|
|