//========================================= // onConnect //========================================= public void onConnect() { int labelHeight = 22; int cSpacing = 4; int maxHeight = Height - labelHeight - (cSpacing * 1); mPhysicalMemoryRange.Top = labelHeight; // take into account the label.. mPhysicalMemoryRange.Height = maxHeight; mPhysicalMemoryRange.Width = this.Width; int mTotalVisibleArea = mPhysicalMemoryRange.Width * mPhysicalMemoryRange.Height; uint minMem = XBOXMemView.convertVirtualAddrToPhysicalAddr((uint)XBOXMemView.MM_PHYSICAL_64KB_BASE); uint maxMem = XBOXMemView.convertVirtualAddrToPhysicalAddr((uint)XBOXMemView.MM_PHYSICAL_4KB_END); uint rangeMem = maxMem - minMem; int mNumBytesPerPixel = (int)(rangeMem / (float)mTotalVisibleArea); headerLabel.Text = "Physical Memory View (1px = " + mNumBytesPerPixel + "bytes)"; this.mPhysicalMemoryRange.init((ulong)minMem, (uint)rangeMem); mPhysicalMemoryRange.onConnect(); }
//========================================= // onDelete //========================================= public void onDelete(uint mpHeap, uint mpBlock, HaloWarsMem.BALContext context) { XBOXMemView.VirtualAddressInfo vai = XBOXMemView.getVirtualAddressInfo(mpBlock); if (vai.mMemRegion != XBOXMemView.VirtualAddressInfo.eMemRegion.ePhysical) { return; } uint translatedAddress = XBOXMemView.convertVirtualAddrToPhysicalAddr(mpBlock); mPhysicalMemoryRange.onDelete(mpHeap, translatedAddress, context); }