Skip to content

Commit d1b1b28

Browse files
authored
Merge pull request #63 from Provenance-Emu/feature/39_numpad_mapping
Fix 39 & 54 numpad controller/keyboard mapping
2 parents fa689cc + 30bfc3a commit d1b1b28

1 file changed

Lines changed: 27 additions & 7 deletions

File tree

libretro.c

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ static void update_input(void)
163163
joypad0Buttons[BUTTON_4] = 0x00;
164164
joypad0Buttons[BUTTON_5] = 0x00;
165165
joypad0Buttons[BUTTON_6] = 0x00;
166+
joypad0Buttons[BUTTON_7] = 0x00;
167+
joypad0Buttons[BUTTON_8] = 0x00;
168+
joypad0Buttons[BUTTON_9] = 0x00;
169+
joypad0Buttons[BUTTON_s] = 0x00;
170+
joypad0Buttons[BUTTON_d] = 0x00;
166171

167172
joypad1Buttons[BUTTON_U] = 0x00;
168173
joypad1Buttons[BUTTON_D] = 0x00;
@@ -180,6 +185,11 @@ static void update_input(void)
180185
joypad1Buttons[BUTTON_4] = 0x00;
181186
joypad1Buttons[BUTTON_5] = 0x00;
182187
joypad1Buttons[BUTTON_6] = 0x00;
188+
joypad1Buttons[BUTTON_7] = 0x00;
189+
joypad1Buttons[BUTTON_8] = 0x00;
190+
joypad1Buttons[BUTTON_9] = 0x00;
191+
joypad1Buttons[BUTTON_s] = 0x00;
192+
joypad1Buttons[BUTTON_d] = 0x00;
183193

184194
if (libretro_supports_bitmasks)
185195
{
@@ -257,20 +267,30 @@ static void update_input(void)
257267
joypad1Buttons[BUTTON_PAUSE] = 0xff;
258268
if (ret[1] & (1 << RETRO_DEVICE_ID_JOYPAD_START))
259269
joypad1Buttons[BUTTON_OPTION] = 0xff;
260-
if (ret[1] & (1 << RETRO_DEVICE_ID_JOYPAD_X))
270+
if (ret[1] & (1 << RETRO_DEVICE_ID_JOYPAD_X) || (input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0, RETROK_p)? 1 : 0))
261271
joypad1Buttons[BUTTON_0] = 0xff;
262-
if (ret[1] & (1 << RETRO_DEVICE_ID_JOYPAD_L))
272+
if (ret[1] & (1 << RETRO_DEVICE_ID_JOYPAD_L) || (input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0, RETROK_q)? 1 : 0))
263273
joypad1Buttons[BUTTON_1] = 0xff;
264-
if (ret[1] & (1 << RETRO_DEVICE_ID_JOYPAD_R))
274+
if (ret[1] & (1 << RETRO_DEVICE_ID_JOYPAD_R) || (input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0, RETROK_w)? 1 : 0))
265275
joypad1Buttons[BUTTON_2] = 0xff;
266-
if (ret[1] & (1 << RETRO_DEVICE_ID_JOYPAD_L2))
276+
if (ret[1] & (1 << RETRO_DEVICE_ID_JOYPAD_L2) || (input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0, RETROK_e)? 1 : 0))
267277
joypad1Buttons[BUTTON_3] = 0xff;
268-
if (ret[1] & (1 << RETRO_DEVICE_ID_JOYPAD_R2))
278+
if (ret[1] & (1 << RETRO_DEVICE_ID_JOYPAD_R2) || (input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0, RETROK_r)? 1 : 0))
269279
joypad1Buttons[BUTTON_4] = 0xff;
270-
if (ret[1] & (1 << RETRO_DEVICE_ID_JOYPAD_L3))
280+
if (ret[1] & (1 << RETRO_DEVICE_ID_JOYPAD_L3) || (input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0, RETROK_t)? 1 : 0))
271281
joypad1Buttons[BUTTON_5] = 0xff;
272-
if (ret[1] & (1 << RETRO_DEVICE_ID_JOYPAD_R3))
282+
if (ret[1] & (1 << RETRO_DEVICE_ID_JOYPAD_R3) || (input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0, RETROK_y)? 1 : 0))
273283
joypad1Buttons[BUTTON_6] = 0xff;
284+
if((input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0, RETROK_u)? 1 : 0))
285+
joypad1Buttons[BUTTON_7] = 0xff;
286+
if((input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0, RETROK_i)? 1 : 0))
287+
joypad1Buttons[BUTTON_8] = 0xff;
288+
if((input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0, RETROK_o)? 1 : 0))
289+
joypad1Buttons[BUTTON_9] = 0xff;
290+
if((input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0, RETROK_LEFTBRACKET)? 1 : 0))
291+
joypad1Buttons[BUTTON_s] = 0xff;
292+
if((input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0, RETROK_RIGHTBRACKET)? 1 : 0))
293+
joypad1Buttons[BUTTON_d] = 0xff;
274294
}
275295

276296
static void extract_basename(char *buf, const char *path, size_t size)

0 commit comments

Comments
 (0)