Forcing previous2021 Beta: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Introduction==
==Introduction==
The [[Source SDK Base 2013 Multiplayer]] 2025 update breaks mods that ran on the older version of the engine. While some mods are technically playable in the new SDK version, they are bug-ridden.
The [[Source SDK Base 2013 Multiplayer]] 2025 update breaks mods that ran on the older version of the engine. While some mods that were built with the old SDK are technically playable in the new SDK version, they are bug-ridden.
This guide is for modders who do not (at least yet) want to update to the new SDK and also wants to prevent players from opening the mod with the new SDK too.
This guide is for modders who currently do not want to update to the new SDK and also wants to prevent players from opening the mod with the new SDK too.


==Code==
==Code==
The method here is to check the engine's protocol version. It should be 24 in the old SDK, but due to class misalignment, calling this function in the new SDK Base with the old SDK code returns a bizarre number.
=== Detecting the New SDK ===
The method here is to check the engine's protocol version with the function <code>engine->GetProtocolVersion()</code>. It should be 24 in the old SDK, but due to class misalignment, calling this function in the new SDK Base with the old SDK code returns a bizarre number.


=== Detecting the New SDK ===
Open cdll_client_int.cpp and find:
Open cdll_client_int.cpp and find:
<source lang="cpp">
<source lang="cpp">
Line 19: Line 19:
</source>
</source>


=== Adding the error disclaimer ===
=== Adding the Error Message ===
Now modify the CHLClient::PostInit function so that it looks like this:
In the function <code>void CHLClient::PostInit()</code>, add the following code underneath <code>IGameSystem::PostInitAllSystems();</code>
<source lang="cpp">
<source lang="cpp">
void CHLClient::PostInit()
if ( IsNewSDK() )
{
{
IGameSystem::PostInitAllSystems();
Error( "The previous2021 beta must be selected for Source SDK Base 2013 Multiplayer to play this mod." );
 
if ( IsNewSDK() )
{
Error( "The previous2021 beta must be selected for Source SDK Base 2013 Multiplayer to play this mod." );
}
 
#ifdef SIXENSE
// allow sixnese input to perform post-init operations
g_pSixenseInput->PostInit();
#endif
 
g_ClientVirtualReality.StartupComplete();
 
#ifdef HL1MP_CLIENT_DLL
if ( s_cl_load_hl1_content.GetBool() && steamapicontext && steamapicontext->SteamApps() )
{
char szPath[ MAX_PATH*2 ];
int ccFolder= steamapicontext->SteamApps()->GetAppInstallDir( 280, szPath, sizeof(szPath) );
if ( ccFolder > 0 )
{
V_AppendSlash( szPath, sizeof(szPath) );
V_strncat( szPath, "hl1", sizeof( szPath ) );
 
g_pFullFileSystem->AddSearchPath( szPath, "HL1" );
g_pFullFileSystem->AddSearchPath( szPath, "GAME" );
}
}
#endif
}
}
</source>
</source>
If a player tries to run the mod with the modern [[Source SDK Base 2013 Multiplayer]] version, the game will stop them and show the above error message.
If a player tries to run the mod with the modern [[Source SDK Base 2013 Multiplayer]] version, the game will stop them and show the above error message.
{{Note|It's advised to keep the wording of the sentence exactly the same as it is in this guide to help players diagnose the error easier. Someone creating a post online asking what the error message means for a mod may help someone else for a different mod who comes across the post and is also wondering what the error message means.}}


[[Category:Programming]]
[[Category:Programming]]

Latest revision as of 00:08, 19 April 2025

Introduction

The Source SDK Base 2013 Multiplayer 2025 update breaks mods that ran on the older version of the engine. While some mods that were built with the old SDK are technically playable in the new SDK version, they are bug-ridden. This guide is for modders who currently do not want to update to the new SDK and also wants to prevent players from opening the mod with the new SDK too.

Code

Detecting the New SDK

The method here is to check the engine's protocol version with the function engine->GetProtocolVersion(). It should be 24 in the old SDK, but due to class misalignment, calling this function in the new SDK Base with the old SDK code returns a bizarre number.

Open cdll_client_int.cpp and find:

void CHLClient::PostInit()

and add this right above it:

bool IsNewSDK()
{
	return engine->GetProtocolVersion() != 24;
}

Adding the Error Message

In the function void CHLClient::PostInit(), add the following code underneath IGameSystem::PostInitAllSystems();

if ( IsNewSDK() )
{
	Error( "The previous2021 beta must be selected for Source SDK Base 2013 Multiplayer to play this mod." );
}

If a player tries to run the mod with the modern Source SDK Base 2013 Multiplayer version, the game will stop them and show the above error message.

Note.pngNote:It's advised to keep the wording of the sentence exactly the same as it is in this guide to help players diagnose the error easier. Someone creating a post online asking what the error message means for a mod may help someone else for a different mod who comes across the post and is also wondering what the error message means.