diff --git a/src/libretro_core.cpp b/src/libretro_core.cpp index 8da43d4c..2da4ff93 100644 --- a/src/libretro_core.cpp +++ b/src/libretro_core.cpp @@ -1,10 +1,11 @@ +#include +#include +#include + #include -#include #include -#include #include -#include static retro_environment_t envCallbacks; static retro_video_refresh_t videoCallbacks; @@ -20,11 +21,17 @@ static bool screenTouched; std::unique_ptr emulator; RendererGL* renderer; -std::filesystem::path Emulator::getConfigPath() { return std::filesystem::path(savePath / "config.toml"); } +std::filesystem::path Emulator::getConfigPath() { + return std::filesystem::path(savePath / "config.toml"); +} -std::filesystem::path Emulator::getAppDataRoot() { return std::filesystem::path(savePath / "Emulator Files"); } +std::filesystem::path Emulator::getAppDataRoot() { + return std::filesystem::path(savePath / "Emulator Files"); +} -static void* GetGLProcAddress(const char* name) { return (void*)hw_render.get_proc_address(name); } +static void* GetGLProcAddress(const char* name) { + return (void*)hw_render.get_proc_address(name); +} static void VideoResetContext() { #ifdef USING_GLES @@ -40,7 +47,9 @@ static void VideoResetContext() { emulator->initGraphicsContext(nullptr); } -static void VideoDestroyContext() { emulator->deinitGraphicsContext(); } +static void VideoDestroyContext() { + emulator->deinitGraphicsContext(); +} static bool SetHWRender(retro_hw_context_type type) { hw_render.context_type = type; @@ -133,13 +142,15 @@ static std::string FetchVariable(std::string key, std::string def) { return std::string(var.value); } -static bool FetchVariableBool(std::string key, bool def) { return FetchVariable(key, def ? "enabled" : "disabled") == "enabled"; } +static bool FetchVariableBool(std::string key, bool def) { + return FetchVariable(key, def ? "enabled" : "disabled") == "enabled"; +} static void configInit() { static const retro_variable values[] = { {"panda3ds_use_shader_jit", "Enable shader JIT; enabled|disabled"}, {"panda3ds_accurate_shader_mul", "Enable accurate shader multiplication; disabled|enabled"}, - {"panda3ds_use_ubershader", defaultShaderMode == ShaderMode::Ubershader ? "Use ubershaders (No stutter, maybe slower); enabled|disabled" + {"panda3ds_use_ubershader", EmulatorConfig::defaultShaderMode == ShaderMode::Ubershader ? "Use ubershaders (No stutter, maybe slower); enabled|disabled" : "Use ubershaders (No stutter, maybe slower); disabled|enabled"}, {"panda3ds_use_vsync", "Enable VSync; enabled|disabled"}, {"panda3ds_dsp_emulation", "DSP emulation; Null|HLE|LLE"}, @@ -208,17 +219,27 @@ void retro_get_system_av_info(retro_system_av_info* info) { info->timing.sample_rate = 32768; } -void retro_set_environment(retro_environment_t cb) { envCallbacks = cb; } +void retro_set_environment(retro_environment_t cb) { + envCallbacks = cb; +} -void retro_set_video_refresh(retro_video_refresh_t cb) { videoCallbacks = cb; } +void retro_set_video_refresh(retro_video_refresh_t cb) { + videoCallbacks = cb; +} -void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb) { audioBatchCallback = cb; } +void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb) { + audioBatchCallback = cb; +} void retro_set_audio_sample(retro_audio_sample_t cb) {} -void retro_set_input_poll(retro_input_poll_t cb) { inputPollCallback = cb; } +void retro_set_input_poll(retro_input_poll_t cb) { + inputPollCallback = cb; +} -void retro_set_input_state(retro_input_state_t cb) { inputStateCallback = cb; } +void retro_set_input_state(retro_input_state_t cb) { + inputStateCallback = cb; +} void retro_init() { enum retro_pixel_format xrgb888 = RETRO_PIXEL_FORMAT_XRGB8888; @@ -236,7 +257,9 @@ void retro_init() { emulator = std::make_unique(); } -void retro_deinit() { emulator = nullptr; } +void retro_deinit() { + emulator = nullptr; +} bool retro_load_game(const retro_game_info* game) { configInit(); @@ -262,7 +285,9 @@ void retro_unload_game() { renderer = nullptr; } -void retro_reset() { emulator->reset(Emulator::ReloadOption::Reload); } +void retro_reset() { + emulator->reset(Emulator::ReloadOption::Reload); +} void retro_run() { ConfigCheckVariables(); @@ -377,4 +402,6 @@ void retro_cheat_set(uint index, bool enabled, const char* code) { } } -void retro_cheat_reset() { emulator->getCheats().reset(); } +void retro_cheat_reset() { + emulator->getCheats().reset(); +}