mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Add 'engine_cl' project to SDK and fix compiler errors
The 'engine_cl' library defines 'CLIENT_DLL', which prunes server specific code. This is used for the 'client.dll' project. Also fixed a compile error in 'CClient::VActivatePlayer', as it used a server only cvar. Ideally, this entire file gets ifdef'd out for engine_cl, currently it doesn't matter as nothing gets compiled in.
This commit is contained in:
parent
6ccf3baa5a
commit
ad6466fa6c
@ -97,15 +97,8 @@ target_link_libraries( ${PROJECT_NAME} PRIVATE
|
||||
"vgui"
|
||||
"rui"
|
||||
|
||||
"engine"
|
||||
"d3d11.lib"
|
||||
)
|
||||
|
||||
else()
|
||||
target_link_libraries( ${PROJECT_NAME} PRIVATE
|
||||
"materialsystem_nodx" # Needs the No-DirectX version for patching.
|
||||
"engine_ds"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Determine the compiler definitions and link libraries per project.
|
||||
@ -113,6 +106,7 @@ if( ${PROJECT_NAME} STREQUAL "gamesdk" )
|
||||
end_sources()
|
||||
|
||||
target_link_libraries( ${PROJECT_NAME} PRIVATE
|
||||
"engine"
|
||||
"server_static"
|
||||
"client_static"
|
||||
)
|
||||
@ -124,6 +118,8 @@ elseif( ${PROJECT_NAME} STREQUAL "dedicated" )
|
||||
end_sources()
|
||||
|
||||
target_link_libraries( ${PROJECT_NAME} PRIVATE
|
||||
"materialsystem_nodx" # Needs the No-DirectX version for patching.
|
||||
"engine_ds"
|
||||
"server_static"
|
||||
)
|
||||
target_compile_definitions( ${PROJECT_NAME} PRIVATE
|
||||
@ -136,6 +132,7 @@ elseif( ${PROJECT_NAME} STREQUAL "client" )
|
||||
end_sources( "${BUILD_OUTPUT_DIR}/bin/x64_retail/" )
|
||||
|
||||
target_link_libraries( ${PROJECT_NAME} PRIVATE
|
||||
"engine_cl"
|
||||
"client_static"
|
||||
)
|
||||
target_compile_definitions( ${PROJECT_NAME} PRIVATE
|
||||
|
@ -20,14 +20,12 @@ add_sources( SOURCE_GROUP "Collision"
|
||||
"traceinit.h"
|
||||
)
|
||||
|
||||
if( ${PROJECT_NAME} STREQUAL "engine" )
|
||||
if( NOT ${PROJECT_NAME} STREQUAL "engine_ds" )
|
||||
add_sources( SOURCE_GROUP "Debug"
|
||||
"debugoverlay.cpp"
|
||||
"debugoverlay.h"
|
||||
)
|
||||
endif()
|
||||
|
||||
if( ${PROJECT_NAME} STREQUAL "engine" )
|
||||
add_sources( SOURCE_GROUP "Render"
|
||||
"gl_matsysiface.h"
|
||||
"gl_model_private.h"
|
||||
@ -89,7 +87,7 @@ add_sources( SOURCE_GROUP "System"
|
||||
"sdk_dll.h"
|
||||
)
|
||||
|
||||
if( ${PROJECT_NAME} STREQUAL "engine" )
|
||||
if( NOT ${PROJECT_NAME} STREQUAL "engine_ds" )
|
||||
add_sources( SOURCE_GROUP "System"
|
||||
"sys_getmodes.cpp"
|
||||
"sys_getmodes.h"
|
||||
@ -98,6 +96,7 @@ add_sources( SOURCE_GROUP "System"
|
||||
)
|
||||
endif()
|
||||
|
||||
if( NOT ${PROJECT_NAME} STREQUAL "engine_cl" )
|
||||
add_sources( SOURCE_GROUP "Server"
|
||||
"server/persistence.cpp"
|
||||
"server/persistence.h"
|
||||
@ -112,6 +111,7 @@ add_sources( SOURCE_GROUP "Server"
|
||||
"server/datablock_sender.cpp"
|
||||
"server/datablock_sender.h"
|
||||
)
|
||||
endif()
|
||||
|
||||
add_sources( SOURCE_GROUP "Client"
|
||||
"client/cdll_engine_int.cpp"
|
||||
@ -129,7 +129,7 @@ add_sources( SOURCE_GROUP "Shared"
|
||||
"shared/shared_rcon.h"
|
||||
)
|
||||
|
||||
if( ${PROJECT_NAME} STREQUAL "engine" )
|
||||
if( NOT ${PROJECT_NAME} STREQUAL "engine_ds" )
|
||||
add_sources( SOURCE_GROUP "Client" # Client only.
|
||||
"client/clientstate.cpp"
|
||||
"client/clientstate.h"
|
||||
@ -144,9 +144,7 @@ add_sources( SOURCE_GROUP "Client" # Client only.
|
||||
"client/datablock_receiver.cpp"
|
||||
"client/datablock_receiver.h"
|
||||
)
|
||||
endif()
|
||||
|
||||
if( ${PROJECT_NAME} STREQUAL "engine" )
|
||||
add_sources( SOURCE_GROUP "GameUI"
|
||||
"${ENGINE_SOURCE_DIR}/gameui/IBrowser.cpp"
|
||||
"${ENGINE_SOURCE_DIR}/gameui/IBrowser.h"
|
||||
@ -218,7 +216,7 @@ add_sources( SOURCE_GROUP "Public"
|
||||
"${ENGINE_SOURCE_DIR}/public/gamebspfile.h"
|
||||
)
|
||||
|
||||
if( ${PROJECT_NAME} STREQUAL "engine" )
|
||||
if( NOT ${PROJECT_NAME} STREQUAL "engine_ds" )
|
||||
add_sources( SOURCE_GROUP "Public"
|
||||
"${ENGINE_SOURCE_DIR}/public/client_class.h"
|
||||
"${ENGINE_SOURCE_DIR}/public/ivrenderview.h"
|
||||
@ -232,8 +230,14 @@ if( ${PROJECT_NAME} STREQUAL "engine_ds" )
|
||||
target_compile_definitions( ${PROJECT_NAME} PRIVATE
|
||||
"DEDICATED"
|
||||
)
|
||||
elseif( ${PROJECT_NAME} STREQUAL "engine_cl" )
|
||||
target_compile_definitions( ${PROJECT_NAME} PRIVATE
|
||||
"CLIENT_DLL"
|
||||
)
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
add_engine_project( "engine" )
|
||||
add_engine_project( "engine_ds" )
|
||||
add_engine_project( "engine_cl" )
|
||||
|
@ -103,6 +103,7 @@ void CClient::VActivatePlayer(CClient* pClient)
|
||||
pClient->SetPersistenceState(PERSISTENCE::PERSISTENCE_READY);
|
||||
v_CClient_ActivatePlayer(pClient);
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
const CNetChan* pNetChan = pClient->GetNetChan();
|
||||
|
||||
if (pNetChan && sv_showconnecting->GetBool())
|
||||
@ -110,6 +111,7 @@ void CClient::VActivatePlayer(CClient* pClient)
|
||||
DevMsg(eDLL_T::SERVER, "Activated player #%d; channel %s(%s) ('%llu')\n",
|
||||
pClient->GetUserID(), pNetChan->GetName(), pNetChan->GetAddress(), pClient->GetNucleusID());
|
||||
}
|
||||
#endif // !CLIENT_DLL
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
@ -216,3 +218,26 @@ bool CClient::VSendNetMsgEx(CClient* pClient, CNetMessage* pMsg, char bLocal, bo
|
||||
{
|
||||
return pClient->SendNetMsgEx(pMsg, bLocal, bForceReliable, bVoice);
|
||||
}
|
||||
|
||||
void VClient::Attach(void) const
|
||||
{
|
||||
#ifndef CLIENT_DLL
|
||||
DetourAttach((LPVOID*)&v_CClient_Clear, &CClient::VClear);
|
||||
DetourAttach((LPVOID*)&v_CClient_Connect, &CClient::VConnect);
|
||||
DetourAttach((LPVOID*)&v_CClient_ActivatePlayer, &CClient::VActivatePlayer);
|
||||
DetourAttach((LPVOID*)&v_CClient_ProcessStringCmd, &CClient::VProcessStringCmd);
|
||||
DetourAttach((LPVOID*)&v_CClient_SendNetMsgEx, &CClient::VSendNetMsgEx);
|
||||
//DetourAttach((LPVOID*)&p_CClient_SendSnapshot, &CClient::VSendSnapshot);
|
||||
#endif // !CLIENT_DLL
|
||||
}
|
||||
void VClient::Detach(void) const
|
||||
{
|
||||
#ifndef CLIENT_DLL
|
||||
DetourDetach((LPVOID*)&v_CClient_Clear, &CClient::VClear);
|
||||
DetourDetach((LPVOID*)&v_CClient_Connect, &CClient::VConnect);
|
||||
DetourDetach((LPVOID*)&v_CClient_ActivatePlayer, &CClient::VActivatePlayer);
|
||||
DetourDetach((LPVOID*)&v_CClient_ProcessStringCmd, &CClient::VProcessStringCmd);
|
||||
DetourDetach((LPVOID*)&v_CClient_SendNetMsgEx, &CClient::VSendNetMsgEx);
|
||||
//DetourDetach((LPVOID*)&p_CClient_SendSnapshot, &CClient::VSendSnapshot);
|
||||
#endif // !CLIENT_DLL
|
||||
}
|
||||
|
@ -268,24 +268,7 @@ class VClient : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const
|
||||
{
|
||||
DetourAttach((LPVOID*)&v_CClient_Clear, &CClient::VClear);
|
||||
DetourAttach((LPVOID*)&v_CClient_Connect, &CClient::VConnect);
|
||||
DetourAttach((LPVOID*)&v_CClient_ActivatePlayer, &CClient::VActivatePlayer);
|
||||
DetourAttach((LPVOID*)&v_CClient_ProcessStringCmd, &CClient::VProcessStringCmd);
|
||||
DetourAttach((LPVOID*)&v_CClient_SendNetMsgEx, &CClient::VSendNetMsgEx);
|
||||
//DetourAttach((LPVOID*)&p_CClient_SendSnapshot, &CClient::VSendSnapshot);
|
||||
}
|
||||
virtual void Detach(void) const
|
||||
{
|
||||
DetourDetach((LPVOID*)&v_CClient_Clear, &CClient::VClear);
|
||||
DetourDetach((LPVOID*)&v_CClient_Connect, &CClient::VConnect);
|
||||
DetourDetach((LPVOID*)&v_CClient_ActivatePlayer, &CClient::VActivatePlayer);
|
||||
DetourDetach((LPVOID*)&v_CClient_ProcessStringCmd, &CClient::VProcessStringCmd);
|
||||
DetourDetach((LPVOID*)&v_CClient_SendNetMsgEx, &CClient::VSendNetMsgEx);
|
||||
//DetourDetach((LPVOID*)&p_CClient_SendSnapshot, &CClient::VSendSnapshot);
|
||||
}
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user