File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed
Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -865,6 +865,18 @@ interface FilteredExtensionGroups {
865865 suggestionGroups: JoystickMapSuggestionGroup []
866866}
867867
868+ /**
869+ * Check if a suggestion group targets the currently selected joystick profile
870+ * @param {JoystickMapSuggestionGroup} group - The group to evaluate
871+ * @returns {boolean} True when the group is compatible with the selected profile
872+ */
873+ const suggestionGroupMatchesSelectedProfile = (group : JoystickMapSuggestionGroup ): boolean => {
874+ if (! group .target ?.length ) return true
875+ if (! selectedProfileHash .value ) return false
876+
877+ return group .target .includes (selectedProfileHash .value )
878+ }
879+
868880/**
869881 * Helper to filter suggestion groups within an extension by a predicate
870882 * @param {JoystickMapSuggestionGroupsFromExtension} extensionGroup - The extension group to filter
@@ -877,6 +889,7 @@ const filterExtensionGroups = (
877889): FilteredExtensionGroups => ({
878890 extensionName: extensionGroup .extensionName ,
879891 suggestionGroups: extensionGroup .suggestionGroups
892+ .filter ((group ) => suggestionGroupMatchesSelectedProfile (group ))
880893 .map ((group ) => ({
881894 ... group ,
882895 buttonMappingSuggestions: group .buttonMappingSuggestions .filter (predicate ),
Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ const JoystickMapSuggestionGroupSchema = z.object({
101101 id : z . string ( ) ,
102102 name : z . string ( ) ,
103103 buttonMappingSuggestions : z . array ( JoystickButtonMappingSuggestionSchema ) ,
104+ targetVehicleTypes : z . array ( z . string ( ) ) . optional ( ) ,
104105 version : z . string ( ) . optional ( ) ,
105106} )
106107
Original file line number Diff line number Diff line change @@ -581,6 +581,10 @@ export interface JoystickMapSuggestionGroup {
581581 * List of button mapping suggestions in this group
582582 */
583583 buttonMappingSuggestions : JoystickMapSuggestion [ ]
584+ /**
585+ * Optional list of joystick profile hashes this group targets
586+ */
587+ targetVehicleTypes ?: string [ ]
584588}
585589
586590/**
You can’t perform that action at this time.
0 commit comments