Merge pull request #6772 from Dwedit/env-hook-fix

Fix full-screen mode change breaking Secondary Core's environment variables
This commit is contained in:
Twinaphex 2018-05-13 05:29:28 +02:00 committed by GitHub
commit 5e7ea8de19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 19 deletions

View File

@ -29,6 +29,10 @@
#include "../verbosity.h"
#ifdef HAVE_RUNAHEAD
#include "../runahead/secondary_core.h"
#endif
static bool core_option_manager_parse_variable(
core_option_manager_t *opt, size_t idx,
const struct retro_variable *var)
@ -128,6 +132,13 @@ void core_option_manager_get(core_option_manager_t *opt, void *data)
if (!opt)
return;
#ifdef HAVE_RUNAHEAD
if (opt->updated)
{
secondary_core_set_variable_update();
}
#endif
opt->updated = false;
for (i = 0; i < opt->size; i++)

View File

@ -116,7 +116,6 @@ static void remove_hooks(void)
current_core.retro_unload_game = originalRetroUnload;
originalRetroUnload = NULL;
}
current_core.retro_set_environment(rarch_environment_cb);
remove_input_state_hook();
}
@ -139,18 +138,6 @@ static void deinit_hook(void)
current_core.retro_deinit();
}
static bool env_hook(unsigned cmd, void *data)
{
bool result = rarch_environment_cb(cmd, data);
if (cmd == RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE && result)
{
bool *bool_p = (bool*)data;
if (*bool_p == true)
secondary_core_set_variable_update();
}
return result;
}
static void add_hooks(void)
{
if (!originalRetroDeinit)
@ -164,7 +151,6 @@ static void add_hooks(void)
originalRetroUnload = current_core.retro_unload_game;
current_core.retro_unload_game = unload_hook;
}
current_core.retro_set_environment(env_hook);
add_input_state_hook();
}

View File

@ -278,12 +278,19 @@ static bool has_variable_update;
static bool rarch_environment_secondary_core_hook(unsigned cmd, void *data)
{
bool result = rarch_environment_cb(cmd, data);
if (cmd == RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE && has_variable_update)
if (has_variable_update)
{
bool *bool_p = (bool*)data;
*bool_p = true;
has_variable_update = false;
return true;
if (cmd == RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE)
{
bool *bool_p = (bool*)data;
*bool_p = true;
has_variable_update = false;
return true;
}
else if (cmd == RETRO_ENVIRONMENT_GET_VARIABLE)
{
has_variable_update = false;
}
}
return result;
}