Skip to content

Commit

Permalink
Disable spt_con_notify for Steampipe - causing weird crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
lipsanen committed Nov 8, 2024
1 parent bf63dcd commit 64c099e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
15 changes: 10 additions & 5 deletions spt/features/con_notify.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "stdafx.hpp"
#include "game_detection.hpp"
#include "..\feature.hpp"
#include "visualizations\imgui\imgui_interface.hpp"

Expand Down Expand Up @@ -49,7 +50,14 @@ static ConNotifyFeature spt_con_notify;

bool ConNotifyFeature::ShouldLoadFeature()
{
return true;
if (utils::DoesGameLookLikeSteampipe())
{
return false;
}
else
{
return true;
}
}

void ConNotifyFeature::InitHooks()
Expand Down Expand Up @@ -83,15 +91,12 @@ void ConNotifyFeature::LoadFeature()
return;\
} \
\
const char* devVal = developer->GetString(); \
char* oldDev = new char[strlen(devVal) + 1]; \
strcpy(oldDev, devVal); \
auto oldDev = developer->GetFloat(); \
developer->SetValue(true); \
\
spt_con_notify.ORIG_##funcName(__VA_ARGS__); \
\
developer->SetValue(oldDev); \
delete[] oldDev; \
return;\
}

Expand Down
9 changes: 9 additions & 0 deletions spt/utils/game_detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ namespace utils
return result;
}

bool DoesGameLookLikeSteampipe()
{
#ifdef SSDK2013
return true;
#else
return false;
#endif
}

bool DoesGameLookLikeEstranged()
{
static bool cached = false, result = false;
Expand Down
1 change: 1 addition & 0 deletions spt/utils/game_detection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace utils
bool DoesGameLookLikeBMSRetail();
bool DoesGameLookLikeBMSLatest();
bool DoesGameLookLikeBMSMod();
bool DoesGameLookLikeSteampipe();
bool DoesGameLookLikeEstranged();
int DateToBuildNumber(const char* date_str);
int GetBuildNumber();
Expand Down

0 comments on commit 64c099e

Please sign in to comment.