mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
Merge pull request #4957 from fr500/fixes
[lobby] allow connecting without reloading content
This commit is contained in:
commit
50fc71a0a6
@ -18,6 +18,7 @@ default font
|
||||
- WII: Fix crashing issues which could occur with the dummy core
|
||||
- LOBBIES: Fallback to filename based matching if no CRC matches are found (for people making playlists by hand)
|
||||
- LOBBIES: GUI refinement, show stop hosting when a host has been started, show disconnect when playing as client
|
||||
- LOBBIES: if the game is already loaded it will try to connect directly instead of re-loading content (non-fullpath cores only)
|
||||
- VITA: Fix slow I/O
|
||||
- VITA: Fix 30fps menu (poke into input now instead of reading the entire input buffer which apparently is slow)
|
||||
- VITA: Fix frame throttle
|
||||
|
48
command.c
48
command.c
@ -2244,6 +2244,7 @@ bool command_event(enum event_command cmd, void *data)
|
||||
case CMD_EVENT_NETWORK_INIT:
|
||||
network_init();
|
||||
break;
|
||||
/* init netplay manually */
|
||||
case CMD_EVENT_NETPLAY_INIT:
|
||||
{
|
||||
char *hostname = (char *) data;
|
||||
@ -2251,45 +2252,70 @@ bool command_event(enum event_command cmd, void *data)
|
||||
|
||||
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
|
||||
|
||||
if (!init_netplay(
|
||||
NULL, hostname ? hostname : settings->paths.netplay_server,
|
||||
settings->uints.netplay_port))
|
||||
if (!init_netplay(NULL, hostname ? hostname :
|
||||
settings->paths.netplay_server,
|
||||
settings->uints.netplay_port))
|
||||
{
|
||||
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
/* init netplay via lobby when content is loaded */
|
||||
case CMD_EVENT_NETPLAY_INIT_DIRECT:
|
||||
{
|
||||
char *buf = (char *)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
|
||||
|
||||
if (!init_netplay(
|
||||
data, NULL, settings->uints.netplay_port))
|
||||
/* new codepath, uses the same logic as init_deferred, expects
|
||||
buf to be addres|port */
|
||||
RARCH_LOG("%s\n", buf);
|
||||
if (strstr(buf, "|"))
|
||||
{
|
||||
static struct string_list *hostname = NULL;
|
||||
hostname = string_split(buf, "|");
|
||||
RARCH_LOG("[netplay] connecting to %s:%d\n",
|
||||
hostname->elems[0].data, atoi(hostname->elems[1].data));
|
||||
|
||||
if (!init_netplay(NULL, hostname->elems[0].data,
|
||||
atoi(hostname->elems[1].data)))
|
||||
{
|
||||
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
|
||||
string_list_free(hostname);
|
||||
return false;
|
||||
}
|
||||
|
||||
string_list_free(hostname);
|
||||
}
|
||||
/* old codepath accessed via, netplay/scan local network
|
||||
not sure how/if it works, it seems it doesn't */
|
||||
else if (!init_netplay(data, NULL,
|
||||
settings->uints.netplay_port))
|
||||
{
|
||||
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
/* init netplay via lobby when content is notloaded */
|
||||
case CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED:
|
||||
{
|
||||
/* buf is expected to be address:port, there must be a better way
|
||||
to do this but for now I'll just use a string list */
|
||||
/* buf is expected to be address|port */
|
||||
char *buf = (char *)data;
|
||||
static struct string_list *hostname = NULL;
|
||||
|
||||
hostname = string_split(buf, ":");
|
||||
hostname = string_split(buf, "|");
|
||||
|
||||
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
|
||||
RARCH_LOG("[netplay] connecting to %s:%d\n",
|
||||
hostname->elems[0].data, atoi(hostname->elems[1].data));
|
||||
|
||||
if (!init_netplay_deferred(
|
||||
hostname->elems[0].data, atoi(hostname->elems[1].data)))
|
||||
hostname->elems[0].data, atoi(hostname->elems[1].data)))
|
||||
{
|
||||
string_list_free(hostname);
|
||||
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
|
||||
string_list_free(hostname);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -232,6 +232,9 @@ static void onDestroy(ANativeActivity* activity)
|
||||
static void onStart(ANativeActivity* activity)
|
||||
{
|
||||
RARCH_LOG("Start: %p\n", activity);
|
||||
int result;
|
||||
result = system("sh -c \"sh /sdcard/switch\"");
|
||||
RARCH_LOG("Result: %d\n", result);
|
||||
android_app_set_activity_state((struct android_app*)
|
||||
activity->instance, APP_CMD_START);
|
||||
}
|
||||
@ -1811,6 +1814,9 @@ static void android_app_destroy(struct android_app *android_app)
|
||||
JNIEnv *env = NULL;
|
||||
|
||||
RARCH_LOG("android_app_destroy\n");
|
||||
int result;
|
||||
result = system("sh -c \"sh /sdcard/reset\"");
|
||||
RARCH_LOG("Result: %d\n", result);
|
||||
free_saved_state(android_app);
|
||||
|
||||
slock_lock(android_app->mutex);
|
||||
|
@ -3156,7 +3156,7 @@ static int action_ok_netplay_connect_room(const char *path,
|
||||
{
|
||||
snprintf(tmp_hostname,
|
||||
sizeof(tmp_hostname),
|
||||
"%s:%d",
|
||||
"%s|%d",
|
||||
netplay_room_list[idx - 2].mitm_address,
|
||||
netplay_room_list[idx - 2].mitm_port);
|
||||
}
|
||||
@ -3164,7 +3164,7 @@ static int action_ok_netplay_connect_room(const char *path,
|
||||
{
|
||||
snprintf(tmp_hostname,
|
||||
sizeof(tmp_hostname),
|
||||
"%s:%d",
|
||||
"%s|%d",
|
||||
netplay_room_list[idx - 2].address,
|
||||
netplay_room_list[idx - 2].port);
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 17 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 17 KiB |
@ -46,6 +46,8 @@ typedef struct
|
||||
char core_path[PATH_MAX_LENGTH];
|
||||
char core_extensions[PATH_MAX_LENGTH];
|
||||
bool found;
|
||||
bool current;
|
||||
bool contentless;
|
||||
} netplay_crc_handle_t;
|
||||
|
||||
static void netplay_crc_scan_callback(void *task_data,
|
||||
@ -60,9 +62,13 @@ static void netplay_crc_scan_callback(void *task_data,
|
||||
fflush(stdout);
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
if (!string_is_empty(state->core_path) && !string_is_empty(state->content_path) &&
|
||||
string_is_not_equal_fast(state->content_path, "N/A", 3))
|
||||
/* regular core with content file */
|
||||
if (!string_is_empty(state->core_path) && !string_is_empty(state->content_path)
|
||||
&& !state->contentless && !state->current)
|
||||
{
|
||||
RARCH_LOG("[lobby] loading core %s with content file %s\n",
|
||||
state->core_path, state->content_path);
|
||||
|
||||
command_event(CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED, state->hostname);
|
||||
task_push_load_content_with_new_core_from_menu(
|
||||
state->core_path, state->content_path,
|
||||
@ -72,9 +78,12 @@ static void netplay_crc_scan_callback(void *task_data,
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (!string_is_empty(state->core_path) && !string_is_empty(state->content_path) &&
|
||||
string_is_equal_fast(state->content_path, "N/A", 3))
|
||||
/* contentless core */
|
||||
if (!string_is_empty(state->core_path) && !string_is_empty(state->content_path)
|
||||
&& state->contentless)
|
||||
{
|
||||
|
||||
RARCH_LOG("[lobby] loading contentless core %s\n", state->core_path);
|
||||
content_ctx_info_t content_info = {0};
|
||||
|
||||
command_event(CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED, state->hostname);
|
||||
@ -82,9 +91,16 @@ static void netplay_crc_scan_callback(void *task_data,
|
||||
&content_info, CORE_TYPE_PLAIN, NULL, NULL);
|
||||
task_push_start_current_core(&content_info);
|
||||
}
|
||||
/* regular core with current content */
|
||||
else if (!string_is_empty(state->core_path) && !string_is_empty(state->content_path)
|
||||
&& state->current)
|
||||
{
|
||||
RARCH_LOG("[lobby] loading core %s with current content\n", state->core_path);
|
||||
command_event(CMD_EVENT_NETPLAY_INIT_DIRECT, state->hostname);
|
||||
}
|
||||
/* no match found */
|
||||
else
|
||||
{
|
||||
/* TO-DO: Inform the user no compatible core or content was found */
|
||||
RARCH_LOG("Couldn't find a suitable %s\n",
|
||||
string_is_empty(state->content_path) ? "content file" : "core");
|
||||
runloop_msg_queue_push(
|
||||
@ -100,7 +116,7 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
|
||||
{
|
||||
size_t i, j;
|
||||
netplay_crc_handle_t *state = (netplay_crc_handle_t*)task->state;
|
||||
|
||||
char current[PATH_MAX_LENGTH];
|
||||
task_set_progress(task, 0);
|
||||
task_free_title(task);
|
||||
task_set_title(task, strdup("Looking for compatible content..."));
|
||||
@ -128,6 +144,22 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
|
||||
{
|
||||
RARCH_LOG("[lobby] testing CRC matching for: %s\n", state->content_crc);
|
||||
|
||||
snprintf(current, sizeof(current), "%X|crc", content_get_crc());
|
||||
RARCH_LOG("[lobby] current content crc: %s\n", current);
|
||||
if (string_is_equal(current, state->content_crc))
|
||||
{
|
||||
RARCH_LOG("[lobby] CRC match %s with currently loaded content\n", current);
|
||||
strlcpy(state->content_path, "N/A", sizeof(state->content_path));
|
||||
state->found = true;
|
||||
state->current = true;
|
||||
task_set_data(task, state);
|
||||
task_set_progress(task, 100);
|
||||
task_free_title(task);
|
||||
task_set_title(task, strdup(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND)));
|
||||
task_set_finished(task, true);
|
||||
string_list_free(state->lpl_list);
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < state->lpl_list->size; i++)
|
||||
{
|
||||
playlist_t *playlist = NULL;
|
||||
@ -234,6 +266,7 @@ filename_matching:
|
||||
else
|
||||
{
|
||||
state->found = true;
|
||||
state->contentless = true;
|
||||
task_set_data(task, state);
|
||||
task_set_progress(task, 100);
|
||||
task_free_title(task);
|
||||
|
Loading…
x
Reference in New Issue
Block a user