# Necr0Potenc3

Member

9

123 Neutral

• Rank
Newbie
1. ## Acquiring game art through DirectX API hooks

There is an old game, circa 199Xs, which I'd like to do a remake. It's an old project of mine and I finally have the time to start it. The game is definitely abandonware so I don't see the problem in re-using the game's art for the remake. So far I have reverse engineered the sound format and successfully extracted the game's sound. However, the file formats for the graphics is way more tricky... being a 199xs game, there is a whole lot of indices across files and different color palettes. The game's code (binary) doesn't help much either... its code over code, a real mess to reverse. Instead of this laborious approach I'm moving towards a smart one. The game uses DirectX, which I'm not familiar with, I've only used OpenGL all my life. Still, I'm fairly certain it's possible to intercept (hook) the DirectX calls the game uses and extract the graphics art there. Not being familiar with DX, I have no idea which APIs I should hook, what I should look at or even if there are existent tools that will perform this task. Could anyone offer ideas? Tips?
2. ## OpenGL Please check how my game runs

solid 59-60 FPS for me geforce mx420 athlon xp 3200 512mb ram vsync on/off made no difference
3. ## Possible?

well, if you're still in doubt check this thread http://www.gamedev.net/community/forums/topic.asp?topic_id=339864
4. ## how to calculate the angle

are they points or vectors? you cant calculate angles between points, so I'm assuming you're talking about vectors to avoid confusion, v1 is v and v2 is w. the formula is: arccos(t) = (v.w) / (|v|.|w|) in other words: arccos(t) = (vx*wx + vy*wy + vz*wz) / (sqrt(vx² + vy² + xz² ) * sqrt(wx² + wy² + wz² )) sqrt being square root
5. ## easy,fast resizing image to bypass "not a power of 2" problem [+contribution]

here is the function that does it, I wrote it based on a microsoft article: void ResizeImage(int Width, int Height, unsigned char *RGB, int *NewWidth, int *NewHeight, unsigned char **NewRGB, int MaxRes) { GLint glMaxTexDim; double xPow2, yPow2; int ixPow2, iyPow2; int xSize2, ySize2; unsigned char *Data = NULL; glGetIntegerv(GL_MAX_TEXTURE_SIZE, &glMaxTexDim); if(glMaxTexDim > MaxRes) glMaxTexDim = MaxRes; if (Width <= glMaxTexDim) xPow2 = log((double)Width) / log(2.0); else xPow2 = log((double)glMaxTexDim) / log(2.0); if (Height <= glMaxTexDim) yPow2 = log((double)Height) / log(2.0); else yPow2 = log((double)glMaxTexDim) / log(2.0); ixPow2 = (int)xPow2; iyPow2 = (int)yPow2; if (xPow2 != (double)ixPow2) ixPow2++; if (yPow2 != (double)iyPow2) iyPow2++; xSize2 = 1 << ixPow2; ySize2 = 1 << iyPow2; Data = (unsigned char*)malloc(xSize2 * ySize2 * 3); gluScaleImage(GL_RGB, Width, Height, GL_UNSIGNED_BYTE, RGB, xSize2, ySize2, GL_UNSIGNED_BYTE, Data); *NewRGB = Data; *NewWidth = xSize2 ; *NewHeight = ySize2 ; return; } its pretty much plug and play. Width, Height and RGB are the "in" parameters. RGB is a buffer with RGB data. NewWidth, NewHeight and NewRGB are "out" parameters, all of them pointers to the variables where the info will be dumped. NewRGB is actually allocated by the function so you have to take care of freeing the memory once you're done with it "ermm... ok. so how do I use it?" just a sample: static void GenTextures(void) { int bmWidth = 0, bmHeight = 0, error = 0; unsigned char *Data = NULL; unsigned int newWidth = 0, newHeight = 0; unsigned char *newData = NULL; error = LoadBMP("background.bmp", &bmWidth, &bmHeight, &Data); if(error) { sprintf(ErrorTxt, "Could not load background.bmp error: %d", error); return; } ResizeImage(bmWidth, bmHeight, Data, &newWidth, &newHeight, &newData, 800); glGenTextures(1, &texture[0]); glBindTexture(GL_TEXTURE_2D, texture[0]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, 3, newWidth, newHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, newData); free(Data); free(newData); return; } hope it helps -gR
6. ## OpenGL Draw lines over other OpenGL games?

an easier method you'll probably need the hDC of the window which is being drawn, but thats easy to be obtained (GetDC) here are the main steps: 1 - use windows hooking (SetWindowsHookEx) on the target window 2 - inside your window hooking function, write a handler for WM_PAINT. inside this handler, do any changes to the window I just can't remember if its: case WM_PAINT: DrawStuff(); CallOriginal(); or the inverse. I'm not even sure if you actually need to call the original window proc since most apps draw stuff on the idle time. you'll have to check it yourself TOO EASY!! (army voice) leave API hooking for other stuff going to the army base now, gonna get myself a taste of not so easy stuff =]
7. ## glPushMatrix doubt

as you said, glLoadIdentity resets the matrix thats why I dont understand why glPushMatrix is used if we can just reset the current matrix. maybe there's something I missed
8. ## glPushMatrix doubt

lets say I have the following pseudo code: glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); .... drawing on this 1st matrix ... glPopMatrix(); ... some code ... glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); ... drawing on this 2nd matrix ... glPopMatrix(); whenever I call glPushMatrix I'm setting up a new matrix, is that correct? if so, are the attributes from the 1st matrix inherited by the second one or is the second matrix a completly new one? I did some testing on my own and I didn't understand when to use glPushMatrix and when not to use it thanks