mirror of
https://github.com/libretro/RetroArch
synced 2025-02-21 00:40:09 +00:00
Style nits/cleanups
This commit is contained in:
parent
c699e47534
commit
cb0653137f
@ -238,18 +238,14 @@ static void mic_driver_microphone_handle_free(retro_microphone_t *microphone, bo
|
|||||||
microphone->resampler = NULL;
|
microphone->resampler = NULL;
|
||||||
microphone->resampler_data = NULL;
|
microphone->resampler_data = NULL;
|
||||||
|
|
||||||
|
/* If the mic driver is being reset and the microphone was already valid... */
|
||||||
if ((microphone->flags & MICROPHONE_FLAG_ACTIVE) && is_reset)
|
if ((microphone->flags & MICROPHONE_FLAG_ACTIVE) && is_reset)
|
||||||
{ /* If the mic driver is being reset and the microphone was already valid... */
|
|
||||||
|
|
||||||
microphone->flags |= MICROPHONE_FLAG_PENDING;
|
microphone->flags |= MICROPHONE_FLAG_PENDING;
|
||||||
/* ...then we need to keep the handle itself valid
|
/* ...then we need to keep the handle itself valid
|
||||||
* so it can be reinitialized.
|
* so it can be reinitialized.
|
||||||
* Otherwise the core will lose mic input. */
|
* Otherwise the core will lose mic input. */
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
memset(microphone, 0, sizeof(*microphone));
|
memset(microphone, 0, sizeof(*microphone));
|
||||||
}
|
|
||||||
/* Do NOT free the microphone handle itself! It's allocated statically! */
|
/* Do NOT free the microphone handle itself! It's allocated statically! */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,8 +264,9 @@ bool microphone_driver_init_internal(void *settings_data)
|
|||||||
bool verbosity_enabled = verbosity_is_enabled();
|
bool verbosity_enabled = verbosity_is_enabled();
|
||||||
size_t max_frames = AUDIO_CHUNK_SIZE_NONBLOCKING * AUDIO_MAX_RATIO;
|
size_t max_frames = AUDIO_CHUNK_SIZE_NONBLOCKING * AUDIO_MAX_RATIO;
|
||||||
|
|
||||||
|
/* If the user has mic support turned off... */
|
||||||
if (!settings->bools.microphone_enable)
|
if (!settings->bools.microphone_enable)
|
||||||
{ /* If the user has mic support turned off... */
|
{
|
||||||
mic_st->flags &= ~MICROPHONE_DRIVER_FLAG_ACTIVE;
|
mic_st->flags &= ~MICROPHONE_DRIVER_FLAG_ACTIVE;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -278,7 +275,7 @@ bool microphone_driver_init_internal(void *settings_data)
|
|||||||
convert_float_to_s16_init_simd();
|
convert_float_to_s16_init_simd();
|
||||||
|
|
||||||
if (!(microphone_driver_find_driver(settings,
|
if (!(microphone_driver_find_driver(settings,
|
||||||
"microphone driver", verbosity_enabled)))
|
"microphone driver", verbosity_enabled)))
|
||||||
{
|
{
|
||||||
RARCH_ERR("[Microphone]: Failed to initialize microphone driver. Will continue without mic input.\n");
|
RARCH_ERR("[Microphone]: Failed to initialize microphone driver. Will continue without mic input.\n");
|
||||||
goto error;
|
goto error;
|
||||||
@ -318,8 +315,7 @@ bool microphone_driver_init_internal(void *settings_data)
|
|||||||
if (!mic_st->driver || !mic_st->driver->init)
|
if (!mic_st->driver || !mic_st->driver->init)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
mic_st->driver_context = mic_st->driver->init();
|
if (!(mic_st->driver_context = mic_st->driver->init()))
|
||||||
if (!mic_st->driver_context)
|
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (!string_is_empty(settings->arrays.microphone_resampler))
|
if (!string_is_empty(settings->arrays.microphone_resampler))
|
||||||
@ -392,10 +388,9 @@ static bool mic_driver_open_mic_internal(retro_microphone_t* microphone)
|
|||||||
microphone->actual_params.rate
|
microphone->actual_params.rate
|
||||||
);
|
);
|
||||||
|
|
||||||
if (mic_driver->mic_use_float && mic_driver->mic_use_float(mic_st->driver_context, microphone->microphone_context))
|
if ( mic_driver->mic_use_float
|
||||||
{
|
&& mic_driver->mic_use_float(mic_st->driver_context, microphone->microphone_context))
|
||||||
microphone->flags |= MICROPHONE_FLAG_USE_FLOAT;
|
microphone->flags |= MICROPHONE_FLAG_USE_FLOAT;
|
||||||
}
|
|
||||||
|
|
||||||
microphone->original_ratio = (double)microphone->effective_params.rate / microphone->actual_params.rate;
|
microphone->original_ratio = (double)microphone->effective_params.rate / microphone->actual_params.rate;
|
||||||
|
|
||||||
@ -425,13 +420,11 @@ static void microphone_driver_close_mic_internal(retro_microphone_t *microphone,
|
|||||||
const microphone_driver_t *mic_driver = mic_st->driver;
|
const microphone_driver_t *mic_driver = mic_st->driver;
|
||||||
void *driver_context = mic_st->driver_context;
|
void *driver_context = mic_st->driver_context;
|
||||||
|
|
||||||
if ( microphone &&
|
if ( microphone
|
||||||
driver_context &&
|
&& driver_context
|
||||||
mic_driver &&
|
&& mic_driver
|
||||||
mic_driver->close_mic)
|
&& mic_driver->close_mic)
|
||||||
{
|
|
||||||
mic_driver_microphone_handle_free(microphone, is_reset);
|
mic_driver_microphone_handle_free(microphone, is_reset);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void microphone_driver_close_mic(retro_microphone_t *microphone)
|
void microphone_driver_close_mic(retro_microphone_t *microphone)
|
||||||
@ -453,11 +446,14 @@ bool microphone_driver_set_mic_state(retro_microphone_t *microphone, bool state)
|
|||||||
return false;
|
return false;
|
||||||
/* If the provided microphone was null or invalid, or the driver is incomplete, stop. */
|
/* If the provided microphone was null or invalid, or the driver is incomplete, stop. */
|
||||||
|
|
||||||
|
/* If the driver is initialized... */
|
||||||
if (driver_context && microphone->microphone_context)
|
if (driver_context && microphone->microphone_context)
|
||||||
{ /* If the driver is initialized... */
|
{
|
||||||
bool success;
|
bool success;
|
||||||
|
|
||||||
|
/* If we want to enable this mic... */
|
||||||
if (state)
|
if (state)
|
||||||
{ /* If we want to enable this mic... */
|
{
|
||||||
success = mic_driver->start_mic(driver_context, microphone->microphone_context);
|
success = mic_driver->start_mic(driver_context, microphone->microphone_context);
|
||||||
/* Enable the mic. (Enabling an active mic is a successful noop.) */
|
/* Enable the mic. (Enabling an active mic is a successful noop.) */
|
||||||
|
|
||||||
@ -474,8 +470,8 @@ bool microphone_driver_set_mic_state(retro_microphone_t *microphone, bool state)
|
|||||||
else
|
else
|
||||||
{ /* If we want to pause this mic... */
|
{ /* If we want to pause this mic... */
|
||||||
success = mic_driver->stop_mic(driver_context, microphone->microphone_context);
|
success = mic_driver->stop_mic(driver_context, microphone->microphone_context);
|
||||||
/* Disable the mic. (If the mic is already stopped, disabling it should still be successful.) */
|
|
||||||
|
|
||||||
|
/* Disable the mic. (If the mic is already stopped, disabling it should still be successful.) */
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
microphone->flags &= ~MICROPHONE_FLAG_ENABLED;
|
microphone->flags &= ~MICROPHONE_FLAG_ENABLED;
|
||||||
@ -493,13 +489,9 @@ bool microphone_driver_set_mic_state(retro_microphone_t *microphone, bool state)
|
|||||||
{ /* The driver's not ready yet, so we'll make a note
|
{ /* The driver's not ready yet, so we'll make a note
|
||||||
* of what the mic's state should be */
|
* of what the mic's state should be */
|
||||||
if (state)
|
if (state)
|
||||||
{
|
|
||||||
microphone->flags |= MICROPHONE_FLAG_ENABLED;
|
microphone->flags |= MICROPHONE_FLAG_ENABLED;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
microphone->flags &= ~MICROPHONE_FLAG_ENABLED;
|
microphone->flags &= ~MICROPHONE_FLAG_ENABLED;
|
||||||
}
|
|
||||||
|
|
||||||
RARCH_DBG("[Microphone]: Set pending state to %s.\n",
|
RARCH_DBG("[Microphone]: Set pending state to %s.\n",
|
||||||
state ? "enabled" : "disabled");
|
state ? "enabled" : "disabled");
|
||||||
@ -512,7 +504,6 @@ bool microphone_driver_get_mic_state(const retro_microphone_t *microphone)
|
|||||||
{
|
{
|
||||||
if (!microphone || !(microphone->flags & MICROPHONE_FLAG_ACTIVE))
|
if (!microphone || !(microphone->flags & MICROPHONE_FLAG_ACTIVE))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return microphone->flags & MICROPHONE_FLAG_ENABLED;
|
return microphone->flags & MICROPHONE_FLAG_ENABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -565,27 +556,25 @@ static size_t microphone_driver_flush(
|
|||||||
|
|
||||||
/* ...then skip the resampler, since it'll produce (more or less) identical results. */
|
/* ...then skip the resampler, since it'll produce (more or less) identical results. */
|
||||||
frames_to_enqueue = MIN(FIFO_WRITE_AVAIL(microphone->outgoing_samples), resampler_data.input_frames);
|
frames_to_enqueue = MIN(FIFO_WRITE_AVAIL(microphone->outgoing_samples), resampler_data.input_frames);
|
||||||
|
|
||||||
|
/* If this mic provides floating-point samples... */
|
||||||
if (microphone->flags & MICROPHONE_FLAG_USE_FLOAT)
|
if (microphone->flags & MICROPHONE_FLAG_USE_FLOAT)
|
||||||
{ /* If this mic provides floating-point samples... */
|
{
|
||||||
convert_float_to_s16(mic_st->final_frames, mic_st->input_frames, resampler_data.input_frames);
|
convert_float_to_s16(mic_st->final_frames, mic_st->input_frames, resampler_data.input_frames);
|
||||||
fifo_write(microphone->outgoing_samples, mic_st->final_frames, frames_to_enqueue * sizeof(int16_t));
|
fifo_write(microphone->outgoing_samples, mic_st->final_frames, frames_to_enqueue * sizeof(int16_t));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
fifo_write(microphone->outgoing_samples, mic_st->input_frames, frames_to_enqueue * sizeof(int16_t));
|
fifo_write(microphone->outgoing_samples, mic_st->input_frames, frames_to_enqueue * sizeof(int16_t));
|
||||||
}
|
|
||||||
|
|
||||||
return resampler_data.input_frames;
|
return resampler_data.input_frames;
|
||||||
}
|
}
|
||||||
/* Couldn't take the fast path, so let's resample the mic input */
|
/* Couldn't take the fast path, so let's resample the mic input */
|
||||||
|
|
||||||
/* First we need to format the input for the resampler. */
|
/* First we need to format the input for the resampler. */
|
||||||
|
/* If this mic provides floating-point samples... */
|
||||||
if (microphone->flags & MICROPHONE_FLAG_USE_FLOAT)
|
if (microphone->flags & MICROPHONE_FLAG_USE_FLOAT)
|
||||||
{/* If this mic provides floating-point samples... */
|
|
||||||
|
|
||||||
/* Samples are already in floating-point, so we just need to up-channel them. */
|
/* Samples are already in floating-point, so we just need to up-channel them. */
|
||||||
convert_to_dual_mono_float(mic_st->dual_mono_frames, mic_st->input_frames, resampler_data.input_frames);
|
convert_to_dual_mono_float(mic_st->dual_mono_frames, mic_st->input_frames, resampler_data.input_frames);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Samples are 16-bit, so we need to convert them first. */
|
/* Samples are 16-bit, so we need to convert them first. */
|
||||||
@ -615,30 +604,30 @@ int microphone_driver_read(retro_microphone_t *microphone, int16_t* frames, size
|
|||||||
size_t frames_remaining = num_frames;
|
size_t frames_remaining = num_frames;
|
||||||
microphone_driver_state_t *mic_st = &mic_driver_st;
|
microphone_driver_state_t *mic_st = &mic_driver_st;
|
||||||
const microphone_driver_t *driver = mic_st->driver;
|
const microphone_driver_t *driver = mic_st->driver;
|
||||||
bool core_paused = runloop_flags & RUNLOOP_FLAG_PAUSED;
|
bool core_paused = (runloop_flags & RUNLOOP_FLAG_PAUSED) ? true : false;
|
||||||
bool is_fastforward = runloop_flags & RUNLOOP_FLAG_FASTMOTION;
|
bool is_fastforward = (runloop_flags & RUNLOOP_FLAG_FASTMOTION) ? true : false;
|
||||||
bool is_slowmo = runloop_flags & RUNLOOP_FLAG_SLOWMOTION;
|
bool is_slowmo = (runloop_flags & RUNLOOP_FLAG_SLOWMOTION) ? true : false;
|
||||||
bool is_rewind = state_manager_frame_is_reversed();
|
bool is_rewind = state_manager_frame_is_reversed();
|
||||||
bool driver_active = mic_st->flags & MICROPHONE_DRIVER_FLAG_ACTIVE;
|
bool driver_active = (mic_st->flags & MICROPHONE_DRIVER_FLAG_ACTIVE) ? true : false;
|
||||||
|
|
||||||
|
/* If the provided arguments aren't valid... */
|
||||||
if (!frames || !microphone)
|
if (!frames || !microphone)
|
||||||
/* If the provided arguments aren't valid... */
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
/* If the microphone or driver aren't active... */
|
||||||
if (!driver_active || !(microphone->flags & MICROPHONE_FLAG_ACTIVE))
|
if (!driver_active || !(microphone->flags & MICROPHONE_FLAG_ACTIVE))
|
||||||
/* If the microphone or driver aren't active... */
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
/* If the driver is invalid or doesn't have the functions it needs... */
|
||||||
if (!driver || !driver->read || !driver->mic_alive)
|
if (!driver || !driver->read || !driver->mic_alive)
|
||||||
/* If the driver is invalid or doesn't have the functions it needs... */
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
/* If the core didn't actually ask for any frames... */
|
||||||
if (num_frames == 0)
|
if (num_frames == 0)
|
||||||
/* If the core didn't actually ask for any frames... */
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((microphone->flags & MICROPHONE_FLAG_PENDING)
|
if ( (microphone->flags & MICROPHONE_FLAG_PENDING)
|
||||||
|| (microphone->flags & MICROPHONE_FLAG_SUSPENDED)
|
|| (microphone->flags & MICROPHONE_FLAG_SUSPENDED)
|
||||||
|| !(microphone->flags & MICROPHONE_FLAG_ENABLED)
|
|| !(microphone->flags & MICROPHONE_FLAG_ENABLED)
|
||||||
|| is_fastforward
|
|| is_fastforward
|
||||||
|| is_slowmo
|
|| is_slowmo
|
||||||
@ -657,18 +646,19 @@ int microphone_driver_read(retro_microphone_t *microphone, int16_t* frames, size
|
|||||||
* Because I couldn't think of anything useful for the mic to do.
|
* Because I couldn't think of anything useful for the mic to do.
|
||||||
* If you can, send a PR! */
|
* If you can, send a PR! */
|
||||||
|
|
||||||
|
/* If the driver or microphone's state haven't been allocated... */
|
||||||
if (!mic_st->driver_context || !microphone->microphone_context)
|
if (!mic_st->driver_context || !microphone->microphone_context)
|
||||||
/* If the driver or microphone's state haven't been allocated... */
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
/* If the mic isn't active like it should be at this point... */
|
||||||
if (!driver->mic_alive(mic_st->driver_context, microphone->microphone_context))
|
if (!driver->mic_alive(mic_st->driver_context, microphone->microphone_context))
|
||||||
{ /* If the mic isn't active like it should be at this point... */
|
{
|
||||||
RARCH_ERR("[Microphone]: Mic frontend has the mic enabled, but the backend has it disabled.\n");
|
RARCH_ERR("[Microphone]: Mic frontend has the mic enabled, but the backend has it disabled.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the core asked for more frames than we can fit... */
|
||||||
if (num_frames > microphone->outgoing_samples->size)
|
if (num_frames > microphone->outgoing_samples->size)
|
||||||
/* If the core asked for more frames than we can fit... */
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
retro_assert(mic_st->input_frames != NULL);
|
retro_assert(mic_st->input_frames != NULL);
|
||||||
@ -676,9 +666,10 @@ int microphone_driver_read(retro_microphone_t *microphone, int16_t* frames, size
|
|||||||
while (FIFO_READ_AVAIL(microphone->outgoing_samples) < num_frames * sizeof(int16_t))
|
while (FIFO_READ_AVAIL(microphone->outgoing_samples) < num_frames * sizeof(int16_t))
|
||||||
{ /* Until we can give the core the frames it asked for... */
|
{ /* Until we can give the core the frames it asked for... */
|
||||||
size_t frames_to_read = MIN(AUDIO_CHUNK_SIZE_NONBLOCKING, frames_remaining);
|
size_t frames_to_read = MIN(AUDIO_CHUNK_SIZE_NONBLOCKING, frames_remaining);
|
||||||
size_t frames_read = 0;
|
size_t frames_read = 0;
|
||||||
|
|
||||||
|
/* If the game is running and the mic driver is active... */
|
||||||
if (!core_paused)
|
if (!core_paused)
|
||||||
/* If the game is running and the mic driver is active... */
|
|
||||||
frames_read = microphone_driver_flush(mic_st, microphone, frames_to_read);
|
frames_read = microphone_driver_flush(mic_st, microphone, frames_to_read);
|
||||||
|
|
||||||
/* Otherwise, advance the counters. We're not gonna get new data,
|
/* Otherwise, advance the counters. We're not gonna get new data,
|
||||||
@ -692,16 +683,13 @@ int microphone_driver_read(retro_microphone_t *microphone, int16_t* frames, size
|
|||||||
|
|
||||||
bool microphone_driver_get_effective_params(const retro_microphone_t *microphone, retro_microphone_params_t *params)
|
bool microphone_driver_get_effective_params(const retro_microphone_t *microphone, retro_microphone_params_t *params)
|
||||||
{
|
{
|
||||||
|
/* If the arguments are null... */
|
||||||
if (!microphone || !params)
|
if (!microphone || !params)
|
||||||
/* If the arguments are null... */
|
|
||||||
return false;
|
return false;
|
||||||
|
/* If this isn't an opened microphone... */
|
||||||
if (!(microphone->flags & MICROPHONE_FLAG_ACTIVE))
|
if (!(microphone->flags & MICROPHONE_FLAG_ACTIVE))
|
||||||
/* If this isn't an opened microphone... */
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
*params = microphone->effective_params;
|
*params = microphone->effective_params;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -744,8 +732,9 @@ retro_microphone_t *microphone_driver_open_mic(const retro_microphone_params_t *
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the core has requested a second microphone... */
|
||||||
if (mic_st->microphone.flags & MICROPHONE_FLAG_ACTIVE)
|
if (mic_st->microphone.flags & MICROPHONE_FLAG_ACTIVE)
|
||||||
{ /* If the core has requested a second microphone... */
|
{
|
||||||
RARCH_ERR("[Microphone]: Failed to open a second microphone, frontend only supports one at a time right now.\n");
|
RARCH_ERR("[Microphone]: Failed to open a second microphone, frontend only supports one at a time right now.\n");
|
||||||
if (mic_st->microphone.flags & MICROPHONE_FLAG_PENDING)
|
if (mic_st->microphone.flags & MICROPHONE_FLAG_PENDING)
|
||||||
/* If that mic is pending... */
|
/* If that mic is pending... */
|
||||||
@ -765,7 +754,8 @@ retro_microphone_t *microphone_driver_open_mic(const retro_microphone_params_t *
|
|||||||
/* If driver_context is NULL, the handle won't have a valid microphone context (but we'll create one later) */
|
/* If driver_context is NULL, the handle won't have a valid microphone context (but we'll create one later) */
|
||||||
|
|
||||||
if (driver_context)
|
if (driver_context)
|
||||||
{ /* If the microphone driver is ready to open a microphone... */
|
{
|
||||||
|
/* If the microphone driver is ready to open a microphone... */
|
||||||
if (mic_driver_open_mic_internal(&mic_st->microphone)) /* If the microphone was successfully initialized... */
|
if (mic_driver_open_mic_internal(&mic_st->microphone)) /* If the microphone was successfully initialized... */
|
||||||
RARCH_LOG("[Microphone]: Opened the requested microphone successfully.\n");
|
RARCH_LOG("[Microphone]: Opened the requested microphone successfully.\n");
|
||||||
else
|
else
|
||||||
@ -789,7 +779,7 @@ static bool microphone_driver_free_devices_list(void)
|
|||||||
{
|
{
|
||||||
microphone_driver_state_t *mic_st = &mic_driver_st;
|
microphone_driver_state_t *mic_st = &mic_driver_st;
|
||||||
if (
|
if (
|
||||||
!mic_st->driver
|
!mic_st->driver
|
||||||
|| !mic_st->driver->device_list_free
|
|| !mic_st->driver->device_list_free
|
||||||
|| !mic_st->driver_context
|
|| !mic_st->driver_context
|
||||||
|| !mic_st->devices_list)
|
|| !mic_st->devices_list)
|
||||||
@ -818,32 +808,32 @@ bool microphone_driver_deinit(bool is_reset)
|
|||||||
|
|
||||||
if (mic_st->input_frames)
|
if (mic_st->input_frames)
|
||||||
memalign_free(mic_st->input_frames);
|
memalign_free(mic_st->input_frames);
|
||||||
mic_st->input_frames = NULL;
|
mic_st->input_frames = NULL;
|
||||||
mic_st->input_frames_length = 0;
|
mic_st->input_frames_length = 0;
|
||||||
|
|
||||||
if (mic_st->converted_input_frames)
|
if (mic_st->converted_input_frames)
|
||||||
memalign_free(mic_st->converted_input_frames);
|
memalign_free(mic_st->converted_input_frames);
|
||||||
mic_st->converted_input_frames = NULL;
|
mic_st->converted_input_frames = NULL;
|
||||||
mic_st->converted_input_frames_length = 0;
|
mic_st->converted_input_frames_length = 0;
|
||||||
|
|
||||||
if (mic_st->dual_mono_frames)
|
if (mic_st->dual_mono_frames)
|
||||||
memalign_free(mic_st->dual_mono_frames);
|
memalign_free(mic_st->dual_mono_frames);
|
||||||
mic_st->dual_mono_frames = NULL;
|
mic_st->dual_mono_frames = NULL;
|
||||||
mic_st->dual_mono_frames_length = 0;
|
mic_st->dual_mono_frames_length = 0;
|
||||||
|
|
||||||
if (mic_st->resampled_frames)
|
if (mic_st->resampled_frames)
|
||||||
memalign_free(mic_st->resampled_frames);
|
memalign_free(mic_st->resampled_frames);
|
||||||
mic_st->resampled_frames = NULL;
|
mic_st->resampled_frames = NULL;
|
||||||
mic_st->resampled_frames_length = 0;
|
mic_st->resampled_frames_length = 0;
|
||||||
|
|
||||||
if (mic_st->resampled_mono_frames)
|
if (mic_st->resampled_mono_frames)
|
||||||
memalign_free(mic_st->resampled_mono_frames);
|
memalign_free(mic_st->resampled_mono_frames);
|
||||||
mic_st->resampled_mono_frames = NULL;
|
mic_st->resampled_mono_frames = NULL;
|
||||||
mic_st->resampled_mono_frames_length = 0;
|
mic_st->resampled_mono_frames_length = 0;
|
||||||
|
|
||||||
if (mic_st->final_frames)
|
if (mic_st->final_frames)
|
||||||
memalign_free(mic_st->final_frames);
|
memalign_free(mic_st->final_frames);
|
||||||
mic_st->final_frames = NULL;
|
mic_st->final_frames = NULL;
|
||||||
mic_st->final_frames_length = 0;
|
mic_st->final_frames_length = 0;
|
||||||
|
|
||||||
mic_st->resampler_quality = RESAMPLER_QUALITY_DONTCARE;
|
mic_st->resampler_quality = RESAMPLER_QUALITY_DONTCARE;
|
||||||
|
@ -1017,12 +1017,6 @@ void rcheevos_leaderboard_trackers_visibility_changed(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rcheevos_enforce_hardcore_settings(void)
|
|
||||||
{
|
|
||||||
/* disable slowdown */
|
|
||||||
runloop_state_get_ptr()->flags &= ~RUNLOOP_FLAG_SLOWMOTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void rcheevos_toggle_hardcore_active(rcheevos_locals_t* locals)
|
static void rcheevos_toggle_hardcore_active(rcheevos_locals_t* locals)
|
||||||
{
|
{
|
||||||
settings_t* settings = config_get_ptr();
|
settings_t* settings = config_get_ptr();
|
||||||
@ -1053,7 +1047,7 @@ static void rcheevos_toggle_hardcore_active(rcheevos_locals_t* locals)
|
|||||||
runloop_msg_queue_push(msg, 0, 3 * 60, true, NULL,
|
runloop_msg_queue_push(msg, 0, 3 * 60, true, NULL,
|
||||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||||
|
|
||||||
rcheevos_enforce_hardcore_settings();
|
runloop_state_get_ptr()->flags &= ~RUNLOOP_FLAG_SLOWMOTION;
|
||||||
|
|
||||||
/* Reactivate leaderboards */
|
/* Reactivate leaderboards */
|
||||||
rcheevos_activate_leaderboards();
|
rcheevos_activate_leaderboards();
|
||||||
@ -1140,12 +1134,10 @@ void rcheevos_hardcore_enabled_changed(void)
|
|||||||
else
|
else
|
||||||
rcheevos_deactivate_leaderboards();
|
rcheevos_deactivate_leaderboards();
|
||||||
}
|
}
|
||||||
|
/* hardcore enabledness didn't change, but hardcore is active, so make
|
||||||
|
* sure to enforce the restrictions. */
|
||||||
else if (rcheevos_locals.hardcore_active && rcheevos_locals.loaded)
|
else if (rcheevos_locals.hardcore_active && rcheevos_locals.loaded)
|
||||||
{
|
runloop_state_get_ptr()->flags &= ~RUNLOOP_FLAG_SLOWMOTION;
|
||||||
/* hardcore enabledness didn't change, but hardcore is active, so make
|
|
||||||
* sure to enforce the restrictions. */
|
|
||||||
rcheevos_enforce_hardcore_settings();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void rcheevos_validate_config_settings(void)
|
void rcheevos_validate_config_settings(void)
|
||||||
@ -1184,7 +1176,7 @@ void rcheevos_validate_config_settings(void)
|
|||||||
const char* val = core_option_manager_get_val(coreopts, i);
|
const char* val = core_option_manager_get_val(coreopts, i);
|
||||||
if (!rc_libretro_is_setting_allowed(disallowed_settings, key, val))
|
if (!rc_libretro_is_setting_allowed(disallowed_settings, key, val))
|
||||||
{
|
{
|
||||||
char buffer[256];
|
char buffer[128];
|
||||||
snprintf(buffer, sizeof(buffer), "Hardcore paused. Setting not allowed: %s=%s", key, val);
|
snprintf(buffer, sizeof(buffer), "Hardcore paused. Setting not allowed: %s=%s", key, val);
|
||||||
CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", buffer);
|
CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", buffer);
|
||||||
rcheevos_pause_hardcore();
|
rcheevos_pause_hardcore();
|
||||||
@ -1858,18 +1850,14 @@ static void rcheevos_start_session_async(retro_task_t* task)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* If there's nothing for the runtime to process,
|
||||||
|
* disable hardcore. */
|
||||||
if (!needs_runtime)
|
if (!needs_runtime)
|
||||||
{
|
|
||||||
/* if there's nothing for the runtime to process,
|
|
||||||
* disable hardcore. */
|
|
||||||
rcheevos_pause_hardcore();
|
rcheevos_pause_hardcore();
|
||||||
}
|
/* hardcore is active. we're going to start processing
|
||||||
|
* achievements. make sure restrictions are enforced */
|
||||||
else if (rcheevos_locals.hardcore_active)
|
else if (rcheevos_locals.hardcore_active)
|
||||||
{
|
runloop_state_get_ptr()->flags &= ~RUNLOOP_FLAG_SLOWMOTION;
|
||||||
/* hardcore is active. we're going to start processing
|
|
||||||
* achievements. make sure restrictions are enforced */
|
|
||||||
rcheevos_enforce_hardcore_settings();
|
|
||||||
}
|
|
||||||
|
|
||||||
task_set_finished(task, true);
|
task_set_finished(task, true);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user