Browse Source

Implement progress failures

I took the liberty to improve the obvious failure cases where a red progress
bar would be useful.
Adam Johnson 12 years ago
parent
commit
6039d62bc2
  1. 21
      Sources/Plasma/Apps/plClient/plClient.cpp
  2. 3
      Sources/Plasma/Apps/plClient/plClient.h
  3. 1
      Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp
  4. 3
      Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp
  5. 6
      Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp
  6. 1
      Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp
  7. 1
      Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h

21
Sources/Plasma/Apps/plClient/plClient.cpp

@ -868,8 +868,8 @@ hsBool plClient::MsgReceive(plMessage* msg)
// plResPatcherMsg // plResPatcherMsg
//============================================================================ //============================================================================
if (plResPatcherMsg * resMsg = plResPatcherMsg::ConvertNoRef(msg)) { if (plResPatcherMsg * resMsg = plResPatcherMsg::ConvertNoRef(msg)) {
plgDispatch::Dispatch()->UnRegisterForExactType(plResPatcherMsg::Index(), GetKey()); IHandlePatcherMsg(resMsg);
IOnAsyncInitComplete(); return true;
} }
return hsKeyedObject::MsgReceive(msg); return hsKeyedObject::MsgReceive(msg);
@ -1300,7 +1300,10 @@ void plClient::IProgressMgrCallbackProc(plOperationProgress * progress)
if (gTaskbarList) if (gTaskbarList)
{ {
HWND hwnd = fInstance->GetWindowHandle(); // lazy HWND hwnd = fInstance->GetWindowHandle(); // lazy
if (progress->IsLastUpdate()) if (progress->IsAborting())
// We'll assume this is fatal
gTaskbarList->SetProgressState(hwnd, TBPF_ERROR);
else if (progress->IsLastUpdate())
gTaskbarList->SetProgressState(hwnd, TBPF_NOPROGRESS); gTaskbarList->SetProgressState(hwnd, TBPF_NOPROGRESS);
else if (progress->GetMax() == 0.f) else if (progress->GetMax() == 0.f)
gTaskbarList->SetProgressState(hwnd, TBPF_INDETERMINATE); gTaskbarList->SetProgressState(hwnd, TBPF_INDETERMINATE);
@ -2550,6 +2553,18 @@ void plClient::IHandlePreloaderMsg (plPreloaderMsg * msg) {
IPatchGlobalAgeFiles(); IPatchGlobalAgeFiles();
} }
//============================================================================
void plClient::IHandlePatcherMsg (plResPatcherMsg * msg) {
plgDispatch::Dispatch()->UnRegisterForExactType(plResPatcherMsg::Index(), GetKey());
if (!msg->Success()) {
plNetClientApp::GetInstance()->QueueDisableNet(true, msg->GetError());
return;
}
IOnAsyncInitComplete();
}
//============================================================================ //============================================================================
void plClient::IHandleNetCommAuthMsg (plNetCommAuthMsg * msg) { void plClient::IHandleNetCommAuthMsg (plNetCommAuthMsg * msg) {

3
Sources/Plasma/Apps/plClient/plClient.h

@ -82,7 +82,7 @@ class plBinkPlayer;
class plPreloaderMsg; class plPreloaderMsg;
class plNetCommAuthMsg; class plNetCommAuthMsg;
class plAgeLoaded2Msg; class plAgeLoaded2Msg;
class plResPatcherMsg;
typedef void (*plMessagePumpProc)( void ); typedef void (*plMessagePumpProc)( void );
@ -179,6 +179,7 @@ protected:
void ICompleteInit (); void ICompleteInit ();
void IOnAsyncInitComplete (); void IOnAsyncInitComplete ();
void IHandlePatcherMsg (plResPatcherMsg * msg);
void IHandlePreloaderMsg (plPreloaderMsg * msg); void IHandlePreloaderMsg (plPreloaderMsg * msg);
void IHandleNetCommAuthMsg (plNetCommAuthMsg * msg); void IHandleNetCommAuthMsg (plNetCommAuthMsg * msg);
bool IHandleAgeLoaded2Msg (plAgeLoaded2Msg * msg); bool IHandleAgeLoaded2Msg (plAgeLoaded2Msg * msg);

1
Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp

@ -300,6 +300,7 @@ void pfSecurePreloader::Start()
void pfSecurePreloader::Terminate() void pfSecurePreloader::Terminate()
{ {
FATAL("pfSecurePreloader failure"); FATAL("pfSecurePreloader failure");
fProgress->SetAborting();
plPreloaderMsg* msg = new plPreloaderMsg; plPreloaderMsg* msg = new plPreloaderMsg;
msg->fSuccess = false; msg->fSuccess = false;

3
Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp

@ -277,7 +277,10 @@ void plResPatcher::Finish(bool success)
if (success) if (success)
PatcherLog(kHeader, "--- Patch Completed Successfully ---"); PatcherLog(kHeader, "--- Patch Completed Successfully ---");
else else
{
PatcherLog(kHeader, "--- Patch Killed by Error ---"); PatcherLog(kHeader, "--- Patch Killed by Error ---");
fProgress->SetAborting();
}
plResPatcherMsg* pMsg = new plResPatcherMsg(success, sLastError); plResPatcherMsg* pMsg = new plResPatcherMsg(success, sLastError);
pMsg->Send(); // whoosh... off it goes pMsg->Send(); // whoosh... off it goes

6
Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp

@ -165,11 +165,9 @@ void plNetLinkingMgr::NCAgeJoinerCallback (
// Tell the user we failed to link. // Tell the user we failed to link.
// In the future, we might want to try graceful recovery (link back to Relto?) // In the future, we might want to try graceful recovery (link back to Relto?)
if (!params->success) { if (!params->success) {
plNetClientMgr::StaticErrorMsg(params->msg); plNetClientApp::GetInstance()->ErrorMsg(params->msg);
hsMessageBox(params->msg, "Linking Error", hsMessageBoxNormal, hsMessageBoxIconError);
#ifdef PLASMA_EXTERNAL_RELEASE #ifdef PLASMA_EXTERNAL_RELEASE
plClientMsg* clientMsg = new plClientMsg(plClientMsg::kQuit); plNetClientApp::GetInstance()->QueueDisableNet(true, params->msg);
clientMsg->Send(hsgResMgr::ResMgr()->FindKey(kClient_KEY));
#endif #endif
return; return;
} }

1
Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp

@ -389,7 +389,6 @@ void plOperationProgress::SetAborting()
hsSetBits(fFlags, kAborting); hsSetBits(fFlags, kAborting);
plProgressMgr::GetInstance()->IUpdateCallbackProc(this); plProgressMgr::GetInstance()->IUpdateCallbackProc(this);
fMax = fValue = 0.f; fMax = fValue = 0.f;
hsClearBits(fFlags, kAborting);
} }
void plOperationProgress::SetRetry() void plOperationProgress::SetRetry()

1
Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h

@ -153,6 +153,7 @@ class plOperationProgress
// progress bars above this one know to adjust their totals to not include any amount // progress bars above this one know to adjust their totals to not include any amount
// that wasn't completed, and will set this progress bar to zero // that wasn't completed, and will set this progress bar to zero
void SetAborting(); void SetAborting();
bool IsAborting() { return hsCheckBits(fFlags, kAborting); }
// If you're reusing an existing progress bar to retry a failed operation, call this. // If you're reusing an existing progress bar to retry a failed operation, call this.
// It will set the retry flag, and reset the progress bar so the next update will // It will set the retry flag, and reset the progress bar so the next update will
// count as the first. If you set retry in RegisterOperation, don't use this too. // count as the first. If you set retry in RegisterOperation, don't use this too.

Loading…
Cancel
Save