Merge pull request #4794 from fr500/master

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

View File

@ -114,12 +114,13 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
!string_is_equal(state->content_path, "N/A"))
goto no_playlists;
/* Lobby reports content CRC, try to use CRC matching
content with no CRC uses 00000000 */
/* Core requires content */
if (!string_is_equal(state->content_path, "N/A"))
{
/* CRC matching */
if (!string_is_equal(state->content_crc, "00000000|crc"))
{
RARCH_LOG("Using CRC matching\n");
RARCH_LOG("[lobby] testing CRC matching for: %s\n", state->content_crc);
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++)
{
if (string_is_equal(playlist->entries[j].crc32, state->content_crc) &&
strstr(state->core_extensions, path_get_extension(playlist->entries[j].path)))
#if 1
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));
state->found = true;
task_set_data(task, state);
@ -153,22 +157,18 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
free(playlist);
}
}
/* Lobby reports core doesn't need content */
else if(string_is_equal(state->content_path, "N/A"))
/* CRC matching failed, goto filename matching */
if (!state->found)
{
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;
RARCH_LOG("[lobby] CRC matching for: %s failed\n", state->content_crc);
goto filename_matching;
}
/* Lobby reports that the core needs content but
the CRC wasn't reported */
}
/* filename matching*/
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++)
{
playlist_t *playlist = NULL;
@ -190,11 +190,16 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
path_remove_extension(entry);
#if 1
RARCH_LOG("[lobby] playlist filename: %s\n",
playlist->entries[j].path);
#endif
if ( !string_is_empty(entry) &&
string_is_equal(entry, state->content_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));
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));
}
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: