Jump to content
Sign in to follow this  
V3ct0r

PKOdev.NET mod loader project template for Visual Studio 2019 Community

Recommended Posts

PKOdev.NET mod loader project template for Visual Studio 2019 Community

 

I am posting a template project for Visual Studio 2019 Community, which is designed to develop mods for PKOdev.NET mod loader using the C++ programming language.

 

 

The project includes

 

1) File structure (address.h, pointer.h, hook.h, structure.h, dllmain.cpp);

 

screenshot_03.png

 

The address.h file contains the addresses of imported functions and objects from the .exe file. This file also defines the namespaces for the corresponding versions of the .exe file, within which it is necessary to specify the addresses for each version of the executable file. All addresses should be in the address namespace.

namespace address
{
        // Game.exe 2 (1252912474)
        namespace GAME_13X_2
        {
            // void CHeadSay::Render(D3DXVECTOR3& pos)
            const unsigned int CHeadSay__Render = 0x00470770;
        }

        // Game.exe 4 (1585009030)
        namespace GAME_13X_4
        {
            // void CHeadSay::Render(D3DXVECTOR3& pos)
            const unsigned int CHeadSay__Render = 0x004707D0;
        }
}

 

The pointer.h file contains pointers to imported functions from the .exe file. All pointers should be in the pointer namespace.

namespace pointer
{
	// void CHeadSay::Render(D3DXVECTOR3& pos)
	typedef void(__thiscall* CHeadSay__Render__Ptr)(void*, D3DXVECTOR3&);
	CHeadSay__Render__Ptr CHeadSay__Render = (CHeadSay__Render__Ptr)(void*)(address::MOD_EXE_VERSION::CHeadSay__Render);
}

 

The hook.h file contains the definitions of the hook functions of the original functions from the .exe file. All hooks should be in the hook namespace.

namespace hook
{
	// void CHeadSay::Render(D3DXVECTOR3& pos)
	void __fastcall CHeadSay__Render(void* This, void* NotUsed, D3DXVECTOR3& Pos);
}

 

The structure.h file contains various data structures necessary for the mod to work.

// 3D vector structure
struct D3DXVECTOR3
{
	float x;
	float y;
	float z;
};

 

The dllmain.cpp file contains the entry point, the implementation of the loader interface functions, the implementation of the hook functions, and the mod code itself.

 

 

2) Mod loader interface (loader.h) and its implementation.

 

screenshot_04.png

 

 

3) Build configurations for all supported .exe files with appropriate preprocessor definitions.

 

screenshot_01.png screenshot_02.png

 

 

4) MS Detours library for hooking functions calls in .exe files.

DetourAttach(&(PVOID&)pkodev::pointer::CHeadSay__Render, pkodev::hook::CHeadSay__Render);

 

 

How to set up your own project

 

1) Rename the project files (pkodev.mod.dummy) to the name of your new mod;

2) Remove unnecessary build configurations;

3) For each build configuration, specify the name of the mod's output DLL file (Target Name);

4) For each build configuration, specify preprocessor definitions MOD_NAME, MOD_AUTHOR, and MOD_VERSION.

 

 

Download

 

PKOdev .NET mod loader project template for Visual Studio 2019 Community (C++).


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...