Skip to content

Commit

Permalink
config: fix crash when config file doesn't exists
Browse files Browse the repository at this point in the history
cmake: fix deps (linux)
mpv: fixes for v0.38.0
  • Loading branch information
Cpasjuste committed Apr 18, 2024
1 parent 158eda3 commit b627240
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/skeleton/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions src/skeleton/mpv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/skeleton/pemu_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit b627240

Please sign in to comment.