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 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

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 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

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
[C++] Idiotic Tibia crashes with PrintText
Results 1 to 9 of 9

Thread: [C++] Idiotic Tibia crashes with PrintText

  1. #1
    Moderator
    Join Date
    Oct 2009
    Posts
    482

    [C++] Idiotic Tibia crashes with PrintText

    Hello,

    I have some GUI classes and they generally worked correct until I've started to play with icons.

    This code will cause crash
    [code=c++]void CIcon:raw(int x, int y)
    {
    Screen::PrintItem(1, x + m_x, y + m_y, m_size, m_itemId, m_itemCount, false);
    Screen::PrintText(1, x + m_x + (m_size / 2), y + m_y + m_size, 2, 255, 127, 1, "Text under icon", 1);
    }[/code]

    This won't
    [code=c++]void CIcon:raw(int x, int y)
    {
    Screen::PrintItem(1, x + m_x, y + m_y, m_size, m_itemId, m_itemCount, false);
    Screen::PrintText(1, 45, 70, 2, 255, 127, 1, "Text under icon", 1);
    }[/code]

    As you can see this is almost the same code.

    Variable values and it's addresses
    Code:
    x = 0 - adr: 0018EC1C - const adr
    m_x = 20 - adr: 02C7A11C
    m_size = 50 - adr: 02C7A134
    y = 0 - adr: 0018EC20 - const adr
    m_y = 20 - adr: 02C7A120
    My PrintText procedure
    Code:
    void PrintText(int nSurface, int nX, int nY, int nFont, int nRed, int nGreen, int nBlue, char* nText, int nAlign)
    {
    	__asm
    	{
    		PUSH nAlign
    		PUSH nBlue
    		PUSH nGreen
    		PUSH nRed
    		PUSH nFont
    		PUSH nY
    		PUSH nX
    		PUSH nSurface
    		MOV ECX, nText
    		CALL Addresses::Print::PrintTextFunc
    		ADD ESP, 32
    	}
    }
    It seems to me that doing any operations on variables inside icon's Draw procedure causes crash.

    This would also cause crash
    [code=c++]int uselessInt = 1;

    void CIcon:raw(int x, int y)
    {
    Screen::PrintItem(1, x + m_x, y + m_y, m_size, m_itemId, m_itemCount, false);
    uselessInt += x + m_size;
    }[/code]

    Few error files from Tibia:
    Code:
    +---------------------------------------------------------------
    Debug Assertion 9.44 NWin32Exception.cpp 55
    Mon Feb 06 19:00:09 2012
    Graphic Engine: DirectX5 (0)
    Operating System: Windows XP Professional in POL
    Processor: AMD Phenom II X6 110
    Video Card: NVIDIA GeForce GTX 570
    Player.cpp 361: exception occurred, reason:
    Player.cpp 465: exception occurred, reason:
    Control.cpp 1763: exception occurred (MessageType: 0 MaW: 3E51CF0 MoW: 0), reason:
    Control.cpp 1758: exception occurred, reason:
    Control.cpp 450: exception occurred (Force?1:0 = 0), reason:
    NWin32Exception.cpp 55: win32 exception occurred, reason:
    access violation (read attempt at 0000000C)
    ----------------------------------------------------------------
    +---------------------------------------------------------------
    Debug Assertion 9.44 NWin32Exception.cpp 55
    Mon Feb 06 19:03:15 2012
    Graphic Engine: DirectX5 (0)
    Operating System: Windows XP Professional in POL
    Processor: AMD Phenom II X6 110
    Video Card: NVIDIA GeForce GTX 570
    Player.cpp 361: exception occurred, reason:
    Player.cpp 465: exception occurred, reason:
    Control.cpp 1763: exception occurred (MessageType: 0 MaW: 3FF3AE0 MoW: 40660B0), reason:
    Control.cpp 1758: exception occurred, reason:
    Control.cpp 450: exception occurred (Force?1:0 = 0), reason:
    NWin32Exception.cpp 55: win32 exception occurred, reason:
    access violation (read attempt at 0000000C)
    ----------------------------------------------------------------
    +---------------------------------------------------------------
    Debug Assertion 9.44 NWin32Exception.cpp 55
    Mon Feb 06 19:33:24 2012
    Graphic Engine: DirectX5 (0)
    Operating System: Windows XP Professional in POL
    Processor: AMD Phenom II X6 110
    Video Card: NVIDIA GeForce GTX 570
    Player.cpp 361: exception occurred, reason:
    Player.cpp 465: exception occurred, reason:
    Control.cpp 1763: exception occurred (MessageType: 0 MaW: 3DD4F88 MoW: 3E48358), reason:
    Control.cpp 1758: exception occurred, reason:
    Control.cpp 450: exception occurred (Force?1:0 = 0), reason:
    NWin32Exception.cpp 55: win32 exception occurred, reason:
    access violation (read attempt at FFFFFFF9)
    ----------------------------------------------------------------
    Anyone knows what causes this crashes?

  2. #2
    Senior Member
    Join Date
    Jan 2008
    Location
    Cambridge, England
    Posts
    725

    RE: [C++] Idiotic Tibia crashes with PrintText

    Jesus christ dude upgrade your PC o.0

    Regarding the issue at hand, I can't understand this horrid language

  3. #3
    Super Moderator
    Join Date
    May 2007
    Posts
    1,191

    RE: [C++] Idiotic Tibia crashes with PrintText

    Quote Originally Posted by ManInTheCave
    Jesus christ dude upgrade your PC o.0

    Regarding the issue at hand, I can't understand this horrid language
    Are you saying a 1100T and 570 is bad? It's almost top of the line

  4. #4
    Super Moderator klusbert's Avatar
    Join Date
    Dec 2007
    Posts
    1,201

    RE: [C++] Idiotic Tibia crashes with PrintText

    ManInTheCave made me laugh! Yeah it's not the best cpu. but far away from bad. It can handle bf3 with no problem!

  5. #5
    Moderator
    Join Date
    Oct 2009
    Posts
    482

    RE: [C++] Idiotic Tibia crashes with PrintText

    Quote Originally Posted by klusbert
    ManInTheCave made me laugh! Yeah it's not the best cpu. but far away from bad. It can handle bf3 with no problem!
    The only game which had Low FPS was The Witcher 2 with all details on max + Ubersampling enabled - it was really poor performance, but without it I have really good fps.

    However I'd like to stick to the point of the topic.

  6. #6

    RE: [C++] Idiotic Tibia crashes with PrintText

    I think ManInTheCave is referring to the outdated OS and not the computer hardware.
    And I agree with him, because with that kind of hardware you gain nothing by using Windows XP. In fact you just loses functionality.

    On topic:
    I guess it could be some overwriting of important registers.
    Maybe your compiler is trying to optimize it and something gets wrong.
    Have you tried to debug your code with ollydbg to find any differences between the working and non working code?

  7. #7
    Moderator
    Join Date
    Oct 2009
    Posts
    482

    RE: [C++] Idiotic Tibia crashes with PrintText

    Quote Originally Posted by Stiju
    I think ManInTheCave is referring to the outdated OS and not the computer hardware.
    And I agree with him, because with that kind of hardware you gain nothing by using Windows XP. In fact you just loses functionality.
    Haha, now I see it. I have Windows 7 and that's strange
    Why it shows so, I don't know

    Quote Originally Posted by Stiju
    On topic:
    I guess it could be some overwriting of important registers.
    Maybe your compiler is trying to optimize it and something gets wrong.
    Have you tried to debug your code with ollydbg to find any differences between the working and non working code?
    I'll try that, when I'll find sth out I'll immediately give informations

  8. #8

    RE: [C++] Idiotic Tibia crashes with PrintText

    Compatibility mode. Also, in either 9.44 or 9.43 update thread, don't remember which, I posted information on using these functions.

  9. #9
    Senior Member
    Join Date
    Jan 2008
    Location
    Cambridge, England
    Posts
    725

    RE: [C++] Idiotic Tibia crashes with PrintText

    I can sort of understand xp when programming for tibia, was talking more about directx 5 lol

Posting Permissions

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