Ejemplo n.º 1
0
void ExpandPointer(VARINFO *v, int code, int page)
{
    if (v->pointer)
    {
        if (code == TVE_EXPAND)
        {
            int val;
            int outofscope = (val = v->derefaddress) == -1 && !ReadValue(v->address, &val, 4, v) || !val;
            if (!v->subtype && watchinfo_list[page][v->watchindex].dbg_info)
            {
                TreeView_DeleteItem(hwndTree[page], v->hTreeHolder);
                ExpandPointerInfo(watchinfo_list[page][v->watchindex].dbg_info, v);
                if (v->subtype->structure)
                {
                    InsertSubTree(v->hTreeItem, 0, v->subtype->subtype, v->watchindex, page);
                }
                else
                    InsertSubTree(v->hTreeItem, 0, v->subtype, v->watchindex, page);
            }
            RefreshAddresses(v->subtype, val, NULL, outofscope);
            RefreshData(watchinfo_list[page][v->watchindex].dbg_info, v);
        }
        else if (code == TVE_COLLAPSE)
        {
            if (v->subtype)
            {
                FreeTree(v->subtype, page);
                FreeVarInfo(v->subtype);
                v->subtype = 0;
                v->hTreeHolder = InsertItem(v->hTreeItem, TVI_LAST, v, page);
            }
        }
    }
}
Ejemplo n.º 2
0
static void AddItem(DEBUG_INFO *dbg, VARINFO *var,
                    int cursoreip, WATCHDATA *ptr)
{
    WATCHINFO *x = MatchItem(var, ptr);
    if (x)
    {
        x->marked = FALSE;
        FreeVarInfo(var);
    }
    else
    {
        HTREEITEM previous = 0;
        if (ptr->watchinfo_count >= ptr->watchinfo_max)
        {
            if (ptr->watchinfo_max >= 128)
            {
                ExtendedMessageBox("Watch Error", MB_SETFOREGROUND |
                                   MB_SYSTEMMODAL,
                                   "There are too many items in the watch window\nNot adding the current selection");
                return ;
            }
            ptr->watchinfo_max += 64;
            ptr->watchinfo_list = realloc(ptr->watchinfo_list, ptr->watchinfo_max *sizeof
                                          (WATCHINFO));
        }
        if (ptr->watchinfo_count)
            previous = ptr->watchinfo_list[ptr->watchinfo_count - 1].info->hTreeItem;
        memset(&ptr->watchinfo_list[ptr->watchinfo_count], 0, sizeof(ptr->watchinfo_list[0]));
        ptr->watchinfo_list[ptr->watchinfo_count].info = var;
        ptr->watchinfo_list[ptr->watchinfo_count].dbg_info = dbg;
        ptr->watchinfo_list[ptr->watchinfo_count++].cursoreip = cursoreip;
        RefreshItem(ptr, &ptr->watchinfo_list[ptr->watchinfo_count - 1], var->address, NULL, TRUE);
        InsertSubTree(0, previous, var, ptr->watchinfo_count - 1, ptr);
    }
}
Ejemplo n.º 3
0
void AddItem(DEBUG_INFO *dbg, VARINFO *var, 
             int cursoreip, int page)
{
    WATCHINFO *x = MatchItem(var, page);
    if (x)
    {
        FreeVarInfo(var);
    }
    else
    {
        HTREEITEM previous = 0;
        if (watchinfo_count[page] >= watchinfo_max[page])
        {
            if (watchinfo_max[page] >= 128)
            {
                ExtendedMessageBox("Watch Error", MB_SETFOREGROUND |
                    MB_SYSTEMMODAL, 
                    "There are too many items in the watch window\nNot adding the current selection");
                return ;
            }
            watchinfo_max[page] += 64;
            watchinfo_list[page] = realloc(watchinfo_list[page], watchinfo_max[page] *sizeof
                (WATCHINFO));
        }
        if (watchinfo_count[page])
            previous = watchinfo_list[page][watchinfo_count[page] - 1].info->hTreeItem;
        memset(&watchinfo_list[page][watchinfo_count[page]], 0, sizeof(watchinfo_list[page][0]));
        watchinfo_list[page][watchinfo_count[page]].info = var;
        watchinfo_list[page][watchinfo_count[page]].dbg_info = dbg;
        watchinfo_list[page][watchinfo_count[page]++].cursoreip = cursoreip;
        RefreshItem(&watchinfo_list[page][watchinfo_count[page] - 1], var->address, NULL);
        InsertSubTree(0, previous, var, watchinfo_count[page] - 1, page);
    }
}
Ejemplo n.º 4
0
void QuadTree::Insert(Sprite *obj){
	if(! isLeaf ){ // Node
		InsertSubTree(obj);
	} else { // Leaf
		objects->push_back(obj);
		// An over Full Leaf should become a Node
		isDirty=true;
	}
	objectcount++;
}
Ejemplo n.º 5
0
static void ExpandPointer(VARINFO *v, int code, WATCHDATA *ptr)
{
    if (v->pointer)
    {
        if (code == TVE_EXPAND)
        {
            int val;
            int outofscope;
            outofscope = ((val = v->derefaddress) == -1 && !ReadValue(v->address, &val, 4, v)) || !val;
            if (!v->subtype && ptr->watchinfo_list[v->watchindex].dbg_info)
            {
                TreeView_DeleteItem(ptr->hwndWatchTree, v->hTreeHolder);
                ExpandPointerInfo(ptr->watchinfo_list[v->watchindex].dbg_info, v);
                if (v->subtype->structure)
                {
                    InsertSubTree(v->hTreeItem, 0, v->subtype->subtype, v->watchindex, ptr);
                }
                else
                    InsertSubTree(v->hTreeItem, 0, v->subtype, v->watchindex, ptr);
            }
            ptr->structNesting[ptr->nestingCount++] = v;
            RefreshAddresses(ptr, v->subtype, val, NULL, outofscope);
            ptr->nestingCount--;
            RefreshData(ptr->watchinfo_list[v->watchindex].dbg_info, v, TRUE);
        }
        else if (code == TVE_COLLAPSE)
        {
            if (v->subtype && !v->derefaddress)
            {
                FreeTree(v->subtype, ptr);
                FreeVarInfo(v->subtype);
                v->subtype = 0;
                v->hTreeHolder = InsertItem(v->hTreeItem, TVI_LAST, v, ptr);
            }
        }
    }
}
Ejemplo n.º 6
0
void QuadTree::ReBallance(){
	unsigned int numObjects = this->Count();
	list<Sprite*>::iterator i;

	if( isDirty && isLeaf && numObjects>QUADMAXOBJECTS && radius>MIN_QUAD_SIZE){
		//cout << "LEAF at "<<center<<" is becoming a NODE.\n";
		isLeaf = false;

		assert(0 != objects->size()); // The Leaf list should not be empty

		for( i = objects->begin(); i != objects->end(); ++i ) {
			InsertSubTree(*i);
		}
		assert(!isLeaf); // Still a Node
		this->objects->clear();
	} else if(isDirty && !isLeaf && numObjects<=QUADMAXOBJECTS ){
		assert(0 == objects->size()); // The Leaf list should be empty
		//cout << "NODE at "<<center<<" is becoming a LEAF.\n";
		isLeaf = true;
		for(int t=0;t<4;t++){
			if(NULL != (subtrees[t])){
				list<Sprite*> *other = subtrees[t]->GetSprites();
				for( i = other->begin(); i != other->end(); ++i ) {
					objects->push_back( *i );
				}
				delete other;
				delete subtrees[t];
				subtrees[t] = NULL;
			}
		}
		assert(isLeaf); // Still a Leaf
	}
	// ReBallance the subtrees
	for(int t=0;t<4;t++){
		if(NULL != (subtrees[t])){
			if(subtrees[t]->Count()==0){
				delete subtrees[t];
				subtrees[t] = NULL;
			} else {
				subtrees[t]->ReBallance();
			}
		}
	}
	isDirty=false;
	assert(numObjects == this->Count()); // ReBallancing should never change the total number of elements
}
Ejemplo n.º 7
0
void InsertSubTree(HTREEITEM parent, HTREEITEM after, VARINFO *var, int index, int page)
{
    while (var)
    {
        AddTypeInfoToName(watchinfo_list[page][index].dbg_info, var);
        var->hTreeItem = InsertItem(parent, after, var, page);
        var->watchindex = index;
        var->watchhead.col1Text = &var->screenname;
        var->watchhead.col2Text = &var->value;
        if (var->pointer && !var->subtype)
        {
            var->hTreeHolder = InsertItem(var->hTreeItem, TVI_LAST, var, page);
            TreeView_Expand(hwndTree[page], var->hTreeItem, TVE_COLLAPSE);
        }
        else
            InsertSubTree(var->hTreeItem, 0, var->subtype, index, page);
        after = var->hTreeItem;
        var = var->link;
    }
}
Ejemplo n.º 8
0
static void InsertSubTree(HTREEITEM parent, HTREEITEM after, VARINFO *var, int index, WATCHDATA *ptr)
{
    while (var)
    {
        AddTypeInfoToName(ptr->watchinfo_list[index].dbg_info, var);
        var->hTreeItem = InsertItem(parent, after, var, ptr);
        var->watchindex = index;
        var->watchhead.col1Text = &var->screenname[0];
        var->watchhead.col2Text = &var->value[0];
        if (var->pointer && !var->subtype && (!var->lref && !var->rref || var->type > eReservedTop))
        {
            var->hTreeHolder = InsertItem(var->hTreeItem, TVI_LAST, var, ptr);
            TreeView_Expand(ptr->hwndWatchTree, var->hTreeItem, TVE_COLLAPSE);
        }
        else
            InsertSubTree(var->hTreeItem, 0, var->subtype, index, ptr);
        after = var->hTreeItem;
        var = var->link;
    }
}