Jump to content
Sign in to follow this  
gunnapong

Name Corlor Neck

Recommended Posts

Hello, @gunnapong!

 

You can write a small DLL for this purpose if you know C++ programming language:

#include <Windows.h>
#include <detours.h>

// Address of ' void CHeadSay::Render( D3DXVECTOR3& pos ) ' method
const unsigned int headsay_render_address = 0x00470770;

// Character name color (0xFFRRGGBB)
const unsigned int color = 0xFF0000FF; // Blue color

// D3DXVECTOR3 structure
struct D3DXVECTOR3
{
    float x;
    float y;
    float z;
};

// Pointer to ' void CHeadSay::Render( D3DXVECTOR3& pos ) ' method
typedef void(__thiscall* CHeadSayRenderPtr)(void*, D3DXVECTOR3& Pos);
CHeadSayRenderPtr CHeadSayRender_Original = (CHeadSayRenderPtr)(void*)(headsay_render_address);

// Hook function for ' void CHeadSay::Render( D3DXVECTOR3& pos ) ' method
void __fastcall CHeadSayRender_Hooked(void* This, void* NotUsed, D3DXVECTOR3& Pos);

// Entry point
BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    // Set some hooks
    if (ul_reason_for_call == DLL_PROCESS_ATTACH)
    {
        DetourRestoreAfterWith();
        DetourTransactionBegin();
        DetourAttach(&(PVOID&)CHeadSayRender_Original, CHeadSayRender_Hooked);
        DetourUpdateThread(GetCurrentThread());
        DetourTransactionCommit();
    } 

    return TRUE;
}

// Hook function for ' void CHeadSay::Render( D3DXVECTOR3& pos ) ' method
void __fastcall CHeadSayRender_Hooked(void* This, void* NotUsed, D3DXVECTOR3& Pos)
{
    // Pointer to current character on the scene
    void* pCha = reinterpret_cast<void*> (
        *reinterpret_cast<unsigned int*>(
            reinterpret_cast<unsigned int>(This) + 0x28
        )
    );

    // Get character type (player, monster, npc and etc)
    const unsigned int type = *reinterpret_cast<unsigned int*>(
        reinterpret_cast<unsigned int>(pCha) + 0x0CD8
    );

    // Check that character is a player
    if ( type == 1 )
    {
        // Set character color
        *reinterpret_cast<unsigned int*>(
            reinterpret_cast<unsigned int>(This) + 0x38
        ) = color;
    }

    // Call original method
    CHeadSayRender_Original(This, Pos);
}

 

To configuire the DLL you need set 2 variables:

 

1) 'const unsigned int color' - the color of character names in format 'FFRRGGBB', for example:

const unsigned int color = 0xFFFF0000; // Red color
	or
const unsigned int color = 0xFF00FF00; // Green color
	or
const unsigned int color = 0xFF0000FF; // Blue color

2) 'const unsigned int headsay_render_address' - this is address of 'void CHeadSay::Render( D3DXVECTOR3& pos )' method in your Game.exe. You need find it manually using program named OllyDbg 1.10. Open your Game.exe in OllyDbg and search for a string 'Lv%d %s'. You will see something like this:

5.png

 

Then scroll up until you see INT instructions:

INT3
INT3
INT3
INT3
INT3

 

6.png

 

Then look for 'PUSH -1' instruction, the address opposite to it will be the address of the 'void CHeadSay::Render( D3DXVECTOR3& pos )' method. In my case it is '0x00470770', so I write in source code of the DLL:

const unsigned int headsay_render_address = 0x00470770;

 

Now you need compile DLL. You will need Visual Studio 2019 Community edition, you can download it for free from Microsoft site. Just open project from attached .zip and build it.

Finally, you need to inject the DLL to your Game.exe proccess. You can find information about it in Google. Probably, you will find a method which uses program 'СFF Explorer' to make Game.exe load DLL on startup.

 

The result:

4.png

 

Download the project (240 KB)


Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

That long dll, what should i do with it. If i open it with visual studio, what should i do after i open it as a project? i simply dont know how to operate that part.

 

Share this post


Link to post
Share on other sites
On 3/5/2022 at 8:55 AM, kyleflow said:

That long dll, what should i do with it. If i open it with visual studio, what should i do after i open it as a project? i simply dont know how to operate that part.

1) Open pkodev.colorname.vcxproj file with Visual Studio 2019 Community;

2) Do necessary changes in dllmain.cpp file;

3) Compile the project (F5 key) or green arrow ( compile.png );

4) You will get pkodev.colorname.dll in bin folder.

  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...