Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About thenoobie

  • Rank
  1. thenoobie

    How to modify pixel shader?

    Thanks so much! I actually tried this earlier thinking that it should definitely work but for some reason it caused a very strange looking 'glass' texture over the object being rendered. I just realized why it wasn't working before though (accidentally removed the shader initialization without realizing it) and it's been fixed.
  2. I'm using a pixel shader in my program but you can only generate shaders a single time unless you want a crash so I'm having trouble modifying it. I want to be able to change the RGB values while in game so that I can figure out which colors I think look best without having to restart the game every 30 seconds to change them. HRESULT GenerateShader(IDirect3DDevice9 *pD3Ddev, IDirect3DPixelShader9 **pShader, float r, float g, float b, bool setzBuf) { char szShader[ 256 ]; ID3DXBuffer *pShaderBuf = NULL; if (setzBuf) sprintf_s( szShader, "ps_3_0\ndef c0, %f, %f, %f, %f\nmov oC0,c0\nmov oDepth, c0.x", r, g, b, 1.0f ); else sprintf_s( szShader, "ps_3_0\ndef c0, %f, %f, %f, %f\nmov oC0,c0", r, g, b, 1.0f ); D3DXAssembleShader( szShader, (strlen(szShader)+1), NULL, NULL, 0, &pShaderBuf, NULL ); if( FAILED( pD3Ddev->CreatePixelShader((const DWORD*)pShaderBuf->GetBufferPointer(), pShader)) )return E_FAIL; return S_OK; } LPDIRECT3DDEVICE9 pD3Ddev pDevice; LPDIRECT3DPIXELSHADER9 pShader customShader; GenerateShader( pDevice, customShader, r, g, b ); Once this shader is created there is no way for me to change the RGB values so I tried this... if ( customShader ) { customShader->Release(); customShader = NULL; } GenerateShader( pDevice, customShader, r, g, b ); So like I showed you above I tried releasing the object and then assigning it the correct shader RGB values again but of course it crashed on me. The only way I can think to do this would be to set up an array of INFINITE and use a loop to constantly make new shaders but of course I'm not going to do that because wow, talk about a memory leak (and wouldn't even work even half decent anyway.) Advice?
  3. thenoobie

    LoadLibrary from byte array?

    No. Just... no. A HMODULE is a handle. A handle is an opaque type given to you by an API. You're not supposed to assume anything about it. You are assuming that it is a pointer to the first byte in memory of a loaded DLL. [/quote] The reason I posted it in the code was I was trying to just show a very simple example of what I am attempting to do, which is turn a byte array into an HMODULE that can be loaded by GetProcAddress() to return the address of the requested function in the DLL.
  4. thenoobie

    LoadLibrary from byte array?

    Thanks, keep the information coming guys. I am incredibly interested in learning Windows programming bottom to top and this is one of the things at the moment that I'm most interested in learning.
  5. thenoobie

    LoadLibrary from byte array?

    I worded my question pretty badly, I want to get the address of a function stored in a DLL through a byte array. This is absolutely 100% for learning purposes which is why I don't want to use a blatantly simpler method. There are 100 ways I know how to do this differently but I want to learn how to do it this specific way. DWORD GetAddressFromBinary( unsigned char *pData ) { // Sort through data here HMODULE MemDll = reinterpret_cast<HMODULE>pData; DWORD Address = GetProcAddress( MemDll, "TestFunction" ); return Address; } int main( unsigned char *pData ) { // Read file for array of bytes unsigned char *pData = ReadFile(/*Parameters here*/); GetAddressFromBinary( pData ); }
  6. thenoobie

    LoadLibrary from byte array?

    Thanks a lot for the link, I really appreciate the help.
  7. thenoobie

    LoadLibrary from byte array?

    The array is 126,462 bytes and it's a DLL binary file.
  8. How would I go about using an array of bytes containing binary data to find the address of a function located in that data. For example, I compile a DLL with the function "Squared( int a, int b )" but all I have is the array of bytes that make up the DLL. How would I go about finding the address of "Squared"?
  9. thenoobie

    3D Bullet Prediction

    I'm looking for an algorithm to calculate where the bots should shoot their guns toward with projectile type bullets (non-instant.) The game is full 3D and I have the X, Y, Z (Vector) positions of the bots and the players. I also have the bullets speed, the distance between the two units (basic math), the vector speed of both units (how fast are they moving X, Y and Z.) I thought this would be fairly simple but I'm having a hell of a time finding a good algorithm and this is definitely more of a math/physics problem than a programming problem. I know I need to calculate how long the bullet will take to reach the target (T) and then calculate where the target will be in (T) ms of time based on his acceleration/direction and finally set the bots viewangles to that position. Anyone got some help?
  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!