Skip to content

Python 3.13, site-packages and SDK 2013 update #508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 39 commits into from
Apr 18, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
13492ea
First part of Win update
Ayuto Apr 1, 2025
284fe5b
Update Python
Ayuto Apr 1, 2025
e32e72b
Fixed dict usage before Python initialization (thanks to spitice)
Ayuto Apr 15, 2025
a1bf96d
Fix Python initialization
Ayuto Apr 15, 2025
e84647e
Update site packages
Ayuto Apr 16, 2025
8f691e4
Fixes due to updated path library
Ayuto Apr 16, 2025
f3f1647
Fix cmake deprecation warnings
Ayuto Apr 16, 2025
061c063
OB SDK fixes
Ayuto Apr 16, 2025
6ac5afe
Fix deprecated datetime function.
Ayuto Apr 16, 2025
81c5b67
Remove tf2 patches
Ayuto Apr 16, 2025
a45cd6e
Remove hl2dm patches
Ayuto Apr 16, 2025
30b818b
Remove patched tier1 for l4d2
Ayuto Apr 16, 2025
977f87c
Fix SDK link libs
Ayuto Apr 16, 2025
7e9a70d
Fix gmod
Ayuto Apr 16, 2025
91691e6
Remove bms patch and fix compilation
Ayuto Apr 16, 2025
28750cd
Remove blade patch
Ayuto Apr 16, 2025
685d27c
Update documentation
Ayuto Apr 16, 2025
2d7e65c
Updated docs for building
Ayuto Apr 16, 2025
732b121
Add static AsmJit lib for Linux
Ayuto Apr 17, 2025
5b9d787
Add static DynamicHooks lib for Linux
Ayuto Apr 17, 2025
740e098
Python update linux
Ayuto Apr 17, 2025
835bc69
32bit Python...
Ayuto Apr 17, 2025
a2e6639
Added Boost libs
Ayuto Apr 17, 2025
cee5da7
Fix link libraries
Ayuto Apr 17, 2025
76171e7
Final fixes
Ayuto Apr 17, 2025
5499de4
Fix path to sqlite lib
Ayuto Apr 17, 2025
081c601
Add sysconfigdata
Ayuto Apr 17, 2025
5f50c5b
Merge branch 'master' into py313
Ayuto Apr 18, 2025
c1836ae
Fix some Sphinx warnings
Ayuto Apr 18, 2025
2b6018a
Add requirements.txt
Ayuto Apr 18, 2025
4b63c1a
Accidentally installed the wrong arch...
Ayuto Apr 18, 2025
3cfe784
Add Linux site-packages
Ayuto Apr 18, 2025
092a33c
Fix documentation
Ayuto Apr 18, 2025
0eea28b
Use c++17
Ayuto Apr 18, 2025
3ba852d
Patches for bms and gmod (use V_swap instead of swap)
Ayuto Apr 18, 2025
0ee352f
PRs have been merged already
Ayuto Apr 18, 2025
720c2df
Use devenv to build Win from cmd
Ayuto Apr 18, 2025
2cba278
Also clear site-packages when updating
Ayuto Apr 18, 2025
a1b20f8
Updated requirements doc
Ayuto Apr 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
OB SDK fixes
  • Loading branch information
Ayuto committed Apr 16, 2025
commit 061c06310cb29604dfb1062e67f35ff934f463d2
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# ------------------------------------------------------------------
# Set minimum required version of CMake
# ------------------------------------------------------------------
CMake_Minimum_Required(VERSION 3.0)
project(Source-Python)
CMake_Minimum_Required(VERSION 3.15)
project(source-python)

# ------------------------------------------------------------------
# Makefile includes.
Expand Down
2 changes: 1 addition & 1 deletion src/core/modules/engines/engines_server_wrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ static void export_iserver(scope _server)

_IServer.add_property(
"udp_port",
#if defined(ENGINE_BRANCH_TF2) || defined(ENGINE_BRANCH_HL2DM)
#if defined(ENGINE_ORANGEBOX)
&IServer::GetLocalUDPPort,
#else
&IServer::GetUDPPort,
Expand Down
10 changes: 9 additions & 1 deletion src/core/modules/entities/entities.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ class TakeDamageInfoBaseWrapper: public CTakeDamageInfo

void set_inflictor(unsigned int uiInflictor)
{
#if defined(ENGINE_ORANGEBOX)
m_hInflictor = EHANDLE::UnsafeFromIndex(uiInflictor);
#else
m_hInflictor = ExcBaseHandleFromIndex(uiInflictor);
#endif
}

unsigned int get_attacker()
Expand Down Expand Up @@ -144,7 +148,7 @@ class TakeDamageInfoBaseWrapper: public CTakeDamageInfo
m_CSGOAttacker.m_iUserId = -1;
}
#else
m_hAttacker = ExcBaseHandleFromIndex(uiAttacker);
m_hAttacker = EHANDLE::UnsafeFromIndex(uiAttacker);
#endif
}

Expand Down Expand Up @@ -172,7 +176,11 @@ class TakeDamageInfoBaseWrapper: public CTakeDamageInfo

void set_weapon(unsigned int uiWeapon)
{
#if defined(ENGINE_ORANGEBOX)
m_hWeapon = EHANDLE::UnsafeFromIndex(uiWeapon);
#else
m_hWeapon = ExcBaseHandleFromIndex(uiWeapon);
#endif
}

void set_base_damage(float flBaseDamage)
Expand Down
23 changes: 18 additions & 5 deletions src/core/modules/keyvalues/keyvalues_wrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,31 @@
friend void RecursiveCopyKeyValuesHack(KeyValues* pThis, KeyValues& src);
void RecursiveCopyKeyValues( KeyValues& src );
*/
#define RecursiveCopyKeyValues \
JustFinishTheDeclaration() {} \
friend void RecursiveCopyKeyValuesHack(KeyValues* pThis, KeyValues& src); \
void RecursiveCopyKeyValues
#if defined(ENGINE_ORANGEBOX)
#define CopyKeyValuesFromRecursive \
JustFinishTheDeclaration() {} \
friend void RecursiveCopyKeyValuesHack(KeyValues* pThis, KeyValues& src); \
void CopyKeyValuesFromRecursive
#else
#define RecursiveCopyKeyValues \
JustFinishTheDeclaration() {} \
friend void RecursiveCopyKeyValuesHack(KeyValues* pThis, KeyValues& src); \
void RecursiveCopyKeyValues
#endif

#include "tier1/KeyValues.h"

// Now, remove the replacement, so the friend function can call the member function.
#define RecursiveCopyKeyValues RecursiveCopyKeyValues
#define CopyKeyValuesFromRecursive CopyKeyValuesFromRecursive

void RecursiveCopyKeyValuesHack(KeyValues* pThis, KeyValues& src)
{
#if defined(ENGINE_ORANGEBOX)
pThis->CopyKeyValuesFromRecursive(src);
#else
pThis->RecursiveCopyKeyValues(src);
#endif
}


Expand Down Expand Up @@ -191,7 +204,7 @@ void export_keyvalues(scope _keyvalues)

.add_property("next_key",
make_function(
&KeyValues::GetNextKey,
GET_CONST_METHOD(const KeyValues*, KeyValues, GetNextKey),
reference_existing_object_policy()
),
&KeyValues::SetNextKey,
Expand Down
2 changes: 2 additions & 0 deletions src/core/modules/players/players_wrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
//-----------------------------------------------------------------------------
// Includes.
//-----------------------------------------------------------------------------
class CBasePlayer;

#include "players_generator.h"
#include "export_main.h"
#include "modules/memory/memory_tools.h"
Expand Down
1 change: 0 additions & 1 deletion src/core/modules/steam/orangebox/steam_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ void export_engine_specific_steamid(scope _steam, T SteamID)
template<class T>
void export_engine_specific_account_type(scope _steam, T AccountType)
{
AccountType.value("P2P_SUPER_SEEDER", k_EAccountTypeP2PSuperSeeder);
}

#endif // _STEAM_WRAP_ORANGEBOX_H
2 changes: 2 additions & 0 deletions src/core/sp_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
//---------------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------------
class CBasePlayer;

// Boost.Python
#include "boost/python.hpp"
using namespace boost::python;
Expand Down
12 changes: 6 additions & 6 deletions src/core/sp_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ bool CSourcePython::Load( CreateInterfaceFn interfaceFactory, CreateInterfaceFn
DevMsg(1, MSG_PREFIX "Connecting tier1 libraries...\n");
ConnectTier1Libraries( &interfaceFactory, 1 );

DevMsg(1, MSG_PREFIX "Connecting tier2 libraries...\n");
ConnectTier2Libraries( &interfaceFactory, 2 );
//DevMsg(1, MSG_PREFIX "Connecting tier2 libraries...\n");
//ConnectTier2Libraries( &interfaceFactory, 2 );
#endif

// Get all engine interfaces.
Expand Down Expand Up @@ -317,8 +317,8 @@ void CSourcePython::Unload( void )
DevMsg(1, MSG_PREFIX "Disconnecting interfaces...\n");
DisconnectInterfaces();
#else
DevMsg(1, MSG_PREFIX "Disconnecting tier2 libraries...\n");
DisconnectTier2Libraries( );
//DevMsg(1, MSG_PREFIX "Disconnecting tier2 libraries...\n");
//DisconnectTier2Libraries( );

DevMsg(1, MSG_PREFIX "Disconnecting tier1 libraries...\n");
DisconnectTier1Libraries( );
Expand Down Expand Up @@ -351,7 +351,7 @@ void CSourcePython::UnPause( void )
//-----------------------------------------------------------------------------
const char *CSourcePython::GetPluginDescription( void )
{
return "Source.Python, (C) 2012-2021, Source.Python Team.";
return "Source.Python, (C) 2012-2025, Source.Python Team.";
}

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -507,7 +507,7 @@ void CSourcePython::ClientFullyConnect( edict_t *pEntity )
}
#endif

#if defined(ENGINE_CSGO) || defined(ENGINE_BMS) || defined(ENGINE_BLADE)
#if defined(ENGINE_CSGO) || defined(ENGINE_BMS) || defined(ENGINE_BLADE) || defined(ENGINE_ORANGEBOX)
void CSourcePython::OnEdictAllocated( edict_t *edict )
{
unsigned int iEntityIndex;
Expand Down
2 changes: 1 addition & 1 deletion src/core/sp_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class CSourcePython: public IServerPluginCallbacks, public IEntityListener, publ
virtual void ClientFullyConnect( edict_t *pEntity );
#endif

#if defined(ENGINE_CSGO) || defined(ENGINE_BMS) || defined(ENGINE_BLADE)
#if defined(ENGINE_CSGO) || defined(ENGINE_BMS) || defined(ENGINE_BLADE) || defined(ENGINE_ORANGEBOX)
virtual void OnEdictAllocated( edict_t *edict );
virtual void OnEdictFreed( const edict_t *edict );
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/loader/loader_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ void CSourcePython::ClientFullyConnect( edict_t *pEntity )
}
#endif

#if defined(ENGINE_CSGO) || defined(ENGINE_BMS) || defined(ENGINE_BLADE)
#if defined(ENGINE_CSGO) || defined(ENGINE_BMS) || defined(ENGINE_BLADE) || defined(ENGINE_ORANGEBOX)
void CSourcePython::OnEdictAllocated( edict_t *edict )
{
if (m_pCorePlugin != NULL)
Expand Down
2 changes: 1 addition & 1 deletion src/loader/loader_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class CSourcePython: public IServerPluginCallbacks
virtual void ClientFullyConnect( edict_t *pEntity );
#endif

#if defined(ENGINE_CSGO) || defined(ENGINE_BMS) || defined(ENGINE_BLADE)
#if defined(ENGINE_CSGO) || defined(ENGINE_BMS) || defined(ENGINE_BLADE) || defined(ENGINE_ORANGEBOX)
virtual void OnEdictAllocated( edict_t *edict );
virtual void OnEdictFreed( const edict_t *edict );
#endif
Expand Down
42 changes: 27 additions & 15 deletions src/makefiles/win32/win32.base.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,19 @@ Set(CMAKE_CXX_FLAGS_RELEASE "/D_NDEBUG /MD /wd4005 /MP")
# ------------------------------------------------------------------
# Statically link runtime libraries for the loader
# ------------------------------------------------------------------
# This looks like a bug...
# For the debug config we need to specify the release flag and vice versa.
target_compile_options(source-python PRIVATE "/MT$<$<CONFIG:Debug>:d>")
target_compile_options(source-python PRIVATE "/MTd$<$<CONFIG:Release>:d>")
target_compile_options(core PRIVATE "/MT$<$<CONFIG:Debug>:d>")
target_compile_options(core PRIVATE "/MTd$<$<CONFIG:Release>:d>")
set_property(TARGET core source-python PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

Set_Target_Properties(core PROPERTIES
LINK_FLAGS_RELEASE "/NODEFAULTLIB:LIBC.lib /NODEFAULTLIB:LIBCMT.lib /NODEFAULTLIB:LIBCPMT.lib"
)
#Set_Target_Properties(core PROPERTIES
# LINK_FLAGS_RELEASE "/NODEFAULTLIB:LIBC.lib /NODEFAULTLIB:LIBCMT.lib /NODEFAULTLIB:LIBCPMT.lib"
#)

SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")

# ------------------------------------------------------------------
# Link libraries.
# ------------------------------------------------------------------
Set(SOURCEPYTHON_LINK_LIBRARIES
${SOURCESDK_LIB}/public/tier0.lib
${SOURCESDK_LIB}/public/tier1.lib
${SOURCESDK_LIB}/public/tier2.lib
${SOURCESDK_LIB}/public/tier3.lib
${SOURCESDK_LIB}/public/vstdlib.lib
${SOURCESDK_LIB}/public/mathlib.lib
${DYNCALLSDK_LIB}/libdyncall_s.lib
${DYNCALLSDK_LIB}/libdyncallback_s.lib
${DYNCALLSDK_LIB}/libdynload_s.lib
Expand All @@ -67,6 +59,26 @@ Set(SOURCEPYTHON_LINK_LIBRARIES
${BOOSTSDK_LIB}/libboost_system-vc143-mt-s-x32-1_87.lib
)

If( SOURCE_ENGINE MATCHES "csgo" OR SOURCE_ENGINE MATCHES "blade")
Set(SOURCEPYTHON_LINK_LIBRARIES
${SOURCEPYTHON_LINK_LIBRARIES}
${SOURCESDK_LIB}/public/tier0.lib
${SOURCESDK_LIB}/public/tier1.lib
${SOURCESDK_LIB}/public/tier2.lib
${SOURCESDK_LIB}/public/tier3.lib
${SOURCESDK_LIB}/public/vstdlib.lib
${SOURCESDK_LIB}/public/mathlib.lib
)
Else()
Set(SOURCEPYTHON_LINK_LIBRARIES
${SOURCEPYTHON_LINK_LIBRARIES}
${SOURCESDK_LIB}/public/x86/tier0.lib
${SOURCESDK_LIB}/public/x86/tier1.lib
${SOURCESDK_LIB}/public/x86/vstdlib.lib
${SOURCESDK_LIB}/public/x86/mathlib.lib
)
Endif()

# CSGO Engine adds in interfaces.lib
If( SOURCE_ENGINE MATCHES "csgo" OR SOURCE_ENGINE MATCHES "blade")
Set(SOURCEPYTHON_LINK_LIBRARIES
Expand Down