From 8a50b7373b71d4d3c68f64242104170bde677b78 Mon Sep 17 00:00:00 2001 From: Andre Leiradella Date: Sat, 29 Apr 2017 14:37:09 +0100 Subject: [PATCH] Added a define to save the achievements JSON --- cheevos/cheevos.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index c623a1bbce..02951df521 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -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);