New upstream version 21.0.2+dfsg1

This commit is contained in:
Sebastian Ramacher 2018-02-19 20:54:37 +01:00
parent 1f1bbb3518
commit baafb6325b
706 changed files with 49633 additions and 5044 deletions

View file

@ -238,6 +238,7 @@ enum state_t {
STATE_PENDING_DOWNLOAD,
STATE_DOWNLOADING,
STATE_DOWNLOADED,
STATE_INSTALL_FAILED,
STATE_INSTALLED,
};
@ -296,7 +297,8 @@ struct update_t {
void CleanPartialUpdate()
{
if (state == STATE_INSTALLED) {
if (state == STATE_INSTALL_FAILED ||
state == STATE_INSTALLED) {
if (!previousFile.empty()) {
DeleteFile(outputPath.c_str());
MyCopyFile(previousFile.c_str(),
@ -342,6 +344,8 @@ static inline void CleanupPartialUpdates()
bool DownloadWorkerThread()
{
const DWORD tlsProtocols = WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2;
HttpHandle hSession = WinHttpOpen(L"OBS Studio Updater/2.1",
WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
WINHTTP_NO_PROXY_NAME,
@ -353,6 +357,9 @@ bool DownloadWorkerThread()
return false;
}
WinHttpSetOption(hSession, WINHTTP_OPTION_SECURE_PROTOCOLS,
(LPVOID)&tlsProtocols, sizeof(tlsProtocols));
HttpHandle hConnect = WinHttpConnect(hSession, L"obsproject.com",
INTERNET_DEFAULT_HTTPS_PORT, 0);
if (!hConnect) {
@ -823,6 +830,8 @@ static bool UpdateFile(update_t &file)
return false;
}
file.previousFile = oldFileRenamedPath;
int error_code;
bool installed_ok;
@ -839,6 +848,8 @@ static bool UpdateFile(update_t &file)
Status(L"Update failed: Couldn't "
L"verify integrity of patched %s",
curFileName);
file.state = STATE_INSTALL_FAILED;
return false;
}
@ -848,6 +859,8 @@ static bool UpdateFile(update_t &file)
L"check of patched "
L"%s failed",
curFileName);
file.state = STATE_INSTALL_FAILED;
return false;
}
}
@ -872,11 +885,12 @@ static bool UpdateFile(update_t &file)
L"(error %d)",
curFileName,
GetLastError());
file.state = STATE_INSTALL_FAILED;
return false;
}
file.previousFile = oldFileRenamedPath;
file.state = STATE_INSTALLED;
file.state = STATE_INSTALLED;
} else {
if (file.patchable) {
/* Uh oh, we thought we could patch something but it's
@ -890,6 +904,8 @@ static bool UpdateFile(update_t &file)
* make sure they exist */
CreateFoldersForPath(file.outputPath.c_str());
file.previousFile = L"";
bool success = !!MyCopyFile(
file.tempPath.c_str(),
file.outputPath.c_str());
@ -897,11 +913,11 @@ static bool UpdateFile(update_t &file)
Status(L"Update failed: Couldn't install %s (error %d)",
file.outputPath.c_str(),
GetLastError());
file.state = STATE_INSTALL_FAILED;
return false;
}
file.previousFile = L"";
file.state = STATE_INSTALLED;
file.state = STATE_INSTALLED;
}
return true;
@ -1211,9 +1227,25 @@ static bool Update(wchar_t *cmdLine)
/* ------------------------------------- *
* Install updates */
int updatesInstalled = 0;
int lastPosition = 0;
SendDlgItemMessage(hwndMain, IDC_PROGRESS,
PBM_SETPOS, 0, 0);
for (update_t &update : updates) {
if (!UpdateFile(update))
if (!UpdateFile(update)) {
return false;
} else {
updatesInstalled++;
int position = (int)(((float)updatesInstalled /
(float)completedUpdates) * 100.0f);
if (position > lastPosition) {
lastPosition = position;
SendDlgItemMessage(hwndMain, IDC_PROGRESS,
PBM_SETPOS, position, 0);
}
}
}
/* If we get here, all updates installed successfully so we can purge
@ -1227,6 +1259,9 @@ static bool Update(wchar_t *cmdLine)
DeleteFile(update.tempPath.c_str());
}
SendDlgItemMessage(hwndMain, IDC_PROGRESS,
PBM_SETPOS, 100, 0);
Status(L"Update complete.");
SetDlgItemText(hwndMain, IDC_BUTTON, L"Launch OBS");
return true;