- Mar 28, 2016
- 530
- 583
- 157
You can use this code to set your Avatar on 3.0.19.3 win32 client.
I am using this to auto-reset my avatar when some Serveradmin deletes it.
Just pass the full image path to the path argument.
Your image has to have the correct size. Meaning no bigger than 300x300 and the filesize has to be small enough that you are allowed to upload it.
I am using this to auto-reset my avatar when some Serveradmin deletes it.
Just pass the full image path to the path argument.
Your image has to have the correct size. Meaning no bigger than 300x300 and the filesize has to be small enough that you are allowed to upload it.
Code:
void setAvatar(std::string path) {
char buff[128];
typedef void*(__thiscall *makeQstring)(const char* buff, const char *some);
HINSTANCE hGetProcIDDLL = GetModuleHandle(L"Qt5Core");
uintptr_t tsProc = (uintptr_t)GetModuleHandle(L"ts3client_win32.exe");
/* get pointer to the function in the dll*/
FARPROC lpfnGetProcessID = GetProcAddress(HMODULE(hGetProcIDDLL), "??0QString@@QAE@PBD@Z");
makeQstring makeString = (makeQstring) lpfnGetProcessID;
auto str = makeString(buff, path.c_str());
auto pt = *((uintptr_t*) ((*((uintptr_t*) (0x97DE24-0xF0000+ tsProc))) + 4)); //pt is array of 16 elements. One element is different than others.
uintptr_t foundAvManager = 0x0;
for (int it = 0; it < 16; it++) {
uintptr_t element = *((uintptr_t*)(pt + 0x4 * it));
int foundcount = 0;
for (int i = 0; i < 16; i++) {
uintptr_t element2 = *((uintptr_t*) (pt + 0x4 * i));
if (element2 == element)
foundcount++;
}
if (foundcount == 1) {
foundAvManager = element;
break;
}
}
if (!foundAvManager) return;
auto avManager = *((uintptr_t*) (foundAvManager + 0x10));//0x30 corresponds to the element 0x30/4 that is different than the others
typedef uintptr_t(__thiscall *setAvatar)(uintptr_t avatarManager, void* some, char some2);
setAvatar setAv = (setAvatar) (0x002EF2C0-0xF0000 + tsProc);
setAv(avManager, buff, 1);
}