Fix Steam (SpawnProcess) and remove runner
This commit is contained in:
parent
3fff0f5c07
commit
a3bbe23ada
32
premake5.lua
32
premake5.lua
@ -296,20 +296,6 @@ resincludedirs {"$(ProjectDir)src"}
|
|||||||
|
|
||||||
dependencies.imports()
|
dependencies.imports()
|
||||||
|
|
||||||
project "runner"
|
|
||||||
kind "WindowedApp"
|
|
||||||
language "C++"
|
|
||||||
|
|
||||||
files {"./src/runner/**.rc", "./src/runner/**.hpp", "./src/runner/**.cpp", "./src/runner/resources/**.*"}
|
|
||||||
|
|
||||||
includedirs {"./src/runner", "./src/common", "%{prj.location}/src"}
|
|
||||||
|
|
||||||
resincludedirs {"$(ProjectDir)src"}
|
|
||||||
|
|
||||||
links {"common"}
|
|
||||||
|
|
||||||
dependencies.imports()
|
|
||||||
|
|
||||||
project "client"
|
project "client"
|
||||||
kind "ConsoleApp"
|
kind "ConsoleApp"
|
||||||
language "C++"
|
language "C++"
|
||||||
@ -327,7 +313,7 @@ includedirs {"./src/client", "./src/common", "%{prj.location}/src"}
|
|||||||
|
|
||||||
resincludedirs {"$(ProjectDir)src"}
|
resincludedirs {"$(ProjectDir)src"}
|
||||||
|
|
||||||
dependson {"tlsdll", "runner"}
|
dependson {"tlsdll"}
|
||||||
|
|
||||||
links {"common"}
|
links {"common"}
|
||||||
|
|
||||||
@ -370,21 +356,5 @@ links {"common"}
|
|||||||
|
|
||||||
resincludedirs {"$(ProjectDir)src"}
|
resincludedirs {"$(ProjectDir)src"}
|
||||||
|
|
||||||
project "runner"
|
|
||||||
kind "WindowedApp"
|
|
||||||
language "C++"
|
|
||||||
|
|
||||||
files {"./src/runner/**.rc", "./src/runner/**.hpp", "./src/runner/**.cpp", "./src/runner/resources/**.*"}
|
|
||||||
|
|
||||||
includedirs {"./src/runner", "./src/common", "%{prj.location}/src"}
|
|
||||||
|
|
||||||
links {"common"}
|
|
||||||
|
|
||||||
resincludedirs {"$(ProjectDir)src"}
|
|
||||||
|
|
||||||
links {"common"}
|
|
||||||
|
|
||||||
dependencies.imports()
|
|
||||||
|
|
||||||
group "Dependencies"
|
group "Dependencies"
|
||||||
dependencies.projects()
|
dependencies.projects()
|
@ -18,8 +18,6 @@ namespace steam_proxy
|
|||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
utils::binary_resource runner_file(RUNNER, "runner.exe");
|
|
||||||
|
|
||||||
utils::nt::library steam_client_module_{};
|
utils::nt::library steam_client_module_{};
|
||||||
#ifdef LOAD_STEAM_OVERLAY
|
#ifdef LOAD_STEAM_OVERLAY
|
||||||
utils::nt::library steam_overlay_module_{};
|
utils::nt::library steam_overlay_module_{};
|
||||||
@ -84,8 +82,7 @@ namespace steam_proxy
|
|||||||
steam_pipe_ = steam_client_module_.invoke<steam::HSteamPipe>("Steam_CreateSteamPipe");
|
steam_pipe_ = steam_client_module_.invoke<steam::HSteamPipe>("Steam_CreateSteamPipe");
|
||||||
global_user_ = steam_client_module_.invoke<steam::HSteamUser>(
|
global_user_ = steam_client_module_.invoke<steam::HSteamUser>(
|
||||||
"Steam_ConnectToGlobalUser", steam_pipe_);
|
"Steam_ConnectToGlobalUser", steam_pipe_);
|
||||||
client_user_ = client_engine_.invoke<void*>(8, steam_pipe_, global_user_);
|
client_user_ = client_engine_.invoke<void*>(8, steam_pipe_, global_user_); // GetIClientUser
|
||||||
// GetIClientUser
|
|
||||||
client_utils_ = client_engine_.invoke<void*>(14, steam_pipe_); // GetIClientUtils
|
client_utils_ = client_engine_.invoke<void*>(14, steam_pipe_); // GetIClientUtils
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,36 +144,23 @@ namespace steam_proxy
|
|||||||
|
|
||||||
client_utils_.invoke<void>("SetAppIDForCurrentPipe", app_id, false);
|
client_utils_.invoke<void>("SetAppIDForCurrentPipe", app_id, false);
|
||||||
|
|
||||||
char our_directory[MAX_PATH] = { 0 };
|
|
||||||
GetCurrentDirectoryA(sizeof(our_directory), our_directory);
|
|
||||||
|
|
||||||
const auto path = runner_file.get_extracted_file();
|
|
||||||
const std::string cmdline = utils::string::va("\"%s\" -proc %d", path.data(), GetCurrentProcessId());
|
|
||||||
|
|
||||||
steam::game_id game_id;
|
|
||||||
game_id.raw.type = 1; // k_EGameIDTypeGameMod
|
|
||||||
game_id.raw.app_id = app_id & 0xFFFFFF;
|
|
||||||
|
|
||||||
const auto* mod_id = "iw7";
|
|
||||||
game_id.raw.mod_id = *reinterpret_cast<const unsigned int*>(mod_id) | 0x80000000;
|
|
||||||
|
|
||||||
client_user_.invoke<bool>("SpawnProcess", path.data(), cmdline.data(), our_directory,
|
|
||||||
&game_id.bits, title.data(), 0, 0, 0);
|
|
||||||
|
|
||||||
return ownership_state::success;
|
return ownership_state::success;
|
||||||
}
|
}
|
||||||
|
|
||||||
ownership_state start_mod(const std::string& title, const size_t app_id)
|
ownership_state start_mod(const std::string& title, const size_t app_id)
|
||||||
{
|
{
|
||||||
__try
|
try
|
||||||
{
|
{
|
||||||
return start_mod_unsafe(title, app_id);
|
return start_mod_unsafe(title, app_id);
|
||||||
}
|
}
|
||||||
__except (EXCEPTION_EXECUTE_HANDLER)
|
catch (const std::exception& e)
|
||||||
{
|
{
|
||||||
do_cleanup();
|
do_cleanup();
|
||||||
return ownership_state::error;
|
printf("Steam: %s\n", e.what());
|
||||||
|
MessageBoxA(GetForegroundWindow(), e.what(), "Error", MB_ICONERROR);
|
||||||
|
TerminateProcess(GetCurrentProcess(), 1234);
|
||||||
}
|
}
|
||||||
|
return ownership_state::error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,8 +202,9 @@ namespace steam_proxy
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (const std::exception& e)
|
||||||
{
|
{
|
||||||
|
do_cleanup();
|
||||||
printf("Steam: %s\n", e.what());
|
printf("Steam: %s\n", e.what());
|
||||||
MessageBoxA(GetForegroundWindow(), e.what(), "Error", MB_ICONERROR);
|
MessageBoxA(GetForegroundWindow(), e.what(), "Error", MB_ICONERROR);
|
||||||
TerminateProcess(GetCurrentProcess(), 1234);
|
TerminateProcess(GetCurrentProcess(), 1234);
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#define DW_PLAYLISTS 303
|
#define DW_PLAYLISTS 303
|
||||||
|
|
||||||
#define TLS_DLL 304
|
#define TLS_DLL 304
|
||||||
#define RUNNER 305
|
|
||||||
|
|
||||||
#define ICON_IMAGE 306
|
#define ICON_IMAGE 306
|
||||||
|
|
||||||
|
@ -107,12 +107,6 @@ TLS_DLL RCDATA "../../build/bin/x64/Debug/tlsdll.dll"
|
|||||||
TLS_DLL RCDATA "../../build/bin/x64/Release/tlsdll.dll"
|
TLS_DLL RCDATA "../../build/bin/x64/Release/tlsdll.dll"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
RUNNER RCDATA "../../build/bin/x64/Debug/runner.exe"
|
|
||||||
#else
|
|
||||||
RUNNER RCDATA "../../build/bin/x64/Release/runner.exe"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ICON_IMAGE RCDATA "resources/icon.png"
|
ICON_IMAGE RCDATA "resources/icon.png"
|
||||||
|
|
||||||
#endif // English (United States) resources
|
#endif // English (United States) resources
|
||||||
|
Loading…
x
Reference in New Issue
Block a user