Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the Wiimote controller #1141

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
36 changes: 34 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,8 @@ typedef enum

/* Added after 2.4 */
LAYOUT_GAMECUBE,
LAYOUT_WIIMOTE_ON_WII,
LAYOUT_WIIMOTE_ON_PC,

LAYOUT_TOTAL
}
Expand Down Expand Up @@ -152,7 +161,21 @@ 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]
}
},
{ // WIIMOTE on 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]
},
{ // WIIMOTE on PC
glyph[GLYPH_NINTENDO_WII_A], glyph[GLYPH_NINTENDO_WII_B],
glyph[GLYPH_NINTENDO_WII_1], glyph[GLYPH_NINTENDO_WII_2],
"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 +255,19 @@ 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)
{
layout = LAYOUT_WIIMOTE_ON_PC;
}
else if (product == 0x0501) // First wiimote on Wii
{
layout = LAYOUT_WIIMOTE_ON_WII;
}
else
{
layout = LAYOUT_NINTENDO_SWITCH_PRO;
Expand Down
Loading