Finished GUI SDK Launcher

Implemented logic behind console frontend.
cleaned up sdklauncher.cpp (methods properly split up in class).
This commit is contained in:
Kawe Mazidjatari 2022-05-26 22:04:50 +02:00
parent 49be7e4e96
commit e1799887d0
6 changed files with 553 additions and 278 deletions

View File

@ -224,13 +224,14 @@ void CUIBaseSurface::Init()
this->m_CleanSDK->SetTabIndex(0); this->m_CleanSDK->SetTabIndex(0);
this->m_CleanSDK->SetText("Clean SDK"); this->m_CleanSDK->SetText("Clean SDK");
this->m_CleanSDK->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left); this->m_CleanSDK->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_CleanSDK->Click += &CleanSDK;
this->m_MainGroupExt->AddControl(this->m_CleanSDK); this->m_MainGroupExt->AddControl(this->m_CleanSDK);
this->m_UpdateSDK = new UIX::UIXButton(); this->m_UpdateSDK = new UIX::UIXButton();
this->m_UpdateSDK->SetSize({ 110, 18 }); this->m_UpdateSDK->SetSize({ 110, 18 });
this->m_UpdateSDK->SetLocation({ 15, 30 }); this->m_UpdateSDK->SetLocation({ 15, 30 });
this->m_UpdateSDK->SetTabIndex(0); this->m_UpdateSDK->SetTabIndex(0);
this->m_UpdateSDK->SetEnabled(false); this->m_UpdateSDK->SetEnabled(false); // !TODO: Implement updater
this->m_UpdateSDK->SetText("Update SDK"); this->m_UpdateSDK->SetText("Update SDK");
this->m_UpdateSDK->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left); this->m_UpdateSDK->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
this->m_MainGroupExt->AddControl(this->m_UpdateSDK); this->m_MainGroupExt->AddControl(this->m_UpdateSDK);
@ -427,24 +428,39 @@ void CUIBaseSurface::Init()
// CONSOLE // CONSOLE
// ######################################################################## // ########################################################################
this->m_ConsoleGroup = new UIX::UIXGroupBox(); this->m_ConsoleGroup = new UIX::UIXGroupBox();
this->m_ConsoleGroup->SetSize({ 429, 181 }); this->m_ConsoleGroup->SetSize({ 429, 15 });
this->m_ConsoleGroup->SetLocation({ 359, 158 }); this->m_ConsoleGroup->SetLocation({ 359, 158 });
this->m_ConsoleGroup->SetTabIndex(0); this->m_ConsoleGroup->SetTabIndex(0);
this->m_ConsoleGroup->SetText("Console"); this->m_ConsoleGroup->SetText("Console");
this->m_ConsoleGroup->SetAnchor(Forms::AnchorStyles::Bottom | Forms::AnchorStyles::Left | Forms::AnchorStyles::Right); this->m_ConsoleGroup->SetAnchor(Forms::AnchorStyles::Bottom | Forms::AnchorStyles::Left | Forms::AnchorStyles::Right);
this->AddControl(this->m_ConsoleGroup); this->AddControl(this->m_ConsoleGroup);
this->m_ConsoleGroupExt = new UIX::UIXGroupBox();
this->m_ConsoleGroupExt->SetSize({ 429, 167 });
this->m_ConsoleGroupExt->SetLocation({ 359, 172 });
this->m_ConsoleGroupExt->SetTabIndex(0);
this->m_ConsoleGroupExt->SetText("");
this->m_ConsoleGroupExt->SetAnchor(Forms::AnchorStyles::Bottom | Forms::AnchorStyles::Left | Forms::AnchorStyles::Right);
this->AddControl(this->m_ConsoleGroupExt);
this->m_ConsoleListView = new UIX::UIXListView(); this->m_ConsoleListView = new UIX::UIXListView();
this->m_ConsoleListView->SetSize({ 427, 165 }); this->m_ConsoleListView->SetSize({ 427, 189 });
this->m_ConsoleListView->SetLocation({ 1, 15 }); this->m_ConsoleListView->SetLocation({ 1, -23 }); // Hide columns
this->m_ConsoleListView->SetTabIndex(0); this->m_ConsoleListView->SetTabIndex(0);
this->m_ConsoleListView->SetText("0");
this->m_ConsoleListView->SetBackColor(Drawing::Color(29, 33, 37)); this->m_ConsoleListView->SetBackColor(Drawing::Color(29, 33, 37));
this->m_ConsoleListView->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left); this->m_ConsoleListView->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Bottom | Forms::AnchorStyles::Left | Forms::AnchorStyles::Right);
this->m_ConsoleGroup->AddControl(this->m_ConsoleListView); this->m_ConsoleListView->SetView(Forms::View::Details);
this->m_ConsoleListView->SetVirtualMode(true);
this->m_ConsoleListView->SetFullRowSelect(true);
this->m_ConsoleGroupExt->AddControl(this->m_ConsoleListView);
this->m_ConsoleListView->Columns.Add({ "index", 40 });
this->m_ConsoleListView->Columns.Add({ "buffer", 387 });
this->m_ConsoleListView->MouseClick += &VirtualItemToClipboard;
this->m_ConsoleListView->RetrieveVirtualItem += &GetVirtualItem;
this->ResumeLayout(false); this->ResumeLayout(false);
this->PerformLayout(); this->PerformLayout();
// END DESIGNER CODE // END DESIGNER CODE
} }
@ -465,6 +481,34 @@ void CUIBaseSurface::Setup()
this->m_VisibilityCombo->Items.Add("Offline"); this->m_VisibilityCombo->Items.Add("Offline");
} }
//-----------------------------------------------------------------------------
// Purpose: removes redundant files from the game install
// Input : *pSender -
//-----------------------------------------------------------------------------
void CUIBaseSurface::CleanSDK(Forms::Control* pSender)
{
CUIBaseSurface* pSurface = reinterpret_cast<CUIBaseSurface*>(pSender->FindForm());
pSurface->m_LogList.push_back(LogList_t(spdlog::level::info, "Running cleaner for SDK installation\n"));
pSurface->m_ConsoleListView->SetVirtualListSize(static_cast<int32_t>(pSurface->m_LogList.size()));
std::system("platform\\clean_sdk.bat");
}
//-----------------------------------------------------------------------------
// Purpose: launches the game with the SDK
// Input : *pSender -
//-----------------------------------------------------------------------------
void CUIBaseSurface::LaunchGame(Forms::Control* pSender)
{
string svParameter = "-launcher -dev ";
eLaunchMode launchMode = eLaunchMode::LM_NONE;
launchMode = g_pLauncher->GetMainSurface()->BuildParameter(svParameter);
if (g_pLauncher->Setup(launchMode, svParameter))
g_pLauncher->Launch();
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: parses all available maps from the main vpk directory // Purpose: parses all available maps from the main vpk directory
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -523,21 +567,6 @@ void CUIBaseSurface::ParsePlaylists()
} }
} }
//-----------------------------------------------------------------------------
// Purpose: launches the game with the SDK
// Input : *pSender -
//-----------------------------------------------------------------------------
void CUIBaseSurface::LaunchGame(Forms::Control* pSender)
{
string svParameter = "-launcher -dev ";
eLaunchMode launchMode = eLaunchMode::LM_NONE;
launchMode = g_pLauncher->GetMainSurface()->BuildParameter(svParameter);
g_pLauncher->Setup(launchMode, svParameter);
g_pLauncher->Launch();
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: clears the form and reloads the playlist // Purpose: clears the form and reloads the playlist
// Input : *pSender - // Input : *pSender -
@ -551,6 +580,77 @@ void CUIBaseSurface::ReloadPlaylists(Forms::Control* pSender)
pSurface->ParsePlaylists(); pSurface->ParsePlaylists();
} }
//-----------------------------------------------------------------------------
// Purpose: copies selected virtual items to clipboard
// Input : &pEventArgs -
// Input : *pSender -
//-----------------------------------------------------------------------------
void CUIBaseSurface::VirtualItemToClipboard(const std::unique_ptr<MouseEventArgs>& pEventArgs, Forms::Control* pSender)
{
if (pEventArgs->Button != Forms::MouseButtons::Right)
return;
CUIBaseSurface* pSurface = reinterpret_cast<CUIBaseSurface*>(pSender->FindForm());
List<uint32_t> lSelected = pSurface->m_ConsoleListView->SelectedIndices();
if (!lSelected.Count())
return;
string svClipBoard;
for (uint32_t i = 0; i < lSelected.Count(); i++)
svClipBoard.append(pSurface->m_LogList[i].m_svText);
clip::set_text(svClipBoard);
}
//-----------------------------------------------------------------------------
// Purpose: gets and handles the virtual item
// Input : &pEventArgs -
// *pSender -
//-----------------------------------------------------------------------------
void CUIBaseSurface::GetVirtualItem(const std::unique_ptr<Forms::RetrieveVirtualItemEventArgs>& pEventArgs, Forms::Control* pSender)
{
CUIBaseSurface* pSurface = reinterpret_cast<CUIBaseSurface*>(pSender->FindForm());
if (static_cast<int>(pSurface->m_LogList.size()) <= 0)
return;
pEventArgs->Style.ForeColor = Drawing::Color::White;
pEventArgs->Style.BackColor = pSender->BackColor();
pSurface->m_ConsoleListView->SetVirtualListSize(static_cast<int32_t>(pSurface->m_LogList.size()));
static const Drawing::Color cColor[] =
{
Drawing::Color(255, 255, 255), // Trace
Drawing::Color(0, 120, 215), // Debug
Drawing::Color(92, 236, 89), // Info
Drawing::Color(236, 203, 0), // Warn
Drawing::Color(236, 28, 0), // Error
Drawing::Color(236, 28, 0), // Critical
Drawing::Color(255, 255, 255), // General
};
static const String svLevel[] =
{
"trace",
"debug",
"info",
"warning",
"error",
"critical",
"general",
};
switch (pEventArgs->SubItemIndex)
{
case 0:
pEventArgs->Style.ForeColor = cColor[pSurface->m_LogList[pEventArgs->ItemIndex].m_nLevel];
pEventArgs->Text = svLevel[pSurface->m_LogList[pEventArgs->ItemIndex].m_nLevel];
break;
case 1:
pEventArgs->Text = pSurface->m_LogList[pEventArgs->ItemIndex].m_svText;
break;
}
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: clears the form and reloads the playlist // Purpose: clears the form and reloads the playlist
// Input : &svParameters - // Input : &svParameters -

View File

@ -1,24 +1,40 @@
#pragma once #pragma once
#include "sdklauncher_const.h" #include "sdklauncher_const.h"
struct LogList_t
{
LogList_t(spdlog::level::level_enum nLevel, String svText)
{
m_nLevel = nLevel;
m_svText = svText;
}
spdlog::level::level_enum m_nLevel;
String m_svText;
};
class CUIBaseSurface : public Forms::Form class CUIBaseSurface : public Forms::Form
{ {
public: public:
CUIBaseSurface(); CUIBaseSurface();
virtual ~CUIBaseSurface() = default; virtual ~CUIBaseSurface() = default;
std::vector<LogList_t> m_LogList;
UIX::UIXListView* m_ConsoleListView;
private: private:
void Init(); void Init();
void Setup(); void Setup();
void ParseMaps(); void ParseMaps();
void ParsePlaylists(); void ParsePlaylists();
static void LaunchGame(Forms::Control* pSender); static void LaunchGame(Forms::Control* pSender);
static void CleanSDK(Forms::Control* pSender);
static void ReloadPlaylists(Forms::Control* pSender); static void ReloadPlaylists(Forms::Control* pSender);
static void VirtualItemToClipboard(const std::unique_ptr<MouseEventArgs>& pEventArgs, Forms::Control* pSender);
static void GetVirtualItem(const std::unique_ptr<Forms::RetrieveVirtualItemEventArgs>& pEventArgs, Forms::Control* pSender);
eLaunchMode BuildParameter(string& svParameter); eLaunchMode BuildParameter(string& svParameter);
enum class eMode enum class eMode
{ {
NONE = -1, NONE = -1,
@ -57,6 +73,7 @@ private:
UIX::UIXGroupBox* m_MainGroup; UIX::UIXGroupBox* m_MainGroup;
UIX::UIXGroupBox* m_GameGroupExt; UIX::UIXGroupBox* m_GameGroupExt;
UIX::UIXGroupBox* m_MainGroupExt; UIX::UIXGroupBox* m_MainGroupExt;
UIX::UIXGroupBox* m_ConsoleGroupExt;
UIX::UIXGroupBox* m_ConsoleGroup; UIX::UIXGroupBox* m_ConsoleGroup;
UIX::UIXGroupBox* m_EngineBaseGroup; UIX::UIXGroupBox* m_EngineBaseGroup;
UIX::UIXGroupBox* m_EngineNetworkGroup; UIX::UIXGroupBox* m_EngineNetworkGroup;
@ -83,6 +100,4 @@ private:
UIX::UIXButton* m_CleanSDK; UIX::UIXButton* m_CleanSDK;
UIX::UIXButton* m_UpdateSDK; UIX::UIXButton* m_UpdateSDK;
UIX::UIXButton* m_LaunchSDK; UIX::UIXButton* m_LaunchSDK;
UIX::UIXListView* m_ConsoleListView;
}; };

View File

@ -6,21 +6,285 @@
#include "gdiplus.h" #include "gdiplus.h"
#include "shellapi.h" #include "shellapi.h"
using namespace Gdiplus; ///////////////////////////////////////////////////////////////////////////////
// Purpose: initializes the user interface
///////////////////////////////////////////////////////////////////////////////
void CLauncher::InitSurface()
{
Forms::Application::EnableVisualStyles();
UIX::UIXTheme::InitializeRenderer(new Themes::KoreTheme());
#pragma comment (lib,"Shell32.lib") g_pLauncher->m_pSurface = new CUIBaseSurface();
#pragma comment (lib,"Gdi32.lib") Forms::Application::Run(g_pLauncher->m_pSurface);
#pragma comment (lib,"Gdiplus.lib") UIX::UIXTheme::ShutdownRenderer();
#pragma comment (lib,"Advapi32.lib") }
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") ///////////////////////////////////////////////////////////////////////////////
// Purpose: initializes the console (release builds only)
///////////////////////////////////////////////////////////////////////////////
void CLauncher::InitConsole()
{
AllocConsole();
freopen("conin$", "r", stdin);
freopen("conout$", "w", stdout);
freopen("conout$", "w", stderr);
}
//----------------------------------------------------------------------------- ///////////////////////////////////////////////////////////////////////////////
// Purpose switch case: // Purpose: initializes the logger
// * Launch the game in user specified mode and state. ///////////////////////////////////////////////////////////////////////////////
// * Load specified command line arguments from a file on the disk. void CLauncher::InitLogger()
// * Format the file paths for the game exe and specified hook dll. {
//----------------------------------------------------------------------------- wconsole->set_pattern("[%^%l%$] %v");
wconsole->set_level(spdlog::level::trace);
spdlog::set_default_logger(wconsole); // Set as default.
}
///////////////////////////////////////////////////////////////////////////////
// Purpose: handles user input pre-init
// Input : argc -
// *argv -
// Output : exit_code (-1 if EP should continue to HandleInput)
///////////////////////////////////////////////////////////////////////////////
int CLauncher::HandleCmdLine(int argc, char* argv[])
{
for (int i = 1; i < __argc; ++i)
{
std::string arg = __argv[i];
if ((arg == "-debug") || (arg == "-dbg"))
{
if (g_pLauncher->Setup(eLaunchMode::LM_HOST_DEBUG, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
if ((arg == "-release") || (arg == "-rel"))
{
if (g_pLauncher->Setup(eLaunchMode::LM_HOST, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
if ((arg == "-dedicated_dev") || (arg == "-dedid"))
{
if (g_pLauncher->Setup(eLaunchMode::LM_SERVER_DEBUG, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
if ((arg == "-dedicated") || (arg == "-dedi"))
{
if (g_pLauncher->Setup(eLaunchMode::LM_SERVER, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
if ((arg == "-client_dev") || (arg == "-cld"))
{
if (g_pLauncher->Setup(eLaunchMode::LM_CLIENT_DEBUG, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
if ((arg == "-client") || (arg == "-cl"))
{
if (g_pLauncher->Setup(eLaunchMode::LM_CLIENT, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
}
return -1;
}
///////////////////////////////////////////////////////////////////////////////
// Purpose: handles user input post-init
// Output : exit_code
///////////////////////////////////////////////////////////////////////////////
int CLauncher::HandleInput()
{
std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl;
g_pLauncher->AddLog(spdlog::level::level_enum::warn, "If a DEBUG option has been choosen as launch parameter, do not broadcast servers to the Server Browser!\n");
g_pLauncher->AddLog(spdlog::level::level_enum::warn, "All FCVAR_CHEAT | FCVAR_DEVELOPMENTONLY ConVar's/ConCommand's will be enabled.\n");
g_pLauncher->AddLog(spdlog::level::level_enum::warn, "Connected clients will be able to set and execute anything flagged FCVAR_CHEAT | FCVAR_DEVELOPMENTONLY.\n");
std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl;
g_pLauncher->AddLog(spdlog::level::level_enum::warn, "Use DEBUG HOST [0] for research and development purposes.\n");
g_pLauncher->AddLog(spdlog::level::level_enum::warn, "Use RELEASE HOST [1] for playing the game and creating servers.\n");
g_pLauncher->AddLog(spdlog::level::level_enum::warn, "Use DEBUG SERVER [2] for research and development purposes.\n");
g_pLauncher->AddLog(spdlog::level::level_enum::warn, "Use RELEASE SERVER [3] for running and hosting dedicated servers.\n");
g_pLauncher->AddLog(spdlog::level::level_enum::warn, "Use DEBUG CLIENT [4] for research and development purposes.\n");
g_pLauncher->AddLog(spdlog::level::level_enum::warn, "Use RELEASE CLIENT [5] for running client only builds against remote servers.\n");
std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl;
g_pLauncher->AddLog(spdlog::level::level_enum::info, "Enter '0' for 'DEBUG HOST'.\n");
g_pLauncher->AddLog(spdlog::level::level_enum::info, "Enter '1' for 'RELEASE HOST'.\n");
g_pLauncher->AddLog(spdlog::level::level_enum::info, "Enter '2' for 'DEBUG SERVER'.\n");
g_pLauncher->AddLog(spdlog::level::level_enum::info, "Enter '3' for 'RELEASE SERVER'.\n");
g_pLauncher->AddLog(spdlog::level::level_enum::info, "Enter '4' for 'DEBUG CLIENT'.\n");
g_pLauncher->AddLog(spdlog::level::level_enum::info, "Enter '5' for 'RELEASE CLIENT'.\n");
std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl;
std::cout << "User input: ";
std::string input = std::string();
if (std::cin >> input)
{
try
{
eLaunchMode mode = static_cast<eLaunchMode>(std::stoi(input));
switch (mode)
{
case eLaunchMode::LM_HOST_DEBUG:
{
if (g_pLauncher->Setup(mode, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
case eLaunchMode::LM_HOST:
{
if (g_pLauncher->Setup(mode, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
case eLaunchMode::LM_SERVER_DEBUG:
{
if (g_pLauncher->Setup(mode, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
case eLaunchMode::LM_SERVER:
{
if (g_pLauncher->Setup(mode, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
case eLaunchMode::LM_CLIENT_DEBUG:
{
if (g_pLauncher->Setup(mode, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
case eLaunchMode::LM_CLIENT:
{
if (g_pLauncher->Setup(mode, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
default:
{
g_pLauncher->AddLog(spdlog::level::level_enum::err, "Invalid mode (range 0-5).\n");
Sleep(2000);
return EXIT_FAILURE;
}
}
}
catch (std::exception& e)
{
g_pLauncher->AddLog(spdlog::level::level_enum::err, "SDK Launcher only takes numerical input. Error: {:s}.\n", e.what());
Sleep(2000);
return EXIT_FAILURE;
}
}
g_pLauncher->AddLog(spdlog::level::level_enum::err, "SDK Launcher requires numerical input.\n");
Sleep(2000);
return EXIT_FAILURE;
}
///////////////////////////////////////////////////////////////////////////////
// Purpose: setup for game dll's and configurations
// Input : lMode -
// lState -
// Output : true on success, false otherwise
///////////////////////////////////////////////////////////////////////////////
bool CLauncher::Setup(eLaunchMode lMode, eLaunchState lState) bool CLauncher::Setup(eLaunchMode lMode, eLaunchState lState)
{ {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@ -41,17 +305,15 @@ bool CLauncher::Setup(eLaunchMode lMode, eLaunchState lState)
} }
else else
{ {
spdlog::error("File 'platform\\cfg\\startup_debug.cfg' does not exist!\n"); AddLog(spdlog::level::level_enum::err, "File 'platform\\cfg\\startup_debug.cfg' does not exist!\n");
cfgFile.close();
return false; return false;
} }
cfgFile.close(); // Close cfg file.
m_svWorkerDll = m_svCurrentDir + "\\gamesdk.dll"; m_svWorkerDll = m_svCurrentDir + "\\gamesdk.dll";
m_svGameExe = m_svCurrentDir + "\\r5apex.exe"; m_svGameExe = m_svCurrentDir + "\\r5apex.exe";
m_svCmdLine = m_svCurrentDir + "\\r5apex.exe " + svCmdLineArgs; m_svCmdLine = m_svCurrentDir + "\\r5apex.exe " + svCmdLineArgs;
spdlog::info("*** LAUNCHING GAME [DEBUG] ***\n"); AddLog(spdlog::level::level_enum::info, "*** LAUNCHING GAME [DEBUG] ***\n");
break; break;
} }
case eLaunchMode::LM_HOST: case eLaunchMode::LM_HOST:
@ -66,17 +328,15 @@ bool CLauncher::Setup(eLaunchMode lMode, eLaunchState lState)
} }
else else
{ {
spdlog::error("File 'platform\\cfg\\startup_retail.cfg' does not exist!\n"); AddLog(spdlog::level::level_enum::err, "File 'platform\\cfg\\startup_retail.cfg' does not exist!\n");
cfgFile.close();
return false; return false;
} }
cfgFile.close(); // Close cfg file.
m_svWorkerDll = m_svCurrentDir + "\\gamesdk.dll"; m_svWorkerDll = m_svCurrentDir + "\\gamesdk.dll";
m_svGameExe = m_svCurrentDir + "\\r5apex.exe"; m_svGameExe = m_svCurrentDir + "\\r5apex.exe";
m_svCmdLine = m_svCurrentDir + "\\r5apex.exe " + svCmdLineArgs; m_svCmdLine = m_svCurrentDir + "\\r5apex.exe " + svCmdLineArgs;
spdlog::info("*** LAUNCHING GAME [RELEASE] ***\n"); AddLog(spdlog::level::level_enum::info, "*** LAUNCHING GAME [RELEASE] ***\n");
break; break;
} }
case eLaunchMode::LM_SERVER_DEBUG: case eLaunchMode::LM_SERVER_DEBUG:
@ -91,17 +351,15 @@ bool CLauncher::Setup(eLaunchMode lMode, eLaunchState lState)
} }
else else
{ {
spdlog::error("File 'platform\\cfg\\startup_dedi_debug.cfg' does not exist!\n"); AddLog(spdlog::level::level_enum::err, "File 'platform\\cfg\\startup_dedi_debug.cfg' does not exist!\n");
cfgFile.close();
return false; return false;
} }
cfgFile.close(); // Close cfg file.
m_svWorkerDll = m_svCurrentDir + "\\dedicated.dll"; m_svWorkerDll = m_svCurrentDir + "\\dedicated.dll";
m_svGameExe = m_svCurrentDir + "\\r5apex_ds.exe"; m_svGameExe = m_svCurrentDir + "\\r5apex_ds.exe";
m_svCmdLine = m_svCurrentDir + "\\r5apex_ds.exe " + svCmdLineArgs; m_svCmdLine = m_svCurrentDir + "\\r5apex_ds.exe " + svCmdLineArgs;
spdlog::info("*** LAUNCHING DEDICATED [DEBUG] ***\n"); AddLog(spdlog::level::level_enum::info, "*** LAUNCHING DEDICATED [DEBUG] ***\n");
break; break;
} }
case eLaunchMode::LM_SERVER: case eLaunchMode::LM_SERVER:
@ -116,38 +374,88 @@ bool CLauncher::Setup(eLaunchMode lMode, eLaunchState lState)
} }
else else
{ {
spdlog::error("File 'platform\\cfg\\startup_dedi_retail.cfg' does not exist!\n"); AddLog(spdlog::level::level_enum::err, "File 'platform\\cfg\\startup_dedi_retail.cfg' does not exist!\n");
cfgFile.close();
return false; return false;
} }
cfgFile.close(); // Close cfg file.
m_svWorkerDll = m_svCurrentDir + "\\dedicated.dll"; m_svWorkerDll = m_svCurrentDir + "\\dedicated.dll";
m_svGameExe = m_svCurrentDir + "\\r5apex_ds.exe"; m_svGameExe = m_svCurrentDir + "\\r5apex_ds.exe";
m_svCmdLine = m_svCurrentDir + "\\r5apex_ds.exe " + svCmdLineArgs; m_svCmdLine = m_svCurrentDir + "\\r5apex_ds.exe " + svCmdLineArgs;
spdlog::info("*** LAUNCHING DEDICATED [RELEASE] ***\n"); AddLog(spdlog::level::level_enum::info, "*** LAUNCHING DEDICATED [RELEASE] ***\n");
break;
}
case eLaunchMode::LM_CLIENT_DEBUG:
{
fs::path cfgPath = fs::current_path() /= "platform\\cfg\\startup_client_debug.cfg";
std::ifstream cfgFile(cfgPath);
if (cfgFile.good() && cfgFile)
{
std::stringstream ss;
ss << cfgFile.rdbuf();
svCmdLineArgs = ss.str(); +"-launcher";
}
else
{
AddLog(spdlog::level::level_enum::err, "File 'platform\\cfg\\startup_client_debug.cfg' does not exist!\n");
return false;
}
m_svWorkerDll = m_svCurrentDir + "\\bin\\client.dll";
m_svGameExe = m_svCurrentDir + "\\r5apex.exe";
m_svCmdLine = m_svCurrentDir + "\\r5apex.exe " + svCmdLineArgs;
AddLog(spdlog::level::level_enum::info, "*** LAUNCHING CLIENT [DEBUG] ***\n");
break;
}
case eLaunchMode::LM_CLIENT:
{
fs::path cfgPath = fs::current_path() /= "platform\\cfg\\startup_client_retail.cfg";
std::ifstream cfgFile(cfgPath);
if (cfgFile.good() && cfgFile)
{
std::stringstream ss;
ss << cfgFile.rdbuf();
svCmdLineArgs = ss.str(); +"-launcher";
}
else
{
AddLog(spdlog::level::level_enum::err, "File 'platform\\cfg\\startup_client_retail.cfg' does not exist!\n");
return false;
}
m_svWorkerDll = m_svCurrentDir + "\\bin\\client.dll";
m_svGameExe = m_svCurrentDir + "\\r5apex.exe";
m_svCmdLine = m_svCurrentDir + "\\r5apex.exe " + svCmdLineArgs;
AddLog(spdlog::level::level_enum::info, "*** LAUNCHING CLIENT [RELEASE] ***\n");
break; break;
} }
default: default:
{ {
spdlog::error("*** NO LAUNCH MODE SPECIFIED ***\n"); AddLog(spdlog::level::level_enum::err, "*** NO LAUNCH MODE SPECIFIED ***\n");
return false; return false;
} }
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// Print the file paths and arguments. // Print the file paths and arguments.
std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl; std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl;
spdlog::debug("- CWD: {}\n", m_svCurrentDir); g_pLauncher->AddLog(spdlog::level::level_enum::debug, "- CWD: {:s}\n", m_svCurrentDir);
spdlog::debug("- EXE: {}\n", m_svGameExe); g_pLauncher->AddLog(spdlog::level::level_enum::debug, "- EXE: {:s}\n", m_svGameExe);
spdlog::debug("- DLL: {}\n", m_svWorkerDll); g_pLauncher->AddLog(spdlog::level::level_enum::debug, "- DLL: {:s}\n", m_svWorkerDll);
spdlog::debug("- CLI: {}\n", svCmdLineArgs); g_pLauncher->AddLog(spdlog::level::level_enum::debug, "- CLI: {:s}\n", svCmdLineArgs);
std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl; std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl;
return true; return true;
} }
///////////////////////////////////////////////////////////////////////////////
// Purpose: setup for game dll's and configurations
// Input : lMode -
// &svCommandLine -
// Output : true on success, false otherwise
///////////////////////////////////////////////////////////////////////////////
bool CLauncher::Setup(eLaunchMode lMode, const string& svCommandLine) bool CLauncher::Setup(eLaunchMode lMode, const string& svCommandLine)
{ {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@ -161,7 +469,7 @@ bool CLauncher::Setup(eLaunchMode lMode, const string& svCommandLine)
m_svGameExe = m_svCurrentDir + "\\r5apex.exe"; m_svGameExe = m_svCurrentDir + "\\r5apex.exe";
m_svCmdLine = m_svCurrentDir + "\\r5apex.exe " + svCommandLine; m_svCmdLine = m_svCurrentDir + "\\r5apex.exe " + svCommandLine;
spdlog::info("*** LAUNCHER SETUP FOR HOST [DEBUG] ***\n"); AddLog(spdlog::level::level_enum::info, "*** LAUNCHER SETUP FOR HOST [DEBUG] ***\n");
break; break;
} }
case eLaunchMode::LM_HOST: case eLaunchMode::LM_HOST:
@ -170,7 +478,7 @@ bool CLauncher::Setup(eLaunchMode lMode, const string& svCommandLine)
m_svGameExe = m_svCurrentDir + "\\r5apex.exe"; m_svGameExe = m_svCurrentDir + "\\r5apex.exe";
m_svCmdLine = m_svCurrentDir + "\\r5apex.exe " + svCommandLine; m_svCmdLine = m_svCurrentDir + "\\r5apex.exe " + svCommandLine;
spdlog::info("*** LAUNCHER SETUP FOR HOST [RELEASE] ***\n"); AddLog(spdlog::level::level_enum::info, "*** LAUNCHER SETUP FOR HOST [RELEASE] ***\n");
break; break;
} }
case eLaunchMode::LM_SERVER_DEBUG: case eLaunchMode::LM_SERVER_DEBUG:
@ -179,7 +487,7 @@ bool CLauncher::Setup(eLaunchMode lMode, const string& svCommandLine)
m_svGameExe = m_svCurrentDir + "\\r5apex_ds.exe"; m_svGameExe = m_svCurrentDir + "\\r5apex_ds.exe";
m_svCmdLine = m_svCurrentDir + "\\r5apex_ds.exe " + svCommandLine; m_svCmdLine = m_svCurrentDir + "\\r5apex_ds.exe " + svCommandLine;
spdlog::info("*** LAUNCHER SETUP FOR DEDICATED [DEBUG] ***\n"); AddLog(spdlog::level::level_enum::info, "*** LAUNCHER SETUP FOR DEDICATED [DEBUG] ***\n");
break; break;
} }
case eLaunchMode::LM_SERVER: case eLaunchMode::LM_SERVER:
@ -188,12 +496,30 @@ bool CLauncher::Setup(eLaunchMode lMode, const string& svCommandLine)
m_svGameExe = m_svCurrentDir + "\\r5apex_ds.exe"; m_svGameExe = m_svCurrentDir + "\\r5apex_ds.exe";
m_svCmdLine = m_svCurrentDir + "\\r5apex_ds.exe " + svCommandLine; m_svCmdLine = m_svCurrentDir + "\\r5apex_ds.exe " + svCommandLine;
spdlog::info("*** LAUNCHER SETUP FOR DEDICATED [RELEASE] ***\n"); AddLog(spdlog::level::level_enum::info, "*** LAUNCHER SETUP FOR DEDICATED [RELEASE] ***\n");
break;
}
case eLaunchMode::LM_CLIENT_DEBUG:
{
m_svWorkerDll = m_svCurrentDir + "\\bin\\client.dll";
m_svGameExe = m_svCurrentDir + "\\r5apex.exe";
m_svCmdLine = m_svCurrentDir + "\\r5apex.exe " + svCommandLine;
AddLog(spdlog::level::level_enum::info, "*** LAUNCHER SETUP FOR CLIENT [DEBUG] ***\n");
break;
}
case eLaunchMode::LM_CLIENT:
{
m_svWorkerDll = m_svCurrentDir + "\\bin\\client.dll";
m_svGameExe = m_svCurrentDir + "\\r5apex.exe";
m_svCmdLine = m_svCurrentDir + "\\r5apex.exe " + svCommandLine;
AddLog(spdlog::level::level_enum::info, "*** LAUNCHER SETUP FOR CLIENT [RELEASE] ***\n");
break; break;
} }
default: default:
{ {
spdlog::error("*** INVALID LAUNCH MODE SPECIFIED ***\n"); AddLog(spdlog::level::level_enum::err, "*** INVALID LAUNCH MODE SPECIFIED ***\n");
return false; return false;
} }
} }
@ -201,16 +527,20 @@ bool CLauncher::Setup(eLaunchMode lMode, const string& svCommandLine)
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// Print the file paths and arguments. // Print the file paths and arguments.
std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl; std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl;
spdlog::debug("- CWD: {}\n", m_svCurrentDir); g_pLauncher->AddLog(spdlog::level::level_enum::debug, "- CWD: {:s}\n", m_svCurrentDir);
spdlog::debug("- EXE: {}\n", m_svGameExe); g_pLauncher->AddLog(spdlog::level::level_enum::debug, "- EXE: {:s}\n", m_svGameExe);
spdlog::debug("- DLL: {}\n", m_svWorkerDll); g_pLauncher->AddLog(spdlog::level::level_enum::debug, "- DLL: {:s}\n", m_svWorkerDll);
spdlog::debug("- CLI: {}\n", svCommandLine); g_pLauncher->AddLog(spdlog::level::level_enum::debug, "- CLI: {:s}\n", svCommandLine);
std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl; std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl;
return true; return true;
} }
bool CLauncher::Launch() ///////////////////////////////////////////////////////////////////////////////
// Purpose: launhes the game with results from the setup
// Output : true on success, false otherwise
///////////////////////////////////////////////////////////////////////////////
bool CLauncher::Launch() const
{ {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// Build our list of dlls to inject. // Build our list of dlls to inject.
@ -269,185 +599,19 @@ bool CLauncher::Launch()
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
int main(int argc, char* argv[], char* envp[]) int main(int argc, char* argv[], char* envp[])
{ {
spdlog::set_pattern("[%^%l%$] %v"); g_pLauncher->InitLogger();
spdlog::set_level(spdlog::level::trace); if (__argc < 2)
if (argc < 2)
{ {
Forms::Application::EnableVisualStyles(); FreeConsole();
UIX::UIXTheme::InitializeRenderer(new Themes::KoreTheme()); g_pLauncher->InitSurface();
g_pLauncher->m_pSurface = new CUIBaseSurface();
Forms::Application::Run(g_pLauncher->m_pSurface);
UIX::UIXTheme::ShutdownRenderer();
} }
else else
{ {
for (int i = 1; i < argc; ++i) int results = g_pLauncher->HandleCmdLine(__argc, __argv);
{ if (results != -1)
std::string arg = argv[i]; return results;
if ((arg == "-debug") || (arg == "-dbg"))
{
if (g_pLauncher->Setup(eLaunchMode::LM_HOST_DEBUG, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000); return g_pLauncher->HandleInput();
return EXIT_FAILURE;
}
if ((arg == "-release") || (arg == "-rel"))
{
if (g_pLauncher->Setup(eLaunchMode::LM_HOST, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
if ((arg == "-dedicated_dev") || (arg == "-dedid"))
{
if (g_pLauncher->Setup(eLaunchMode::LM_SERVER_DEBUG, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
if ((arg == "-dedicated") || (arg == "-dedi"))
{
if (g_pLauncher->Setup(eLaunchMode::LM_SERVER, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
}
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 HOST [1] for research and development purposes.\n");
spdlog::warn("Use RELEASE HOST [2] for playing the game and creating servers.\n");
spdlog::warn("Use DEBUG SERVER [3] for research and development purposes.\n");
spdlog::warn("Use RELEASE SERVER [4] for running and hosting dedicated servers.\n");
spdlog::warn("Use DEBUG CLIENT [5] for research and development purposes.\n");
spdlog::warn("Use RELEASE CLIENT [6] for running client only builds against remote servers.\n");
std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl;
spdlog::info("Enter '1' for 'DEBUG HOST'.\n");
spdlog::info("Enter '2' for 'RELEASE HOST'.\n");
spdlog::info("Enter '3' for 'DEBUG SERVER'.\n");
spdlog::info("Enter '4' for 'RELEASE SERVER'.\n");
spdlog::info("Enter '5' for 'DEBUG CLIENT'.\n");
spdlog::info("Enter '6' for 'RELEASE CLIENT'.\n");
std::cout << "----------------------------------------------------------------------------------------------------------------------" << std::endl;
std::cout << "User input: ";
std::string input = std::string();
if (std::cin >> input)
{
try
{
eLaunchMode mode = (eLaunchMode)std::stoi(input);
switch (mode)
{
case eLaunchMode::LM_HOST_DEBUG:
{
if (g_pLauncher->Setup(eLaunchMode::LM_HOST_DEBUG, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
case eLaunchMode::LM_HOST:
{
if (g_pLauncher->Setup(eLaunchMode::LM_HOST, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
case eLaunchMode::LM_SERVER_DEBUG:
{
if (g_pLauncher->Setup(eLaunchMode::LM_SERVER_DEBUG, eLaunchState::LS_CHEATS))
{
if (g_pLauncher->Launch())
{
Sleep(2000);
return EXIT_SUCCESS;
}
}
Sleep(2000);
return EXIT_FAILURE;
}
case eLaunchMode::LM_SERVER:
{
if (g_pLauncher->Setup(eLaunchMode::LM_SERVER, 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;
}
}
spdlog::error("R5Reloaded requires numerical input to launch.\n");
Sleep(5000);
return EXIT_FAILURE;
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include "basepanel.h" #include "basepanel.h"
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
class CLauncher class CLauncher
{ {
@ -7,21 +8,41 @@ public:
CLauncher() CLauncher()
{ {
m_svCurrentDir = fs::current_path().u8string(); m_svCurrentDir = fs::current_path().u8string();
//m_pMainUI = new CUIBasePanel();
} }
~CLauncher() ~CLauncher()
{ {
delete[] m_pSurface; delete[] m_pSurface;
} }
template <typename T, typename ...P>
void AddLog(spdlog::level::level_enum nLevel, T&& svFormat, P &&... vParams)
{
String svBuffer = fmt::format(std::forward<T>(svFormat), std::forward<P>(vParams)...).c_str();
wconsole->log(nLevel, svBuffer.ToCString());
wconsole->flush();
if (m_pSurface)
{
m_pSurface->m_LogList.push_back(LogList_t(nLevel, svBuffer));
m_pSurface->m_ConsoleListView->SetVirtualListSize(static_cast<int32_t>(m_pSurface->m_LogList.size()));
m_pSurface->m_ConsoleListView->Refresh();
}
}
void InitSurface();
void InitConsole();
void InitLogger();
int HandleCmdLine(int argc, char* argv[]);
int HandleInput();
bool Setup(eLaunchMode lMode, eLaunchState lState); bool Setup(eLaunchMode lMode, eLaunchState lState);
bool Setup(eLaunchMode lMode, const string& svCommandLine); bool Setup(eLaunchMode lMode, const string& svCommandLine);
bool Launch(); bool Launch() const;
CUIBaseSurface* GetMainSurface() const { return m_pSurface; } CUIBaseSurface* GetMainSurface() const { return m_pSurface; }
CUIBaseSurface* m_pSurface;
private: private:
CUIBaseSurface* m_pSurface = nullptr;
std::shared_ptr<spdlog::logger> wconsole = spdlog::stdout_color_mt("win_console");
string m_svWorkerDll; string m_svWorkerDll;
string m_svGameExe; string m_svGameExe;

View File

@ -7,35 +7,10 @@
namespace Themes namespace Themes
{ {
// Constants for brushes // Constants for brushes
/*const static auto BorderBrush = Drawing::Color(219, 56, 80);
const static auto DisabledBorderBrush = Drawing::Color(30, 32, 55);
const static auto BackgroundBrush = Drawing::Color(30, 32, 55);
const static auto BackgroundLightBrush = Drawing::Color(31, 37, 62);
const static auto BackgroundGrad1 = Drawing::Color(30, 32, 55);
const static auto BackgroundGrad2 = Drawing::Color(30, 32, 55);
const static auto BackgroundOverGrad1 = Drawing::Color(30, 32, 55);
const static auto BackgroundOverGrad2 = Drawing::Color(30, 32, 55);
const static auto TextEnabledBrush = Drawing::Color(Drawing::Color::White);
const static auto TextDisabledBrush = Drawing::Color(Drawing::Color::Gray);
const static auto ProgressGrad1 = Drawing::Color(219, 56, 80);
const static auto ProgressGrad2 = Drawing::Color(219, 56, 80);
const static auto HeaderBrush = Drawing::Color(46, 53, 84);*/
// New Theme, saving for anyone else who wants to help.
const static auto BorderBrush = Drawing::Color(20, 20, 20); const static auto BorderBrush = Drawing::Color(20, 20, 20);
const static auto DarkBorderBrush = Drawing::Color(20, 20, 20); const static auto DarkBorderBrush = Drawing::Color(20, 20, 20);
const static auto DisabledBorderBrush = Drawing::Color(20, 20, 20); const static auto DisabledBorderBrush = Drawing::Color(20, 20, 20);
const static auto ControlBrushSelected = Drawing::Color(0, 120, 215);
const static auto BackgroundBrush = Drawing::Color(36, 41, 46); const static auto BackgroundBrush = Drawing::Color(36, 41, 46);
const static auto BackgroundLightBrush = Drawing::Color(47, 54, 61); const static auto BackgroundLightBrush = Drawing::Color(47, 54, 61);
@ -52,7 +27,7 @@ namespace Themes
const static auto ProgressGrad1 = Drawing::Color(0, 120, 215); const static auto ProgressGrad1 = Drawing::Color(0, 120, 215);
const static auto ProgressGrad2 = Drawing::Color(0, 120, 215); const static auto ProgressGrad2 = Drawing::Color(0, 120, 215);
const static auto HeaderBrush = Drawing::Color(54, 54, 54); const static auto HeaderBrush = Drawing::Color(47, 54, 61);
// Constants for images // Constants for images
static Drawing::Image* CheckBoxImage = nullptr; static Drawing::Image* CheckBoxImage = nullptr;
@ -423,7 +398,7 @@ namespace Themes
auto State = SendMessageA(Ctrl->GetHandle(), LVM_GETITEMSTATE, (WPARAM)EventArgs->ItemIndex, (LPARAM)LVIS_SELECTED); auto State = SendMessageA(Ctrl->GetHandle(), LVM_GETITEMSTATE, (WPARAM)EventArgs->ItemIndex, (LPARAM)LVIS_SELECTED);
// Fetch color from style // Fetch color from style
Drawing::SolidBrush BackBrush((State == LVIS_SELECTED) ? BorderBrush : EventArgs->Style.BackColor); Drawing::SolidBrush BackBrush((State == LVIS_SELECTED) ? ControlBrushSelected : EventArgs->Style.BackColor);
// Build text layout rect // Build text layout rect
Drawing::Rectangle TextLayoutRect(SubItemBounds); Drawing::Rectangle TextLayoutRect(SubItemBounds);

View File

@ -79,7 +79,7 @@
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libcppkore_x64.lib;libdetours_x64.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>libcppkore_x64.lib;libdetours_x64.lib;shell32.lib;gdi32.lib;gdiplus.lib;advapi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)lib\$(Configuration)\</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Configuration)\</AdditionalLibraryDirectories>
</Link> </Link>
<PostBuildEvent> <PostBuildEvent>
@ -113,7 +113,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libcppkore_x64.lib;libdetours_x64.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>libcppkore_x64.lib;libdetours_x64.lib;shell32.lib;gdi32.lib;gdiplus.lib;advapi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)lib\$(Configuration)\</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(SolutionDir)lib\$(Configuration)\</AdditionalLibraryDirectories>
<SetChecksum>true</SetChecksum> <SetChecksum>true</SetChecksum>
</Link> </Link>