From 4954862ff0c1546d9857a46e14683e0c33f0f35d Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 15 Sep 2024 22:05:45 +0200 Subject: [PATCH] Added launcher for CS:S Enhanced --- engine/cl_main.cpp | 5 +++++ launcher/launcher.cpp | 13 +++++++++++-- launcher/wscript | 3 +++ launcher_main/main.cpp | 1 + launcher_main/wscript | 39 +++++++++++++++++++++++++++------------ 5 files changed, 47 insertions(+), 14 deletions(-) diff --git a/engine/cl_main.cpp b/engine/cl_main.cpp index c746b4ae70..23928da44b 100644 --- a/engine/cl_main.cpp +++ b/engine/cl_main.cpp @@ -2378,6 +2378,11 @@ bool CL_ShouldLoadBackgroundLevel( const CCommand &args ) bIsTF2 = true; } + if ( Q_stricmp( COM_GetModDirectory(), "cstrike" ) == 0 ) + { + return false; + } + if ( bIsTF2 && IsPC() ) return false; diff --git a/launcher/launcher.cpp b/launcher/launcher.cpp index 0b27da73e2..7c4363f003 100644 --- a/launcher/launcher.cpp +++ b/launcher/launcher.cpp @@ -91,7 +91,11 @@ int MessageBox( HWND hWnd, const char *message, const char *header, unsigned uTy // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" +#ifdef CSS_ENHANCED_EXECUTABLE +#define DEFAULT_HL2_GAMEDIR "cstrike" +#else #define DEFAULT_HL2_GAMEDIR "hl2" +#endif #if defined( USE_SDL ) extern void* CreateSDLMgr(); @@ -419,7 +423,7 @@ void CLogAllFiles::Init() // game directory has not been established yet, must derive ourselves char path[MAX_PATH]; - Q_snprintf( path, sizeof(path), "%s/%s", GetBaseDirectory(), CommandLine()->ParmValue( "-game", "hl2" ) ); + Q_snprintf( path, sizeof(path), "%s/%s", GetBaseDirectory(), CommandLine()->ParmValue( "-game", DEFAULT_HL2_GAMEDIR ) ); Q_FixSlashes( path ); #ifdef WIN32 Q_strlower( path ); @@ -818,7 +822,7 @@ bool CSourceAppSystemGroup::PreInit() if ( IsPC() ) { // This will get called multiple times due to being here, but only the first one will do anything - reslistgenerator->Init( GetBaseDirectory(), CommandLine()->ParmValue( "-game", "hl2" ) ); + reslistgenerator->Init( GetBaseDirectory(), CommandLine()->ParmValue( "-game", DEFAULT_HL2_GAMEDIR ) ); // This will also get called each time, but will actually fix up the command line as needed reslistgenerator->SetupCommandLine(); @@ -1267,6 +1271,11 @@ DLL_EXPORT int LauncherMain( int argc, char **argv ) CommandLine()->CreateCmdLine( argc, argv ); #endif +#ifdef CSS_ENHANCED_EXECUTABLE + CommandLine()->AppendParm( "-game", DEFAULT_HL2_GAMEDIR ); + CommandLine()->AppendParm( "-defaultgamedir", DEFAULT_HL2_GAMEDIR ); +#endif + // No -dxlevel or +mat_hdr_level allowed on POSIX #ifdef POSIX CommandLine()->RemoveParm( "-dxlevel" ); diff --git a/launcher/wscript b/launcher/wscript index 8bd7dad3f4..d7446c32e2 100755 --- a/launcher/wscript +++ b/launcher/wscript @@ -48,6 +48,9 @@ def build(bld): install_path = bld.env.LIBDIR + if 'cstrike' == bld.options.GAMES: + defines += ['CSS_ENHANCED_EXECUTABLE'] + bld.shlib( source = source, target = PROJECT_NAME, diff --git a/launcher_main/main.cpp b/launcher_main/main.cpp index bc075b945b..863d05b187 100644 --- a/launcher_main/main.cpp +++ b/launcher_main/main.cpp @@ -4,6 +4,7 @@ // //=====================================================================================// +#include "tier1/strtools.h" #if defined( _WIN32 ) && !defined( _X360 ) #include #include diff --git a/launcher_main/wscript b/launcher_main/wscript index 11f105b0bc..0c3144ab7e 100755 --- a/launcher_main/wscript +++ b/launcher_main/wscript @@ -30,16 +30,31 @@ def build(bld): source += ['launcher_main.rc'] install_path = bld.env.BINDIR - bld( - source = source, - target = PROJECT_NAME, - name = PROJECT_NAME, - features = 'c cxx cxxprogram', - includes = includes, - defines = defines, - use = libs, - install_path = install_path, - subsystem = bld.env.MSVC_SUBSYSTEM, - idx = bld.get_taskgen_count() - ) + + if 'cstrike' == bld.options.GAMES: + bld( + source = source, + target = 'css_enhanced', + name = 'css_enhanced', + features = 'c cxx cxxprogram', + includes = includes, + defines = defines + ['CSS_ENHANCED_EXECUTABLE'], + use = libs, + install_path = install_path, + subsystem = bld.env.MSVC_SUBSYSTEM, + idx = bld.get_taskgen_count() + ) + else: + bld( + source = source, + target = PROJECT_NAME, + name = PROJECT_NAME, + features = 'c cxx cxxprogram', + includes = includes, + defines = defines, + use = libs, + install_path = install_path, + subsystem = bld.env.MSVC_SUBSYSTEM, + idx = bld.get_taskgen_count() + )