mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
Implement progress failures
I took the liberty to improve the obvious failure cases where a red progress bar would be useful.
This commit is contained in:
@ -868,8 +868,8 @@ hsBool plClient::MsgReceive(plMessage* msg)
|
||||
// plResPatcherMsg
|
||||
//============================================================================
|
||||
if (plResPatcherMsg * resMsg = plResPatcherMsg::ConvertNoRef(msg)) {
|
||||
plgDispatch::Dispatch()->UnRegisterForExactType(plResPatcherMsg::Index(), GetKey());
|
||||
IOnAsyncInitComplete();
|
||||
IHandlePatcherMsg(resMsg);
|
||||
return true;
|
||||
}
|
||||
|
||||
return hsKeyedObject::MsgReceive(msg);
|
||||
@ -1300,7 +1300,10 @@ void plClient::IProgressMgrCallbackProc(plOperationProgress * progress)
|
||||
if (gTaskbarList)
|
||||
{
|
||||
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);
|
||||
else if (progress->GetMax() == 0.f)
|
||||
gTaskbarList->SetProgressState(hwnd, TBPF_INDETERMINATE);
|
||||
@ -2550,6 +2553,18 @@ void plClient::IHandlePreloaderMsg (plPreloaderMsg * msg) {
|
||||
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) {
|
||||
|
||||
|
@ -82,7 +82,7 @@ class plBinkPlayer;
|
||||
class plPreloaderMsg;
|
||||
class plNetCommAuthMsg;
|
||||
class plAgeLoaded2Msg;
|
||||
|
||||
class plResPatcherMsg;
|
||||
|
||||
typedef void (*plMessagePumpProc)( void );
|
||||
|
||||
@ -179,6 +179,7 @@ protected:
|
||||
|
||||
void ICompleteInit ();
|
||||
void IOnAsyncInitComplete ();
|
||||
void IHandlePatcherMsg (plResPatcherMsg * msg);
|
||||
void IHandlePreloaderMsg (plPreloaderMsg * msg);
|
||||
void IHandleNetCommAuthMsg (plNetCommAuthMsg * msg);
|
||||
bool IHandleAgeLoaded2Msg (plAgeLoaded2Msg * msg);
|
||||
|
@ -300,6 +300,7 @@ void pfSecurePreloader::Start()
|
||||
void pfSecurePreloader::Terminate()
|
||||
{
|
||||
FATAL("pfSecurePreloader failure");
|
||||
fProgress->SetAborting();
|
||||
|
||||
plPreloaderMsg* msg = new plPreloaderMsg;
|
||||
msg->fSuccess = false;
|
||||
|
@ -277,7 +277,10 @@ void plResPatcher::Finish(bool success)
|
||||
if (success)
|
||||
PatcherLog(kHeader, "--- Patch Completed Successfully ---");
|
||||
else
|
||||
{
|
||||
PatcherLog(kHeader, "--- Patch Killed by Error ---");
|
||||
fProgress->SetAborting();
|
||||
}
|
||||
|
||||
plResPatcherMsg* pMsg = new plResPatcherMsg(success, sLastError);
|
||||
pMsg->Send(); // whoosh... off it goes
|
||||
|
@ -165,11 +165,9 @@ void plNetLinkingMgr::NCAgeJoinerCallback (
|
||||
// Tell the user we failed to link.
|
||||
// In the future, we might want to try graceful recovery (link back to Relto?)
|
||||
if (!params->success) {
|
||||
plNetClientMgr::StaticErrorMsg(params->msg);
|
||||
hsMessageBox(params->msg, "Linking Error", hsMessageBoxNormal, hsMessageBoxIconError);
|
||||
plNetClientApp::GetInstance()->ErrorMsg(params->msg);
|
||||
#ifdef PLASMA_EXTERNAL_RELEASE
|
||||
plClientMsg* clientMsg = new plClientMsg(plClientMsg::kQuit);
|
||||
clientMsg->Send(hsgResMgr::ResMgr()->FindKey(kClient_KEY));
|
||||
plNetClientApp::GetInstance()->QueueDisableNet(true, params->msg);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
@ -389,7 +389,6 @@ void plOperationProgress::SetAborting()
|
||||
hsSetBits(fFlags, kAborting);
|
||||
plProgressMgr::GetInstance()->IUpdateCallbackProc(this);
|
||||
fMax = fValue = 0.f;
|
||||
hsClearBits(fFlags, kAborting);
|
||||
}
|
||||
|
||||
void plOperationProgress::SetRetry()
|
||||
|
@ -153,6 +153,7 @@ class plOperationProgress
|
||||
// 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
|
||||
void SetAborting();
|
||||
bool IsAborting() { return hsCheckBits(fFlags, kAborting); }
|
||||
// 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
|
||||
// count as the first. If you set retry in RegisterOperation, don't use this too.
|
||||
|
Reference in New Issue
Block a user