mirror of
https://github.com/libretro/RetroArch
synced 2025-03-30 16:20:27 +00:00
Reorder structs, alignment
This commit is contained in:
parent
f09df7c6e3
commit
f48dc0ff5b
@ -77,11 +77,11 @@ enum audio_mixer_state
|
||||
|
||||
typedef struct audio_statistics
|
||||
{
|
||||
unsigned samples;
|
||||
float average_buffer_saturation;
|
||||
float std_deviation_percentage;
|
||||
float close_to_underrun;
|
||||
float close_to_blocking;
|
||||
unsigned samples;
|
||||
} audio_statistics_t;
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
@ -49,10 +49,9 @@
|
||||
|
||||
typedef struct rarch_CC_resampler
|
||||
{
|
||||
audio_frame_float_t buffer[4];
|
||||
|
||||
float distance;
|
||||
void (*process)(void *re, struct resampler_data *data);
|
||||
audio_frame_float_t buffer[4];
|
||||
float distance;
|
||||
} rarch_CC_resampler_t;
|
||||
|
||||
#ifdef _MIPS_ARCH_ALLEGREX
|
||||
|
@ -73,16 +73,16 @@ struct audio_mixer_sound
|
||||
struct
|
||||
{
|
||||
/* wav */
|
||||
unsigned frames;
|
||||
const float* pcm;
|
||||
unsigned frames;
|
||||
} wav;
|
||||
|
||||
#ifdef HAVE_STB_VORBIS
|
||||
struct
|
||||
{
|
||||
/* ogg */
|
||||
unsigned size;
|
||||
const void* data;
|
||||
unsigned size;
|
||||
} ogg;
|
||||
#endif
|
||||
|
||||
@ -90,8 +90,8 @@ struct audio_mixer_sound
|
||||
struct
|
||||
{
|
||||
/* flac */
|
||||
unsigned size;
|
||||
const void* data;
|
||||
unsigned size;
|
||||
} flac;
|
||||
#endif
|
||||
|
||||
@ -99,8 +99,8 @@ struct audio_mixer_sound
|
||||
struct
|
||||
{
|
||||
/* mp */
|
||||
unsigned size;
|
||||
const void* data;
|
||||
unsigned size;
|
||||
} mp3;
|
||||
#endif
|
||||
|
||||
@ -108,8 +108,8 @@ struct audio_mixer_sound
|
||||
struct
|
||||
{
|
||||
/* mod/s3m/xm */
|
||||
unsigned size;
|
||||
const void* data;
|
||||
unsigned size;
|
||||
} mod;
|
||||
#endif
|
||||
} types;
|
||||
@ -117,12 +117,6 @@ struct audio_mixer_sound
|
||||
|
||||
struct audio_mixer_voice
|
||||
{
|
||||
bool repeat;
|
||||
unsigned type;
|
||||
float volume;
|
||||
audio_mixer_sound_t *sound;
|
||||
audio_mixer_stop_cb_t stop_cb;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
@ -133,61 +127,67 @@ struct audio_mixer_voice
|
||||
#ifdef HAVE_STB_VORBIS
|
||||
struct
|
||||
{
|
||||
unsigned position;
|
||||
unsigned samples;
|
||||
unsigned buf_samples;
|
||||
float* buffer;
|
||||
float ratio;
|
||||
stb_vorbis *stream;
|
||||
void *resampler_data;
|
||||
const retro_resampler_t *resampler;
|
||||
float *buffer;
|
||||
unsigned position;
|
||||
unsigned samples;
|
||||
unsigned buf_samples;
|
||||
float ratio;
|
||||
} ogg;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DR_FLAC
|
||||
struct
|
||||
{
|
||||
unsigned position;
|
||||
unsigned samples;
|
||||
unsigned buf_samples;
|
||||
float* buffer;
|
||||
float ratio;
|
||||
drflac *stream;
|
||||
void *resampler_data;
|
||||
const retro_resampler_t *resampler;
|
||||
unsigned position;
|
||||
unsigned samples;
|
||||
unsigned buf_samples;
|
||||
float ratio;
|
||||
} flac;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DR_MP3
|
||||
struct
|
||||
{
|
||||
unsigned position;
|
||||
unsigned samples;
|
||||
unsigned buf_samples;
|
||||
float* buffer;
|
||||
float ratio;
|
||||
drmp3 stream;
|
||||
void *resampler_data;
|
||||
const retro_resampler_t *resampler;
|
||||
float* buffer;
|
||||
unsigned position;
|
||||
unsigned samples;
|
||||
unsigned buf_samples;
|
||||
float ratio;
|
||||
} mp3;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_IBXM
|
||||
struct
|
||||
{
|
||||
unsigned position;
|
||||
unsigned samples;
|
||||
unsigned buf_samples;
|
||||
int* buffer;
|
||||
struct replay* stream;
|
||||
struct module* module;
|
||||
unsigned position;
|
||||
unsigned samples;
|
||||
unsigned buf_samples;
|
||||
} mod;
|
||||
#endif
|
||||
} types;
|
||||
audio_mixer_sound_t *sound;
|
||||
audio_mixer_stop_cb_t stop_cb;
|
||||
unsigned type;
|
||||
float volume;
|
||||
bool repeat;
|
||||
|
||||
};
|
||||
|
||||
/* TODO/FIXME - static globals */
|
||||
static struct audio_mixer_voice s_voices[AUDIO_MIXER_MAX_VOICES] = {{0}};
|
||||
static struct audio_mixer_voice s_voices[AUDIO_MIXER_MAX_VOICES] = {0};
|
||||
static unsigned s_rate = 0;
|
||||
|
||||
#ifdef HAVE_RWAV
|
||||
|
@ -68,15 +68,9 @@ static void *resampler_nearest_init(const struct resampler_config *config,
|
||||
{
|
||||
rarch_nearest_resampler_t *re = (rarch_nearest_resampler_t*)
|
||||
calloc(1, sizeof(rarch_nearest_resampler_t));
|
||||
|
||||
(void)config;
|
||||
(void)mask;
|
||||
|
||||
if (!re)
|
||||
return NULL;
|
||||
|
||||
re->fraction = 0;
|
||||
|
||||
return re;
|
||||
}
|
||||
|
||||
|
@ -667,7 +667,7 @@ const struct file_archive_file_backend* file_archive_get_file_backend(const char
|
||||
uint32_t file_archive_get_file_crc32(const char *path)
|
||||
{
|
||||
file_archive_transfer_t state;
|
||||
struct archive_extract_userdata userdata = {{0}};
|
||||
struct archive_extract_userdata userdata = {0};
|
||||
bool returnerr = false;
|
||||
const char *archive_path = NULL;
|
||||
bool contains_compressed = path_contains_compressed_file(path);
|
||||
|
@ -330,7 +330,7 @@ static int64_t zip_file_read(
|
||||
{
|
||||
file_archive_transfer_t state = {ARCHIVE_TRANSFER_INIT};
|
||||
decomp_state_t decomp = {0};
|
||||
struct archive_extract_userdata userdata = {{0}};
|
||||
struct archive_extract_userdata userdata = {0};
|
||||
bool returnerr = true;
|
||||
int ret = 0;
|
||||
|
||||
|
@ -62,10 +62,10 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char drive;
|
||||
cdrom_track_t track[99]; /* unsigned alignment */
|
||||
cdrom_group_timeouts_t timeouts; /* unsigned short alignment */
|
||||
unsigned char num_tracks;
|
||||
cdrom_group_timeouts_t timeouts;
|
||||
cdrom_track_t track[99];
|
||||
char drive;
|
||||
} cdrom_toc_t;
|
||||
|
||||
void cdrom_lba_to_msf(unsigned lba, unsigned char *min, unsigned char *sec, unsigned char *frame);
|
||||
|
@ -60,49 +60,48 @@ typedef struct file_archive_handle
|
||||
|
||||
typedef struct file_archive_transfer
|
||||
{
|
||||
enum file_archive_transfer_type type;
|
||||
struct RFILE *archive_file;
|
||||
int64_t archive_size;
|
||||
void *context;
|
||||
unsigned step_total, step_current;
|
||||
struct RFILE *archive_file;
|
||||
const struct file_archive_file_backend *backend;
|
||||
#ifdef HAVE_MMAP
|
||||
int archive_mmap_fd;
|
||||
uint8_t *archive_mmap_data;
|
||||
int archive_mmap_fd;
|
||||
#endif
|
||||
unsigned step_total;
|
||||
unsigned step_current;
|
||||
enum file_archive_transfer_type type;
|
||||
} file_archive_transfer_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
file_archive_transfer_t archive; /* int64_t alignment */
|
||||
char *source_file;
|
||||
char *subdir;
|
||||
char *target_dir;
|
||||
char *target_file;
|
||||
char *valid_ext;
|
||||
|
||||
char *callback_error;
|
||||
|
||||
file_archive_transfer_t archive;
|
||||
struct archive_extract_userdata *userdata;
|
||||
} decompress_state_t;
|
||||
|
||||
struct archive_extract_userdata
|
||||
{
|
||||
/* These are set or read by the archive processing */
|
||||
char archive_path[PATH_MAX_LENGTH];
|
||||
char current_file_path[PATH_MAX_LENGTH];
|
||||
char *first_extracted_file_path;
|
||||
const char *extraction_directory;
|
||||
size_t archive_path_size;
|
||||
struct string_list *ext;
|
||||
struct string_list *list;
|
||||
bool found_file;
|
||||
bool list_only;
|
||||
uint32_t crc;
|
||||
file_archive_transfer_t *transfer;
|
||||
/* Not used by the processing, free to use outside or in iterate callback */
|
||||
decompress_state_t *dec;
|
||||
void* cb_data;
|
||||
size_t archive_path_size;
|
||||
uint32_t crc;
|
||||
char archive_path[PATH_MAX_LENGTH];
|
||||
char current_file_path[PATH_MAX_LENGTH];
|
||||
bool found_file;
|
||||
bool list_only;
|
||||
};
|
||||
|
||||
/* Returns true when parsing should continue. False to stop. */
|
||||
|
@ -38,16 +38,8 @@
|
||||
struct chdstream
|
||||
{
|
||||
chd_file *chd;
|
||||
/* Should we swap bytes? */
|
||||
bool swab;
|
||||
/* Size of frame taken from each hunk */
|
||||
uint32_t frame_size;
|
||||
/* Offset of data within frame */
|
||||
uint32_t frame_offset;
|
||||
/* Number of frames per hunk */
|
||||
uint32_t frames_per_hunk;
|
||||
/* First frame of track in chd */
|
||||
uint32_t track_frame;
|
||||
/* Loaded hunk */
|
||||
uint8_t *hunkmem;
|
||||
/* Byte offset where track data starts (after pregap) */
|
||||
size_t track_start;
|
||||
/* Byte offset where track data ends */
|
||||
@ -56,16 +48,20 @@ struct chdstream
|
||||
size_t offset;
|
||||
/* Loaded hunk number */
|
||||
int32_t hunknum;
|
||||
/* Loaded hunk */
|
||||
uint8_t *hunkmem;
|
||||
/* Size of frame taken from each hunk */
|
||||
uint32_t frame_size;
|
||||
/* Offset of data within frame */
|
||||
uint32_t frame_offset;
|
||||
/* Number of frames per hunk */
|
||||
uint32_t frames_per_hunk;
|
||||
/* First frame of track in chd */
|
||||
uint32_t track_frame;
|
||||
/* Should we swap bytes? */
|
||||
bool swab;
|
||||
};
|
||||
|
||||
typedef struct metadata
|
||||
{
|
||||
char type[64];
|
||||
char subtype[32];
|
||||
char pgtype[32];
|
||||
char pgsub[32];
|
||||
uint32_t frame_offset;
|
||||
uint32_t frames;
|
||||
uint32_t pad;
|
||||
@ -73,6 +69,10 @@ typedef struct metadata
|
||||
uint32_t pregap;
|
||||
uint32_t postgap;
|
||||
uint32_t track;
|
||||
char type[64];
|
||||
char subtype[32];
|
||||
char pgtype[32];
|
||||
char pgsub[32];
|
||||
} metadata_t;
|
||||
|
||||
static uint32_t padding_frames(uint32_t frames)
|
||||
|
@ -35,8 +35,6 @@
|
||||
|
||||
struct intfstream_internal
|
||||
{
|
||||
enum intfstream_type type;
|
||||
|
||||
struct
|
||||
{
|
||||
RFILE *fp;
|
||||
@ -44,19 +42,19 @@ struct intfstream_internal
|
||||
|
||||
struct
|
||||
{
|
||||
memstream_t *fp;
|
||||
struct
|
||||
{
|
||||
uint8_t *data;
|
||||
uint64_t size;
|
||||
} buf;
|
||||
memstream_t *fp;
|
||||
bool writable;
|
||||
} memory;
|
||||
#ifdef HAVE_CHD
|
||||
struct
|
||||
{
|
||||
int32_t track;
|
||||
chdstream_t *fp;
|
||||
int32_t track;
|
||||
} chd;
|
||||
#endif
|
||||
#if defined(HAVE_ZLIB)
|
||||
@ -65,6 +63,7 @@ struct intfstream_internal
|
||||
rzipstream_t *fp;
|
||||
} rzip;
|
||||
#endif
|
||||
enum intfstream_type type;
|
||||
};
|
||||
|
||||
int64_t intfstream_get_size(intfstream_internal_t *intf)
|
||||
|
@ -33,10 +33,10 @@ static uint64_t last_file_size = 0;
|
||||
|
||||
struct memstream
|
||||
{
|
||||
uint8_t *buf;
|
||||
uint64_t size;
|
||||
uint64_t ptr;
|
||||
uint64_t max_ptr;
|
||||
uint8_t *buf;
|
||||
unsigned writing;
|
||||
};
|
||||
|
||||
|
@ -47,10 +47,7 @@
|
||||
/* Holds all metadata for an RZIP file stream */
|
||||
struct rzipstream
|
||||
{
|
||||
bool is_compressed;
|
||||
bool is_writing;
|
||||
uint64_t size;
|
||||
uint32_t chunk_size;
|
||||
/* virtual_ptr: Used to track how much
|
||||
* uncompressed data has been read */
|
||||
uint64_t virtual_ptr;
|
||||
@ -60,12 +57,15 @@ struct rzipstream
|
||||
const struct trans_stream_backend *inflate_backend;
|
||||
void *inflate_stream;
|
||||
uint8_t *in_buf;
|
||||
uint8_t *out_buf;
|
||||
uint32_t in_buf_size;
|
||||
uint32_t in_buf_ptr;
|
||||
uint8_t *out_buf;
|
||||
uint32_t out_buf_size;
|
||||
uint32_t out_buf_ptr;
|
||||
uint32_t out_buf_occupancy;
|
||||
uint32_t chunk_size;
|
||||
bool is_compressed;
|
||||
bool is_writing;
|
||||
};
|
||||
|
||||
/* Header Functions */
|
||||
|
@ -29,9 +29,9 @@
|
||||
|
||||
struct zlib_trans_stream
|
||||
{
|
||||
bool inited;
|
||||
int ex; /* window_bits or level */
|
||||
z_stream z;
|
||||
int ex; /* window_bits or level */
|
||||
bool inited;
|
||||
};
|
||||
|
||||
static void *zlib_deflate_stream_new(void)
|
||||
|
26
retroarch.c
26
retroarch.c
@ -1939,7 +1939,7 @@ struct rarch_state
|
||||
menu_input_t menu_input_state; /* retro_time_t alignment */
|
||||
#endif
|
||||
|
||||
retro_usec_t runloop_frame_time_last;
|
||||
retro_usec_t runloop_frame_time_last; /* int64_t alignment */
|
||||
|
||||
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
|
||||
rarch_timer_t shader_delay_timer; /* int64_t alignment */
|
||||
@ -28996,7 +28996,7 @@ static bool audio_compute_buffer_statistics(
|
||||
(unsigned)p_rarch->audio_driver_free_samples_count,
|
||||
AUDIO_BUFFER_FREE_SAMPLES_COUNT);
|
||||
|
||||
if (!stats || samples < 3)
|
||||
if (samples < 3)
|
||||
return false;
|
||||
|
||||
stats->samples = (unsigned)
|
||||
@ -29049,13 +29049,19 @@ static bool audio_compute_buffer_statistics(
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
static void report_audio_buffer_statistics(struct rarch_state *p_rarch)
|
||||
{
|
||||
audio_statistics_t audio_stats = {0.0f};
|
||||
audio_statistics_t audio_stats;
|
||||
audio_stats.samples = 0;
|
||||
audio_stats.average_buffer_saturation = 0.0f;
|
||||
audio_stats.std_deviation_percentage = 0.0f;
|
||||
audio_stats.close_to_underrun = 0.0f;
|
||||
audio_stats.close_to_blocking = 0.0f;
|
||||
|
||||
if (!audio_compute_buffer_statistics(p_rarch, &audio_stats))
|
||||
return;
|
||||
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("[Audio]: Average audio buffer saturation: %.2f %%,"
|
||||
" standard deviation (percentage points): %.2f %%.\n"
|
||||
"[Audio]: Amount of time spent close to underrun: %.2f %%."
|
||||
@ -29064,8 +29070,8 @@ static void report_audio_buffer_statistics(struct rarch_state *p_rarch)
|
||||
audio_stats.std_deviation_percentage,
|
||||
audio_stats.close_to_underrun,
|
||||
audio_stats.close_to_blocking);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* config_get_audio_driver_options:
|
||||
@ -29134,7 +29140,9 @@ static bool audio_driver_deinit_internal(struct rarch_state *p_rarch)
|
||||
#ifdef HAVE_DSP_FILTER
|
||||
audio_driver_dsp_filter_free();
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
report_audio_buffer_statistics(p_rarch);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -32980,7 +32988,7 @@ static void video_driver_frame(const void *data, unsigned width,
|
||||
|
||||
if (video_info.statistics_show)
|
||||
{
|
||||
audio_statistics_t audio_stats = {0.0f};
|
||||
audio_statistics_t audio_stats;
|
||||
double stddev = 0.0;
|
||||
struct retro_system_av_info *av_info = &p_rarch->video_driver_av_info;
|
||||
unsigned red = 255;
|
||||
@ -32988,6 +32996,12 @@ static void video_driver_frame(const void *data, unsigned width,
|
||||
unsigned blue = 255;
|
||||
unsigned alpha = 255;
|
||||
|
||||
audio_stats.samples = 0;
|
||||
audio_stats.average_buffer_saturation = 0.0f;
|
||||
audio_stats.std_deviation_percentage = 0.0f;
|
||||
audio_stats.close_to_underrun = 0.0f;
|
||||
audio_stats.close_to_blocking = 0.0f;
|
||||
|
||||
video_monitor_fps_statistics(NULL, &stddev, NULL);
|
||||
|
||||
video_info.osd_stat_params.x = 0.010f;
|
||||
|
Loading…
x
Reference in New Issue
Block a user