Finished designer code

Work in progress gui launcher
This commit is contained in:
Kawe Mazidjatari 2022-05-23 19:14:12 +02:00
parent 4afc4e8d6a
commit 7225de1bd4
6 changed files with 836 additions and 190 deletions

View File

@ -0,0 +1,454 @@
#include "core/stdafx.h"
#include "basepanel.h"
#include <objidl.h>
#include "gdiplus.h"
#include "shellapi.h"
void CUIBasePanel::Init()
{
const INT WindowX = 800;
const INT WindowY = 350;
this->SuspendLayout();
this->SetAutoScaleDimensions({ 6, 13 });
this->SetAutoScaleMode(Forms::AutoScaleMode::Font);
this->SetText("SDK Launcher");
this->SetClientSize({ WindowX, WindowY });
this->SetFormBorderStyle(Forms::FormBorderStyle::FixedSingle);
this->SetStartPosition(Forms::FormStartPosition::CenterParent);
this->SetMinimizeBox(false);
this->SetMaximizeBox(false);
// #################################################################################################
//
// #################################################################################################
this->m_GameGroup = new UIX::UIXGroupBox();
this->m_GameGroup->SetSize({ 458, 84 });
this->m_GameGroup->SetLocation({ 12, 10 });
this->m_GameGroup->SetTabIndex(0);
this->m_GameGroup->SetText("Game");
this->m_GameGroup->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->AddControl(this->m_GameGroup);
this->m_GameGroupExt = new UIX::UIXGroupBox();
this->m_GameGroupExt->SetSize({ 458, 55 });
this->m_GameGroupExt->SetLocation({ 12, 93 });
this->m_GameGroupExt->SetTabIndex(0);
this->m_GameGroupExt->SetText("");
this->m_GameGroupExt->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->AddControl(this->m_GameGroupExt);
this->m_MapLabel = new UIX::UIXLabel();
this->m_MapLabel->SetSize({ 50, 25 });
this->m_MapLabel->SetLocation({ 365, 28 });
this->m_MapLabel->SetTabIndex(0);
this->m_MapLabel->SetText("Map");
this->m_MapLabel->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_MapLabel->SetTextAlign(Drawing::ContentAlignment::TopLeft);
this->m_GameGroup->AddControl(this->m_MapLabel);
this->m_MapCombo = new UIX::UIXComboBox();
this->m_MapCombo->SetSize({ 347, 25 });
this->m_MapCombo->SetLocation({ 15, 25 });
this->m_MapCombo->SetTabIndex(0);
this->m_MapCombo->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_MapCombo->SetDropDownStyle(Forms::ComboBoxStyle::DropDownList);
std::regex rgArchiveRegex{ R"([^_]*_(.*)(.bsp.pak000_dir).*)" };
std::smatch smRegexMatches;
for (const auto& dEntry : fs::directory_iterator("vpk"))
{
std::string svFileName = dEntry.path().string();
std::regex_search(svFileName, smRegexMatches, rgArchiveRegex);
if (smRegexMatches.size() > 0)
{
if (strcmp(smRegexMatches[1].str().c_str(), "frontend") == 0)
{
continue;
}
else if (strcmp(smRegexMatches[1].str().c_str(), "mp_common") == 0)
{
this->m_MapCombo->Items.Add("mp_lobby");
continue;
}
this->m_MapCombo->Items.Add(smRegexMatches[1].str().c_str());
}
}
this->m_GameGroup->AddControl(this->m_MapCombo);
this->m_PlaylistLabel = new UIX::UIXLabel();
this->m_PlaylistLabel->SetSize({ 50, 25 });
this->m_PlaylistLabel->SetLocation({ 365, 53 });
this->m_PlaylistLabel->SetTabIndex(0);
this->m_PlaylistLabel->SetText("Playlist");
this->m_PlaylistLabel->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_PlaylistLabel->SetTextAlign(Drawing::ContentAlignment::TopLeft);
this->m_GameGroup->AddControl(this->m_PlaylistLabel);
this->m_PlaylistCombo = new UIX::UIXComboBox();
this->m_PlaylistCombo->SetSize({ 347, 25 });
this->m_PlaylistCombo->SetLocation({ 15, 50 });
this->m_PlaylistCombo->SetTabIndex(0);
this->m_PlaylistCombo->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_PlaylistCombo->SetDropDownStyle(Forms::ComboBoxStyle::DropDownList);
this->m_GameGroup->AddControl(this->m_PlaylistCombo);
this->m_CheatsToggle = new UIX::UIXCheckBox();
this->m_CheatsToggle->SetSize({ 110, 18 });
this->m_CheatsToggle->SetLocation({ 15, 7 });
this->m_CheatsToggle->SetTabIndex(0);
this->m_CheatsToggle->SetText("Enable cheats");
this->m_CheatsToggle->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_GameGroupExt->AddControl(this->m_CheatsToggle);
this->m_DevelopmentToggle = new UIX::UIXCheckBox();
this->m_DevelopmentToggle->SetSize({ 150, 18 });
this->m_DevelopmentToggle->SetLocation({ 130, 7 });
this->m_DevelopmentToggle->SetTabIndex(0);
this->m_DevelopmentToggle->SetText("Enable development");
this->m_DevelopmentToggle->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_GameGroupExt->AddControl(this->m_DevelopmentToggle);
this->m_ConsoleToggle = new UIX::UIXCheckBox();
this->m_ConsoleToggle->SetSize({ 150, 18 });
this->m_ConsoleToggle->SetLocation({ 290, 7 });
this->m_ConsoleToggle->SetTabIndex(0);
this->m_ConsoleToggle->SetText("Show console");
this->m_ConsoleToggle->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_GameGroupExt->AddControl(this->m_ConsoleToggle);
this->m_ColorConsoleToggle = new UIX::UIXCheckBox();
this->m_ColorConsoleToggle->SetSize({ 105, 18 });
this->m_ColorConsoleToggle->SetLocation({ 15, 30 });
this->m_ColorConsoleToggle->SetTabIndex(0);
this->m_ColorConsoleToggle->SetChecked(true);
this->m_ColorConsoleToggle->SetText("Color console");
this->m_ColorConsoleToggle->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_GameGroupExt->AddControl(this->m_ColorConsoleToggle);
this->m_PlaylistFileTextBox = new UIX::UIXTextBox();
this->m_PlaylistFileTextBox->SetSize({ 178, 18 });
this->m_PlaylistFileTextBox->SetLocation({ 130, 30 });
this->m_PlaylistFileTextBox->SetTabIndex(0);
this->m_PlaylistFileTextBox->SetText("playlists_r5_patch.txt");
this->m_PlaylistFileTextBox->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_GameGroupExt->AddControl(this->m_PlaylistFileTextBox);
this->m_PlaylistFileLabel = new UIX::UIXLabel();
this->m_PlaylistFileLabel->SetSize({ 50, 18 });
this->m_PlaylistFileLabel->SetLocation({ 311, 32 });
this->m_PlaylistFileLabel->SetTabIndex(0);
this->m_PlaylistFileLabel->SetText("Playlist file");
this->m_PlaylistFileLabel->SetAnchor(Forms::AnchorStyles::Bottom | Forms::AnchorStyles::Left);
this->m_GameGroupExt->AddControl(this->m_PlaylistFileLabel);
// #################################################################################################
//
// #################################################################################################
this->m_MainGroup = new UIX::UIXGroupBox();
this->m_MainGroup->SetSize({ 308, 84 });
this->m_MainGroup->SetLocation({ 480, 10 });
this->m_MainGroup->SetTabIndex(0);
this->m_MainGroup->SetText("Main");
this->m_MainGroup->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->AddControl(this->m_MainGroup);
this->m_MainGroupExt = new UIX::UIXGroupBox();
this->m_MainGroupExt->SetSize({ 308, 55 });
this->m_MainGroupExt->SetLocation({ 480, 93 });
this->m_MainGroupExt->SetTabIndex(0);
this->m_MainGroupExt->SetText("");
this->m_MainGroupExt->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->AddControl(this->m_MainGroupExt);
this->m_ModeCombo = new UIX::UIXComboBox();
this->m_ModeCombo->SetSize({ 82, 25 });
this->m_ModeCombo->SetLocation({ 15, 25 });
this->m_ModeCombo->SetTabIndex(0);
this->m_ModeCombo->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_ModeCombo->SetDropDownStyle(Forms::ComboBoxStyle::DropDownList);
this->m_ModeCombo->Items.Add("Host");
this->m_ModeCombo->Items.Add("Server");
this->m_ModeCombo->Items.Add("Client");
this->m_MainGroup->AddControl(this->m_ModeCombo);
this->m_ModeLabel = new UIX::UIXLabel();
this->m_ModeLabel->SetSize({ 50, 25 });
this->m_ModeLabel->SetLocation({ 100, 28 });
this->m_ModeLabel->SetTabIndex(0);
this->m_ModeLabel->SetText("Mode");
this->m_ModeLabel->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_ModeLabel->SetTextAlign(Drawing::ContentAlignment::TopLeft);
this->m_MainGroup->AddControl(this->m_ModeLabel);
this->m_CustomDllTextBox = new UIX::UIXTextBox();
this->m_CustomDllTextBox->SetSize({ 80, 21 });
this->m_CustomDllTextBox->SetLocation({ 150, 25 });
this->m_CustomDllTextBox->SetTabIndex(0);
this->m_CustomDllTextBox->SetText("");
this->m_CustomDllTextBox->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_MainGroup->AddControl(this->m_CustomDllTextBox);
this->m_CustomDllLabel = new UIX::UIXLabel();
this->m_CustomDllLabel->SetSize({ 70, 21 });
this->m_CustomDllLabel->SetLocation({ 233, 28 });
this->m_CustomDllLabel->SetTabIndex(0);
this->m_CustomDllLabel->SetText("Additional dll's");
this->m_CustomDllLabel->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_MainGroup->AddControl(this->m_CustomDllLabel);
this->m_LaunchArgsTextBox = new UIX::UIXTextBox();
this->m_LaunchArgsTextBox->SetSize({ 215, 21 });
this->m_LaunchArgsTextBox->SetLocation({ 15, 50 });
this->m_LaunchArgsTextBox->SetTabIndex(0);
this->m_LaunchArgsTextBox->SetText("");
this->m_LaunchArgsTextBox->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_MainGroup->AddControl(this->m_LaunchArgsTextBox);
this->m_LaunchArgsLabel = new UIX::UIXLabel();
this->m_LaunchArgsLabel->SetSize({ 70, 21 });
this->m_LaunchArgsLabel->SetLocation({ 233, 53 });
this->m_LaunchArgsLabel->SetTabIndex(0);
this->m_LaunchArgsLabel->SetText("Launch flags");
this->m_LaunchArgsLabel->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_MainGroup->AddControl(this->m_LaunchArgsLabel);
this->m_CleanSDK = new UIX::UIXButton();
this->m_CleanSDK->SetSize({ 110, 18 });
this->m_CleanSDK->SetLocation({ 15, 7 });
this->m_CleanSDK->SetTabIndex(0);
this->m_CleanSDK->SetText("Clean SDK");
this->m_CleanSDK->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_MainGroupExt->AddControl(this->m_CleanSDK);
this->m_UpdateSDK = new UIX::UIXButton();
this->m_UpdateSDK->SetSize({ 110, 18 });
this->m_UpdateSDK->SetLocation({ 15, 30 });
this->m_UpdateSDK->SetTabIndex(0);
this->m_UpdateSDK->SetText("Update SDK");
this->m_UpdateSDK->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_MainGroupExt->AddControl(this->m_UpdateSDK);
this->m_LaunchSDK = new UIX::UIXButton();
this->m_LaunchSDK->SetSize({ 170, 41 });
this->m_LaunchSDK->SetLocation({ 130, 7 });
this->m_LaunchSDK->SetTabIndex(0);
this->m_LaunchSDK->SetText("Launch game");
this->m_LaunchSDK->SetBackColor(Drawing::Color(3, 102, 214));
this->m_LaunchSDK->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_MainGroupExt->AddControl(this->m_LaunchSDK);
// #################################################################################################
//
// #################################################################################################
this->m_EngineBaseGroup = new UIX::UIXGroupBox();
this->m_EngineBaseGroup->SetSize({ 337, 73 });
this->m_EngineBaseGroup->SetLocation({ 12, 158 });
this->m_EngineBaseGroup->SetTabIndex(0);
this->m_EngineBaseGroup->SetText("Engine");
this->m_EngineBaseGroup->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->AddControl(this->m_EngineBaseGroup);
this->m_EngineNetworkGroup = new UIX::UIXGroupBox();
this->m_EngineNetworkGroup->SetSize({ 337, 55 });
this->m_EngineNetworkGroup->SetLocation({ 12, 230 });
this->m_EngineNetworkGroup->SetTabIndex(0);
this->m_EngineNetworkGroup->SetText("");
this->m_EngineNetworkGroup->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->AddControl(this->m_EngineNetworkGroup);
this->m_EngineVideoGroup = new UIX::UIXGroupBox();
this->m_EngineVideoGroup->SetSize({ 337, 55 });
this->m_EngineVideoGroup->SetLocation({ 12, 284 });
this->m_EngineVideoGroup->SetTabIndex(0);
this->m_EngineVideoGroup->SetText("");
this->m_EngineVideoGroup->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->AddControl(this->m_EngineVideoGroup);
this->m_ReservedCoresTextBox = new UIX::UIXTextBox();
this->m_ReservedCoresTextBox->SetSize({ 18, 18 });
this->m_ReservedCoresTextBox->SetLocation({ 15, 25 });
this->m_ReservedCoresTextBox->SetTabIndex(0);
this->m_ReservedCoresTextBox->SetReadOnly(false);
this->m_ReservedCoresTextBox->SetText("0");
this->m_ReservedCoresTextBox->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_EngineBaseGroup->AddControl(this->m_ReservedCoresTextBox);
this->m_ReservedCoresLabel = new UIX::UIXLabel();
this->m_ReservedCoresLabel->SetSize({ 125, 18 });
this->m_ReservedCoresLabel->SetLocation({ 36, 27 });
this->m_ReservedCoresLabel->SetTabIndex(0);
this->m_ReservedCoresLabel->SetText("Reserved cores");
this->m_ReservedCoresLabel->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_ReservedCoresLabel->SetTextAlign(Drawing::ContentAlignment::TopLeft);
this->m_EngineBaseGroup->AddControl(this->m_ReservedCoresLabel);
this->m_WorkerThreadsTextBox = new UIX::UIXTextBox();
this->m_WorkerThreadsTextBox->SetSize({ 18, 18 });
this->m_WorkerThreadsTextBox->SetLocation({ 155, 25 });
this->m_WorkerThreadsTextBox->SetTabIndex(0);
this->m_WorkerThreadsTextBox->SetReadOnly(false);
this->m_WorkerThreadsTextBox->SetText("28");
this->m_WorkerThreadsTextBox->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_EngineBaseGroup->AddControl(this->m_WorkerThreadsTextBox);
this->m_WorkerThreadsLabel = new UIX::UIXLabel();
this->m_WorkerThreadsLabel->SetSize({ 125, 18 });
this->m_WorkerThreadsLabel->SetLocation({ 176, 27 });
this->m_WorkerThreadsLabel->SetTabIndex(0);
this->m_WorkerThreadsLabel->SetText("Worker threads");
this->m_WorkerThreadsLabel->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_WorkerThreadsLabel->SetTextAlign(Drawing::ContentAlignment::TopLeft);
this->m_EngineBaseGroup->AddControl(this->m_WorkerThreadsLabel);
this->m_SingleCoreDediToggle = new UIX::UIXCheckBox();
this->m_SingleCoreDediToggle->SetSize({ 125, 18 });
this->m_SingleCoreDediToggle->SetLocation({ 15, 48 });
this->m_SingleCoreDediToggle->SetTabIndex(0);
this->m_SingleCoreDediToggle->SetText("Single-core server");
this->m_SingleCoreDediToggle->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_EngineBaseGroup->AddControl(this->m_SingleCoreDediToggle);
this->m_NoAsyncJobsToggle = new UIX::UIXCheckBox();
this->m_NoAsyncJobsToggle->SetSize({ 125, 18 });
this->m_NoAsyncJobsToggle->SetLocation({ 155, 48 });
this->m_NoAsyncJobsToggle->SetTabIndex(2);
this->m_NoAsyncJobsToggle->SetText("Synchronize jobs");
this->m_NoAsyncJobsToggle->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_EngineBaseGroup->AddControl(this->m_NoAsyncJobsToggle);
this->m_NetEncryptionToggle = new UIX::UIXCheckBox();
this->m_NetEncryptionToggle->SetSize({ 125, 18 });
this->m_NetEncryptionToggle->SetLocation({ 15, 7 });
this->m_NetEncryptionToggle->SetTabIndex(0);
this->m_NetEncryptionToggle->SetChecked(true);
this->m_NetEncryptionToggle->SetText("Net encryption");
this->m_NetEncryptionToggle->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_EngineNetworkGroup->AddControl(this->m_NetEncryptionToggle);
this->m_NetRandomKeyToggle = new UIX::UIXCheckBox();
this->m_NetRandomKeyToggle->SetSize({ 125, 18 });
this->m_NetRandomKeyToggle->SetLocation({ 155, 7 });
this->m_NetRandomKeyToggle->SetTabIndex(0);
this->m_NetRandomKeyToggle->SetChecked(true);
this->m_NetRandomKeyToggle->SetText("Net random key");
this->m_NetRandomKeyToggle->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_EngineNetworkGroup->AddControl(this->m_NetRandomKeyToggle);
this->m_QueuedPacketThread = new UIX::UIXCheckBox();
this->m_QueuedPacketThread->SetSize({ 125, 18 });
this->m_QueuedPacketThread->SetLocation({ 15, 30 });
this->m_QueuedPacketThread->SetTabIndex(2);
this->m_QueuedPacketThread->SetText("No queued packets");
this->m_QueuedPacketThread->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_EngineNetworkGroup->AddControl(this->m_QueuedPacketThread);
this->m_NoTimeOut = new UIX::UIXCheckBox();
this->m_NoTimeOut->SetSize({ 125, 18 });
this->m_NoTimeOut->SetLocation({ 155, 30 });
this->m_NoTimeOut->SetTabIndex(0);
this->m_NoTimeOut->SetText("No time out");
this->m_NoTimeOut->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_EngineNetworkGroup->AddControl(this->m_NoTimeOut);
this->m_WindowedToggle = new UIX::UIXCheckBox();
this->m_WindowedToggle->SetSize({ 105, 18 });
this->m_WindowedToggle->SetLocation({ 15, 7 });
this->m_WindowedToggle->SetTabIndex(0);
this->m_WindowedToggle->SetChecked(true);
this->m_WindowedToggle->SetText("Windowed");
this->m_WindowedToggle->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_EngineVideoGroup->AddControl(this->m_WindowedToggle);
this->m_BorderlessToggle = new UIX::UIXCheckBox();
this->m_BorderlessToggle->SetSize({ 150, 18 });
this->m_BorderlessToggle->SetLocation({ 155, 7 });
this->m_BorderlessToggle->SetTabIndex(0);
this->m_BorderlessToggle->SetText("No border");
this->m_BorderlessToggle->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_EngineVideoGroup->AddControl(this->m_BorderlessToggle);
this->m_FpsTextBox = new UIX::UIXTextBox();
this->m_FpsTextBox->SetSize({ 25, 18 });
this->m_FpsTextBox->SetLocation({ 15, 30 });
this->m_FpsTextBox->SetTabIndex(0);
this->m_FpsTextBox->SetReadOnly(false);
this->m_FpsTextBox->SetText("-1");
this->m_FpsTextBox->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_EngineVideoGroup->AddControl(this->m_FpsTextBox);
this->m_FpsLabel = new UIX::UIXLabel();
this->m_FpsLabel->SetSize({ 125, 18 });
this->m_FpsLabel->SetLocation({ 43, 32 });
this->m_FpsLabel->SetTabIndex(0);
this->m_FpsLabel->SetText("Max FPS");
this->m_FpsLabel->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_FpsLabel->SetTextAlign(Drawing::ContentAlignment::TopLeft);
this->m_EngineVideoGroup->AddControl(this->m_FpsLabel);
this->m_WidthTextBox = new UIX::UIXTextBox();
this->m_WidthTextBox->SetSize({ 50, 18 });
this->m_WidthTextBox->SetLocation({ 100, 30 });
this->m_WidthTextBox->SetTabIndex(0);
this->m_WidthTextBox->SetReadOnly(false);
this->m_WidthTextBox->SetText("");
this->m_WidthTextBox->SetAnchor(Forms::AnchorStyles::Bottom | Forms::AnchorStyles::Right);
this->m_EngineVideoGroup->AddControl(this->m_WidthTextBox);
this->m_HeightTextBox = new UIX::UIXTextBox();
this->m_HeightTextBox->SetSize({ 50, 18 });
this->m_HeightTextBox->SetLocation({ 149, 30 });
this->m_HeightTextBox->SetTabIndex(0);
this->m_HeightTextBox->SetReadOnly(false);
this->m_HeightTextBox->SetText("");
this->m_HeightTextBox->SetAnchor(Forms::AnchorStyles::Bottom | Forms::AnchorStyles::Right);
this->m_EngineVideoGroup->AddControl(this->m_HeightTextBox);
this->m_ResolutionLabel = new UIX::UIXLabel();
this->m_ResolutionLabel->SetSize({ 125, 18 });
this->m_ResolutionLabel->SetLocation({ 202, 32 });
this->m_ResolutionLabel->SetTabIndex(0);
this->m_ResolutionLabel->SetText("Resolution (width | height)");
this->m_ResolutionLabel->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_ResolutionLabel->SetTextAlign(Drawing::ContentAlignment::TopLeft);
this->m_EngineVideoGroup->AddControl(this->m_ResolutionLabel);
// #################################################################################################
//
// #################################################################################################
this->m_ConsoleGroup = new UIX::UIXGroupBox();
this->m_ConsoleGroup->SetSize({ 429, 181 });
this->m_ConsoleGroup->SetLocation({ 359, 158 });
this->m_ConsoleGroup->SetTabIndex(0);
this->m_ConsoleGroup->SetText("Console");
this->m_ConsoleGroup->SetAnchor(Forms::AnchorStyles::Bottom | Forms::AnchorStyles::Left | Forms::AnchorStyles::Right);
this->AddControl(this->m_ConsoleGroup);
this->m_ConsoleListView = new UIX::UIXListView();
this->m_ConsoleListView->SetSize({ 427, 165 });
this->m_ConsoleListView->SetLocation({ 1, 15 });
this->m_ConsoleListView->SetTabIndex(0);
this->m_ConsoleListView->SetText("0");
this->m_ConsoleListView->SetBackColor(Drawing::Color(29, 33, 37));
this->m_ConsoleListView->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_ConsoleGroup->AddControl(this->m_ConsoleListView);
this->ResumeLayout(false);
this->PerformLayout();
// END DESIGNER CODE
this->SetBackColor({ 47, 54, 61 });
}
CUIBasePanel::CUIBasePanel() : Forms::Form()
{
g_pMainUI = this;
this->Init();
}
CUIBasePanel* g_pMainUI;

View File

@ -0,0 +1,78 @@
#pragma once
#include "thirdparty/cppnet/cppkore/Kore.h"
#include "thirdparty/cppnet/cppkore/UIXTheme.h"
#include "thirdparty/cppnet/cppkore/UIXLabel.h"
#include "thirdparty/cppnet/cppkore/UIXListView.h"
#include "thirdparty/cppnet/cppkore/UIXCheckBox.h"
#include "thirdparty/cppnet/cppkore/UIXComboBox.h"
#include "thirdparty/cppnet/cppkore/UIXTextBox.h"
#include "thirdparty/cppnet/cppkore/UIXGroupBox.h"
#include "thirdparty/cppnet/cppkore/UIXButton.h"
#include "thirdparty/cppnet/cppkore/UIXRadioButton.h"
#include "thirdparty/cppnet/cppkore/KoreTheme.h"
class CUIBasePanel : public Forms::Form
{
public:
CUIBasePanel();
virtual ~CUIBasePanel() = default;
private:
void Init();
UIX::UIXTextBox* m_HeightTextBox;
UIX::UIXTextBox* m_WidthTextBox;
UIX::UIXTextBox* m_WorkerThreadsTextBox;
UIX::UIXTextBox* m_ReservedCoresTextBox;
UIX::UIXTextBox* m_FpsTextBox;
UIX::UIXTextBox* m_PlaylistFileTextBox;
UIX::UIXTextBox* m_CustomDllTextBox;
UIX::UIXTextBox* m_LaunchArgsTextBox;
// Labels
UIX::UIXLabel* m_WorkerThreadsLabel;
UIX::UIXLabel* m_ReservedCoresLabel;
UIX::UIXLabel* m_MapLabel;
UIX::UIXLabel* m_PlaylistLabel;
UIX::UIXLabel* m_ModeLabel;
UIX::UIXLabel* m_FpsLabel;
UIX::UIXLabel* m_ResolutionLabel;
UIX::UIXLabel* m_PlaylistFileLabel;
UIX::UIXLabel* m_CustomDllLabel;
UIX::UIXLabel* m_LaunchArgsLabel;
// Boxes
UIX::UIXGroupBox* m_GameGroup;
UIX::UIXGroupBox* m_MainGroup;
UIX::UIXGroupBox* m_GameGroupExt;
UIX::UIXGroupBox* m_MainGroupExt;
UIX::UIXGroupBox* m_ConsoleGroup;
UIX::UIXGroupBox* m_EngineBaseGroup;
UIX::UIXGroupBox* m_EngineNetworkGroup;
UIX::UIXGroupBox* m_EngineVideoGroup;
// Toggles
UIX::UIXCheckBox* m_CheatsToggle;
UIX::UIXCheckBox* m_DevelopmentToggle;
UIX::UIXCheckBox* m_ConsoleToggle;
UIX::UIXCheckBox* m_WindowedToggle;
UIX::UIXCheckBox* m_BorderlessToggle;
UIX::UIXCheckBox* m_SingleCoreDediToggle;
UIX::UIXCheckBox* m_NoAsyncJobsToggle;
UIX::UIXCheckBox* m_NetEncryptionToggle;
UIX::UIXCheckBox* m_NetRandomKeyToggle;
UIX::UIXCheckBox* m_QueuedPacketThread;
UIX::UIXCheckBox* m_NoTimeOut;
UIX::UIXCheckBox* m_ColorConsoleToggle;
// Combo
UIX::UIXComboBox* m_MapCombo;
UIX::UIXComboBox* m_PlaylistCombo;
UIX::UIXComboBox* m_ModeCombo;
// Buttons
UIX::UIXButton* m_LaunchGame;
UIX::UIXButton* m_CleanSDK;
UIX::UIXButton* m_UpdateSDK;
UIX::UIXButton* m_LaunchSDK;
UIX::UIXListView* m_ConsoleListView;
};
extern CUIBasePanel* g_pMainUI;

View File

@ -1,5 +1,16 @@
#include "core/stdafx.h"
#include "sdklauncher.h"
#include "basepanel.h"
#include <objidl.h>
#include "gdiplus.h"
#include "shellapi.h"
using namespace Gdiplus;
#pragma comment (lib,"Shell32.lib")
#pragma comment (lib,"Gdi32.lib")
#pragma comment (lib,"Gdiplus.lib")
#pragma comment (lib,"Advapi32.lib")
//-----------------------------------------------------------------------------
// Purpose switch case:
@ -7,141 +18,140 @@
// * Load specified command line arguments from a file on the disk.
// * Format the file paths for the game exe and specified hook dll.
//-----------------------------------------------------------------------------
bool LaunchR5Apex(eLaunchMode lMode, eLaunchState lState)
bool CLauncher::Setup(eLaunchMode lMode, eLaunchState lState)
{
///////////////////////////////////////////////////////////////////////////
// Initialize strings.
std::string svWorkerDll = std::string();
std::string svGameDir = std::string();
std::string svCmdLineArgs = std::string();
std::string svStartCmdLine = std::string();
std::string svCurrentDir = std::filesystem::current_path().u8string();
///////////////////////////////////////////////////////////////////////////
// Determine launch mode.
switch (lMode)
{
case eLaunchMode::LM_DEBUG_GAME:
case eLaunchMode::LM_DEBUG_GAME:
{
fs::path cfgPath = fs::current_path() /= "platform\\cfg\\startup_debug.cfg";
std::ifstream cfgFile(cfgPath);
if (cfgFile.good() && cfgFile)
{
fs::path cfgPath = fs::current_path() /= "platform\\cfg\\startup_debug.cfg"; // Get cfg path for debug startup.
std::ifstream cfgFile(cfgPath); // Read the cfg file.
if (cfgFile.good() && cfgFile) // Does the cfg file exist?
{
std::stringstream ss;
ss << cfgFile.rdbuf(); // Read ifstream buffer into stringstream.
svCmdLineArgs = ss.str() + "-launcher"; // Get all the contents of the cfg file.
}
else
{
spdlog::error("File 'platform\\cfg\\startup_debug.cfg' does not exist!\n");
cfgFile.close();
return false;
}
cfgFile.close(); // Close cfg file.
svWorkerDll = svCurrentDir + "\\gamesdk.dll"; // Get path to worker dll.
svGameDir = svCurrentDir + "\\r5apex.exe"; // Get path to game executeable.
svStartCmdLine = svCurrentDir + "\\r5apex.exe " + svCmdLineArgs; // Setup startup command line string.
spdlog::info("*** LAUNCHING GAME [DEBUG] ***\n");
break;
std::stringstream ss;
ss << cfgFile.rdbuf();
svCmdLineArgs = ss.str() + "-launcher";
}
case eLaunchMode::LM_RELEASE_GAME:
else
{
fs::path cfgPath = fs::current_path() /= "platform\\cfg\\startup_retail.cfg"; // Get cfg path for release startup.
std::ifstream cfgFile(cfgPath); // Read the cfg file.
if (cfgFile.good() && cfgFile) // Does the cfg file exist?
{
std::stringstream ss;
ss << cfgFile.rdbuf(); // Read ifstream buffer into stringstream.
svCmdLineArgs = ss.str() + "-launcher"; // Get all the contents of the cfg file.
}
else
{
spdlog::error("File 'platform\\cfg\\startup_retail.cfg' does not exist!\n");
cfgFile.close();
return false;
}
cfgFile.close(); // Close cfg file.
svWorkerDll = svCurrentDir + "\\gamesdk.dll"; // Get path to worker dll.
svGameDir = svCurrentDir + "\\r5apex.exe"; // Get path to game executeable.
svStartCmdLine = svCurrentDir + "\\r5apex.exe " + svCmdLineArgs; // Setup startup command line string.
spdlog::info("*** LAUNCHING GAME [RELEASE] ***\n");
break;
}
case eLaunchMode::LM_DEBUG_DEDI:
{
fs::path cfgPath = fs::current_path() /= "platform\\cfg\\startup_dedi_debug.cfg"; // Get cfg path for dedicated startup.
std::ifstream cfgFile(cfgPath); // Read the cfg file.
if (cfgFile.good() && cfgFile) // Does the cfg file exist?
{
std::stringstream ss;
ss << cfgFile.rdbuf(); // Read ifstream buffer into stringstream.
svCmdLineArgs = ss.str() + "-launcher"; // Get all the contents of the cfg file.
}
else
{
spdlog::error("File 'platform\\cfg\\startup_dedi_debug.cfg' does not exist!\n");
cfgFile.close();
return false;
}
cfgFile.close(); // Close cfg file.
svWorkerDll = svCurrentDir + "\\dedicated.dll"; // Get path to worker dll.
svGameDir = svCurrentDir + "\\r5apex_ds.exe"; // Get path to game executeable.
svStartCmdLine = svCurrentDir + "\\r5apex_ds.exe " + svCmdLineArgs; // Setup startup command line string.
spdlog::info("*** LAUNCHING DEDICATED [DEBUG] ***\n");
break;
}
case eLaunchMode::LM_RELEASE_DEDI:
{
fs::path cfgPath = fs::current_path() /= "platform\\cfg\\startup_dedi_retail.cfg"; // Get cfg path for dedicated startup.
std::ifstream cfgFile(cfgPath); // Read the cfg file.
if (cfgFile.good() && cfgFile) // Does the cfg file exist?
{
std::stringstream ss;
ss << cfgFile.rdbuf(); // Read ifstream buffer into stringstream.
svCmdLineArgs = ss.str(); // Get all the contents of the cfg file.
}
else
{
spdlog::error("File 'platform\\cfg\\startup_dedi_retail.cfg' does not exist!\n");
cfgFile.close();
return false;
}
cfgFile.close(); // Close cfg file.
svWorkerDll = svCurrentDir + "\\dedicated.dll"; // Get path to worker dll.
svGameDir = svCurrentDir + "\\r5apex_ds.exe"; // Get path to game executeable.
svStartCmdLine = svCurrentDir + "\\r5apex_ds.exe " + svCmdLineArgs; // Setup startup command line string.
spdlog::info("*** LAUNCHING DEDICATED [RELEASE] ***\n");
break;
}
default:
{
spdlog::error("*** NO LAUNCH MODE SPECIFIED ***\n");
spdlog::error("File 'platform\\cfg\\startup_debug.cfg' does not exist!\n");
cfgFile.close();
return false;
}
cfgFile.close(); // Close cfg file.
m_svWorkerDll = m_svCurrentDir + "\\gamesdk.dll";
m_svGameExe = m_svCurrentDir + "\\r5apex.exe";
m_svCmdLine = m_svCurrentDir + "\\r5apex.exe " + svCmdLineArgs;
spdlog::info("*** LAUNCHING GAME [DEBUG] ***\n");
break;
}
case eLaunchMode::LM_RELEASE_GAME:
{
fs::path cfgPath = fs::current_path() /= "platform\\cfg\\startup_retail.cfg";
std::ifstream cfgFile(cfgPath);
if (cfgFile.good() && cfgFile)
{
std::stringstream ss;
ss << cfgFile.rdbuf();
svCmdLineArgs = ss.str() + "-launcher";
}
else
{
spdlog::error("File 'platform\\cfg\\startup_retail.cfg' does not exist!\n");
cfgFile.close();
return false;
}
cfgFile.close(); // Close cfg file.
m_svWorkerDll = m_svCurrentDir + "\\gamesdk.dll";
m_svGameExe = m_svCurrentDir + "\\r5apex.exe";
m_svCmdLine = m_svCurrentDir + "\\r5apex.exe " + svCmdLineArgs;
spdlog::info("*** LAUNCHING GAME [RELEASE] ***\n");
break;
}
case eLaunchMode::LM_DEBUG_DEDI:
{
fs::path cfgPath = fs::current_path() /= "platform\\cfg\\startup_dedi_debug.cfg";
std::ifstream cfgFile(cfgPath);
if (cfgFile.good() && cfgFile)
{
std::stringstream ss;
ss << cfgFile.rdbuf();
svCmdLineArgs = ss.str() + "-launcher";
}
else
{
spdlog::error("File 'platform\\cfg\\startup_dedi_debug.cfg' does not exist!\n");
cfgFile.close();
return false;
}
cfgFile.close(); // Close cfg file.
m_svWorkerDll = m_svCurrentDir + "\\dedicated.dll";
m_svGameExe = m_svCurrentDir + "\\r5apex_ds.exe";
m_svCmdLine = m_svCurrentDir + "\\r5apex_ds.exe " + svCmdLineArgs;
spdlog::info("*** LAUNCHING DEDICATED [DEBUG] ***\n");
break;
}
case eLaunchMode::LM_RELEASE_DEDI:
{
fs::path cfgPath = fs::current_path() /= "platform\\cfg\\startup_dedi_retail.cfg";
std::ifstream cfgFile(cfgPath);
if (cfgFile.good() && cfgFile)
{
std::stringstream ss;
ss << cfgFile.rdbuf();
svCmdLineArgs = ss.str(); +"-launcher";
}
else
{
spdlog::error("File 'platform\\cfg\\startup_dedi_retail.cfg' does not exist!\n");
cfgFile.close();
return false;
}
cfgFile.close(); // Close cfg file.
m_svWorkerDll = m_svCurrentDir + "\\dedicated.dll";
m_svGameExe = m_svCurrentDir + "\\r5apex_ds.exe";
m_svCmdLine = m_svCurrentDir + "\\r5apex_ds.exe " + svCmdLineArgs;
spdlog::info("*** LAUNCHING DEDICATED [RELEASE] ***\n");
break;
}
default:
{
spdlog::error("*** NO LAUNCH MODE SPECIFIED ***\n");
return false;
}
}
///////////////////////////////////////////////////////////////////////////
// Print the file paths and arguments.
// Print the file paths and arguments.
std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl;
spdlog::debug("- CWD: {}\n", svCurrentDir);
spdlog::debug("- EXE: {}\n", svGameDir);
spdlog::debug("- DLL: {}\n", svWorkerDll);
spdlog::debug("- CWD: {}\n", m_svCurrentDir);
spdlog::debug("- EXE: {}\n", m_svGameExe);
spdlog::debug("- DLL: {}\n", m_svWorkerDll);
spdlog::debug("- CLI: {}\n", svCmdLineArgs);
std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl;
return true;
}
bool CLauncher::Launch()
{
///////////////////////////////////////////////////////////////////////////
// Build our list of dlls to inject.
LPCSTR DllsToInject[1] =
{
svWorkerDll.c_str()
m_svWorkerDll.c_str()
};
STARTUPINFOA StartupInfo = { 0 };
@ -154,14 +164,14 @@ bool LaunchR5Apex(eLaunchMode lMode, eLaunchState lState)
// Create the game process in a suspended state with our dll.
BOOL result = DetourCreateProcessWithDllsA
(
svGameDir.c_str(), // lpApplicationName
(LPSTR)svStartCmdLine.c_str(), // lpCommandLine
m_svGameExe.c_str(), // lpApplicationName
(LPSTR)m_svCmdLine.c_str(), // lpCommandLine
NULL, // lpProcessAttributes
NULL, // lpThreadAttributes
FALSE, // bInheritHandles
CREATE_SUSPENDED, // dwCreationFlags
NULL, // lpEnvironment
svCurrentDir.c_str(), // lpCurrentDirectory
m_svCurrentDir.c_str(), // lpCurrentDirectory
&StartupInfo, // lpStartupInfo
&ProcInfo, // lpProcessInformation
sizeof(DllsToInject) / sizeof(LPCSTR), // nDlls
@ -197,101 +207,178 @@ int main(int argc, char* argv[], char* envp[])
spdlog::set_pattern("[%^%l%$] %v");
spdlog::set_level(spdlog::level::trace);
for (int i = 1; i < argc; ++i)
if (argc < 2)
{
std::string arg = argv[i];
if ((arg == "-debug") || (arg == "-dbg"))
{
LaunchR5Apex(eLaunchMode::LM_DEBUG_GAME, eLaunchState::LS_CHEATS);
Sleep(2000);
return EXIT_SUCCESS;
}
if ((arg == "-release") || (arg == "-rel"))
{
LaunchR5Apex(eLaunchMode::LM_RELEASE_GAME, eLaunchState::LS_CHEATS);
Sleep(2000);
return EXIT_SUCCESS;
}
if ((arg == "-dedicated_dev") || (arg == "-dedid"))
{
LaunchR5Apex(eLaunchMode::LM_DEBUG_DEDI, eLaunchState::LS_CHEATS);
Sleep(2000);
return EXIT_SUCCESS;
}
if ((arg == "-dedicated") || (arg == "-dedi"))
{
LaunchR5Apex(eLaunchMode::LM_RELEASE_DEDI, eLaunchState::LS_CHEATS);
Sleep(2000);
return EXIT_SUCCESS;
}
Forms::Application::EnableVisualStyles();
UIX::UIXTheme::InitializeRenderer(new Themes::KoreTheme());
CUIBasePanel* mainUI = new CUIBasePanel();
Forms::Application::Run(mainUI);
UIX::UIXTheme::ShutdownRenderer();
}
std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl;
spdlog::warn("If a DEBUG option has been choosen as launch parameter, do not broadcast servers to the Server Browser!\n");
spdlog::warn("All FCVAR_CHEAT | FCVAR_DEVELOPMENTONLY ConVar's/ConCommand's will be enabled.\n");
spdlog::warn("Connected clients will be able to set and execute anything flagged FCVAR_CHEAT | FCVAR_DEVELOPMENTONLY.\n");
std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl;
spdlog::warn("Use DEBUG GAME [1] for research and development purposes.\n");
spdlog::warn("Use RELEASE GAME [2] for playing the game and creating servers.\n");
spdlog::warn("Use DEBUG DEDICATED [3] for research and development purposes.\n");
spdlog::warn("Use RELEASE DEDICATED [4] for running and hosting dedicated servers.\n");
std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl;
spdlog::info("Enter '1' for 'DEBUG GAME'.\n");
spdlog::info("Enter '2' for 'RELEASE GAME'.\n");
spdlog::info("Enter '3' for 'DEBUG DEDICATED'.\n");
spdlog::info("Enter '4' for 'RELEASE DEDICATED'.\n");
std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl;
std::cout << "User input: ";
std::string input = std::string();
if (std::cin >> input)
else
{
try
for (int i = 1; i < argc; ++i)
{
eLaunchMode mode = (eLaunchMode)std::stoi(input);
switch (mode)
std::string arg = argv[i];
if ((arg == "-debug") || (arg == "-dbg"))
{
case eLaunchMode::LM_DEBUG_GAME:
{
LaunchR5Apex(eLaunchMode::LM_DEBUG_GAME, eLaunchState::LS_CHEATS);
if (g_pLauncher->Setup(eLaunchMode::LM_DEBUG_GAME, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_SUCCESS;
return EXIT_FAILURE;
}
case eLaunchMode::LM_RELEASE_GAME:
if ((arg == "-release") || (arg == "-rel"))
{
LaunchR5Apex(eLaunchMode::LM_RELEASE_GAME, eLaunchState::LS_CHEATS);
if (g_pLauncher->Setup(eLaunchMode::LM_RELEASE_GAME, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_SUCCESS;
return EXIT_FAILURE;
}
case eLaunchMode::LM_DEBUG_DEDI:
if ((arg == "-dedicated_dev") || (arg == "-dedid"))
{
LaunchR5Apex(eLaunchMode::LM_DEBUG_DEDI, eLaunchState::LS_CHEATS);
if (g_pLauncher->Setup(eLaunchMode::LM_DEBUG_DEDI, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_SUCCESS;
return EXIT_FAILURE;
}
case eLaunchMode::LM_RELEASE_DEDI:
if ((arg == "-dedicated") || (arg == "-dedi"))
{
LaunchR5Apex(eLaunchMode::LM_RELEASE_DEDI, eLaunchState::LS_CHEATS);
if (g_pLauncher->Setup(eLaunchMode::LM_RELEASE_DEDI, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_SUCCESS;
return EXIT_FAILURE;
}
default:
}
std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl;
spdlog::warn("If a DEBUG option has been choosen as launch parameter, do not broadcast servers to the Server Browser!\n");
spdlog::warn("All FCVAR_CHEAT | FCVAR_DEVELOPMENTONLY ConVar's/ConCommand's will be enabled.\n");
spdlog::warn("Connected clients will be able to set and execute anything flagged FCVAR_CHEAT | FCVAR_DEVELOPMENTONLY.\n");
std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl;
spdlog::warn("Use DEBUG GAME [1] for research and development purposes.\n");
spdlog::warn("Use RELEASE GAME [2] for playing the game and creating servers.\n");
spdlog::warn("Use DEBUG DEDICATED [3] for research and development purposes.\n");
spdlog::warn("Use RELEASE DEDICATED [4] for running and hosting dedicated servers.\n");
std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl;
spdlog::info("Enter '1' for 'DEBUG GAME'.\n");
spdlog::info("Enter '2' for 'RELEASE GAME'.\n");
spdlog::info("Enter '3' for 'DEBUG DEDICATED'.\n");
spdlog::info("Enter '4' for 'RELEASE DEDICATED'.\n");
std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl;
std::cout << "User input: ";
std::string input = std::string();
if (std::cin >> input)
{
try
{
spdlog::error("R5Reloaded requires '1' for DEBUG GAME mode, '2' for RELEASE GAME mode, '3' for DEBUG DEDICATED mode, '4' for RELEASE DEDICATED mode.\n");
eLaunchMode mode = (eLaunchMode)std::stoi(input);
switch (mode)
{
case eLaunchMode::LM_DEBUG_GAME:
{
if (g_pLauncher->Setup(eLaunchMode::LM_DEBUG_GAME, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
case eLaunchMode::LM_RELEASE_GAME:
{
if (g_pLauncher->Setup(eLaunchMode::LM_RELEASE_GAME, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
case eLaunchMode::LM_DEBUG_DEDI:
{
if (g_pLauncher->Setup(eLaunchMode::LM_DEBUG_DEDI, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
case eLaunchMode::LM_RELEASE_DEDI:
{
if (g_pLauncher->Setup(eLaunchMode::LM_RELEASE_DEDI, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
default:
{
spdlog::error("R5Reloaded requires '1' for DEBUG GAME mode, '2' for RELEASE GAME mode, '3' for DEBUG DEDICATED mode, '4' for RELEASE DEDICATED mode.\n");
Sleep(5000);
return EXIT_FAILURE;
}
}
}
catch (std::exception& e)
{
spdlog::error("R5Reloaded only takes numerical input to launch. Error: {}.\n", e.what());
Sleep(5000);
return EXIT_FAILURE;
}
}
}
catch (std::exception& e)
{
spdlog::error("R5Reloaded only takes numerical input to launch. Error: {}.\n", e.what());
Sleep(5000);
return EXIT_FAILURE;
}
}
spdlog::error("R5Reloaded requires numerical input to launch.\n");
spdlog::error("R5Reloaded requires numerical input to launch.\n");
Sleep(5000);
return EXIT_FAILURE;
Sleep(5000);
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}

View File

@ -22,3 +22,22 @@ enum class eLaunchState : int
LS_CHEATS, // Enable cheats
LS_DEBUG // Enable debug
};
class CLauncher
{
public:
CLauncher()
{
m_svCurrentDir = fs::current_path().u8string();
}
bool Setup(eLaunchMode lMode, eLaunchState lState);
bool Launch();
private:
string m_svWorkerDll;
string m_svGameExe;
string m_svCmdLine;
string m_svCurrentDir;
};
inline CLauncher* g_pLauncher = new CLauncher();

View File

@ -127,6 +127,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\public\utility.cpp" />
<ClCompile Include="..\sdklauncher\basepanel.cpp" />
<ClCompile Include="..\sdklauncher\sdklauncher.cpp" />
</ItemGroup>
<ItemGroup>
@ -139,6 +140,7 @@
<ItemGroup>
<ClInclude Include="..\core\stdafx.h" />
<ClInclude Include="..\public\include\utility.h" />
<ClInclude Include="..\sdklauncher\basepanel.h" />
<ClInclude Include="..\sdklauncher\sdklauncher.h" />
<ClInclude Include="..\sdklauncher\sdklauncher_res.h" />
<ClInclude Include="..\thirdparty\detours\include\detours.h" />

View File

@ -30,6 +30,9 @@
<ClCompile Include="..\public\utility.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\sdklauncher\basepanel.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\resource\sdklauncher.rc">
@ -58,6 +61,9 @@
<ClInclude Include="..\public\include\utility.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\sdklauncher\basepanel.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="..\resource\ico\sdklauncher_rel.ico">