mirror of
https://github.com/libretro/RetroArch
synced 2025-04-07 13:23:32 +00:00
Merge pull request #6509 from Dwedit/master
Make RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE work on the secondary core
This commit is contained in:
commit
19a6375ec6
@ -112,6 +112,7 @@ static void remove_hooks(void)
|
|||||||
current_core.retro_unload_game = originalRetroUnload;
|
current_core.retro_unload_game = originalRetroUnload;
|
||||||
originalRetroUnload = NULL;
|
originalRetroUnload = NULL;
|
||||||
}
|
}
|
||||||
|
current_core.retro_set_environment(rarch_environment_cb);
|
||||||
remove_input_state_hook();
|
remove_input_state_hook();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,6 +135,18 @@ static void deinit_hook(void)
|
|||||||
current_core.retro_deinit();
|
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)
|
static void add_hooks(void)
|
||||||
{
|
{
|
||||||
if (!originalRetroDeinit)
|
if (!originalRetroDeinit)
|
||||||
@ -147,7 +160,7 @@ static void add_hooks(void)
|
|||||||
originalRetroUnload = current_core.retro_unload_game;
|
originalRetroUnload = current_core.retro_unload_game;
|
||||||
current_core.retro_unload_game = unload_hook;
|
current_core.retro_unload_game = unload_hook;
|
||||||
}
|
}
|
||||||
|
current_core.retro_set_environment(env_hook);
|
||||||
add_input_state_hook();
|
add_input_state_hook();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
#include "../paths.h"
|
#include "../paths.h"
|
||||||
#include "../content.h"
|
#include "../content.h"
|
||||||
|
|
||||||
|
#include "secondary_core.h"
|
||||||
|
|
||||||
static int port_map[16];
|
static int port_map[16];
|
||||||
|
|
||||||
static char *secondary_library_path;
|
static char *secondary_library_path;
|
||||||
@ -46,6 +48,8 @@ bool secondary_core_run_no_input_polling(void);
|
|||||||
|
|
||||||
bool secondary_core_deserialize(const void *buffer, int size);
|
bool secondary_core_deserialize(const void *buffer, int size);
|
||||||
|
|
||||||
|
static bool rarch_environment_secondary_core_hook(unsigned cmd, void *data);
|
||||||
|
|
||||||
void secondary_core_destroy(void);
|
void secondary_core_destroy(void);
|
||||||
|
|
||||||
void set_last_core_type(enum rarch_core_type type);
|
void set_last_core_type(enum rarch_core_type type);
|
||||||
@ -205,7 +209,8 @@ bool secondary_core_create(void)
|
|||||||
secondary_core.retro_set_audio_sample_batch(secondary_callbacks.sample_batch_cb);
|
secondary_core.retro_set_audio_sample_batch(secondary_callbacks.sample_batch_cb);
|
||||||
secondary_core.retro_set_input_state(secondary_callbacks.state_cb);
|
secondary_core.retro_set_input_state(secondary_callbacks.state_cb);
|
||||||
secondary_core.retro_set_input_poll(secondary_callbacks.poll_cb);
|
secondary_core.retro_set_input_poll(secondary_callbacks.poll_cb);
|
||||||
secondary_core.retro_set_environment(rarch_environment_cb);
|
secondary_core.retro_set_environment(rarch_environment_secondary_core_hook);
|
||||||
|
secondary_core_set_variable_update();
|
||||||
|
|
||||||
secondary_core.retro_init();
|
secondary_core.retro_init();
|
||||||
|
|
||||||
@ -269,6 +274,26 @@ bool secondary_core_create(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
bool *bool_p = (bool*)data;
|
||||||
|
*bool_p = true;
|
||||||
|
has_variable_update = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void secondary_core_set_variable_update(void)
|
||||||
|
{
|
||||||
|
has_variable_update = true;
|
||||||
|
}
|
||||||
|
|
||||||
bool secondary_core_run_no_input_polling(void)
|
bool secondary_core_run_no_input_polling(void)
|
||||||
{
|
{
|
||||||
if (!secondary_module)
|
if (!secondary_module)
|
||||||
@ -350,5 +375,10 @@ void remember_controller_port_device(long port, long device)
|
|||||||
{
|
{
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
}
|
}
|
||||||
|
void secondary_core_set_variable_update(void)
|
||||||
|
{
|
||||||
|
/* do nothing */
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ void secondary_core_destroy(void);
|
|||||||
void set_last_core_type(enum rarch_core_type type);
|
void set_last_core_type(enum rarch_core_type type);
|
||||||
void remember_controller_port_device(long port, long device);
|
void remember_controller_port_device(long port, long device);
|
||||||
void clear_controller_port_map(void);
|
void clear_controller_port_map(void);
|
||||||
|
void secondary_core_set_variable_update(void);
|
||||||
|
|
||||||
RETRO_END_DECLS
|
RETRO_END_DECLS
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user