Crysis 2 health percentage.

Post » Wed Nov 21, 2012 8:05 am

I did a little digging in Crysis 2's memory. I believe I found out where the health is stored. It's stored in a 4 byte integer going from 100(healthy) to 0(dead).
The weird thing is, I found two integers which represent health, but only one stays allocated throughout the game longer enough for me to work with.

By using a DX9/11 overlay, it's possible to display this number directly in Crysis 2 the same way Fraps' FPS meter is displayed on either corners of the screen.
I found some code to hook myself to DX9, still haven't tested, but will do later.

My hurdle right now is to find the health address, but because it's dynamically allocated, it's location is different as soon as the variable is freed and allocated again.

In the screenshot below we see two addresses that correspond to health.

Image

But only the one on that is displayed in the Memory Viewer is the one we need. In the Memory Viewer window, look at the ASCII representation of the hexadecimal numbers, we see the characters '@,s,t,a,n,d'.

I am going to use those as my pattern and scan the process' virtual address space for them characters and then calculating the address of the health variable which as we see is not that far from the characters we just saw.

No promises though as to whether I will succeed, I think this is a good project to work on, till I get some datasheets from AMD and continue my original project.
User avatar
ezra
 
Posts: 3510
Joined: Sun Aug 12, 2007 6:40 pm

Post » Wed Nov 21, 2012 8:43 am

Code burns my eyes!!!!!! Good stuff man but BlackMark already achieved this. ;) I have a health bar displayed on my G19 keyboard screen. Here: http://www.gamesas.com/forums/viewtopic.php?f=40&t=36890

Image
User avatar
sophie
 
Posts: 3482
Joined: Fri Apr 20, 2007 7:31 pm

Post » Wed Nov 21, 2012 2:38 am

Yeah, I know of that thread, but that is specifically aimed for a keyboard. What I am trying to do is display it in-game in Multiplayer. You will then have a rough estimate of how much damage a gun or melee does.

And if everything goes as planned and I succeed in displaying the number in C2, I will release the source code for it to be improved.
User avatar
Janette Segura
 
Posts: 3512
Joined: Wed Aug 22, 2007 12:36 am

Post » Wed Nov 21, 2012 3:33 pm

Ah cool, you should talk to BlackMark. He just he ran the program on his PC screen too.
User avatar
Jarrett Willis
 
Posts: 3409
Joined: Thu Jul 19, 2007 6:01 pm

Post » Wed Nov 21, 2012 6:03 am

I have to admit though, his work is on a much higher level. I struggled just to find the health address, and he has gone as far as to display Ping and weapon type. Impressive indeed.
User avatar
marina
 
Posts: 3401
Joined: Tue Mar 13, 2007 10:02 pm


Return to Crysis