 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Zaladine Expert Cheater
Reputation: 3
Joined: 14 Oct 2012 Posts: 129 Location: Djokdja, Indonesia
|
Posted: Sat Feb 01, 2014 9:01 pm Post subject: Q: Creating a table address based on other address. |
|
|
I'm making a table for this specific game, which UI uses a non-digit-gauge
(a pointing arrow) for its wind bearing. I've managed to obtain this bearing
address, and turns out that it is in Radian system.
However, since some popular walk-throughs for certain calculation involving
this wind bearing is in degree, i need (want) to create a new table address
which reads my previous Radian address, convert it, and shown in degree.
According to Wiki, the formula is:
This new table address needs to be updated in real-time (once every second
is actually acceptable), as the aforementioned address is.
So, please teach me how to do this (preferably in a step-by-step manner for
beginners). Thank you very much in advance for kind replies...
_________________
... to boldly go where no eagle has gone before ... |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25819 Location: The netherlands
|
Posted: Sat Feb 01, 2014 9:30 pm Post subject: |
|
|
Is the angle in radians stored as a float ?
If so, try this custom type (Not suitable for scanning, but usable for working with)
Just execute this script and you'll have a RadToDegree type
| Code: |
function RadToDegree_bytestovalue(b1,b2,b3,b4)
--Add extra byte parameters as required
bt={}
bt[1]=b1
bt[2]=b2
bt[3]=b3
bt[4]=b4
return (byteTableToFloat(bt)*180) / math.pi
end
function RadToDegree_valuetobytes(i)
--return the bytes to write (usually only used when you change the value)
bt=floatToByteTable((i * math.pi) / 180)
return bt[1],bt[2],bt[3],bt[4]
end
registerCustomTypeLua("RadToDegree", 4, RadToDegree_bytestovalue, RadToDegree_valuetobytes)
|
One downside is that it currently only handles full integers
(You can also do an auto assembler script for this which CAN add support for floating points. But I don't feel like delving too deep into the floating point instruction set)
_________________
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 |
|
 |
Zaladine Expert Cheater
Reputation: 3
Joined: 14 Oct 2012 Posts: 129 Location: Djokdja, Indonesia
|
|
| Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Wed Feb 05, 2014 1:00 pm Post subject: RadToDegree (Custom Type AA) |
|
|
Custom Type Lua: Not suitable for scanning, but usable for working with.
Custom Type AA: Suitable for scanning and working with.
If you need for fast scanning (searching) - use "Custom Type AA" below:
| Code: |
alloc(ConvertRoutine,128)
alloc(ConvertBackRoutine,128)
alloc(TypeName,64)
alloc(ByteSize,4)
alloc(UsesFloat,1)
TypeName:
db 'RadToDeg (single-fp)',0
// single-precision floating-point value
ByteSize:
dd 4
UsesFloat:
db 1
ConvertRoutine:
[64-bit]
cvtss2sd xmm0,dword ptr[rcx]
[/64-bit]
[32-bit]
mov eax,[esp+04]
cvtss2sd xmm0,dword ptr[eax]
[/32-bit]
mov eax,#180
cvtsi2sd xmm1,eax
mulsd xmm0,xmm1
fldpi
sub esp,8
db DD 1C 24 // fstp qword ptr [esp], fstp qword ptr [rsp]
divsd xmm0,[esp]
add esp,8
cvtsd2ss xmm0,xmm0
movd eax,xmm0
[64-bit]
ret
[/64-bit]
[32-bit]
ret 0004
[/32-bit]
ConvertBackRoutine:
[64-bit]
movd xmm0,ecx
[/64-bit]
[32-bit]
push ecx
mov ecx,[esp+08]
movd xmm0,ecx
[/32-bit]
cvtss2sd xmm0,xmm0
mov ecx,#180
cvtsi2sd xmm1,ecx
divsd xmm0,xmm1
fldpi
sub esp,8
db DD 1C 24 // fstp qword ptr [esp], fstp qword ptr [rsp]
mulsd xmm0,[esp]
add esp,8
cvtsd2ss xmm0,xmm0
[64-bit]
movd [rdx],xmm0
ret
[/64-bit]
[32-bit]
mov ecx,[esp+0C]
movd [ecx],xmm0
pop ecx
ret 0008
[/32-bit]
|
Choose define new custom type AA, remove all auto-generated code, and paste the above code.
@Dark Byte, because of bug (reported here id=309):
I have to use "db DD 1C 24"
keywords (for easy "google searching"):
radians degrees pi Custom Type AA xmm0 xmm1 SSE
| Description: |
|
| Filesize: |
8.7 KB |
| Viewed: |
4158 Time(s) |

|
_________________
|
|
| 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
|
|