コード例 #1
0
    private void readSecondaryPointers()
    {
        secondayPointers = new int[numberOfRooms];

        for (int i = 0; i < numberOfRooms; i++)
        {
            secondayPointers[i] = PointerRead.ShortRead_LoHi(primaryPointer_val + (i * bytesPerRoomEntry));
        }
    }
コード例 #2
0
    private void updatePointers()
    {
        bool match = true;

        byte[] b = new byte[originalCode.Length];
        Array.Copy(ROM.DATA, codePointer, b, 0, originalCode.Length);

        for (int i = 0; i < originalCode.Length; i++)
        {
            if (originalCode[i] != b[i])
            {
                match = false;
                break;
            }
        }

        if (match)
        {
            secondaryPointer = PointerRead.ShortRead_LoHi(primaryPointer);
        }
        else if (b[0] == specialPatchByte)
        {
            int    Codeaddress = PointerRead.LongRead_LoHiBank(codePointer + 1);
            byte[] patch       = new byte[patchByConn.Length];
            Array.Copy(ROM.DATA, Codeaddress, patch, 0, patchByConn.Length);
            for (int i = 0; i < patchByConn.Length; i++)
            {
                if (patchByConn[i] != patch[i] && i != connPointerByteNo && i != connPointerByteNo + 1)
                {
                    throw new Exception(patchError);
                }
            }
            secondaryPointer = PointerRead.ShortRead_LoHi(codePointer + connPointerByteNo);
        }
        else
        {
            throw new Exception(patchError);
        }

        roomPointers = new int[size / bytesPerRoomEntry];
        for (int i = 0; i < size / bytesPerRoomEntry; i++)
        {
            roomPointers[i] = PointerRead.ShortRead_LoHi(secondaryPointer + (i * bytesPerRoomEntry));
        }
        isConnPatched = !match;
    }