Checkpoint: now the core can be loaded with errors (but getting there!)

This commit is contained in:
XargonWan 2025-01-14 14:50:49 +09:00
parent 0fff64f084
commit 9dffd94f24
3 changed files with 8 additions and 4 deletions

View file

@ -53,9 +53,12 @@ void RetroHost::forwarded_input( const godot::Ref<godot::InputEvent> &event )
if(retro_key > RETROK_LAST)
return;
this->core.retro_keyboard_event_callback( key_event->is_pressed(), retro_key,
0, modifiers );
if (this->core.retro_keyboard_event_callback) {
this->core.retro_keyboard_event_callback(key_event->is_pressed(), retro_key, 0, modifiers);
} else {
godot::UtilityFunctions::printerr("[RetroHost] retro_keyboard_event_callback is not set.");
}
keyboard_state[retro_key] = key_event->is_pressed();
}
}

View file

@ -141,6 +141,7 @@ bool RetroHost::load_core(godot::String name)
load_symbol_return_false_on_err(this->core.handle, this->core.retro_run, retro_run);
load_symbol_return_false_on_err(this->core.handle, this->core.retro_load_game, retro_load_game);
load_symbol_return_false_on_err(this->core.handle, this->core.retro_unload_game, retro_unload_game);
load_symbol_return_false_on_err(this->core.handle, this->core.retro_keyboard_event_callback, retro_keyboard_event_callback);
godot::UtilityFunctions::print("[RetroHost] All symbols loaded successfully.");

View file

@ -116,7 +116,7 @@ private:
bool (*retro_load_game)(const struct retro_game_info *game);
void (*retro_unload_game)(void);
retro_keyboard_event_t retro_keyboard_event_callback;
retro_keyboard_event_t retro_keyboard_event_callback = nullptr;
} core;
protected: