mirror of
https://github.com/libretro/RetroArch
synced 2025-04-03 10:21:31 +00:00
(Input) Remove post_init and make it part of input_init
This commit is contained in:
parent
3f4366628d
commit
545911d4da
1
driver.h
1
driver.h
@ -206,7 +206,6 @@ typedef struct input_driver
|
|||||||
#ifdef RARCH_CONSOLE
|
#ifdef RARCH_CONSOLE
|
||||||
void (*set_default_keybind_lut)(unsigned device, unsigned port);
|
void (*set_default_keybind_lut)(unsigned device, unsigned port);
|
||||||
void (*set_analog_dpad_mapping)(unsigned device, unsigned map_dpad_enum, unsigned controller_id);
|
void (*set_analog_dpad_mapping)(unsigned device, unsigned map_dpad_enum, unsigned controller_id);
|
||||||
void (*post_init)(void);
|
|
||||||
unsigned max_pads;
|
unsigned max_pads;
|
||||||
#endif
|
#endif
|
||||||
const char *ident;
|
const char *ident;
|
||||||
|
@ -199,7 +199,6 @@ static void init_console_drivers(void)
|
|||||||
init_drivers_pre(); // Set driver.* function callbacks.
|
init_drivers_pre(); // Set driver.* function callbacks.
|
||||||
driver.video->start(); // Statically starts video driver. Sets driver.video_data.
|
driver.video->start(); // Statically starts video driver. Sets driver.video_data.
|
||||||
driver.input_data = driver.input->init();
|
driver.input_data = driver.input->init();
|
||||||
driver.input->post_init();
|
|
||||||
|
|
||||||
// Core handles audio.
|
// Core handles audio.
|
||||||
}
|
}
|
||||||
|
@ -242,19 +242,6 @@ static void gx_input_set_analog_dpad_mapping(unsigned device, unsigned map_dpad_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *gx_input_init(void)
|
|
||||||
{
|
|
||||||
PAD_Init();
|
|
||||||
#ifdef HW_RVL
|
|
||||||
WPAD_Init();
|
|
||||||
#endif
|
|
||||||
SYS_SetResetCallback(reset_callback);
|
|
||||||
#ifdef HW_RVL
|
|
||||||
SYS_SetPowerCallback(power_callback);
|
|
||||||
#endif
|
|
||||||
return (void*)-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gx_set_default_keybind_lut(unsigned device, unsigned port)
|
static void gx_set_default_keybind_lut(unsigned device, unsigned port)
|
||||||
{
|
{
|
||||||
(void)port;
|
(void)port;
|
||||||
@ -340,8 +327,17 @@ static void gx_set_default_keybind_lut(unsigned device, unsigned port)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gx_input_post_init(void)
|
static void *gx_input_init(void)
|
||||||
{
|
{
|
||||||
|
PAD_Init();
|
||||||
|
#ifdef HW_RVL
|
||||||
|
WPAD_Init();
|
||||||
|
#endif
|
||||||
|
SYS_SetResetCallback(reset_callback);
|
||||||
|
#ifdef HW_RVL
|
||||||
|
SYS_SetPowerCallback(power_callback);
|
||||||
|
#endif
|
||||||
|
|
||||||
for(unsigned i = 0; i < MAX_PLAYERS; i++)
|
for(unsigned i = 0; i < MAX_PLAYERS; i++)
|
||||||
{
|
{
|
||||||
gx_set_default_keybind_lut(0, i);
|
gx_set_default_keybind_lut(0, i);
|
||||||
@ -350,6 +346,8 @@ static void gx_input_post_init(void)
|
|||||||
|
|
||||||
for(unsigned i = 0; i < MAX_PADS; i++)
|
for(unsigned i = 0; i < MAX_PADS; i++)
|
||||||
gx_input_set_analog_dpad_mapping(g_settings.input.device[i], g_settings.input.dpad_emulation[i], i);
|
gx_input_set_analog_dpad_mapping(g_settings.input.device[i], g_settings.input.dpad_emulation[i], i);
|
||||||
|
|
||||||
|
return (void*)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gx_input_poll(void *data)
|
static void gx_input_poll(void *data)
|
||||||
@ -645,7 +643,6 @@ const input_driver_t input_gx = {
|
|||||||
.free = gx_input_free_input,
|
.free = gx_input_free_input,
|
||||||
.set_default_keybind_lut = gx_set_default_keybind_lut,
|
.set_default_keybind_lut = gx_set_default_keybind_lut,
|
||||||
.set_analog_dpad_mapping = gx_input_set_analog_dpad_mapping,
|
.set_analog_dpad_mapping = gx_input_set_analog_dpad_mapping,
|
||||||
.post_init = gx_input_post_init,
|
|
||||||
.max_pads = MAX_PADS,
|
.max_pads = MAX_PADS,
|
||||||
.ident = "gx",
|
.ident = "gx",
|
||||||
};
|
};
|
||||||
|
@ -64,8 +64,6 @@ static void nullinput_set_analog_dpad_mapping(unsigned device, unsigned map_dpad
|
|||||||
(void)map_dpad_enum;
|
(void)map_dpad_enum;
|
||||||
(void)controller_id;
|
(void)controller_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nullinput_input_post_init(void) {}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const input_driver_t input_null = {
|
const input_driver_t input_null = {
|
||||||
@ -77,7 +75,6 @@ const input_driver_t input_null = {
|
|||||||
#ifdef RARCH_CONSOLE
|
#ifdef RARCH_CONSOLE
|
||||||
nullinput_set_default_keybind_lut,
|
nullinput_set_default_keybind_lut,
|
||||||
nullinput_set_analog_dpad_mapping,
|
nullinput_set_analog_dpad_mapping,
|
||||||
nullinput_input_post_init,
|
|
||||||
2,
|
2,
|
||||||
#endif
|
#endif
|
||||||
"null",
|
"null",
|
||||||
|
@ -427,15 +427,6 @@ static void ps3_input_free_input(void *data)
|
|||||||
//cellPadEnd();
|
//cellPadEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void* ps3_input_init(void)
|
|
||||||
{
|
|
||||||
cellPadInit(MAX_PADS);
|
|
||||||
#ifdef HAVE_MOUSE
|
|
||||||
cellMouseInit(MAX_MICE);
|
|
||||||
#endif
|
|
||||||
return (void*)-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ps3_set_default_keybind_lut(unsigned device, unsigned port)
|
static void ps3_set_default_keybind_lut(unsigned device, unsigned port)
|
||||||
{
|
{
|
||||||
(void)device;
|
(void)device;
|
||||||
@ -445,8 +436,13 @@ static void ps3_set_default_keybind_lut(unsigned device, unsigned port)
|
|||||||
g_settings.input.default_binds[i] = platform_keys[i].joykey;
|
g_settings.input.default_binds[i] = platform_keys[i].joykey;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ps3_input_post_init(void)
|
static void* ps3_input_init(void)
|
||||||
{
|
{
|
||||||
|
cellPadInit(MAX_PADS);
|
||||||
|
#ifdef HAVE_MOUSE
|
||||||
|
cellMouseInit(MAX_MICE);
|
||||||
|
#endif
|
||||||
|
|
||||||
for(unsigned i = 0; i < MAX_PLAYERS; i++)
|
for(unsigned i = 0; i < MAX_PLAYERS; i++)
|
||||||
{
|
{
|
||||||
ps3_set_default_keybind_lut(0, i);
|
ps3_set_default_keybind_lut(0, i);
|
||||||
@ -455,6 +451,8 @@ static void ps3_input_post_init(void)
|
|||||||
|
|
||||||
for (unsigned i = 0; i < MAX_PADS; i++)
|
for (unsigned i = 0; i < MAX_PADS; i++)
|
||||||
ps3_input_set_analog_dpad_mapping(0, g_settings.input.dpad_emulation[i], i);
|
ps3_input_set_analog_dpad_mapping(0, g_settings.input.dpad_emulation[i], i);
|
||||||
|
|
||||||
|
return (void*)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ps3_input_key_pressed(void *data, int key)
|
static bool ps3_input_key_pressed(void *data, int key)
|
||||||
@ -470,7 +468,6 @@ const input_driver_t input_ps3 = {
|
|||||||
.free = ps3_input_free_input,
|
.free = ps3_input_free_input,
|
||||||
.set_default_keybind_lut = ps3_set_default_keybind_lut,
|
.set_default_keybind_lut = ps3_set_default_keybind_lut,
|
||||||
.set_analog_dpad_mapping = ps3_input_set_analog_dpad_mapping,
|
.set_analog_dpad_mapping = ps3_input_set_analog_dpad_mapping,
|
||||||
.post_init = ps3_input_post_init,
|
|
||||||
.max_pads = MAX_PADS,
|
.max_pads = MAX_PADS,
|
||||||
.ident = "ps3",
|
.ident = "ps3",
|
||||||
};
|
};
|
||||||
|
@ -151,22 +151,25 @@ static void psp_free_input(void *data)
|
|||||||
(void)data;
|
(void)data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void psp_set_default_keybind_lut(unsigned device, unsigned port)
|
||||||
|
{
|
||||||
|
(void)device;
|
||||||
|
(void)port;
|
||||||
|
}
|
||||||
|
|
||||||
static void* psp_input_initialize(void)
|
static void* psp_input_initialize(void)
|
||||||
{
|
{
|
||||||
#ifdef PSP
|
#ifdef PSP
|
||||||
sceCtrlSetSamplingCycle(0);
|
sceCtrlSetSamplingCycle(0);
|
||||||
#endif
|
#endif
|
||||||
sceCtrlSetSamplingMode(DEFAULT_SAMPLING_MODE);
|
sceCtrlSetSamplingMode(DEFAULT_SAMPLING_MODE);
|
||||||
return (void*)-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void psp_input_post_init(void)
|
|
||||||
{
|
|
||||||
for(unsigned i = 0; i < MAX_PLAYERS; i++)
|
for(unsigned i = 0; i < MAX_PLAYERS; i++)
|
||||||
{
|
{
|
||||||
psp_set_default_keybind_lut(0, i);
|
psp_set_default_keybind_lut(0, i);
|
||||||
rarch_input_set_default_keybinds(i);
|
rarch_input_set_default_keybinds(i);
|
||||||
}
|
}
|
||||||
|
return (void*)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool psp_key_pressed(void *data, int key)
|
static bool psp_key_pressed(void *data, int key)
|
||||||
@ -183,12 +186,6 @@ static bool psp_key_pressed(void *data, int key)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void psp_set_default_keybind_lut(unsigned device, unsigned port)
|
|
||||||
{
|
|
||||||
(void)device;
|
|
||||||
(void)port;
|
|
||||||
}
|
|
||||||
|
|
||||||
const input_driver_t input_psp = {
|
const input_driver_t input_psp = {
|
||||||
.init = psp_input_initialize,
|
.init = psp_input_initialize,
|
||||||
.poll = psp_input_poll,
|
.poll = psp_input_poll,
|
||||||
@ -197,7 +194,6 @@ const input_driver_t input_psp = {
|
|||||||
.free = psp_free_input,
|
.free = psp_free_input,
|
||||||
.set_default_keybind_lut = psp_set_default_keybind_lut,
|
.set_default_keybind_lut = psp_set_default_keybind_lut,
|
||||||
.set_analog_dpad_mapping = psp_input_set_analog_dpad_mapping,
|
.set_analog_dpad_mapping = psp_input_set_analog_dpad_mapping,
|
||||||
.post_init = psp_input_post_init,
|
|
||||||
.max_pads = MAX_PADS,
|
.max_pads = MAX_PADS,
|
||||||
.ident = "psp",
|
.ident = "psp",
|
||||||
};
|
};
|
||||||
|
@ -329,11 +329,6 @@ static void *xdk_input_init(void)
|
|||||||
while(XGetDeviceEnumerationStatus() == XDEVICE_ENUMERATION_BUSY) {}
|
while(XGetDeviceEnumerationStatus() == XDEVICE_ENUMERATION_BUSY) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (void*)-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void xdk_input_post_init(void)
|
|
||||||
{
|
|
||||||
for(unsigned i = 0; i < MAX_PLAYERS; i++)
|
for(unsigned i = 0; i < MAX_PLAYERS; i++)
|
||||||
{
|
{
|
||||||
xdk_set_default_keybind_lut(0, i);
|
xdk_set_default_keybind_lut(0, i);
|
||||||
@ -342,6 +337,8 @@ static void xdk_input_post_init(void)
|
|||||||
|
|
||||||
for(unsigned i = 0; i < MAX_PADS; i++)
|
for(unsigned i = 0; i < MAX_PADS; i++)
|
||||||
xdk_input_set_analog_dpad_mapping(0, g_settings.input.dpad_emulation[i], i);
|
xdk_input_set_analog_dpad_mapping(0, g_settings.input.dpad_emulation[i], i);
|
||||||
|
|
||||||
|
return (void*)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool xdk_input_key_pressed(void *data, int key)
|
static bool xdk_input_key_pressed(void *data, int key)
|
||||||
@ -358,7 +355,6 @@ const input_driver_t input_xinput =
|
|||||||
xdk_input_free_input,
|
xdk_input_free_input,
|
||||||
xdk_set_default_keybind_lut,
|
xdk_set_default_keybind_lut,
|
||||||
xdk_input_set_analog_dpad_mapping,
|
xdk_input_set_analog_dpad_mapping,
|
||||||
xdk_input_post_init,
|
|
||||||
MAX_PADS,
|
MAX_PADS,
|
||||||
"xinput"
|
"xinput"
|
||||||
};
|
};
|
||||||
|
@ -82,16 +82,6 @@ static void xenon360_input_free_input(void *data)
|
|||||||
(void)data;
|
(void)data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void* xenon360_input_init(void)
|
|
||||||
{
|
|
||||||
return (void*)-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool xenon360_input_key_pressed(void *data, int key)
|
|
||||||
{
|
|
||||||
return (g_extern.lifecycle_state & (1ULL << key));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void xenon360_input_set_default_keybind_lut(unsigned device, unsigned port)
|
static void xenon360_input_set_default_keybind_lut(unsigned device, unsigned port)
|
||||||
{
|
{
|
||||||
(void)device;
|
(void)device;
|
||||||
@ -105,7 +95,7 @@ static void xenon360_input_set_analog_dpad_mapping(unsigned device, unsigned map
|
|||||||
(void)controller_id;
|
(void)controller_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xenon360_input_post_init(void)
|
static void* xenon360_input_init(void)
|
||||||
{
|
{
|
||||||
for(unsigned i = 0; i < MAX_PLAYERS; i++)
|
for(unsigned i = 0; i < MAX_PLAYERS; i++)
|
||||||
{
|
{
|
||||||
@ -115,8 +105,16 @@ static void xenon360_input_post_init(void)
|
|||||||
|
|
||||||
for(unsigned i = 0; i < MAX_PADS; i++)
|
for(unsigned i = 0; i < MAX_PADS; i++)
|
||||||
xenon360_input_set_analog_dpad_mapping(0, g_settings.input.dpad_emulation[i], i);
|
xenon360_input_set_analog_dpad_mapping(0, g_settings.input.dpad_emulation[i], i);
|
||||||
|
|
||||||
|
return (void*)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool xenon360_input_key_pressed(void *data, int key)
|
||||||
|
{
|
||||||
|
return (g_extern.lifecycle_state & (1ULL << key));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const input_driver_t input_xenon360 = {
|
const input_driver_t input_xenon360 = {
|
||||||
.init = xenon360_input_init,
|
.init = xenon360_input_init,
|
||||||
.poll = xenon360_input_poll,
|
.poll = xenon360_input_poll,
|
||||||
@ -125,7 +123,6 @@ const input_driver_t input_xenon360 = {
|
|||||||
.free = xenon360_input_free_input,
|
.free = xenon360_input_free_input,
|
||||||
.set_default_keybind_lut = xenon360_input_set_default_keybind_lut,
|
.set_default_keybind_lut = xenon360_input_set_default_keybind_lut,
|
||||||
.set_analog_dpad_mapping = xenon360_input_set_analog_dpad_mapping,
|
.set_analog_dpad_mapping = xenon360_input_set_analog_dpad_mapping,
|
||||||
.post_init = xenon360_input_post_init,
|
|
||||||
.max_pads = MAX_PADS,
|
.max_pads = MAX_PADS,
|
||||||
.ident = "xenon360",
|
.ident = "xenon360",
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user