mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 14:37:41 +00:00
Compare commits
16 Commits
OPENURU_BU
...
working_19
Author | SHA1 | Date | |
---|---|---|---|
38bf3ed1dc | |||
67a9e4a892 | |||
13e3022087 | |||
9b80ebf645 | |||
d007fac536
|
|||
099a171f85 | |||
994cee47b1 | |||
ba7b2d0caf | |||
9be38cb29b | |||
8c46126007
|
|||
bef0bfa262 | |||
3d3d70fc08 | |||
2a63116726 | |||
86d2da35b7
|
|||
1bfa806843 | |||
23126d3135 |
@ -162,6 +162,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
|
|
||||||
#include "plTweak.h"
|
#include "plTweak.h"
|
||||||
|
|
||||||
|
#include <ShObjIdl.h>
|
||||||
|
|
||||||
#define MSG_LOADING_BAR
|
#define MSG_LOADING_BAR
|
||||||
|
|
||||||
// static hsVector3 gAbsDown(0,0,-hsScalar1);
|
// static hsVector3 gAbsDown(0,0,-hsScalar1);
|
||||||
@ -170,6 +172,10 @@ static plDispatchBase* gDisp = nil;
|
|||||||
static plTimerCallbackManager* gTimerMgr = nil;
|
static plTimerCallbackManager* gTimerMgr = nil;
|
||||||
static plAudioSystem* gAudio = nil;
|
static plAudioSystem* gAudio = nil;
|
||||||
|
|
||||||
|
#ifdef HS_BUILD_FOR_WIN32
|
||||||
|
extern ITaskbarList3* gTaskbarList;
|
||||||
|
#endif
|
||||||
|
|
||||||
hsBool plClient::fDelayMS = false;
|
hsBool plClient::fDelayMS = false;
|
||||||
|
|
||||||
plClient* plClient::fInstance=nil;
|
plClient* plClient::fInstance=nil;
|
||||||
@ -771,6 +777,12 @@ hsBool plClient::MsgReceive(plMessage* msg)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case plClientMsg::kFlashWindow:
|
||||||
|
{
|
||||||
|
FlashWindow();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1286,6 +1298,32 @@ void plClient::IProgressMgrCallbackProc(plOperationProgress * progress)
|
|||||||
if(!fInstance)
|
if(!fInstance)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Increments the taskbar progress [Windows 7+]
|
||||||
|
#ifdef HS_BUILD_FOR_WIN32
|
||||||
|
if (gTaskbarList && fInstance->GetWindowHandle())
|
||||||
|
{
|
||||||
|
static TBPFLAG lastState = TBPF_NOPROGRESS;
|
||||||
|
TBPFLAG myState;
|
||||||
|
|
||||||
|
// So, calling making these kernel calls is kind of SLOW. So, let's
|
||||||
|
// hide that behind a userland check--this helps linking go faster!
|
||||||
|
if (progress->IsLastUpdate())
|
||||||
|
myState = TBPF_NOPROGRESS;
|
||||||
|
else if (progress->GetMax() == 0.f)
|
||||||
|
myState = TBPF_INDETERMINATE;
|
||||||
|
else
|
||||||
|
// This will set TBPF_NORMAL for us
|
||||||
|
myState = TBPF_NORMAL;
|
||||||
|
|
||||||
|
if (myState == TBPF_NORMAL)
|
||||||
|
// This sets us to TBPF_NORMAL
|
||||||
|
gTaskbarList->SetProgressValue(fInstance->GetWindowHandle(), (ULONGLONG)progress->GetProgress(), (ULONGLONG)progress->GetMax());
|
||||||
|
else if (myState != lastState)
|
||||||
|
gTaskbarList->SetProgressState(fInstance->GetWindowHandle(), myState);
|
||||||
|
lastState = myState;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
fInstance->fMessagePumpProc();
|
fInstance->fMessagePumpProc();
|
||||||
|
|
||||||
// HACK HACK HACK HACK!
|
// HACK HACK HACK HACK!
|
||||||
@ -2426,6 +2464,17 @@ void plClient::WindowActivate(bool active)
|
|||||||
fWindowActive = active;
|
fWindowActive = active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void plClient::FlashWindow()
|
||||||
|
{
|
||||||
|
#ifdef HS_BUILD_FOR_WIN32
|
||||||
|
FLASHWINFO info;
|
||||||
|
info.cbSize = sizeof(info);
|
||||||
|
info.dwFlags = FLASHW_TIMERNOFG | FLASHW_ALL;
|
||||||
|
info.hwnd = fWindowHndl;
|
||||||
|
info.uCount = -1;
|
||||||
|
FlashWindowEx(&info);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void plClient::IOnAsyncInitComplete () {
|
void plClient::IOnAsyncInitComplete () {
|
||||||
|
@ -292,6 +292,7 @@ public:
|
|||||||
virtual void WindowActivate(bool active);
|
virtual void WindowActivate(bool active);
|
||||||
virtual hsBool WindowActive() const { return fWindowActive; }
|
virtual hsBool WindowActive() const { return fWindowActive; }
|
||||||
|
|
||||||
|
void FlashWindow();
|
||||||
void SetMessagePumpProc( plMessagePumpProc proc ) { fMessagePumpProc = proc; }
|
void SetMessagePumpProc( plMessagePumpProc proc ) { fMessagePumpProc = proc; }
|
||||||
void ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync = false);
|
void ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync = false);
|
||||||
void ResizeDisplayDevice(int Width, int Height, hsBool Windowed);
|
void ResizeDisplayDevice(int Width, int Height, hsBool Windowed);
|
||||||
|
@ -77,6 +77,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#include "WinHttp.h"
|
#include "WinHttp.h"
|
||||||
#include "loginfix.h"
|
#include "loginfix.h"
|
||||||
|
#include <ShObjIdl.h>
|
||||||
//
|
//
|
||||||
// Defines
|
// Defines
|
||||||
//
|
//
|
||||||
@ -99,6 +100,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
// Globals
|
// Globals
|
||||||
//
|
//
|
||||||
hsBool gHasMouse = false;
|
hsBool gHasMouse = false;
|
||||||
|
ITaskbarList3* gTaskbarList = nil; // NT 6.1+ taskbar stuff
|
||||||
|
|
||||||
extern hsBool gDataServerLocal;
|
extern hsBool gDataServerLocal;
|
||||||
extern hsBool gUseBackgroundDownloader;
|
extern hsBool gUseBackgroundDownloader;
|
||||||
@ -137,6 +139,7 @@ bool gPendingActivateFlag = false;
|
|||||||
|
|
||||||
static bool s_loginDlgRunning = false;
|
static bool s_loginDlgRunning = false;
|
||||||
static CEvent s_statusEvent(kEventManualReset);
|
static CEvent s_statusEvent(kEventManualReset);
|
||||||
|
static UINT s_WmTaskbarList = RegisterWindowMessage("TaskbarButtonCreated");
|
||||||
|
|
||||||
FILE *errFP = nil;
|
FILE *errFP = nil;
|
||||||
HINSTANCE gHInst = NULL; // Instance of this app
|
HINSTANCE gHInst = NULL; // Instance of this app
|
||||||
@ -480,6 +483,18 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
static bool gDragging = false;
|
static bool gDragging = false;
|
||||||
static UInt8 mouse_down = 0;
|
static UInt8 mouse_down = 0;
|
||||||
|
|
||||||
|
// Messages we registered for manually (no const value)
|
||||||
|
if (message == s_WmTaskbarList)
|
||||||
|
{
|
||||||
|
// Grab the Windows 7 taskbar list stuff
|
||||||
|
if (gTaskbarList)
|
||||||
|
gTaskbarList->Release();
|
||||||
|
HRESULT result = CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_ALL, IID_ITaskbarList3, (void**)&gTaskbarList);
|
||||||
|
if (FAILED(result))
|
||||||
|
gTaskbarList = nil;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Handle messages
|
// Handle messages
|
||||||
switch (message) {
|
switch (message) {
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
@ -579,7 +594,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
plMouseDevice::HideCursor();
|
plMouseDevice::HideCursor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -668,17 +682,15 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
if (plNetClientMgr * mgr = plNetClientMgr::GetInstance())
|
if (plNetClientMgr * mgr = plNetClientMgr::GetInstance())
|
||||||
mgr->QueueDisableNet(false, nil);
|
mgr->QueueDisableNet(false, nil);
|
||||||
DestroyWindow(gClient->GetWindowHandle());
|
DestroyWindow(gClient->GetWindowHandle());
|
||||||
return TRUE;
|
break;
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
gClient->SetDone(TRUE);
|
gClient->SetDone(TRUE);
|
||||||
if (plNetClientMgr * mgr = plNetClientMgr::GetInstance())
|
if (plNetClientMgr * mgr = plNetClientMgr::GetInstance())
|
||||||
mgr->QueueDisableNet(false, nil);
|
mgr->QueueDisableNet(false, nil);
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
return TRUE;
|
|
||||||
case WM_CREATE:
|
|
||||||
// Create renderer
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,8 +172,8 @@ static CEvent s_statusEvent(kEventManualReset);
|
|||||||
|
|
||||||
static const wchar * s_deleteFiles[] = {
|
static const wchar * s_deleteFiles[] = {
|
||||||
L"NetDiag.exe",
|
L"NetDiag.exe",
|
||||||
L"UruExplorer.pdb",
|
// L"UruExplorer.pdb", // removed for OpenUru Builds
|
||||||
L"UruExplorer.map",
|
// L"UruExplorer.map",
|
||||||
};
|
};
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -224,8 +224,9 @@ pfGUIListPicture::pfGUIListPicture( plKey mipKey, hsBool respectAlpha ) : pfGUIL
|
|||||||
char str[ 512 ];
|
char str[ 512 ];
|
||||||
sprintf( str, "%s_uncomp", mip->GetKeyName() );
|
sprintf( str, "%s_uncomp", mip->GetKeyName() );
|
||||||
fMipmapKey = hsgResMgr::ResMgr()->NewKey( str, uncompBuffer, fMipmapKey->GetUoid().GetLocation() );
|
fMipmapKey = hsgResMgr::ResMgr()->NewKey( str, uncompBuffer, fMipmapKey->GetUoid().GetLocation() );
|
||||||
fMipmapKey->RefObject();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fMipmapKey->RefObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
pfGUIListPicture::~pfGUIListPicture()
|
pfGUIListPicture::~pfGUIListPicture()
|
||||||
|
@ -722,6 +722,13 @@ void cyMisc::ExcludeRegionSetNow(pyKey& sender, pyKey& exKey, UInt16 state)
|
|||||||
plgDispatch::MsgSend( msg ); // whoosh... off it goes
|
plgDispatch::MsgSend( msg ); // whoosh... off it goes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cyMisc::FlashWindow()
|
||||||
|
{
|
||||||
|
plKey clientKey = hsgResMgr::ResMgr()->FindKey(kClient_KEY);
|
||||||
|
plClientMsg* pMsg = new plClientMsg(plClientMsg::kFlashWindow);
|
||||||
|
pMsg->Send(clientKey); // whoosh... off it goes
|
||||||
|
}
|
||||||
|
|
||||||
#include "hsTimer.h"
|
#include "hsTimer.h"
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
@ -244,6 +244,15 @@ public:
|
|||||||
//
|
//
|
||||||
static hsBool WasLocallyNotified(pyKey &selfkey);
|
static hsBool WasLocallyNotified(pyKey &selfkey);
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Function : FlashWindow
|
||||||
|
// PARAMETERS :
|
||||||
|
//
|
||||||
|
// PURPOSE : Flashes the client window if it is not focused
|
||||||
|
//
|
||||||
|
static void FlashWindow();
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Function : GetClientName
|
// Function : GetClientName
|
||||||
|
@ -48,6 +48,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
|
|
||||||
#include <python.h>
|
#include <python.h>
|
||||||
|
|
||||||
|
PYTHON_BASIC_GLOBAL_METHOD_DEFINITION(PtFlashWindow, cyMisc::FlashWindow, "Flashes the client window if it is not focused");
|
||||||
|
|
||||||
PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetAgeName, "DEPRECIATED - use ptDniInfoSource instead")
|
PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetAgeName, "DEPRECIATED - use ptDniInfoSource instead")
|
||||||
{
|
{
|
||||||
return PyString_FromString(cyMisc::GetAgeName());
|
return PyString_FromString(cyMisc::GetAgeName());
|
||||||
@ -496,6 +498,8 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtDumpLogs, args, "Params: folder\nDumps all cur
|
|||||||
|
|
||||||
void cyMisc::AddPlasmaMethods(std::vector<PyMethodDef> &methods)
|
void cyMisc::AddPlasmaMethods(std::vector<PyMethodDef> &methods)
|
||||||
{
|
{
|
||||||
|
PYTHON_GLOBAL_METHOD_NOARGS(methods, PtFlashWindow);
|
||||||
|
|
||||||
PYTHON_GLOBAL_METHOD_NOARGS(methods, PtGetAgeName);
|
PYTHON_GLOBAL_METHOD_NOARGS(methods, PtGetAgeName);
|
||||||
PYTHON_GLOBAL_METHOD_NOARGS(methods, PtGetAgeInfo);
|
PYTHON_GLOBAL_METHOD_NOARGS(methods, PtGetAgeInfo);
|
||||||
PYTHON_GLOBAL_METHOD_NOARGS(methods, PtGetAgeTime);
|
PYTHON_GLOBAL_METHOD_NOARGS(methods, PtGetAgeTime);
|
||||||
|
@ -94,6 +94,8 @@ public:
|
|||||||
kEnableRenderScene,
|
kEnableRenderScene,
|
||||||
kResetGraphicsDevice,
|
kResetGraphicsDevice,
|
||||||
kSetGraphicsDefaults,
|
kSetGraphicsDefaults,
|
||||||
|
|
||||||
|
kFlashWindow,
|
||||||
};
|
};
|
||||||
|
|
||||||
// graphics settings fields
|
// graphics settings fields
|
||||||
|
@ -385,7 +385,7 @@ bool plNCAgeJoiner::MsgReceive (plMessage * msg) {
|
|||||||
}
|
}
|
||||||
else if (unsigned ageVaultId = NetCommGetAge()->ageVaultId) {
|
else if (unsigned ageVaultId = NetCommGetAge()->ageVaultId) {
|
||||||
// Download the age vault
|
// Download the age vault
|
||||||
VaultDownload(
|
VaultDownloadNoCallbacks(
|
||||||
L"AgeJoin",
|
L"AgeJoin",
|
||||||
ageVaultId,
|
ageVaultId,
|
||||||
AgeVaultDownloadCallback,
|
AgeVaultDownloadCallback,
|
||||||
|
@ -318,7 +318,7 @@ static void INetCliAuthSetPlayerRequestCallback (
|
|||||||
else {
|
else {
|
||||||
s_needAvatarLoad = true;
|
s_needAvatarLoad = true;
|
||||||
|
|
||||||
VaultDownload(
|
VaultDownloadNoCallbacks(
|
||||||
L"SetActivePlayer",
|
L"SetActivePlayer",
|
||||||
s_player->playerInt,
|
s_player->playerInt,
|
||||||
PlayerInitCallback,
|
PlayerInitCallback,
|
||||||
@ -374,7 +374,7 @@ static void INetCliAuthLoginSetPlayerRequestCallback (
|
|||||||
msg->Send();
|
msg->Send();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
VaultDownload(
|
VaultDownloadNoCallbacks(
|
||||||
L"SetActivePlayer",
|
L"SetActivePlayer",
|
||||||
s_player->playerInt,
|
s_player->playerInt,
|
||||||
LoginPlayerInitCallback,
|
LoginPlayerInitCallback,
|
||||||
|
@ -181,7 +181,23 @@ struct VaultDownloadTrans {
|
|||||||
unsigned vaultId;
|
unsigned vaultId;
|
||||||
ENetError result;
|
ENetError result;
|
||||||
|
|
||||||
VaultDownloadTrans ();
|
VaultDownloadTrans()
|
||||||
|
: callback(), cbParam(), progressCallback(), cbProgressParam(),
|
||||||
|
nodeCount(), nodesLeft(), vaultId(), result(kNetSuccess)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
VaultDownloadTrans(const wchar_t* _tag, FVaultDownloadCallback _callback,
|
||||||
|
void* _cbParam, FVaultProgressCallback _progressCallback,
|
||||||
|
void* _cbProgressParam, unsigned _vaultId)
|
||||||
|
: callback(_callback), cbParam(_cbParam), progressCallback(_progressCallback),
|
||||||
|
cbProgressParam(_cbProgressParam), nodeCount(), nodesLeft(),
|
||||||
|
vaultId(_vaultId), result(kNetSuccess)
|
||||||
|
{
|
||||||
|
StrCopy(tag, _tag, arrsize(tag));
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~VaultDownloadTrans() { }
|
||||||
|
|
||||||
static void VaultNodeFetched (
|
static void VaultNodeFetched (
|
||||||
ENetError result,
|
ENetError result,
|
||||||
@ -196,6 +212,28 @@ struct VaultDownloadTrans {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct VaultDownloadNoCallbacksTrans : VaultDownloadTrans {
|
||||||
|
VaultDownloadNoCallbacksTrans()
|
||||||
|
: VaultDownloadTrans()
|
||||||
|
{
|
||||||
|
VaultSuppressCallbacks();
|
||||||
|
}
|
||||||
|
|
||||||
|
VaultDownloadNoCallbacksTrans(const wchar_t* _tag, FVaultDownloadCallback _callback,
|
||||||
|
void* _cbParam, FVaultProgressCallback _progressCallback,
|
||||||
|
void* _cbProgressParam, unsigned _vaultId)
|
||||||
|
: VaultDownloadTrans(_tag, _callback, _cbParam, _progressCallback, _cbProgressParam, _vaultId)
|
||||||
|
{
|
||||||
|
VaultSuppressCallbacks();
|
||||||
|
}
|
||||||
|
|
||||||
|
~VaultDownloadNoCallbacksTrans()
|
||||||
|
{
|
||||||
|
VaultEnableCallbacks();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
struct VaultAgeInitTrans {
|
struct VaultAgeInitTrans {
|
||||||
FVaultInitAgeCallback callback;
|
FVaultInitAgeCallback callback;
|
||||||
void * cbState;
|
void * cbState;
|
||||||
@ -262,6 +300,8 @@ static HASHTABLEDECL(
|
|||||||
|
|
||||||
static bool s_processPlayerInbox = false;
|
static bool s_processPlayerInbox = false;
|
||||||
|
|
||||||
|
static long s_suppressCallbacks = 0;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* Local functions
|
* Local functions
|
||||||
@ -303,10 +343,12 @@ static void VaultNodeAddedDownloadCallback(ENetError result, void * param) {
|
|||||||
VaultProcessUnvisitNote(childLink->node);
|
VaultProcessUnvisitNote(childLink->node);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IVaultCallback * cb = s_callbacks.Head(); cb; cb = s_callbacks.Next(cb))
|
if (s_suppressCallbacks == 0) {
|
||||||
|
for (IVaultCallback* cb = s_callbacks.Head(); cb; cb = s_callbacks.Next(cb))
|
||||||
cb->cb->AddedChildNode(parentLink->node, childLink->node);
|
cb->cb->AddedChildNode(parentLink->node, childLink->node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DEL(notify);
|
DEL(notify);
|
||||||
}
|
}
|
||||||
@ -377,10 +419,12 @@ static void BuildNodeTree (
|
|||||||
parentNode->state->children.Add(childLink);
|
parentNode->state->children.Add(childLink);
|
||||||
|
|
||||||
if (notifyNow || childNode->nodeType != 0) {
|
if (notifyNow || childNode->nodeType != 0) {
|
||||||
|
if (s_suppressCallbacks == 0) {
|
||||||
// We made a new link, so make the callbacks
|
// We made a new link, so make the callbacks
|
||||||
for (IVaultCallback * cb = s_callbacks.Head(); cb; cb = s_callbacks.Next(cb))
|
for (IVaultCallback* cb = s_callbacks.Head(); cb; cb = s_callbacks.Next(cb))
|
||||||
cb->cb->AddedChildNode(parentNode, childNode);
|
cb->cb->AddedChildNode(parentNode, childNode);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
INotifyAfterDownload* notify = NEWZERO(INotifyAfterDownload)(parentNode->nodeId, childNode->nodeId);
|
INotifyAfterDownload* notify = NEWZERO(INotifyAfterDownload)(parentNode->nodeId, childNode->nodeId);
|
||||||
s_notifyAfterDownload.Add(notify);
|
s_notifyAfterDownload.Add(notify);
|
||||||
@ -543,6 +587,10 @@ static void ChangedVaultNodeFetched (
|
|||||||
|
|
||||||
RelVaultNodeLink* savedLink = s_nodes.Find(node->nodeId);
|
RelVaultNodeLink* savedLink = s_nodes.Find(node->nodeId);
|
||||||
|
|
||||||
|
// Yeah, we are purposefully allowing this global callback to go out,
|
||||||
|
// even if callback suppression has been enabled. The intent behind
|
||||||
|
// that is to suppress spurious callbacks, but node changes are
|
||||||
|
// probably not spurious.
|
||||||
if (savedLink) {
|
if (savedLink) {
|
||||||
for (IVaultCallback * cb = s_callbacks.Head(); cb; cb = s_callbacks.Next(cb))
|
for (IVaultCallback * cb = s_callbacks.Head(); cb; cb = s_callbacks.Next(cb))
|
||||||
cb->cb->ChangedNode(savedLink->node);
|
cb->cb->ChangedNode(savedLink->node);
|
||||||
@ -638,7 +686,7 @@ static void VaultNodeAdded (
|
|||||||
RelVaultNodeLink* parentLink = s_nodes.Find(parentId);
|
RelVaultNodeLink* parentLink = s_nodes.Find(parentId);
|
||||||
RelVaultNodeLink* childLink = s_nodes.Find(childId);
|
RelVaultNodeLink* childLink = s_nodes.Find(childId);
|
||||||
|
|
||||||
if (childLink->node->nodeType != 0) {
|
if (childLink->node->nodeType != 0 && s_suppressCallbacks == 0) {
|
||||||
for (IVaultCallback * cb = s_callbacks.Head(); cb; cb = s_callbacks.Next(cb))
|
for (IVaultCallback * cb = s_callbacks.Head(); cb; cb = s_callbacks.Next(cb))
|
||||||
cb->cb->AddedChildNode(parentLink->node, childLink->node);
|
cb->cb->AddedChildNode(parentLink->node, childLink->node);
|
||||||
}
|
}
|
||||||
@ -660,7 +708,7 @@ static void VaultNodeRemoved (
|
|||||||
if (!childLink)
|
if (!childLink)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (parentLink->node->IsParentOf(childId, 1)) {
|
if (parentLink->node->IsParentOf(childId, 1) && s_suppressCallbacks == 0) {
|
||||||
// We have the relationship, so make the callbacks
|
// We have the relationship, so make the callbacks
|
||||||
for (IVaultCallback * cb = s_callbacks.Head(); cb; cb = s_callbacks.Next(cb))
|
for (IVaultCallback * cb = s_callbacks.Head(); cb; cb = s_callbacks.Next(cb))
|
||||||
cb->cb->RemovingChildNode(parentLink->node, childLink->node);
|
cb->cb->RemovingChildNode(parentLink->node, childLink->node);
|
||||||
@ -831,11 +879,6 @@ void VaultFindNodeTrans::VaultNodeFound (
|
|||||||
*
|
*
|
||||||
***/
|
***/
|
||||||
|
|
||||||
//============================================================================
|
|
||||||
VaultDownloadTrans::VaultDownloadTrans () {
|
|
||||||
ASSERT(!nodeCount); // must be alloced with
|
|
||||||
}
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void VaultDownloadTrans::VaultNodeFetched (
|
void VaultDownloadTrans::VaultNodeFetched (
|
||||||
ENetError result,
|
ENetError result,
|
||||||
@ -1047,8 +1090,10 @@ void IRelVaultNode::UnlinkFromRelatives () {
|
|||||||
next = parents.Next(link);
|
next = parents.Next(link);
|
||||||
|
|
||||||
// We have the relationship, so make the callbacks
|
// We have the relationship, so make the callbacks
|
||||||
for (IVaultCallback * cb = s_callbacks.Head(); cb; cb = s_callbacks.Next(cb))
|
if (s_suppressCallbacks == 0) {
|
||||||
|
for (IVaultCallback* cb = s_callbacks.Head(); cb; cb = s_callbacks.Next(cb))
|
||||||
cb->cb->RemovingChildNode(link->node, this->node);
|
cb->cb->RemovingChildNode(link->node, this->node);
|
||||||
|
}
|
||||||
|
|
||||||
link->node->state->Unlink(node);
|
link->node->state->Unlink(node);
|
||||||
}
|
}
|
||||||
@ -1478,6 +1523,16 @@ void VaultUnregisterCallback (VaultCallback * cb) {
|
|||||||
cb->internal = nil;
|
cb->internal = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void VaultSuppressCallbacks() {
|
||||||
|
AtomicAdd(&s_suppressCallbacks, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void VaultEnableCallbacks() {
|
||||||
|
long prevValue = AtomicAdd(&s_suppressCallbacks, -1);
|
||||||
|
hsAssert(prevValue > 0, "Hmm... A negative vault callback suppression count?");
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
@ -1772,9 +1827,11 @@ void VaultRemoveChildNode (
|
|||||||
|
|
||||||
if (parentLink->node->IsParentOf(childId, 1)) {
|
if (parentLink->node->IsParentOf(childId, 1)) {
|
||||||
// We have the relationship, so make the callbacks
|
// We have the relationship, so make the callbacks
|
||||||
for (IVaultCallback * cb = s_callbacks.Head(); cb; cb = s_callbacks.Next(cb))
|
if (s_suppressCallbacks == 0) {
|
||||||
|
for (IVaultCallback* cb = s_callbacks.Head(); cb; cb = s_callbacks.Next(cb))
|
||||||
cb->cb->RemovingChildNode(parentLink->node, childLink->node);
|
cb->cb->RemovingChildNode(parentLink->node, childLink->node);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
parentLink->node->state->Unlink(childLink->node);
|
parentLink->node->state->Unlink(childLink->node);
|
||||||
childLink->node->state->Unlink(parentLink->node);
|
childLink->node->state->Unlink(parentLink->node);
|
||||||
@ -4945,13 +5002,27 @@ void VaultDownload (
|
|||||||
FVaultProgressCallback progressCallback,
|
FVaultProgressCallback progressCallback,
|
||||||
void * cbProgressParam
|
void * cbProgressParam
|
||||||
) {
|
) {
|
||||||
VaultDownloadTrans * trans = NEWZERO(VaultDownloadTrans);
|
VaultDownloadTrans * trans = new VaultDownloadTrans(tag, callback, cbParam,
|
||||||
StrCopy(trans->tag, tag, arrsize(trans->tag));
|
progressCallback, cbProgressParam, vaultId);
|
||||||
trans->callback = callback;
|
|
||||||
trans->cbParam = cbParam;
|
NetCliAuthVaultFetchNodeRefs(
|
||||||
trans->progressCallback = progressCallback;
|
vaultId,
|
||||||
trans->cbProgressParam = cbProgressParam;
|
VaultDownloadTrans::VaultNodeRefsFetched,
|
||||||
trans->vaultId = vaultId;
|
trans
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void VaultDownloadNoCallbacks (
|
||||||
|
const wchar tag[],
|
||||||
|
unsigned vaultId,
|
||||||
|
FVaultDownloadCallback callback,
|
||||||
|
void* cbParam,
|
||||||
|
FVaultProgressCallback progressCallback,
|
||||||
|
void* cbProgressParam
|
||||||
|
) {
|
||||||
|
VaultDownloadNoCallbacksTrans* trans = new VaultDownloadNoCallbacksTrans(tag, callback,
|
||||||
|
cbParam, progressCallback, cbProgressParam, vaultId);
|
||||||
|
|
||||||
NetCliAuthVaultFetchNodeRefs(
|
NetCliAuthVaultFetchNodeRefs(
|
||||||
vaultId,
|
vaultId,
|
||||||
@ -5001,6 +5072,8 @@ void VaultDownloadAndWait (
|
|||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void VaultCull (unsigned vaultId) {
|
void VaultCull (unsigned vaultId) {
|
||||||
|
VaultCallbackSuppressor suppress;
|
||||||
|
|
||||||
// Remove the node from the global table
|
// Remove the node from the global table
|
||||||
if (RelVaultNodeLink * link = s_nodes.Find(vaultId)) {
|
if (RelVaultNodeLink * link = s_nodes.Find(vaultId)) {
|
||||||
LogMsg(kLogDebug, L"Vault: Culling node %u", link->node->nodeId);
|
LogMsg(kLogDebug, L"Vault: Culling node %u", link->node->nodeId);
|
||||||
|
@ -82,6 +82,18 @@ struct VaultCallback {
|
|||||||
void VaultRegisterCallback (VaultCallback * cb);
|
void VaultRegisterCallback (VaultCallback * cb);
|
||||||
void VaultUnregisterCallback (VaultCallback * cb);
|
void VaultUnregisterCallback (VaultCallback * cb);
|
||||||
|
|
||||||
|
void VaultSuppressCallbacks();
|
||||||
|
void VaultEnableCallbacks();
|
||||||
|
|
||||||
|
class VaultCallbackSuppressor
|
||||||
|
{
|
||||||
|
VaultCallbackSuppressor(const VaultCallbackSuppressor&) { }
|
||||||
|
VaultCallbackSuppressor(VaultCallbackSuppressor&&) { }
|
||||||
|
|
||||||
|
public:
|
||||||
|
VaultCallbackSuppressor() { VaultSuppressCallbacks(); }
|
||||||
|
~VaultCallbackSuppressor() { VaultEnableCallbacks(); }
|
||||||
|
};
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
@ -476,6 +488,14 @@ void VaultDownload (
|
|||||||
FVaultProgressCallback progressCallback,
|
FVaultProgressCallback progressCallback,
|
||||||
void * cbProgressParam
|
void * cbProgressParam
|
||||||
);
|
);
|
||||||
|
void VaultDownloadNoCallbacks(
|
||||||
|
const wchar tag[],
|
||||||
|
unsigned vaultId,
|
||||||
|
FVaultDownloadCallback callback,
|
||||||
|
void* cbParam,
|
||||||
|
FVaultProgressCallback progressCallback,
|
||||||
|
void* cbProgressParam
|
||||||
|
);
|
||||||
void VaultDownloadAndWait (
|
void VaultDownloadAndWait (
|
||||||
const wchar tag[],
|
const wchar tag[],
|
||||||
unsigned vaultId,
|
unsigned vaultId,
|
||||||
|
Reference in New Issue
Block a user