mirror of
https://github.com/libretro/RetroArch
synced 2025-03-23 19:21:03 +00:00
Don't use structs in global_t. Also simplifies the async wifi code.
This commit is contained in:
parent
bb7a96e9a8
commit
99ab41be4a
@ -69,6 +69,7 @@
|
||||
#include "../list_special.h"
|
||||
#include "../performance_counters.h"
|
||||
#include "../core_info.h"
|
||||
#include "../wifi/wifi_driver.h"
|
||||
#include "../tasks/tasks_internal.h"
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
@ -4893,12 +4894,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
0, 0, 0);
|
||||
else
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
struct string_list *ssid_list = string_list_new();
|
||||
driver_wifi_get_ssids(ssid_list);
|
||||
|
||||
if (!global)
|
||||
break;
|
||||
|
||||
if (global->ssid_list->size == 0)
|
||||
if (ssid_list->size == 0)
|
||||
{
|
||||
task_push_wifi_scan();
|
||||
|
||||
@ -4911,9 +4910,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
else
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < global->ssid_list->size; i++)
|
||||
for (i = 0; i < ssid_list->size; i++)
|
||||
{
|
||||
const char *ssid = global->ssid_list->elems[i].data;
|
||||
const char *ssid = ssid_list->elems[i].data;
|
||||
menu_entries_append_enum(info->list,
|
||||
ssid,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CONNECT_WIFI),
|
||||
|
@ -1011,10 +1011,6 @@ bool retroarch_main_init(int argc, char *argv[])
|
||||
{
|
||||
bool init_failed = false;
|
||||
|
||||
global_t *global = global_get_ptr();
|
||||
if (global)
|
||||
global->ssid_list = string_list_new();
|
||||
|
||||
retroarch_init_state();
|
||||
|
||||
if (setjmp(error_sjlj_context) > 0)
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <boolean.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <retro_common_api.h>
|
||||
#include <lists/string_list.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
@ -192,8 +191,6 @@ typedef struct global
|
||||
bool flickerfilter_enable;
|
||||
bool softfilter_enable;
|
||||
} console;
|
||||
|
||||
struct string_list *ssid_list;
|
||||
} global_t;
|
||||
|
||||
typedef struct runloop_ctx_msg_info
|
||||
|
@ -43,12 +43,11 @@ static void wifi_scan_callback(void *task_data,
|
||||
const char *path = NULL;
|
||||
const char *label = NULL;
|
||||
enum msg_hash_enums enum_idx = MSG_UNKNOWN;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
menu_entries_get_last_stack(&path, &label, &menu_type, &enum_idx, NULL);
|
||||
|
||||
/* Don't push the results if we left the wifi menu */
|
||||
if (!global || !string_is_equal(label,
|
||||
if (!string_is_equal(label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_WIFI_SETTINGS_LIST)))
|
||||
return;
|
||||
|
||||
@ -56,10 +55,13 @@ static void wifi_scan_callback(void *task_data,
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, file_list);
|
||||
|
||||
struct string_list *ssid_list = string_list_new();
|
||||
driver_wifi_get_ssids(ssid_list);
|
||||
|
||||
unsigned i;
|
||||
for (i = 0; i < global->ssid_list->size; i++)
|
||||
for (i = 0; i < ssid_list->size; i++)
|
||||
{
|
||||
const char *ssid = global->ssid_list->elems[i].data;
|
||||
const char *ssid = ssid_list->elems[i].data;
|
||||
menu_entries_append_enum(file_list,
|
||||
ssid,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CONNECT_WIFI),
|
||||
@ -70,17 +72,12 @@ static void wifi_scan_callback(void *task_data,
|
||||
|
||||
static void task_wifi_scan_handler(retro_task_t *task)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
wifi_handle_t *state = (wifi_handle_t*)task->state;
|
||||
|
||||
driver_wifi_scan();
|
||||
task->progress = 50;
|
||||
task->title = strdup("Parsing SSID list...");
|
||||
driver_wifi_get_ssids(global->ssid_list);
|
||||
task->progress = 100;
|
||||
task->title = strdup("Wi-Fi scan complete");
|
||||
task->finished = true;
|
||||
task->task_data = state;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -81,6 +81,9 @@ static void connmanctl_get_ssids(struct string_list* ssids)
|
||||
union string_list_elem_attr attr;
|
||||
attr.i = RARCH_FILETYPE_UNSET;
|
||||
|
||||
if (!lines)
|
||||
return;
|
||||
|
||||
for (i = 0; i < lines->size; i++)
|
||||
{
|
||||
char ssid[20];
|
||||
|
Loading…
x
Reference in New Issue
Block a user