|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Kulturbanause How do I cheat? Reputation: 0
Joined: 19 May 2009 Posts: 3
|
Posted: Fri Jul 27, 2018 1:23 pm Post subject: Need some help to "special" freeze a value |
|
|
Hi Community,
I want to freeze a value of an adress in a special way.
I know you can freeze a value, you can freeze it to allow increase and you can freeze it to allow decrease. Standard functions of CE.
What I want is to freeze this value to for example 10000 and make it possible to allow increase and decrease above 10000. But the value should never decrease below 10000.
This 10000 should act as a boundary. All values above this value should be possible but a decrease below 10000 should not be possible.
How to achieve this?
BR
Kulturbanause
|
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Fri Jul 27, 2018 2:28 pm Post subject: |
|
|
Find out where the value is written to, and compare it to your freeze value to see if you will allow it to set the value.
https://wiki.cheatengine.org/index.php?title=Tutorials:Auto_Assembler:Injection_full
Here is an example script.
Code: |
{$STRICT}
define(address, mgsvtpp.exe+3E883F4)
define(bytes, 89 07 80 8B 88 0E 00 00 05)
////
//// ------------------------------ ENABLE ------------------------------
[ENABLE]
aobScanModule(aobGmpWrtHook, mgsvtpp.exe, 48xxxxxxxxxxxx89xx44xxxx44xxxx3Dxxxxxxxx7Cxx44xxxx7Fxx89xx80xxxxxxxxxxxx48xxxxxxxx48xxxxxxxxxx)
define(injGmpWrtHook, aobGmpWrtHook+1B)
assert(injGmpWrtHook, bytes)
registerSymbol(injGmpWrtHook)
alloc(memGmpWrtHook, 0x400, injGmpWrtHook)
label(intGmpWrtHook)
registerSymbol(intGmpWrtHook)
label(ptrGmpWrtHook)
registerSymbol(ptrGmpWrtHook)
label(n_code)
label(o_code)
label(exit)
label(return)
memGmpWrtHook:
intGmpWrtHook:
dd (int)50000
ptrGmpWrtHook:
dq 0
align 10 CC
n_code:
pushfq
mov [ptrGmpWrtHook],rdi
push rcx
mov ecx,[intGmpWrtHook] // move freeze value to ECX
cmp [rdi],ecx // compare GMP (money) to freeze value
jge @f // jump if GMP is greater then freeze value
mov eax,ecx // set new value to freeze value
@@:
pop rcx
cmp [rdi],eax // cmp new value with GMP
jle @f // jump if GMP is less than new value.
mov eax,[rdi] // set new value to current value (freeze value)
@@:
popfq
o_code:
mov [rdi],eax
or byte ptr [rbx+00000E88],05
exit:
jmp return
////
//// ---------- Injection Point ----------
injGmpWrtHook:
jmp n_code
nop
nop
nop
nop
return:
////
//// ------------------------------ DISABLE ------------------------------
[DISABLE]
////
//// ---------- Injection Point ----------
injGmpWrtHook:
db bytes
unregisterSymbol(injGmpWrtHook)
unregisterSymbol(intGmpWrtHook)
unregisterSymbol(ptrGmpWrtHook)
dealloc(memGmpWrtHook) |
_________________
|
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Fri Jul 27, 2018 3:49 pm Post subject: |
|
|
either hook code that accesses it and use assembly to compare it to your min value and if it's less set it to the min, otherwise do nothing/write the original.
Or you can use some lua code to do it, using something like
Code: | {$lua}
[ENABLE]
-- value boundary configuration
local min = 10000
local max = nil
-- start of generic code
local mr = memrec.Parent -- assumes script to freeze is nested under value to freeze
FreezeTimers = FreezeTimers or {}
if syntaxcheck then return end
local t = createTimer()
FreezeTimers[memrec.id] = t
t.Interval = getFreezeTimer().Interval -- use same interval as CE
t.OnTimer = function()
local value = tonumber(mr.Value, mr.ShowAsHex and 16 or 10)
if max and value > max then value = max end
if min and value < min then value = min end
mr.Value = string.format(mr.ShowAsHex and '0x%X' or '%d', value)
end
[DISABLE]
if syntaxcheck then return end
FreezeTimers[memrec.id].destroy() |
_________________
|
|
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
|
|