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
beetle-pce-libretro
Commits
37c567ae
Commit
37c567ae
authored
Sep 13, 2020
by
trioan
Browse files
libretro: use input bitmask
parent
17c298af
Changes
1
Hide whitespace changes
Inline
Side-by-side
libretro.cpp
View file @
37c567ae
...
...
@@ -869,6 +869,8 @@ static retro_input_poll_t input_poll_cb;
static
retro_input_state_t
input_state_cb
;
static
double
last_sound_rate
;
static
bool
libretro_supports_bitmasks
=
false
;
static
MDFN_Surface
*
surf
;
static
bool
failed_init
;
...
...
@@ -937,6 +939,9 @@ void retro_init(void)
setting_pce_last_scanline
=
242
;
check_system_specs
();
if
(
environ_cb
(
RETRO_ENVIRONMENT_GET_INPUT_BITMASKS
,
NULL
))
libretro_supports_bitmasks
=
true
;
}
void
retro_reset
(
void
)
...
...
@@ -1423,6 +1428,9 @@ void retro_unload_game(void)
static
void
update_input
(
void
)
{
unsigned
i
,
j
;
int16_t
joy_bits
[
MAX_PLAYERS
]
=
{
0
};
static
int
turbo_map
[]
=
{
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
1
,
0
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
};
static
int
turbo_map_alt
[]
=
{
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
1
,
0
};
static
unsigned
map
[]
=
{
...
...
@@ -1443,7 +1451,18 @@ static void update_input(void)
RETRO_DEVICE_ID_JOYPAD_R3
};
for
(
unsigned
j
=
0
;
j
<
MAX_PLAYERS
;
j
++
)
for
(
j
=
0
;
j
<
MAX_PLAYERS
;
j
++
)
{
if
(
libretro_supports_bitmasks
)
joy_bits
[
j
]
=
input_state_cb
(
j
,
RETRO_DEVICE_JOYPAD
,
0
,
RETRO_DEVICE_ID_JOYPAD_MASK
);
else
{
for
(
i
=
0
;
i
<
(
RETRO_DEVICE_ID_JOYPAD_R3
+
1
);
i
++
)
joy_bits
[
j
]
|=
input_state_cb
(
j
,
RETRO_DEVICE_JOYPAD
,
0
,
i
)
?
(
1
<<
i
)
:
0
;
}
}
for
(
j
=
0
;
j
<
MAX_PLAYERS
;
j
++
)
{
if
(
input_type
[
j
]
==
RETRO_DEVICE_JOYPAD
)
// Joypad
{
...
...
@@ -1458,9 +1477,9 @@ static void update_input(void)
if
(
turbo_counter
[
j
][
i
]
>
(
Turbo_Delay
))
//When the counter exceeds turbo delay, fire and return to zero
{
if
(
Turbo_Toggling
==
2
&&
(
i
==
8
||
i
==
9
)
&&
!
avpad6_enable
[
j
])
input_state
|=
input_state_cb
(
j
,
RETRO_DEVICE_JOYPAD
,
0
,
map
[
i
])
?
(
1
<<
turbo_map
[
i
])
:
0
;
input_state
|=
(
joy_bits
[
j
]
&
(
1
<<
map
[
i
])
)
?
(
1
<<
turbo_map
[
i
])
:
0
;
else
input_state
|=
input_state_cb
(
j
,
RETRO_DEVICE_JOYPAD
,
0
,
map
[
i
])
?
(
1
<<
i
)
:
0
;
input_state
|=
(
joy_bits
[
j
]
&
(
1
<<
map
[
i
])
)
?
(
1
<<
i
)
:
0
;
turbo_counter
[
j
][
i
]
=
0
;
}
...
...
@@ -1507,7 +1526,7 @@ static void update_input(void)
input_state
|=
avpad6_enable
[
j
];
}
else
input_state
|=
input_state_cb
(
j
,
RETRO_DEVICE_JOYPAD
,
0
,
map
[
i
])
?
(
1
<<
i
)
:
0
;
input_state
|=
(
joy_bits
[
j
]
&
(
1
<<
map
[
i
])
)
?
(
1
<<
i
)
:
0
;
}
if
(
disable_softreset
==
true
)
...
...
@@ -1787,6 +1806,8 @@ void retro_deinit()
log_cb
(
RETRO_LOG_INFO
,
"[%s]: Estimated FPS: %.5f
\n
"
,
MEDNAFEN_CORE_NAME
,
(
double
)
video_frames
*
44100
/
audio_frames
);
}
libretro_supports_bitmasks
=
false
;
}
unsigned
retro_get_region
(
void
)
...
...
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