mirror of
https://github.com/libretro/RetroArch
synced 2025-02-11 15:40:28 +00:00
Cut down on some menu_widgets_ready calls
This commit is contained in:
parent
b4676e3591
commit
20846796cd
@ -75,6 +75,7 @@ struct screenshot_task_state
|
|||||||
char filename[PATH_MAX_LENGTH];
|
char filename[PATH_MAX_LENGTH];
|
||||||
char shotname[256];
|
char shotname[256];
|
||||||
void *userbuf;
|
void *userbuf;
|
||||||
|
bool widgets_ready;
|
||||||
struct scaler_ctx scaler;
|
struct scaler_ctx scaler;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -155,7 +156,7 @@ static void task_screenshot_handler(retro_task_t *task)
|
|||||||
/* If menu widgets are enabled, state is freed
|
/* If menu widgets are enabled, state is freed
|
||||||
in the callback after the notification
|
in the callback after the notification
|
||||||
is displayed */
|
is displayed */
|
||||||
if (!menu_widgets_ready())
|
if (!state->widgets_ready)
|
||||||
#endif
|
#endif
|
||||||
free(state);
|
free(state);
|
||||||
return;
|
return;
|
||||||
@ -200,7 +201,7 @@ static void task_screenshot_callback(retro_task_t *task,
|
|||||||
{
|
{
|
||||||
screenshot_task_state_t *state = (screenshot_task_state_t*)task->state;
|
screenshot_task_state_t *state = (screenshot_task_state_t*)task->state;
|
||||||
|
|
||||||
if (!menu_widgets_ready())
|
if (!state->widgets_ready)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (state && !state->silence)
|
if (state && !state->silence)
|
||||||
@ -247,6 +248,11 @@ static bool screenshot_dump(
|
|||||||
state->pitch = pitch;
|
state->pitch = pitch;
|
||||||
state->frame = frame;
|
state->frame = frame;
|
||||||
state->userbuf = userbuf;
|
state->userbuf = userbuf;
|
||||||
|
#ifdef HAVE_MENU_WIDGETS
|
||||||
|
state->widgets_ready = menu_widgets_ready();
|
||||||
|
#else
|
||||||
|
state->widgets_ready = false;
|
||||||
|
#endif
|
||||||
state->silence = savestate;
|
state->silence = savestate;
|
||||||
state->history_list_enable = settings->bools.history_list_enable;
|
state->history_list_enable = settings->bools.history_list_enable;
|
||||||
state->pixel_format_type = pixel_format_type;
|
state->pixel_format_type = pixel_format_type;
|
||||||
@ -319,7 +325,7 @@ static bool screenshot_dump(
|
|||||||
task->callback = task_screenshot_callback;
|
task->callback = task_screenshot_callback;
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_MENU) && defined(HAVE_MENU_WIDGETS)
|
#if defined(HAVE_MENU) && defined(HAVE_MENU_WIDGETS)
|
||||||
if (menu_widgets_ready() && !savestate)
|
if (state->widgets_ready && !savestate)
|
||||||
task_free_title(task);
|
task_free_title(task);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@ -388,7 +394,8 @@ static bool take_screenshot_viewport(
|
|||||||
if (!screenshot_dump(screenshot_dir,
|
if (!screenshot_dump(screenshot_dir,
|
||||||
name_base,
|
name_base,
|
||||||
buffer, vp.width, vp.height,
|
buffer, vp.width, vp.height,
|
||||||
vp.width * 3, true, buffer, savestate, is_idle, is_paused, fullpath, use_thread,
|
vp.width * 3, true, buffer,
|
||||||
|
savestate, is_idle, is_paused, fullpath, use_thread,
|
||||||
pixel_format_type))
|
pixel_format_type))
|
||||||
{
|
{
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
@ -25,9 +25,9 @@
|
|||||||
#include "../../menu/widgets/menu_widgets.h"
|
#include "../../menu/widgets/menu_widgets.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool connman_cache[256] = {0};
|
static bool connman_cache[256] = {0};
|
||||||
static unsigned connman_counter = 0;
|
static unsigned connman_counter = 0;
|
||||||
static struct string_list* lines;
|
static struct string_list* lines = NULL;
|
||||||
|
|
||||||
static void *connmanctl_init(void)
|
static void *connmanctl_init(void)
|
||||||
{
|
{
|
||||||
@ -65,7 +65,9 @@ static void connmanctl_scan(void)
|
|||||||
|
|
||||||
pclose(popen("connmanctl scan wifi", "r"));
|
pclose(popen("connmanctl scan wifi", "r"));
|
||||||
|
|
||||||
runloop_msg_queue_push("Wi-Fi scan complete.", 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
runloop_msg_queue_push("Wi-Fi scan complete.",
|
||||||
|
1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT,
|
||||||
|
MESSAGE_QUEUE_CATEGORY_INFO);
|
||||||
|
|
||||||
serv_file = popen("connmanctl services", "r");
|
serv_file = popen("connmanctl services", "r");
|
||||||
while (fgets (line, 512, serv_file) != NULL)
|
while (fgets (line, 512, serv_file) != NULL)
|
||||||
@ -100,18 +102,17 @@ static void connmanctl_get_ssids(struct string_list* ssids)
|
|||||||
|
|
||||||
static bool connmanctl_ssid_is_online(unsigned i)
|
static bool connmanctl_ssid_is_online(unsigned i)
|
||||||
{
|
{
|
||||||
char ln[512] = {0};
|
char ln[512] = {0};
|
||||||
char service[128] = {0};
|
char service[128] = {0};
|
||||||
char command[256] = {0};
|
char command[256] = {0};
|
||||||
const char *line = lines->elems[i].data;
|
const char *line = lines->elems[i].data;
|
||||||
FILE *command_file = NULL;
|
FILE *command_file = NULL;
|
||||||
|
|
||||||
if (connman_counter == 60)
|
if (connman_counter == 60)
|
||||||
{
|
{
|
||||||
connman_counter = 0;
|
|
||||||
|
|
||||||
static struct string_list* list = NULL;
|
static struct string_list* list = NULL;
|
||||||
list = string_split(line, " ");
|
connman_counter = 0;
|
||||||
|
list = string_split(line, " ");
|
||||||
if (!list)
|
if (!list)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -124,9 +125,12 @@ static bool connmanctl_ssid_is_online(unsigned i)
|
|||||||
strlcpy(service, list->elems[list->size-1].data, sizeof(service));
|
strlcpy(service, list->elems[list->size-1].data, sizeof(service));
|
||||||
string_list_free(list);
|
string_list_free(list);
|
||||||
|
|
||||||
strlcat(command, "connmanctl services ", sizeof(command));
|
strlcat(command, "connmanctl services ",
|
||||||
strlcat(command, service, sizeof(command));
|
sizeof(command));
|
||||||
strlcat(command, " | grep 'State = \\(online\\|ready\\)'", sizeof(command));
|
strlcat(command, service,
|
||||||
|
sizeof(command));
|
||||||
|
strlcat(command, " | grep 'State = \\(online\\|ready\\)'",
|
||||||
|
sizeof(command));
|
||||||
|
|
||||||
command_file = popen(command, "r");
|
command_file = popen(command, "r");
|
||||||
|
|
||||||
@ -149,22 +153,23 @@ static bool connmanctl_ssid_is_online(unsigned i)
|
|||||||
|
|
||||||
static bool connmanctl_connect_ssid(unsigned i, const char* passphrase)
|
static bool connmanctl_connect_ssid(unsigned i, const char* passphrase)
|
||||||
{
|
{
|
||||||
char ln[512] = {0};
|
char ln[512] = {0};
|
||||||
char name[64] = {0};
|
char name[64] = {0};
|
||||||
char service[128] = {0};
|
char service[128] = {0};
|
||||||
char command[256] = {0};
|
char command[256] = {0};
|
||||||
char settings_dir[PATH_MAX_LENGTH] = {0};
|
char settings_dir[PATH_MAX_LENGTH] = {0};
|
||||||
char settings_path[PATH_MAX_LENGTH] = {0};
|
char settings_path[PATH_MAX_LENGTH] = {0};
|
||||||
FILE *command_file = NULL;
|
FILE *command_file = NULL;
|
||||||
FILE *settings_file = NULL;
|
FILE *settings_file = NULL;
|
||||||
const char *line = lines->elems[i].data;
|
const char *line = lines->elems[i].data;
|
||||||
|
|
||||||
static struct string_list* list = NULL;
|
static struct string_list* list = NULL;
|
||||||
// connmanctl services outputs a 4 character prefixed lines, either whispace
|
/* connmanctl services outputs a 4 character prefixed lines,
|
||||||
// or an identifier. i.e.:
|
* either whitespace or an identifier. i.e.:
|
||||||
// $ connmanctl services
|
* $ connmanctl services
|
||||||
// '*A0 SSID some_unique_id'
|
* '*A0 SSID some_unique_id'
|
||||||
// ' SSID some_another_unique_id'
|
* ' SSID some_another_unique_id'
|
||||||
|
*/
|
||||||
list = string_split(line+4, " ");
|
list = string_split(line+4, " ");
|
||||||
if (!list)
|
if (!list)
|
||||||
return false;
|
return false;
|
||||||
@ -220,7 +225,9 @@ static bool connmanctl_connect_ssid(unsigned i, const char* passphrase)
|
|||||||
#ifdef HAVE_MENU_WIDGETS
|
#ifdef HAVE_MENU_WIDGETS
|
||||||
if (!menu_widgets_ready())
|
if (!menu_widgets_ready())
|
||||||
#endif
|
#endif
|
||||||
runloop_msg_queue_push(ln, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
runloop_msg_queue_push(ln, 1, 180, true,
|
||||||
|
NULL, MESSAGE_QUEUE_ICON_DEFAULT,
|
||||||
|
MESSAGE_QUEUE_CATEGORY_INFO);
|
||||||
}
|
}
|
||||||
pclose(command_file);
|
pclose(command_file);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user