Skip to content

Commit f3c8764

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 f3c8764

File tree

7 files changed

+40
-8
lines changed

7 files changed

+40
-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: 34 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,8 @@ typedef enum
8996

9097
/* Added after 2.4 */
9198
LAYOUT_GAMECUBE,
99+
LAYOUT_WIIMOTE_ON_WII,
100+
LAYOUT_WIIMOTE_ON_PC,
92101

93102
LAYOUT_TOTAL
94103
}
@@ -152,7 +161,21 @@ static const char* glyph_layout[LAYOUT_TOTAL][SDL_CONTROLLER_BUTTON_RIGHTSHOULDE
152161
glyph[GLYPH_UNKNOWN], glyph[GLYPH_UNKNOWN], "START",
153162
glyph[GLYPH_UNKNOWN], glyph[GLYPH_UNKNOWN],
154163
glyph[GLYPH_UNKNOWN], glyph[GLYPH_NINTENDO_GAMECUBE_Z]
155-
}
164+
},
165+
{ // WIIMOTE on WII
166+
glyph[GLYPH_NINTENDO_WII_1], glyph[GLYPH_NINTENDO_WII_2],
167+
glyph[GLYPH_NINTENDO_WII_A], glyph[GLYPH_NINTENDO_WII_B],
168+
"HOME", glyph[GLYPH_NINTENDO_WII_MINUS], glyph[GLYPH_NINTENDO_WII_PLUS],
169+
glyph[GLYPH_UNKNOWN], glyph[GLYPH_UNKNOWN],
170+
glyph[GLYPH_UNKNOWN], glyph[GLYPH_UNKNOWN]
171+
},
172+
{ // WIIMOTE on PC
173+
glyph[GLYPH_NINTENDO_WII_A], glyph[GLYPH_NINTENDO_WII_B],
174+
glyph[GLYPH_NINTENDO_WII_1], glyph[GLYPH_NINTENDO_WII_2],
175+
"HOME", glyph[GLYPH_NINTENDO_WII_MINUS], glyph[GLYPH_NINTENDO_WII_PLUS],
176+
glyph[GLYPH_UNKNOWN], glyph[GLYPH_UNKNOWN],
177+
glyph[GLYPH_UNKNOWN], glyph[GLYPH_UNKNOWN]
178+
},
156179
};
157180

158181
static bool keyboard_is_active = true;
@@ -232,10 +255,19 @@ void BUTTONGLYPHS_update_layout(SDL_GameController *c)
232255
{
233256
layout = LAYOUT_NINTENDO_SWITCH_JOYCON_R;
234257
}
235-
else if (product == 0x0337)
258+
else if (product == 0x0337 ||
259+
product == 0x0100) // First GC controller on a Wii or Gamecube
236260
{
237261
layout = LAYOUT_GAMECUBE;
238262
}
263+
else if (product == 0x0306)
264+
{
265+
layout = LAYOUT_WIIMOTE_ON_PC;
266+
}
267+
else if (product == 0x0501) // First wiimote on Wii
268+
{
269+
layout = LAYOUT_WIIMOTE_ON_WII;
270+
}
239271
else
240272
{
241273
layout = LAYOUT_NINTENDO_SWITCH_PRO;

0 commit comments

Comments
 (0)