libretro: fix linker error with tests

This commit is contained in:
Eric Warmenhoven 2026-04-07 14:48:49 -04:00 committed by OpenSauce
parent 3d69741076
commit b2faa299d5
3 changed files with 34 additions and 25 deletions

View File

@ -105,31 +105,6 @@ unsigned retro_api_version() {
return RETRO_API_VERSION;
}
void LibRetro::OnConfigureEnvironment() {
#ifdef HAVE_LIBRETRO_VFS
struct retro_vfs_interface_info vfs_iface_info{1, nullptr};
LibRetro::SetVFSCallback(&vfs_iface_info);
#endif
LibRetro::RegisterCoreOptions();
static const struct retro_controller_description controllers[] = {
{"Nintendo 3DS", RETRO_DEVICE_JOYPAD},
};
static const struct retro_controller_info ports[] = {
{controllers, 1},
{nullptr, 0},
};
LibRetro::SetControllerInfo(ports);
}
uintptr_t LibRetro::GetFramebuffer() {
return emu_instance->hw_render.get_current_framebuffer();
}
/**
* Updates Citra's settings with Libretro's.
*/
@ -598,6 +573,7 @@ bool retro_load_game(const struct retro_game_info* info) {
LibRetro::DisplayMessage("Failed to set HW renderer");
return false;
}
LibRetro::SetFramebufferCallback(emu_instance->hw_render.get_current_framebuffer);
#endif
break;
case Settings::GraphicsAPI::Vulkan:

View File

@ -8,6 +8,7 @@
#include "audio_core/libretro_sink.h"
#include "common/scm_rev.h"
#include "core/3ds.h"
#include "core_settings.h"
#include "emu_window/libretro_window.h"
#include "environment.h"
@ -26,6 +27,7 @@ static retro_audio_sample_batch_t audio_batch_cb;
static retro_environment_t environ_cb;
static retro_input_poll_t input_poll_cb;
static retro_input_state_t input_state_cb;
static retro_hw_get_current_framebuffer_t framebuffer_cb;
} // namespace
@ -232,6 +234,34 @@ bool CanUseJIT() {
}
#endif
void OnConfigureEnvironment() {
#ifdef HAVE_LIBRETRO_VFS
struct retro_vfs_interface_info vfs_iface_info{1, nullptr};
SetVFSCallback(&vfs_iface_info);
#endif
RegisterCoreOptions();
static const struct retro_controller_description controllers[] = {
{"Nintendo 3DS", RETRO_DEVICE_JOYPAD},
};
static const struct retro_controller_info ports[] = {
{controllers, 1},
{nullptr, 0},
};
SetControllerInfo(ports);
}
void SetFramebufferCallback(retro_hw_get_current_framebuffer_t cb) {
framebuffer_cb = cb;
}
uintptr_t GetFramebuffer() {
return framebuffer_cb ? framebuffer_cb() : 0;
}
}; // namespace LibRetro
void retro_get_system_info(struct retro_system_info* info) {

View File

@ -109,6 +109,9 @@ bool HasUpdatedConfig();
/// Returns the current framebuffer.
uintptr_t GetFramebuffer();
/// Sets the callback used by GetFramebuffer().
void SetFramebufferCallback(retro_hw_get_current_framebuffer_t cb);
/// Tells the frontend that we are done.
bool Shutdown();