mirror of https://github.com/mgba-emu/mgba.git
Libretro: Only set camera peripheral when it is available (#1931)
Otherwise, if the frontend does not support GET_CAMERA_INTERFACE, the start and stop functions are NULL, causing a crash when a gameboy ROM is unloaded.
This commit is contained in:
parent
f75a4d304b
commit
82f3432e7a
|
@ -606,9 +606,10 @@ bool retro_load_game(const struct retro_game_info* game) {
|
|||
cam.width = GBCAM_WIDTH;
|
||||
cam.caps = 1 << RETRO_CAMERA_BUFFER_RAW_FRAMEBUFFER;
|
||||
cam.frame_raw_framebuffer = _updateCamera;
|
||||
if (environCallback(RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE, &cam)) {
|
||||
core->setPeripheral(core, mPERIPH_IMAGE_SOURCE, &imageSource);
|
||||
}
|
||||
|
||||
environCallback(RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE, &cam);
|
||||
const char* modelName = mCoreConfigGetValue(&core->config, "gb.model");
|
||||
struct GB* gb = core->board;
|
||||
|
||||
|
|
Loading…
Reference in New Issue