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(); SetCoreOptions();
InitDiskControlInterface(); InitDiskControlInterface();
InitLogging();
}
if (!m_interfaces_initialized) void LibretroHostInterface::InitInterfaces()
{ {
InitLogging(); InitRumbleInterface();
InitRumbleInterface();
unsigned dummy = 0; unsigned dummy = 0;
m_supports_input_bitmasks = g_retro_environment_callback(RETRO_ENVIRONMENT_GET_INPUT_BITMASKS, &dummy); m_supports_input_bitmasks = g_retro_environment_callback(RETRO_ENVIRONMENT_GET_INPUT_BITMASKS, &dummy);
m_interfaces_initialized = true;
}
} }
void LibretroHostInterface::InitLogging() void LibretroHostInterface::InitLogging()
@ -100,6 +98,7 @@ bool LibretroHostInterface::Initialize()
if (!HostInterface::Initialize()) if (!HostInterface::Initialize())
return false; return false;
InitInterfaces();
LoadSettings(); LoadSettings();
FixIncompatibleSettings(true); FixIncompatibleSettings(true);
UpdateLogging(); UpdateLogging();

View File

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