mirror of
https://github.com/libretro/RetroArch
synced 2025-02-11 15:40:28 +00:00
Merge pull request #2244 from leiradel/master
even better error handling
This commit is contained in:
commit
c943822002
39
cheevos.c
39
cheevos.c
@ -560,7 +560,7 @@ static int new_cheevo( cheevos_readud_t* ud )
|
|||||||
cheevo->badge = dupstr( &ud->badge );
|
cheevo->badge = dupstr( &ud->badge );
|
||||||
cheevo->points = strtol( ud->points.string, NULL, 10 );
|
cheevo->points = strtol( ud->points.string, NULL, 10 );
|
||||||
cheevo->dirty = 0;
|
cheevo->dirty = 0;
|
||||||
cheevo->active = flags == 3;
|
cheevo->active = 1; /* flags == 3; */
|
||||||
cheevo->modified = 0;
|
cheevo->modified = 0;
|
||||||
|
|
||||||
if ( !cheevo->title || !cheevo->description || !cheevo->author || !cheevo->badge )
|
if ( !cheevo->title || !cheevo->description || !cheevo->author || !cheevo->badge )
|
||||||
@ -1328,9 +1328,10 @@ static int cheevos_login( void )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RARCH_LOG( "CHEEVOS error getting user token\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
RARCH_LOG( "CHEEVOS error getting user token\n" );
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1338,24 +1339,26 @@ int cheevos_get_by_game_id( const char** json, unsigned game_id )
|
|||||||
{
|
{
|
||||||
char request[ 256 ];
|
char request[ 256 ];
|
||||||
|
|
||||||
cheevos_login();
|
if ( !cheevos_login() )
|
||||||
|
|
||||||
snprintf(
|
|
||||||
request, sizeof( request ),
|
|
||||||
"http://retroachievements.org/dorequest.php?r=patch&u=%s&g=%u&f=3&l=1&t=%s",
|
|
||||||
config_get_ptr()->cheevos.user_name, game_id, token
|
|
||||||
);
|
|
||||||
|
|
||||||
request[ sizeof( request ) - 1 ] = 0;
|
|
||||||
*json = cheevos_http_get( request, NULL );
|
|
||||||
|
|
||||||
if ( *json )
|
|
||||||
{
|
{
|
||||||
RARCH_LOG( "CHEEVOS got achievements for game id %u\n", game_id );
|
snprintf(
|
||||||
return 0;
|
request, sizeof( request ),
|
||||||
|
"http://retroachievements.org/dorequest.php?r=patch&u=%s&g=%u&f=3&l=1&t=%s",
|
||||||
|
config_get_ptr()->cheevos.user_name, game_id, token
|
||||||
|
);
|
||||||
|
|
||||||
|
request[ sizeof( request ) - 1 ] = 0;
|
||||||
|
*json = cheevos_http_get( request, NULL );
|
||||||
|
|
||||||
|
if ( *json )
|
||||||
|
{
|
||||||
|
RARCH_LOG( "CHEEVOS got achievements for game id %u\n", game_id );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
RARCH_LOG( "CHEEVOS error getting achievements for game id %u\n", game_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
RARCH_LOG( "CHEEVOS error getting achievements for game id %u\n", game_id );
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1439,5 +1442,5 @@ int cheevos_get_by_content( const char** json, const void* data, size_t size )
|
|||||||
game_id = cheevos_get_game_id( hash );
|
game_id = cheevos_get_game_id( hash );
|
||||||
}
|
}
|
||||||
|
|
||||||
return cheevos_get_by_game_id( json, game_id );
|
return game_id ? cheevos_get_by_game_id( json, game_id ) : -1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user