Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 85
[C++] Win XP vs. Win7 - debugs
Results 1 to 2 of 2

Thread: [C++] Win XP vs. Win7 - debugs

  1. #1
    Senior Member
    Join Date
    Oct 2009
    Location
    Poland, Świebodzin
    Posts
    233

    [C++] Win XP vs. Win7 - debugs

    Hello. I've got problem related to the debug on Win7. I check which one code does debug - it is mana bar code. I've got Hawkye's code. I use 8.54 addresses, they are 100% correct, because it works on XP without any debug.

    Code:
    void GetActualGraphicEngine()
    {
    	int actualGraphicEngine =  *(int*)Address::GRAPHIC_ENGINE_MODE_ADDR;
    	switch(actualGraphicEngine)
    	{
    		case 0:
    			DrawRectAddress = Address::DRAW_RECT_DX5_FUNC_ADDR;
    			break;
    
    		case 1:
    			DrawRectAddress = Address::DRAW_RECT_OGL_FUNC_ADDR;
    			break;
    
    		case 2:
    			DrawRectAddress = Address::DRAW_RECT_DX9_FUNC_ADDR;
    			break;
    	}
    }
    
    DWORD PrepareDrawRectAddress = Address::PREPARE_DRAW_RECT_FUNC_ADDR;
    
    void DrawRectangle(int nSurface, int X, int Y, int W, int H, int nRed, int nGreen, int nBlue)
    {
    	asm("mov %0, %%eax": /*no output opperand*/ : "r" (PrepareDrawRectAddress)); //We call the function that will prepare the registers for the DrawRect function
    	asm("call *%eax");
    	asm("mov %%eax, %%ecx": /*no output opperand*/ : /*no input operand*/ : "%ecx" /*we tell the compiler not to touch ecx anymore!*/);
    
    	asm("push %0": /*no output opperand*/ : "g" (nBlue)); //We push all the parameters
    	asm("push %0": /*no output opperand*/ : "g" (nGreen));
    	asm("push %0": /*no output opperand*/ : "g" (nRed));
    	asm("push %0": /*no output opperand*/ : "g" (H));
    	asm("push %0": /*no output opperand*/ : "g" (W));
    	asm("push %0": /*no output opperand*/ : "g" (Y));
    	asm("push %0": /*no output opperand*/ : "g" (X));
    	asm("push %0": /*no output opperand*/ : "g" (nSurface));
    
    	asm("mov %0, %%eax": /*no output opperand*/ : "r" (DrawRectAddress)); //We call the DrawRect function
    	asm("call *%eax");
    }
    
    void DrawRect(int nSurface, int X, int Y, int W, int H, int nRed, int nGreen, int nBlue) //Thanks to DarkStar and Farsa for the DrawRect Function
    {
    	GetActualGraphicEngine();
    	DrawRectangle(nSurface, X, Y, W, H, nRed, nGreen, nBlue);
    }
    
    void __stdcall DrawBlackBarPatched(int nSurface, int X, int Y, int W, int H, int nRed, int nGreen, int nBlue)
    {
    	asm("movl %SS:-130(%ebp),%ecx");
    
    	DWORD creaturePointer = *(DWORD*)Address::CURRENT_HP_BAR_DRAWING_CREATURE;
    	DWORD creatureID = *(DWORD*)(creaturePointer);
    
    	if(SendDlgItemMessage(mainWindow, IDC_MANABAR, BM_GETCHECK, 0, 0) == BST_CHECKED)
    	{
    		if(player.getID() == creatureID)
    			DrawRect(nSurface, X, Y-6, W, H, nRed, nGreen, nBlue);
    	}
    	DrawRect(nSurface, X, Y, W, H, nRed, nGreen, nBlue);
    }
    
    void __stdcall DrawColorBarPatched(int nSurface, int X, int Y, int W, int H, int nRed, int nGreen, int nBlue)
    {
    	asm("movl %SS:-0x19C(%ebp),%ecx");
    
    	DWORD creaturePointer = *(DWORD*)Address::CURRENT_HP_BAR_DRAWING_CREATURE;
    	DWORD creatureID = *(DWORD*)creaturePointer;
    
    	DrawRect(nSurface, X, Y, W, H, nRed, nGreen, nBlue);
    	if(SendDlgItemMessage(mainWindow, IDC_MANABAR, BM_GETCHECK, 0, 0) == BST_CHECKED)
    	{
    		if(player.getID() == creatureID)
    		{
    			DrawRect(nSurface, X, Y, W, H, 0, 0, 0);
    
    			DrawRect(nSurface, X, Y-6, W, H, nRed, nGreen, nBlue);
    
    			DWORD width = (25 * player.getMP()) / player.getMPMax();
    			DWORD percent = (100 * player.getMP()) / player.getMPMax();
    
    			if(percent >= 80)
    				DrawRect(nSurface, X, Y, width, H, 39, 64, 139);
    			else if(percent >= 60 && percent < 80)
    				DrawRect(nSurface, X, Y, width, H, 58, 95, 205);
    			else if(percent >= 40 && percent < 60)
    				DrawRect(nSurface, X, Y, width, H, 72, 118, 255);
    			else if(percent < 40)
    				DrawRect(nSurface, X, Y, width, H, 100, 149, 237);
    		}
    	}
    }
    I don't know well ASM to find what's going on.

    Code:
    +---------------------------------------------------------------
    Debug Assertion 8.54 NWin32Exception.cpp 50
    Wed Aug 29 16:26:45 2012
    Graphic Engine: DirectX9 (2)
    Operating System: Windows 7 Home Premium Edition 64 Bit in POL
    Processor: AMD A6-3400M 
    Video Card: ATI Radeon AMD (TM) 
    Last Packet Types: 131 180 180 160 160 210 210 210 162 141
    Last Packet: 010 249 069 038 016 050 000 000 100 231 003 232 003 007 009 037
    Player Position: [999,1000,7]
    Player Name: *** (***)
    Player Action: 051 055 046 053 057 046 050 051 053 046 049 055 049 058 055 049 055 050
    Player.cpp 361: exception occurred, reason:
    Player.cpp 465: exception occurred, reason:
    Control.cpp 1497: exception occurred (MaW: 2632518 MoW: 0 ), reason:
    Control.cpp 386: exception occurred (Force?1:0 = 0), reason:
    MainWindow.cpp 138: exception occurred (Surface = 1), reason:
    GUI.cpp 1479: exception occurred (Surface = 1), reason:
    MapWindow.cpp 869: exception occurred (Surface = 1), reason:
    MapWindow.cpp 803: exception occurred, reason:
    NWin32Exception.cpp 50: win32 exception occurred, reason:
    access violation (read attempt at 0013E0E4)
    ----------------------------------------------------------------
    Regards, Czepek!
    Last edited by Czepek; 03-15-2013 at 03:39 PM.

  2. #2

    RE: [C++] Win XP vs. Win7 - debugs

    The value returned from PrepareDrawRectAddress is the actual graphics engine. There's no need to determine it yourself.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •