Header uniformity - enums on top, then structs, then public declarations

This commit is contained in:
libretroadmin 2023-05-30 21:03:36 +02:00
parent c07e6a6da2
commit c0ba738f0d
18 changed files with 336 additions and 331 deletions

View File

@ -83,6 +83,17 @@ enum audio_mixer_state
AUDIO_STREAM_STATE_PLAYING_SEQUENTIAL 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 typedef struct audio_statistics
{ {
unsigned samples; unsigned samples;

View File

@ -158,16 +158,6 @@ typedef struct audio_driver
size_t (*buffer_size)(void *data); size_t (*buffer_size)(void *data);
} audio_driver_t; } 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 typedef struct
{ {
double source_ratio_original; double source_ratio_original;
@ -306,44 +296,6 @@ bool audio_driver_stop(void);
bool audio_driver_is_ai_service_speech_running(void); bool audio_driver_is_ai_service_speech_running(void);
#endif #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: * audio_compute_buffer_statistics:
* *
@ -422,6 +374,44 @@ size_t audio_driver_sample_batch_rewind(
void audio_driver_menu_sample(void); void audio_driver_menu_sample(void);
#endif #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 RETRO_END_DECLS
#endif /* __AUDIO_DRIVER__H */ #endif /* __AUDIO_DRIVER__H */

View File

@ -34,38 +34,10 @@
#include "configuration.h" #include "configuration.h"
RETRO_BEGIN_DECLS
#define MAX_CMD_DRIVERS 3 #define MAX_CMD_DRIVERS 3
#define DEFAULT_NETWORK_CMD_PORT 55355 #define DEFAULT_NETWORK_CMD_PORT 55355
struct cmd_map RETRO_BEGIN_DECLS
{
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;
enum event_command enum event_command
{ {
@ -291,12 +263,6 @@ enum event_command
CMD_EVENT_SEND_DEBUG_INFO CMD_EVENT_SEND_DEBUG_INFO
}; };
typedef struct command_handle
{
command_t *handle;
unsigned id;
} command_handle_t;
enum cmd_source_t enum cmd_source_t
{ {
CMD_NONE = 0, CMD_NONE = 0,
@ -304,6 +270,40 @@ enum cmd_source_t
CMD_NETWORK 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; struct rarch_state;
/** /**

View File

@ -68,6 +68,8 @@
strlcpy(var, newvar, sizeof(var)); \ strlcpy(var, newvar, sizeof(var)); \
} }
RETRO_BEGIN_DECLS
enum crt_switch_type enum crt_switch_type
{ {
CRT_SWITCH_NONE = 0, CRT_SWITCH_NONE = 0,
@ -85,8 +87,6 @@ enum override_type
OVERRIDE_GAME OVERRIDE_GAME
}; };
RETRO_BEGIN_DECLS
typedef struct settings typedef struct settings
{ {
struct struct

View File

@ -26,35 +26,6 @@
RETRO_BEGIN_DECLS 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 enum retro_core_flags
{ {
RETRO_CORE_FLAG_INITED = (1 << 0), RETRO_CORE_FLAG_INITED = (1 << 0),
@ -99,6 +70,36 @@ struct retro_core_t
uint8_t flags; 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 RETRO_END_DECLS
#endif #endif

View File

@ -22,8 +22,6 @@
#include <retro_common_api.h> #include <retro_common_api.h>
RETRO_BEGIN_DECLS
#define MAX_USERS 16 #define MAX_USERS 16
#define MAX_INPUT_DEVICES 16 #define MAX_INPUT_DEVICES 16
@ -37,6 +35,56 @@ RETRO_BEGIN_DECLS
#define RARCH_UNMAPPED 1024 #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. */ /* RetroArch specific bind IDs. */
enum enum
{ {
@ -196,54 +244,6 @@ enum input_turbo_default_button
INPUT_TURBO_DEFAULT_BUTTON_LAST 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 RETRO_END_DECLS
#endif #endif

View File

@ -23,6 +23,7 @@
#include <string/stdstring.h> #include <string/stdstring.h>
#include <encodings/utf.h> #include <encodings/utf.h>
#include <clamping.h> #include <clamping.h>
#include <retro_endianness.h>
#include "input_driver.h" #include "input_driver.h"
#include "input_keymaps.h" #include "input_keymaps.h"

View File

@ -40,8 +40,10 @@
#include "input_osk.h" #include "input_osk.h"
#include "../msg_hash.h" #include "../msg_hash.h"
#ifdef HAVE_HID
#include "include/hid_types.h" #include "include/hid_types.h"
#include "include/hid_driver.h" #include "include/hid_driver.h"
#endif
#include "include/gamepad.h" #include "include/gamepad.h"
#include "../configuration.h" #include "../configuration.h"
#include "../performance_counters.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 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 RETRO_BEGIN_DECLS
enum rarch_movie_type enum rarch_movie_type
@ -108,6 +144,21 @@ enum rarch_movie_type
RARCH_MOVIE_RECORD 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 #ifdef HAVE_BSV_MOVIE
enum bsv_flags enum bsv_flags
{ {
@ -129,7 +180,8 @@ struct bsv_state
}; };
/* These data are always little-endian. */ /* These data are always little-endian. */
struct bsv_key_data { struct bsv_key_data
{
uint8_t down; uint8_t down;
uint16_t mod; uint16_t mod;
uint8_t _padding; uint8_t _padding;
@ -163,10 +215,6 @@ struct bsv_movie
}; };
typedef struct bsv_movie bsv_movie_t; 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 #endif
/** /**
@ -193,9 +241,6 @@ struct input_keyboard_line
bool enabled; bool enabled;
}; };
extern retro_keybind_set input_config_binds[MAX_USERS];
extern retro_keybind_set input_autoconf_binds[MAX_USERS];
struct rarch_joypad_info struct rarch_joypad_info
{ {
const struct retro_keybind *auto_binds; const struct retro_keybind *auto_binds;
@ -233,7 +278,6 @@ struct input_remote
bool state[RARCH_BIND_LIST_END]; bool state[RARCH_BIND_LIST_END];
}; };
typedef struct typedef struct
{ {
char display_name[256]; char display_name[256];
@ -441,21 +485,6 @@ struct input_keyboard_ctx_wait
input_keyboard_press_t cb; 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 typedef struct
{ {
/** /**
@ -633,36 +662,6 @@ const char* config_get_joypad_driver_options(void);
const input_device_driver_t *input_joypad_init_driver( const input_device_driver_t *input_joypad_init_driver(
const char *ident, void *data); 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. * Registers a newly connected pad with RetroArch.
* *
@ -693,8 +692,6 @@ input_driver_state_t *input_state_get_ptr(void);
/*************************************/ /*************************************/
#ifdef HAVE_HID #ifdef HAVE_HID
#include "include/hid_driver.h"
/** /**
* Get an enumerated list of all HID driver names * 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; extern hid_driver_t wiiu_hid;
#endif /* HAVE_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 RETRO_END_DECLS
#endif /* __INPUT_DRIVER__H */ #endif /* __INPUT_DRIVER__H */

View File

@ -66,7 +66,8 @@ extern const struct rarch_key_map rarch_key_map_ps4[];
#endif #endif
#if defined(_WIN32) && _WIN32_WINNT >= 0x0501 && !defined(__WINRT__) #if defined(_WIN32) && _WIN32_WINNT >= 0x0501 && !defined(__WINRT__)
enum winraw_scancodes { enum winraw_scancodes
{
SC_ESCAPE = 0x01, SC_ESCAPE = 0x01,
SC_1 = 0x02, SC_1 = 0x02,
SC_2 = 0x03, SC_2 = 0x03,

View File

@ -36,29 +36,6 @@
RETRO_BEGIN_DECLS 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 enum overlay_hitbox
{ {
OVERLAY_HITBOX_RADIAL = 0, OVERLAY_HITBOX_RADIAL = 0,
@ -155,6 +132,29 @@ enum OVERLAY_DESC_FLAGS
OVERLAY_DESC_RANGE_MOD_EXCLUSIVE = (1 << 2) 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 typedef struct overlay_eightway_config
{ {
input_bits_t up; input_bits_t up;
@ -223,7 +223,6 @@ struct overlay_desc
uint8_t flags; uint8_t flags;
}; };
struct overlay struct overlay
{ {
struct overlay_desc *descs; struct overlay_desc *descs;

View File

@ -19,6 +19,8 @@
#include "../msg_hash.h" #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 enum input_auto_game_focus_type
{ {
AUTO_GAME_FOCUS_OFF = 0, AUTO_GAME_FOCUS_OFF = 0,
@ -50,7 +52,6 @@ struct input_bind_map
bool valid; bool valid;
}; };
/* Turbo support. */ /* Turbo support. */
struct turbo_buttons struct turbo_buttons
{ {
@ -119,8 +120,6 @@ typedef struct input_game_focus_state
bool core_requested; bool core_requested;
} input_game_focus_state_t; } 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]; extern const struct input_bind_map input_config_bind_map[RARCH_BIND_LIST_END_NULL];
typedef struct rarch_joypad_driver input_device_driver_t; typedef struct rarch_joypad_driver input_device_driver_t;

View File

@ -38,7 +38,6 @@ typedef struct location_driver
const char *ident; const char *ident;
} location_driver_t; } location_driver_t;
typedef struct typedef struct
{ {
const location_driver_t *driver; const location_driver_t *driver;

View File

@ -22,6 +22,7 @@
#include <array/rhmap.h> #include <array/rhmap.h>
#include <formats/rjson.h> #include <formats/rjson.h>
#include <formats/rjson_helpers.h> #include <formats/rjson_helpers.h>
#include <retro_endianness.h>
#include "menu_driver.h" #include "menu_driver.h"
#include "menu_cbs.h" #include "menu_cbs.h"

View File

@ -28,6 +28,17 @@
#define MSG_HASH(Id, str) case Id: return str; #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 RETRO_BEGIN_DECLS
enum msg_hash_action enum msg_hash_action
@ -162,17 +173,6 @@ enum msg_file_type
FILE_TYPE_LAST 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 enum msg_hash_enums
{ {
MSG_UNKNOWN = 0, MSG_UNKNOWN = 0,

View File

@ -24,31 +24,10 @@
#include <libretro.h> #include <libretro.h>
#include <features/features_cpu.h> #include <features/features_cpu.h>
RETRO_BEGIN_DECLS
#ifndef MAX_COUNTERS #ifndef MAX_COUNTERS
#define MAX_COUNTERS 64 #define MAX_COUNTERS 64
#endif #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) \ #define performance_counter_init(perf, name) \
perf.ident = name; \ perf.ident = name; \
if (!perf.registered) \ 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) #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 RETRO_END_DECLS
#endif #endif

View File

@ -86,6 +86,26 @@ RETRO_BEGIN_DECLS
| DRIVER_LED_MASK \ | DRIVER_LED_MASK \
| DRIVER_MIDI_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); bool retroarch_ctl(enum rarch_ctl_state state, void *data);
int retroarch_get_capabilities(enum rarch_capabilities type, 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_reset(void);
void core_options_flush(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: * retroarch_fail:
* @error_code : Error code. * @error_code : Error code.

View File

@ -24,6 +24,7 @@
#include <compat/strl.h> #include <compat/strl.h>
#include <file/file_path.h> #include <file/file_path.h>
#include <streams/file_stream.h> #include <streams/file_stream.h>
#include <retro_endianness.h>
#ifdef _WIN32 #ifdef _WIN32
#include <direct.h> #include <direct.h>

View File

@ -44,6 +44,16 @@
RETRO_BEGIN_DECLS 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 typedef struct nbio_buf
{ {
void *buf; void *buf;
@ -51,6 +61,26 @@ typedef struct nbio_buf
unsigned bufsize; unsigned bufsize;
} nbio_buf_t; } 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 #ifdef HAVE_NETWORKING
typedef struct typedef struct
{ {
@ -220,36 +250,6 @@ void *task_push_decompress(
void task_file_load_handler(retro_task_t *task); 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( bool take_screenshot(
const char *screenshot_dir, const char *screenshot_dir,
const char *path, bool silence, const char *path, bool silence,
@ -266,7 +266,6 @@ void *savefile_ptr_get(void);
void path_init_savefile_new(void); void path_init_savefile_new(void);
/* Autoconfigure tasks */ /* Autoconfigure tasks */
extern const char* const input_builtin_autoconfs[];
void input_autoconfigure_blissbox_override_handler( void input_autoconfigure_blissbox_override_handler(
int vid, int pid, char *device_name, size_t len); int vid, int pid, char *device_name, size_t len);
bool input_autoconfigure_connect( bool input_autoconfigure_connect(
@ -293,6 +292,8 @@ bool menu_explore_init_in_progress(void *data);
void menu_explore_wait_for_init_task(void); void menu_explore_wait_for_init_task(void);
#endif #endif
extern const char* const input_builtin_autoconfs[];
RETRO_END_DECLS RETRO_END_DECLS
#endif #endif