From 7075cab19c1320ceddfe3f18a88911050280abd8 Mon Sep 17 00:00:00 2001 From: David Gillies Date: Tue, 10 Sep 2024 21:12:25 -0700 Subject: [PATCH] Make display modes more curated --- src/services/CoresService.Video.cs | 78 +++++++++++++++++++++++++----- 1 file changed, 66 insertions(+), 12 deletions(-) diff --git a/src/services/CoresService.Video.cs b/src/services/CoresService.Video.cs index e6e6f9d..87bd16f 100644 --- a/src/services/CoresService.Video.cs +++ b/src/services/CoresService.Video.cs @@ -10,29 +10,57 @@ public partial class CoresService "0x10", // CRT Trinitron "0x20", // Grayscale LCD "0x30", // Reflective Color LCD + "0x40", // Backlit Color LCD + "0xE0", // Pinball Neon Matrix + "0xE1", // Vacuum Fluorescent + }; + + private static readonly string[] GB_MODES = + { + "0x21", // Original GB DMG + "0x22", // Original GBP + "0x23", // Original GBP Light + }; + + private static readonly string[] GBC_MODES = + { "0x31", // Original GBC LCD "0x32", // Original GBC LCD+ - "0x40", // Backlit Color LCD + }; + + private static readonly string[] GBA_MODES = + { "0x41", // Original GBA LCD "0x42", // Original GBA SP 101 + }; + + private static readonly string[] GG_MODES = + { "0x51", // Original GG "0x52", // Original GG+ + }; + + private static readonly string[] NGP_MODES = + { "0x61", // Original NGP + }; + + private static readonly string[] NGPC_MODES = + { "0x62", // Original NGPC "0x63", // Original NGPC+ + }; + + private static readonly string[] PCE_MODES = + { "0x71", // TurboExpress "0x72", // PC Engine LT - "0x81", // Original Lynx - "0x82", // Original Lynx+ - "0xE0", // Pinball Neon Matrix - "0xE1", // Vacuum Fluorescent }; - private static readonly string[] GB_MODES = + private static readonly string[] LYNX_MODES = { - "0x21", // Original GB DMG - "0x22", // Original GBP - "0x23", // Original GBP Light + "0x81", // Original Lynx + "0x82", // Original Lynx+ }; public void ChangeAspectRatio(string identifier, int fromWidth, int fromHeight, int toWidth, int toHeight) @@ -58,13 +86,39 @@ public void AddDisplayModes(string identifier) { var info = this.ReadCoreJson(identifier); var video = this.ReadVideoJson(identifier); - List all = ALL_MODES.Select(id => new DisplayMode { id = id }).ToList(); + List all = new List(); + + switch (info.metadata.platform_ids) - if (info.metadata.platform_ids.Contains("gb")) { - all.AddRange(GB_MODES.Select(id => new DisplayMode { id = id })); + case string[] p when p.Contains("gb"): + all.AddRange(GB_MODES.Select(id => new DisplayMode { id = id })); + break; + case string[] p when p.Contains("gbc"): + all.AddRange(GBC_MODES.Select(id => new DisplayMode { id = id })); + break; + case string[] p when p.Contains("gba"): + all.AddRange(GBA_MODES.Select(id => new DisplayMode { id = id })); + break; + case string[] p when p.Contains("gg"): + all.AddRange(GG_MODES.Select(id => new DisplayMode { id = id })); + break; + case string[] p when p.Contains("lynx"): + all.AddRange(LYNX_MODES.Select(id => new DisplayMode { id = id })); + break; + case string[] p when p.Any(s => s.EndsWith("ngpc")): + all.AddRange(NGPC_MODES.Select(id => new DisplayMode { id = id })); + break; + case string[] p when p.Any(s => s.EndsWith("ngp")): + all.AddRange(NGP_MODES.Select(id => new DisplayMode { id = id })); + break; + case string[] p when p.Any(s => s.StartsWith("pce")): + all.AddRange(PCE_MODES.Select(id => new DisplayMode { id = id })); + break; + } + all.AddRange(ALL_MODES.Select(id => new DisplayMode { id = id })); video.display_modes = all; Dictionary output = new Dictionary { { "video", video } };