Reorder structs, alignment

This commit is contained in:
twinaphex 2020-08-15 18:30:27 +02:00
parent 454338c4f3
commit 0598c5643a
3 changed files with 42 additions and 36 deletions

View File

@ -86,10 +86,14 @@ enum cheat_rumble_type
struct item_cheat
{
unsigned int idx;
/* Clock value for when rumbling should stop */
retro_time_t rumble_primary_end_time;
retro_time_t rumble_secondary_end_time;
char *desc;
bool state;
char *code;
unsigned int idx;
unsigned int handler;
/* Number of bits = 2^memory_search_size
* 0=1, 1=2, 2=4, 3=8, 4=16, 5=32
@ -119,19 +123,16 @@ struct item_cheat
* 1 : 11110000
*/
unsigned int address_mask;
/* Whether to apply the cheat based on big-endian console memory or not */
bool big_endian;
unsigned int rumble_type;
unsigned int rumble_value;
unsigned int rumble_prev_value;
unsigned int rumble_initialized;
unsigned int rumble_port; /* 0-15 for specific port, anything else means "all ports" */
/* 0-15 for specific port, anything else means "all ports" */
unsigned int rumble_port;
unsigned int rumble_primary_strength; /* 0-65535 */
unsigned int rumble_primary_duration; /* in milliseconds */
retro_time_t rumble_primary_end_time; /* clock value for when rumbling should stop */
unsigned int rumble_secondary_strength; /* 0-65535 */
unsigned int rumble_secondary_duration; /* in milliseconds */
retro_time_t rumble_secondary_end_time; /* clock value for when rumbling should stop */
/*
* The repeat_ variables allow for a single cheat code to affect multiple memory addresses.
@ -149,22 +150,28 @@ struct item_cheat
unsigned int repeat_add_to_value;
unsigned int repeat_add_to_address;
bool state;
/* Whether to apply the cheat based on big-endian console memory or not */
bool big_endian;
};
struct cheat_manager
{
struct item_cheat working_cheat; /* retro_time_t alignment */
struct item_cheat *cheats;
unsigned ptr;
unsigned size;
unsigned buf_size;
unsigned total_memory_size;
uint8_t *curr_memory_buf;
uint8_t *prev_memory_buf;
uint8_t *matches;
uint8_t **memory_buf_list;
unsigned *memory_size_list;
unsigned int delete_state;
unsigned int loading_cheat_size;
unsigned int loading_cheat_offset;
unsigned ptr;
unsigned size;
unsigned buf_size;
unsigned total_memory_size;
unsigned num_memory_buffers;
struct item_cheat working_cheat;
unsigned match_idx;
unsigned match_action;
unsigned search_bit_size;
@ -173,15 +180,12 @@ struct cheat_manager
unsigned search_eqplus_value;
unsigned search_eqminus_value;
unsigned num_matches;
bool big_endian;
bool memory_initialized;
bool memory_search_initialized;
unsigned int delete_state;
unsigned browse_address;
char working_desc[CHEAT_DESC_SCRATCH_SIZE];
char working_code[CHEAT_CODE_SCRATCH_SIZE];
unsigned int loading_cheat_size;
unsigned int loading_cheat_offset;
bool big_endian;
bool memory_initialized;
bool memory_search_initialized;
};
typedef struct cheat_manager cheat_manager_t;

View File

@ -65,7 +65,6 @@
struct state_manager
{
uint8_t *data;
size_t capacity;
/* Reading and writing is done here here. */
uint8_t *head;
/* If head comes close to this, discard a frame. */
@ -73,10 +72,14 @@ struct state_manager
uint8_t *thisblock;
uint8_t *nextblock;
#if STRICT_BUF_SIZE
uint8_t *debugblock;
size_t debugsize;
#endif
size_t capacity;
/* This one is rounded up from reset::blocksize. */
size_t blocksize;
/* size_t + (blocksize + 131071) / 131072 *
* (blocksize + u16 + u16) + u16 + u32 + size_t
* (yes, the math is a bit ugly). */
@ -84,10 +87,6 @@ struct state_manager
unsigned entries;
bool thisblock_valid;
#if STRICT_BUF_SIZE
size_t debugsize;
uint8_t *debugblock;
#endif
};
struct state_manager_rewind_state

View File

@ -1186,8 +1186,8 @@ static const camera_driver_t *camera_drivers[] = {
#define MAX_VISIBILITY 32
#endif
#define DECLARE_BIND(x, bind, desc) { true, 0, #x, desc, bind }
#define DECLARE_META_BIND(level, x, bind, desc) { true, level, #x, desc, bind }
#define DECLARE_BIND(base, bind, desc) { #base, desc, 0, bind, true }
#define DECLARE_META_BIND(level, base, bind, desc) { #base, desc, level, bind, true }
#define DEFAULT_NETWORK_CMD_PORT 55355
#define STDIN_BUF_SIZE 4096
@ -1621,8 +1621,8 @@ typedef struct video_pixel_scaler
typedef struct
{
enum gfx_ctx_api api;
struct string_list *list;
enum gfx_ctx_api api;
} gfx_api_gpu_map;
struct remote_message
@ -1725,12 +1725,14 @@ struct cmd_action_map
struct command
{
#ifdef HAVE_STDIN_CMD
size_t stdin_buf_ptr;
#endif
#ifdef HAVE_NETWORK_CMD
int net_fd;
#endif
#ifdef HAVE_STDIN_CMD
char stdin_buf[STDIN_BUF_SIZE];
size_t stdin_buf_ptr;
#endif
bool stdin_enable;
bool state[RARCH_BIND_LIST_END];
@ -1739,7 +1741,9 @@ struct command
/* Input config. */
struct input_bind_map
{
bool valid;
const char *base;
enum msg_hash_enums desc;
/* Meta binds get input as prefix, not input_playerN".
* 0 = libretro related.
@ -1748,9 +1752,9 @@ struct input_bind_map
*/
uint8_t meta;
const char *base;
enum msg_hash_enums desc;
uint8_t retro_key;
bool valid;
};
typedef struct turbo_buttons turbo_buttons_t;
@ -1871,7 +1875,6 @@ struct menu_bind_state
unsigned port;
bool skip;
};
#endif
@ -2603,10 +2606,10 @@ struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END] = {
};
static gfx_api_gpu_map gpu_map[] = {
{ GFX_CTX_VULKAN_API, NULL },
{ GFX_CTX_DIRECT3D10_API, NULL },
{ GFX_CTX_DIRECT3D11_API, NULL },
{ GFX_CTX_DIRECT3D12_API, NULL }
{ NULL, GFX_CTX_VULKAN_API },
{ NULL, GFX_CTX_DIRECT3D10_API },
{ NULL, GFX_CTX_DIRECT3D11_API },
{ NULL, GFX_CTX_DIRECT3D12_API }
};
static const struct input_bind_map input_config_bind_map[RARCH_BIND_LIST_END_NULL] = {