Merge pull request #3935 from leiradel/master

Fix achievements being awarded upon game reset.
This commit is contained in:
Twinaphex 2016-11-04 21:29:44 +01:00 committed by GitHub
commit 1eddb67770
3 changed files with 26 additions and 3 deletions

View File

@ -2499,6 +2499,25 @@ found:
return false;
}
void cheevos_reset_game(void)
{
cheevo_t *cheevo = cheevos_locals.core.cheevos;
const cheevo_t *end = cheevo + cheevos_locals.core.count;
for (; cheevo < end; cheevo++)
{
cheevo->last = 1;
}
cheevo = cheevos_locals.unofficial.cheevos;
end = cheevo + cheevos_locals.unofficial.count;
for (; cheevo < end; cheevo++)
{
cheevo->last = 1;
}
}
void cheevos_populate_menu(void *data)
{
#ifdef HAVE_MENU

View File

@ -41,6 +41,8 @@ typedef struct
bool cheevos_load(const void *data);
void cheevos_reset_game(void);
void cheevos_populate_menu(void *data);
bool cheevos_get_description(cheevos_ctx_desc_t *desc);

View File

@ -44,6 +44,7 @@
#include "verbosity.h"
#include "gfx/video_driver.h"
#include "audio/audio_driver.h"
#include "cheevos.h"
static struct retro_core_t core;
static unsigned core_poll_type;
@ -83,7 +84,7 @@ void core_set_input_state(retro_ctx_input_state_info_t *info)
* core_init_libretro_cbs:
* @data : pointer to retro_callbacks object
*
* Initializes libretro callbacks, and binds the libretro callbacks
* Initializes libretro callbacks, and binds the libretro callbacks
* to default callback functions.
**/
static bool core_init_libretro_cbs(void *data)
@ -355,6 +356,7 @@ bool core_get_system_av_info(struct retro_system_av_info *av_info)
bool core_reset(void)
{
core.retro_reset();
cheevos_reset_game();
return true;
}
@ -435,10 +437,10 @@ bool core_load(void)
bool core_verify_api_version(void)
{
unsigned api_version = core.retro_api_version();
RARCH_LOG("%s: %u\n",
RARCH_LOG("%s: %u\n",
msg_hash_to_str(MSG_VERSION_OF_LIBRETRO_API),
api_version);
RARCH_LOG("%s: %u\n",
RARCH_LOG("%s: %u\n",
msg_hash_to_str(MSG_COMPILED_AGAINST_API),
RETRO_API_VERSION);