[Proxy]: Fix

This commit is contained in:
FutureRave 2022-11-21 23:08:06 +00:00
parent c7ed592010
commit d2686071aa
No known key found for this signature in database
GPG Key ID: 22F9079C86CFAB31
2 changed files with 14 additions and 14 deletions

View File

@ -162,31 +162,31 @@ namespace Steam
Interface clientUtils(Proxy::ClientEngine->GetIClientUtils(Proxy::SteamPipe));
clientUtils.invoke<void>("SetAppIDForCurrentPipe", Proxy::AppId, false);
char ourPath[MAX_PATH] = {0};
char ourPath[MAX_PATH]{};
GetModuleFileNameA(GetModuleHandle(nullptr), ourPath, sizeof(ourPath));
char ourDirectory[MAX_PATH] = { 0 };
char ourDirectory[MAX_PATH]{};
GetCurrentDirectoryA(sizeof(ourDirectory), ourDirectory);
std::string cmdline = ::Utils::String::VA("\"%s\" -proc %d", ourPath, GetCurrentProcessId());
const auto* cmdline = ::Utils::String::VA("\"%s\" -proc %d", ourPath, GetCurrentProcessId());
// As of 02/19/2017, the SpawnProcess method doesn't require the app id anymore,
// but only for those who participate in the beta.
// Therefore we have to check how many bytes the method expects as arguments
// and adapt our call accordingly!
size_t expectedParams = Proxy::ClientUser.paramSize("SpawnProcess");
const auto expectedParams = Proxy::ClientUser.paramSize("SpawnProcess");
if (expectedParams == 40) // Release
{
Proxy::ClientUser.invoke<bool>("SpawnProcess", ourPath, cmdline.data(), ourDirectory, gameID.bits, mod.data(), Proxy::AppId, 0, 0);
Proxy::ClientUser.invoke<bool>("SpawnProcess", ourPath, cmdline, ourDirectory, gameID.bits, mod.data(), Proxy::AppId, 0, 0, 0);
}
else if (expectedParams == 36) // Beta
{
Proxy::ClientUser.invoke<bool>("SpawnProcess", ourPath, cmdline.data(), ourDirectory, gameID.bits, mod.data(), Proxy::AppId, 0, 0);
Proxy::ClientUser.invoke<bool>("SpawnProcess", ourPath, cmdline, ourDirectory, gameID.bits, mod.data(), Proxy::AppId, 0, 0);
}
else if (expectedParams == 48) // Legacy, expects VAC blob
{
char blob[8] = { 0 };
Proxy::ClientUser.invoke<bool>("SpawnProcess", blob, 0, ourPath, cmdline.data(), 0, ourDirectory, gameID.bits, Proxy::AppId, mod.data(), 0, 0);
Proxy::ClientUser.invoke<bool>("SpawnProcess", blob, 0, ourPath, cmdline, 0, ourDirectory, gameID.bits, Proxy::AppId, mod.data(), 0, 0);
}
else
{
@ -260,7 +260,7 @@ namespace Steam
Proxy::Callbacks.erase(callId);
}
void Proxy::RunCallback(int32_t callId, void* data, size_t /*size*/)
void Proxy::RunCallback(int32_t callId, void* data, std::size_t /*size*/)
{
std::lock_guard<std::recursive_mutex> _(Proxy::CallMutex);

View File

@ -169,8 +169,8 @@ namespace Steam
return T();
}
size_t argc = method.second;
constexpr size_t passedArgc = Interface::AddSizes<sizeof(Args)...>::value;
std::size_t argc = method.second;
constexpr std::size_t passedArgc = Interface::AddSizes<sizeof(Args)...>::value;
if(passedArgc != argc)
{
OutputDebugStringA(::Utils::String::VA("Steam interface arguments for method %s do not match (expected %d bytes, but got %d bytes)!\n", methodName.data(), argc, passedArgc));
@ -185,7 +185,7 @@ namespace Steam
return this->interfacePtr != nullptr;
}
size_t paramSize(const std::string& methodName)
std::size_t paramSize(const std::string& methodName)
{
auto method = this->getMethod(methodName);
return method.second;
@ -222,9 +222,9 @@ namespace Steam
private:
std::string buffer;
inline void packBytes(const void* bytes, size_t size)
inline void packBytes(const void* bytes, std::size_t size)
{
this->buffer.append(reinterpret_cast<const char*>(bytes), size);
this->buffer.append(static_cast<const char*>(bytes), size);
}
inline void packDataType(uint8_t type)
@ -358,7 +358,7 @@ namespace Steam
static std::function<SteamFreeLastCallbackFn> SteamFreeLastCallback;
static std::function<SteamGetAPICallResultFn> SteamGetAPICallResult;
static void RunCallback(int32_t callId, void* data, size_t size);
static void RunCallback(int32_t callId, void* data, std::size_t size);
static void UnregisterCalls();
static void LaunchWatchGuard();