From 859f00acdd9bbc1c9cf1d65867a7c7216b05b48e Mon Sep 17 00:00:00 2001 From: RektInator Date: Tue, 30 May 2017 18:38:54 +0200 Subject: [PATCH] [CardTitles] Code optimizations --- src/Components/Modules/CardTitles.cpp | 30 +++++++++++------------ src/Components/Modules/ServerCommands.cpp | 16 ++++++------ 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/Components/Modules/CardTitles.cpp b/src/Components/Modules/CardTitles.cpp index 36f02ad0..5351a555 100644 --- a/src/Components/Modules/CardTitles.cpp +++ b/src/Components/Modules/CardTitles.cpp @@ -49,14 +49,14 @@ namespace Components push esi; push eax; call GetPlayerCardClientInfo; - add esp, 0x08; + add esp, 8; pop esi; pop ebp; - mov[ebx + 0x4], eax; + mov[ebx + 4], eax; pop ebx; - push 0x62EB2C; + push 62EB2Ch; retn; } } @@ -65,23 +65,23 @@ namespace Components { __asm { - cmp byte ptr[edi + 0x01], 0xFF; // Check if skip prefix exists (edi + 0x00 = @) + cmp byte ptr[edi + 01h], FFh; // Check if skip prefix exists (edi + 0x00 = @) jne back; - add edi, 0x02; // Ignore the 0x40 and 0xFF prefix (Localize and Skip prefix) + add edi, 2; // Ignore the 0x40 and 0xFF prefix (Localize and Skip prefix) jmp jumpback; back: - add edi, 0x01; + add edi, 1; push edi; - mov eax, 0x4F1700; + mov eax, 4F1700h; call eax; - add esp, 0x04; + add esp, 4; mov edi, eax; jumpback: - push 0x63A2E3; + push 63A2E3h; retn; } } @@ -125,7 +125,7 @@ namespace Components mov eax, title; pop ecx; mov ecx, currentLookupRequest; - mov ecx, DWORD ptr[ecx + 0x04]; + mov ecx, DWORD ptr[ecx + 4]; retn; } } @@ -143,7 +143,7 @@ namespace Components mov eax, title; pop ecx; mov ecx, currentLookupRequest; - mov ecx, DWORD ptr[ecx + 0x04]; + mov ecx, DWORD ptr[ecx + 4]; retn; } } @@ -158,10 +158,10 @@ namespace Components // Continue with the normal lookup request because we did not use our custom result __asm { - mov eax, [esi + 0x50]; - cmp eax, 0x3; + mov eax, [esi + 50h]; + cmp eax, 3; - push 0x62DCC7; + push 62DCC7h; retn; } } @@ -216,6 +216,6 @@ namespace Components CardTitles::~CardTitles() { - + CustomTitles.clear(); } } \ No newline at end of file diff --git a/src/Components/Modules/ServerCommands.cpp b/src/Components/Modules/ServerCommands.cpp index 0361d660..44756c64 100644 --- a/src/Components/Modules/ServerCommands.cpp +++ b/src/Components/Modules/ServerCommands.cpp @@ -36,11 +36,11 @@ namespace Components test al, al; jnz jumpback; - push 0x5944AE; + push 5944AEh; retn; jumpback: - push 0x594536; + push 594536h; retn; } } @@ -50,15 +50,15 @@ namespace Components __asm { mov lastServerCommand, ecx; - cmp ecx, 0x79; + cmp ecx, 79h; jl above; - push 0x59449F; + push 59449Fh; retn; above: - push 0x593C28; + push 593C28h; retn; } } @@ -78,9 +78,11 @@ namespace Components { __asm { + pushad; call OnServerCommandFailPrint; + popad; - push 0x5944C0; + push 5944C0h; retn; } } @@ -98,6 +100,6 @@ namespace Components ServerCommands::~ServerCommands() { - + Commands.clear(); } }