| View previous topic :: View next topic |
| Author |
Message |
peddroelm Advanced Cheater
Reputation: 0
Joined: 03 Oct 2014 Posts: 84
|
Posted: Fri Oct 03, 2014 1:53 pm Post subject: CombatDamageLog using hardware BP on W access HitPoint var ? |
|
|
I am a total cheat engine noob - used memory hacking software a bit but it is no longer maintained and attaching debugger on target Steam game crashes the game so I'm looking for alternatives - this application seems still "alive" (active development)
My simple goal - obtaining a combat damage value log for a particular game (most games nowadays lack the feature and it is important for reverse engineering various combat/skill mechanics and often hard to spot otherwise bugs ) ..
They way I used to do this for Origin games (ME2, ME3) was to set a hardware breakpoint on write access on the memory location storing the hit point variable for the test subject (damaged by various abilities/weapons) ..
On each breakpoint hit it would execute a basic script that would print (to a window where I could copy/paste it from later -- a text file would also work as long as it doesn't attempt to write to HDD 70 times per second ) timestamp of activation, HP difference between Full HP - current HP and heal the target back to full HP .. It would help measure weapon rof mechanics (ramp ups due to timestamps), separate between multiple DOTs (damage over time running simultaneously) ...
Can such a thing be achieved with cheat engine ? Current target game is Borderlands 2 (Steam) ..
Would not be true combat log functionality as it will only log damage received by 1-3 targets ( HW BP registers limited ) and I don't know how to get variable for hit point address "on the fly" .. Also would not differentiate between source of damage (relevant in multiplayer -will only register all damage inflicted - not by which player) but it would serve great for my (game mechanics) testing purpose ..
Last edited by peddroelm on Fri Oct 03, 2014 1:59 pm; edited 1 time in total |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 472
Joined: 09 May 2003 Posts: 25867 Location: The netherlands
|
Posted: Fri Oct 03, 2014 1:57 pm Post subject: |
|
|
Use the veh debugger interface
Also, try the pointerscanner to find a pointer and poll that
_________________
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 |
|
 |
peddroelm Advanced Cheater
Reputation: 0
Joined: 03 Oct 2014 Posts: 84
|
Posted: Fri Oct 03, 2014 2:02 pm Post subject: |
|
|
| Dark Byte wrote: | Tried the veh debugger interface?
Also, try the pointerscanner to find a pointer and poll that |
not my question (google research tells me cheat engine currently can attach debuffer to steam games - tried with VEH option - game still runs) ...
My question - does cheat engine has the feature to run a simple script on write access hardware breakpoint (print game variable value, timestamp and alter game variable value (better explained in OP) ) ?
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 472
Joined: 09 May 2003 Posts: 25867 Location: The netherlands
|
Posted: Fri Oct 03, 2014 2:10 pm Post subject: |
|
|
This is an example script that will print out all the value changes of the specific address.
| Code: |
if (isDebugging~=nil) and (address~=nil) then
debug_removeBreakpoint(address)
isDebugging=nil
address=nil
end
address=0x00396CA8
function debugger_onBreakpoint()
print(readInteger(address))
debug_continueFromBreakpoint(co_run)
return 1
end
debug_setBreakpoint(address, 4, bptWrite)
isDebugging=true
|
_________________
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 |
|
 |
peddroelm Advanced Cheater
Reputation: 0
Joined: 03 Oct 2014 Posts: 84
|
Posted: Fri Oct 03, 2014 2:18 pm Post subject: |
|
|
Thank you!
So the answer is yes and it is worth putting time in learning some basic cheat engine operation (lack of windows internals//solid assembly programming knowledge will prevent me getting too far )
edit:
- found my float variable address
- open memory location
- data breakpoint - break on write - adds a hardware breakpoint on the proper address with "break" action on hit ...
Issues:
1). shooting target (value at breakpoint location changes in memory viewer doesn't break (breakpoint won't trigger. why? ) )
2). I didn't want to "break" on hit in the first place - I wanted to "execute a script " on hit - how do I do that ?
3). If I chose find out what writes this address - instead of breakpoint and shoot the target ( value changes ) - it doesn't pick up the instruction that did the writing (why ?)
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 472
Joined: 09 May 2003 Posts: 25867 Location: The netherlands
|
Posted: Fri Oct 03, 2014 3:49 pm Post subject: |
|
|
1: If you have previously ran that script I posted above it will override all breakpoints that would end up breaking
execute
| Code: |
debugger_onBreakpoint=nil
|
in lua to remove that override
2: see the above script. It executes the print function
Replace that print line with your own script, or function
3:
Can you use functions like "find what accesses this address" normally on this game ? (e.g if both the game and ce have restarted and you use that feature)
If not, you might have to change your settings to page exception breakpoints.
And you may have to check the option in settings to override existing breakpoints
Make sure you first attach the veh debugger to the game before you start debugging. you might want to manually attach it using the process list
_________________
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 |
|
 |
peddroelm Advanced Cheater
Reputation: 0
Joined: 03 Oct 2014 Posts: 84
|
Posted: Fri Oct 03, 2014 10:52 pm Post subject: |
|
|
| Dark Byte wrote: |
And you may have to check the option in settings to override existing breakpoints
...
|
If the game is using them - wouldn't this lead to unexpected behaviour/crash from the game ? (what are the worse and best case scenario from overriding application set breakpoints ?)
I just want my damage feedback , don't want to alter game damage calculations .
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 472
Joined: 09 May 2003 Posts: 25867 Location: The netherlands
|
Posted: Sat Oct 04, 2014 4:17 am Post subject: |
|
|
Best case scenario is that those breakpoints are idle and not really used, so removing them won't cause an issue.
Worst case scenario is that they are constantly used and cause a crash even before you get a chance at doing damage
If that is the case try page exceptions (they don't use hwbp's but are soo slow the game may look frozen. Use these to find the code and then do a code injection that tells ce the damage)
Also, do you really need it to be as accurate as that? (The instant it changes)
You could also just read the health before and after a set timespan and see the difference, and if there is health regen just add that to the total (most likely health regen is a constant amount/timespan)
_________________
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 |
|
 |
peddroelm Advanced Cheater
Reputation: 0
Joined: 03 Oct 2014 Posts: 84
|
Posted: Sat Oct 04, 2014 6:22 am Post subject: |
|
|
in order to be able to tell all effects (you can then use reverse engineered damage formula to calculate what caused that effect (was it DOT tick, melee attack, pistol bullet, thorns damage , fall damage, etc ..) ) applied to target - needs to be a breakpoint that will trigger each and every time target takes damage (should be hardware BP otherwise if it screws game speed - results would no longer be accurate - irrelevant ) ..
If no separation needed - (single shot weapon with no dot) - no break point needed ..
|
|
| Back to top |
|
 |
peddroelm Advanced Cheater
Reputation: 0
Joined: 03 Oct 2014 Posts: 84
|
Posted: Thu Mar 10, 2016 11:59 pm Post subject: |
|
|
back to this .
function debugger_onBreakpoint()
print(readInteger(address))
debug_continueFromBreakpoint(co_run)
return 1
end
My (limited) understanding is this function would trigger for all breakpoints.
What if I want to use 2 or more (up to 4) hardware breakpoints each with its own function to execute on break?
I will probably need a switch statement to execute code based on which of the breakpoints was hit . (How ?)
EDIT1
perhaps I can check like this (not sure)
if (EIP == BP1address) then // Will EIP have the breaking address ?
print( MaxHealth - readFloat(BP1address)) // print amount of damage received by health
writeFloat(BP1address, MaxHealth) // heal back to full HP
debug_continueFromBreakpoint(co_run)
return 1
end
if (EIP == BP2address) then // Will EIP have the breaking address ?
print( MaxShield - readFloat(BP2address)) // print amount of damage received by shields
// writeFloat(BP2address, MaxShields) // heal back to full shields
debug_continueFromBreakpoint(co_run)
return 1
end
.. etc
put a BP3 on a another unit's health
Will also need to print time between BPs individual activations
On MHT was using something like this
DWORD Timestamp;
print Time()-Timestamp
Timestamp = Time();
////////////////////////////////
///////////////////////////////
unsigned long Time()
Gets the number of milliseconds that have elapsed since Windows was started.
can access this in lua cheat engine ? is there a better way to get time offsets between breakpoint activations ?
EDIT2 Cheat Engine 6.5 Released:
"debug_setBreakpoint can now take an OnBreakpoint parameter that lets you set a specific function just for that breakpoint "
Where could I see an example for this ?
...here
http://wiki.cheatengine.org/index.php?title=debug_setBreakpoint
..debug_setBreakpoint(address, size, trigger, function)..
edit 3
progress
| Code: | 135.0
135.0
236.0
236.0
236.0
135.0
135.0
236.0
236.0
236.0
236.0
236.0
236.0
1347.0
236.0
236.0
236.0
236.0
236.0
236.0
236.0
236.0
236.0
236.0
135.0
135.0
135.0
236.0
236.0
236.0
135.0
135.0
135.0
236.0
135.0
236.0
135.0
135.0
135.0
135.0
1347.0
1347.0
135.0
135.0
135.0
135.0
236.0
236.0
135.0
236.0
135.0
135.0
1683.0
236.0
236.0
135.0
236.0
135.0
236.0
135.0
236.0
135.0
236.0
236.0
236.0
236.0
236.0
236.0
236.0
.. |
to this code
| Code: | if (isDebugging~=nil) and (addressbp1~=nil) then
debug_removeBreakpoint(addressbp1)
isDebugging=nil
addressbp1=nil
end
addressbp1=0x24BEEAF4
function debugger_onBreakpoint()
-- if (EIP == addressbp1) then
print(2500-readFloat(addressbp1))
writeFloat(addressbp1, 2500.0)
debug_continueFromBreakpoint(co_run)
-- end
return 1
end
debug_setBreakpoint(addressbp1, 4, bptWrite)
isDebugging=true |
if I uncomment the check for breakpoint , for future multiple breakpoint usage - it stops working - the if condition never true ?
EDIT 4
This explains it
| Code: | 4468405
618431220
135.0
4468405
618431220
236.0
-- if (EIP == addressbp1) then
print(EIP)
print (addressbp1)
print(2500-readFloat(addressbp1))
|
but how do I know which BP is Which ?
|
|
| Back to top |
|
 |
|