From b627240a0efe43872975318bd6232537d5f57096 Mon Sep 17 00:00:00 2001 From: cpasjuste Date: Thu, 18 Apr 2024 10:46:50 +0200 Subject: [PATCH] config: fix crash when config file doesn't exists cmake: fix deps (linux) mpv: fixes for v0.38.0 --- src/skeleton/CMakeLists.txt | 4 +++- src/skeleton/mpv.cpp | 9 +++++++++ src/skeleton/pemu_config.cpp | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/skeleton/CMakeLists.txt b/src/skeleton/CMakeLists.txt index 6d8f9263..37939c73 100644 --- a/src/skeleton/CMakeLists.txt +++ b/src/skeleton/CMakeLists.txt @@ -42,7 +42,9 @@ if (OPTION_BUILTIN_MINIZIP) ${CMAKE_CURRENT_SOURCE_DIR}/external/minizip/unzip.c) list(APPEND FLAGS -DIOAPI_NO_64 -DUSE_FILE32API) else () - list(APPEND LDFLAGS minizip) + pkg_search_module(MINIZIP REQUIRED minizip) + list(APPEND CROSS2DUI_INCLUDE ${MINIZIP_INCLUDE_DIRS}) + list(APPEND LDFLAGS ${MINIZIP_LIBRARIES}) endif () if (PLATFORM_LINUX OR PLATFORM_WINDOWS) diff --git a/src/skeleton/mpv.cpp b/src/skeleton/mpv.cpp index 3bc54ab9..8d8924fe 100644 --- a/src/skeleton/mpv.cpp +++ b/src/skeleton/mpv.cpp @@ -44,6 +44,11 @@ Mpv::Mpv(const std::string &configPath, bool initRender) { mpv_set_option_string(handle, "vo", "null"); mpv_set_option_string(handle, "ao", "null"); } +#if MPV_CLIENT_API_VERSION >= 131075 // >= v0.38.0 + else { + mpv_set_option_string(handle, "vo", "libmpv"); + } +#endif int res = mpv_initialize(handle); if (res != 0) { @@ -86,7 +91,11 @@ int Mpv::load(const std::string &file, LoadType loadType, const std::string &opt } else if (loadType == LoadType::AppendPlay) { type = "append-play"; } +#if MPV_CLIENT_API_VERSION >= 131075 // >= v0.38.0 + const char *cmd[] = {"loadfile", file.c_str(), type.c_str(), nullptr, options.c_str()}; +#else const char *cmd[] = {"loadfile", file.c_str(), type.c_str(), options.c_str(), nullptr}; +#endif return mpv_command(handle, cmd); } diff --git a/src/skeleton/pemu_config.cpp b/src/skeleton/pemu_config.cpp index 5250e9af..cd10bd3f 100644 --- a/src/skeleton/pemu_config.cpp +++ b/src/skeleton/pemu_config.cpp @@ -199,7 +199,7 @@ bool PEMUConfig::addRomPath(const std::string &name, const std::string &path, co printf("PEMUConfig::addRomPath: %s (system: %s, path: %s)\n", name.c_str(), system.name.c_str(), path.c_str()); auto roms = config_lookup(libConfigGetInstance(), std::string(getName() + ".ROMS").c_str()); - if (config_setting_get_member(roms, name.c_str())) { + if (roms && config_setting_get_member(roms, name.c_str())) { printf("PEMUConfig::addRomPath: %s found in config file, skipping\n", name.c_str()); return false; }