- 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:
put this into MapleAPI.cpp:
Put this in your MainFunc() in dllmain.cpp:
add this function to ExampleHooks.h:
add this function inside the MapleHooks namespace in ExampleHooks.cpp:
and you'll also need to adjust the imports in that class too
and finally add this into a new file called CUIStatusBar.h:
and thats it. you could do all of this in dllmain but i like organization.
note that I am using this as a base but feel free to use your own:
You must be registered to see links
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 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: