Results 1 to 5 of 5
  1. #1
    ieatyourlvllol's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    50
    Reputation
    77
    Thanks
    337
    My Mood
    Aggressive

    Fonts without reset hook

    This is the way i set up fonts in CA with a present hook...

    also i'm not gonna be explaining hooks, drawing function's or how its set up =p so don't ask me at least.

    Font.h
    Code:
    class cFont
    {
    public:
    
    	LPD3DXFONT g_pFont;
    
    	void FontManager (LPDIRECT3DDEVICE9 pDevice)
    	{
    		if (g_pFont)
    		{
    			g_pFont->Release();
    			g_pFont = NULL;
    		}
    		D3DXCreateFont( pDevice,
    		                     14,
                                          0,
                                    FW_BOLD,
                                          1,
                                          0,
                            DEFAULT_CHARSET,
                         OUT_DEFAULT_PRECIS,
                            DEFAULT_QUALITY,
                DEFAULT_PITCH | FF_DONTCARE,
                                    "Arial",
                                    &g_pFont );
    	}
    
    }Font;
    DllMain.cpp
    Code:
    void cooperativeStatus(LPDIRECT3DDEVICE9 pDevice)
    {
    	HRESULT cooperativeStat = pDevice->TestCooperativeLevel();
    	
    	switch (cooperativeStat)
    	{
    	case D3DERR_DEVICELOST:
    		Sleep(1000);
    		Font.g_pFont->OnLostDevice();
    		break;
    	case D3DERR_DEVICENOTRESET:
    		Font.g_pFont->OnResetDevice();
    		break;
    	case D3DERR_DRIVERINTERNALERROR:
    		break;
    	case D3D_OK:  //Do youre drawings here
    		if (MenuShow)
    		{
    			RenderMenu(pDevice);
    		}
    		break;
    	}
    }
    Now just call them in you're present hook and youre good to go lol

    Code:
    HRESULT APIENTRY MyPresent ( LPDIRECT3DDEVICE9 pDevice,
    	                     const RECT *pSourceRect,
    			     const RECT *pDestRect,
    			     HWND hDestWindowOverride,
    			     const RGNDATA *pDirtyRegion )
    {
    	_asm pushad;
    
    	Font.FontManager(pDevice);
    	cooperativeStatus(pDevice);
    
    	_asm popad;
    
    	return RealPresent(pDevice,pSourceRect,pDestRect,hDestWindowOverride,pDirtyRegion);
    }
    Hope this helps some of you

    if any of you code junkies think something is rong let me know lmao





  2. #2
    supercarz1991's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    North of Hell, South of Heaven
    Posts
    6,067
    Reputation
    323
    Thanks
    3,323
    My Mood
    Doh
    basically the same way my old universal d3d menu does it. was one of the first menus i ever made, and it's bad ass XD works on any game that's d3d9-d3d11

    commando: You're probably the best non-coder coder I know LOL


  3. #3
    topblast's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Far from around you Programmer: C++ | VB | C# | JAVA
    Posts
    3,607
    Reputation
    149
    Thanks
    4,922
    My Mood
    Cool
    I can see that you try, but the I wouldnt use this on my base. The purpose of reset is to reset only when device is new or different, but in the implementation you have there, tho on track with some things which are not required. You see both functions u use can reset a font but in the first function 'FontManager' it is creating a new font every frame, which would be a very hard hit on performance. In the second frame, u have a sleep for a second in a rendering frame, i understand what you are trying to achieve here, but the implementation of it is somewhat out of place.

    But it is a nice try, good work either way.
    I just like programming, that is all.

    Current Stuff:

    • GPU Programmer (Cuda)
    • Client/Server (Cloud Server)
    • Mobile App Development

  4. The Following User Says Thank You to topblast For This Useful Post:

    ieatyourlvllol (12-12-2013)

  5. #4
    ieatyourlvllol's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    50
    Reputation
    77
    Thanks
    337
    My Mood
    Aggressive
    hahaha thanks i understand, ill fix that for myself you know...the only thing i thought about that could be wrong with this is the way i was recreating that font in fontmgr and you nailed it lmao xD and about that sleep func idk...something about wasteing data without it....idk i read to much random stuffs from google xD





  6. #5
    topblast's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Far from around you Programmer: C++ | VB | C# | JAVA
    Posts
    3,607
    Reputation
    149
    Thanks
    4,922
    My Mood
    Cool
    Quote Originally Posted by ieatyourlvllol View Post
    hahaha thanks i understand, ill fix that for myself you know...the only thing i thought about that could be wrong with this is the way i was recreating that font in fontmgr and you nailed it lmao xD and about that sleep func idk...something about wasteing data without it....idk i read to much random stuffs from google xD
    Sleep is used to put a thread on somewhat of a pause or yield to another thread. Sleeping or other thread waiting method in a Rendering/GUI is not recommended where it is "ballz to the wallz" to get everything done in 16ms(1000ms / 60 : the refresh rate of a 60Hz monitor). Sleeping for anytime can dramatically affect the time it have to do this.

    With that lesson learnt there is also no reason to sleep before lost device
    I just like programming, that is all.

    Current Stuff:

    • GPU Programmer (Cuda)
    • Client/Server (Cloud Server)
    • Mobile App Development

Similar Threads

  1. [Request] Can any one here post a project for D3D Menu Without the HOOK SURE !
    By DarkPladin in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 4
    Last Post: 08-02-2012, 05:04 PM
  2. [Tutorial] [Quicktut]about changing ur font on mpgh without using go advance :)
    By Snipermon in forum CrossFire Tutorials
    Replies: 32
    Last Post: 03-08-2011, 03:01 PM
  3. Replies: 16
    Last Post: 03-06-2011, 01:53 PM
  4. Combined Base v2 [ Supports Sprites and 2 fonts with working hook]
    By whit in forum Combat Arms Hack Coding / Programming / Source Code
    Replies: 201
    Last Post: 11-16-2010, 04:53 PM
  5. ESP hack without gameengine hook
    By silent1990 in forum C++/C Programming
    Replies: 6
    Last Post: 07-06-2009, 09:34 PM