//========================================= // 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); }
//========================================= // onResize //========================================= public void onResize(uint mpHeap, uint mpOrigBlock, uint mNewSize, uint mpNewBlock, HaloWarsMem.BALContext context) { XBOXMemView.VirtualAddressInfo vai = XBOXMemView.getVirtualAddressInfo(mpOrigBlock); if (vai.mMemRegion == XBOXMemView.VirtualAddressInfo.eMemRegion.eVirtual) { if (vai.mSizeOfContainingPage == XBOXMemView.VirtualAddressInfo.ePageSize.e4k) { mVirtual4KRange.onResize(mpHeap, mpOrigBlock, mNewSize, mpNewBlock, context); } else if (vai.mSizeOfContainingPage == XBOXMemView.VirtualAddressInfo.ePageSize.e64k) { mVirtual64KRange.onResize(mpHeap, mpOrigBlock, mNewSize, mpNewBlock, context); } } else if (vai.mMemRegion == XBOXMemView.VirtualAddressInfo.eMemRegion.eImage) { if (vai.mSizeOfContainingPage == XBOXMemView.VirtualAddressInfo.ePageSize.e4k) { mImage4KRange.onResize(mpHeap, mpOrigBlock, mNewSize, mpNewBlock, context); } else if (vai.mSizeOfContainingPage == XBOXMemView.VirtualAddressInfo.ePageSize.e64k) { mImage64KRange.onResize(mpHeap, mpOrigBlock, mNewSize, mpNewBlock, context); } } else if (vai.mMemRegion == XBOXMemView.VirtualAddressInfo.eMemRegion.eEncrypted) { mEncrypted64KRange.onResize(mpHeap, mpOrigBlock, mNewSize, mpNewBlock, context); } else if (vai.mMemRegion == XBOXMemView.VirtualAddressInfo.eMemRegion.ePhysical) { if (vai.mSizeOfContainingPage == XBOXMemView.VirtualAddressInfo.ePageSize.e4k) { Physical4KRange.onResize(mpHeap, mpOrigBlock, mNewSize, mpNewBlock, context); } else if (vai.mSizeOfContainingPage == XBOXMemView.VirtualAddressInfo.ePageSize.e64k) { Physical64KRange.onResize(mpHeap, mpOrigBlock, mNewSize, mpNewBlock, context); } else if (vai.mSizeOfContainingPage == XBOXMemView.VirtualAddressInfo.ePageSize.e16m) { mPhysical16MBRange.onResize(mpHeap, mpOrigBlock, mNewSize, mpNewBlock, context); } } }