コード例 #1
0
        static unsafe void DumpAlpha(int index, IntPtr framePtr, PinMameDisplayLayout displayLayout)
        {
            ushort *ptr = (ushort *)framePtr;

            for (var position = 0; position < displayLayout.Length; position++)
            {
                var segments = new string[8] {
                    " AAAAA   ",
                    "FI J KB  ",
                    "F IJK B  ",
                    " GG LL   ",
                    "E ONM C  ",
                    "EO N MC P",
                    " DDDDD  H",
                    "       H "
                };

                for (var row = 0; row < 8; row++)
                {
                    for (var column = 0; column < segments[row].Length; column++)
                    {
                        for (var bit = 0; bit < 16; bit++)
                        {
                            segments[row] = segments[row].Replace("" + (char)('A' + bit), (ptr[position] & (1 << bit)) > 0 ? "▓" : " ");
                        }
                    }

                    Console.SetCursorPosition(position * 10, index * 8 + row);
                    Console.Write(segments[row] + " ");
                }
            }
        }
コード例 #2
0
ファイル: PinMame.cs プロジェクト: jsm174/pinmame-dotnet
 private void ProbeOnDisplayAvailable(int index, int displayCount, PinMameDisplayLayout displayLayout)
 {
     _availableDisplays[index] = displayLayout;
     if (displayCount == _availableDisplays.Count)
     {
         _availableDisplaysToken.Cancel();
     }
 }
コード例 #3
0
ファイル: PinMame.cs プロジェクト: jsm174/pinmame-dotnet
        private void OnDisplayUpdatedCallback(int index, IntPtr framePtr, ref PinMameApi.PinmameDisplayLayout displayLayoutRef)
        {
            var displayLayout = new PinMameDisplayLayout(displayLayoutRef);

            Logger.Trace($"OnDisplayUpdatedCallback - index={index}, displayLayout={displayLayout}");

            OnDisplayUpdated?.Invoke(index, framePtr, displayLayout);
        }
コード例 #4
0
ファイル: PinMame.cs プロジェクト: jsm174/pinmame-dotnet
        private void OnDisplayAvailableCallback(int index, int displayCount, ref PinMameApi.PinmameDisplayLayout displayLayoutRef)
        {
            var displayLayout = new PinMameDisplayLayout(displayLayoutRef, PinMameApi.PinmameGetHardwareGen());

            Logger.Trace($"OnDisplayAvailableCallback - index={index}, displayCount={displayCount}, displayLayout={displayLayout}");

            OnDisplayAvailable?.Invoke(index, displayCount, displayLayout);
        }
コード例 #5
0
        static void OnDisplayUpdated(int index, IntPtr framePtr, PinMameDisplayLayout displayLayout)
        {
            Logger.Info($"OnDisplayUpdated: index={index}, displayLayout={displayLayout}");

            if (displayLayout.IsDmd && _dmdMap != null)
            {
                DumpDmd(index, framePtr, displayLayout);
            }
            else
            {
                DumpAlpha(index, framePtr, displayLayout);
            }
        }
コード例 #6
0
        static unsafe void DumpDmd(int index, IntPtr framePtr, PinMameDisplayLayout displayLayout)
        {
            byte *ptr = (byte *)framePtr;

            for (var y = 0; y < displayLayout.Height; y++)
            {
                var dmd = "";

                for (var x = 0; x < displayLayout.Width; x++)
                {
                    dmd += _dmdMap[_dmdLevels[ptr[y * displayLayout.Width + x]]];
                }

                Console.SetCursorPosition(0, y);
                Console.Write(dmd);
            }
        }
コード例 #7
0
        static void OnDisplayAvailable(int index, int displayCount, PinMameDisplayLayout displayLayout)
        {
            Logger.Info($"OnDisplayAvailable: index={index}, displayCount={displayCount}, displayLayout={displayLayout}");

            if (displayLayout.IsDmd)
            {
                if (displayLayout.Depth == 2)
                {
                    _dmdMap = new[] { "░", "▒", "▓", "▓" };
                }
                else
                {
                    _dmdMap = new[] {
                        "░", "░", "░", "░",
                        "▒", "▒", "▒", "▒",
                        "▓", "▓", "▓", "▓",
                        "▓", "▓", "▓", "▓",
                    };
                }
            }
            _dmdLevels = displayLayout.Levels;
        }