@@ -20,7 +20,7 @@ public class ControllerDefinition
2020
2121 private IReadOnlyList < IReadOnlyList < ( string , AxisSpec ? ) > > ? _orderedControls ;
2222
23- /// <summary>starts with console buttons, then each player's buttons individually</summary>
23+ /// <summary>Starts with console buttons, then each player's buttons individually</summary>
2424 public IReadOnlyList < IReadOnlyList < ( string Name , AxisSpec ? AxisSpec ) > > ControlsOrdered
2525 {
2626 get
@@ -35,6 +35,11 @@ public class ControllerDefinition
3535 public readonly string Name ;
3636
3737 private Dictionary < string , char > ? _mnemonicsCache ;
38+
39+ /// <summary>
40+ /// A mapping between buttons names and their Bk2 mnemonics.
41+ /// (it's only relevant for buttons, not axes)
42+ /// </summary>
3843 public IReadOnlyDictionary < string , char > ? MnemonicsCache => _mnemonicsCache ;
3944
4045 /// <remarks>
@@ -113,7 +118,7 @@ private void AssertMutable()
113118 if ( ! _mutable ) throw new InvalidOperationException ( ERR_MSG ) ;
114119 }
115120
116- /// <remarks>implementors should include empty lists for empty players, including "player 0", to match this base implementation</remarks>
121+ /// <remarks>Implementors should include empty lists for empty players, including "player 0" (console buttons) , to match this base implementation</remarks>
117122 protected virtual IReadOnlyList < IReadOnlyList < ( string Name , AxisSpec ? AxisSpec ) > > GenOrderedControls ( )
118123 {
119124 var ret = new List < ( string , AxisSpec ? ) > [ PlayerCount + 1 ] ;
@@ -123,7 +128,7 @@ private void AssertMutable()
123128 return ret ;
124129 }
125130
126- /// <summary>permanently disables the ability to mutate this instance; returns this reference</summary>
131+ /// <summary>Permanently disables the ability to mutate this instance; returns this reference</summary>
127132 public ControllerDefinition MakeImmutable ( )
128133 {
129134 BoolButtons = BoolButtons . ToImmutableList ( ) ;
@@ -134,6 +139,12 @@ public ControllerDefinition MakeImmutable()
134139 return this ;
135140 }
136141
142+ /// <summary>
143+ /// Get the player number associated with a control (button, analog axis, etc.).
144+ /// Returns 0 for general console buttons not associated with a particular player's control port.
145+ /// (for example, returns 0 for the Power button on NES)
146+ /// For some consoles like (non-linked) Game Boy, this always returns 0.
147+ /// </summary>
137148 public static int PlayerNumber ( string buttonName )
138149 {
139150 var match = PlayerRegex . Match ( buttonName ) ;
@@ -144,6 +155,11 @@ public static int PlayerNumber(string buttonName)
144155
145156 private static readonly Regex PlayerRegex = new Regex ( "^P(\\ d+) " ) ;
146157
158+ /// <summary>
159+ /// Returns the number of players.
160+ /// Currently only returns 0 for consoles where all control ports are empty,
161+ /// so returns 1 for (non-linked) Game Boy and similar cases.
162+ /// </summary>
147163 public int PlayerCount
148164 {
149165 get
0 commit comments