Added a define to save the achievements JSON

This commit is contained in:
Andre Leiradella 2017-04-29 14:37:09 +01:00
parent 6930262ec2
commit 8a50b7373b

View File

@ -65,6 +65,10 @@
* from retroachievements.org. */
#undef CHEEVOS_JSON_OVERRIDE
/* Define this macro with a string to save the JSON file to disk with
* that name. */
#define CHEEVOS_SAVE_JSON "megamanx11.json"
/* Define this macro to have the password and token logged. THIS WILL DISCLOSE
* THE USER'S PASSWORD, TAKE CARE! */
#undef CHEEVOS_LOG_PASSWORD
@ -3103,6 +3107,13 @@ found:
if (cheevos_get_by_game_id(&json, game_id, &timeout) == 0 && json != NULL)
#endif
{
#ifdef CHEEVOS_SAVE_JSON
{
FILE* file = fopen(CHEEVOS_SAVE_JSON, "w");
fwrite((void*)json, 1, strlen(json), file);
fclose(file);
}
#endif
if (!settings->bools.cheevos_enable || !cheevos_parse(json))
{
cheevos_deactivate_unlocks(game_id, &timeout);