Skip to content

Commit

Permalink
disable some experimental stuff for release builds; make assert alway…
Browse files Browse the repository at this point in the history
…s active
  • Loading branch information
sigsegv-mvm committed Jan 19, 2016
1 parent 2612cc3 commit b91e93e
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 6 deletions.
6 changes: 5 additions & 1 deletion AMBuildScript
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class ExtensionConfig(object):

# Optimization
if builder.options.opt == '1':
cxx.defines += ['NDEBUG']
#cxx.defines += ['NDEBUG']
if cxx.like('gcc'):
cxx.cflags += ['-O3']
elif cxx.like('msvc'):
Expand All @@ -240,6 +240,10 @@ class ExtensionConfig(object):
cxx.defines += ['DEBUG', '_DEBUG']
if cxx.like('msvc'):
cxx.cflags += ['/Od', '/RTC1']

# Experimental features
if builder.options.experimental == '1':
cxx.defines += ['EXPERIMENTAL']

# This needs to be after our optimization flags which could otherwise disable it.
if cxx.vendor == 'msvc':
Expand Down
4 changes: 2 additions & 2 deletions MSVC14/sigsegv.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<AdditionalOptions>/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..;..\sdk;$(SOURCEMOD18);$(SOURCEMOD18)\public;$(SOURCEMOD18)\public\amtl\include;$(SOURCEMOD18)\public\extensions;$(SOURCEMOD18)\sourcepawn\include;$(HL2SDKOBVALVE)\common;$(HL2SDKOBVALVE)\game\shared;$(HL2SDKOBVALVE)\public;$(HL2SDKOBVALVE)\public\engine;$(HL2SDKOBVALVE)\public\game\server;$(HL2SDKOBVALVE)\public\tier0;$(HL2SDKOBVALVE)\public\tier1;$(HL2SDKOBVALVE)\public\toolframework;$(HL2SDKOBVALVE)\public\vstdlib;$(MMSOURCE110)\core;$(MMSOURCE110)\core\sourcehook;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=7;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=7;EXPERIMENTAL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
Expand Down Expand Up @@ -100,7 +100,7 @@ copy $(TargetDir)\sigsegv.ext.2.tf2.pdb $(SolutionDir)\..\build\package\addons\s
<AdditionalOptions>/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12</AdditionalOptions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..;..\sdk;$(SOURCEMOD18);$(SOURCEMOD18)\public;$(SOURCEMOD18)\public\amtl\include;$(SOURCEMOD18)\public\extensions;$(SOURCEMOD18)\sourcepawn\include;$(HL2SDKOBVALVE)\common;$(HL2SDKOBVALVE)\game\shared;$(HL2SDKOBVALVE)\public;$(HL2SDKOBVALVE)\public\engine;$(HL2SDKOBVALVE)\public\game\server;$(HL2SDKOBVALVE)\public\tier0;$(HL2SDKOBVALVE)\public\tier1;$(HL2SDKOBVALVE)\public\toolframework;$(HL2SDKOBVALVE)\public\vstdlib;$(MMSOURCE110)\core;$(MMSOURCE110)\core\sourcehook;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=7;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=7;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
Expand Down
24 changes: 23 additions & 1 deletion addr/addr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void IAddr::Init()

if (result) {
this->m_State = State::OK;
DevMsg("IAddr::Init \"%s\" OK 0x%08x\n", this->GetName(), this->m_iAddr);
// DevMsg("IAddr::Init \"%s\" OK 0x%08x\n", this->GetName(), this->m_iAddr);
} else {
this->m_State = State::FAIL;
DevMsg("IAddr::Init \"%s\" FAIL\n", this->GetName());
Expand Down Expand Up @@ -84,6 +84,28 @@ void *AddrManager::GetAddr(const char *name)
}


static ConCommand ccmd_addrlist("sigsegv_addrlist", &AddrManager::CC_ListAddrs,
"List addresses and show their status", FCVAR_NONE);
void AddrManager::CC_ListAddrs(const CCommand& cmd)
{
for (const auto& pair : s_Addrs) {
const IAddr *addr = pair.second;

switch (addr->GetState()) {
case IAddr::State::INITIAL:
Msg("%-8s %s\n", "INITIAL", addr->GetName());
break;
case IAddr::State::OK:
Msg("%08x %s\n", addr->GetAddr(), addr->GetName());
break;
case IAddr::State::FAIL:
Msg("%-8s %s\n", "FAIL", addr->GetName());
break;
}
}
}


bool IAddr_Sym::FindAddrLinux(uintptr_t& addr) const
{
void *sym_addr = LibMgr::FindSym(this->GetLibrary(), this->GetSymbol());
Expand Down
2 changes: 2 additions & 0 deletions addr/addr.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class AddrManager

static void *GetAddr(const char *name);

static void CC_ListAddrs(const CCommand& cmd);

private:
AddrManager() {}

Expand Down
1 change: 1 addition & 0 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <functional>
#include <memory>
#include <string>
#include <utility>

/* STL */
#include <list>
Expand Down
1 change: 1 addition & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
builder.options.add_option('--sm-path', type=str, dest='sm_path', default=None, help='Path to SourceMod')
builder.options.add_option('--enable-debug', action='store_const', const='1', dest='debug', help='Enable debugging symbols')
builder.options.add_option('--enable-optimize', action='store_const', const='1', dest='opt', help='Enable optimization')
builder.options.add_option('--enable-experimental', action='store_const', const='1', dest='experimental', help='Enable experimental/incomplete features')
builder.options.add_option('-s', '--sdks', default='all', dest='sdks', help='Build against specified SDKs; valid args are "all", "present", or comma-delimited list of engine names (default: %default)')

builder.Configure()
2 changes: 2 additions & 0 deletions gameconf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ static const char *const configs[] = {
"sigsegv/sigsegv.vtable",
"sigsegv/sigsegv.datamap",
"sigsegv/sigsegv.globals",
#ifdef EXPERIMENTAL
"sigsegv/sigsegv.nextbot.action",
"sigsegv/sigsegv.nextbot.contextualquery",
"sigsegv/sigsegv.nextbot.eventresponder",
"sigsegv/sigsegv.nextbot.player",
#endif
"sigsegv/sigsegv.population",
"sigsegv/sigsegv.tfbot",
"sigsegv/sigsegv.tfbot.behavior",
Expand Down
4 changes: 4 additions & 0 deletions mod/debug_airblastbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "util/util.h"


#ifdef EXPERIMENTAL

static ConVar cvar_duration("sigsegv_debug_airblastbox_duration", "0.1", FCVAR_NOTIFY,
"Debug: box draw duration");

Expand Down Expand Up @@ -62,3 +64,5 @@ static ConVar cvar_enable("sigsegv_debug_airblastbox_enable", "0", FCVAR_NOTIFY,
ConVarRef var(pConVar);
s_Mod.SetEnabled(var.GetBool());
});

#endif
3 changes: 3 additions & 0 deletions mod/debug_deflectcylinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "util/util.h"


#ifdef EXPERIMENTAL

static ConVar cvar_duration("sigsegv_debug_deflectcylinder_duration", "0.1", FCVAR_NOTIFY,
"Debug: cylinder draw duration");

Expand Down Expand Up @@ -148,3 +150,4 @@ static ConVar cvar_enable("sigsegv_debug_deflectcylinder_enable", "0", FCVAR_NOT
s_Mod.SetEnabled(var.GetBool());
});

#endif
3 changes: 3 additions & 0 deletions mod/debug_ehsphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "util/util.h"


#ifdef EXPERIMENTAL

static ConVar cvar_duration("sigsegv_debug_ehsphere_duration", "0.5", FCVAR_NOTIFY,
"Debug: EH sphere draw duration");

Expand Down Expand Up @@ -66,3 +68,4 @@ static ConVar cvar_enable("sigsegv_debug_ehsphere_enable", "0", FCVAR_NOTIFY,
s_Mod.SetEnabled(var.GetBool());
});

#endif
4 changes: 4 additions & 0 deletions mod/mod_robottickle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "stub/stub.h"


#ifdef EXPERIMENTAL

DETOUR_DECL_MEMBER(bool, CTFPlayer_CanBeForcedToLaugh)
{

Expand Down Expand Up @@ -34,3 +36,5 @@ static CMod_RobotTickle s_Mod;
s_Mod.SetEnabled(var.GetBool());
});
*/

#endif
4 changes: 4 additions & 0 deletions mod/mod_stickypusher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "re/path.h"


#ifdef EXPERIMENTAL

constexpr int MISSION_PUSHSTICKIES = 7;


Expand Down Expand Up @@ -137,3 +139,5 @@ static ConVar cvar_enable("sigsegv_stickypusher_enable", "0", FCVAR_NOTIFY,
ConVarRef var(pConVar);
s_Mod.SetEnabled(var.GetBool());
});

#endif
2 changes: 1 addition & 1 deletion sdk/smsdk_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
/* Basic information exposed publicly */
#define SMEXT_CONF_NAME "sigsegv MvM"
#define SMEXT_CONF_DESCRIPTION "sigsegv's Mann vs Machine mods"
#define SMEXT_CONF_VERSION "2016.01.08"
#define SMEXT_CONF_VERSION "2016.01.19"
#define SMEXT_CONF_AUTHOR "sigsegv"
#define SMEXT_CONF_URL "http://sigpipe.info/"
#define SMEXT_CONF_LOGTAG "SIGSEGV"
Expand Down
2 changes: 1 addition & 1 deletion util/scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void IScan::DoScan()

int incr = (fwd ? align : -align);

DevMsg("IScan::DoScan: ptr 0x%08x, end 0x%08x, incr %c0x%08x\n", (uintptr_t)ptr, (uintptr_t)end, (fwd ? '+' : '-'), align);
// DevMsg("IScan::DoScan: ptr 0x%08x, end 0x%08x, incr %c0x%08x\n", (uintptr_t)ptr, (uintptr_t)end, (fwd ? '+' : '-'), align);

/* use an array because std::vector is horrendously slow here */
int num_scanners = this->m_Scanners.size();
Expand Down

0 comments on commit b91e93e

Please sign in to comment.