From c3ad65f62890b499e1e0e0ae378bae1d6957f996 Mon Sep 17 00:00:00 2001 From: luiscuenca Date: Thu, 25 Jul 2019 11:22:20 -0700 Subject: [PATCH] add --skipSplash param --- launchers/win32/LauncherApp.cpp | 5 ++++- launchers/win32/LauncherDlg.cpp | 11 ++++++---- launchers/win32/LauncherManager.cpp | 6 +++-- launchers/win32/LauncherManager.h | 34 +++++++++++++++-------------- 4 files changed, 33 insertions(+), 23 deletions(-) diff --git a/launchers/win32/LauncherApp.cpp b/launchers/win32/LauncherApp.cpp index 5aae2f312b..841a0bee3b 100644 --- a/launchers/win32/LauncherApp.cpp +++ b/launchers/win32/LauncherApp.cpp @@ -43,6 +43,7 @@ BOOL CLauncherApp::InitInstance() { bool restarting = false; bool noUpdate = false; bool continueUpdating = false; + bool skipSplash = false; if (iNumOfArgs > 1) { for (int i = 1; i < iNumOfArgs; i++) { CString curArg = CString(pArgs[i]); @@ -54,6 +55,8 @@ BOOL CLauncherApp::InitInstance() { noUpdate = true; } else if (curArg.Compare(_T("--continueUpdating")) == 0) { continueUpdating = true; + } else if (curArg.Compare(_T("--skipSplash")) == 0) { + skipSplash = true; } } } @@ -68,7 +71,7 @@ BOOL CLauncherApp::InitInstance() { if (uninstalling) { _manager.uninstall(); } else { - _manager.init(!noUpdate, continueUpdating); + _manager.init(!noUpdate, continueUpdating, skipSplash); } if (!_manager.hasFailed() && !_manager.installLauncher()) { return FALSE; diff --git a/launchers/win32/LauncherDlg.cpp b/launchers/win32/LauncherDlg.cpp index fb64555a69..d7d214842d 100644 --- a/launchers/win32/LauncherDlg.cpp +++ b/launchers/win32/LauncherDlg.cpp @@ -693,7 +693,6 @@ void CLauncherDlg::OnTimer(UINT_PTR nIDEvent) { } } } - BOOL needsToWait = theApp._manager.needsToWait(); if (_showSplash) { if (_splashStep == 0) { if (theApp._manager.needsUninstall()) { @@ -704,10 +703,14 @@ void CLauncherDlg::OnTimer(UINT_PTR nIDEvent) { setDrawDialog(DrawStep::DrawProcessUpdate); theApp._manager.updateProgress(LauncherManager::ProcessType::Uninstall, 0.0f); } else { - theApp._manager.addToLog(_T("Start splash screen")); - setDrawDialog(DrawStep::DrawLogo); + if (theApp._manager.shouldSkipSplashScreen()) { + _splashStep = SPLASH_DURATION; + } else { + theApp._manager.addToLog(_T("Start splash screen")); + setDrawDialog(DrawStep::DrawLogo); + } } - } else if (_splashStep > SPLASH_DURATION && !needsToWait) { + } else if (_splashStep > SPLASH_DURATION && !theApp._manager.needsToWait()) { _showSplash = false; if (theApp._manager.shouldShutDown()) { if (_applicationWND != NULL) { diff --git a/launchers/win32/LauncherManager.cpp b/launchers/win32/LauncherManager.cpp index a431672f2e..26ad95f7d2 100644 --- a/launchers/win32/LauncherManager.cpp +++ b/launchers/win32/LauncherManager.cpp @@ -21,11 +21,13 @@ LauncherManager::LauncherManager() { LauncherManager::~LauncherManager() { } -void LauncherManager::init(BOOL allowUpdate, BOOL continueUpdating) { +void LauncherManager::init(BOOL allowUpdate, BOOL continueUpdating, BOOL skipSplashScreen) { initLog(); int tokenPos = 0; _updateLauncherAllowed = allowUpdate; _continueUpdating = continueUpdating; + _skipSplashScreen = skipSplashScreen; + _shouldWait = !skipSplashScreen; if (_continueUpdating) { _progressOffset = CONTINUE_UPDATING_GLOBAL_OFFSET; } @@ -613,7 +615,7 @@ void LauncherManager::restartNewLauncher() { if (_willContinueUpdating) { LauncherUtils::launchApplication(_tempLauncherPath, _T(" --restart --noUpdate --continueUpdating")); } else { - LauncherUtils::launchApplication(_tempLauncherPath, _T(" --restart --noUpdate")); + LauncherUtils::launchApplication(_tempLauncherPath, _T(" --restart --noUpdate --skipSplash")); } Sleep(500); } diff --git a/launchers/win32/LauncherManager.h b/launchers/win32/LauncherManager.h index 29dd05b4e0..108327469d 100644 --- a/launchers/win32/LauncherManager.h +++ b/launchers/win32/LauncherManager.h @@ -59,7 +59,7 @@ public: }; LauncherManager(); ~LauncherManager(); - void init(BOOL allowUpdate, BOOL continueUpdating); + void init(BOOL allowUpdate, BOOL continueUpdating, BOOL skipSplashScreen); BOOL initLog(); BOOL addToLog(const CString& line); void closeLog(); @@ -90,18 +90,19 @@ public: const CString& getVersion() const { return _version; } BOOL shouldShutDown() const { return _shouldShutdown; } BOOL shouldLaunch() const { return _shouldLaunch; } - BOOL needsUpdate() { return _shouldUpdate; } - BOOL needsSelfUpdate() { return _shouldUpdateLauncher; } - BOOL needsSelfDownload() { return _shouldDownloadLauncher; } - BOOL needsUninstall() { return _shouldUninstall; } - BOOL needsInstall() { return _shouldInstall; } - BOOL needsToWait() { return _shouldWait; } - BOOL needsRestartNewLauncher() { return _shouldRestartNewLauncher; } - BOOL shouldContinueUpdating() { return _continueUpdating; } - BOOL willContinueUpdating() { return _willContinueUpdating; } + BOOL shouldSkipSplashScreen() const { return _skipSplashScreen; } + BOOL needsUpdate() const { return _shouldUpdate; } + BOOL needsSelfUpdate() const { return _shouldUpdateLauncher; } + BOOL needsSelfDownload() const { return _shouldDownloadLauncher; } + BOOL needsUninstall() const { return _shouldUninstall; } + BOOL needsInstall() const { return _shouldInstall; } + BOOL needsToWait() const { return _shouldWait; } + BOOL needsRestartNewLauncher() const { return _shouldRestartNewLauncher; } + BOOL shouldContinueUpdating() const { return _continueUpdating; } + BOOL willContinueUpdating() const { return _willContinueUpdating; } void setDisplayName(const CString& displayName) { _displayName = displayName; } - bool isLoggedIn() { return _loggedIn; } - bool hasFailed() { return _hasFailed; } + bool isLoggedIn() const { return _loggedIn; } + bool hasFailed() const { return _hasFailed; } void setFailed(bool hasFailed) { _hasFailed = hasFailed; } const CString& getLatestInterfaceURL() const { return _latestApplicationURL; } void uninstall() { _shouldUninstall = true; _shouldWait = false; }; @@ -115,7 +116,7 @@ public: void restartNewLauncher(); void onZipExtracted(ProcessType type, int size); void onFileDownloaded(ProcessType type); - float getProgress() { return _progress; } + float getProgress() const { return _progress; } void updateProgress(ProcessType processType, float progress); void onCancel(); const CString& getLauncherVersion() const { return _launcherVersion; } @@ -145,11 +146,12 @@ private: BOOL _shouldLaunch { FALSE }; BOOL _shouldWait { TRUE }; BOOL _shouldUpdateLauncher { FALSE }; - BOOL _shouldDownloadLauncher{ FALSE }; + BOOL _shouldDownloadLauncher { FALSE }; BOOL _updateLauncherAllowed { TRUE }; BOOL _shouldRestartNewLauncher { FALSE }; - BOOL _continueUpdating{ FALSE }; - BOOL _willContinueUpdating{ FALSE }; + BOOL _continueUpdating { FALSE }; + BOOL _willContinueUpdating { FALSE }; + BOOL _skipSplashScreen { FALSE }; float _progressOffset { 0.0f }; float _progress { 0.0f }; CStdioFile _logFile;