mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Since the SDK loader (loader.dll) is taking care of loading the DLL with the process, the SDK launcher no longer needs to inject it. Replaced call 'DetourCreateProcessWithDllsA' with 'CreateProcessA', and performed additional cleanup
65 lines
1.8 KiB
C++
65 lines
1.8 KiB
C++
#pragma once
|
|
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
|
|
|
class CLauncher
|
|
{
|
|
public:
|
|
CLauncher(const char* pszLoggerName)
|
|
{
|
|
m_pSurface = nullptr;
|
|
m_pLogger = spdlog::stdout_color_mt(pszLoggerName);
|
|
m_svCurrentDir = fs::current_path().u8string();
|
|
}
|
|
~CLauncher()
|
|
{
|
|
if (m_pSurface)
|
|
{
|
|
delete m_pSurface;
|
|
}
|
|
}
|
|
|
|
void AddLog(spdlog::level::level_enum nLevel, const char* szFormat, ...)
|
|
{
|
|
string svBuffer;
|
|
va_list args;
|
|
va_start(args, szFormat);
|
|
svBuffer = FormatV(szFormat, args);
|
|
va_end(args);
|
|
|
|
m_pLogger->log(nLevel, svBuffer);
|
|
m_pLogger->flush();
|
|
|
|
if (m_pSurface)
|
|
{
|
|
m_pSurface->m_LogList.push_back(LogList_t(nLevel, svBuffer));
|
|
m_pSurface->ConsoleListView()->SetVirtualListSize(static_cast<int32_t>(m_pSurface->m_LogList.size()));
|
|
m_pSurface->ConsoleListView()->Refresh();
|
|
}
|
|
}
|
|
|
|
void RunSurface();
|
|
void InitConsole();
|
|
void InitLogger();
|
|
|
|
int HandleCommandLine(int argc, char* argv[]);
|
|
int HandleInput();
|
|
|
|
bool CreateLaunchContext(eLaunchMode lMode, const char* szCommandLine = nullptr, const char* szConfig = nullptr);
|
|
void SetupLaunchContext(const char* szConfig, const char* szGameDll, const char* szCommandLine);
|
|
bool LaunchProcess() const;
|
|
|
|
CSurface* GetMainSurface() const { return m_pSurface; }
|
|
|
|
private:
|
|
CSurface* m_pSurface;
|
|
std::shared_ptr<spdlog::logger> m_pLogger;
|
|
|
|
string m_svGameDll;
|
|
string m_svCmdLine;
|
|
string m_svCurrentDir;
|
|
};
|
|
|
|
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam);
|
|
|
|
extern CLauncher* g_pLauncher;
|