1
0
mirror of https://github.com/libretro/RetroArch synced 2025-03-21 04:21:13 +00:00

Merge pull request from fr500/master

Lobby improvements
This commit is contained in:
Twinaphex 2017-04-01 17:53:54 +02:00 committed by GitHub
commit fdae8f4c6d

@ -114,12 +114,13 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
!string_is_equal(state->content_path, "N/A")) !string_is_equal(state->content_path, "N/A"))
goto no_playlists; goto no_playlists;
/* Lobby reports content CRC, try to use CRC matching /* Core requires content */
content with no CRC uses 00000000 */ if (!string_is_equal(state->content_path, "N/A"))
{
/* CRC matching */
if (!string_is_equal(state->content_crc, "00000000|crc")) if (!string_is_equal(state->content_crc, "00000000|crc"))
{ {
RARCH_LOG("[lobby] testing CRC matching for: %s\n", state->content_crc);
RARCH_LOG("Using CRC matching\n");
for (i = 0; i < state->lpl_list->size; i++) for (i = 0; i < state->lpl_list->size; i++)
{ {
@ -133,10 +134,13 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
for (j = 0; j < playlist->size; j++) for (j = 0; j < playlist->size; j++)
{ {
if (string_is_equal(playlist->entries[j].crc32, state->content_crc) && #if 1
strstr(state->core_extensions, path_get_extension(playlist->entries[j].path))) RARCH_LOG("[lobby] playlist CRC: %s\n",
playlist->entries[j].crc32);
#endif
if (string_is_equal(playlist->entries[j].crc32, state->content_crc))
{ {
RARCH_LOG("CRC Match %s\n", playlist->entries[j].crc32); RARCH_LOG("[lobby] CRC match %s\n", playlist->entries[j].crc32);
strlcpy(state->content_path, playlist->entries[j].path, sizeof(state->content_path)); strlcpy(state->content_path, playlist->entries[j].path, sizeof(state->content_path));
state->found = true; state->found = true;
task_set_data(task, state); task_set_data(task, state);
@ -153,22 +157,18 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
free(playlist); free(playlist);
} }
} /* CRC matching failed, goto filename matching */
/* Lobby reports core doesn't need content */ if (!state->found)
else if(string_is_equal(state->content_path, "N/A"))
{ {
state->found = true; RARCH_LOG("[lobby] CRC matching for: %s failed\n", state->content_crc);
task_set_data(task, state); goto filename_matching;
task_set_progress(task, 100);
task_set_title(task, strdup(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND)));
task_set_finished(task, true);
return;
} }
/* Lobby reports that the core needs content but }
the CRC wasn't reported */ /* filename matching*/
else else
{ {
RARCH_LOG("Using filename matching\n"); filename_matching:
RARCH_LOG("[lobby] testing filename matching for: %s\n", state->content_path);
for (i = 0; i < state->lpl_list->size; i++) for (i = 0; i < state->lpl_list->size; i++)
{ {
playlist_t *playlist = NULL; playlist_t *playlist = NULL;
@ -190,11 +190,16 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
path_remove_extension(entry); path_remove_extension(entry);
#if 1
RARCH_LOG("[lobby] playlist filename: %s\n",
playlist->entries[j].path);
#endif
if ( !string_is_empty(entry) && if ( !string_is_empty(entry) &&
string_is_equal(entry, state->content_path) && string_is_equal(entry, state->content_path) &&
strstr(state->core_extensions, path_get_extension(playlist->entries[j].path))) strstr(state->core_extensions, path_get_extension(playlist->entries[j].path)))
{ {
RARCH_LOG("Filename match %s\n", playlist->entries[j].path); RARCH_LOG("[lobby] filename match %s\n", playlist->entries[j].path);
strlcpy(state->content_path, playlist->entries[j].path, sizeof(state->content_path)); strlcpy(state->content_path, playlist->entries[j].path, sizeof(state->content_path));
state->found = true; state->found = true;
@ -209,9 +214,23 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
task_set_progress(task, (int)(j/playlist->size*100.0)); task_set_progress(task, (int)(j/playlist->size*100.0));
} }
free(playlist); free(playlist);
} }
/* filename matching failed */
if (!state->found)
RARCH_LOG("[lobby] filename matching for: %s failed\n", state->content_path);
}
}
/* Lobby reports core doesn't need content */
else
{
state->found = true;
task_set_data(task, state);
task_set_progress(task, 100);
task_set_title(task, strdup(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND)));
task_set_finished(task, true);
return;
} }
no_playlists: no_playlists: