kodi-game / game.libretro

Libretro compatibility layer for the Kodi Game API
GNU General Public License v2.0
37 stars 26 forks source link

Move callback initialization after retro_init() #121

Closed garbear closed 6 months ago

garbear commented 6 months ago

Description

This PR splits CLibretroEnvironment::Initialize() into two functions:

The purpose is to move callback initialization after retro_init(). Setting callbacks before retro_init() causes Mesen to crash.

Upon inspection of RetroArch, their code sets callbacks after retro_init() also, so this should be a safe move.

Motivation and context

Reported here: https://forum.kodi.tv/showthread.php?tid=173361&pid=3180238#pid3180238

How has this been tested?

Before: Mesen segfaults when setting callbacks

After: Mesen loads successfully

garbear commented 6 months ago

Confirmed working here: https://forum.kodi.tv/showthread.php?tid=173361&pid=3180858#pid3180858

I'll get this fix in to the latest Nexus and Omega releases.