Is it possible to link / build parts of the Unreal Engine source with your own project?

Hello :slight_smile:

I downloaded the latest Unreal Engine source from GitHub and have been able to build it with VS2013 CE.

In my former thread I’ve asked if it is possible to build a “Mutator” which can be used for the game “ARK: Survival Evolved” to create server-side plugins. But as we found out, it is not possible, since these mentioned “Mutators” are only supported by “Unreal Tournament”.

However, we managed to build a server-side plugin system using DLL-Injection and Function Hooking / Function Routing: [DISCONTINUED] Base Raiding Protection (v1.3.5) :: ARK: Survival Evolved General Discussions

This works great. Now we would like to extend our plugins but ran into some problems.

For instance we would like to hook a function called


AShooterPlayerController::ServerSendChatMessage(AShooterPlayerController *this, FString *ChatMessage, int SendMode)

The hook works in general. But so far we have been unable to resolve “FString *ChatMessage”. No matter what we try, we either only get the first letter of the sent text or just “garbage”, which looks like pointers / addresses, but we have not been able to access the memory behind them.

So my idea was, to link parts (header files) of the UE into our own projects, to enable accessing to these proper types and use them to declare our detour functions.

Unfortunately some first attempts didn’t work out. I have been able to build the whole UE, but when I add the desired include paths and header files (for instance “./Containers/UnrealString.h”) to our test project, I’m unable to build and run into quite some error messages, like



static FORCEINLINE void* Memmove( void* Dest, const void* Src, SIZE_T Count )
Error	3	error C2433: 'FMemory::int32' : '__forceinline' not permitted on data declarations	c:\projects\unrealengine\engine\source\runtime\core\public\hal\UnrealMemory.h

static FORCEINLINE void* Memset(void* Dest, uint8 Char, SIZE_T Count)
Error	7	error C2061: syntax error : identifier 'uint8'	c:\projects\unrealengine\engine\source\runtime\core\public\hal\UnrealMemory.h

template< class T >
DEPRECATED(4.8, "Please use Memset.")
static FORCEINLINE void MemSet( T& Src, uint8 ValueToSet )
Error	9	error C2988: unrecognizable template declaration/definition	c:\projects\unrealengine\engine\source\runtime\core\public\hal\UnrealMemory.h


etc.

So any advice on how to get this compiled? Did any of you guys already attempt this? Advice on compiler settings, etc?

Thank you! Any help is appreciated! :slight_smile:

Ok, thats nice. Problem solved. :smiley:

We found out, that you can create an UE4 Editor Plugin (derived from UE4/Engine/Plugins/Developer/BlankPlugin) and modify it so that it works as a normal DLL (having its entrypoint at DllMain). Then we can include our hooking / routing library and handle it from there on.

By the way:

Is there a better method to access FString characters without using an iterator? Or how can I convert a FString to a string?



string receivedMessage = "";

for (auto& msgChar : *chatMessage)
{
	receivedMessage += msgChar;
}
sprintf_s(message, "Received: %s", receivedMessage);


Thanks! :slight_smile:


string receivedMessage(TCHAR_TO_UTF8(**chatMessage));

Works.