Multiple bug fixes

The initial install, and all subsequent updates were always looking for prereleases. But the prerelease checks were also bugged so it grabbed the latest release. Now this has been fixed, the bug became apparent. Now defaulted to latest (non-prerelease). Also only toggle update view if the game is installed. Also added an error message if 'SDKLauncher_WriteLocalManifest()' fails
This commit is contained in:
Kawe Mazidjatari 2023-11-01 01:44:21 +01:00
parent 69c6de4638
commit dfc9f50176
2 changed files with 15 additions and 19 deletions

View File

@ -145,15 +145,19 @@ bool CBaseSurface::CheckForUpdate()
printf("%s: runframe; interval=%f\n", __FUNCTION__, g_flUpdateCheckRate);
const bool updateAvailable = SDKLauncher_CheckForUpdate(m_ExperimentalBuildsCheckbox->Checked());
if (m_bIsInstalled && updateAvailable)
if (m_bIsInstalled)
{
printf("%s: found update; interval=%f\n", __FUNCTION__, g_flUpdateCheckRate);
ToggleUpdateView(true);
if (m_bIsInstalled && updateAvailable)
{
printf("%s: found update; interval=%f\n", __FUNCTION__, g_flUpdateCheckRate);
ToggleUpdateView(true);
return true;
return true;
}
ToggleUpdateView(false);
}
ToggleUpdateView(false);
return false;
}
@ -328,7 +332,7 @@ void CBaseSurface::OnUpdateClick(Forms::Control* Sender)
CUtlVector<CUtlString> fileList;
CUtlString errorMessage;
if (!SDKLauncher_BeginInstall(true, false, fileList, &errorMessage, pProgress))
if (!SDKLauncher_BeginInstall(false, false, fileList, &errorMessage, pProgress))
{
Forms::MessageBox::Show(Format("Failed to install game: %s\n", errorMessage.String()).c_str(),
"Error", Forms::MessageBoxButtons::OK, Forms::MessageBoxIcon::Error);
@ -394,7 +398,7 @@ void CBaseSurface::OnInstallClick(Forms::Control* Sender)
CUtlVector<CUtlString> fileList;
CUtlString errorMessage;
if (!SDKLauncher_BeginInstall(true, false, fileList, &errorMessage, pProgress))
if (!SDKLauncher_BeginInstall(false, false, fileList, &errorMessage, pProgress))
{
Forms::MessageBox::Show(Format("Failed to install game: %s\n", errorMessage.String()).c_str(),
"Error", Forms::MessageBoxButtons::OK, Forms::MessageBoxIcon::Error);

View File

@ -329,27 +329,18 @@ bool SDKLauncher_AcquireReleaseManifest(const char* url, string& responseMessage
for (size_t i = 0; i < responseJson.size(); i++)
{
auto& release = responseJson[i];
const auto& release = responseJson[i];
const bool isPreRelease = release["prerelease"].get<bool>();
if (preRelease)
{
if (i == responseJson.size() - 1 && outManifest.empty())
{
// TODO: we probably do not want to take the first one, as it might not be ordered
// needs to be confirmed!
outManifest = responseJson[0]; // Just take the first one then.
break;
}
const bool isPreRelease = release["prerelease"].get<bool>();
if (isPreRelease)
{
outManifest = release;
break;
}
}
else
else if (!isPreRelease)
{
outManifest = release;
break;
@ -576,6 +567,7 @@ bool SDKLauncher_BeginInstall(const bool bPreRelease, const bool bOptionalDepots
if (!SDKLauncher_WriteLocalManifest(remoteManifest))
{
errorMessage->Set("Failed to write local manifest file (insufficient rights?)");
return false;
}