Jump to content

core crash after game


Recommended Posts

40k

Hello guys, i didn't find solv for my problem.

i add system hide costume and i enter game char didn't load and few second later core crash.

gdb:
 

Quote
Spoiler

#1  0x081b1ef6 in std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >::find (
    __x=..., this=0x54) at /usr/local/lib/gcc8/include/c++/bits/stl_map.h:1168
No locals.
#2  quest::PC::GetFlag (this=0x0, name=...) at questpc.cpp:94
        it = <optimized out>
#3  0x0808e1c8 in CHARACTER::GetQuestFlag (this=<optimized out>, flag=...) at char.cpp:6703
        q = <optimized out>
        pPC = <optimized out>
#4  0x08093926 in CHARACTER::GetHideCostume (this=0x42d0f340, wear=0) at /usr/local/lib/gcc8/include/c++/bits/basic_string.h:252
        costume_hide = "hide_costume_w.hide_costume_0\000\375J\000\000\000\000\000e\375J\374\364\350(\210\244\277\277\"\004\336(\000\000\000\000\001\000\000\000\304\244\277\277\354+\233\b\036", '\000' <repeats 11 times>, "\314\276=+\273\344\247\224\304\244\277\277\370\250\277\277\000\000\000\000\304\244\277\277\000\240\314(\370\250\277\277(,\273(\000e\375J\354+\233\b\035\000\000\000\273\344\247\224\314\244\277\277\026,\273(\314\244\277\277>9\t\b\000e\375J\304\244\277\277\371\244\277\277\000\000\000\000\377\000\377\377\000e\375J\035\000\000\000\035\000\000\000\000\000\000\000\374\364\350(\374\244\277\277hide_cos"...
#5  0x080939c0 in CHARACTER::SetHideCostumeUpdate (this=0x42d0f340) at char.cpp:8880
        body_costume = 0x0
        acce_costume = 0x0
        hair_costume = 0x0
        weapon_costume = 0x0
#6  0x08093f57 in CHARACTER::EncodeInsertPacket (this=0x42d0f340, entity=0x4afedc00) at char.cpp:1070
        addPacket = {header = 111 'o', dwVID = 12453, name = '\000' <repeats 24 times>, awPart = {0, 0, 0, 0, 0}, bEmpire = 0 '\000', dwGuildID = 0, dwLevel = 0,
          sAlignment = 0, bPKMode = 0 '\000', dwMountVnum = 0, dwArrow = 0}
        ch = <optimized out>
        d = 0x2b216300
        ch = 0x4afedc00
        pack = {header = 1 '\001', dwVID = 12453, angle = 45, x = 591800, y = 100400, z = 0, bType = 1 '\001', wRaceNum = 20367, bMovingSpeed = 100 'd',
          bAttackSpeed = 100 'd', bStateFlag = 0 '\000', dwAffectFlag = {0, 0}}
        iDur = 0
#7  0x081125e7 in CEntity::ViewInsert (this=0x4afedc00, entity=<optimized out>, recursive=true) at entity_view.cpp:63
        it = <optimized out>
#8  0x08112806 in CFuncViewInsert::operator() (ent=0x42d0f340, this=<synthetic pointer>) at entity_view.cpp:107
No locals.
#9  FCollectEntity::ForEach<CFuncViewInsert> (f=<synthetic pointer>..., this=0xbfbfa9f0) at sectree.h:73
        entity = 0x42d0f340
        it = {_M_current = 0x4aae140c}
        it = <optimized out>
        entity = <optimized out>
#10 SECTREE::ForEachAround<CFuncViewInsert> (func=<synthetic pointer>..., this=<optimized out>) at sectree.h:120
--Type <RET> for more, q to quit, c to continue without paging--
        collector = {result = {<std::_Vector_base<CEntity*, std::allocator<CEntity*> >> = {
              _M_impl = {<std::allocator<CEntity*>> = {<__gnu_cxx::new_allocator<CEntity*>> = {<No data fields>}, <No data fields>}, _M_start = 0x4aae1400,
                _M_finish = 0x4aae1508, _M_end_of_storage = 0x4aae1600}}, <No data fields>}}
        it = <optimized out>
        collector = <optimized out>
        it = <optimized out>
        sectree = <optimized out>
#11 CEntity::UpdateSectree (this=<optimized out>) at entity_view.cpp:138
        __FUNCTION__ = "UpdateSectree"
        f = <optimized out>
        it = <optimized out>
        this_it = <optimized out>
#12 0x08088ac2 in CHARACTER::Show (this=0x4afedc00, lMapIndex=62, x=588952, y=99049, z=0, bShowSpawnMotion=false) at char.cpp:1713
        sectree = 0x3feb8680
        bChangeTree = <optimized out>
#13 0x081377c1 in CInputLogin::Entergame (this=<optimized out>, d=<optimized out>, data=<optimized out>) at entity.h:54
        ch = 0x4afedc00
        pos = {x = 588952, y = 99049, z = 0}
        __FUNCTION__ = "Entergame"
        p = {bHeader = 0 '\000', time = -1800936261}
        p2 = {header = 0 '\000', channel = 0 '\000'}
#14 0x08138c45 in CInputLogin::Analyze (this=0x2b21636c, d=0x2b216300, bHeader=10 '\n', c_pData=0x4afdc4c0 "\nmetin2client.exe") at input_login.cpp:1109
        iExtraLen = 0
        __FUNCTION__ = "Analyze"
#15 0x0812d6a5 in CInputProcessor::Process (iBytes=1, r_iBytesProceed=@0xbfbfabb8: 0, c_pvOrig=0x4afdc4c0, lpDesc=0x2b216300, this=0x2b21636c) at input.cpp:99
        iExtraPacketSize = <optimized out>
        bHeader = 10 '\n'
        c_pszName = 0x4aff4d5c "EnterGame"
        c_pData = 0x4afdc4c0 "\nmetin2client.exe"
        bLastHeader = 0 '\000'
        iLastPacketLen = 0
        iPacketLen = 1
        c_pData = <optimized out>
        bLastHeader = <optimized out>
        iLastPacketLen = <optimized out>
        iPacketLen = <optimized out>
        __FUNCTION__ = "Process"
        bHeader = <optimized out>
        c_pszName = <optimized out>
        iExtraPacketSize = <optimized out>
#16 CInputProcessor::Process (this=0x2b21636c, lpDesc=0x2b216300, c_pvOrig=0x4afdc4c0, iBytes=1, r_iBytesProceed=@0xbfbfabb8: 0) at input.cpp:59
        c_pData = 0x4afdc4c0 "\nmetin2client.exe"
        iPacketLen = <optimized out>
--Type <RET> for more, q to quit, c to continue without paging--
        __FUNCTION__ = "Process"
        bHeader = <optimized out>
        c_pszName = <optimized out>
        iExtraPacketSize = <optimized out>
#17 0x08103a4e in DESC::ProcessInput (this=0x2b216300) at desc.cpp:304
        iBytesProceed = 0
        bytes_read = 1
        __FUNCTION__ = "ProcessInput"
#18 0x08221135 in io_loop (fdw=0x29363d00) at main.cpp:1013
        iRet = <optimized out>
        d = 0x2b216300
        num_events = 3
        event_idx = 2
        __FUNCTION__ = "io_loop"
#19 0x08221381 in idle () at main.cpp:896
        now = {tv_sec = 1591811553, tv_usec = 479278}
        passed_pulses = <optimized out>
        t = 60519
        pta = {tv_sec = 1591811553, tv_usec = 39119}
        process_time_count = 11
        now = <optimized out>
        passed_pulses = <optimized out>
        t = <optimized out>
#20 idle () at main.cpp:865
        now = <optimized out>
        passed_pulses = <optimized out>
        t = <optimized out>
        pta = {tv_sec = 1591811553, tv_usec = 39119}
        process_time_count = 11
#21 0x0806efa5 in main (argc=<optimized out>, argv=<optimized out>) at main.cpp:540
        sectree_manager = {<singleton<SECTREE_MANAGER>> = {_vptr.singleton = 0x84f8cec <vtable for SECTREE_MANAGER+8>, static ms_singleton = 0xbfbfb114},
          static current_sectree_version = 768, m_map_pkSectree = {_M_t = {
              _M_impl = {<std::allocator<std::_Rb_tree_node<std::pair<unsigned int const, SECTREE_MAP*> > >> = {<__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<unsigned int const, SECTREE_MAP*> > >> = {<No data fields>}, <No data fields>}, <std::_Rb_tree_key_compare<std::less<unsigned int> >> = {
                  _M_key_compare = {<std::binary_function<unsigned int, unsigned int, bool>> = {<No data fields>}, <No data fields>}}, <std::_Rb_tree_header> = {
                  _M_header = {_M_color = std::_S_red, _M_parent = 0x32a63f80, _M_left = 0x2b49e660, _M_right = 0x4a968da0}, _M_node_count = 13}, <No data fields>}}},
          m_map_pkArea = {_M_t = {
 

 

 

  • Metin2 Dev 1
  • Love 1
Link to comment
Share on other sites

as you can see in your gdb log your core crashes at  quest::PC::GetFlag (this=0x0, name=...) at questpc.cpp:94

Without knowing what exactly happens at line 94 it's not possible to determine what exactly crashes the core.

 

I have a theory though. Since this=0x0 indicates it I think your call to GetFlag is invalid and thus creating this error.

You'd check char.cpp CHARACTER::GetQuestFlag

I think return pPC->GetFlag(flag); causes this issue because pPC seems to be a nullpointer. You'd first check if pPC even exists via if(pPc) before you call GetFlag on it. Try it and tell us if this works. Otherwise we cannot gamble what exact line is triggering your problem.

 

Oh and don't install shitty systems. The above "solution" may only mask your problem.

We are the tortured.
We're not your friends.
As long as we're not visible.
We are unfixable.

Link to comment
Share on other sites

For everyone who used this "well-coded" system and paid for it: Here's the proper fix with explanation.

 

in char.cpp look for:

CHARACTER::EncodeInsertPacket

 

The tutorial told you to add the following lines which is kinda uhm... problematic, to say the least:

#ifdef ENABLE_HIDE_COSTUME_SYSTEM
        SetHideCostumeUpdate();
#endif

 

Now if you may have a look at the conditions needed for this to trigger... (just look a few lines above and you'll see it and hopefully start to get what I'm trying to say):

if (IsPC() == true || m_bCharType == CHAR_TYPE_NPC)

 

So, even if we're dealing with an NPC... This function will trigger SetHideCostumeUpdate(). And guess what this call does? You guessed right: It calls for CHARACTER::GetQuestFlag

And now here we have it: Since we're dealing with an NPC this function is unable to fetch the current quest player (ofcourse it can't because.. It's a npc). What does it to instead? Yep, it returns a nullpointer, thus rendering the call to quest::PC::GetFlag destructive.

 

How to fix it? You can just make sure that this function does not get triggered when dealing with an npc:

#ifdef ENABLE_HIDE_COSTUME_SYSTEM

        if(m_bCharType != CHAR_TYPE_NPC)

        {
              SetHideCostumeUpdate();

        }
#endif

 

That should fix the crash.

You can also add the check like mentioned above but as I said, the root cause of this is a misuse of GetQuestFlag which is called by SetHideCostumeUpdate(). You can also make the check inside the SethideCostumeUpdate() to make sure you're not dealing with an NPC there. It doesn't matter where exactly you're doing it as long as you're doing it before you try to fetch the quest character and end up killing your server.

Edited by Vanilla
  • Love 6

We are the tortured.
We're not your friends.
As long as we're not visible.
We are unfixable.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 24

      Experimental Renderer

    2. 11

      Multi Language System

    3. 0

      [FREE DESIGN] Interface + Logo + Discord Banner and Avatar

    4. 4

      Feeding game source to LLM

    5. 0

      Quest 6/7 Problem

    6. 5

      Effect weapons

    7. 0

      [C++] Fix Core Downer Using Negative Number in GM Codes

    8. 3

      Crystal Metinstone

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.