Overall launcher cleanup and improvements

Use clean_sdk.bat to clean the SDK install.
This commit is contained in:
Kawe Mazidjatari 2023-10-21 18:00:25 +02:00
parent f4df4e0fc0
commit ae098603bb
5 changed files with 33 additions and 36 deletions

View File

@ -704,7 +704,7 @@ void CAdvancedSurface::CleanSDK(Forms::Control* pSender)
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");
std::system("bin\\clean_sdk.bat");
}
//-----------------------------------------------------------------------------
@ -717,7 +717,7 @@ void CAdvancedSurface::UpdateSDK(Forms::Control* pSender)
pSurface->m_LogList.push_back(LogList_t(spdlog::level::info, "Running updater for SDK installation\n"));
pSurface->m_ConsoleListView->SetVirtualListSize(static_cast<int32_t>(pSurface->m_LogList.size()));
std::system("platform\\update_sdk.bat");
std::system("bin\\update_sdk.bat");
}
//-----------------------------------------------------------------------------

View File

@ -61,12 +61,12 @@ CBaseSurface::CBaseSurface()
this->m_RepairButton->SetSize({ 168, 70 });
this->m_RepairButton->SetLocation({ 10, 90 });
this->m_RepairButton->SetTabIndex(9);
this->m_RepairButton->SetEnabled(/*m_bIsInstalled*/ false);
this->m_RepairButton->SetText(XorStr("Repair Apex"));
this->m_RepairButton->SetEnabled(/*m_bIsInstalled*/ true);
this->m_RepairButton->SetText(XorStr("Advanced Options"));
this->m_RepairButton->SetAnchor(Forms::AnchorStyles::Bottom | Forms::AnchorStyles::Left);
// TODO: should hash every file against a downloaded manifest instead and
// start repairing what mismatches.
this->m_RepairButton->Click += &OnInstallClick;
this->m_RepairButton->Click += &OnAdvancedClick;
m_BaseGroup->AddControl(this->m_RepairButton);
this->m_DonateButton = new UIX::UIXButton();
@ -92,9 +92,9 @@ CBaseSurface::CBaseSurface()
this->m_AdvancedButton->SetLocation({ 188, 116 });
this->m_AdvancedButton->SetTabIndex(9);
this->m_AdvancedButton->SetEnabled(m_bIsInstalled);
this->m_AdvancedButton->SetText(XorStr("Advanced Options"));
this->m_AdvancedButton->SetText(XorStr("Follow on YouTube"));
this->m_AdvancedButton->SetAnchor(Forms::AnchorStyles::Bottom | Forms::AnchorStyles::Left);
this->m_AdvancedButton->Click += &OnAdvancedClick;
this->m_AdvancedButton->Click += &OnYouTubeClick;
m_BaseGroup->AddControl(this->m_AdvancedButton);
m_ExperimentalBuildsCheckbox = new UIX::UIXCheckBox();
@ -104,13 +104,10 @@ CBaseSurface::CBaseSurface()
this->m_ExperimentalBuildsCheckbox->SetText(XorStr("Check for playtest/event updates"));
this->m_ExperimentalBuildsCheckbox->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left);
// TODO: remove this when its made public!!!
m_ExperimentalBuildsCheckbox->SetChecked(true);
m_BaseGroup->AddControl(this->m_ExperimentalBuildsCheckbox);
// TODO: Use a toggle item instead; remove this field.
m_bPartialInstall = false;
m_bPartialInstall = true;
m_bUpdateViewToggled = false;
Threading::Thread([this] {
@ -216,20 +213,20 @@ void CBaseSurface::OnInstallClick(Forms::Control* Sender)
}
//CBaseSurface* pSurf = (CBaseSurface*)Sender;
//const bool bPartial = pSurf->m_bPartialInstall;
CBaseSurface* pSurf = (CBaseSurface*)Sender;
const bool bPartial = pSurf->m_bPartialInstall;
//const int minRequiredSpace = bPartial ? MIN_REQUIRED_DISK_SPACE : MIN_REQUIRED_DISK_SPACE_OPT;
//int currentDiskSpace;
const int minRequiredSpace = bPartial ? MIN_REQUIRED_DISK_SPACE : MIN_REQUIRED_DISK_SPACE_OPT;
int currentDiskSpace;
//if (!SDKLauncher_CheckDiskSpace(minRequiredSpace, &currentDiskSpace))
//{
// Forms::MessageBox::Show(Format("There is not enough space available on the disk to install R5Reloaded;"
// " you need at least %iGB, you currently have %iGB\n", minRequiredSpace, currentDiskSpace).c_str(),
// "Error", Forms::MessageBoxButtons::OK, Forms::MessageBoxIcon::Error);
if (!SDKLauncher_CheckDiskSpace(minRequiredSpace, &currentDiskSpace))
{
Forms::MessageBox::Show(Format("There is not enough space available on the disk to install R5Reloaded;"
" you need at least %iGB, you currently have %iGB\n", minRequiredSpace, currentDiskSpace).c_str(),
"Error", Forms::MessageBoxButtons::OK, Forms::MessageBoxIcon::Error);
// return;
//}
return;
}
auto downloadSurface = std::make_unique<CProgressPanel>();
CProgressPanel* pProgress = downloadSurface.get();
@ -240,7 +237,7 @@ void CBaseSurface::OnInstallClick(Forms::Control* Sender)
if (!SDKLauncher_CreateDepotDirectories())
{
Forms::MessageBox::Show(Format("Failed to create depot directories: Error code = %08x\n", GetLastError()).c_str(),
Forms::MessageBox::Show(Format("Failed to create intermediate directory: Error code = %08x\n", GetLastError()).c_str(),
"Error", Forms::MessageBoxButtons::OK, Forms::MessageBoxIcon::Error);
return;
@ -277,10 +274,15 @@ void CBaseSurface::OnAdvancedClick(Forms::Control* Sender)
void CBaseSurface::OnSupportClick(Forms::Control* /*Sender*/)
{
ShellExecute(0, 0, XorStr("https://www.paypal.com/donate/?hosted_button_id=S28DHC2TF6UV4"), 0, 0, SW_SHOW);
ShellExecute(0, 0, XorStr("https://ko-fi.com/amos0"), 0, 0, SW_SHOW);
}
void CBaseSurface::OnJoinClick(Forms::Control* /*Sender*/)
{
ShellExecute(0, 0, XorStr("https://discord.com/invite/jqMkUdXrBr"), 0, 0, SW_SHOW);
}
void CBaseSurface::OnYouTubeClick(Forms::Control* /*Sender*/)
{
ShellExecute(0, 0, XorStr("https://www.youtube.com/@AmosMods"), 0, 0, SW_SHOW);
}

View File

@ -20,6 +20,7 @@ protected:
static void OnSupportClick(Forms::Control* Sender);
static void OnJoinClick(Forms::Control* Sender);
static void OnYouTubeClick(Forms::Control* Sender);
private:
void Frame();

View File

@ -13,7 +13,7 @@
// Gigabytes.
// TODO: obtain these from the repo...
#define MIN_REQUIRED_DISK_SPACE 20
#define MIN_REQUIRED_DISK_SPACE 35
#define MIN_REQUIRED_DISK_SPACE_OPT 55 // Optional textures
#define QUERY_TIMEOUT 15

View File

@ -24,18 +24,12 @@ DWORD ErrorAndExit(const char* pSymbol)
}
//----------------------------------------------------------------------------
// TODO: this code is from the SDK launcher, make it shared!
// Purpose: clears all intermediate and deprecated files
//----------------------------------------------------------------------------
bool ClearDepotDirectories()
bool ClearIntermediateFiles()
{
// Clear all depot files.
if (!RemoveDirectoryA(RESTART_DEPOT_DOWNLOAD_DIR) ||
!RemoveDirectoryA(DEFAULT_DEPOT_DOWNLOAD_DIR))
{
return false;
}
return true;
const bool bret = std::system("bin\\clean_sdk.bat") != NULL;
return bret;
}
//-----------------------------------------------------------------------------
@ -188,7 +182,7 @@ int main(int argc, char** argv)
const char* destPath = (argc > 2) ? argv[2] : currentPath;
MoveFiles(argv[1], destPath);
if (!ClearDepotDirectories())
if (!ClearIntermediateFiles())
{
printf("Failed to remove intermediate files!\n");
}