diff --git a/audio/microphone_driver.c b/audio/microphone_driver.c index 296b77d8e3..f5a667cf86 100644 --- a/audio/microphone_driver.c +++ b/audio/microphone_driver.c @@ -238,18 +238,14 @@ static void mic_driver_microphone_handle_free(retro_microphone_t *microphone, bo microphone->resampler = 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 the mic driver is being reset and the microphone was already valid... */ - microphone->flags |= MICROPHONE_FLAG_PENDING; /* ...then we need to keep the handle itself valid * so it can be reinitialized. * Otherwise the core will lose mic input. */ - } else - { memset(microphone, 0, sizeof(*microphone)); - } /* 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(); 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 the user has mic support turned off... */ + { mic_st->flags &= ~MICROPHONE_DRIVER_FLAG_ACTIVE; return false; } @@ -278,7 +275,7 @@ bool microphone_driver_init_internal(void *settings_data) convert_float_to_s16_init_simd(); 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"); goto error; @@ -318,8 +315,7 @@ bool microphone_driver_init_internal(void *settings_data) if (!mic_st->driver || !mic_st->driver->init) goto error; - mic_st->driver_context = mic_st->driver->init(); - if (!mic_st->driver_context) + if (!(mic_st->driver_context = mic_st->driver->init())) goto error; 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 ); - if (mic_driver->mic_use_float && mic_driver->mic_use_float(mic_st->driver_context, microphone->microphone_context)) - { - microphone->flags |= MICROPHONE_FLAG_USE_FLOAT; - } + 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->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; void *driver_context = mic_st->driver_context; - if ( microphone && - driver_context && - mic_driver && - mic_driver->close_mic) - { + if ( microphone + && driver_context + && mic_driver + && mic_driver->close_mic) mic_driver_microphone_handle_free(microphone, is_reset); - } } 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; /* 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 the driver is initialized... */ + { bool success; + + /* If we want to enable this mic... */ if (state) - { /* If we want to enable this mic... */ + { success = mic_driver->start_mic(driver_context, microphone->microphone_context); /* 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 { /* If we want to pause this mic... */ 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) { 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 * of what the mic's state should be */ if (state) - { microphone->flags |= MICROPHONE_FLAG_ENABLED; - } else - { microphone->flags &= ~MICROPHONE_FLAG_ENABLED; - } RARCH_DBG("[Microphone]: Set pending state to %s.\n", 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)) return false; - 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. */ 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 this mic provides floating-point samples... */ + { 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)); } else - { fifo_write(microphone->outgoing_samples, mic_st->input_frames, frames_to_enqueue * sizeof(int16_t)); - } return resampler_data.input_frames; } /* Couldn't take the fast path, so let's resample the mic input */ /* 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 this mic provides floating-point samples... */ - /* 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); - } else { /* 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; microphone_driver_state_t *mic_st = &mic_driver_st; const microphone_driver_t *driver = mic_st->driver; - bool core_paused = runloop_flags & RUNLOOP_FLAG_PAUSED; - bool is_fastforward = runloop_flags & RUNLOOP_FLAG_FASTMOTION; - bool is_slowmo = runloop_flags & RUNLOOP_FLAG_SLOWMOTION; + bool core_paused = (runloop_flags & RUNLOOP_FLAG_PAUSED) ? true : false; + bool is_fastforward = (runloop_flags & RUNLOOP_FLAG_FASTMOTION) ? true : false; + bool is_slowmo = (runloop_flags & RUNLOOP_FLAG_SLOWMOTION) ? true : false; 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 the provided arguments aren't valid... */ return -1; + /* If the microphone or driver aren't active... */ if (!driver_active || !(microphone->flags & MICROPHONE_FLAG_ACTIVE)) - /* If the microphone or driver aren't active... */ return -1; + /* If the driver is invalid or doesn't have the functions it needs... */ if (!driver || !driver->read || !driver->mic_alive) - /* If the driver is invalid or doesn't have the functions it needs... */ return -1; + /* If the core didn't actually ask for any frames... */ if (num_frames == 0) - /* If the core didn't actually ask for any frames... */ return 0; - if ((microphone->flags & MICROPHONE_FLAG_PENDING) - || (microphone->flags & MICROPHONE_FLAG_SUSPENDED) + if ( (microphone->flags & MICROPHONE_FLAG_PENDING) + || (microphone->flags & MICROPHONE_FLAG_SUSPENDED) || !(microphone->flags & MICROPHONE_FLAG_ENABLED) || is_fastforward || 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. * 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 the driver or microphone's state haven't been allocated... */ 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 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"); return -1; } + /* If the core asked for more frames than we can fit... */ if (num_frames > microphone->outgoing_samples->size) - /* If the core asked for more frames than we can fit... */ return -1; 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)) { /* 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_read = 0; + size_t frames_read = 0; + + /* If the game is running and the mic driver is active... */ 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); /* 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) { + /* If the arguments are null... */ if (!microphone || !params) - /* If the arguments are null... */ return false; - + /* If this isn't an opened microphone... */ if (!(microphone->flags & MICROPHONE_FLAG_ACTIVE)) - /* If this isn't an opened microphone... */ return false; - *params = microphone->effective_params; - return true; } @@ -744,8 +732,9 @@ retro_microphone_t *microphone_driver_open_mic(const retro_microphone_params_t * return NULL; } + /* If the core has requested a second microphone... */ 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"); if (mic_st->microphone.flags & MICROPHONE_FLAG_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) - { /* 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... */ RARCH_LOG("[Microphone]: Opened the requested microphone successfully.\n"); else @@ -789,7 +779,7 @@ static bool microphone_driver_free_devices_list(void) { microphone_driver_state_t *mic_st = &mic_driver_st; if ( - !mic_st->driver + !mic_st->driver || !mic_st->driver->device_list_free || !mic_st->driver_context || !mic_st->devices_list) @@ -818,32 +808,32 @@ bool microphone_driver_deinit(bool is_reset) if (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; if (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; if (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; if (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; if (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; if (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->resampler_quality = RESAMPLER_QUALITY_DONTCARE; diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index 659c63fc4d..ee80a65ab6 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -197,7 +197,7 @@ static int rcheevos_init_memory(rcheevos_locals_t* locals) mmap.descriptors = &descriptors[0]; mmap.num_descriptors = mmaps->num_descriptors; - /* RetroArch wraps the retro_memory_descriptor's + /* RetroArch wraps the retro_memory_descriptor's * in rarch_memory_descriptor_t's, pull them back out */ for (i = 0; i < mmap.num_descriptors; ++i) memcpy(&descriptors[i], &mmaps->descriptors[i].core, @@ -213,7 +213,7 @@ static int rcheevos_init_memory(rcheevos_locals_t* locals) uint8_t* rcheevos_patch_address(unsigned address) { - /* Memory map was not previously initialized + /* Memory map was not previously initialized * (no achievements for this game?), try now */ if (rcheevos_locals.memory.count == 0) rcheevos_init_memory(&rcheevos_locals); @@ -232,7 +232,7 @@ static unsigned rcheevos_peek(unsigned address, switch (num_bytes) { case 4: - return (data[3] << 24) | (data[2] << 16) | + return (data[3] << 24) | (data[2] << 16) | (data[1] << 8) | (data[0]); case 3: return (data[2] << 16) | (data[1] << 8) | (data[0]); @@ -287,7 +287,7 @@ static void rcheevos_activate_achievements(void) static rcheevos_racheevo_t* rcheevos_find_cheevo(unsigned id) { rcheevos_racheevo_t* cheevo = rcheevos_locals.game.achievements; - rcheevos_racheevo_t* stop = cheevo + rcheevos_racheevo_t* stop = cheevo + rcheevos_locals.game.achievement_count; for(; cheevo < stop; ++cheevo) @@ -355,7 +355,7 @@ void rcheevos_award_achievement(rcheevos_locals_t* locals, } } - /* Start the award task (unofficial achievement + /* Start the award task (unofficial achievement * unlocks are not submitted). */ if (!(cheevo->active & RCHEEVOS_ACTIVE_UNOFFICIAL)) rcheevos_client_award_achievement(cheevo->id); @@ -406,7 +406,7 @@ void rcheevos_award_achievement(rcheevos_locals_t* locals, static rcheevos_ralboard_t* rcheevos_find_lboard(unsigned id) { rcheevos_ralboard_t* lboard = rcheevos_locals.game.leaderboards; - rcheevos_ralboard_t* stop = lboard + rcheevos_ralboard_t* stop = lboard + rcheevos_locals.game.leaderboard_count; for (; lboard < stop; ++lboard) @@ -631,8 +631,8 @@ static void rcheevos_challenge_started( bool widgets_ready) { settings_t* settings = config_get_ptr(); - if ( cheevo - && widgets_ready + if ( cheevo + && widgets_ready && settings->bools.cheevos_challenge_indicators && rcheevos_is_player_active()) gfx_widgets_set_challenge_display(cheevo->id, cheevo->badge); @@ -741,7 +741,7 @@ void rcheevos_reset_game(bool widgets_ready) rc_runtime_reset(&rcheevos_locals.runtime); - /* Some cores reallocate memory on reset, + /* Some cores reallocate memory on reset, * make sure we update our pointers */ if (rcheevos_locals.memory.total_size > 0) rcheevos_init_memory(&rcheevos_locals); @@ -777,7 +777,7 @@ bool rcheevos_unload(void) { settings_t* settings = config_get_ptr(); - /* Immediately mark the game as unloaded + /* Immediately mark the game as unloaded so the ping thread will terminate normally */ rcheevos_locals.game.id = -1; rcheevos_locals.game.console_id = 0; @@ -877,7 +877,7 @@ bool rcheevos_unload(void) rc_runtime_destroy(&rcheevos_locals.runtime); - /* If the config-level token has been cleared, + /* If the config-level token has been cleared, * we need to re-login on loading the next game */ if (!settings->arrays.cheevos_token[0]) rcheevos_locals.token[0] = '\0'; @@ -889,7 +889,7 @@ bool rcheevos_unload(void) static void rcheevos_toggle_hardcore_achievements( rcheevos_locals_t *locals) { - const unsigned active_mask = + const unsigned active_mask = RCHEEVOS_ACTIVE_SOFTCORE | RCHEEVOS_ACTIVE_HARDCORE | RCHEEVOS_ACTIVE_UNSUPPORTED; rcheevos_racheevo_t* cheevo = locals->game.achievements; rcheevos_racheevo_t* stop = cheevo + locals->game.achievement_count; @@ -956,7 +956,7 @@ static void rcheevos_activate_leaderboards(void) static void rcheevos_deactivate_leaderboards(void) { rcheevos_ralboard_t* lboard = rcheevos_locals.game.leaderboards; - rcheevos_ralboard_t* stop = lboard + + rcheevos_ralboard_t* stop = lboard + rcheevos_locals.game.leaderboard_count; #if defined(HAVE_GFX_WIDGETS) @@ -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) { 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, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); - rcheevos_enforce_hardcore_settings(); + runloop_state_get_ptr()->flags &= ~RUNLOOP_FLAG_SLOWMOTION; /* Reactivate leaderboards */ rcheevos_activate_leaderboards(); @@ -1126,8 +1120,8 @@ void rcheevos_hardcore_enabled_changed(void) * (i.e. cheevos_enable, hardcore_mode_enable) to synchronize the internal state to the configs. * also called when a game is first loaded to synchronize the internal state to the configs. */ const settings_t* settings = config_get_ptr(); - const bool enabled = settings - && settings->bools.cheevos_enable + const bool enabled = settings + && settings->bools.cheevos_enable && settings->bools.cheevos_hardcore_mode_enable; if (enabled != rcheevos_locals.hardcore_active) @@ -1140,21 +1134,19 @@ void rcheevos_hardcore_enabled_changed(void) else 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) - { - /* hardcore enabledness didn't change, but hardcore is active, so make - * sure to enforce the restrictions. */ - rcheevos_enforce_hardcore_settings(); - } + runloop_state_get_ptr()->flags &= ~RUNLOOP_FLAG_SLOWMOTION; } void rcheevos_validate_config_settings(void) { int i; - const rc_disallowed_setting_t + const rc_disallowed_setting_t *disallowed_settings = NULL; core_option_manager_t* coreopts = NULL; - struct retro_system_info *sysinfo = + struct retro_system_info *sysinfo = &runloop_state_get_ptr()->system.info; const settings_t* settings = config_get_ptr(); @@ -1171,7 +1163,7 @@ void rcheevos_validate_config_settings(void) return; } - if (!(disallowed_settings + if (!(disallowed_settings = rc_libretro_get_disallowed_settings(sysinfo->library_name))) return; @@ -1184,7 +1176,7 @@ void rcheevos_validate_config_settings(void) const char* val = core_option_manager_get_val(coreopts, i); 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); CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", buffer); rcheevos_pause_hardcore(); @@ -1308,12 +1300,12 @@ static void rcheevos_validate_memrefs(rcheevos_locals_t* locals) * first call to retro_run. in that case, there will be a total_size * of memory reported by the core, but init will return false, as * all of the pointers were null. if we're still loading the game, - * just reset the memory count and we'll re-evaluate in + * just reset the memory count and we'll re-evaluate in * rcheevos_test() */ if (!locals->loaded) { - /* If no memory was exposed, report the error now + /* If no memory was exposed, report the error now * instead of waiting */ if (locals->memory.total_size != 0) { @@ -1634,8 +1626,8 @@ void rcheevos_show_mastery_placard(void) rcheevos_locals.game.mastery_placard_shown = true; snprintf(title, sizeof(title), - msg_hash_to_str(rcheevos_locals.hardcore_active - ? MSG_CHEEVOS_MASTERED_GAME + msg_hash_to_str(rcheevos_locals.hardcore_active + ? MSG_CHEEVOS_MASTERED_GAME : MSG_CHEEVOS_COMPLETED_GAME), rcheevos_locals.game.title); title[sizeof(title) - 1] = '\0'; @@ -1689,7 +1681,7 @@ static void rcheevos_show_game_placard(void) char msg[256]; const settings_t* settings = config_get_ptr(); const rcheevos_racheevo_t* cheevo = rcheevos_locals.game.achievements; - const rcheevos_racheevo_t* end = cheevo + const rcheevos_racheevo_t* end = cheevo + rcheevos_locals.game.achievement_count; int number_of_active = 0; int number_of_unsupported = 0; @@ -1798,7 +1790,7 @@ static void rcheevos_fetch_badges_callback(void* userdata) static void rcheevos_fetch_badges(void) { - /* this function manages the + /* this function manages the * RCHEEVOS_LOAD_STATE_FETCHING_BADGES state */ rcheevos_client_fetch_badges(rcheevos_fetch_badges_callback, NULL); } @@ -1858,18 +1850,14 @@ static void rcheevos_start_session_async(retro_task_t* task) } #endif + /* If there's nothing for the runtime to process, + * disable hardcore. */ if (!needs_runtime) - { - /* if there's nothing for the runtime to process, - * disable 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) - { - /* hardcore is active. we're going to start processing - * achievements. make sure restrictions are enforced */ - rcheevos_enforce_hardcore_settings(); - } + runloop_state_get_ptr()->flags &= ~RUNLOOP_FLAG_SLOWMOTION; task_set_finished(task, true); @@ -1915,7 +1903,7 @@ static void rcheevos_initialize_runtime_callback(void* userdata) static void rcheevos_fetch_game_data(void) { - if ( rcheevos_locals.load_info.state + if ( rcheevos_locals.load_info.state == RCHEEVOS_LOAD_STATE_NETWORK_ERROR) { rcheevos_locals.game.hash = NULL; @@ -1990,7 +1978,7 @@ struct rcheevos_identify_game_data static void rcheevos_identify_game_callback(void* userdata) { - struct rcheevos_identify_game_data* data = + struct rcheevos_identify_game_data* data = (struct rcheevos_identify_game_data*)userdata; rcheevos_locals.load_info.hashes_tried++; @@ -2167,7 +2155,7 @@ void rcheevos_begin_load_state(enum rcheevos_load_state state) #endif } -/* Decrement and return the outstanding requests counter. +/* Decrement and return the outstanding requests counter. * If non-zero, requests are still outstanding */ int rcheevos_end_load_state(void) { @@ -2192,10 +2180,10 @@ bool rcheevos_load_aborted(void) { /* Unload has been called */ case RCHEEVOS_LOAD_STATE_ABORTED: - /* Unload quit waiting and ran to completion */ + /* Unload quit waiting and ran to completion */ case RCHEEVOS_LOAD_STATE_NONE: /* Login/resolve hash failed after several attempts */ - case RCHEEVOS_LOAD_STATE_NETWORK_ERROR: + case RCHEEVOS_LOAD_STATE_NETWORK_ERROR: return true; default: break; @@ -2208,7 +2196,7 @@ bool rcheevos_load(const void *data) const struct retro_game_info *info = (const struct retro_game_info*) data; settings_t *settings = config_get_ptr(); - bool cheevos_enable = settings + bool cheevos_enable = settings && settings->bools.cheevos_enable; memset(&rcheevos_locals.load_info, 0, @@ -2226,7 +2214,7 @@ bool rcheevos_load(const void *data) #endif rc_runtime_init(&rcheevos_locals.runtime); - /* If achievements are not enabled, or the core doesn't + /* If achievements are not enabled, or the core doesn't * support achievements, disable hardcore and bail */ if (!cheevos_enable || !rcheevos_locals.core_supports || !data) { @@ -2289,11 +2277,11 @@ bool rcheevos_load(const void *data) */ - /* Identify the game and log the user in. + /* Identify the game and log the user in. * These will run asynchronously. */ if (!rcheevos_identify_game(info)) { - /* No hashes could be generated for the game, + /* No hashes could be generated for the game, * disable hardcore and bail */ rcheevos_locals.game.id = 0; rcheevos_end_load_state();