libretro: Move some interface init to retro_init

Apparently fixes rumble.
This commit is contained in:
Connor McLaughlin 2020-11-15 00:11:50 +10:00
parent 65be904d15
commit 5b4cc214c5
3 changed files with 12 additions and 14 deletions

View file

@ -63,21 +63,19 @@ LibretroHostInterface::~LibretroHostInterface()
}
}
void LibretroHostInterface::InitInterfaces()
void LibretroHostInterface::retro_set_environment()
{
SetCoreOptions();
InitDiskControlInterface();
InitLogging();
}
if (!m_interfaces_initialized)
{
InitLogging();
InitRumbleInterface();
void LibretroHostInterface::InitInterfaces()
{
InitRumbleInterface();
unsigned dummy = 0;
m_supports_input_bitmasks = g_retro_environment_callback(RETRO_ENVIRONMENT_GET_INPUT_BITMASKS, &dummy);
m_interfaces_initialized = true;
}
unsigned dummy = 0;
m_supports_input_bitmasks = g_retro_environment_callback(RETRO_ENVIRONMENT_GET_INPUT_BITMASKS, &dummy);
}
void LibretroHostInterface::InitLogging()
@ -100,6 +98,7 @@ bool LibretroHostInterface::Initialize()
if (!HostInterface::Initialize())
return false;
InitInterfaces();
LoadSettings();
FixIncompatibleSettings(true);
UpdateLogging();

View file

@ -11,8 +11,6 @@ public:
LibretroHostInterface();
~LibretroHostInterface() override;
void InitInterfaces();
ALWAYS_INLINE u32 GetResolutionScale() const { return g_settings.gpu_resolution_scale; }
bool Initialize() override;
@ -31,6 +29,7 @@ public:
std::string GetBIOSDirectory() override;
// Called by frontend
void retro_set_environment();
void retro_get_system_av_info(struct retro_system_av_info* info);
bool retro_load_game(const struct retro_game_info* game);
void retro_run_frame();
@ -53,6 +52,7 @@ protected:
private:
bool SetCoreOptions();
bool HasCoreVariablesChanged();
void InitInterfaces();
void InitLogging();
void InitDiskControlInterface();
void InitRumbleInterface();
@ -96,7 +96,6 @@ private:
retro_rumble_interface m_rumble_interface = {};
bool m_rumble_interface_valid = false;
bool m_supports_input_bitmasks = false;
bool m_interfaces_initialized = false;
float m_last_aspect_ratio = 4.0f / 3.0f;
};

View file

@ -124,7 +124,7 @@ RETRO_API size_t retro_get_memory_size(unsigned id)
RETRO_API void retro_set_environment(retro_environment_t f)
{
g_retro_environment_callback = f;
g_libretro_host_interface.InitInterfaces();
g_libretro_host_interface.retro_set_environment();
}
RETRO_API void retro_set_video_refresh(retro_video_refresh_t f)