Make Your First Basic Opengl Hack

社区服务
高级搜索
猴岛论坛CSGO反恐精英CS作弊器交流讨论Make Your First Basic Opengl Hack
发帖 回复
倒序阅读 最近浏览的帖子最近浏览的版块
1个回复

Make Your First Basic Opengl Hack

楼层直达
莎仕芘亞

ZxID:1171401

等级: 元老
猴岛国防部部长

举报 只看楼主 使用道具 楼主   发表于: 2007-06-27 0
This was NOT Written by me. I got it from http://kab.g3host.net/~o187/c/wallhack.html but figured it would make a good addition to this forum.

Basically it gives you a start to making your own OpenGL hack with 1 hack mode : D and it is VERY easy to understand.

Well here it is:

Tools Needed: Visual C++ (5.0, 6.0 and 7.0/.Net Recomended)
Description: You will learn to make a simple OpenGL Wallhack via a wrapper.

Setup Environment:
1. Start Visual C++
2. Start a new project/solution and make it an empty DLL name it opengl32
3. Add a new c++ source (.cpp source) and call it main.cpp
4. Add a new DEF File (.def) and call it opengl32.def.
5. Open the project properties and link the following libraries: opengl32.lib glaux.lib glu32.lib

opengl32.def:
This fill will contain all the exports you will need from OpenGL, theres realy nothing to explain just make it look like this:

LIBRARY opengl32
EXPORTS
glAccum
glAlphaFunc
glAreTexturesResident
glArrayElement
glBegin
glBindTexture
glBitmap
glBlendFunc
glCallList
glCallLists
glClear
glClearAccum
glClearColor
glClearDepth
glClearIndex
glClearStencil
glClipPlane
glColor3b
glColor3bv
glColor3d
glColor3dv
glColor3f
glColor3fv
glColor3i
glColor3iv
glColor3s
glColor3sv
glColor3ub
glColor3ubv
glColor3ui
glColor3uiv
glColor3us
glColor3usv
glColor4b
glColor4bv
glColor4d
glColor4dv
glColor4f
glColor4fv
glColor4i
glColor4iv
glColor4s
glColor4sv
glColor4ub
glColor4ubv
glColor4ui
glColor4uiv
glColor4us
glColor4usv
glColorMask
glColorMaterial
glColorPointer
glCopyPixels
glCopyTexImage1D
glCopyTexImage2D
glCopyTexSubImage1D
glCopyTexSubImage2D
glCullFace
glDeleteLists
glDeleteTextures
glDepthFunc
glDepthMask
glDepthRange
glDisable
glDisableClientState
glDrawArrays
glDrawBuffer
glDrawElements
glDrawPixels
glEdgeFlag
glEdgeFlagPointer
glEdgeFlagv
glEnable
glEnableClientState
glEnd
glEndList
glEvalCoord1d
glEvalCoord1dv
glEvalCoord1f
glEvalCoord1fv
glEvalCoord2d
glEvalCoord2dv
glEvalCoord2f
glEvalCoord2fv
glEvalMesh1
glEvalMesh2
glEvalPoint1
glEvalPoint2
glFeedbackBuffer
glFinish
glFlush
glFogf
glFogfv
glFogi
glFogiv
glFrontFace
glFrustum
glGenLists
glGenTextures
glGetBooleanv
glGetClipPlane
glGetDoublev
glGetError
glGetFloatv
glGetIntegerv
glGetLightfv
glGetLightiv
glGetMapdv
glGetMapfv
glGetMapiv
glGetMaterialfv
glGetMaterialiv
glGetPixelMapfv
glGetPixelMapuiv
glGetPixelMapusv
glGetPointerv
glGetPolygonStipple
glGetString
glGetTexEnvfv
glGetTexEnviv
glGetTexGendv
glGetTexGenfv
glGetTexGeniv
glGetTexImage
glGetTexLevelParameterfv
glGetTexLevelParameteriv
glGetTexParameterfv
glGetTexParameteriv
glHint
glIndexMask
glIndexPointer
glIndexd
glIndexdv
glIndexf
glIndexfv
glIndexi
glIndexiv
glIndexs
glIndexsv
glIndexub
glIndexubv
glInitNames
glInterleavedArrays
glIsEnabled
glIsList
glIsTexture
glLightModelf
glLightModelfv
glLightModeli
glLightModeliv
glLightf
glLightfv
glLighti
glLightiv
glLineStipple
glLineWidth
glListBase
glLoadIdentity
glLoadMatrixd
glLoadMatrixf
glLoadName
glLogicOp
glMap1d
glMap1f
glMap2d
glMap2f
glMapGrid1d
glMapGrid1f
glMapGrid2d
glMapGrid2f
glMaterialf
glMaterialfv
glMateriali
glMaterialiv
glMatrixMode
glMultMatrixd
glMultMatrixf
glNewList
glNormal3b
glNormal3bv
glNormal3d
glNormal3dv
glNormal3f
glNormal3fv
glNormal3i
glNormal3iv
glNormal3s
glNormal3sv
glNormalPointer
glOrtho
glPassThrough
glPixelMapfv
glPixelMapuiv
glPixelMapusv
glPixelStoref
glPixelStorei
glPixelTransferf
glPixelTransferi
glPixelZoom
glPointSize
glPolygonMode
glPolygonOffset
glPolygonStipple
glPopAttrib
glPopClientAttrib
glPopMatrix
glPopName
glPrioritizeTextures
glPushAttrib
glPushClientAttrib
glPushMatrix
glPushName
glRasterPos2d
glRasterPos2dv
glRasterPos2f
glRasterPos2fv
glRasterPos2i
glRasterPos2iv
glRasterPos2s
glRasterPos2sv
glRasterPos3d
glRasterPos3dv
glRasterPos3f
glRasterPos3fv
glRasterPos3i
glRasterPos3iv
glRasterPos3s
glRasterPos3sv
glRasterPos4d
glRasterPos4dv
glRasterPos4f
glRasterPos4fv
glRasterPos4i
glRasterPos4iv
glRasterPos4s
glRasterPos4sv
glReadBuffer
glReadPixels
glRectd
glRectdv
glRectf
glRectfv
glRecti
glRectiv
glRects
glRectsv
glRenderMode
glRotated
glRotatef
glScaled
glScalef
glScissor
glSelectBuffer
glShadeModel
glStencilFunc
glStencilMask
glStencilOp
glTexCoord1d
glTexCoord1dv
glTexCoord1f
glTexCoord1fv
glTexCoord1i
glTexCoord1iv
glTexCoord1s
glTexCoord1sv
glTexCoord2d
glTexCoord2dv
glTexCoord2f
glTexCoord2fv
glTexCoord2i
glTexCoord2iv
glTexCoord2s
glTexCoord2sv
glTexCoord3d
glTexCoord3dv
glTexCoord3f
glTexCoord3fv
glTexCoord3i
glTexCoord3iv
glTexCoord3s
glTexCoord3sv
glTexCoord4d
glTexCoord4dv
glTexCoord4f
glTexCoord4fv
glTexCoord4i
glTexCoord4iv
glTexCoord4s
glTexCoord4sv
glTexCoordPointer
glTexEnvf
glTexEnvfv
glTexEnvi
glTexEnviv
glTexGend
glTexGendv
glTexGenf
glTexGenfv
glTexGeni
glTexGeniv
glTexImage1D
glTexImage2D
glTexParameterf
glTexParameterfv
glTexParameteri
glTexParameteriv
glTexSubImage1D
glTexSubImage2D
glTranslated
glTranslatef
glVertex2d
glVertex2dv
glVertex2f
glVertex2fv
glVertex2i
glVertex2iv
glVertex2s
glVertex2sv
glVertex3d
glVertex3dv
glVertex3f
glVertex3fv
glVertex3i
glVertex3iv
glVertex3s
glVertex3sv
glVertex4d
glVertex4dv
glVertex4f
glVertex4fv
glVertex4i
glVertex4iv
glVertex4s
glVertex4sv
glVertexPointer
glViewport
wglChoosePixelFormat
wglCopyContext
wglCreateContext
wglCreateLayerContext
wglDeleteContext
wglDescribeLayerPlane
wglDescribePixelFormat
wglGetCurrentContext
wglGetCurrentDC
wglGetDefaultProcAddress
wglGetLayerPaletteEntries
wglGetPixelFormat
wglGetProcAddress
wglMakeCurrent
wglRealizeLayerPalette
wglSetLayerPaletteEntries
wglSetPixelFormat
wglShareLists
wglSwapBuffers
wglSwapLayerBuffers
wglUseFontBitmapsA
wglUseFontBitmapsW
wglUseFontOutlinesA
wglUseFontOutlinesW

main.cpp:
First we will need to include some basic opengl and win32 libraries:

#include <windows.h>

#include <gl/gl.h>

#include <gl/glu.h>

#include <gl/glaux.h>

Now we will need to set the dll entry point, this is done through DllMain:

BOOL __stdcall DllMain(HANDLE hInst, DWORD dwReason, LPVOID lpReserved)

{

if (dwReason == DLL_PROCESS_ATTACH)

{

//

}

return TRUE;

}

At this point u should be able to compile with 0 errors and 0 warnings, if not go back and redo everything. You can test the dll by moving it to Half-Life\gldrv\ and then adding your dll to drvmap.txt by adding a line to the text file that says "gldrv/opengl32.dll My Hack", now if you are in windows 98 you can just select the dll from the drop down list under video options in opengl mode and play, but if you are in a NT based OS (nt, 2k, xp) you need to first go to console under default mode then close console and go to video options and select you dll and play, you must do this every time (to fix this you can use Vasily's Wrapgen). The hack so far does nothing, but it loads!

To add our main feature (the wallhack) you first need to hook glBegin this is done through the following code:

void __stdcall NEWglBegin( GLenum mode )

{

glBegin(mode);

}

Now you need to open your opengl32.def and in the long list find glBegin and make it say glBegin=NEWglBegin instead. You should be able to compile and it should work fine, but it does not do anything yet! To make the xqz2 style wallhack you need to add the following code before glBegin(mode);:

if(mode == GL_TRIANGLE_STRIP)

{

glDisable(GL_DEPTH_TEST);

}

Compile the hack and you should have your working wallhack! You cant toggle it but it's there, you can now work on your hack and make it into something better!

____________________________________________________
ApOc's Tut

ive learnt most of these methods from Game-Deception but i will try an put them in my own words really...

its getting quite late where i am and i will have to go soon so il only do a few now and il keep updating... it would be nice if it was made sticky *hint*

XQZ WH (my prefered method):
in shaded model check if the gl mode is equal to smooth then call the function glDepthFunc with a GL_ALWAYS parameter

ASUS WH:
in begin check if the mode does NOT<- equal triangles or triangle_strip or triangle_fan or quads. Then make a float to store 4 numbers (red, gree, blue and alpha) then call the function glGetFloatv with the parameters GL_CURRENT_COLOR, nameofurfloat. Then disable depth testing. Enable Blend. Then call this function
code:
1:
2:
3:
4:
5:


1:

glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);






You then want to set the transparency of the walls to about half, this can be done by calling the function glColor4f with the parameters (yourfloat[0], yourfloat[1], yourfloat[2], 0.5f). You then want to finally call this function code:
1:
2:
3:
4:
5:
6:

1:

glClearColor(0.0f,0.0f,0.0f,0.0f);







Fullbright:
in begin check if the mode is equal to quads and enable gl_texture_2d

Lambert:
in vertex3f call the function glColor3f and max everything out (1.0f, 1.0f, 1.0f)


Thanks i hope that you understood ok... i will update this with more stuff later

zjnwww

ZxID:1182936

等级: 上尉
风雨过后的彩虹最美丽
举报 只看该作者 沙发   发表于: 2008-01-19 0
保证质量
« 返回列表
发帖 回复