Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Commit

Permalink
Launch hl2.exe directly instead of through steam, since steam doesn't…
Browse files Browse the repository at this point in the history
… pass all arguments from steam://run/ urls to the game anymore
  • Loading branch information
PazerOP committed Jun 25, 2021
1 parent 963035d commit bb535fd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion submodules/mh_stuff
2 changes: 2 additions & 0 deletions tf2_bot_detector/Platform/Windows/Processes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ void tf2_bot_detector::Processes::Launch(const std::filesystem::path& executable
void tf2_bot_detector::Processes::Launch(const std::filesystem::path& executable,
const std::string_view& args, bool elevated)
{
DebugLog("ShellExecute({}, {}) (elevated = {})", executable, args, elevated);

const auto cmdLineWide = mh::change_encoding<wchar_t>(args);

const auto result = ShellExecuteW(
Expand Down
15 changes: 9 additions & 6 deletions tf2_bot_detector/SetupFlow/TF2CommandLinePage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,15 @@ bool TF2CommandLinePage::TF2CommandLine::IsPopulated() const
return true;
}

static void OpenTF2(const std::string_view& rconPassword, uint16_t rconPort)
static void OpenTF2(const Settings& settings, const std::string_view& rconPassword, uint16_t rconPort)
{
std::string url;
url << "steam://run/440//"
const std::filesystem::path hl2Path = settings.GetTFDir() / ".." / "hl2.exe";

std::string args;
args <<
" -game tf"

This comment has been minimized.

Copy link
@mastercoms

mastercoms Jun 25, 2021

The appconfig for this is -game tf -steam. https://steamdb.info/app/440/config/

This comment has been minimized.

Copy link
@UAVXP

UAVXP Jun 25, 2021

The appconfig for this is -game tf -steam. https://steamdb.info/app/440/config/

I think @PazerOP has fixed this in the newest commit

This comment has been minimized.

Copy link
@mastercoms

mastercoms Jun 25, 2021

Yes but technically, it should be retrieved from the Steam/appcache/appinfo.vdf binary VDF file, rather than manually input.

This comment has been minimized.

Copy link
@PazerOP

PazerOP Jun 26, 2021

Author Owner

I don't think it's worth the time to implement something (or find a library and add it) for this binary vdf format when these arguments work fine.

" -usercon"
" -high"
" -high" // TODO: make this an option
" +developer 1 +alias developer"
" +contimes 0 +alias contimes" // the text in the top left when developer >= 1
" +ip 0.0.0.0 +alias ip"
Expand All @@ -153,7 +156,7 @@ static void OpenTF2(const std::string_view& rconPassword, uint16_t rconPort)
" -conclearlog"
;

Shell::OpenURL(std::move(url));
Processes::Launch(hl2Path, args);
}

TF2CommandLinePage::RCONClientData::RCONClientData(std::string pwd, uint16_t port) :
Expand Down Expand Up @@ -246,7 +249,7 @@ void TF2CommandLinePage::DrawLaunchTF2Button(const DrawState& ds)
m_Data.m_RandomRCONPassword = GenerateRandomRCONPassword();
m_Data.m_RandomRCONPort = ds.m_Settings->m_TF2Interface.GetRandomRCONPort();

OpenTF2(m_Data.m_RandomRCONPassword, m_Data.m_RandomRCONPort);
OpenTF2(*ds.m_Settings, m_Data.m_RandomRCONPassword, m_Data.m_RandomRCONPort);
m_Data.m_LastTF2LaunchTime = curTime;
}

Expand Down

0 comments on commit bb535fd

Please sign in to comment.