diff --git a/tasks/task_autodetect_blissbox.c b/tasks/task_autodetect_blissbox.c index 83a81e15dd..00ebb554cd 100644 --- a/tasks/task_autodetect_blissbox.c +++ b/tasks/task_autodetect_blissbox.c @@ -496,8 +496,8 @@ static const blissbox_pad_type_t* input_autoconfigure_get_blissbox_pad_type(int #endif } -void input_autoconfigure_blissbox_override_handler( - int vid, int pid, char *device_name, size_t len) +void input_autoconfigure_blissbox_override_handler(int vid, int pid, + char *s, size_t len) { if (pid == BLISSBOX_UPDATE_MODE_PID) RARCH_LOG("[Autoconf]: Bliss-Box in update mode detected. Ignoring.\n"); @@ -522,10 +522,8 @@ void input_autoconfigure_blissbox_override_handler( /* override name given to autoconfig so it knows what kind of pad this is */ if (len > 0) { - size_t _len = strlcpy(device_name, "Bliss-Box 4-Play ", len); - strlcpy(device_name + _len, - pad->name, - len - _len); + size_t _len = strlcpy(s, "Bliss-Box 4-Play ", len); + strlcpy(s + _len, pad->name, len - _len); } blissbox_pads[index] = pad; diff --git a/tasks/task_cloudsync.c b/tasks/task_cloudsync.c index a7e014f949..a8148c5da0 100644 --- a/tasks/task_cloudsync.c +++ b/tasks/task_cloudsync.c @@ -177,8 +177,7 @@ static file_list_t *task_cloud_sync_create_manifest(RFILE *file) static void task_cloud_sync_manifest_filename(char *s, size_t len, bool server) { - settings_t *settings = config_get_ptr(); - const char *path_dir_core_assets = settings->paths.directory_core_assets; + const char *path_dir_core_assets = config_get_ptr()->paths.directory_core_assets; fill_pathname_join_special(s, path_dir_core_assets, server ? MANIFEST_FILENAME_SERVER : MANIFEST_FILENAME_LOCAL, len); @@ -523,8 +522,7 @@ static void task_cloud_sync_backup_file(struct item_file *file) char new_dir[DIR_MAX_LENGTH]; char backup_dir[DIR_MAX_LENGTH]; char new_path[PATH_MAX_LENGTH]; - settings_t *settings = config_get_ptr(); - const char *path_dir_core_assets = settings->paths.directory_core_assets; + const char *path_dir_core_assets = config_get_ptr()->paths.directory_core_assets; time_t cur_time = time(NULL); rtime_localtime(&cur_time, &tm_); @@ -584,7 +582,7 @@ static void task_cloud_sync_fetch_server_file(task_cloud_sync_state_t *sync_stat const char *key = CS_FILE_KEY(server_file); /* the key from the server file is in "portable" format, use '/' */ const char *path = strchr(key, '/') + 1; - settings_t *settings = config_get_ptr(); + settings_t *settings = config_get_ptr(); /* we're just fetching a file the server has, we can update this now */ task_cloud_sync_add_to_updated_manifest(sync_state, key, CS_FILE_HASH(server_file), true); @@ -741,12 +739,12 @@ static void task_cloud_sync_upload_current_file(task_cloud_sync_state_t *sync_st static void task_cloud_sync_delete_current_file(task_cloud_sync_state_t *sync_state) { - struct item_file *item = &sync_state->current_manifest->list[sync_state->current_idx]; - settings_t *settings = config_get_ptr(); + struct item_file *item = &sync_state->current_manifest->list[sync_state->current_idx]; + bool cloud_sync_destructive = config_get_ptr()->bools.cloud_sync_destructive; RARCH_WARN(CSPFX "server has deleted %s, so shall we\n", CS_FILE_KEY(item)); - if (settings->bools.cloud_sync_destructive) + if (cloud_sync_destructive) filestream_delete(item->path); else task_cloud_sync_backup_file(item); @@ -1237,13 +1235,13 @@ static bool task_cloud_sync_task_finder(retro_task_t *task, void *user_data) void task_push_cloud_sync(void) { - settings_t *settings = config_get_ptr(); + char task_title[128]; task_finder_data_t find_data; task_cloud_sync_state_t *sync_state = NULL; retro_task_t *task = NULL; - char task_title[128]; + bool cloud_sync_enable = config_get_ptr()->bools.cloud_sync_enable; - if (!settings->bools.cloud_sync_enable) + if (!cloud_sync_enable) return; if (!tcs_running_lock) @@ -1266,7 +1264,7 @@ void task_push_cloud_sync(void) return; } - sync_state->phase = CLOUD_SYNC_PHASE_BEGIN; + sync_state->phase = CLOUD_SYNC_PHASE_BEGIN; sync_state->start_time = cpu_features_get_time_usec(); strlcpy(task_title, "Cloud Sync in progress", sizeof(task_title)); diff --git a/tasks/task_translation.c b/tasks/task_translation.c index 94680b9763..d4fb7eec5a 100644 --- a/tasks/task_translation.c +++ b/tasks/task_translation.c @@ -56,7 +56,7 @@ static void task_auto_translate_handler(retro_task_t *task) uint32_t runloop_flags = runloop_get_flags(); access_state_t *access_st = access_state_get_ptr(); #ifdef HAVE_ACCESSIBILITY - settings_t *settings = config_get_ptr(); + bool accessibility_enable = config_get_ptr()->bools.accessibility_enable; #endif uint8_t flg = task_get_flags(task); @@ -73,8 +73,7 @@ static void task_auto_translate_handler(retro_task_t *task) break; case 2: /* Narrator Mode */ #ifdef HAVE_ACCESSIBILITY - if (!is_narrator_running( - settings->bools.accessibility_enable)) + if (!is_narrator_running(accessibility_enable)) goto task_finished; #endif break; @@ -99,13 +98,9 @@ task_finished: free(task->user_data); } -static void call_auto_translate_task( - settings_t *settings, - bool *was_paused) +static void ai_service_call_auto_translate_task(access_state_t *access_st, + int ai_service_mode, bool *was_paused) { - int ai_service_mode = settings->uints.ai_service_mode; - access_state_t *access_st = access_state_get_ptr(); - /*Image Mode*/ if (ai_service_mode == 0) { @@ -116,21 +111,21 @@ static void call_auto_translate_task( } else /* Speech or Narrator Mode */ { - int* mode = NULL; - retro_task_t *t = task_init(); + int* mode = NULL; + retro_task_t *t = task_init(); if (!t) return; - mode = (int*)malloc(sizeof(int)); + mode = (int*)malloc(sizeof(int)); - t->user_data = NULL; - t->handler = task_auto_translate_handler; - t->flags |= RETRO_TASK_FLG_MUTE; + t->user_data = NULL; + t->handler = task_auto_translate_handler; + t->flags |= RETRO_TASK_FLG_MUTE; if (mode) { - *mode = ai_service_mode; - t->user_data = mode; + *mode = ai_service_mode; + t->user_data = mode; } task_queue_push(t); @@ -173,6 +168,8 @@ static void handle_translation_cb( VIDEO_FLAG_WIDGETS_PAUSED) ? true : false; dispgfx_widget_t *p_dispwidget = dispwidget_get_ptr(); #endif + bool ai_service_pause = settings->bools.ai_service_pause; + unsigned ai_service_mode = settings->uints.ai_service_mode; #ifdef HAVE_ACCESSIBILITY bool accessibility_enable = settings->bools.accessibility_enable; unsigned accessibility_narrator_speech_speed = settings->uints.accessibility_narrator_speech_speed; @@ -356,16 +353,16 @@ static void handle_translation_cb( { /* Get image data (24 bit), and convert to the emulated pixel format */ image_width = - ((uint32_t) ((uint8_t)raw_image_file_data[21]) << 24) + - ((uint32_t) ((uint8_t)raw_image_file_data[20]) << 16) + - ((uint32_t) ((uint8_t)raw_image_file_data[19]) << 8) + - ((uint32_t) ((uint8_t)raw_image_file_data[18]) << 0); + ((uint32_t) ((uint8_t)raw_image_file_data[21]) << 24) + + ((uint32_t) ((uint8_t)raw_image_file_data[20]) << 16) + + ((uint32_t) ((uint8_t)raw_image_file_data[19]) << 8) + + ((uint32_t) ((uint8_t)raw_image_file_data[18]) << 0); image_height = - ((uint32_t) ((uint8_t)raw_image_file_data[25]) << 24) + - ((uint32_t) ((uint8_t)raw_image_file_data[24]) << 16) + - ((uint32_t) ((uint8_t)raw_image_file_data[23]) << 8) + - ((uint32_t) ((uint8_t)raw_image_file_data[22]) << 0); + ((uint32_t) ((uint8_t)raw_image_file_data[25]) << 24) + + ((uint32_t) ((uint8_t)raw_image_file_data[24]) << 16) + + ((uint32_t) ((uint8_t)raw_image_file_data[23]) << 8) + + ((uint32_t) ((uint8_t)raw_image_file_data[22]) << 0); raw_image_data = (void*)malloc(image_width * image_height * 3 * sizeof(uint8_t)); if (raw_image_data) memcpy(raw_image_data, @@ -380,15 +377,15 @@ static void handle_translation_cb( int retval = 0; rpng_t *rpng = NULL; image_width = - ((uint32_t) ((uint8_t)raw_image_file_data[16]) << 24)+ - ((uint32_t) ((uint8_t)raw_image_file_data[17]) << 16)+ - ((uint32_t) ((uint8_t)raw_image_file_data[18]) << 8)+ - ((uint32_t) ((uint8_t)raw_image_file_data[19]) << 0); + ((uint32_t) ((uint8_t)raw_image_file_data[16]) << 24) + + ((uint32_t) ((uint8_t)raw_image_file_data[17]) << 16) + + ((uint32_t) ((uint8_t)raw_image_file_data[18]) << 8) + + ((uint32_t) ((uint8_t)raw_image_file_data[19]) << 0); image_height = - ((uint32_t) ((uint8_t)raw_image_file_data[20]) << 24)+ - ((uint32_t) ((uint8_t)raw_image_file_data[21]) << 16)+ - ((uint32_t) ((uint8_t)raw_image_file_data[22]) << 8)+ - ((uint32_t) ((uint8_t)raw_image_file_data[23]) << 0); + ((uint32_t) ((uint8_t)raw_image_file_data[20]) << 24) + + ((uint32_t) ((uint8_t)raw_image_file_data[21]) << 16) + + ((uint32_t) ((uint8_t)raw_image_file_data[22]) << 8) + + ((uint32_t) ((uint8_t)raw_image_file_data[23]) << 0); if (!(rpng = rpng_alloc())) { @@ -421,7 +418,8 @@ static void handle_translation_cb( tc = d % 3; th = image_height-d / (image_width * 3) - 1; tw = (d % (image_width * 3)) / 3; - ((uint8_t*) raw_image_data)[tw * 3 + th * 3 * image_width + tc] = ((uint8_t *)raw_image_data_alpha)[ui]; + ((uint8_t*) raw_image_data)[tw * 3 + th * 3 * image_width + tc] = + ((uint8_t *)raw_image_data_alpha)[ui]; d += 1; } } @@ -588,8 +586,7 @@ static void handle_translation_cb( #ifdef HAVE_ACCESSIBILITY if ( txt_str && is_accessibility_enabled( - accessibility_enable, - access_st->enabled)) + accessibility_enable, access_st->enabled)) accessibility_speak_priority( accessibility_enable, accessibility_narrator_speech_speed, @@ -626,8 +623,9 @@ finish: { bool was_paused = (runloop_flags & RUNLOOP_FLAG_PAUSED) ? true : false; if ( (access_st->ai_service_auto != 0) - && !settings->bools.ai_service_pause) - call_auto_translate_task(settings, &was_paused); + && !ai_service_pause) + ai_service_call_auto_translate_task(access_st, ai_service_mode, + &was_paused); } free(auto_str); }