Thread: Menu Crashing

Results 1 to 13 of 13
  1. #1
    Flengo's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    /admincp/banning.php
    Posts
    20,591
    Reputation
    5180
    Thanks
    14,179
    My Mood
    Inspired

    Menu Crashing

    I'm trying to use SEGnosis scrolling menu. Its posted on UC. It injects, and you can see the menu. I start going through it and after a few seconds it crashes.

    Menu.cpp
    Code:
    #include "Menu.h"
    
    #define Red D3DCOLOR_ARGB (255 , 255 , 0 , 0 )    
    #define Yellow D3DCOLOR_ARGB (255 , 255 , 255 , 0 ) 
    #define Green D3DCOLOR_ARGB (255 , 0 , 255 , 0 )    
    #define Blue D3DCOLOR_ARGB (255 , 0 , 0 , 255 )     
    #define Purple D3DCOLOR_ARGB (255 , 102 , 0 , 153 )   
    #define Pink D3DCOLOR_ARGB (255 , 255 , 20 , 147 ) 
    #define Orange D3DCOLOR_ARGB (255 , 255 , 165 , 0 )  
    #define Black D3DCOLOR_ARGB (255 , 0 , 0 , 0 )       
    #define White D3DCOLOR_ARGB (255 , 255 , 255 , 255 )
    
    cMenu Menu;//Menu
    cDraw Draw;
    
    //----------------------------------//
    cDraw::cDraw()
    {
    	m_pDevice = 0;
    	m_iLB_FontSize = 14;
    }
    //----------------------------------//
    cDraw::~cDraw()
    {
    	
    }
    //----------------------------------//
    
    //----------------------------------//
    void cDraw::Load_Resources( void )
    {
    	m_coLB_Item			= D3DCOLOR_ARGB( 255, 0, 0,	0 );
    	m_coLB_SelItem		= D3DCOLOR_ARGB( 255, 0, 200, 0 );
    	m_coLB_SectionItem	= D3DCOLOR_ARGB( 255, 0, 0, 255 );
    	
    	m_coLB_Back			= D3DCOLOR_ARGB( 255, 255, 255,	255 );
    	m_coLB_Border		= D3DCOLOR_ARGB( 255, 0, 0,	0 );
    	m_coLB_Stripe		= D3DCOLOR_XRGB( 248, 248, 248 );
    	
    	m_coRed				= D3DCOLOR_XRGB( 255, 0, 0 );
    	m_coBlue			= D3DCOLOR_XRGB( 0, 0, 255 );
    	m_coWhite			= D3DCOLOR_XRGB( 255, 255, 255 );
    	m_coBlack			= D3DCOLOR_XRGB( 0, 0, 0 );
    
    	D3DXCreateFont( m_pDevice, m_iLB_FontSize, 0, FW_MEDIUM, 1, 0 ,DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_SCRIPT, "Arial", &m_pLBFont );
    	//D3DXCreateLine( m_pDevice, &m_pLine );
    }
    //----------------------------------//
    
    //----------------------------------//
    void cDraw::String ( int X, int Y, D3DCOLOR Color, const char *szString, ... )
    {
    	long	W = 100, H = 40;
    	char	szBuffer[ 1024 ] = { 0 };
    	RECT	rtFontPos = { X, Y, X + W, Y + H };
    	
    	va_list va_alist;
    	va_start( va_alist, szString );
    	vsprintf( szBuffer, szString, va_alist);
    	va_end	( va_alist );
    
    	m_pLBFont->DrawText( NULL, szBuffer, -1, &rtFontPos, DT_LEFT | DT_NOCLIP, Color );
    }
    //----------------------------------//
    void cDraw::Rect   ( int X, int Y, int W, int H, D3DCOLOR Color )
    {
    	D3DXVECTOR2 vLine[ 2 ];
    		m_pLine->SetWidth( W );
    		m_pLine->SetAntialias( 0 );
    		m_pLine->SetGLLines( 1 );
    
    	m_pLine->SetWidth( W );
    	m_pLine->Begin();
    
    		vLine[ 0 ][ 0 ] = X+W/2;
    		vLine[ 0 ][ 1 ] = Y;
    		vLine[ 1 ][ 0 ] = X+W/2;
    		vLine[ 1 ][ 1 ] = Y+H;
    
    	m_pLine->Draw( vLine, 2, Color );
    	m_pLine->End();
    }
    //----------------------------------//
    
    struct _Menu_Item
    {
    	long	iType;
    	char	szItem[ MAX_PATH ];
    		 
    	float	fMin,
    			fMax,
    			fStatus,
    			fOffset;
    }*Menu_Item;
    
    //----------------------------------//
    cMenu::cMenu()
    {
    	Menu_Item = new _Menu_Item[ 100 ];
    	ZeroMemory( Menu_Item, sizeof( _Menu_Item ) * 100 );
    	
    	m_iMenuItemAmount	= 0;
    	m_iCurrentIndex		= 1;
    	m_iLB_Index			= 0;
    	m_iLB_Amount		= 6;
    	
    	m_bVisible = true;
    	
    	SetRect( &m_rtClient, 0, 14, 0, 14 );
    }
    //----------------------------------//
    cMenu::~cMenu()
    {
    	delete Menu_Item;
    }
    //----------------------------------//
    
    //----------------------------------//
    void cMenu::Create			( void )
    {
    	Menu.Append_Item( ITEM_TYPE_SECTION,	"[Catagory 1]", 0, 0, 1 );
    	Menu.Append_Item( ITEM_TYPE_OPTION,	"Option1", 0, 100, 1 );
    	Menu.Append_Item( ITEM_TYPE_OPTION,	"Option2", 0, 1, 0.1f );
    	Menu.Append_Item( ITEM_TYPE_OPTION,	"Option3", 0, 10, 2 );
    	Menu.Append_Item( ITEM_TYPE_SECTION,	"[Catagory 2]", 0, 0, 1 );
    	Menu.Append_Item( ITEM_TYPE_OPTION,	"Option4", 0, 1, 1 );
    	Menu.Append_Item( ITEM_TYPE_OPTION,	"Option5", 0, 1, 1 );
    	Menu.Append_Item( ITEM_TYPE_OPTION,	"Option6", 0, 1, 1 );
    	Menu.Append_Item( ITEM_TYPE_OPTION,	"Option7", 0, 1, 1 );
    
    	for( int i = 0; i < m_iMenuItemAmount; i++ )
    	{
    		if( strcmp( Menu_Item[ i ].szItem, "  Distance" ) == 0 ) // For setting defaults
    			Menu_Item[ i ].fStatus = 100;
    	}
    	
    	//LoadSettings();
    }
    //----------------------------------//
    
    //----------------------------------//
    void cMenu::SaveSettings	( void )
    {
    	fstream pFile( "Settings.gha", ios::out );
    	
    	pFile.write( ( const char* )Menu_Item, sizeof( _Menu_Item ) * ( m_iMenuItemAmount - 1 ) );
    	
    	pFile.close();
    }
    //----------------------------------//
    void cMenu::LoadSettings	( void )
    {
    	fstream pFile( "Settings.gha", ios::in );
    	
    	pFile.read( ( char* )Menu_Item, sizeof( _Menu_Item ) * ( m_iMenuItemAmount - 1 ) );
    	
    	pFile.close();
    }
    //----------------------------------//
    
    //----------------------------------//
    char* cMenu::Extend_String	( char* szString, long iLength )
    {
    	static char szBuffer[ 2048 ];
    	
    	long iCurrentLength = strlen( szString );
    	
    	strcpy( szBuffer, szString );
    	
    	for( int i = iCurrentLength; i < iLength; i++ )
    		strcat( szBuffer, " " );
    	
    	return szBuffer;
    }
    //----------------------------------//
    void  cMenu::Append_Item	( long iType, char* szItem, float fMin, float fMax, float fOffset )
    {
    	strcpy_s( Menu_Item[ m_iMenuItemAmount ].szItem, MAX_PATH, szItem );
    	
    	Menu_Item[ m_iMenuItemAmount ].fMin		= fMin;
    	Menu_Item[ m_iMenuItemAmount ].fMax		= fMax;
    	Menu_Item[ m_iMenuItemAmount ].iType	= iType;
    	Menu_Item[ m_iMenuItemAmount ].fOffset	= fOffset;
    	Menu_Item[ m_iMenuItemAmount ].fStatus	= 0;
    	
    	m_iMenuItemAmount++;
    }
    //----------------------------------//
    float cMenu::GetItemByName ( char* szName )
    {
    	for( int i = 0; i < m_iMenuItemAmount; i++ )
    		if( strcmp( szName, Menu_Item[ i ].szItem ) == 0 )
    			return Menu_Item[ i ].fStatus;
    	
    	return -1;
    }
    //----------------------------------//
    
    //----------------------------------//
    void cMenu::Keyboard_Input	( void )
    {
    	if( GetAsyncKeyState( VK_LEFT )&1  && Menu_Item[ m_iCurrentIndex ].fStatus - Menu_Item[ m_iCurrentIndex ].fOffset >= Menu_Item[ m_iCurrentIndex ].fMin ) 
    	{
    		Menu_Item[ m_iCurrentIndex ].fStatus -= Menu_Item[ m_iCurrentIndex ].fOffset;
    		//SaveSettings();
    	}
    	if( GetAsyncKeyState( VK_RIGHT )&1 && Menu_Item[ m_iCurrentIndex ].fStatus + Menu_Item[ m_iCurrentIndex ].fOffset <= Menu_Item[ m_iCurrentIndex ].fMax )
    	{
    		Menu_Item[ m_iCurrentIndex ].fStatus += Menu_Item[ m_iCurrentIndex ].fOffset;
    		//SaveSettings();
    	}
    	
    	if( GetAsyncKeyState( VK_UP )&1  )
    		for( int i = m_iCurrentIndex - 1; i > 0; i-- )
    			if( Menu_Item[ i ].iType == ITEM_TYPE_OPTION )
    			{
    				m_iCurrentIndex = i;
    				break;
    			}
    	
    	if( GetAsyncKeyState( VK_DOWN )&1 )
    		for( int i = m_iCurrentIndex + 1; i < m_iMenuItemAmount; i++ )
    			if( Menu_Item[ i ].iType == ITEM_TYPE_OPTION  )
    			{
    				m_iCurrentIndex = i;
    				break;
    			}
    	
    	m_iLB_Index = m_iCurrentIndex - m_iLB_Amount/2;
    	
    	if( m_iLB_Index < 0 )
    		m_iLB_Index = 0;
    	
    	if( m_iLB_Index > m_iMenuItemAmount - m_iLB_Amount )
    		m_iLB_Index = m_iMenuItemAmount - m_iLB_Amount;
    }
    //----------------------------------//
    
    //----------------------------------//
    void cMenu::List_Box		( void )
    {
    	SetRect( &m_rtLB_Client, m_rtClient.left, m_rtClient.top, 210, Draw.m_iLB_FontSize * m_iLB_Amount );
    	
    	Draw.Rect( m_rtLB_Client.left - 1, m_rtLB_Client.top - 1, m_rtLB_Client.right + 2, m_rtLB_Client.bottom + 2, Draw.m_coLB_Border );
    	Draw.Rect( m_rtLB_Client.left, m_rtLB_Client.top, m_rtLB_Client.right, m_rtLB_Client.bottom, Draw.m_coLB_Back );
    		
    	for( int i = m_rtLB_Client.top; i < m_iLB_Amount * Draw.m_iLB_FontSize + m_rtLB_Client.top; i += Draw.m_iLB_FontSize * 2 )
    		Draw.Rect( m_rtLB_Client.left, i, 210, Draw.m_iLB_FontSize, Draw.m_coLB_Stripe );
    
    	for( int i = m_iLB_Index, k = 0; i < m_iLB_Amount + m_iLB_Index; i++, k++ )
    	{
    		if( Menu_Item[ i ].iType == ITEM_TYPE_SECTION )
    			Draw.String( m_rtLB_Client.left + 1, m_rtLB_Client.top + ( k * Draw.m_iLB_FontSize ) + 1, Draw.m_coLB_SectionItem, "%s", Menu_Item[ i ].szItem );
    		else
    			Draw.String( m_rtLB_Client.left + 20, m_rtLB_Client.top + ( k * Draw.m_iLB_FontSize ) + 1, ( i == m_iCurrentIndex ? Draw.m_coLB_SelItem : Draw.m_coLB_Item ), "%s : %.1f", Extend_String( Menu_Item[ i ].szItem, 20 ), Menu_Item[ i ].fStatus );
    	}		
    }
    //----------------------------------//
    void cMenu::Display_Menu	( void )
    {
    	Keyboard_Input();
    	List_Box();
    }
    //----------------------------------//
    
    
    //----------------------------------//
    void cMenu::Commands		( void )
    {	
    	if( GetAsyncKeyState( VK_INSERT )&1 )
    		m_bVisible = !m_bVisible;
    	
    	if( GetItemByName( "Option1" ) )
    	{
    		
    	}
    	
    	if( GetItemByName( "Option2" ) )
    	{
    		
    	}
    	
    	if( GetItemByName( "Option3" ) )
    	{
    		
    	}
    }
    
    //----------------------------------//
    In Present:

    Code:
    if(!Draw.m_pDevice)
    {
    	Draw.m_pDevice = pDevice;
    	Draw.Load_Resources();
    	Menu.Create();
    	Menu.Display_Menu();
    }
    That's my code. Any help? My hook and detours work, tested with another menu.
    Last edited by Drake; 05-10-2012 at 09:14 AM.
    I Read All Of My PM's & VM's
    If you need help with anything, just let me know.

     


     
    VM | PM | IM
    Staff Administrator Since 10.13.2019
    Publicist Since 04.04.2015
    Middleman Since 04.14.2014
    Global Moderator Since 08.01.2013
    Premium Since 05.29.2013

    Minion+ Since 04.18.2013

    Combat Arms Minion Since 12.26.2012
    Contributor Since 11.16.2012
    Member Since 05.11.2010


  2. #2
    gotter's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    Minecraft snowy Biome
    Posts
    360
    Reputation
    6
    Thanks
    153
    when does it crash?

  3. #3
    CookieMonster™'s Avatar
    Join Date
    Apr 2012
    Gender
    male
    Location
    Engine.exe
    Posts
    263
    Reputation
    31
    Thanks
    137
    My Mood
    Yeehaw
    Check what functions/hacks are being called.
    Check everything.
    ~JA

  4. #4
    Flengo's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    /admincp/banning.php
    Posts
    20,591
    Reputation
    5180
    Thanks
    14,179
    My Mood
    Inspired
    Quote Originally Posted by Crash' View Post
    Check what functions/hacks are being called.
    Check everything.
    ~JA
    No hacks are being called.
    That is everything.
    The menu code and the lines that I posted above that are in present, are it.

    It works, but its crashing. Don't know why. I tried checking through the functions and edited some things but it didn't change anything.
    I Read All Of My PM's & VM's
    If you need help with anything, just let me know.

     


     
    VM | PM | IM
    Staff Administrator Since 10.13.2019
    Publicist Since 04.04.2015
    Middleman Since 04.14.2014
    Global Moderator Since 08.01.2013
    Premium Since 05.29.2013

    Minion+ Since 04.18.2013

    Combat Arms Minion Since 12.26.2012
    Contributor Since 11.16.2012
    Member Since 05.11.2010


  5. #5
    CAFlames's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Location
    Where ever my imagination takes me
    Posts
    3,006
    Reputation
    202
    Thanks
    2,944
    My Mood
    Twisted
    It's been a while since I dealt with this stuff, but if I were you, I would look at this part:

    Code:
    if(!Draw.m_pDevice)
    {
    	Draw.m_pDevice = pDevice;
    	Draw.Load_Resources();
    	Menu.Create();
    	Menu.Display_Menu();
    }
    @comando2056

    Current Works:
    ---Horror Game





    [IMG]https://i645.photobucke*****m/albums/uu180/drgnforce9/Siggys/signature3.jpg[/IMG]
    Special thanks to drgnforce9 for my sig picture

    Quote Originally Posted by m_t_h View Post

    CAflames is one epic coder.

    Rep and thanks him.. or you're perma banned.

  6. #6
    CookieMonster™'s Avatar
    Join Date
    Apr 2012
    Gender
    male
    Location
    Engine.exe
    Posts
    263
    Reputation
    31
    Thanks
    137
    My Mood
    Yeehaw
    @CAFlames
    I thought you were dead o.o

  7. #7
    CAFlames's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Location
    Where ever my imagination takes me
    Posts
    3,006
    Reputation
    202
    Thanks
    2,944
    My Mood
    Twisted
    Quote Originally Posted by Crash' View Post
    @ CAFlames
    I thought you were dead o.o
    I resurrected in the spirit of Easter!

    I am thinking about getting back into the business.. but not as involved with CA as I used to. I just miss coding for mpgh. Iunno..

    Current Works:
    ---Horror Game





    [IMG]https://i645.photobucke*****m/albums/uu180/drgnforce9/Siggys/signature3.jpg[/IMG]
    Special thanks to drgnforce9 for my sig picture

    Quote Originally Posted by m_t_h View Post

    CAflames is one epic coder.

    Rep and thanks him.. or you're perma banned.

  8. #8
    CookieMonster™'s Avatar
    Join Date
    Apr 2012
    Gender
    male
    Location
    Engine.exe
    Posts
    263
    Reputation
    31
    Thanks
    137
    My Mood
    Yeehaw
    @CAFlames
    Add my MSN

  9. #9
    Flengo's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    /admincp/banning.php
    Posts
    20,591
    Reputation
    5180
    Thanks
    14,179
    My Mood
    Inspired
    Quote Originally Posted by CAFlames View Post
    It's been a while since I dealt with this stuff, but if I were you, I would look at this part:

    Code:
    if(!Draw.m_pDevice)
    {
    	Draw.m_pDevice = pDevice;
    	Draw.Load_Resources();
    	Menu.Create();
    	Menu.Display_Menu();
    }
    @comando2056
    Yeah I'm pretty sure that is where the problem is occurring but I don't know what to do.
    I Read All Of My PM's & VM's
    If you need help with anything, just let me know.

     


     
    VM | PM | IM
    Staff Administrator Since 10.13.2019
    Publicist Since 04.04.2015
    Middleman Since 04.14.2014
    Global Moderator Since 08.01.2013
    Premium Since 05.29.2013

    Minion+ Since 04.18.2013

    Combat Arms Minion Since 12.26.2012
    Contributor Since 11.16.2012
    Member Since 05.11.2010


  10. #10
    CAFlames's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Location
    Where ever my imagination takes me
    Posts
    3,006
    Reputation
    202
    Thanks
    2,944
    My Mood
    Twisted
    Quote Originally Posted by comando2056 View Post


    Yeah I'm pretty sure that is where the problem is occurring but I don't know what to do.
    Do you ever create the font?

    Current Works:
    ---Horror Game





    [IMG]https://i645.photobucke*****m/albums/uu180/drgnforce9/Siggys/signature3.jpg[/IMG]
    Special thanks to drgnforce9 for my sig picture

    Quote Originally Posted by m_t_h View Post

    CAflames is one epic coder.

    Rep and thanks him.. or you're perma banned.

  11. #11
    CookieMonster™'s Avatar
    Join Date
    Apr 2012
    Gender
    male
    Location
    Engine.exe
    Posts
    263
    Reputation
    31
    Thanks
    137
    My Mood
    Yeehaw
    Take that tip ^^
    Check everything.

  12. #12
    Flengo's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    /admincp/banning.php
    Posts
    20,591
    Reputation
    5180
    Thanks
    14,179
    My Mood
    Inspired
    Quote Originally Posted by CAFlames View Post


    Do you ever create the font?
    Yes. But its fine I created my own It's working.

    Thanks anyways guys.

    @flameswor10 Request Close.
    I Read All Of My PM's & VM's
    If you need help with anything, just let me know.

     


     
    VM | PM | IM
    Staff Administrator Since 10.13.2019
    Publicist Since 04.04.2015
    Middleman Since 04.14.2014
    Global Moderator Since 08.01.2013
    Premium Since 05.29.2013

    Minion+ Since 04.18.2013

    Combat Arms Minion Since 12.26.2012
    Contributor Since 11.16.2012
    Member Since 05.11.2010


  13. #13
    CookieMonster™'s Avatar
    Join Date
    Apr 2012
    Gender
    male
    Location
    Engine.exe
    Posts
    263
    Reputation
    31
    Thanks
    137
    My Mood
    Yeehaw
    @comando2056
    Good Job.
    I wanna see a screenie of it
    Add my msn which is
    crashinfinity@hotmail.com

Similar Threads

  1. Menu Crash?
    By ppl2pass in forum Combat Arms Hack Coding / Programming / Source Code
    Replies: 41
    Last Post: 08-04-2010, 09:23 PM
  2. [Release] Crash's Menu Hack v1.1 FIX
    By Crash in forum Combat Arms Hacks & Cheats
    Replies: 116
    Last Post: 06-23-2010, 04:07 PM
  3. [Release] Crash's Menu Hack v1.2 - [ Chams + Wallhack ] !
    By Crash in forum Combat Arms Hacks & Cheats
    Replies: 113
    Last Post: 06-22-2010, 09:19 AM
  4. [Release] Crash's Menu Hack v1
    By Crash in forum Combat Arms Hacks & Cheats
    Replies: 88
    Last Post: 06-16-2010, 10:21 PM
  5. Gellins D3D menu work but features crash!
    By Mr.Magicman in forum Combat Arms Help
    Replies: 0
    Last Post: 06-01-2010, 09:24 AM