Jump to content
  • Advertisement

aj3423

Member
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

108 Neutral

About aj3423

  • Rank
    Newbie
  1.   It's unlikely that it uses any D3D function for this.  The work will be done on the CPU, so what it will do is something like use the string to calculate a list of positions and texture coords, then lock the vertex buffer, memcpy the list across, then unlock. Exactly, what API(s) could be used to do the calculation, except the ScriptPlace/ScriptShape/ExtTextOut.     It's likely that no APIs are used to do the calculation.  Instead it's just regular arithmetic operators: +, -, *, /, and some array lookups, followed by a memcpy.   For example, one way of drawing text might be to store the characters in a texture with 16 rows and 16 columns.  That gives enough for 256 characters, so we're assuming a standard extended ASCII character set, but the principle will be the same for other character sets.  The integer equivalent of each character (space = 32, A = 65, B = 66, etc) is used to look up an array which supplies the texture coords to use for that character (this can also be done with math).  This and the positions are then copied out to an array of structs that looks something like:   struct textchar {     float position[2];     float texcoord[2]; };   The array is sized large enough for the string being drawn.  When we reach the end of the string the vertex buffer is locked, the array is memcpyed in, the vertex buffer is unlocked, a draw call is issued.   In other words, no API is needed for this; it's not an API problem, it's a "do it yourself in C/C++" problem.   Seems lots of game uses freetype2 + .ttc file, now I know how it works. Thanks a lot.
  2.   It's unlikely that it uses any D3D function for this.  The work will be done on the CPU, so what it will do is something like use the string to calculate a list of positions and texture coords, then lock the vertex buffer, memcpy the list across, then unlock. Exactly, what API(s) could be used to do the calculation, except the ScriptPlace/ScriptShape/ExtTextOut.
  3. I checked he Text3d demo, debugging it with IDA Pro, in function DrawText it calls ScriptPlace/ScriptShape and ExtTextOut, I guess it uses these function to calculate each pixel of text string. But the real game never uses these function, what function could the game possibly use to do the calculation?
  4. 0x010016F8 is a pointer to a string, no direct3d function operates on strings so the d3dx drawtext function should use the string and font data to calculate the values it passes to the other functions.   Inside the function drawtext, I guess when It calculates each vertex of the string, it should reference to the memory address.  But in which step is the calculation done?
  5. Thanks, I tried PIXWin, it works. The game calls SetTexture -> SetStreamSource -> DrawIndexedPrimitive to draw the text   I can see the Mesh, VertexBuffer and some other visual information from PIXWin, but I don't see any relationship between these stuff and the text being drawn.  So I tried to analyze the Text3D from DirectX examples, because it uses ID3DXFont::DrawText to draw this red string(on the first image), and may be I can find the how the underlying things are done.   I captured one frame of Text3D, opened in PIXWin, it draws this line first:   and here's the call of DrawText:     I checked all the functions in the call tree,  0x010016F8 is never used, why?  maybe I missed something? Thanks.
  6. Thanks guys   to mhagain:     I'll try that when I get back.   to Tom KQT:     Do you mean the API like D3DXCreateText / D3DXCreateTexture ?   to cozzie:     :)
  7. Hi, I wanna hook a DX game's text output, it uses d3dx9_35.dll. I'm not good at DirectX,  the game looks like:     I hooked D3DXCreateFontA/W, D3DXCreateFontIndirectA/W , they are not called. And the GDI api TextOutA/W DrawTextA/W are not used either. The game is not protected, I can debug it with OllyDbg, I add breakpoints to these functions, never breaks. So how does the game draw text?   Thanks.
  • 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!