Skip to content

Commit 4f7baf4

Browse files
committed
Add support for the Wiimote controller
Thanks @Fussmatte for the button pictures. The Product IDs added here are those reported by libSDL when running on a Wii. Fixes: #1136
1 parent 448c4a5 commit 4f7baf4

File tree

7 files changed

+29
-8
lines changed

7 files changed

+29
-8
lines changed

desktop_version/fonts/buttons_10x10.fontmeta

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<height>10</height>
66
<white_teeth>1</white_teeth>
77
<chars>
8-
<range start="0xEB00" end="0xEB36"/>
8+
<range start="0xEB00" end="0xEB3C"/>
99
</chars>
1010
<special>
11-
<range start="0xEB00" end="0xEB36" color="1"/>
11+
<range start="0xEB00" end="0xEB3C" color="1"/>
1212
</special>
1313
</font_metadata>
214 Bytes
Loading

desktop_version/fonts/buttons_12x12.fontmeta

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<height>12</height>
66
<white_teeth>1</white_teeth>
77
<chars>
8-
<range start="0xEB00" end="0xEB36"/>
8+
<range start="0xEB00" end="0xEB3C"/>
99
</chars>
1010
<special>
11-
<range start="0xEB00" end="0xEB36" color="1"/>
11+
<range start="0xEB00" end="0xEB3C" color="1"/>
1212
</special>
1313
</font_metadata>
288 Bytes
Loading

desktop_version/fonts/buttons_8x8.fontmeta

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<height>8</height>
66
<white_teeth>1</white_teeth>
77
<chars>
8-
<range start="0xEB00" end="0xEB36"/>
8+
<range start="0xEB00" end="0xEB3C"/>
99
</chars>
1010
<special>
11-
<range start="0xEB00" end="0xEB36" color="1"/>
11+
<range start="0xEB00" end="0xEB3C" color="1"/>
1212
</special>
1313
</font_metadata>
252 Bytes
Loading

desktop_version/src/ButtonGlyphs.cpp

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ typedef enum
7171
GLYPH_NINTENDO_GAMECUBE_R,
7272
GLYPH_NINTENDO_GAMECUBE_Z,
7373

74+
GLYPH_NINTENDO_WII_A,
75+
GLYPH_NINTENDO_WII_B,
76+
GLYPH_NINTENDO_WII_1,
77+
GLYPH_NINTENDO_WII_2,
78+
GLYPH_NINTENDO_WII_MINUS,
79+
GLYPH_NINTENDO_WII_PLUS,
80+
7481
GLYPH_TOTAL
7582
}
7683
ButtonGlyphKey;
@@ -89,6 +96,7 @@ typedef enum
8996

9097
/* Added after 2.4 */
9198
LAYOUT_GAMECUBE,
99+
LAYOUT_WII,
92100

93101
LAYOUT_TOTAL
94102
}
@@ -152,7 +160,14 @@ static const char* glyph_layout[LAYOUT_TOTAL][SDL_CONTROLLER_BUTTON_RIGHTSHOULDE
152160
glyph[GLYPH_UNKNOWN], glyph[GLYPH_UNKNOWN], "START",
153161
glyph[GLYPH_UNKNOWN], glyph[GLYPH_UNKNOWN],
154162
glyph[GLYPH_UNKNOWN], glyph[GLYPH_NINTENDO_GAMECUBE_Z]
155-
}
163+
},
164+
{ // WII
165+
glyph[GLYPH_NINTENDO_WII_1], glyph[GLYPH_NINTENDO_WII_2],
166+
glyph[GLYPH_NINTENDO_WII_A], glyph[GLYPH_NINTENDO_WII_B],
167+
"HOME", glyph[GLYPH_NINTENDO_WII_MINUS], glyph[GLYPH_NINTENDO_WII_PLUS],
168+
glyph[GLYPH_UNKNOWN], glyph[GLYPH_UNKNOWN],
169+
glyph[GLYPH_UNKNOWN], glyph[GLYPH_UNKNOWN]
170+
},
156171
};
157172

158173
static bool keyboard_is_active = true;
@@ -232,10 +247,16 @@ void BUTTONGLYPHS_update_layout(SDL_GameController *c)
232247
{
233248
layout = LAYOUT_NINTENDO_SWITCH_JOYCON_R;
234249
}
235-
else if (product == 0x0337)
250+
else if (product == 0x0337 ||
251+
product == 0x0100) // First GC controller on a Wii or Gamecube
236252
{
237253
layout = LAYOUT_GAMECUBE;
238254
}
255+
else if (product == 0x0306 || // Wiimote on Linux
256+
product == 0x0501) // First wiimote on Wii
257+
{
258+
layout = LAYOUT_WII;
259+
}
239260
else
240261
{
241262
layout = LAYOUT_NINTENDO_SWITCH_PRO;

0 commit comments

Comments
 (0)