Linux (gtk, glade, cli):
- Add control for Lid (defaults to Backspace). - Disallow Left+Right or Up+Down, acts like Windows port. - Show correct button state on HUD.
This commit is contained in:
parent
fed37e55d3
commit
4e5b6e6d6f
|
@ -156,6 +156,9 @@ Enter = START
|
||||||
.RS
|
.RS
|
||||||
Left Shift = SELECT
|
Left Shift = SELECT
|
||||||
.RE
|
.RE
|
||||||
|
.RS
|
||||||
|
Backspace = LID
|
||||||
|
.RE
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
desmume was written by DeSmuME team
|
desmume was written by DeSmuME team
|
||||||
(http://sourceforge.net/projects/desmume).
|
(http://sourceforge.net/projects/desmume).
|
||||||
|
|
|
@ -121,7 +121,8 @@ const u16 cli_kb_cfg[NB_KEYS] =
|
||||||
SDLK_s, // X
|
SDLK_s, // X
|
||||||
SDLK_a, // Y
|
SDLK_a, // Y
|
||||||
SDLK_p, // DEBUG
|
SDLK_p, // DEBUG
|
||||||
SDLK_o // BOOST
|
SDLK_o, // BOOST
|
||||||
|
SDLK_BACKSPACE, // Lid
|
||||||
};
|
};
|
||||||
|
|
||||||
class configured_features : public CommandLine
|
class configured_features : public CommandLine
|
||||||
|
|
|
@ -39,7 +39,8 @@ const char *key_names[NB_KEYS] =
|
||||||
"A", "B", "Select", "Start",
|
"A", "B", "Select", "Start",
|
||||||
"Right", "Left", "Up", "Down",
|
"Right", "Left", "Up", "Down",
|
||||||
"R", "L", "X", "Y",
|
"R", "L", "X", "Y",
|
||||||
"Debug", "Boost"
|
"Debug", "Boost",
|
||||||
|
"Lid",
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Joypad Key Codes -- 4-digit Hexadecimal number
|
/* Joypad Key Codes -- 4-digit Hexadecimal number
|
||||||
|
@ -70,7 +71,8 @@ const u16 default_joypad_cfg[NB_KEYS] =
|
||||||
0x0204, // X
|
0x0204, // X
|
||||||
0x0203, // Y
|
0x0203, // Y
|
||||||
0xFFFF, // DEBUG
|
0xFFFF, // DEBUG
|
||||||
0xFFFF // BOOST
|
0xFFFF, // BOOST
|
||||||
|
0x0202, // Lid
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Load default joystick and keyboard configurations */
|
/* Load default joystick and keyboard configurations */
|
||||||
|
@ -265,11 +267,44 @@ static void set_mouse_coord(signed long x,signed long y)
|
||||||
mouse.y = y;
|
mouse.y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adapted from Windows port
|
||||||
|
bool allowUpAndDown = false;
|
||||||
|
static buttonstruct<int> cardinalHeldTime = {0};
|
||||||
|
|
||||||
|
static void RunAntipodalRestriction(const buttonstruct<bool>& pad)
|
||||||
|
{
|
||||||
|
if(allowUpAndDown)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pad.U ? (cardinalHeldTime.U++) : (cardinalHeldTime.U=0);
|
||||||
|
pad.D ? (cardinalHeldTime.D++) : (cardinalHeldTime.D=0);
|
||||||
|
pad.L ? (cardinalHeldTime.L++) : (cardinalHeldTime.L=0);
|
||||||
|
pad.R ? (cardinalHeldTime.R++) : (cardinalHeldTime.R=0);
|
||||||
|
}
|
||||||
|
static void ApplyAntipodalRestriction(buttonstruct<bool>& pad)
|
||||||
|
{
|
||||||
|
if(allowUpAndDown)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// give preference to whichever direction was most recently pressed
|
||||||
|
if(pad.U && pad.D)
|
||||||
|
if(cardinalHeldTime.U < cardinalHeldTime.D)
|
||||||
|
pad.D = false;
|
||||||
|
else
|
||||||
|
pad.U = false;
|
||||||
|
if(pad.L && pad.R)
|
||||||
|
if(cardinalHeldTime.L < cardinalHeldTime.R)
|
||||||
|
pad.R = false;
|
||||||
|
else
|
||||||
|
pad.L = false;
|
||||||
|
}
|
||||||
|
|
||||||
/* Update NDS keypad */
|
/* Update NDS keypad */
|
||||||
void update_keypad(u16 keys)
|
void update_keypad(u16 keys)
|
||||||
{
|
{
|
||||||
NDS_beginProcessingInput();
|
// Set raw inputs
|
||||||
UserButtons& input = NDS_getProcessingUserInput().buttons;
|
{
|
||||||
|
buttonstruct<bool> input = {};
|
||||||
input.G = (keys>>12)&1;
|
input.G = (keys>>12)&1;
|
||||||
input.E = (keys>>8)&1;
|
input.E = (keys>>8)&1;
|
||||||
input.W = (keys>>9)&1;
|
input.W = (keys>>9)&1;
|
||||||
|
@ -283,7 +318,21 @@ void update_keypad(u16 keys)
|
||||||
input.D = (keys>>7)&1;
|
input.D = (keys>>7)&1;
|
||||||
input.L = (keys>>5)&1;
|
input.L = (keys>>5)&1;
|
||||||
input.R = (keys>>4)&1;
|
input.R = (keys>>4)&1;
|
||||||
input.F = 0;
|
input.F = (keys>>14)&1;
|
||||||
|
RunAntipodalRestriction(input);
|
||||||
|
NDS_setPad(
|
||||||
|
input.R, input.L, input.D, input.U,
|
||||||
|
input.T, input.S, input.B, input.A,
|
||||||
|
input.Y, input.X, input.W, input.E,
|
||||||
|
input.G, input.F);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set real input
|
||||||
|
NDS_beginProcessingInput();
|
||||||
|
{
|
||||||
|
UserButtons& input = NDS_getProcessingUserInput().buttons;
|
||||||
|
ApplyAntipodalRestriction(input);
|
||||||
|
}
|
||||||
NDS_endProcessingInput();
|
NDS_endProcessingInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
#define JOY_HAT_UP 2
|
#define JOY_HAT_UP 2
|
||||||
#define JOY_HAT_DOWN 3
|
#define JOY_HAT_DOWN 3
|
||||||
|
|
||||||
#define NB_KEYS 14
|
#define NB_KEYS 15
|
||||||
#define KEY_NONE 0
|
#define KEY_NONE 0
|
||||||
#define KEY_A 1
|
#define KEY_A 1
|
||||||
#define KEY_B 2
|
#define KEY_B 2
|
||||||
|
@ -60,6 +60,7 @@
|
||||||
#define KEY_Y 12
|
#define KEY_Y 12
|
||||||
#define KEY_DEBUG 13
|
#define KEY_DEBUG 13
|
||||||
#define KEY_BOOST 14
|
#define KEY_BOOST 14
|
||||||
|
#define KEY_LID 15
|
||||||
|
|
||||||
/* Keypad key names */
|
/* Keypad key names */
|
||||||
extern const char *key_names[NB_KEYS];
|
extern const char *key_names[NB_KEYS];
|
||||||
|
|
|
@ -103,6 +103,9 @@ Enter = START
|
||||||
.RS
|
.RS
|
||||||
Left Shift = SELECT
|
Left Shift = SELECT
|
||||||
.RE
|
.RE
|
||||||
|
.RS
|
||||||
|
Backspace = LID
|
||||||
|
.RE
|
||||||
.PP
|
.PP
|
||||||
Desmume accepts joystick events, which can be configured by user.
|
Desmume accepts joystick events, which can be configured by user.
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
|
|
|
@ -1596,6 +1596,25 @@ Contributors:
|
||||||
<property name="y_options"></property>
|
<property name="y_options"></property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkButton" id="button_Lid">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="label" translatable="yes">Lid : </property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
|
<property name="focus_on_click">True</property>
|
||||||
|
<signal name="clicked" handler="on_button_kb_key_clicked" object="%d:15" last_modification_time="Tue, 13 Feb 2007 07:20:23 GMT"/>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">4</property>
|
||||||
|
<property name="right_attach">5</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
<property name="bottom_attach">3</property>
|
||||||
|
<property name="x_options">fill</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkButton" id="button_Select">
|
<widget class="GtkButton" id="button_Select">
|
||||||
|
@ -2012,6 +2031,25 @@ Contributors:
|
||||||
<property name="y_options"></property>
|
<property name="y_options"></property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkButton" id="button_joy_Lid">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="label" translatable="yes">Lid : </property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
|
<property name="focus_on_click">True</property>
|
||||||
|
<signal name="clicked" handler="on_button_joy_key_clicked" object="%d:15" last_modification_time="Tue, 13 Feb 2007 07:07:05 GMT"/>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">4</property>
|
||||||
|
<property name="right_attach">5</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="bottom_attach">2</property>
|
||||||
|
<property name="x_options">fill</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkButton" id="button_joy_L">
|
<widget class="GtkButton" id="button_joy_L">
|
||||||
|
|
|
@ -61,7 +61,8 @@ const u16 gtk_kb_cfg[NB_KEYS] =
|
||||||
GDK_s, // X
|
GDK_s, // X
|
||||||
GDK_a, // Y
|
GDK_a, // Y
|
||||||
GDK_p, // DEBUG
|
GDK_p, // DEBUG
|
||||||
GDK_o // BOOST
|
GDK_o, // BOOST
|
||||||
|
GDK_BackSpace, // Lid
|
||||||
};
|
};
|
||||||
|
|
||||||
SoundInterface_struct *SNDCoreList[] = {
|
SoundInterface_struct *SNDCoreList[] = {
|
||||||
|
|
|
@ -157,6 +157,9 @@ Enter = START
|
||||||
.RS
|
.RS
|
||||||
Left Shift = SELECT
|
Left Shift = SELECT
|
||||||
.RE
|
.RE
|
||||||
|
.RS
|
||||||
|
Backspace = LID
|
||||||
|
.RE
|
||||||
.PP
|
.PP
|
||||||
Desmume accepts joystick events, which can be configured by user.
|
Desmume accepts joystick events, which can be configured by user.
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
|
|
|
@ -610,7 +610,8 @@ static const u16 gtk_kb_cfg[NB_KEYS] = {
|
||||||
GDK_s, // X
|
GDK_s, // X
|
||||||
GDK_a, // Y
|
GDK_a, // Y
|
||||||
GDK_p, // DEBUG
|
GDK_p, // DEBUG
|
||||||
GDK_o // BOOST
|
GDK_o, // BOOST
|
||||||
|
GDK_BackSpace, // Lid
|
||||||
};
|
};
|
||||||
|
|
||||||
GKeyFile *keyfile;
|
GKeyFile *keyfile;
|
||||||
|
|
Loading…
Reference in New Issue