Exemple #1
0
        private void UpdateItemLinkedList()
        {
            int dist = itemData.DataMoveDist;

            var pointerToData = Expander.pointers.ItemData.AsPRom(level); // Offset of program pointer to first item
            var itemPointer   = new pCpu(newRomData, pointerToData);      // Address of first item
            var dataOffset    = itemPointer.AsPRom(level);                // Offset of first item

            bool done = false;

            while (!done)
            {
                var  OffsetOfpNext = dataOffset + 1;
                pCpu pNext         = new pCpu(newRomData, OffsetOfpNext);

                done |= pNext.Value == 0xFFFF;
                if (!done)
                {
                    // Update pointer to next item to where item data will be moved to
                    pCpu updatedPNext = pNext + dist;
                    updatedPNext.Write(newRomData, OffsetOfpNext);
                    // Update dataOffset to point to next item
                    dataOffset = pNext.AsPRom(level);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Finds the offset of a pointer table and its associated data, given the offset of the game's pointer to the pointer table.
        /// </summary>
        /// <param name="level"></param>
        /// <param name="pointers"></param>
        /// <param name="data"></param>
        /// <param name="pointerCount">Specifies the number of pointers in the pointer table. This is used to init pointers.length and data.pointerCount.</param>
        /// <param name="pTablePointer"></param>
        void FindPointersAndData(Level level, DataSegment pointers, DataSegment data, pCpu pTablePointer, int pointerCount)
        {
            pointers.pPTable     = pTablePointer.AsPRom(level);
            pointers.ptableCount = 1;
            pointers.length      = pointerCount * 2;
            pointers.pSource     = level.DerefHandle(pointers.pPTable);

            data.pPTable     = pointers.pSource;
            data.ptableCount = pointerCount;
            data.pSource     = level.DerefHandle(data.pPTable);
        }
Exemple #3
0
        private pRom GetOffsetOfFirstPalEntry(Level level)
        {
            pCpu pFirst = (pCpu)0xFFFF;

            for (int i = 0; i < Expander.pointers.PalPointerCount; i++)
            {
                var pData = level.PalettePointers[i];
                if (pData < pFirst)
                {
                    pFirst = pData;
                }
            }

            return(pFirst.AsPRom(level));
        }
Exemple #4
0
 public void SetPointers(Level level, pCpu ppPTable, int pointerCount)
 {
     this.pPTable     = ppPTable.AsPRom(level);
     this.ptableCount = pointerCount;
     this.pSource     = level.DerefHandle(ppPTable);
 }