mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
Merge pull request #11474 from jdgleaver/ai-service-fixes
AI Service fixes
This commit is contained in:
commit
9b58163a0e
@ -2631,7 +2631,7 @@ static bool accessibility_speak_unix(int speed,
|
|||||||
{
|
{
|
||||||
/* check if old pid is running */
|
/* check if old pid is running */
|
||||||
if (is_narrator_running_unix())
|
if (is_narrator_running_unix())
|
||||||
return true;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (speak_pid > 0)
|
if (speak_pid > 0)
|
||||||
@ -2665,6 +2665,12 @@ static bool accessibility_speak_unix(int speed,
|
|||||||
cmd[3] = (char*)speak_text;
|
cmd[3] = (char*)speak_text;
|
||||||
execvp("espeak", cmd);
|
execvp("espeak", cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
if (voice_out)
|
||||||
|
free(voice_out);
|
||||||
|
if (speed_out)
|
||||||
|
free(speed_out);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -413,7 +413,7 @@ uint8_t* rpng_save_image_bgr24_string(const uint8_t *data,
|
|||||||
buf = (uint8_t*)malloc(buf_length*sizeof(uint8_t));
|
buf = (uint8_t*)malloc(buf_length*sizeof(uint8_t));
|
||||||
if (!buf)
|
if (!buf)
|
||||||
GOTO_END_ERROR();
|
GOTO_END_ERROR();
|
||||||
|
|
||||||
intf_s = intfstream_open_writable_memory(buf,
|
intf_s = intfstream_open_writable_memory(buf,
|
||||||
RETRO_VFS_FILE_ACCESS_WRITE,
|
RETRO_VFS_FILE_ACCESS_WRITE,
|
||||||
RETRO_VFS_FILE_ACCESS_HINT_NONE,
|
RETRO_VFS_FILE_ACCESS_HINT_NONE,
|
||||||
@ -433,7 +433,10 @@ end:
|
|||||||
if (buf)
|
if (buf)
|
||||||
free(buf);
|
free(buf);
|
||||||
if (intf_s)
|
if (intf_s)
|
||||||
|
{
|
||||||
|
intfstream_close(intf_s);
|
||||||
free(intf_s);
|
free(intf_s);
|
||||||
|
}
|
||||||
if (ret == false)
|
if (ret == false)
|
||||||
{
|
{
|
||||||
if (output)
|
if (output)
|
||||||
|
@ -95,7 +95,8 @@ enum rwav_state rwav_iterate(rwav_iterator_t *iter)
|
|||||||
|
|
||||||
rwav->subchunk2size = data[40] | data[41] << 8 | data[42] << 16 | data[43] << 24;
|
rwav->subchunk2size = data[40] | data[41] << 8 | data[42] << 16 | data[43] << 24;
|
||||||
|
|
||||||
if (rwav->subchunk2size > iter->size - 44)
|
if ((rwav->subchunk2size < 1) ||
|
||||||
|
(rwav->subchunk2size > iter->size - 44))
|
||||||
return RWAV_ITERATE_ERROR; /* too few bytes in buffer */
|
return RWAV_ITERATE_ERROR; /* too few bytes in buffer */
|
||||||
|
|
||||||
samples = malloc(rwav->subchunk2size);
|
samples = malloc(rwav->subchunk2size);
|
||||||
|
77
retroarch.c
77
retroarch.c
@ -13721,41 +13721,27 @@ static void handle_translation_cb(
|
|||||||
curr_state = 0;
|
curr_state = 0;
|
||||||
}
|
}
|
||||||
else if (string_is_equal(found_string, "image"))
|
else if (string_is_equal(found_string, "image"))
|
||||||
{
|
|
||||||
curr_state = 1;
|
curr_state = 1;
|
||||||
free(found_string);
|
|
||||||
}
|
|
||||||
else if (string_is_equal(found_string, "sound"))
|
else if (string_is_equal(found_string, "sound"))
|
||||||
{
|
|
||||||
curr_state = 2;
|
curr_state = 2;
|
||||||
free(found_string);
|
|
||||||
}
|
|
||||||
else if (string_is_equal(found_string, "text"))
|
else if (string_is_equal(found_string, "text"))
|
||||||
{
|
|
||||||
curr_state = 3;
|
curr_state = 3;
|
||||||
free(found_string);
|
|
||||||
}
|
|
||||||
else if (string_is_equal(found_string, "error"))
|
else if (string_is_equal(found_string, "error"))
|
||||||
{
|
|
||||||
curr_state = 4;
|
curr_state = 4;
|
||||||
free(found_string);
|
|
||||||
}
|
|
||||||
else if (string_is_equal(found_string, "auto"))
|
else if (string_is_equal(found_string, "auto"))
|
||||||
{
|
|
||||||
curr_state = 5;
|
curr_state = 5;
|
||||||
free(found_string);
|
|
||||||
}
|
|
||||||
else if (string_is_equal(found_string, "press"))
|
else if (string_is_equal(found_string, "press"))
|
||||||
{
|
|
||||||
curr_state = 6;
|
curr_state = 6;
|
||||||
free(found_string);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
curr_state = 0;
|
||||||
curr_state = 0;
|
|
||||||
free(found_string);
|
|
||||||
}
|
|
||||||
start = -1;
|
start = -1;
|
||||||
|
|
||||||
|
if (found_string)
|
||||||
|
{
|
||||||
|
free(found_string);
|
||||||
|
found_string = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
@ -13766,8 +13752,13 @@ static void handle_translation_cb(
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
RARCH_LOG("No text found...\n");
|
RARCH_LOG("No text found...\n");
|
||||||
#endif
|
#endif
|
||||||
if (!text_string)
|
if (text_string)
|
||||||
text_string = (char*)malloc(15);
|
{
|
||||||
|
free(text_string);
|
||||||
|
text_string = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
text_string = (char*)malloc(15);
|
||||||
|
|
||||||
strlcpy(text_string, err_string, 15);
|
strlcpy(text_string, err_string, 15);
|
||||||
#ifdef HAVE_GFX_WIDGETS
|
#ifdef HAVE_GFX_WIDGETS
|
||||||
@ -13989,15 +13980,6 @@ static void handle_translation_cb(
|
|||||||
if (raw_sound_data)
|
if (raw_sound_data)
|
||||||
{
|
{
|
||||||
audio_mixer_stream_params_t params;
|
audio_mixer_stream_params_t params;
|
||||||
nbio_buf_t *task_data = (nbio_buf_t*)malloc(sizeof(nbio_buf_t));
|
|
||||||
nbio_buf_t *img = (nbio_buf_t*)task_data;
|
|
||||||
|
|
||||||
task_data->buf = raw_sound_data;
|
|
||||||
task_data->bufsize = new_sound_size;
|
|
||||||
task_data->path = NULL;
|
|
||||||
|
|
||||||
if (!img)
|
|
||||||
return;
|
|
||||||
|
|
||||||
params.volume = 1.0f;
|
params.volume = 1.0f;
|
||||||
params.slot_selection_type = AUDIO_MIXER_SLOT_SELECTION_MANUAL; /* user->slot_selection_type; */
|
params.slot_selection_type = AUDIO_MIXER_SLOT_SELECTION_MANUAL; /* user->slot_selection_type; */
|
||||||
@ -14005,18 +13987,18 @@ static void handle_translation_cb(
|
|||||||
params.stream_type = AUDIO_STREAM_TYPE_SYSTEM; /* user->stream_type; */
|
params.stream_type = AUDIO_STREAM_TYPE_SYSTEM; /* user->stream_type; */
|
||||||
params.type = AUDIO_MIXER_TYPE_WAV;
|
params.type = AUDIO_MIXER_TYPE_WAV;
|
||||||
params.state = AUDIO_STREAM_STATE_PLAYING;
|
params.state = AUDIO_STREAM_STATE_PLAYING;
|
||||||
params.buf = img->buf;
|
params.buf = raw_sound_data;
|
||||||
params.bufsize = img->bufsize;
|
params.bufsize = new_sound_size;
|
||||||
params.cb = NULL;
|
params.cb = NULL;
|
||||||
params.basename = NULL;
|
params.basename = NULL;
|
||||||
|
|
||||||
audio_driver_mixer_add_stream(¶ms);
|
audio_driver_mixer_add_stream(¶ms);
|
||||||
|
|
||||||
if (img->path)
|
if (raw_sound_data)
|
||||||
free(img->path);
|
{
|
||||||
if (params.basename)
|
free(raw_sound_data);
|
||||||
free(params.basename);
|
raw_sound_data = NULL;
|
||||||
free(img);
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -14127,6 +14109,8 @@ finish:
|
|||||||
free(err_string);
|
free(err_string);
|
||||||
if (text_string)
|
if (text_string)
|
||||||
free(text_string);
|
free(text_string);
|
||||||
|
if (found_string)
|
||||||
|
free(found_string);
|
||||||
if (raw_output_data)
|
if (raw_output_data)
|
||||||
free(raw_output_data);
|
free(raw_output_data);
|
||||||
|
|
||||||
@ -14537,10 +14521,10 @@ static bool run_translation_service(
|
|||||||
if (rf3[i] == '\"')
|
if (rf3[i] == '\"')
|
||||||
rf3[i] = ' ';
|
rf3[i] = ' ';
|
||||||
}
|
}
|
||||||
json_length = 11 + out_length + 15 + system_label_len;
|
json_length = 11 + out_length + 15 + system_label_len + 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
json_length = 11 + out_length + 1;
|
json_length = 11 + out_length + 2;
|
||||||
|
|
||||||
state_son = (char*)malloc(state_son_length);
|
state_son = (char*)malloc(state_son_length);
|
||||||
|
|
||||||
@ -14596,6 +14580,8 @@ static bool run_translation_service(
|
|||||||
if (!json_buffer)
|
if (!json_buffer)
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
||||||
|
json_buffer[json_length - 1] = '\0';
|
||||||
|
|
||||||
/* Image data */
|
/* Image data */
|
||||||
memcpy(json_buffer, (const void*)rf1, 11 * sizeof(uint8_t));
|
memcpy(json_buffer, (const void*)rf1, 11 * sizeof(uint8_t));
|
||||||
memcpy(json_buffer + 11, bmp64_buffer, out_length * sizeof(uint8_t));
|
memcpy(json_buffer + 11, bmp64_buffer, out_length * sizeof(uint8_t));
|
||||||
@ -14611,6 +14597,7 @@ static bool run_translation_service(
|
|||||||
if (rf3)
|
if (rf3)
|
||||||
{
|
{
|
||||||
size_t system_label_len = strlen(system_label);
|
size_t system_label_len = strlen(system_label);
|
||||||
|
|
||||||
memcpy(json_buffer + curr_length,
|
memcpy(json_buffer + curr_length,
|
||||||
(const void*)rf3,
|
(const void*)rf3,
|
||||||
(15 + system_label_len) * sizeof(uint8_t));
|
(15 + system_label_len) * sizeof(uint8_t));
|
||||||
@ -31041,6 +31028,12 @@ bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params)
|
|||||||
{
|
{
|
||||||
case AUDIO_MIXER_TYPE_WAV:
|
case AUDIO_MIXER_TYPE_WAV:
|
||||||
handle = audio_mixer_load_wav(buf, (int32_t)params->bufsize);
|
handle = audio_mixer_load_wav(buf, (int32_t)params->bufsize);
|
||||||
|
/* WAV is a special case - input buffer is not
|
||||||
|
* free()'d when sound playback is complete (it is
|
||||||
|
* converted to a PCM buffer, which is free()'d instead),
|
||||||
|
* so have to do it here */
|
||||||
|
free(buf);
|
||||||
|
buf = NULL;
|
||||||
break;
|
break;
|
||||||
case AUDIO_MIXER_TYPE_OGG:
|
case AUDIO_MIXER_TYPE_OGG:
|
||||||
handle = audio_mixer_load_ogg(buf, (int32_t)params->bufsize);
|
handle = audio_mixer_load_ogg(buf, (int32_t)params->bufsize);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user