Proper gamemode redirection

Added fix for zombieMode & survival.
Made the game inject as lib again.
Patched a steambit check for mp
This commit is contained in:
Joelrau 2021-01-03 03:29:11 +02:00
parent 2e22126560
commit 51bcaefa7e
4 changed files with 17 additions and 7 deletions

View File

@ -58,6 +58,7 @@ namespace auth
else
{
utils::hook::jump(0x140538920, 0x140538976);
utils::hook::jump(0x140009801, 0x140009B48);
utils::hook::jump(0x140009AEB, 0x140009B48);
utils::hook::jump(0x14053995F, 0x1405399A0);
utils::hook::jump(0x140539E70, 0x140539EB6);

View File

@ -7,7 +7,7 @@ namespace redirect
{
namespace
{
void launch_complementary_game(const bool singleplayer)
void launch_complementary_game(const bool singleplayer, const std::string& mode = "")
{
const utils::nt::library self;
@ -18,8 +18,9 @@ namespace redirect
ZeroMemory(&process_info, sizeof(process_info));
startup_info.cb = sizeof(startup_info);
auto* arguments = const_cast<char*>(utils::string::va("%s%s", self.get_path().data(),
(singleplayer ? " -singleplayer" : " -multiplayer")));
auto* arguments = const_cast<char*>(utils::string::va("%s%s%s", self.get_path().data(),
(singleplayer ? " -singleplayer" : " -multiplayer"),
(mode.empty() ? "" : (" +"s + mode).data())));
CreateProcessA(self.get_path().data(), arguments, nullptr, nullptr, false, NULL, nullptr, nullptr,
&startup_info, &process_info);
@ -44,7 +45,15 @@ namespace redirect
}
else if (utils::string::starts_with(file, "steam://run/209660/"))
{
launch_complementary_game(false);
std::string mode(file);
mode.erase(0, 20);
if (!mode.empty())
{
mode = utils::string::replace(mode, "%2b", ""); // '+'
mode = utils::string::replace(mode, "%2", " "); // ' '
}
launch_complementary_game(false, mode);
return HINSTANCE(33);
}

View File

@ -7,7 +7,7 @@
#pragma comment(linker, "/stack:0x1000000")
#ifdef INJECT_HOST_AS_LIB
#pragma comment(linker, "/base:0x150000000")
#pragma comment(linker, "/base:0x152000000")
#else
#pragma comment(linker, "/base:0x140000000")
#endif

View File

@ -1,9 +1,9 @@
#pragma once
#define BINARY_PAYLOAD_SIZE 0x15000000
#define BINARY_PAYLOAD_SIZE 0x12000000
// Decide whether to load the game as lib or to inject it
//#define INJECT_HOST_AS_LIB
#define INJECT_HOST_AS_LIB
#pragma warning(push)
#pragma warning(disable: 4100)