Пример #1
0
        private byte[] Write()
        {
            byte[] data = new byte[SIZE_CGB];
            for (int i = 0; i < Tiles.Length; i++)
            {
                Array.Copy(Tiles[i].Write(), 0, data, i * Tile.SIZE_TILE, Tile.SIZE_TILE);
            }

            for (int i = 0; i < ColorPalette.Length; i++)
            {
                BitConverter.GetBytes(GetRGB555(ColorPalette[i])).CopyTo(data, 0x1FE0 + (i * 2));
            }

            Array.Copy(Map.Write(), 0, data, 0x2000, 0x600);

            return(data);
        }
Пример #2
0
        private byte[] Write()
        {
            byte[] data = new byte[SIZE_CGB];
            for (int i = 0; i < Tiles.Length; i++)
            {
                Array.Copy(Tiles[i].Write(), 0, data, i * Tile.SIZE_TILE, Tile.SIZE_TILE);
            }

            for (int i = 0; i < ColorPalette.Length; i++)
            {
                var value = GetRGB555(ColorPalette[i]);
                var span  = data.AsSpan(0x1FE0 + (i * 2));
                WriteUInt16LittleEndian(span, value);
            }

            Array.Copy(Map.Write(), 0, data, 0x2000, 0x600);

            return(data);
        }