diff --git a/audio/audio_defines.h b/audio/audio_defines.h index 04d28866ec..450b8cf3cf 100644 --- a/audio/audio_defines.h +++ b/audio/audio_defines.h @@ -83,6 +83,17 @@ enum audio_mixer_state AUDIO_STREAM_STATE_PLAYING_SEQUENTIAL }; +enum audio_driver_state_flags +{ + AUDIO_FLAG_ACTIVE = (1 << 0), + AUDIO_FLAG_USE_FLOAT = (1 << 1), + AUDIO_FLAG_SUSPENDED = (1 << 2), + AUDIO_FLAG_MIXER_ACTIVE = (1 << 3), + AUDIO_FLAG_HARD_DISABLE = (1 << 4), + AUDIO_FLAG_CONTROL = (1 << 5) +}; + + typedef struct audio_statistics { unsigned samples; diff --git a/audio/audio_driver.h b/audio/audio_driver.h index f01888d9ad..d09e4ce2a7 100644 --- a/audio/audio_driver.h +++ b/audio/audio_driver.h @@ -158,16 +158,6 @@ typedef struct audio_driver size_t (*buffer_size)(void *data); } audio_driver_t; -enum audio_driver_state_flags -{ - AUDIO_FLAG_ACTIVE = (1 << 0), - AUDIO_FLAG_USE_FLOAT = (1 << 1), - AUDIO_FLAG_SUSPENDED = (1 << 2), - AUDIO_FLAG_MIXER_ACTIVE = (1 << 3), - AUDIO_FLAG_HARD_DISABLE = (1 << 4), - AUDIO_FLAG_CONTROL = (1 << 5) -}; - typedef struct { double source_ratio_original; @@ -306,44 +296,6 @@ bool audio_driver_stop(void); bool audio_driver_is_ai_service_speech_running(void); #endif -extern audio_driver_t audio_rsound; -extern audio_driver_t audio_audioio; -extern audio_driver_t audio_oss; -extern audio_driver_t audio_alsa; -extern audio_driver_t audio_alsathread; -extern audio_driver_t audio_tinyalsa; -extern audio_driver_t audio_roar; -extern audio_driver_t audio_openal; -extern audio_driver_t audio_opensl; -extern audio_driver_t audio_jack; -extern audio_driver_t audio_sdl; -extern audio_driver_t audio_xa; -extern audio_driver_t audio_pulse; -extern audio_driver_t audio_dsound; -extern audio_driver_t audio_wasapi; -extern audio_driver_t audio_coreaudio; -extern audio_driver_t audio_coreaudio3; -extern audio_driver_t audio_xenon360; -extern audio_driver_t audio_ps3; -extern audio_driver_t audio_gx; -extern audio_driver_t audio_ax; -extern audio_driver_t audio_psp; -extern audio_driver_t audio_ps2; -extern audio_driver_t audio_ctr_csnd; -extern audio_driver_t audio_ctr_dsp; -#ifdef HAVE_THREADS -extern audio_driver_t audio_ctr_dsp_thread; -#endif -extern audio_driver_t audio_switch; -extern audio_driver_t audio_switch_thread; -extern audio_driver_t audio_switch_libnx_audren; -extern audio_driver_t audio_switch_libnx_audren_thread; -extern audio_driver_t audio_rwebaudio; - -audio_driver_state_t *audio_state_get_ptr(void); - -extern audio_driver_t *audio_drivers[]; - /** * audio_compute_buffer_statistics: * @@ -422,6 +374,44 @@ size_t audio_driver_sample_batch_rewind( void audio_driver_menu_sample(void); #endif +extern audio_driver_t audio_rsound; +extern audio_driver_t audio_audioio; +extern audio_driver_t audio_oss; +extern audio_driver_t audio_alsa; +extern audio_driver_t audio_alsathread; +extern audio_driver_t audio_tinyalsa; +extern audio_driver_t audio_roar; +extern audio_driver_t audio_openal; +extern audio_driver_t audio_opensl; +extern audio_driver_t audio_jack; +extern audio_driver_t audio_sdl; +extern audio_driver_t audio_xa; +extern audio_driver_t audio_pulse; +extern audio_driver_t audio_dsound; +extern audio_driver_t audio_wasapi; +extern audio_driver_t audio_coreaudio; +extern audio_driver_t audio_coreaudio3; +extern audio_driver_t audio_xenon360; +extern audio_driver_t audio_ps3; +extern audio_driver_t audio_gx; +extern audio_driver_t audio_ax; +extern audio_driver_t audio_psp; +extern audio_driver_t audio_ps2; +extern audio_driver_t audio_ctr_csnd; +extern audio_driver_t audio_ctr_dsp; +#ifdef HAVE_THREADS +extern audio_driver_t audio_ctr_dsp_thread; +#endif +extern audio_driver_t audio_switch; +extern audio_driver_t audio_switch_thread; +extern audio_driver_t audio_switch_libnx_audren; +extern audio_driver_t audio_switch_libnx_audren_thread; +extern audio_driver_t audio_rwebaudio; + +audio_driver_state_t *audio_state_get_ptr(void); + +extern audio_driver_t *audio_drivers[]; + RETRO_END_DECLS #endif /* __AUDIO_DRIVER__H */ diff --git a/command.h b/command.h index ad3ac3e12e..dd2b6ada4d 100644 --- a/command.h +++ b/command.h @@ -34,38 +34,10 @@ #include "configuration.h" -RETRO_BEGIN_DECLS - #define MAX_CMD_DRIVERS 3 #define DEFAULT_NETWORK_CMD_PORT 55355 -struct cmd_map -{ - const char *str; - unsigned id; -}; - -struct command_handler; - -typedef void (*command_poller_t)(struct command_handler *cmd); -typedef void (*command_replier_t)(struct command_handler *cmd, const char * data, size_t len); -typedef void (*command_destructor_t)(struct command_handler *cmd); - -struct command_handler -{ - /* Interface to poll the driver */ - command_poller_t poll; - /* Interface to reply */ - command_replier_t replier; - /* Interface to delete the underlying command */ - command_destructor_t destroy; - /* Underlying command storage */ - void *userptr; - /* State received */ - bool state[RARCH_BIND_LIST_END]; -}; - -typedef struct command_handler command_t; +RETRO_BEGIN_DECLS enum event_command { @@ -291,12 +263,6 @@ enum event_command CMD_EVENT_SEND_DEBUG_INFO }; -typedef struct command_handle -{ - command_t *handle; - unsigned id; -} command_handle_t; - enum cmd_source_t { CMD_NONE = 0, @@ -304,6 +270,40 @@ enum cmd_source_t CMD_NETWORK }; +struct cmd_map +{ + const char *str; + unsigned id; +}; + +struct command_handler; + +typedef void (*command_poller_t)(struct command_handler *cmd); +typedef void (*command_replier_t)(struct command_handler *cmd, const char * data, size_t len); +typedef void (*command_destructor_t)(struct command_handler *cmd); + +struct command_handler +{ + /* Interface to poll the driver */ + command_poller_t poll; + /* Interface to reply */ + command_replier_t replier; + /* Interface to delete the underlying command */ + command_destructor_t destroy; + /* Underlying command storage */ + void *userptr; + /* State received */ + bool state[RARCH_BIND_LIST_END]; +}; + +typedef struct command_handler command_t; + +typedef struct command_handle +{ + command_t *handle; + unsigned id; +} command_handle_t; + struct rarch_state; /** diff --git a/configuration.h b/configuration.h index 78f8903d64..630f0938b6 100644 --- a/configuration.h +++ b/configuration.h @@ -68,6 +68,8 @@ strlcpy(var, newvar, sizeof(var)); \ } +RETRO_BEGIN_DECLS + enum crt_switch_type { CRT_SWITCH_NONE = 0, @@ -85,8 +87,6 @@ enum override_type OVERRIDE_GAME }; -RETRO_BEGIN_DECLS - typedef struct settings { struct diff --git a/dynamic.h b/dynamic.h index 0a9c455a11..79ed70ab16 100644 --- a/dynamic.h +++ b/dynamic.h @@ -26,35 +26,6 @@ RETRO_BEGIN_DECLS -/** - * libretro_free_system_info: - * @info : Pointer to system info information. - * - * Frees system information. - **/ -void libretro_free_system_info(struct retro_system_info *info); - -const struct retro_subsystem_info *libretro_find_subsystem_info( - const struct retro_subsystem_info *info, - unsigned num_info, const char *ident); - -/** - * libretro_find_controller_description: - * @info : Pointer to controller info handle. - * @id : Identifier of controller to search - * for. - * - * Search for a controller of type @id in @info. - * - * Leaf function. - * - * @return controller description of found controller on success, - * otherwise NULL. - **/ -const struct retro_controller_description * - libretro_find_controller_description( - const struct retro_controller_info *info, unsigned id); - enum retro_core_flags { RETRO_CORE_FLAG_INITED = (1 << 0), @@ -99,6 +70,36 @@ struct retro_core_t uint8_t flags; }; + +/** + * libretro_free_system_info: + * @info : Pointer to system info information. + * + * Frees system information. + **/ +void libretro_free_system_info(struct retro_system_info *info); + +const struct retro_subsystem_info *libretro_find_subsystem_info( + const struct retro_subsystem_info *info, + unsigned num_info, const char *ident); + +/** + * libretro_find_controller_description: + * @info : Pointer to controller info handle. + * @id : Identifier of controller to search + * for. + * + * Search for a controller of type @id in @info. + * + * Leaf function. + * + * @return controller description of found controller on success, + * otherwise NULL. + **/ +const struct retro_controller_description * + libretro_find_controller_description( + const struct retro_controller_info *info, unsigned id); + RETRO_END_DECLS #endif diff --git a/input/input_defines.h b/input/input_defines.h index 75e6768215..bdd36fc37a 100644 --- a/input/input_defines.h +++ b/input/input_defines.h @@ -22,8 +22,6 @@ #include -RETRO_BEGIN_DECLS - #define MAX_USERS 16 #define MAX_INPUT_DEVICES 16 @@ -37,6 +35,56 @@ RETRO_BEGIN_DECLS #define RARCH_UNMAPPED 1024 +/* Specialized _MOUSE that targets the full screen regardless of viewport. + */ +#define RARCH_DEVICE_MOUSE_SCREEN (RETRO_DEVICE_MOUSE | 0x10000) + +/* Specialized _POINTER that targets the full screen regardless of viewport. + * Should not be used by a libretro implementation as coordinates returned + * make no sense. + * + * It is only used internally for overlays. */ +#define RARCH_DEVICE_POINTER_SCREEN (RETRO_DEVICE_POINTER | 0x10000) + +#define RARCH_DEVICE_ID_POINTER_BACK (RETRO_DEVICE_ID_POINTER_PRESSED | 0x10000) + +/* libretro has 16 buttons from 0-15 (libretro.h) + * Analog binds use RETRO_DEVICE_ANALOG, but we follow the same scheme + * internally in RetroArch for simplicity, so they are mapped into [16, 23]. + */ + +#define AXIS_NEG(x) (((uint32_t)(x) << 16) | 0xFFFFU) +#define AXIS_POS(x) ((uint32_t)(x) | 0xFFFF0000UL) +#define AXIS_NONE 0xFFFFFFFFUL +#define AXIS_DIR_NONE 0xFFFFU + +#define AXIS_NEG_GET(x) (((uint32_t)(x) >> 16) & 0xFFFFU) +#define AXIS_POS_GET(x) ((uint32_t)(x) & 0xFFFFU) + +#define NO_BTN 0xFFFFU + +#define HAT_UP_SHIFT 15 +#define HAT_DOWN_SHIFT 14 +#define HAT_LEFT_SHIFT 13 +#define HAT_RIGHT_SHIFT 12 +#define HAT_UP_MASK (1 << HAT_UP_SHIFT) +#define HAT_DOWN_MASK (1 << HAT_DOWN_SHIFT) +#define HAT_LEFT_MASK (1 << HAT_LEFT_SHIFT) +#define HAT_RIGHT_MASK (1 << HAT_RIGHT_SHIFT) +#define HAT_MAP(x, hat) ((x & ((1 << 12) - 1)) | hat) + +#define HAT_MASK (HAT_UP_MASK | HAT_DOWN_MASK | HAT_LEFT_MASK | HAT_RIGHT_MASK) +#define GET_HAT_DIR(x) (x & HAT_MASK) +#define GET_HAT(x) (x & (~HAT_MASK)) + +#ifdef HAVE_BSV_MOVIE +#define BSV_MOVIE_IS_PLAYBACK_ON() (input_st->bsv_movie_state_handle && (input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_PLAYBACK) && !(input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_END)) +#define BSV_MOVIE_IS_RECORDING() (input_st->bsv_movie_state_handle && (input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_RECORDING)) + +#endif + +RETRO_BEGIN_DECLS + /* RetroArch specific bind IDs. */ enum { @@ -196,54 +244,6 @@ enum input_turbo_default_button INPUT_TURBO_DEFAULT_BUTTON_LAST }; -/* Specialized _MOUSE that targets the full screen regardless of viewport. - */ -#define RARCH_DEVICE_MOUSE_SCREEN (RETRO_DEVICE_MOUSE | 0x10000) - -/* Specialized _POINTER that targets the full screen regardless of viewport. - * Should not be used by a libretro implementation as coordinates returned - * make no sense. - * - * It is only used internally for overlays. */ -#define RARCH_DEVICE_POINTER_SCREEN (RETRO_DEVICE_POINTER | 0x10000) - -#define RARCH_DEVICE_ID_POINTER_BACK (RETRO_DEVICE_ID_POINTER_PRESSED | 0x10000) - -/* libretro has 16 buttons from 0-15 (libretro.h) - * Analog binds use RETRO_DEVICE_ANALOG, but we follow the same scheme - * internally in RetroArch for simplicity, so they are mapped into [16, 23]. - */ - -#define AXIS_NEG(x) (((uint32_t)(x) << 16) | 0xFFFFU) -#define AXIS_POS(x) ((uint32_t)(x) | 0xFFFF0000UL) -#define AXIS_NONE 0xFFFFFFFFUL -#define AXIS_DIR_NONE 0xFFFFU - -#define AXIS_NEG_GET(x) (((uint32_t)(x) >> 16) & 0xFFFFU) -#define AXIS_POS_GET(x) ((uint32_t)(x) & 0xFFFFU) - -#define NO_BTN 0xFFFFU - -#define HAT_UP_SHIFT 15 -#define HAT_DOWN_SHIFT 14 -#define HAT_LEFT_SHIFT 13 -#define HAT_RIGHT_SHIFT 12 -#define HAT_UP_MASK (1 << HAT_UP_SHIFT) -#define HAT_DOWN_MASK (1 << HAT_DOWN_SHIFT) -#define HAT_LEFT_MASK (1 << HAT_LEFT_SHIFT) -#define HAT_RIGHT_MASK (1 << HAT_RIGHT_SHIFT) -#define HAT_MAP(x, hat) ((x & ((1 << 12) - 1)) | hat) - -#define HAT_MASK (HAT_UP_MASK | HAT_DOWN_MASK | HAT_LEFT_MASK | HAT_RIGHT_MASK) -#define GET_HAT_DIR(x) (x & HAT_MASK) -#define GET_HAT(x) (x & (~HAT_MASK)) - -#ifdef HAVE_BSV_MOVIE -#define BSV_MOVIE_IS_PLAYBACK_ON() (input_st->bsv_movie_state_handle && (input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_PLAYBACK) && !(input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_END)) -#define BSV_MOVIE_IS_RECORDING() (input_st->bsv_movie_state_handle && (input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_RECORDING)) - -#endif - RETRO_END_DECLS #endif diff --git a/input/input_driver.c b/input/input_driver.c index 57d2eb9c4e..2495db9577 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "input_driver.h" #include "input_keymaps.h" diff --git a/input/input_driver.h b/input/input_driver.h index b5e6b446f3..0ddb6e0b19 100644 --- a/input/input_driver.h +++ b/input/input_driver.h @@ -40,8 +40,10 @@ #include "input_osk.h" #include "../msg_hash.h" +#ifdef HAVE_HID #include "include/hid_types.h" #include "include/hid_driver.h" +#endif #include "include/gamepad.h" #include "../configuration.h" #include "../performance_counters.h" @@ -100,6 +102,40 @@ #define INHERIT_JOYAXIS(binds) (((binds)[x_plus].joyaxis == (binds)[x_minus].joyaxis) || ( (binds)[y_plus].joyaxis == (binds)[y_minus].joyaxis)) +#define REPLAY_TOKEN_INVALID '\0' +#define REPLAY_TOKEN_REGULAR_FRAME 'f' +#define REPLAY_TOKEN_CHECKPOINT_FRAME 'c' + +/** + * Takes as input analog key identifiers and converts them to corresponding + * bind IDs ident_minus and ident_plus. + * + * @param idx Analog key index (eg RETRO_DEVICE_INDEX_ANALOG_LEFT) + * @param ident Analog key identifier (eg RETRO_DEVICE_ID_ANALOG_X) + * @param ident_minus Bind ID minus, will be set by function. + * @param ident_plus Bind ID plus, will be set by function. + */ +#define input_conv_analog_id_to_bind_id(idx, ident, ident_minus, ident_plus) \ + switch ((idx << 1) | ident) \ + { \ + case (RETRO_DEVICE_INDEX_ANALOG_LEFT << 1) | RETRO_DEVICE_ID_ANALOG_X: \ + ident_minus = RARCH_ANALOG_LEFT_X_MINUS; \ + ident_plus = RARCH_ANALOG_LEFT_X_PLUS; \ + break; \ + case (RETRO_DEVICE_INDEX_ANALOG_LEFT << 1) | RETRO_DEVICE_ID_ANALOG_Y: \ + ident_minus = RARCH_ANALOG_LEFT_Y_MINUS; \ + ident_plus = RARCH_ANALOG_LEFT_Y_PLUS; \ + break; \ + case (RETRO_DEVICE_INDEX_ANALOG_RIGHT << 1) | RETRO_DEVICE_ID_ANALOG_X: \ + ident_minus = RARCH_ANALOG_RIGHT_X_MINUS; \ + ident_plus = RARCH_ANALOG_RIGHT_X_PLUS; \ + break; \ + case (RETRO_DEVICE_INDEX_ANALOG_RIGHT << 1) | RETRO_DEVICE_ID_ANALOG_Y: \ + ident_minus = RARCH_ANALOG_RIGHT_Y_MINUS; \ + ident_plus = RARCH_ANALOG_RIGHT_Y_PLUS; \ + break; \ + } + RETRO_BEGIN_DECLS enum rarch_movie_type @@ -108,6 +144,21 @@ enum rarch_movie_type RARCH_MOVIE_RECORD }; +enum input_driver_state_flags +{ + INP_FLAG_NONBLOCKING = (1 << 0), + INP_FLAG_KB_LINEFEED_ENABLE = (1 << 1), + INP_FLAG_KB_MAPPING_BLOCKED = (1 << 2), + INP_FLAG_BLOCK_HOTKEY = (1 << 3), + INP_FLAG_BLOCK_LIBRETRO_INPUT = (1 << 4), + INP_FLAG_BLOCK_POINTER_INPUT = (1 << 5), + INP_FLAG_GRAB_MOUSE_STATE = (1 << 6), + INP_FLAG_OLD_ANALOG_DPAD_MODE_SET = (1 << 7), + INP_FLAG_OLD_LIBRETRO_DEVICE_SET = (1 << 8), + INP_FLAG_REMAPPING_CACHE_ACTIVE = (1 << 9), + INP_FLAG_DEFERRED_WAIT_KEYS = (1 << 10) +}; + #ifdef HAVE_BSV_MOVIE enum bsv_flags { @@ -129,7 +180,8 @@ struct bsv_state }; /* These data are always little-endian. */ -struct bsv_key_data { +struct bsv_key_data +{ uint8_t down; uint16_t mod; uint8_t _padding; @@ -163,10 +215,6 @@ struct bsv_movie }; typedef struct bsv_movie bsv_movie_t; - -#define REPLAY_TOKEN_INVALID '\0' -#define REPLAY_TOKEN_REGULAR_FRAME 'f' -#define REPLAY_TOKEN_CHECKPOINT_FRAME 'c' #endif /** @@ -193,9 +241,6 @@ struct input_keyboard_line bool enabled; }; -extern retro_keybind_set input_config_binds[MAX_USERS]; -extern retro_keybind_set input_autoconf_binds[MAX_USERS]; - struct rarch_joypad_info { const struct retro_keybind *auto_binds; @@ -233,7 +278,6 @@ struct input_remote bool state[RARCH_BIND_LIST_END]; }; - typedef struct { char display_name[256]; @@ -441,21 +485,6 @@ struct input_keyboard_ctx_wait input_keyboard_press_t cb; }; -enum input_driver_state_flags -{ - INP_FLAG_NONBLOCKING = (1 << 0), - INP_FLAG_KB_LINEFEED_ENABLE = (1 << 1), - INP_FLAG_KB_MAPPING_BLOCKED = (1 << 2), - INP_FLAG_BLOCK_HOTKEY = (1 << 3), - INP_FLAG_BLOCK_LIBRETRO_INPUT = (1 << 4), - INP_FLAG_BLOCK_POINTER_INPUT = (1 << 5), - INP_FLAG_GRAB_MOUSE_STATE = (1 << 6), - INP_FLAG_OLD_ANALOG_DPAD_MODE_SET = (1 << 7), - INP_FLAG_OLD_LIBRETRO_DEVICE_SET = (1 << 8), - INP_FLAG_REMAPPING_CACHE_ACTIVE = (1 << 9), - INP_FLAG_DEFERRED_WAIT_KEYS = (1 << 10) -}; - typedef struct { /** @@ -633,36 +662,6 @@ const char* config_get_joypad_driver_options(void); const input_device_driver_t *input_joypad_init_driver( const char *ident, void *data); -/** - * Takes as input analog key identifiers and converts them to corresponding - * bind IDs ident_minus and ident_plus. - * - * @param idx Analog key index (eg RETRO_DEVICE_INDEX_ANALOG_LEFT) - * @param ident Analog key identifier (eg RETRO_DEVICE_ID_ANALOG_X) - * @param ident_minus Bind ID minus, will be set by function. - * @param ident_plus Bind ID plus, will be set by function. - */ -#define input_conv_analog_id_to_bind_id(idx, ident, ident_minus, ident_plus) \ - switch ((idx << 1) | ident) \ - { \ - case (RETRO_DEVICE_INDEX_ANALOG_LEFT << 1) | RETRO_DEVICE_ID_ANALOG_X: \ - ident_minus = RARCH_ANALOG_LEFT_X_MINUS; \ - ident_plus = RARCH_ANALOG_LEFT_X_PLUS; \ - break; \ - case (RETRO_DEVICE_INDEX_ANALOG_LEFT << 1) | RETRO_DEVICE_ID_ANALOG_Y: \ - ident_minus = RARCH_ANALOG_LEFT_Y_MINUS; \ - ident_plus = RARCH_ANALOG_LEFT_Y_PLUS; \ - break; \ - case (RETRO_DEVICE_INDEX_ANALOG_RIGHT << 1) | RETRO_DEVICE_ID_ANALOG_X: \ - ident_minus = RARCH_ANALOG_RIGHT_X_MINUS; \ - ident_plus = RARCH_ANALOG_RIGHT_X_PLUS; \ - break; \ - case (RETRO_DEVICE_INDEX_ANALOG_RIGHT << 1) | RETRO_DEVICE_ID_ANALOG_Y: \ - ident_minus = RARCH_ANALOG_RIGHT_Y_MINUS; \ - ident_plus = RARCH_ANALOG_RIGHT_Y_PLUS; \ - break; \ - } - /** * Registers a newly connected pad with RetroArch. * @@ -693,8 +692,6 @@ input_driver_state_t *input_state_get_ptr(void); /*************************************/ #ifdef HAVE_HID -#include "include/hid_driver.h" - /** * Get an enumerated list of all HID driver names * @@ -1129,6 +1126,9 @@ extern hid_driver_t wiiusb_hid; extern hid_driver_t wiiu_hid; #endif /* HAVE_HID */ +extern retro_keybind_set input_config_binds[MAX_USERS]; +extern retro_keybind_set input_autoconf_binds[MAX_USERS]; + RETRO_END_DECLS #endif /* __INPUT_DRIVER__H */ diff --git a/input/input_keymaps.h b/input/input_keymaps.h index 89fbcbe9d1..3a8cbe3674 100644 --- a/input/input_keymaps.h +++ b/input/input_keymaps.h @@ -66,7 +66,8 @@ extern const struct rarch_key_map rarch_key_map_ps4[]; #endif #if defined(_WIN32) && _WIN32_WINNT >= 0x0501 && !defined(__WINRT__) -enum winraw_scancodes { +enum winraw_scancodes +{ SC_ESCAPE = 0x01, SC_1 = 0x02, SC_2 = 0x03, diff --git a/input/input_overlay.h b/input/input_overlay.h index 7c29292ba6..b337c6e0d4 100644 --- a/input/input_overlay.h +++ b/input/input_overlay.h @@ -36,29 +36,6 @@ RETRO_BEGIN_DECLS -/* Overlay driver acts as a medium between input drivers - * and video driver. - * - * Coordinates are fetched from input driver, and an - * overlay with pressable actions are displayed on-screen. - * - * This interface requires that the video driver has support - * for the overlay interface. - */ - -typedef struct video_overlay_interface -{ - void (*enable)(void *data, bool state); - bool (*load)(void *data, - const void *images, unsigned num_images); - void (*tex_geom)(void *data, unsigned image, - float x, float y, float w, float h); - void (*vertex_geom)(void *data, unsigned image, - float x, float y, float w, float h); - void (*full_screen)(void *data, bool enable); - void (*set_alpha)(void *data, unsigned image, float mod); -} video_overlay_interface_t; - enum overlay_hitbox { OVERLAY_HITBOX_RADIAL = 0, @@ -155,6 +132,29 @@ enum OVERLAY_DESC_FLAGS OVERLAY_DESC_RANGE_MOD_EXCLUSIVE = (1 << 2) }; +/* Overlay driver acts as a medium between input drivers + * and video driver. + * + * Coordinates are fetched from input driver, and an + * overlay with pressable actions are displayed on-screen. + * + * This interface requires that the video driver has support + * for the overlay interface. + */ + +typedef struct video_overlay_interface +{ + void (*enable)(void *data, bool state); + bool (*load)(void *data, + const void *images, unsigned num_images); + void (*tex_geom)(void *data, unsigned image, + float x, float y, float w, float h); + void (*vertex_geom)(void *data, unsigned image, + float x, float y, float w, float h); + void (*full_screen)(void *data, bool enable); + void (*set_alpha)(void *data, unsigned image, float mod); +} video_overlay_interface_t; + typedef struct overlay_eightway_config { input_bits_t up; @@ -223,7 +223,6 @@ struct overlay_desc uint8_t flags; }; - struct overlay { struct overlay_desc *descs; diff --git a/input/input_types.h b/input/input_types.h index e55775c3e8..54cafb8075 100644 --- a/input/input_types.h +++ b/input/input_types.h @@ -19,6 +19,8 @@ #include "../msg_hash.h" +#define INPUT_CONFIG_BIND_MAP_GET(i) ((const struct input_bind_map*)&input_config_bind_map[(i)]) + enum input_auto_game_focus_type { AUTO_GAME_FOCUS_OFF = 0, @@ -50,7 +52,6 @@ struct input_bind_map bool valid; }; - /* Turbo support. */ struct turbo_buttons { @@ -119,8 +120,6 @@ typedef struct input_game_focus_state bool core_requested; } input_game_focus_state_t; -#define INPUT_CONFIG_BIND_MAP_GET(i) ((const struct input_bind_map*)&input_config_bind_map[(i)]) - extern const struct input_bind_map input_config_bind_map[RARCH_BIND_LIST_END_NULL]; typedef struct rarch_joypad_driver input_device_driver_t; diff --git a/location_driver.h b/location_driver.h index 248cd3e238..c17879a122 100644 --- a/location_driver.h +++ b/location_driver.h @@ -38,7 +38,6 @@ typedef struct location_driver const char *ident; } location_driver_t; - typedef struct { const location_driver_t *driver; diff --git a/menu/menu_explore.c b/menu/menu_explore.c index cb4a11a0cf..ab653dbd5a 100644 --- a/menu/menu_explore.c +++ b/menu/menu_explore.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "menu_driver.h" #include "menu_cbs.h" diff --git a/msg_hash.h b/msg_hash.h index e1061a7a13..159c5a8b57 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -28,6 +28,17 @@ #define MSG_HASH(Id, str) case Id: return str; +#define MENU_LABEL(STR) \ + MENU_ENUM_LABEL_##STR, \ + MENU_ENUM_SUBLABEL_##STR, \ + MENU_ENUM_LABEL_VALUE_##STR + +#define MENU_LBL_H(STR) \ + MENU_ENUM_LABEL_##STR, \ + MENU_ENUM_SUBLABEL_##STR, \ + MENU_ENUM_LABEL_VALUE_##STR, \ + MENU_ENUM_LABEL_HELP_##STR + RETRO_BEGIN_DECLS enum msg_hash_action @@ -162,17 +173,6 @@ enum msg_file_type FILE_TYPE_LAST }; -#define MENU_LABEL(STR) \ - MENU_ENUM_LABEL_##STR, \ - MENU_ENUM_SUBLABEL_##STR, \ - MENU_ENUM_LABEL_VALUE_##STR - -#define MENU_LBL_H(STR) \ - MENU_ENUM_LABEL_##STR, \ - MENU_ENUM_SUBLABEL_##STR, \ - MENU_ENUM_LABEL_VALUE_##STR, \ - MENU_ENUM_LABEL_HELP_##STR - enum msg_hash_enums { MSG_UNKNOWN = 0, diff --git a/performance_counters.h b/performance_counters.h index acc37b8d16..0ac5d4992b 100644 --- a/performance_counters.h +++ b/performance_counters.h @@ -24,31 +24,10 @@ #include #include -RETRO_BEGIN_DECLS - #ifndef MAX_COUNTERS #define MAX_COUNTERS 64 #endif -typedef struct rarch_timer -{ - int64_t current; - int64_t timeout_us; - int64_t timeout_end; - bool timer_begin; - bool timer_end; -} rarch_timer_t; - -struct retro_perf_counter **retro_get_perf_counter_rarch(void); - -struct retro_perf_counter **retro_get_perf_counter_libretro(void); - -unsigned retro_get_perf_count_rarch(void); - -unsigned retro_get_perf_count_libretro(void); - -void rarch_perf_register(struct retro_perf_counter *perf); - #define performance_counter_init(perf, name) \ perf.ident = name; \ if (!perf.registered) \ @@ -81,6 +60,27 @@ void rarch_perf_register(struct retro_perf_counter *perf); **/ #define performance_counter_stop_plus(is_perfcnt_enable, perf) performance_counter_stop_internal(is_perfcnt_enable, perf) +RETRO_BEGIN_DECLS + +typedef struct rarch_timer +{ + int64_t current; + int64_t timeout_us; + int64_t timeout_end; + bool timer_begin; + bool timer_end; +} rarch_timer_t; + +struct retro_perf_counter **retro_get_perf_counter_rarch(void); + +struct retro_perf_counter **retro_get_perf_counter_libretro(void); + +unsigned retro_get_perf_count_rarch(void); + +unsigned retro_get_perf_count_libretro(void); + +void rarch_perf_register(struct retro_perf_counter *perf); + RETRO_END_DECLS #endif diff --git a/retroarch.h b/retroarch.h index 28e9ae7709..a0347aa01d 100644 --- a/retroarch.h +++ b/retroarch.h @@ -86,6 +86,26 @@ RETRO_BEGIN_DECLS | DRIVER_LED_MASK \ | DRIVER_MIDI_MASK ) +enum rarch_state_flags +{ + RARCH_FLAGS_HAS_SET_USERNAME = (1 << 0), + RARCH_FLAGS_HAS_SET_VERBOSITY = (1 << 1), + RARCH_FLAGS_HAS_SET_LIBRETRO = (1 << 2), + RARCH_FLAGS_HAS_SET_LIBRETRO_DIRECTORY = (1 << 3), + RARCH_FLAGS_HAS_SET_SAVE_PATH = (1 << 4), + RARCH_FLAGS_HAS_SET_STATE_PATH = (1 << 5), + RARCH_FLAGS_HAS_SET_UPS_PREF = (1 << 6), + RARCH_FLAGS_HAS_SET_BPS_PREF = (1 << 7), + RARCH_FLAGS_HAS_SET_IPS_PREF = (1 << 8), + RARCH_FLAGS_HAS_SET_LOG_TO_FILE = (1 << 9), + RARCH_FLAGS_UPS_PREF = (1 << 10), + RARCH_FLAGS_BPS_PREF = (1 << 11), + RARCH_FLAGS_IPS_PREF = (1 << 12), + RARCH_FLAGS_BLOCK_CONFIG_READ = (1 << 13), + RARCH_FLAGS_CLI_DATABASE_SCAN = (1 << 14) +}; + + bool retroarch_ctl(enum rarch_ctl_state state, void *data); int retroarch_get_capabilities(enum rarch_capabilities type, @@ -163,25 +183,6 @@ bool core_options_remove_override(bool game_specific); void core_options_reset(void); void core_options_flush(void); -enum rarch_state_flags -{ - RARCH_FLAGS_HAS_SET_USERNAME = (1 << 0), - RARCH_FLAGS_HAS_SET_VERBOSITY = (1 << 1), - RARCH_FLAGS_HAS_SET_LIBRETRO = (1 << 2), - RARCH_FLAGS_HAS_SET_LIBRETRO_DIRECTORY = (1 << 3), - RARCH_FLAGS_HAS_SET_SAVE_PATH = (1 << 4), - RARCH_FLAGS_HAS_SET_STATE_PATH = (1 << 5), - RARCH_FLAGS_HAS_SET_UPS_PREF = (1 << 6), - RARCH_FLAGS_HAS_SET_BPS_PREF = (1 << 7), - RARCH_FLAGS_HAS_SET_IPS_PREF = (1 << 8), - RARCH_FLAGS_HAS_SET_LOG_TO_FILE = (1 << 9), - RARCH_FLAGS_UPS_PREF = (1 << 10), - RARCH_FLAGS_BPS_PREF = (1 << 11), - RARCH_FLAGS_IPS_PREF = (1 << 12), - RARCH_FLAGS_BLOCK_CONFIG_READ = (1 << 13), - RARCH_FLAGS_CLI_DATABASE_SCAN = (1 << 14) -}; - /** * retroarch_fail: * @error_code : Error code. diff --git a/tasks/task_movie.c b/tasks/task_movie.c index ac4f489727..47438705c2 100644 --- a/tasks/task_movie.c +++ b/tasks/task_movie.c @@ -24,6 +24,7 @@ #include #include #include +#include #ifdef _WIN32 #include diff --git a/tasks/tasks_internal.h b/tasks/tasks_internal.h index fb9025efa1..0a35bbad8a 100644 --- a/tasks/tasks_internal.h +++ b/tasks/tasks_internal.h @@ -44,6 +44,16 @@ RETRO_BEGIN_DECLS +enum screenshot_task_flags +{ + SS_TASK_FLAG_BGR24 = (1 << 0), + SS_TASK_FLAG_SILENCE = (1 << 1), + SS_TASK_FLAG_IS_IDLE = (1 << 2), + SS_TASK_FLAG_IS_PAUSED = (1 << 3), + SS_TASK_FLAG_HISTORY_LIST_ENABLE = (1 << 4), + SS_TASK_FLAG_WIDGETS_READY = (1 << 5) +}; + typedef struct nbio_buf { void *buf; @@ -51,6 +61,26 @@ typedef struct nbio_buf unsigned bufsize; } nbio_buf_t; +typedef struct screenshot_task_state screenshot_task_state_t; + +struct screenshot_task_state +{ + struct scaler_ctx scaler; + uint8_t *out_buffer; + const void *frame; + void *userbuf; + + int pitch; + unsigned width; + unsigned height; + unsigned pixel_format_type; + + uint8_t flags; + + char filename[PATH_MAX_LENGTH]; + char shotname[NAME_MAX_LENGTH]; +}; + #ifdef HAVE_NETWORKING typedef struct { @@ -220,36 +250,6 @@ void *task_push_decompress( void task_file_load_handler(retro_task_t *task); -typedef struct screenshot_task_state screenshot_task_state_t; - -enum screenshot_task_flags -{ - SS_TASK_FLAG_BGR24 = (1 << 0), - SS_TASK_FLAG_SILENCE = (1 << 1), - SS_TASK_FLAG_IS_IDLE = (1 << 2), - SS_TASK_FLAG_IS_PAUSED = (1 << 3), - SS_TASK_FLAG_HISTORY_LIST_ENABLE = (1 << 4), - SS_TASK_FLAG_WIDGETS_READY = (1 << 5) -}; - -struct screenshot_task_state -{ - struct scaler_ctx scaler; - uint8_t *out_buffer; - const void *frame; - void *userbuf; - - int pitch; - unsigned width; - unsigned height; - unsigned pixel_format_type; - - uint8_t flags; - - char filename[PATH_MAX_LENGTH]; - char shotname[NAME_MAX_LENGTH]; -}; - bool take_screenshot( const char *screenshot_dir, const char *path, bool silence, @@ -266,7 +266,6 @@ void *savefile_ptr_get(void); void path_init_savefile_new(void); /* Autoconfigure tasks */ -extern const char* const input_builtin_autoconfs[]; void input_autoconfigure_blissbox_override_handler( int vid, int pid, char *device_name, size_t len); bool input_autoconfigure_connect( @@ -293,6 +292,8 @@ bool menu_explore_init_in_progress(void *data); void menu_explore_wait_for_init_task(void); #endif +extern const char* const input_builtin_autoconfs[]; + RETRO_END_DECLS #endif