mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Don't reinstall the entire game if an update was pushed with no updated files
This commit is contained in:
parent
dfc9f50176
commit
7a07731457
@ -332,7 +332,7 @@ void CBaseSurface::OnUpdateClick(Forms::Control* Sender)
|
|||||||
CUtlVector<CUtlString> fileList;
|
CUtlVector<CUtlString> fileList;
|
||||||
CUtlString errorMessage;
|
CUtlString errorMessage;
|
||||||
|
|
||||||
if (!SDKLauncher_BeginInstall(false, false, fileList, &errorMessage, pProgress))
|
if (!SDKLauncher_BeginInstall(false, false, false, fileList, &errorMessage, pProgress))
|
||||||
{
|
{
|
||||||
Forms::MessageBox::Show(Format("Failed to install game: %s\n", errorMessage.String()).c_str(),
|
Forms::MessageBox::Show(Format("Failed to install game: %s\n", errorMessage.String()).c_str(),
|
||||||
"Error", Forms::MessageBoxButtons::OK, Forms::MessageBoxIcon::Error);
|
"Error", Forms::MessageBoxButtons::OK, Forms::MessageBoxIcon::Error);
|
||||||
@ -398,7 +398,7 @@ void CBaseSurface::OnInstallClick(Forms::Control* Sender)
|
|||||||
CUtlVector<CUtlString> fileList;
|
CUtlVector<CUtlString> fileList;
|
||||||
CUtlString errorMessage;
|
CUtlString errorMessage;
|
||||||
|
|
||||||
if (!SDKLauncher_BeginInstall(false, false, fileList, &errorMessage, pProgress))
|
if (!SDKLauncher_BeginInstall(false, false, true, fileList, &errorMessage, pProgress))
|
||||||
{
|
{
|
||||||
Forms::MessageBox::Show(Format("Failed to install game: %s\n", errorMessage.String()).c_str(),
|
Forms::MessageBox::Show(Format("Failed to install game: %s\n", errorMessage.String()).c_str(),
|
||||||
"Error", Forms::MessageBoxButtons::OK, Forms::MessageBoxIcon::Error);
|
"Error", Forms::MessageBoxButtons::OK, Forms::MessageBoxIcon::Error);
|
||||||
|
@ -509,9 +509,16 @@ bool SDKLauncher_BuildUpdateList(const nlohmann::json& localManifest,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose: start the automatic installation procedure
|
||||||
|
// Input : bPreRelease -
|
||||||
|
// bOptionalDepots -
|
||||||
|
// bFullInstallWhenListEmpty - if true, installs all depots in the remote manifest when depot list vector is empty
|
||||||
|
// &zipList -
|
||||||
|
// *errorMessage -
|
||||||
|
// *pProgress -
|
||||||
|
// Output : true on success, false otherwise
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool SDKLauncher_BeginInstall(const bool bPreRelease, const bool bOptionalDepots,
|
bool SDKLauncher_BeginInstall(const bool bPreRelease, const bool bOptionalDepots, const bool bFullInstallWhenListEmpty,
|
||||||
CUtlVector<CUtlString>& zipList, CUtlString* errorMessage, CProgressPanel* pProgress)
|
CUtlVector<CUtlString>& zipList, CUtlString* errorMessage, CProgressPanel* pProgress)
|
||||||
{
|
{
|
||||||
string responseMessage;
|
string responseMessage;
|
||||||
@ -541,6 +548,16 @@ bool SDKLauncher_BeginInstall(const bool bPreRelease, const bool bOptionalDepots
|
|||||||
Assert(depotList.IsEmpty());
|
Assert(depotList.IsEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (depotList.IsEmpty() && !bFullInstallWhenListEmpty)
|
||||||
|
{
|
||||||
|
if (!SDKLauncher_WriteLocalManifest(remoteManifest, errorMessage))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
FOR_EACH_VEC(depotList, i)
|
FOR_EACH_VEC(depotList, i)
|
||||||
{
|
{
|
||||||
const CUtlString& depotName = depotList[i];
|
const CUtlString& depotName = depotList[i];
|
||||||
@ -565,9 +582,8 @@ bool SDKLauncher_BeginInstall(const bool bPreRelease, const bool bOptionalDepots
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SDKLauncher_WriteLocalManifest(remoteManifest))
|
if (!SDKLauncher_WriteLocalManifest(remoteManifest, errorMessage))
|
||||||
{
|
{
|
||||||
errorMessage->Set("Failed to write local manifest file (insufficient rights?)");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -824,11 +840,12 @@ bool SDKLauncher_GetLocalManifest(nlohmann::json& localManifest)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SDKLauncher_WriteLocalManifest(const nlohmann::json& localManifest)
|
bool SDKLauncher_WriteLocalManifest(const nlohmann::json& localManifest, CUtlString* errorMessage)
|
||||||
{
|
{
|
||||||
CIOStream writer;
|
CIOStream writer;
|
||||||
if (!writer.Open(DEPOT_MANIFEST_FILE_PATH, CIOStream::Mode_t::WRITE))
|
if (!writer.Open(DEPOT_MANIFEST_FILE_PATH, CIOStream::Mode_t::WRITE))
|
||||||
{
|
{
|
||||||
|
errorMessage->Set("Failed to write local manifest file (insufficient rights?)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ bool SDKLauncher_CreateDepotDirectories();
|
|||||||
bool SDKLauncher_ClearDepotDirectories();
|
bool SDKLauncher_ClearDepotDirectories();
|
||||||
|
|
||||||
bool SDKLauncher_ExtractZipFile(nlohmann::json& manifest, const CUtlString& filePath, DepotChangedList_t* changedList, CProgressPanel* pProgress);
|
bool SDKLauncher_ExtractZipFile(nlohmann::json& manifest, const CUtlString& filePath, DepotChangedList_t* changedList, CProgressPanel* pProgress);
|
||||||
bool SDKLauncher_BeginInstall(const bool bPreRelease, const bool bOptionalDepots,
|
bool SDKLauncher_BeginInstall(const bool bPreRelease, const bool bOptionalDepots, const bool bFullInstallWhenListEmpty,
|
||||||
CUtlVector<CUtlString>& zipList, CUtlString* errorMessage, CProgressPanel* pProgress);
|
CUtlVector<CUtlString>& zipList, CUtlString* errorMessage, CProgressPanel* pProgress);
|
||||||
|
|
||||||
bool SDKLauncher_IsManifestValid(const nlohmann::json& depotManifest);
|
bool SDKLauncher_IsManifestValid(const nlohmann::json& depotManifest);
|
||||||
@ -26,7 +26,7 @@ bool SDKLauncher_InstallDepotList(nlohmann::json& manifest, CUtlVector<CUtlStrin
|
|||||||
|
|
||||||
bool SDKLauncher_GetRemoteManifest(const char* url, string& responseMessage, nlohmann::json& remoteManifest, const bool bPreRelease);
|
bool SDKLauncher_GetRemoteManifest(const char* url, string& responseMessage, nlohmann::json& remoteManifest, const bool bPreRelease);
|
||||||
bool SDKLauncher_GetLocalManifest(nlohmann::json& localManifest);
|
bool SDKLauncher_GetLocalManifest(nlohmann::json& localManifest);
|
||||||
bool SDKLauncher_WriteLocalManifest(const nlohmann::json& localManifest);
|
bool SDKLauncher_WriteLocalManifest(const nlohmann::json& localManifest, CUtlString* errorMessage);
|
||||||
|
|
||||||
bool SDKLauncher_CheckDiskSpace(const int minRequiredSpace, int* const availableSize = nullptr);
|
bool SDKLauncher_CheckDiskSpace(const int minRequiredSpace, int* const availableSize = nullptr);
|
||||||
bool SDKLauncher_CheckForUpdate(const bool bPreRelease);
|
bool SDKLauncher_CheckForUpdate(const bool bPreRelease);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user