Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Set Any Chat Bar Limit (default is 64)

Skilled Illusionist
Joined
Feb 18, 2010
Messages
320
Reaction score
112
got sidetracked working on something and stumbled over this so thought i would share because i keep seeing it listed as a "feature"

note that I am using this as a base but feel free to use your own:

all the addresses used are for v95 so looking them up to xref with your version will be easier.

first you'll need to find the address for the function CUIStatusBar::ChatLogAdd
and the address for CUIStatusBar::m_aChatLog, this can be seen inside the while loop in the above function.
aob might look something like 74 ?? 83 78 FC 40 76
take note of the addresses of the while loop because we want to skip (jmp) that whole section.
in v95 it starts with a mov, then cmp, then a conditional jmp (this is the one we want).

put this into MapleAPI.h:
Code:
HOOKTYPEDEF_H(void, __fastcall, CUIStatusBar__ChatLogAdd, void* pThis, void* edx, const char* sChat, int lType, int nChannelID, int bWhisperIcon, ZRef<void*> pItem);

put this into MapleAPI.cpp:
Code:
HOOKTYPEDEF_C(CUIStatusBar__ChatLogAdd);

Put this in your MainFunc() in dllmain.cpp:
Code:
INITMAPLEHOOK(
        _CUIStatusBar__ChatLogAdd,
        _CUIStatusBar__ChatLogAdd_t,
        MapleHooks::CUIStatusBar__ChatLogAdd,
        0x0087AEC0 // replace with address to CUIStatusBar::ChatLogAdd
    );

    // CUIStatusBar::ChatLogAdd -> remove old entries from chat
    BYTE val = x86JMP;
    MemEdit::WriteValue<BYTE>(0x0087B2E7, &val); // replace with address of the first conditional jmp in the while loop

add this function to ExampleHooks.h:
Code:
void __fastcall CUIStatusBar__ChatLogAdd(void* pThis, void* edx,
        const char* sChat, int lType, int nChannelID,
        int bWhisperIcon, ZRef<void*> pItem);

add this function inside the MapleHooks namespace in ExampleHooks.cpp:
Code:
void __fastcall CUIStatusBar__ChatLogAdd(void* pThis, void* edx,
        const char* sChat, int lType, int nChannelID,
        int bWhisperIcon, ZRef<void*> pItem)
    {
        ZArray<ZRef<CUIStatusBar::CChatLog>>* m_aChatLog = reinterpret_cast<ZArray<ZRef<CUIStatusBar::CChatLog>>*>(0x00C6F188); // replace with address to CUIStatusBar::m_aChatLog

        while (m_aChatLog->GetCount() > 1000) { // you can set your custom limit here
            auto idx = m_aChatLog->FindIndex(0);
            m_aChatLog->RemoveAt(idx);
        }

        _CUIStatusBar__ChatLogAdd(pThis, NULL, sChat, lType, nChannelID, bWhisperIcon, pItem);
    }
and you'll also need to adjust the imports in that class too

and finally add this into a new file called CUIStatusBar.h:
Code:
#pragma once
#include <MapleTypes.h>

struct CUIStatusBar
{
    struct CChatLog : ZRefCounted 
    {
// it doesnt really matter what is in here, ZAlloc knows the original size and will deallocate appropriately
    };
};

and thats it. you could do all of this in dllmain but i like organization.
 
Last edited:
Initiate Mage
Joined
May 30, 2021
Messages
4
Reaction score
1
Code:
[COLOR=#666666]WriteValue<BYTE>(0x[/COLOR]0087B2E9+3, 1000);

Could we just use this instead?
 
Skilled Illusionist
Joined
Feb 18, 2010
Messages
320
Reaction score
112
Code:
[COLOR=#666666]WriteValue<BYTE>(0x[/COLOR]0087B2E9+3, 1000);

Could we just use this instead?

No. While that is a good thought, it will not work because the value that the loop checks against is a byte, which means the highest value that will fit is 255. If you want the limit to be 255 or less, then by all means, simply perform the single-byte edit that you described.

If you are determined to do this with the fewest keystrokes possible, you will need to write an assembly routine containing your new comparison instructions, jump to it from 0x0087B2E9, then jump back to 0x0087B2ED.

What I described is called a code-cave (maybe you are familiar), and here is a good link if you would like to learn more about it: .

However, while code-caves can be quick and useful in some cases, they only (realistically) take you so far, and learning to properly use detours in an organized fashion will result in a much cleaner codebase that is easier to maintain, use, and modify.
 
Newbie Spellweaver
Joined
Aug 29, 2018
Messages
6
Reaction score
1
hi
im trying to do this with your template but while building i get some errors.
<commonType.h> cant be found
assert_size(sizeof(CUIStatusBar::CChatLog), 0x34) trows me an error for assert_size
Severity Code Description Project File Line Suppression StateError (active) E1574 static assertion failed with "Static size assert failed."
 
Skilled Illusionist
Joined
Feb 18, 2010
Messages
320
Reaction score
112
hi
im trying to do this with your template but while building i get some errors.
<commonType.h> cant be found
assert_size(sizeof(CUIStatusBar::CChatLog), 0x34) trows me an error for assert_size
Severity Code Description Project File Line Suppression StateError (active) E1574 static assertion failed with "Static size assert failed."

Thanks! Those are both errors on my part, I updated the original post and it should work now. The size assert isn't necessary (or you can set it to 0x12 if you want, I think that's the size of ZRefCounted iirc). I renamed MapleTypes to CommonTypes in my private fork but I never made that change in the public repo, so that is why that file can't be found.
 
Newbie Spellweaver
Joined
Aug 29, 2018
Messages
6
Reaction score
1
im not too good at this and im getting a few new errors now.
in MapleAPI.h i get a ZRef error. syntax error: identifier ZRef. maybe im not linking properly to mapleAPI.cpp?
and i think because of that i get an error in ExampleHooks.cpp
_CUIStatusBar__ChatLogAdd(pThis, NULL, sChat, lType, nChannelID, bWhisperIcon, pItem); too many arguments for call. it points to the pItem
 
Skilled Illusionist
Joined
Feb 18, 2010
Messages
320
Reaction score
112
im not too good at this and im getting a few new errors now.
in MapleAPI.h i get a ZRef error. syntax error: identifier ZRef. maybe im not linking properly to mapleAPI.cpp?
and i think because of that i get an error in ExampleHooks.cpp
_CUIStatusBar__ChatLogAdd(pThis, NULL, sChat, lType, nChannelID, bWhisperIcon, pItem); too many arguments for call. it points to the pItem

Include MapleTypes.h in MapleAPI.h. The MapleTypes header file has all the common maple types linked in it (such as ZRef).
 
Newbie Spellweaver
Joined
Aug 29, 2018
Messages
6
Reaction score
1
Thank you! i got it to build. sadly it does crash my game after char select. im using v83 with these adresses:
CUIStatusBar::ChatLogAdd: 0x008DB070
whileloop: 0x008DB385
CUIStatusBar::m_aChatLog: 0x00BF1100
 
Back
Top