Hi for all, first I like to say.. that I'm decompiling Inventory class from my main.exe and I found this small code on my research.. (is only assembler inline), but works, this is to change: "Durability: %d" (on my: Text.bmd from 1.03K JPN Client is line: 71 number) by: "Life: %d" text (70 number line), this is for: Pets job, maybe to some person can be usefull, enjoy it.
Pet.h file:
Pet.cpp file:Code:#ifndef _PET_H #define _PET_H #define ItemId(x, y) ((x * 512) + y) void DemonShowLife(); void ItemSpecialToolTipHook(); #endif
Screenshots:Code://Buffers: DWORD AddLifeText_Offset = 0x00595F77; DWORD ReturnLifeText_Offset = 0x00595F94; //Inline Function (Re-writed): void __declspec(naked) DemonShowLife() { _asm { CMP AX, ItemId(13,64) JNZ DarkWolf_Label JE AddLifeText // ---- DarkWolf_Label: // ---- CMP AX, ItemId(13,97) JNZ Unicorn_Label JE AddLifeText // ---- Unicorn_Label: // ---- CMP AX, ItemId(13,106) JNZ Rudolf_Label JE AddLifeText // ---- Rudolf_Label: // ---- CMP AX, ItemId(13,67) JNZ Panda_Label JE AddLifeText // ---- Panda_Label: // ---- CMP AX, ItemId(13,80) JNZ Dragon_Label JE AddLifeText // ---- Dragon_Label: // ---- CMP AX, ItemId(13,110) JNZ Skeleton_Label JE AddLifeText // ---- Skeleton_Label: // ---- CMP AX, ItemId(13,123) JNZ ReturnTextLife JE AddLifeText // ---- AddLifeText: // ---- JMP AddLifeText_Offset // ---- ReturnTextLife: // ---- JMP ReturnLifeText_Offset } } //Hook Function: void ItemSpecialToolTipHook() { Utils.SetRange((LPVOID)0x00595F8E, 6, ASM::NOP); Utils.SetJmp((LPVOID)0x00595F8E, DemonShowLife); }
PS: BUGS = 0 (Here I don't modify nothing from original main.exe intermal memory, I mean: EAX, ECX, EDX registers and etc.)
Credits:
Webzen
Nemesis (Me) -> mauro07
- - - Updated - - -
Another way to make this is combining: ASM + C++ (Boolean Function).. but on this way is necesary change: AX to: EAX on: _asm block..
this works too.. (but on this way is possible have: bugs):
- - - Updated - - -Code:BOOL bShowLifeText; DWORD dwShowLifeText; DWORD dwShowLifeText_Buffer = 0x00595F94; DWORD ShowLifeText_Jump = 0x0059614D; void __declspec(naked) DemonShowLife() { bShowLifeText = FALSE; //This is important, because you don't like that another items like: Helm or Armor change: Durability Text by: Life :D // ---- _asm { MOV dwShowLifeText, EAX //Here is necesary change: AX by: EAX instruction. } // ---- if (dwShowLifeText == ItemId(13, 64)) { bShowLifeText = TRUE; } else if (dwShowLifeText == ItemId(13, 97)) { bShowLifeText = TRUE; } else if (dwShowLifeText == ItemId(13, 67)) { bShowLifeText = TRUE; } else if (dwShowLifeText == ItemId(13, 106)) { bShowLifeText = TRUE; } else if (dwShowLifeText == ItemId(13, 80)) { bShowLifeText = TRUE; } else if (dwShowLifeText == ItemId(13, 110)) { bShowLifeText = TRUE; } else if (dwShowLifeText == ItemId(13, 123)) { bShowLifeText = TRUE; } // ---- if (bShowLifeText == TRUE) { _asm { XOR ECX, ECX MOV CL, BYTE PTR DS:[ESI+0x16] PUSH ECX PUSH 0x46 JMP ShowLifeText_Jump } //Here I re-write the complete Assembler part of code to: "Set" -> Text.bmd number line: 70 -> (In hexadecimal: 0x46) } else { _asm { JMP dwShowLifeText_Buffer //Here I make directly JUMP to: Offset stored on: DWORD Buffer, because is not necesary: MOV instruction first. } } } HOOK Function is the same: Utils.SetRange((LPVOID)0x00595F8E, 6, ASM::NOP); Utils.SetJmp((LPVOID)0x00595F8E, DemonShowLife);
If some person is interested on learn something more from: ASM with C++, on this page you can understand a very usefull concept to:
"Jumping from ASM block to C or C++ Label (Out) and from: C or C++ Label to: ASM Label"




Reply With Quote


