Jump to content
  • Advertisement

xilup

Member
  • Content Count

    18
  • Joined

  • Last visited

Community Reputation

100 Neutral

About xilup

  • Rank
    Member
  1. I'm trying to hook WSARecv, and so far i did great. I replaced the epilogue code of the original function with a JMP to my fake function.Now, when it comes to reading the data, seems that the data keeps repeating itself.Sometimes, my fake functions gets called twice, with the same data in the buffer.It is very strange, since i'm handling the buffer after everything is received. Below is my fake function class hook { ..... static void WSARecv(); ..... }; void __declspec(naked) oCHook::WSARecv() { static SOCKET s; static LPWSABUF buf; static DWORD dwReturn; __asm mov dwReturn, eax __asm push eax __asm mov eax, [ebp + 8] __asm mov s, eax __asm mov eax, [ebp + 12] __asm mov buf, eax if(dwReturn >0) pThis->_WSARecv(s, buf); // pThis is a static member containing the instance of the parent class // _WSARecv is the function that handles the data obtained by the hook. // Now, for some reason _WSARecv gets called twice or even more times, // having the same data in the buffer. // What can be wrong? __asm pop eax __asm pop esi __asm leave __asm retn 0x1C00 }
  2. I'm rendering my scene to a multisampled framebuffer and then i blit it to thw window's default framebuffer.The problem is that it's killing my FPS, it mvoes really slowly.Overall it works, i have a multisampled image on the screen but it moves to slow. Is it because of my hardware, or i did something wrong? void COpenGLDriver::BeginScene() { if(lpScreen) lpScreen->HandleScreen(); glClearColor(0,0,1,1); glClear(GL_COLOR_BUFFER_BIT); lpExtension->glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFrame); } void COpenGLDriver::EndScene() { lpExtension->glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, NULL); } void COpenGLDriver::Present(RECT *lpSrcRect, RECT *lpDstRect) { LQSCREENDATA mData; lpScreen->GetScreenData(&mData); lpExtension->glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, mFrame); lpExtension->glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, NULL); lpExtension->glBlitFramebufferEXT( lpSrcRect ? lpSrcRect->left : 0, lpSrcRect ? lpSrcRect->top : 0, lpSrcRect ? lpSrcRect->right : mData.mWidth, lpSrcRect ? lpSrcRect->bottom : mData.mHeight, lpDstRect ? lpDstRect->left : 0, lpDstRect ? lpDstRect->top : 0, lpDstRect ? lpDstRect->right : mData.mWidth, lpDstRect ? lpDstRect->bottom : mData.mHeight, GL_COLOR_BUFFER_BIT, //I removed the depth and stencil buffer, //it moves a bit faster, but in full screen mode FPS go really low. GL_NEAREST); //I also tried GL_LINEAR, same thing lpExtension->glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, NULL); lpExtension->glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, NULL); SwapBuffers(mData.hDC); } If i blit from a non-multisampled framebuffer to the default framebuffer, it is just a little bit faster, hardly noticeable.
  3. 1. Can i use the PBO to pack from a texture object? So let's say that i have my texture object, i pack the data from it, modify it, and then unpack it back to the texture(or maybe somewhere else). How? 2. Same as 1. only that i'm replacing texture objects with FBO. Can i pack and unpack from a FBO? How? 3. What is a Texture Buffer Object? How can i make use of this? Thank you. Can be usefull for others too.
  4. Quote:Original post by cache_hit Put a breakpoint on the constructor. When it gets hit, hopefully it is the result of a dynamic allocation (malloc/new). Look up the stack to find the call to malloc, and check the argument, which should tell you the number of bytes. Perfect!Thank you, it worked!
  5. I am trying to modify Gothic 2 just fo fun. I am having the addresses of the classes, the constructors, deconstructors, but i need to know how to find out the size of a class(e.g. oCNpc).To find out the classes' address i am using IDA. The reason for this is that i want to create my own instances of that classes, but to do so i need to allocate some memory(size = sizeof(class)) mov the pointer to ECX then call the class' constructor. --xilup
  6. So i am injecting a DLL into a process, and this process has several classes. How do i use it's classes? I know anything i need to know about these classes, but how do i make use of them? For example i have a class name CNPChar, this class has the contructor, the deconstructor and some functions like(SetNPCPos, GetNPCPos etc). How can i use this class? How can i make my own instance of this class and control it from my injected library?
  7. void matRotateX(float _a) { m[5] = cos(_a); m[6] = sin(_a); m[9] = -sin(_a); m[10]= cos(_a); } void matRotateY(float _a) { m[0] = cos(_a); m[2] = -sin(_a); m[8] = sin(_a); m[10]= cos(_a); } void matRotateZ(float _a) { m[0] = cos(_a); m[1] = sin(_a); m[4] = -sin(_a); m[5] = cos(_a); } This are my functions that rotate my custom matrix class. If i rotate a quad for example, by the Z axis, it will rotate from the top left corner of the quad.How can i modify these functions so i can set the rotation center?
  8. Quote:Original post by Nanoha You've certainly got the right idea, can't see why that alone would cause major slow down. What graphics card are you using? Might be useful to see whats inside that m_pWindow->gOnRender() method. Also you can use glPushAttrib(GL_VIEWPORT_BIT) and glPopAttrib() to store the currect view port and pop it back afterwards *** Source Snippet Removed *** I find it neater but I think push/pop attrib might be depreciated in opengl now. Have you tried using a frame buffer object as a render target instead of using glCopyTexImage2D? not sure how that would fit in with your other window rendering bits though (mind if your havign slow down issues and non-power of 2 texture issues chances are your card mmight not support fbo) Thank you very much!Very usefull reply.
  9. Quote:Original post by Nanoha Quote:Original post by xilup But my problem goes here.Seems that i cannot render to a 1280x1024 texture, or can i? Don't see why you shouldn't be able to. If that is an issue for whatever reason then you could render to a 1280*1280 texture (rendering only to a section of it using glViewport) and when it comes to rendering the final texture to screen you could render it with tex coords (0, 0) to (1, 0.8), 0.8 being 1024/1280. pOpenGL->glSetTexture ( "render" ); //this bind an empty texture that has a size of 1280x1280 i32 t_i32Viewport[4];glGetIntegerv(GL_VIEWPORT, t_i32Viewport); glViewport( 0, 0, 1280, 1024 ); if ( m_pWindow ) m_pWindow->gOnRender (); glCopyTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 1280, 1280, 0 ); pOpenGL->glClearScene ( GL_COLOR_BUFFER_BIT, GL_ARGB(0,0,1,1) ); glViewport( t_i32Viewport[0],t_i32Viewport[1],t_i32Viewport[2],t_i32Viewport[3]); glBegin(GL_TRIANGLE_STRIP); glTexCoord2f(0,0); glVertex2f(0,0); glTexCoord2f(0,1); glVertex2f(0,t_i32Viewport[2]); glTexCoord2f(t_i32Viewport[3]/t_i32Viewport[2],0); glVertex2f(t_i32Viewport[3], 0); glTexCoord2f(t_i32Viewport[3]/t_i32Viewport[2],1); glVertex2f(t_i32Viewport[3], t_i32Viewport[2]); glEnd(); It is very very very slow, and when it finaly shows something on screen its only my cursor which moves really slow.
  10. I need to make my 2D game resolutionindpeendent, but i am having some problems here. The native resolution of the game is 1280x1024, so i need to render everything on a 1280x1024 texture, and then stretch the texture to the actual resolution size. But my problem goes here.Seems that i cannot render to a 1280x1024 texture, or can i? Can you guys help me on this one?
  11. Quote:Original post by Nanoha Not sure what your doing with all the widgets etc but maybe you could render everything off screen to a texture with a fixed resolution and only right at the end render that final texture as a simple quad to a window of whatever size you need. Hy.Thanks for the reply. How about the mouse position? I'm guessing that i will have to scale that.
  12. Ok so i managed to get my 2D game done after working a couple of months at it. I am having a nice GUI system that contains most of the WindowsNT gadgets and so on. Now the problem is how to make the game resolution independent, since it's native resolution is 1280x1024. Now the first solution that came into my mind was getting the scaling offsets, and then scale all the elements with these offsets. m_v2dScale.m_tX = (m_v2dWndRes.m_tX / 1280.0f); m_v2dScale.m_tY = (m_v2dWndRes.m_tY / 1024.0f); ... m_v4dRect.v4dScale(m_v2dScale);//(multiply the position and the width\height of the 4 dimensional vector with the offsets of the scale vector. Now using this method gives me a lots of bugs, a lots of artifacts and everything looks bad overall. Maybe i am not doing something the way i should. So for now i have a 2D game stucked at the resolution of 1280x1024. What is the best way to make it resolution independent?
  13. xilup

    Multisampling and Lines

    Quote:Original post by Hodgman It's been a while since I've dealt with this, but you could try glDisable( GL_LINE_SMOOTH ) Don't think it would do too much, since i am using multisampling.However, what i am trying to do is a 2D game, so i don't think multisampling is really necessary here, since almost all of my quads will be textured.
  14. I need to draw some raw lines(a string of pixels), but it seems that multisampling keeps messing my lines.It makes them thicker and almost transparent.Is there a way of glEnable() and glDisable() multisampling or drawing lines without that happening? Thank you, xilup.
  15. xilup

    glScissor issues

    I played around all the day with glScissor and i finally managed to get something working.Not all good. but at least there is something good. My question now is, if i intersect two scissor boxes, sc1 and sc2, that have the same dimensions, what part of sc2 will be visible?Only the one that is in the sc1 or the whole box? Because i'm having an issue here. Please take a look: void CEngineGL::glPushMask ( RECT rcRect ) { m_vRectGL.push_back (rcRect); glScissor( rcRect.left, m_iResY-rcRect.top-rcRect.bottom, rcRect.right, rcRect.bottom ); glEnable( GL_SCISSOR_TEST ); } void CEngineGL::glPopMask () { if ( m_vRectGL.size() > 0 ) m_vRectGL.pop_back (); if ( m_vRectGL.size() == 0 ) { int t_iVec[4]; glGetIntegerv( GL_SCISSOR_BOX, t_iVec ); glScissor( t_iVec[0], t_iVec[1], t_iVec[2], t_iVec[3] ); glDisable( GL_SCISSOR_TEST ); } else { RECT &rcRect = m_vRectGL.back(); glScissor( rcRect.left, m_iResY-rcRect.top-rcRect.bottom, rcRect.right, rcRect.bottom ); glEnable( GL_SCISSOR_TEST ); } } This is my code for doing scissoring. Now using these code this way: RECT rcRect; SetRect( &rcRect, 100, 100, 500, 500 ); p_glCore->glPushMask ( rcRect ); { p_glCore->glClearScene ( GL_COLOR_BUFFER_BIT, GL_XRGB(0,1,0) ); SetRect( &rcRect, 250, 250, 500, 500 ); p_glCore->glPushMask ( rcRect ); { p_glCore->glClearScene ( GL_COLOR_BUFFER_BIT, GL_XRGB(0,0,0) ); p_glWindow->glOnRender (Vector2D(500,600), 0.0f); } p_glCore->glPopMask (); p_glCursor->glOnRender ( p_glEngine->glGetMouse(), 0.0f ); } p_glCore->glPopMask (); Results in something like this: [picture]http://img340.imageshack.us/i/31753929.jpg/[/picture] As you may noticve in the image, the cursor draws only withing the first scissor box, as it should, and that pink little rectangle also draws well withing the 2nd scissor box, but the 2nd scissor box won't fit into the first scissor box. -- Made Some modifications and everything works well right now. --By the way, for those who need help in the future void CEngineGL::glPushMask ( RECT rcRect ) { if (m_vRectGL.size() > 0 ) { RECT pr = m_vRectGL.back(); if ( rcRect.left < pr.left ) { rcRect.right -= (pr.left-rcRect.left); rcRect.left = pr.left; if ( rcRect.right < 0 ) rcRect.right = 0; } if ( rcRect.top < pr.top ) { rcRect.bottom -= (pr.top-rcRect.top); rcRect.top = pr.top; if ( rcRect.bottom < 0 ) rcRect.bottom = 0; } if ( rcRect.right + rcRect.left > pr.right + pr.left ) { rcRect.right -= (rcRect.right + rcRect.left)-(pr.right + pr.left); if ( rcRect.right < 0 ) rcRect.right = 0; } if ( rcRect.bottom + rcRect.top > pr.bottom + pr.top ) { rcRect.bottom -= (rcRect.bottom + rcRect.top)-(pr.bottom + pr.top); if ( rcRect.bottom < 0 ) rcRect.bottom = 0; } } m_vRectGL.push_back (rcRect); glScissor( rcRect.left, m_iResY-rcRect.top-rcRect.bottom, rcRect.right, rcRect.bottom ); glEnable( GL_SCISSOR_TEST ); } void CEngineGL::glPopMask () { if ( m_vRectGL.size() > 0 ) m_vRectGL.pop_back (); if ( m_vRectGL.size() == 0 ) { int t_iVec[4]; glGetIntegerv( GL_SCISSOR_BOX, t_iVec ); glScissor( t_iVec[0], t_iVec[1], t_iVec[2], t_iVec[3] ); glDisable( GL_SCISSOR_TEST ); } else { RECT &rcRect = m_vRectGL.back(); glScissor( rcRect.left, m_iResY-rcRect.top-rcRect.bottom, rcRect.right, rcRect.bottom ); glEnable( GL_SCISSOR_TEST ); } } //m_vRectGL is declared as std::vector<RECT> m_vRectGL; [Edited by - xilup on December 5, 2009 11:30:33 AM]
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!