Skip to content

Commit 031f28c

Browse files
committed
Bring 64x support for Gmod with the merged 32x & 64x SDK changes
1 parent 4c9016b commit 031f28c

File tree

10 files changed

+121
-32
lines changed

10 files changed

+121
-32
lines changed

.github/workflows/artifacts.yml

Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,28 @@ jobs:
77
strategy:
88
fail-fast: false
99
matrix:
10-
source_branch: [sdk2013-sp, sdk2013-mp, asw, gmod]
10+
name: [sdk2013-sp, sdk2013-mp, asw, gmod, gmod_64]
11+
include:
12+
- name: sdk2013-sp
13+
branch: sdk2013-sp
14+
arch: '32'
15+
vscodeArch: 'x86'
16+
- name: sdk2013-mp
17+
branch: sdk2013-mp
18+
arch: '32'
19+
vscodeArch: 'x86'
20+
- name: asw
21+
branch: asw
22+
arch: '32'
23+
vscodeArch: 'x86'
24+
- name: gmod
25+
branch: gmod
26+
arch: '32'
27+
vscodeArch: 'x86'
28+
- name: gmod_64
29+
branch: gmod
30+
arch: '64'
31+
vscodeArch: 'x64'
1132

1233
runs-on: windows-2022
1334

@@ -20,7 +41,7 @@ jobs:
2041
- name: Checkout VPhysics Jolt
2142
uses: actions/checkout@v3
2243
with:
23-
path: ${{ matrix.source_branch }}/src/vphysics_jolt
44+
path: ${{ matrix.branch }}/src/vphysics_jolt
2445
submodules: recursive
2546

2647
- name: Find Visual Studio
@@ -32,28 +53,41 @@ jobs:
3253
| Out-File -FilePath "${Env:GITHUB_ENV}" -Append
3354
3455
- name: Build MSVC x86
35-
working-directory: ${{ matrix.source_branch }}/src
56+
working-directory: ${{ matrix.branch }}/src
3657
run: |
3758
& "${Env:COMSPEC}" /s /c "`"${Env:VSDEVCMD}`" -arch=x86 -host_arch=x64 -no_logo && set" `
3859
| % { , ($_ -Split '=', 2) } `
3960
| % { [System.Environment]::SetEnvironmentVariable($_[0], $_[1]) }
4061
.\fix_registry.bat
41-
.\createjoltprojects.bat
62+
.\createjoltprojects.bat ${{ matrix.arch }}
4263
devenv jolt.sln /upgrade
43-
msbuild jolt.sln /nodeReuse:false /t:Rebuild /p:Configuration=Release /p:Platform=x86 /m /v:minimal
64+
msbuild jolt.sln /nodeReuse:false /t:Rebuild /p:Configuration=Release /p:Platform=${{ matrix.vscodeArch }} /m /v:minimal
4465
4566
- name: Upload artifacts
4667
uses: actions/upload-artifact@v3
4768
with:
48-
name: vphysics_jolt_${{ matrix.source_branch }}_win32
49-
path: ${{ matrix.source_branch }}/game
69+
name: vphysics_jolt_${{ matrix.branch }}_win${{ matrix.arch }}
70+
path: ${{ matrix.branch }}/game
5071
if-no-files-found: error
5172

5273
linux:
5374
strategy:
5475
fail-fast: false
5576
matrix:
56-
source_branch: [sdk2013-sp, sdk2013-mp, gmod]
77+
name: [sdk2013-sp, sdk2013-mp, gmod, gmod_64]
78+
include:
79+
- name: sdk2013-sp
80+
branch: sdk2013-sp
81+
arch: '32'
82+
- name: sdk2013-mp
83+
branch: sdk2013-mp
84+
arch: '32'
85+
- name: gmod
86+
branch: gmod
87+
arch: '32'
88+
- name: gmod_64
89+
branch: gmod
90+
arch: '64'
5791

5892
runs-on: ubuntu-latest
5993
container: debian:bullseye
@@ -73,22 +107,25 @@ jobs:
73107
- name: Checkout VPhysics Jolt
74108
uses: actions/checkout@v3
75109
with:
76-
path: ${{ matrix.source_branch }}/src/vphysics_jolt
110+
path: ${{ matrix.branch }}/src/vphysics_jolt
77111
submodules: recursive
78112

79113
- name: Build GCC x86
80-
working-directory: ${{ matrix.source_branch }}/src
114+
working-directory: ${{ matrix.branch }}/src
81115
run: |
82116
chmod +x createjoltprojects.sh
83117
chmod +x devtools/bin/vpc_linux
84118
chmod +x devtools/bin/vpc
85119
chmod +x devtools/gendbg.sh
86-
./createjoltprojects.sh
87-
make -f jolt.mak -j $(nproc)
120+
./createjoltprojects.sh ${{ matrix.arch }}
121+
if [ "${{ matrix.arch }}" = "64" ]; then
122+
make -f jolt.mak ARCH_FLAGS="-march=x86-64 -mtune=generic" -j $(nproc)
123+
else
124+
make -f jolt.mak -j $(nproc)
125+
fi
88126
89127
- name: Upload artifacts
90128
uses: actions/upload-artifact@v3
91129
with:
92-
name: vphysics_jolt_${{ matrix.source_branch }}_linux32
93-
path: ${{ matrix.source_branch }}/game
94-
if-no-files-found: error
130+
name: vphysics_jolt_${{ matrix.branch }}_linux${{ matrix.arch }}
131+
path: ${{ matrix.branch }}/game
Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11

22
#pragma once
33

4-
#if defined( GAME_CSGO ) || defined( GAME_VITAMIN )
5-
#define GAME_CSGO_OR_NEWER
6-
#define override_csgo override
7-
#define override_not_csgo
8-
#else
9-
#define override_csgo
10-
#define override_not_csgo override
11-
#endif
12-
134
// GMod SDK2013 x86 branch
145
#if defined( GAME_GMOD )
6+
#if PLATFORM_64BITS
7+
#define GAME_GMOD_64X
8+
#endif
159
#define override_gmod override
1610
#define override_not_gmod
1711
#else
1812
#define override_gmod
1913
#define override_not_gmod override
2014
#endif
2115

22-
#if defined( GAME_CSGO ) || defined( GAME_VITAMIN ) || defined( GAME_PORTAL2 )
16+
#if defined( GAME_CSGO ) || defined( GAME_VITAMIN ) || defined( GAME_GMOD_64X )
17+
#define GAME_CSGO_OR_NEWER
18+
#define override_csgo override
19+
#define override_not_csgo
20+
#else
21+
#define override_csgo
22+
#define override_not_csgo override
23+
#endif
24+
25+
#if defined( GAME_CSGO ) || defined( GAME_VITAMIN ) || defined( GAME_PORTAL2 ) || defined( GAME_GMOD_64X )
2326
#define GAME_PORTAL2_OR_NEWER
2427
#define override_portal2 override
2528
#define override_not_portal2
@@ -28,7 +31,7 @@
2831
#define override_not_portal2 override
2932
#endif
3033

31-
#if defined( GAME_CSGO ) || defined( GAME_VITAMIN ) || defined( GAME_PORTAL2 ) || defined( GAME_L4D2 )
34+
#if defined( GAME_CSGO ) || defined( GAME_VITAMIN ) || defined( GAME_PORTAL2 ) || defined( GAME_L4D2 ) || defined( GAME_GMOD_64X )
3235
#define GAME_L4D2_OR_NEWER
3336
#define override_l4d2 override
3437
#define override_not_l4d2
@@ -37,7 +40,7 @@
3740
#define override_not_l4d2 override
3841
#endif
3942

40-
#if defined( GAME_CSGO ) || defined( GAME_VITAMIN ) || defined( GAME_PORTAL2 ) || defined( GAME_L4D2 ) || defined( GAME_ASW )
43+
#if defined( GAME_CSGO ) || defined( GAME_VITAMIN ) || defined( GAME_PORTAL2 ) || defined( GAME_L4D2 ) || defined( GAME_ASW ) || defined( GAME_GMOD_64X )
4144
#define GAME_ASW_OR_NEWER
4245
#define override_asw override
4346
#define override_not_asw
@@ -50,7 +53,7 @@
5053
using strlen_t = int;
5154
#endif
5255

53-
#ifndef GAME_CSGO_OR_NEWER
56+
#if !defined(GAME_CSGO_OR_NEWER) || defined( GAME_GMOD_64X )
5457
#define FastASCIIToUpper( c ) ( ( ( (c) >= 'a' ) && ( (c) <= 'z' ) ) ? ( (c) - 32 ) : (c) )
5558
#define FastASCIIToLower( c ) ( ( ( (c) >= 'A' ) && ( (c) <= 'Z' ) ) ? ( (c) + 32 ) : (c) )
5659
#endif

vphysics_jolt/compat/compat_sdk2013.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
// Source Engine branches for SDK 2013.
66

77
#include "Color.h"
8+
#include "branch_overrides.h"
89

10+
#if !defined( GAME_GMOD_64X )
911
enum LoggingSeverity_t
1012
{
1113
LS_MESSAGE = 0,
@@ -15,6 +17,16 @@ enum LoggingSeverity_t
1517
LS_HIGHEST_SEVERITY = 4,
1618
};
1719

20+
static const int MAX_LOGGING_MESSAGE_LENGTH = 2048;
21+
#else
22+
#undef DECLARE_LOGGING_CHANNEL
23+
#undef DEFINE_LOGGING_CHANNEL_NO_TAGS
24+
#undef Log_Msg
25+
#undef Log_Warning
26+
#undef Log_Error
27+
#undef InternalMsg
28+
#endif
29+
1830
struct LoggingChannelInfo_t
1931
{
2032
const char *pszName;
@@ -27,8 +39,6 @@ struct LoggingChannelInfo_t
2739

2840
#define DEFINE_LOGGING_CHANNEL_NO_TAGS( Channel, ChannelName, ... ) LoggingChannelInfo_t g_LoggingInfo##Channel = { ChannelName, __VA_ARGS__ };
2941

30-
static const int MAX_LOGGING_MESSAGE_LENGTH = 2048;
31-
3242
// TODO
3343
#define DevAssert( ... )
3444
#define DevAssertMsg( ... )
@@ -39,11 +49,13 @@ static const int MAX_LOGGING_MESSAGE_LENGTH = 2048;
3949
#define Log_Error( Channel, Fmt, ... ) InternalMsg( Channel, Fmt, ##__VA_ARGS__ )
4050

4151
// Unused, just makes stuff cleaner to not have ifdef spam.
52+
#if !defined( GAME_GMOD_64X )
4253
enum collisionhints
4354
{
4455
COLLISION_HINT_DEBRIS = 0x0001,
4556
COLLISION_HINT_STATICSOLID = 0x0002,
4657
};
58+
#endif
4759

4860
class IPhysicsCollisionSet;
4961
class IPhysics;

vphysics_jolt/vjolt_controller_player.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,8 @@ class SourceHitFilter : public JPH::BodyFilter
288288
uint32 JoltPhysicsPlayerController::GetContactState( uint16 nGameFlags )
289289
{
290290
// This does not seem to affect much, we should aspire to have our physics be as 1:1 to brush collisions as possible anyway
291-
#ifdef GAME_PORTAL2_OR_NEWER
291+
// Raphael: I was getting stuck at the slightest touch with this enabled on 64x Gmod.
292+
#if defined( GAME_PORTAL2_OR_NEWER ) && !defined( GAME_GMOD )
292293
if ( !m_pObject->IsCollisionEnabled() )
293294
return 0;
294295

vphysics_jolt/vjolt_controller_player.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ class JoltPhysicsPlayerController : public IPhysicsPlayerController, public IJol
3232

3333
bool WasFrozen() override;
3434

35+
#if defined( GAME_GMOD_64X )
36+
uint32 GetContactState( uint16 nGameFlags ); // Not a virtual in Gmod.
37+
#else
3538
uint32 GetContactState( uint16 nGameFlags ) override_portal2;
39+
#endif
3640

3741
// IJoltObjectDestroyedListener
3842
void OnJoltPhysicsObjectDestroyed( JoltPhysicsObject *pObject ) override;

vphysics_jolt/vjolt_environment.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,10 +1117,14 @@ void JoltPhysicsEnvironment::PreRestore( const physprerestoreparams_t &params )
11171117
{
11181118
m_SaveRestorePointerMap.clear();
11191119

1120+
#if defined( GAME_GMOD_64X )
1121+
Log_Stub( LOG_VJolt ); // Raphael (ToDo): Figure out what happens here normally... I should check the SDK again and see if we have the previous structure used by all other branches.
1122+
#else
11201123
for ( int i = 0; i < params.recreatedObjectCount; i++ )
11211124
AddPhysicsSaveRestorePointer(
11221125
reinterpret_cast< uintp >( params.recreatedObjectList[ i ].pOldObject ),
11231126
params.recreatedObjectList[ i ].pNewObject );
1127+
#endif
11241128
}
11251129

11261130
bool JoltPhysicsEnvironment::Restore( const physrestoreparams_t &params )
@@ -1549,3 +1553,16 @@ void JoltPhysicsEnvironment::HandleDebugDumpingEnvironment( void *pReturnAddress
15491553
s_bShouldDumpEnvironmentClient = false;
15501554
s_bShouldDumpEnvironmentServer = false;
15511555
}
1556+
1557+
#if defined( GAME_GMOD_64X )
1558+
// NOTE: physprerestoreparams_t was named to physpresaverestoreparams_t though we kept the original for now.
1559+
void JoltPhysicsEnvironment::PreSave(const physprerestoreparams_t& params)
1560+
{
1561+
Log_Stub( LOG_VJolt );
1562+
}
1563+
1564+
void JoltPhysicsEnvironment::PostSave()
1565+
{
1566+
Log_Stub( LOG_VJolt );
1567+
}
1568+
#endif

vphysics_jolt/vjolt_environment.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,13 @@ class JoltPhysicsEnvironment final : public IPhysicsEnvironment
116116
void CleanupDeleteList() override;
117117
void EnableDeleteQueue( bool enable ) override;
118118

119+
#if defined( GAME_GMOD_64X )
120+
void PreSave( const physprerestoreparams_t &params ) override;
121+
#endif
119122
bool Save( const physsaveparams_t& params ) override;
123+
#if defined( GAME_GMOD_64X )
124+
void PostSave() override;
125+
#endif
120126
void PreRestore( const physprerestoreparams_t& params ) override;
121127
bool Restore( const physrestoreparams_t& params ) override;
122128
void PostRestore() override;

vphysics_jolt/vjolt_surfaceprops.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ KeyValues *JoltPhysicsSurfaceProps::SurfacePropsToKeyValues( const char *pszBuff
237237
}
238238

239239
//-------------------------------------------------------------------------------------------------
240-
240+
#if !defined( GAME_GMOD_64X )
241241
void *JoltPhysicsSurfaceProps::GetIVPMaterial( int nIndex )
242242
{
243243
Log_Stub( LOG_VJolt );
@@ -267,6 +267,7 @@ const char *JoltPhysicsSurfaceProps::GetReservedMaterialName( int nMaterialIndex
267267
Log_Stub( LOG_VJolt );
268268
return "default";
269269
}
270+
#endif
270271

271272
//-------------------------------------------------------------------------------------------------
272273

vphysics_jolt/vjolt_surfaceprops.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ class JoltPhysicsSurfaceProps final : public IPhysicsSurfaceProps
4343

4444
ISaveRestoreOps *GetMaterialIndexDataOps() const override_portal2;
4545

46+
#if !defined( GAME_GMOD_64X )
4647
// GMod-specific internal gubbins that was exposed in the public interface.
4748
void *GetIVPMaterial( int nIndex ) override_gmod;
4849
int GetIVPMaterialIndex( const void *pMaterial ) const override_gmod;
4950
void *GetIVPManager( void ) override_gmod;
5051
int RemapIVPMaterialIndex( int nIndex ) const override_gmod;
5152
const char *GetReservedMaterialName( int nMaterialIndex ) const override_gmod;
53+
#endif
5254

5355
public:
5456
static JoltPhysicsSurfaceProps& GetInstance() { return s_PhysicsSurfaceProps; }

vphysics_wrapper/vphysics_wrapper.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ class PhysicsWrapper final : public CBaseAppSystem<IPhysics>
3232
void Shutdown() override;
3333
void *QueryInterface( const char *pInterfaceName ) override;
3434

35+
#if PLATFORM_64BITS
36+
const AppSystemInfo_t *GetDependencies( ) override { return NULL; };
37+
AppSystemTier_t GetTier() override { return APP_SYSTEM_TIER2; };
38+
void Reconnect( CreateInterfaceFn factory, const char *pInterfaceName ) override {};
39+
#endif
40+
3541
IPhysicsEnvironment *CreateEnvironment() override;
3642
void DestroyEnvironment( IPhysicsEnvironment *pEnvironment ) override;
3743
IPhysicsEnvironment *GetActiveEnvironmentByIndex( int index ) override;

0 commit comments

Comments
 (0)