Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
tyrquake
Commits
3b9aecd0
Commit
3b9aecd0
authored
Jun 21, 2019
by
Libretro-Admin
Browse files
Update - add new RETRO_ENVIRONMENT_GET_INPUT_BITMASKS
parent
c794094a
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
common/libretro.c
View file @
3b9aecd0
...
...
@@ -81,6 +81,7 @@ unsigned device_type = 0;
unsigned
MEMSIZE_MB
;
static
struct
retro_rumble_interface
rumble
;
static
bool
libretro_supports_bitmasks
=
false
;
#if defined(HW_DOL)
#define DEFAULT_MEMSIZE_MB 8
...
...
@@ -379,6 +380,9 @@ void retro_init(void)
else
log_cb
=
NULL
;
if
(
environ_cb
(
RETRO_ENVIRONMENT_GET_INPUT_BITMASKS
,
NULL
))
libretro_supports_bitmasks
=
true
;
Sys_Init
();
}
...
...
@@ -387,6 +391,8 @@ void retro_deinit(void)
Sys_Quit
();
if
(
heap
)
free
(
heap
);
libretro_supports_bitmasks
=
false
;
}
unsigned
retro_api_version
(
void
)
...
...
@@ -541,14 +547,27 @@ void Sys_SendKeyEvents(void)
{
case
RETRO_DEVICE_JOYPAD
:
case
RETRO_DEVICE_MODERN
:
if
(
libretro_supports_bitmasks
)
{
unsigned
i
;
int16_t
ret
=
input_cb
(
port
,
RETRO_DEVICE_JOYPAD
,
0
,
RETRO_DEVICE_ID_JOYPAD_MASK
);
for
(
i
=
RETRO_DEVICE_ID_JOYPAD_B
;
i
<=
RETRO_DEVICE_ID_JOYPAD_R3
;
++
i
)
{
if
(
ret
&
(
1
<<
i
))
Key_Event
(
K_JOY_B
+
i
,
1
);
else
Key_Event
(
K_JOY_B
+
i
,
0
);
}
}
else
{
unsigned
i
;
for
(
i
=
RETRO_DEVICE_ID_JOYPAD_B
;
i
<=
RETRO_DEVICE_ID_JOYPAD_R3
;
++
i
)
{
if
(
input_cb
(
port
,
RETRO_DEVICE_JOYPAD
,
0
,
i
))
Key_Event
(
K_JOY_B
+
i
,
1
);
else
Key_Event
(
K_JOY_B
+
i
,
0
);
if
(
input_cb
(
port
,
RETRO_DEVICE_JOYPAD
,
0
,
i
))
Key_Event
(
K_JOY_B
+
i
,
1
);
else
Key_Event
(
K_JOY_B
+
i
,
0
);
}
}
break
;
...
...
common/libretro.h
View file @
3b9aecd0
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment