(Netplay) Disallow netplay start when content is not loaded for static core platforms (#14220)

This commit is contained in:
Cthulhu-throwaway 2022-07-26 02:21:57 -03:00 committed by GitHub
parent 8ac1a36259
commit 8d4a64ab96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 57 additions and 13 deletions

View File

@ -11487,6 +11487,10 @@ MSG_HASH( /* FIXME Should be MSG_ */
MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED, MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED,
"Netplay will start when content is loaded." "Netplay will start when content is loaded."
) )
MSG_HASH(
MSG_NETPLAY_NEED_CONTENT_LOADED,
"Content must be loaded before starting netplay."
)
MSG_HASH( /* FIXME Should be MSG_ */ MSG_HASH( /* FIXME Should be MSG_ */
MENU_ENUM_LABEL_VALUE_NETPLAY_LOAD_CONTENT_MANUALLY, MENU_ENUM_LABEL_VALUE_NETPLAY_LOAD_CONTENT_MANUALLY,
"Couldn't find a suitable core or content file, load manually." "Couldn't find a suitable core or content file, load manually."

View File

@ -7367,6 +7367,7 @@ static void action_ok_netplay_enable_client_hostname_cb(void *userdata,
{ {
if (!task_push_netplay_content_reload(line)) if (!task_push_netplay_content_reload(line))
{ {
#ifdef HAVE_DYNAMIC
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL); command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL); netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL);
command_event(CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED, (void*)line); command_event(CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED, (void*)line);
@ -7375,10 +7376,20 @@ static void action_ok_netplay_enable_client_hostname_cb(void *userdata,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED),
1, 480, true, NULL, 1, 480, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} #else
runloop_msg_queue_push(
msg_hash_to_str(MSG_NETPLAY_NEED_CONTENT_LOADED),
1, 480, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#endif
menu_input_dialog_end(); menu_input_dialog_end();
retroarch_menu_running_finished(false); }
else
{
menu_input_dialog_end();
retroarch_menu_running_finished(false);
}
} }
else else
menu_input_dialog_end(); menu_input_dialog_end();

View File

@ -179,6 +179,7 @@ enum msg_hash_enums
MSG_SETTING_DISK_IN_TRAY, MSG_SETTING_DISK_IN_TRAY,
MSG_FAILED_TO_SET_DISK, MSG_FAILED_TO_SET_DISK,
MSG_FAILED_TO_SET_INITIAL_DISK, MSG_FAILED_TO_SET_INITIAL_DISK,
MSG_NETPLAY_NEED_CONTENT_LOADED,
MSG_FAILED_TO_CONNECT_TO_CLIENT, MSG_FAILED_TO_CONNECT_TO_CLIENT,
MSG_FAILED_TO_CONNECT_TO_HOST, MSG_FAILED_TO_CONNECT_TO_HOST,
MSG_NETPLAY_HOST_FULL, MSG_NETPLAY_HOST_FULL,

View File

@ -2876,6 +2876,7 @@ bool command_event(enum event_command cmd, void *data)
{ {
if (!task_push_netplay_content_reload(NULL)) if (!task_push_netplay_content_reload(NULL))
{ {
#ifdef HAVE_DYNAMIC
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL); command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_SERVER, NULL); netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_SERVER, NULL);
@ -2883,6 +2884,12 @@ bool command_event(enum event_command cmd, void *data)
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED),
1, 480, true, NULL, 1, 480, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#else
runloop_msg_queue_push(
msg_hash_to_str(MSG_NETPLAY_NEED_CONTENT_LOADED),
1, 480, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#endif
return false; return false;
} }

View File

@ -471,15 +471,16 @@ static bool static_load(const char *core, const char *subsystem,
if (!string_is_empty(subsystem)) if (!string_is_empty(subsystem))
{ {
const struct string_list *subsystem_content =
(const struct string_list*)content;
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_ADD_FORK_ARG, ARG("--subsystem")) || if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_ADD_FORK_ARG, ARG("--subsystem")) ||
!netplay_driver_ctl(RARCH_NETPLAY_CTL_ADD_FORK_ARG, ARG(subsystem))) !netplay_driver_ctl(RARCH_NETPLAY_CTL_ADD_FORK_ARG, ARG(subsystem)))
goto failure; goto failure;
if (content) if (subsystem_content && subsystem_content->size > 0)
{ {
size_t i; size_t i;
const struct string_list *subsystem_content =
(const struct string_list*)content;
for (i = 0; i < subsystem_content->size; i++) for (i = 0; i < subsystem_content->size; i++)
{ {
@ -488,11 +489,28 @@ static bool static_load(const char *core, const char *subsystem,
goto failure; goto failure;
} }
} }
#ifdef HAVE_MENU
else
{
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_ADD_FORK_ARG, ARG("--menu")))
goto failure;
}
#endif
} }
else if (content) else
{ {
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_ADD_FORK_ARG, ARG(content))) if (content)
goto failure; {
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_ADD_FORK_ARG, ARG(content)))
goto failure;
}
#ifdef HAVE_MENU
else
{
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_ADD_FORK_ARG, ARG("--menu")))
goto failure;
}
#endif
} }
if (!frontend_driver_set_fork(FRONTEND_FORK_CORE_WITH_ARGS)) if (!frontend_driver_set_fork(FRONTEND_FORK_CORE_WITH_ARGS))
@ -688,14 +706,17 @@ static void task_netplay_crc_scan_callback(retro_task_t *task,
content_clear_subsystem(); content_clear_subsystem();
content_set_subsystem_by_name(data->current.subsystem); content_set_subsystem_by_name(data->current.subsystem);
} }
#else
if (static_load(data->core, data->current.subsystem, NULL,
data->hostname))
#endif
runloop_msg_queue_push( runloop_msg_queue_push(
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED),
1, 480, true, NULL, 1, 480, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#else
runloop_msg_queue_push(
msg_hash_to_str(MSG_NETPLAY_NEED_CONTENT_LOADED),
1, 480, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#endif
} }
else else
RARCH_WARN("[Lobby] Nothing to load.\n"); RARCH_WARN("[Lobby] Nothing to load.\n");