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] + " "); } } }
private void ProbeOnDisplayAvailable(int index, int displayCount, PinMameDisplayLayout displayLayout) { _availableDisplays[index] = displayLayout; if (displayCount == _availableDisplays.Count) { _availableDisplaysToken.Cancel(); } }
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); }
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); }
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); } }
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); } }
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; }