mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
Get rid of superfluous get_ai_service_auto/set_ai_service_auto get/set
wrapper functions
This commit is contained in:
parent
af01b97a11
commit
aeb3f692d5
46
retroarch.c
46
retroarch.c
@ -4704,17 +4704,6 @@ error:
|
||||
|
||||
/* TRANSLATION */
|
||||
#ifdef HAVE_TRANSLATE
|
||||
static int get_ai_service_auto(void)
|
||||
{
|
||||
return g_ai_service_auto;
|
||||
}
|
||||
|
||||
static bool set_ai_service_auto(int num)
|
||||
{
|
||||
g_ai_service_auto = num;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool task_auto_translate_callback(void)
|
||||
{
|
||||
bool was_paused = runloop_paused;
|
||||
@ -4766,11 +4755,13 @@ static void task_auto_translate_handler(retro_task_t *task)
|
||||
#endif
|
||||
}
|
||||
return;
|
||||
|
||||
task_finished:
|
||||
if (get_ai_service_auto() == 1)
|
||||
set_ai_service_auto(2);
|
||||
if (g_ai_service_auto == 1)
|
||||
g_ai_service_auto = 2;
|
||||
|
||||
task_set_finished(task, true);
|
||||
|
||||
if (*mode_ptr == 1 || *mode_ptr == 2)
|
||||
task_auto_translate_callback();
|
||||
if (task->user_data)
|
||||
@ -4785,8 +4776,8 @@ static bool call_auto_translate_task(bool* was_paused)
|
||||
/*Image Mode*/
|
||||
if (ai_service_mode == 0)
|
||||
{
|
||||
if (get_ai_service_auto() == 1)
|
||||
set_ai_service_auto(2);
|
||||
if (g_ai_service_auto == 1)
|
||||
g_ai_service_auto = 2;
|
||||
|
||||
command_event(CMD_EVENT_AI_SERVICE_CALL, was_paused);
|
||||
return true;
|
||||
@ -4843,7 +4834,7 @@ static void handle_translation_cb(
|
||||
|
||||
#ifdef GFX_MENU_WIDGETS
|
||||
if (gfx_widgets_ai_service_overlay_get_state() != 0
|
||||
&& get_ai_service_auto() == 2)
|
||||
&& g_ai_service_auto == 2)
|
||||
{
|
||||
/* When auto mode is on, we turn off the overlay
|
||||
* once we have the result for the next call.*/
|
||||
@ -4852,7 +4843,7 @@ static void handle_translation_cb(
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
if (get_ai_service_auto() != 2)
|
||||
if (g_ai_service_auto != 2)
|
||||
RARCH_LOG("RESULT FROM AI SERVICE...\n");
|
||||
#endif
|
||||
|
||||
@ -4980,7 +4971,7 @@ static void handle_translation_cb(
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!raw_image_file_data && !raw_sound_data && !text_string && get_ai_service_auto() != 2 && !key_string)
|
||||
if (!raw_image_file_data && !raw_sound_data && !text_string && g_ai_service_auto != 2 && !key_string)
|
||||
{
|
||||
error = "Invalid JSON body.";
|
||||
goto finish;
|
||||
@ -5325,7 +5316,7 @@ finish:
|
||||
|
||||
if (string_is_equal(auto_string, "auto"))
|
||||
{
|
||||
if (get_ai_service_auto() != 0 && !settings->bools.ai_service_pause)
|
||||
if (g_ai_service_auto != 0 && !settings->bools.ai_service_pause)
|
||||
call_auto_translate_task(&was_paused);
|
||||
}
|
||||
if (auto_string)
|
||||
@ -5546,7 +5537,7 @@ static bool run_translation_service(bool paused)
|
||||
core_info_t *core_info = NULL;
|
||||
|
||||
#ifdef HAVE_GFX_WIDGETS
|
||||
if (gfx_widgets_ai_service_overlay_get_state() != 0 && get_ai_service_auto() == 1)
|
||||
if (gfx_widgets_ai_service_overlay_get_state() != 0 && g_ai_service_auto == 1)
|
||||
{
|
||||
/* For the case when ai service pause is disabled. */
|
||||
gfx_widgets_ai_service_overlay_unload();
|
||||
@ -5799,7 +5790,7 @@ static bool run_translation_service(bool paused)
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (get_ai_service_auto()!=2)
|
||||
if (g_ai_service_auto != 2)
|
||||
RARCH_LOG("Request size: %d\n", out_length);
|
||||
#endif
|
||||
{
|
||||
@ -5894,7 +5885,7 @@ static bool run_translation_service(bool paused)
|
||||
sizeof(new_ai_service_url));
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (get_ai_service_auto() != 2)
|
||||
if (g_ai_service_auto != 2)
|
||||
RARCH_LOG("SENDING... %s\n", new_ai_service_url);
|
||||
#endif
|
||||
task_push_http_post_transfer(new_ai_service_url,
|
||||
@ -7178,11 +7169,11 @@ bool command_event(enum event_command cmd, void *data)
|
||||
* Also, this mode is required for "auto" translation
|
||||
* packages, since you don't want to pause for that.
|
||||
*/
|
||||
if (get_ai_service_auto() == 2)
|
||||
if (g_ai_service_auto == 2)
|
||||
{
|
||||
/* Auto mode was turned on, but we pressed the
|
||||
* toggle button, so turn it off now. */
|
||||
set_ai_service_auto(0);
|
||||
g_ai_service_auto = 0;
|
||||
#ifdef HAVE_MENU_WIDGETS
|
||||
gfx_widgets_ai_service_overlay_unload();
|
||||
#endif
|
||||
@ -8506,9 +8497,9 @@ bool command_event(enum event_command cmd, void *data)
|
||||
if (data!=NULL)
|
||||
paused = *((bool*)data);
|
||||
|
||||
if (get_ai_service_auto() == 0 && !settings->bools.ai_service_pause)
|
||||
set_ai_service_auto(1);
|
||||
if (get_ai_service_auto() != 2)
|
||||
if (g_ai_service_auto == 0 && !settings->bools.ai_service_pause)
|
||||
g_ai_service_auto = 1;
|
||||
if (g_ai_service_auto != 2)
|
||||
RARCH_LOG("AI Service Called...\n");
|
||||
run_translation_service(paused);
|
||||
}
|
||||
@ -17548,6 +17539,7 @@ void input_keyboard_event(bool down, unsigned code,
|
||||
if (code != 303 && code != 0)
|
||||
{
|
||||
char* say_char = (char*)malloc(sizeof(char)+1);
|
||||
|
||||
if (say_char)
|
||||
{
|
||||
char c = (char) character;
|
||||
|
Loading…
x
Reference in New Issue
Block a user