@@ -200,7 +200,7 @@ private void UpdateDmd(int index, PinMameDisplayLayout displayLayout, IntPtr fra
200
200
201
201
lock ( _dispatchQueue ) {
202
202
_dispatchQueue . Enqueue ( ( ) => OnDisplayFrame ? . Invoke ( this ,
203
- new DisplayFrameData ( $ "{ DmdPrefix } { index } ", GetDisplayType ( displayLayout . Type ) , _frameBuffer [ index ] ) ) ) ;
203
+ new DisplayFrameData ( $ "{ DmdPrefix } { index } ", GetDisplayFrameFormat ( displayLayout ) , _frameBuffer [ index ] ) ) ) ;
204
204
}
205
205
}
206
206
@@ -211,7 +211,7 @@ private void UpdateSegDisp(int index, PinMameDisplayLayout displayLayout, IntPtr
211
211
lock ( _dispatchQueue ) {
212
212
//Logger.Info($"[PinMAME] Seg data ({index}): {BitConverter.ToString(_frameBuffer[index])}" );
213
213
_dispatchQueue . Enqueue ( ( ) => OnDisplayFrame ? . Invoke ( this ,
214
- new DisplayFrameData ( $ "{ SegDispPrefix } { index } ", GetDisplayType ( displayLayout . Type ) , _frameBuffer [ index ] ) ) ) ;
214
+ new DisplayFrameData ( $ "{ SegDispPrefix } { index } ", GetDisplayFrameFormat ( displayLayout ) , _frameBuffer [ index ] ) ) ) ;
215
215
}
216
216
}
217
217
@@ -300,41 +300,37 @@ public void Switch(string id, bool isClosed)
300
300
}
301
301
}
302
302
303
- public static DisplayFrameFormat GetDisplayType ( PinMameDisplayType dp )
303
+ public static DisplayFrameFormat GetDisplayFrameFormat ( PinMameDisplayLayout layout )
304
304
{
305
- switch ( dp ) {
305
+ if ( layout . IsDmd ) {
306
+ return layout . Depth == 4 ? DisplayFrameFormat . Dmd4 : DisplayFrameFormat . Dmd2 ;
307
+ }
308
+
309
+ switch ( layout . Type ) {
306
310
case PinMameDisplayType . Seg8 : // 7 segments and comma
307
311
case PinMameDisplayType . Seg7SC : // 7 segments, small, with comma
308
- return DisplayFrameFormat . Segment7Comma ;
309
312
case PinMameDisplayType . Seg8D : // 7 segments and period
310
- return DisplayFrameFormat . Segment7Dot ;
311
313
case PinMameDisplayType . Seg7 : // 7 segments
312
314
case PinMameDisplayType . Seg7S : // 7 segments, small
313
- return DisplayFrameFormat . Segment7 ;
314
315
case PinMameDisplayType . Seg87 : // 7 segments, comma every three
315
- return DisplayFrameFormat . Segment7CommaEvery3 ;
316
316
case PinMameDisplayType . Seg87F : // 7 segments, forced comma every three
317
- return DisplayFrameFormat . Segment7CommaEvery3Forced ;
318
-
319
317
case PinMameDisplayType . Seg10 : // 9 segments and comma
320
- return DisplayFrameFormat . Segment9Comma ;
321
318
case PinMameDisplayType . Seg9 : // 9 segments
322
- return DisplayFrameFormat . Segment9 ;
323
319
case PinMameDisplayType . Seg98 : // 9 segments, comma every three
324
- return DisplayFrameFormat . Segment9CommaEvery3 ;
325
320
case PinMameDisplayType . Seg98F : // 9 segments, forced comma every three
326
- return DisplayFrameFormat . Segment9CommaEvery3Forced ;
327
-
328
321
case PinMameDisplayType . Seg16 : // 16 segments
329
- return DisplayFrameFormat . Segment16 ;
330
322
case PinMameDisplayType . Seg16R : // 16 segments with comma and period reversed
331
323
case PinMameDisplayType . Seg16N : // 16 segments without commas
332
324
case PinMameDisplayType . Seg16D : // 16 segments with periods only
333
325
case PinMameDisplayType . Seg16S : // 16 segments with split top and bottom line
334
- return DisplayFrameFormat . Segment16 ;
335
-
336
- case PinMameDisplayType . Dmd :
337
- return DisplayFrameFormat . Dmd2 ;
326
+ case PinMameDisplayType . Seg8H :
327
+ case PinMameDisplayType . Seg7H :
328
+ case PinMameDisplayType . Seg87H :
329
+ case PinMameDisplayType . Seg87FH :
330
+ case PinMameDisplayType . Seg7SH :
331
+ case PinMameDisplayType . Seg7SCH :
332
+ case PinMameDisplayType . Seg7 | PinMameDisplayType . NoDisp :
333
+ return DisplayFrameFormat . Segment ;
338
334
339
335
case PinMameDisplayType . Video :
340
336
break ;
@@ -346,19 +342,13 @@ public static DisplayFrameFormat GetDisplayType(PinMameDisplayType dp)
346
342
case PinMameDisplayType . SegRev :
347
343
case PinMameDisplayType . DmdNoAA :
348
344
case PinMameDisplayType . NoDisp :
349
- case PinMameDisplayType . Seg8H :
350
- case PinMameDisplayType . Seg7H :
351
- case PinMameDisplayType . Seg87H :
352
- case PinMameDisplayType . Seg87FH :
353
- case PinMameDisplayType . Seg7SH :
354
- case PinMameDisplayType . Seg7SCH :
355
- throw new ArgumentOutOfRangeException ( nameof ( dp ) , dp , null ) ;
345
+ throw new ArgumentOutOfRangeException ( nameof ( layout ) , layout , null ) ;
356
346
357
347
default :
358
- throw new ArgumentOutOfRangeException ( nameof ( dp ) , dp , null ) ;
348
+ throw new ArgumentOutOfRangeException ( nameof ( layout ) , layout , null ) ;
359
349
}
360
350
361
- throw new NotImplementedException ( $ "Still unsupported segmented display format: { dp } .") ;
351
+ throw new NotImplementedException ( $ "Still unsupported segmented display format: { layout } .") ;
362
352
}
363
353
}
364
354
}
0 commit comments