mirror of
https://github.com/libretro/RetroArch
synced 2025-04-24 06:02:36 +00:00
Allows buttons with l_x_plus, etc, to act as analogs.
Matches up with regular input drivers which can map buttons to analogs as well if the analogs are not used.
This commit is contained in:
parent
35c485aab0
commit
a65db38baf
@ -13,10 +13,10 @@ overlay0_desc0_overlay = left.png
|
||||
overlay0_desc1_overlay = right.png
|
||||
overlay0_desc2_overlay = up.png
|
||||
overlay0_desc3_overlay = down.png
|
||||
overlay0_desc0 = "left,0.25,0.50,rect,0.125,0.125"
|
||||
overlay0_desc1 = "right,0.75,0.50,rect,0.125,0.125"
|
||||
overlay0_desc2 = "up,0.50,0.25,rect,0.125,0.125"
|
||||
overlay0_desc3 = "down,0.50,0.75,rect,0.125,0.125"
|
||||
overlay0_desc0 = "left|l_x_minus,0.25,0.50,rect,0.125,0.125"
|
||||
overlay0_desc1 = "right|l_x_plus,0.75,0.50,rect,0.125,0.125"
|
||||
overlay0_desc2 = "up|l_y_minus,0.50,0.25,rect,0.125,0.125"
|
||||
overlay0_desc3 = "down|l_y_plus,0.50,0.75,rect,0.125,0.125"
|
||||
|
||||
overlay0_desc4 = "nul,0.30,0.90,rect,0.28,0.08" # Paste an arbitrary image. Input associated with this is nul.
|
||||
overlay0_desc4_overlay = logo.png
|
||||
|
12
retroarch.c
12
retroarch.c
@ -550,6 +550,18 @@ static inline void input_poll_overlay(void)
|
||||
}
|
||||
}
|
||||
|
||||
// Map "analog" buttons to analog axes like regular input drivers do.
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
if (!driver.overlay_state.analog[j])
|
||||
{
|
||||
unsigned bind_plus = RARCH_ANALOG_LEFT_X_PLUS + 2 * j;
|
||||
unsigned bind_minus = bind_plus + 1;
|
||||
driver.overlay_state.analog[j] += (driver.overlay_state.buttons & (1ULL << bind_plus)) ? 0x7fff : 0;
|
||||
driver.overlay_state.analog[j] -= (driver.overlay_state.buttons & (1ULL << bind_minus)) ? 0x7fff : 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (polled)
|
||||
input_overlay_post_poll(driver.overlay);
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user