Skip to content

Commit

Permalink
Update for latest Blade Symphony SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
asherkin committed Apr 9, 2020
1 parent 44baa59 commit 0ac7875
Show file tree
Hide file tree
Showing 16 changed files with 176 additions and 143 deletions.
6 changes: 3 additions & 3 deletions AMBuildScript
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ PossibleSDKs = {
'eye': SDK('HL2SDK-EYE', '2.eye', '5', 'EYE', WinOnly, 'eye'),
'csgo': SDK('HL2SDKCSGO', '2.csgo', '21', 'CSGO', CSGO, 'csgo'),
'portal2': SDK('HL2SDKPORTAL2', '2.portal2', '17', 'PORTAL2', [], 'portal2'),
'blade': SDK('HL2SDKBLADE', '2.blade', '18', 'BLADE', WinLinux, 'blade'),
'blade': SDK('HL2SDKBLADE', '2.blade', '18', 'BLADE', WinOnly, 'blade'),
'insurgency': SDK('HL2SDKINSURGENCY', '2.insurgency', '19', 'INSURGENCY', WinLinuxMac, 'insurgency'),
'contagion': SDK('HL2SDKCONTAGION', '2.contagion', '14', 'CONTAGION', WinOnly, 'contagion'),
'bms': SDK('HL2SDKBMS', '2.bms', '10', 'BMS', WinLinux, 'bms'),
Expand Down Expand Up @@ -519,7 +519,7 @@ class SMConfig(object):
if builder.target.platform in ['linux', 'mac']:
compiler.defines += ['NO_HOOK_MALLOC', 'NO_MALLOC_OVERRIDE']

if sdk.name == 'csgo' and builder.target.platform == 'linux':
if sdk.name in ['csgo', 'blade'] and builder.target.platform == 'linux':
compiler.linkflags += ['-lstdc++']
compiler.defines += ['_GLIBCXX_USE_CXX11_ABI=0']

Expand Down Expand Up @@ -565,7 +565,7 @@ class SMConfig(object):
if builder.target.platform == 'linux':
if sdk.name in ['css', 'hl2dm', 'dods', 'tf2', 'sdk2013', 'bms', 'nucleardawn', 'l4d2', 'insurgency', 'doi']:
dynamic_libs = ['libtier0_srv.so', 'libvstdlib_srv.so']
elif arch == 'x64' and sdk.name == 'csgo':
elif arch == 'x64' and sdk.name in ['csgo', 'blade']:
dynamic_libs = ['libtier0_client.so', 'libvstdlib_client.so']
elif sdk.name in ['l4d', 'blade', 'insurgency', 'doi', 'csgo']:
dynamic_libs = ['libtier0.so', 'libvstdlib.so']
Expand Down
23 changes: 20 additions & 3 deletions core/AMBuilder
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os

project = SM.HL2Project(builder, 'sourcemod')

project.sources += [
'MenuStyle_Valve.cpp',
'logic_bridge.cpp',
Expand Down Expand Up @@ -37,7 +38,6 @@ project.sources += [
'MenuStyle_Radio.cpp',
'sm_autonatives.cpp',
'ConsoleDetours.cpp',
'vprof_tool.cpp',
'smn_commandline.cpp',
'GameHooks.cpp',
]
Expand All @@ -63,13 +63,19 @@ for sdk_name in SM.sdks:
os.path.join(sdk.path, 'public', 'engine', 'protobuf'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf')
]
elif sdk.name == 'blade':
compiler.cxxincludes += [
os.path.join(sdk.path, 'common', 'protobuf-2.5.0', 'src'),
os.path.join(sdk.path, 'public', 'engine', 'protobuf'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'berimbau', 'protobuf')
]

if compiler.like('msvc'):
compiler.defines += ['_ALLOW_KEYWORD_MACROS']
if builder.target.platform == 'linux':
compiler.postlink += ['-lpthread', '-lrt']

if sdk.name == 'csgo':
if sdk.name in ['csgo', 'blade']:
if builder.target.platform == 'linux':
if arch == 'x86':
lib_path = os.path.join(sdk.path, 'lib', 'linux32', 'release', 'libprotobuf.a')
Expand Down Expand Up @@ -97,17 +103,28 @@ for sdk_name in SM.sdks:
lib_path = os.path.join(sdk.path, 'lib', 'win32', 'release', 'vs' + vs_year, 'libprotobuf.lib')
compiler.linkflags.insert(0, binary.Dep(lib_path))

if sdk.name == 'csgo':
if sdk.name in ['csgo', 'blade']:
binary.sources += ['smn_protobuf.cpp']
else:
binary.sources += ['smn_bitbuffer.cpp']

if sdk.name != 'blade':
binary.sources += [
'vprof_tool.cpp',
]

if sdk.name == 'csgo':
binary.sources += [
os.path.join(sdk.path, 'public', 'engine', 'protobuf', 'netmessages.pb.cc'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessages.pb.cc'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessage_helpers.cpp'),
]
elif sdk.name == 'blade':
binary.sources += [
os.path.join(sdk.path, 'public', 'engine', 'protobuf', 'netmessages.pb.cc'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'berimbau', 'protobuf', 'berimbau_usermessages.pb.cc'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'berimbau', 'protobuf', 'berimbau_usermessage_helpers.cpp'),
]

SM.binaries += builder.Add(project)

15 changes: 8 additions & 7 deletions core/HalfLife2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@

#if SOURCE_ENGINE == SE_CSGO
#include <cstrike15_usermessages.pb.h>
#elif SOURCE_ENGINE == SE_BLADE
#include <berimbau_usermessages.pb.h>
#endif


typedef ICommandLine *(*FakeGetCommandLine)();

#define TIER0_NAME FORMAT_SOURCE_BIN_NAME("tier0")
Expand Down Expand Up @@ -516,7 +517,7 @@ bool CHalfLife2::TextMsg(int client, int dest, const char *msg)
char buffer[253];
ke::SafeSprintf(buffer, sizeof(buffer), "%s\1\n", msg);

#if SOURCE_ENGINE == SE_CSGO
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE
CCSUsrMsg_SayText *pMsg;
if ((pMsg = (CCSUsrMsg_SayText *)g_UserMsgs.StartProtobufMessage(m_SayTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
{
Expand All @@ -543,7 +544,7 @@ bool CHalfLife2::TextMsg(int client, int dest, const char *msg)
}
}

#if SOURCE_ENGINE == SE_CSGO
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE
CCSUsrMsg_TextMsg *pMsg;
if ((pMsg = (CCSUsrMsg_TextMsg *)g_UserMsgs.StartProtobufMessage(m_MsgTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
{
Expand Down Expand Up @@ -580,7 +581,7 @@ bool CHalfLife2::HintTextMsg(int client, const char *msg)
{
cell_t players[] = {client};

#if SOURCE_ENGINE == SE_CSGO
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE
CCSUsrMsg_HintText *pMsg;
if ((pMsg = (CCSUsrMsg_HintText *)g_UserMsgs.StartProtobufMessage(m_HinTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
{
Expand Down Expand Up @@ -610,7 +611,7 @@ bool CHalfLife2::HintTextMsg(int client, const char *msg)

bool CHalfLife2::HintTextMsg(cell_t *players, int count, const char *msg)
{
#if SOURCE_ENGINE == SE_CSGO
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE
CCSUsrMsg_HintText *pMsg;
if ((pMsg = (CCSUsrMsg_HintText *)g_UserMsgs.StartProtobufMessage(m_HinTextMsg, players, count, USERMSG_RELIABLE)) == NULL)
{
Expand Down Expand Up @@ -645,7 +646,7 @@ bool CHalfLife2::ShowVGUIMenu(int client, const char *name, KeyValues *data, boo
int count = 0;
cell_t players[] = {client};

#if SOURCE_ENGINE == SE_CSGO
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE
CCSUsrMsg_VGUIMenu *pMsg;
if ((pMsg = (CCSUsrMsg_VGUIMenu *)g_UserMsgs.StartProtobufMessage(m_VGUIMenu, players, 1, USERMSG_RELIABLE)) == NULL)
{
Expand All @@ -670,7 +671,7 @@ bool CHalfLife2::ShowVGUIMenu(int client, const char *name, KeyValues *data, boo
SubKey = data->GetFirstSubKey();
}

#if SOURCE_ENGINE == SE_CSGO
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE
pMsg->set_name(name);
pMsg->set_show(show);

Expand Down
6 changes: 4 additions & 2 deletions core/MenuStyle_Radio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@

#if SOURCE_ENGINE == SE_CSGO
#include <game/shared/csgo/protobuf/cstrike15_usermessages.pb.h>
#elif SOURCE_ENGINE == SE_BLADE
#include <game/shared/berimbau/protobuf/berimbau_usermessages.pb.h>
#endif

extern const char *g_RadioNumTable[];
Expand Down Expand Up @@ -174,7 +176,7 @@ void CRadioStyle::OnUserMessage(int msg_id, bf_write *bf, IRecipientFilter *pFil
{
int count = pFilter->GetRecipientCount();

#if SOURCE_ENGINE == SE_CSGO
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE
int c = ((CCSUsrMsg_ShowMenu &)msg).display_time();
#else
bf_read br(bf->GetBasePointer(), 3);
Expand Down Expand Up @@ -483,7 +485,7 @@ void CRadioMenuPlayer::Radio_Refresh()
time = menuHoldTime - (unsigned int)(gpGlobals->curtime - menuStartTime);
}

#if SOURCE_ENGINE == SE_CSGO
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE
// TODO: find what happens past 240 on CS:GO
CCSUsrMsg_ShowMenu *msg = (CCSUsrMsg_ShowMenu *)g_UserMsgs.StartProtobufMessage(g_ShowMenuId, players, 1, USERMSG_BLOCKHOOKS);
msg->set_bits_valid_slots(display_keys);
Expand Down
2 changes: 1 addition & 1 deletion core/PlayerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2365,7 +2365,7 @@ void CPlayer::Kick(const char *str)
}
else
{
#if SOURCE_ENGINE == SE_CSGO
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE
pClient->Disconnect(str);
#else
pClient->Disconnect("%s", str);
Expand Down
10 changes: 5 additions & 5 deletions core/UserMessagePBHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ class SMProtobufMessage

inline bool GetColor(const char *pszFieldName, Color *out)
{
#if SOURCE_ENGINE != SE_CSGO
#if SOURCE_ENGINE != SE_CSGO && SOURCE_ENGINE != SE_BLADE
return false;
#else
GETCHECK_FIELD();
Expand All @@ -837,7 +837,7 @@ class SMProtobufMessage

inline bool SetColor(const char *pszFieldName, const Color &value)
{
#if SOURCE_ENGINE != SE_CSGO
#if SOURCE_ENGINE != SE_CSGO && SOURCE_ENGINE != SE_BLADE
return false;
#else
GETCHECK_FIELD();
Expand All @@ -856,7 +856,7 @@ class SMProtobufMessage

inline bool GetRepeatedColor(const char *pszFieldName, int index, Color *out)
{
#if SOURCE_ENGINE != SE_CSGO
#if SOURCE_ENGINE != SE_CSGO && SOURCE_ENGINE != SE_BLADE
return false;
#else
GETCHECK_FIELD();
Expand All @@ -878,7 +878,7 @@ class SMProtobufMessage

inline bool SetRepeatedColor(const char *pszFieldName, int index, const Color &value)
{
#if SOURCE_ENGINE != SE_CSGO
#if SOURCE_ENGINE != SE_CSGO && SOURCE_ENGINE != SE_BLADE
return false;
#else
GETCHECK_FIELD();
Expand All @@ -898,7 +898,7 @@ class SMProtobufMessage

inline bool AddColor(const char *pszFieldName, const Color &value)
{
#if SOURCE_ENGINE != SE_CSGO
#if SOURCE_ENGINE != SE_CSGO && SOURCE_ENGINE != SE_BLADE
return false;
#else
GETCHECK_FIELD();
Expand Down

0 comments on commit 0ac7875

Please sign in to comment.