diff --git a/360/xenon360_input.c b/360/xenon360_input.c index db1fd5787f..be1c1e345c 100644 --- a/360/xenon360_input.c +++ b/360/xenon360_input.c @@ -35,7 +35,7 @@ static void xenon360_input_poll(void *data) } } -static int16_t xenon360_input_state(void *data, const struct snes_keybind **binds, +static int16_t xenon360_input_state(void *data, const struct retro_keybind **binds, bool port, unsigned device, unsigned index, unsigned id) { diff --git a/autosave.c b/autosave.c index ec91362a03..4711d8029a 100644 --- a/autosave.c +++ b/autosave.c @@ -31,7 +31,7 @@ struct autosave sthread_t *thread; void *buffer; - const void *snes_buffer; + const void *retro_buffer; const char *path; size_t bufsize; unsigned interval; @@ -46,9 +46,9 @@ static void autosave_thread(void *data) while (!save->quit) { autosave_lock(save); - bool differ = memcmp(save->buffer, save->snes_buffer, save->bufsize) != 0; + bool differ = memcmp(save->buffer, save->retro_buffer, save->bufsize) != 0; if (differ) - memcpy(save->buffer, save->snes_buffer, save->bufsize); + memcpy(save->buffer, save->retro_buffer, save->bufsize); autosave_unlock(save); if (differ) @@ -92,14 +92,14 @@ autosave_t *autosave_new(const char *path, const void *data, size_t size, unsign handle->interval = interval; handle->path = path; handle->buffer = malloc(size); - handle->snes_buffer = data; + handle->retro_buffer = data; if (!handle->buffer) { free(handle); return NULL; } - memcpy(handle->buffer, handle->snes_buffer, handle->bufsize); + memcpy(handle->buffer, handle->retro_buffer, handle->bufsize); handle->lock = slock_new(); handle->cond_lock = slock_new(); diff --git a/config.def.h b/config.def.h index e5ffdffac5..4f69ebf9df 100644 --- a/config.def.h +++ b/config.def.h @@ -310,7 +310,7 @@ static const float axis_threshold = 0.5; // SDL sometimes reverses the axes for some odd reason, but hey. :D // Player 1 -static const struct snes_keybind snes_keybinds_1[] = { +static const struct retro_keybind retro_keybinds_1[] = { // SNES button | keyboard key | js btn | js axis | { true, RETRO_DEVICE_ID_JOYPAD_B, SK_z, NO_BTN, AXIS_NONE }, { true, RETRO_DEVICE_ID_JOYPAD_Y, SK_a, NO_BTN, AXIS_NONE }, @@ -366,7 +366,7 @@ static const struct snes_keybind snes_keybinds_1[] = { }; // Player 2-5 -static const struct snes_keybind snes_keybinds_rest[] = { +static const struct retro_keybind retro_keybinds_rest[] = { { true, RETRO_DEVICE_ID_JOYPAD_B, SK_UNKNOWN, NO_BTN, AXIS_NONE }, { true, RETRO_DEVICE_ID_JOYPAD_Y, SK_UNKNOWN, NO_BTN, AXIS_NONE }, { true, RETRO_DEVICE_ID_JOYPAD_SELECT, SK_UNKNOWN, NO_BTN, AXIS_NONE }, diff --git a/driver.h b/driver.h index b1375541ed..d5b2630114 100644 --- a/driver.h +++ b/driver.h @@ -92,7 +92,7 @@ enum // RetroArch specific bind IDs. RARCH_BIND_LIST_END_NULL }; -struct snes_keybind +struct retro_keybind { bool valid; int id; @@ -156,7 +156,7 @@ typedef struct input_driver { void *(*init)(void); void (*poll)(void *data); - int16_t (*input_state)(void *data, const struct snes_keybind **snes_keybinds, unsigned port, unsigned device, unsigned index, unsigned id); + int16_t (*input_state)(void *data, const struct retro_keybind **retro_keybinds, unsigned port, unsigned device, unsigned index, unsigned id); bool (*key_pressed)(void *data, int key); void (*free)(void *data); const char *ident; @@ -282,8 +282,8 @@ extern const input_driver_t input_null; #define input_init_func() driver.input->init() #define input_poll_func() driver.input->poll(driver.input_data) -#define input_input_state_func(snes_keybinds, port, device, index, id) \ - driver.input->input_state(driver.input_data, snes_keybinds, port, device, index, id) +#define input_input_state_func(retro_keybinds, port, device, index, id) \ + driver.input->input_state(driver.input_data, retro_keybinds, port, device, index, id) #define input_free_func() driver.input->free(driver.input_data) static inline bool input_key_pressed_func(int key) diff --git a/general.h b/general.h index 64247fa4ec..1ece494b95 100644 --- a/general.h +++ b/general.h @@ -154,7 +154,7 @@ struct settings struct { char driver[32]; - struct snes_keybind binds[MAX_PLAYERS][RARCH_BIND_LIST_END]; + struct retro_keybind binds[MAX_PLAYERS][RARCH_BIND_LIST_END]; float axis_threshold; int joypad_map[MAX_PLAYERS]; #ifdef RARCH_CONSOLE diff --git a/gfx/ext_gfx.c b/gfx/ext_gfx.c index 5535cf4238..b3edeea887 100644 --- a/gfx/ext_gfx.c +++ b/gfx/ext_gfx.c @@ -57,7 +57,7 @@ static void input_ext_poll(void *data) ext->driver->poll(ext->handle); } -static int16_t input_ext_input_state(void *data, const struct snes_keybind **snes_keybinds, unsigned port, unsigned device, unsigned index, unsigned id) +static int16_t input_ext_input_state(void *data, const struct retro_keybind **retro_keybinds, unsigned port, unsigned device, unsigned index, unsigned id) { input_ext_t *ext = (input_ext_t*)data; @@ -65,7 +65,7 @@ static int16_t input_ext_input_state(void *data, const struct snes_keybind **sne if (id < RARCH_BIND_LIST_END) { - const struct snes_keybind *rarch_bind = &snes_keybinds[player - 1][id]; + const struct retro_keybind *rarch_bind = &retro_keybinds[player - 1][id]; if (!rarch_bind->valid) return 0; @@ -86,7 +86,7 @@ static bool input_ext_key_pressed(void *data, int key) if (key >= 0 && key < RARCH_BIND_LIST_END) { - const struct snes_keybind *rarch_bind = &g_settings.input.binds[0][key]; + const struct retro_keybind *rarch_bind = &g_settings.input.binds[0][key]; if (!rarch_bind->valid) return false; diff --git a/gfx/py_state/py_state.c b/gfx/py_state/py_state.c index 15f982d519..9c58638222 100644 --- a/gfx/py_state/py_state.c +++ b/gfx/py_state/py_state.c @@ -68,7 +68,7 @@ static PyObject *py_read_input(PyObject *self, PyObject *args) if (player > MAX_PLAYERS || player < 1 || key >= RARCH_FIRST_META_KEY) return NULL; - static const struct snes_keybind *binds[MAX_PLAYERS] = { + static const struct retro_keybind *binds[MAX_PLAYERS] = { g_settings.input.binds[0], g_settings.input.binds[1], g_settings.input.binds[2], diff --git a/gfx/state_tracker.c b/gfx/state_tracker.c index ed05c0f025..c9927a858b 100644 --- a/gfx/state_tracker.c +++ b/gfx/state_tracker.c @@ -228,7 +228,7 @@ static void update_input(state_tracker_t *tracker) }; // Only bind for up to two players for now. - static const struct snes_keybind *binds[2] = { + static const struct retro_keybind *binds[2] = { g_settings.input.binds[0], g_settings.input.binds[1], }; diff --git a/input/dinput.c b/input/dinput.c index 1dcf42078f..756a60bf9a 100644 --- a/input/dinput.c +++ b/input/dinput.c @@ -190,7 +190,7 @@ static bool dinput_joykey_pressed(sdl_dinput_t *di, unsigned port_num, uint16_t return false; } -int16_t sdl_dinput_axis(sdl_dinput_t *di, unsigned port_num, const struct snes_keybind *key) +int16_t sdl_dinput_axis(sdl_dinput_t *di, unsigned port_num, const struct retro_keybind *key) { uint32_t joyaxis = key->joyaxis; @@ -235,7 +235,7 @@ int16_t sdl_dinput_axis(sdl_dinput_t *di, unsigned port_num, const struct snes_k return val; } -static bool dinput_joyaxis_pressed(sdl_dinput_t *di, unsigned port_num, const struct snes_keybind *key) +static bool dinput_joyaxis_pressed(sdl_dinput_t *di, unsigned port_num, const struct retro_keybind *key) { if (key->joyaxis == AXIS_NONE) return false; @@ -246,7 +246,7 @@ static bool dinput_joyaxis_pressed(sdl_dinput_t *di, unsigned port_num, const st return abs(val) > min; } -bool sdl_dinput_pressed(sdl_dinput_t *di, unsigned port_num, const struct snes_keybind *key) +bool sdl_dinput_pressed(sdl_dinput_t *di, unsigned port_num, const struct retro_keybind *key) { if (di->joypad[port_num] == NULL) return false; diff --git a/input/linuxraw_input.c b/input/linuxraw_input.c index 42624671f9..eb65791b2f 100644 --- a/input/linuxraw_input.c +++ b/input/linuxraw_input.c @@ -231,11 +231,11 @@ static bool linuxraw_key_pressed(linuxraw_input_t *linuxraw, int key) return linuxraw->state[keysym_lut[key]]; } -static bool linuxraw_is_pressed(linuxraw_input_t *linuxraw, const struct snes_keybind *binds, unsigned id) +static bool linuxraw_is_pressed(linuxraw_input_t *linuxraw, const struct retro_keybind *binds, unsigned id) { if (id < RARCH_BIND_LIST_END) { - const struct snes_keybind *bind = &binds[id]; + const struct retro_keybind *bind = &binds[id]; return bind->valid && linuxraw_key_pressed(linuxraw, binds[id].key); } else @@ -249,7 +249,7 @@ static bool linuxraw_bind_button_pressed(void *data, int key) input_sdl.key_pressed(linuxraw->sdl, key); } -static int16_t linuxraw_input_state(void *data, const struct snes_keybind **binds, unsigned port, unsigned device, unsigned index, unsigned id) +static int16_t linuxraw_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned index, unsigned id) { linuxraw_input_t *linuxraw = (linuxraw_input_t*)data; diff --git a/input/null.c b/input/null.c index 48ae092d88..a861b63d4b 100644 --- a/input/null.c +++ b/input/null.c @@ -26,10 +26,10 @@ static void null_input_poll(void *data) (void)data; } -static int16_t null_input_state(void *data, const struct snes_keybind **snes_keybinds, unsigned port, unsigned device, unsigned index, unsigned id) +static int16_t null_input_state(void *data, const struct retro_keybind **retro_keybinds, unsigned port, unsigned device, unsigned index, unsigned id) { (void)data; - (void)snes_keybinds; + (void)retro_keybinds; (void)port; (void)device; (void)index; diff --git a/input/rarch_dinput.h b/input/rarch_dinput.h index 9bfc8be479..8fec0fc210 100644 --- a/input/rarch_dinput.h +++ b/input/rarch_dinput.h @@ -38,10 +38,10 @@ sdl_dinput_t *sdl_dinput_init(void); void sdl_dinput_free(sdl_dinput_t *di); bool sdl_dinput_pressed(sdl_dinput_t *di, unsigned port_num, - const struct snes_keybind *key); + const struct retro_keybind *key); int16_t sdl_dinput_axis(sdl_dinput_t *di, unsigned port_num, - const struct snes_keybind *key); + const struct retro_keybind *key); void sdl_dinput_poll(sdl_dinput_t *di); diff --git a/input/sdl_input.c b/input/sdl_input.c index 6260ebbf8d..686f2db0db 100644 --- a/input/sdl_input.c +++ b/input/sdl_input.c @@ -258,7 +258,7 @@ static bool sdl_axis_pressed(sdl_input_t *sdl, unsigned port_num, uint32_t joyax } #endif -static bool sdl_is_pressed(sdl_input_t *sdl, unsigned port_num, const struct snes_keybind *key) +static bool sdl_is_pressed(sdl_input_t *sdl, unsigned port_num, const struct retro_keybind *key) { if (sdl->use_keyboard && sdl_key_pressed(key->key)) return true; @@ -279,23 +279,23 @@ static bool sdl_is_pressed(sdl_input_t *sdl, unsigned port_num, const struct sne static bool sdl_bind_button_pressed(void *data, int key) { - const struct snes_keybind *binds = g_settings.input.binds[0]; + const struct retro_keybind *binds = g_settings.input.binds[0]; if (key >= 0 && key < RARCH_BIND_LIST_END) { - const struct snes_keybind *bind = &binds[key]; + const struct retro_keybind *bind = &binds[key]; return sdl_is_pressed((sdl_input_t*)data, 0, bind); } else return false; } -static int16_t sdl_joypad_device_state(sdl_input_t *sdl, const struct snes_keybind **binds_, +static int16_t sdl_joypad_device_state(sdl_input_t *sdl, const struct retro_keybind **binds_, unsigned port_num, unsigned id) { - const struct snes_keybind *binds = binds_[port_num]; + const struct retro_keybind *binds = binds_[port_num]; if (id < RARCH_BIND_LIST_END) { - const struct snes_keybind *bind = &binds[id]; + const struct retro_keybind *bind = &binds[id]; return bind->valid ? (sdl_is_pressed(sdl, port_num, bind) ? 1 : 0) : 0; } else @@ -329,10 +329,10 @@ static void conv_analog_id_to_bind_id(unsigned index, unsigned id, } } -static int16_t sdl_analog_device_state(sdl_input_t *sdl, const struct snes_keybind **binds_, +static int16_t sdl_analog_device_state(sdl_input_t *sdl, const struct retro_keybind **binds_, unsigned port_num, unsigned index, unsigned id) { - const struct snes_keybind *binds = binds_[port_num]; + const struct retro_keybind *binds = binds_[port_num]; if (id >= RARCH_BIND_LIST_END) return 0; @@ -340,8 +340,8 @@ static int16_t sdl_analog_device_state(sdl_input_t *sdl, const struct snes_keybi unsigned id_plus = 0; conv_analog_id_to_bind_id(index, id, &id_minus, &id_plus); - const struct snes_keybind *bind_minus = &binds[id_minus]; - const struct snes_keybind *bind_plus = &binds[id_plus]; + const struct retro_keybind *bind_minus = &binds[id_minus]; + const struct retro_keybind *bind_plus = &binds[id_plus]; if (!bind_minus->valid || !bind_plus->valid) return 0; @@ -405,7 +405,7 @@ static int16_t sdl_lightgun_device_state(sdl_input_t *sdl, unsigned id) } } -static int16_t sdl_input_state(void *data_, const struct snes_keybind **binds, unsigned port, unsigned device, unsigned index, unsigned id) +static int16_t sdl_input_state(void *data_, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned index, unsigned id) { sdl_input_t *data = (sdl_input_t*)data_; switch (device) diff --git a/input/x11_input.c b/input/x11_input.c index 2bdf173335..2aeb8a5bb8 100644 --- a/input/x11_input.c +++ b/input/x11_input.c @@ -169,11 +169,11 @@ static bool x_key_pressed(x11_input_t *x11, int key) return ret; } -static bool x_is_pressed(x11_input_t *x11, const struct snes_keybind *binds, unsigned id) +static bool x_is_pressed(x11_input_t *x11, const struct retro_keybind *binds, unsigned id) { if (id < RARCH_BIND_LIST_END) { - const struct snes_keybind *bind = &binds[id]; + const struct retro_keybind *bind = &binds[id]; return bind->valid && x_key_pressed(x11, binds[id].key); } else @@ -187,7 +187,7 @@ static bool x_bind_button_pressed(void *data, int key) input_sdl.key_pressed(x11->sdl, key); } -static int16_t x_input_state(void *data, const struct snes_keybind **binds, unsigned port, unsigned device, unsigned index, unsigned id) +static int16_t x_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned index, unsigned id) { x11_input_t *x11 = (x11_input_t*)data; diff --git a/input/xinput2_input.c b/input/xinput2_input.c index 97dee91342..c6ebd74185 100644 --- a/input/xinput2_input.c +++ b/input/xinput2_input.c @@ -54,7 +54,7 @@ static void xinput2_input_poll(void *data) } } -static int16_t xinput2_input_state(void *data, const struct snes_keybind **binds, +static int16_t xinput2_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned index, unsigned id) { diff --git a/netplay.h b/netplay.h index 4da0a58064..c1693a05a5 100644 --- a/netplay.h +++ b/netplay.h @@ -53,9 +53,9 @@ void netplay_free(netplay_t *handle); // On regular netplay, flip who controls player 1 and 2. void netplay_flip_players(netplay_t *handle); -// Call this before running snes_run() +// Call this before running retro_run() void netplay_pre_frame(netplay_t *handle); -// Call this after running snes_run() +// Call this after running retro_run() void netplay_post_frame(netplay_t *handle); #endif diff --git a/ps3/ps3_input.c b/ps3/ps3_input.c index d08b650b72..b45755d667 100644 --- a/ps3/ps3_input.c +++ b/ps3/ps3_input.c @@ -174,7 +174,7 @@ static int16_t ps3_mouse_device_state(void *data, unsigned player, unsigned id) #endif -static int16_t ps3_input_state(void *data, const struct snes_keybind **binds, +static int16_t ps3_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned index, unsigned id) { diff --git a/retroarch.c b/retroarch.c index 624830090c..57ae1d50d0 100644 --- a/retroarch.c +++ b/retroarch.c @@ -449,7 +449,7 @@ static int16_t input_state(unsigned port, unsigned device, unsigned index, unsig } #endif - static const struct snes_keybind *binds[MAX_PLAYERS] = { + static const struct retro_keybind *binds[MAX_PLAYERS] = { g_settings.input.binds[0], g_settings.input.binds[1], g_settings.input.binds[2], diff --git a/settings.c b/settings.c index f78eb4fb7f..89dc933e6f 100644 --- a/settings.c +++ b/settings.c @@ -203,11 +203,11 @@ void config_set_defaults(void) g_settings.network_cmd_enable = network_cmd_enable; g_settings.network_cmd_port = network_cmd_port; - rarch_assert(sizeof(g_settings.input.binds[0]) >= sizeof(snes_keybinds_1)); - rarch_assert(sizeof(g_settings.input.binds[1]) >= sizeof(snes_keybinds_rest)); - memcpy(g_settings.input.binds[0], snes_keybinds_1, sizeof(snes_keybinds_1)); + rarch_assert(sizeof(g_settings.input.binds[0]) >= sizeof(retro_keybinds_1)); + rarch_assert(sizeof(g_settings.input.binds[1]) >= sizeof(retro_keybinds_rest)); + memcpy(g_settings.input.binds[0], retro_keybinds_1, sizeof(retro_keybinds_1)); for (unsigned i = 1; i < MAX_PLAYERS; i++) - memcpy(g_settings.input.binds[i], snes_keybinds_rest, sizeof(snes_keybinds_rest)); + memcpy(g_settings.input.binds[i], retro_keybinds_rest, sizeof(retro_keybinds_rest)); // Verify that binds are in proper order. for (int i = 0; i < MAX_PLAYERS; i++) @@ -522,7 +522,7 @@ struct bind_map const char *key; const char *btn; const char *axis; - int snes_key; + int retro_key; }; #define DECLARE_BIND(x, bind) { true, "input_" #x, "input_" #x "_btn", "input_" #x "_axis", bind } @@ -671,9 +671,9 @@ static const struct key_map sk_map[] = { { "nul", SK_UNKNOWN }, }; -static struct snes_keybind *find_snes_bind(unsigned port, int id) +static struct retro_keybind *find_retro_bind(unsigned port, int id) { - struct snes_keybind *binds = g_settings.input.binds[port]; + struct retro_keybind *binds = g_settings.input.binds[port]; return binds[id].valid ? &binds[id] : NULL; } @@ -696,7 +696,7 @@ static int find_sk_key(const char *str) return find_sk_bind(str); } -static void read_keybinds_keyboard(config_file_t *conf, unsigned player, unsigned index, struct snes_keybind *bind) +static void read_keybinds_keyboard(config_file_t *conf, unsigned player, unsigned index, struct retro_keybind *bind) { char tmp[64]; @@ -710,7 +710,7 @@ static void read_keybinds_keyboard(config_file_t *conf, unsigned player, unsigne } } -static void parse_hat(struct snes_keybind *bind, const char *str) +static void parse_hat(struct retro_keybind *bind, const char *str) { if (!isdigit(*str)) return; @@ -738,7 +738,7 @@ static void parse_hat(struct snes_keybind *bind, const char *str) bind->joykey = HAT_MAP(hat, hat_dir); } -static void read_keybinds_button(config_file_t *conf, unsigned player, unsigned index, struct snes_keybind *bind) +static void read_keybinds_button(config_file_t *conf, unsigned player, unsigned index, struct retro_keybind *bind) { char tmp[64]; if (bind_maps[player][index].btn && @@ -757,7 +757,7 @@ static void read_keybinds_button(config_file_t *conf, unsigned player, unsigned } } -static void read_keybinds_axis(config_file_t *conf, unsigned player, unsigned index, struct snes_keybind *bind) +static void read_keybinds_axis(config_file_t *conf, unsigned player, unsigned index, struct retro_keybind *bind) { char tmp[64]; if (bind_maps[player][index].axis && @@ -781,7 +781,7 @@ static void read_keybinds_player(config_file_t *conf, unsigned player) { for (unsigned i = 0; bind_maps[player][i].valid; i++) { - struct snes_keybind *bind = find_snes_bind(player, bind_maps[player][i].snes_key); + struct retro_keybind *bind = find_retro_bind(player, bind_maps[player][i].retro_key); rarch_assert(bind); read_keybinds_keyboard(conf, player, i, bind); @@ -807,7 +807,7 @@ bool config_read_keybinds(const char *path) } static void save_keybind_key(config_file_t *conf, - const struct bind_map *map, const struct snes_keybind *bind) + const struct bind_map *map, const struct retro_keybind *bind) { char ascii[2] = {0}; const char *btn = ascii; @@ -831,7 +831,7 @@ static void save_keybind_key(config_file_t *conf, #ifndef RARCH_CONSOLE static void save_keybind_hat(config_file_t *conf, - const struct bind_map *map, const struct snes_keybind *bind) + const struct bind_map *map, const struct retro_keybind *bind) { unsigned hat = GET_HAT(bind->joykey); const char *dir = NULL; @@ -865,7 +865,7 @@ static void save_keybind_hat(config_file_t *conf, #endif static void save_keybind_joykey(config_file_t *conf, - const struct bind_map *map, const struct snes_keybind *bind) + const struct bind_map *map, const struct retro_keybind *bind) { if (bind->joykey == NO_BTN) config_set_string(conf, map->btn, "nul"); @@ -878,7 +878,7 @@ static void save_keybind_joykey(config_file_t *conf, } static void save_keybind_axis(config_file_t *conf, - const struct bind_map *map, const struct snes_keybind *bind) + const struct bind_map *map, const struct retro_keybind *bind) { unsigned axis = 0; char dir = '\0'; @@ -902,7 +902,7 @@ static void save_keybind_axis(config_file_t *conf, } static void save_keybind(config_file_t *conf, - const struct bind_map *map, const struct snes_keybind *bind) + const struct bind_map *map, const struct retro_keybind *bind) { if (!map->valid) return; diff --git a/wii/input.c b/wii/input.c index 4ba47f8263..3cf83e151a 100644 --- a/wii/input.c +++ b/wii/input.c @@ -32,7 +32,7 @@ static bool wpad_state[5][RARCH_FIRST_META_KEY]; /* Wii Classic pads */ static bool g_quit; -static int16_t wii_input_state(void *data, const struct snes_keybind **binds, +static int16_t wii_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned index, unsigned id) {