Hooking openGL functions for new style reflection
Hi,
This is just an idea I've been thinking about for a while, since Jagex started using the jOGL library to do its graphics.
I'm not sure if any of you are aware of the FPS (e.g. counterstrike, CoD etc) cheating scene. There are two style of hacks - one hooks the game functions directly (similar to the way RS client hacks work) and the others hook at the openGL/D3D level.
As RS can now use openGL to render (only in high gfx settings?) it it now trivial to hook openGL and perform standard model detection. (see http://forum.gamedeception.net/forumdisplay.php?f=261 for some general examples of what can be done in other games).
As a proof of concept I used GLIntercept (http://glintercept.nutty.org/) to log OGL calls and make sure this is plausible.
Here's an example of what I believe is a 3D model being rendered:
Code:
glGenBuffersARB(1,0x2320add4)
glBindBufferARB(GL_ARRAY_BUFFER,1028)
glBufferDataARB(GL_ARRAY_BUFFER,3168,0x23783ffc,GL_STATIC_DRAW) //0x23783ffc points to the vertex buffer... read this for model recognition
glEnableClientState(GL_VERTEX_ARRAY)
glVertexPointer(3,GL_FLOAT,24,0x0000)
glEnableClientState(GL_NORMAL_ARRAY)
glNormalPointer(GL_FLOAT,24,0x000c)
glEnableClientState(GL_COLOR_ARRAY)
glBindBufferARB(GL_ARRAY_BUFFER,171)
glColorPointer(4,GL_UNSIGNED_BYTE,28,0x000c)
glEnableClientState(GL_TEXTURE_COORD_ARRAY)
glBindBufferARB(GL_ARRAY_BUFFER,135)
glTexCoordPointer(2,GL_FLOAT,36,0x001c)
glBindTexture(GL_TEXTURE_2D,145)
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER,136)
glDrawElements(GL_TRIANGLES,168,GL_UNSIGNED_SHORT,0x0000) Textures[ (0,145) ]
glBindTexture(GL_TEXTURE_2D,144)
glDrawElements(GL_TRIANGLES,138,GL_UNSIGNED_SHORT,0x0150) Textures[ (0,144) ]
glPopMatrix()
glMatrixMode(GL_PROJECTION)
glLoadMatrixf([1.183333,0.000000,0.000000,0.000000,0.000000,2.453564,0.000000,0.000000,0.000000,0.000000,-1.027477,-1.000000,0.000000,0.000000,-96.387375,0.000000])
glMatrixMode(GL_MODELVIEW)
glMatrixMode(GL_PROJECTION)
glLoadMatrixf([1.183333,0.000000,0.000000,0.000000,0.000000,2.453564,0.000000,0.000000,0.000000,0.000000,-1.026092,-1.000000,0.000000,0.000000,-87.635582,0.000000])
glMatrixMode(GL_MODELVIEW)
glPushMatrix()
glMultMatrixf([1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,7360.000000,-320.000000,5952.000000,1.000000])
Once you can copy out the vertex array, you can generate a unique ID for each model (e.g. devise an algorithm to generate a unique id based on vertex positions) and do a WorldToScreen conversion to get the 2D coords of the model. This can then be passed to scar.
Similar methods would allow things such as map recognition etc.
The advantage over the SMART reflection is that it doesn't need to be updated every time RS is updated, only if they change the models.
Thoughs, ideas, suggestions? I could code up a small proof of concept if people are interested.