Skip to content

Commit

Permalink
Add support for the Wiimote controller
Browse files Browse the repository at this point in the history
Thanks @Fussmatte for the button pictures. The Product IDs added here
are those reported by libSDL when running on a Wii.

Fixes: #1136
  • Loading branch information
mardy committed Jan 29, 2024
1 parent 448c4a5 commit 4f7baf4
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 8 deletions.
4 changes: 2 additions & 2 deletions desktop_version/fonts/buttons_10x10.fontmeta
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<height>10</height>
<white_teeth>1</white_teeth>
<chars>
<range start="0xEB00" end="0xEB36"/>
<range start="0xEB00" end="0xEB3C"/>
</chars>
<special>
<range start="0xEB00" end="0xEB36" color="1"/>
<range start="0xEB00" end="0xEB3C" color="1"/>
</special>
</font_metadata>
Binary file modified desktop_version/fonts/buttons_10x10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions desktop_version/fonts/buttons_12x12.fontmeta
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<height>12</height>
<white_teeth>1</white_teeth>
<chars>
<range start="0xEB00" end="0xEB36"/>
<range start="0xEB00" end="0xEB3C"/>
</chars>
<special>
<range start="0xEB00" end="0xEB36" color="1"/>
<range start="0xEB00" end="0xEB3C" color="1"/>
</special>
</font_metadata>
Binary file modified desktop_version/fonts/buttons_12x12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions desktop_version/fonts/buttons_8x8.fontmeta
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<height>8</height>
<white_teeth>1</white_teeth>
<chars>
<range start="0xEB00" end="0xEB36"/>
<range start="0xEB00" end="0xEB3C"/>
</chars>
<special>
<range start="0xEB00" end="0xEB36" color="1"/>
<range start="0xEB00" end="0xEB3C" color="1"/>
</special>
</font_metadata>
Binary file modified desktop_version/fonts/buttons_8x8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 23 additions & 2 deletions desktop_version/src/ButtonGlyphs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ typedef enum
GLYPH_NINTENDO_GAMECUBE_R,
GLYPH_NINTENDO_GAMECUBE_Z,

GLYPH_NINTENDO_WII_A,
GLYPH_NINTENDO_WII_B,
GLYPH_NINTENDO_WII_1,
GLYPH_NINTENDO_WII_2,
GLYPH_NINTENDO_WII_MINUS,
GLYPH_NINTENDO_WII_PLUS,

GLYPH_TOTAL
}
ButtonGlyphKey;
Expand All @@ -89,6 +96,7 @@ typedef enum

/* Added after 2.4 */
LAYOUT_GAMECUBE,
LAYOUT_WII,

LAYOUT_TOTAL
}
Expand Down Expand Up @@ -152,7 +160,14 @@ static const char* glyph_layout[LAYOUT_TOTAL][SDL_CONTROLLER_BUTTON_RIGHTSHOULDE
glyph[GLYPH_UNKNOWN], glyph[GLYPH_UNKNOWN], "START",
glyph[GLYPH_UNKNOWN], glyph[GLYPH_UNKNOWN],
glyph[GLYPH_UNKNOWN], glyph[GLYPH_NINTENDO_GAMECUBE_Z]
}
},
{ // WII
glyph[GLYPH_NINTENDO_WII_1], glyph[GLYPH_NINTENDO_WII_2],
glyph[GLYPH_NINTENDO_WII_A], glyph[GLYPH_NINTENDO_WII_B],
"HOME", glyph[GLYPH_NINTENDO_WII_MINUS], glyph[GLYPH_NINTENDO_WII_PLUS],
glyph[GLYPH_UNKNOWN], glyph[GLYPH_UNKNOWN],
glyph[GLYPH_UNKNOWN], glyph[GLYPH_UNKNOWN]
},
};

static bool keyboard_is_active = true;
Expand Down Expand Up @@ -232,10 +247,16 @@ void BUTTONGLYPHS_update_layout(SDL_GameController *c)
{
layout = LAYOUT_NINTENDO_SWITCH_JOYCON_R;
}
else if (product == 0x0337)
else if (product == 0x0337 ||
product == 0x0100) // First GC controller on a Wii or Gamecube
{
layout = LAYOUT_GAMECUBE;
}
else if (product == 0x0306 || // Wiimote on Linux
product == 0x0501) // First wiimote on Wii
{
layout = LAYOUT_WII;
}
else
{
layout = LAYOUT_NINTENDO_SWITCH_PRO;
Expand Down

0 comments on commit 4f7baf4

Please sign in to comment.