@@ -16,7 +16,8 @@ public class MsuListService(AppInitializationService appInitializationService,
1616 IMsuUserOptionsService userOptions ,
1717 IMsuTypeService msuTypeService ,
1818 IMsuAppSettingsService appSettingsService ,
19- IMsuMonitorService msuMonitorService ) : ControlService
19+ IMsuMonitorService msuMonitorService ,
20+ IMsuHardwareService msuHardwareService ) : ControlService
2021{
2122 public MsuListViewModel Model { get ; set ; } = new ( )
2223 {
@@ -40,11 +41,17 @@ public MsuListViewModel InitializeModel()
4041 appInitializationService . InitializationComplete += InitializationServiceOnInitializationComplete ;
4142 msuLookupService . OnMsuLookupComplete += MsuLookupServiceOnOnMsuLookupComplete ;
4243 msuLookupService . OnMsuLookupStarted += MsuLookupServiceOnOnMsuLookupStarted ;
44+ msuHardwareService . HardwareMsusChanged += MsuHardwareServiceOnHardwareMsusChanged ;
4345 Model . IsMsuMonitorDisabled = appSettingsService . MsuAppSettings . DisableMsuMonitorWindow == true ;
4446 CheckIfLoading ( ) ;
4547 return Model ;
4648 }
4749
50+ private void MsuHardwareServiceOnHardwareMsusChanged ( object ? sender , MsuListEventArgs e )
51+ {
52+ PopulateMsuViewModels ( e . Msus . ToList ( ) ) ;
53+ }
54+
4855 private void MsuLookupServiceOnOnMsuLookupStarted ( object ? sender , EventArgs e )
4956 {
5057 CheckIfLoading ( ) ;
@@ -70,8 +77,24 @@ public void FilterMSUs(MsuType msuType, MsuFilter msuFilter)
7077 userOptions . MsuUserOptions . DefaultMsuPath ;
7178 var rootPath = Model . HardwareMode ? "" : GetMsuTypeBasePath ( msuType ) ;
7279 var useAbsolutePath = string . IsNullOrWhiteSpace ( rootPath ) ;
80+
81+ // Hardware MSUs are more limited in compatibility
82+ List < string > ? compatibleMsuNames = null ;
83+ if ( Model . HardwareMode )
84+ {
85+ if ( appSettingsService . MsuAppSettings . HardwareCompatibleMsuTypes . TryGetValue ( msuType . DisplayName ,
86+ out compatibleMsuNames ) )
87+ {
88+ compatibleMsuNames . Add ( msuType . DisplayName ) ;
89+ }
90+ else
91+ {
92+ compatibleMsuNames = [ msuType . DisplayName ] ;
93+ }
94+ }
95+
7396 var filteredMsus = Model . MsuViewModels
74- . Where ( x => x . Msu . MatchesFilter ( msuFilter , msuType , msuTypePath ) &&
97+ . Where ( x => x . Msu . MatchesFilter ( msuFilter , msuType , msuTypePath , compatibleMsuNames ) &&
7598 ( x . Msu . NumUniqueTracks > x . Msu . MsuType ? . RequiredTrackNumbers . Count / 5 || x . Msu . NumUniqueTracks > 10 ) )
7699 . OrderBy ( x => x . MsuName )
77100 . ToList ( ) ;
@@ -159,7 +182,7 @@ public void PopulateMsuViewModels(List<Msu>? msus)
159182 . Where ( x => userOptions . MsuUserOptions . SelectedMsus ? . Contains ( x . MsuPath ) == true ) . ToList ( ) ;
160183
161184 Model . DisplayUnknownMsuWindow =
162- Model . Msus . Any ( x => x . MsuType == null && x is { NumUniqueTracks : > 15 , IgnoreUnknown : false , IsHardwareMsu : false } && string . IsNullOrEmpty ( x . Settings . MsuTypeName ) ) ;
185+ Model . Msus . Any ( x => x . MsuType == null && x is { NumUniqueTracks : > 15 , IgnoreUnknown : false } && string . IsNullOrEmpty ( x . Settings . MsuTypeName ) ) ;
163186
164187 if ( Model . DisplayUnknownMsuWindow )
165188 {
0 commit comments