[Friends] Add friend handler
This commit is contained in:
parent
0221d24f07
commit
4cf2ca270c
65
src/Worker/Handlers/Friends.cpp
Normal file
65
src/Worker/Handlers/Friends.cpp
Normal file
@ -0,0 +1,65 @@
|
||||
#include "STDInclude.hpp"
|
||||
|
||||
namespace Worker
|
||||
{
|
||||
int ProcessId;
|
||||
|
||||
int __stdcall EntryPoint(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, char* /*lpCmdLine*/, int /*nCmdShow*/)
|
||||
{
|
||||
Runner runner(Worker::ProcessId);
|
||||
runner.run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
if(!Steam::Proxy::Inititalize())
|
||||
{
|
||||
printf("Failed to initialize worker!\n");
|
||||
ExitProcess(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
SetConsoleTitleA("IW4x: Worker");
|
||||
#else
|
||||
FreeConsole();
|
||||
#endif
|
||||
|
||||
Utils::Hook(0x6BABA1, Worker::EntryPoint, HOOK_CALL).install()->quick();
|
||||
}
|
||||
}
|
||||
|
||||
void Uninitialize()
|
||||
{
|
||||
Steam::Proxy::Uninititalize();
|
||||
}
|
||||
|
||||
bool ParseWorkerFlag()
|
||||
{
|
||||
char* command = "-parent ";
|
||||
char* parentProc = strstr(GetCommandLineA(), command);
|
||||
|
||||
if (parentProc)
|
||||
{
|
||||
parentProc += strlen(command);
|
||||
Worker::ProcessId = atoi(parentProc);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsWorker()
|
||||
{
|
||||
static Utils::Value<bool> flag;
|
||||
|
||||
if (!flag.isValid())
|
||||
{
|
||||
flag.set(Worker::ParseWorkerFlag());
|
||||
}
|
||||
|
||||
return flag.get();
|
||||
}
|
||||
}
|
11
src/Worker/Handlers/Friends.hpp
Normal file
11
src/Worker/Handlers/Friends.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
namespace Worker
|
||||
{
|
||||
void Initialize();
|
||||
void Uninitialize();
|
||||
|
||||
bool IsWorker();
|
||||
}
|
||||
|
||||
#include "Runner.hpp"
|
Loading…
Reference in New Issue
Block a user