Fix playback case-insensitive intros

This commit is contained in:
Azamat H. Hackimov 2024-07-09 03:59:58 +03:00
parent ae279d1211
commit 5a4e1533a6
4 changed files with 7 additions and 9 deletions

View File

@ -84,7 +84,7 @@ bool PlayMovie(const std::filesystem::path &moviename) {
SetMovieProperties(0, 0, Max_window_w, Max_window_h, Renderer_type);
int mveerr = mve_PlayMovie(filename.u8string().c_str(), Descent);
int mveerr = mve_PlayMovie(filename, Descent);
// Shutdown the subtitle system
SubtCloseSubtitles();

View File

@ -491,10 +491,7 @@ void Descent3() {
};
for (auto const &intro : intros) {
std::filesystem::path intropath = std::filesystem::path(Base_directory) / "movies" / intro;
if (cfexist(intropath)) {
PlayMovie(intropath);
}
PlayMovie(std::filesystem::path(Base_directory) / "movies" / intro);
}
}

View File

@ -22,6 +22,7 @@
#include "renderer.h"
#include <cstdint>
#include <filesystem>
#define MVELIB_NOERROR 0
#define MVELIB_FILE_ERROR (-1)
@ -36,7 +37,7 @@ class oeApplication;
int mve_Init(const char *dir, const char *sndcard);
// simply plays a movie.
int mve_PlayMovie(const char *mvename, oeApplication *app);
int mve_PlayMovie(const std::filesystem::path &pMovieName, oeApplication *pApp);
// used to copy movie data to a pointer, looping will loop, fhandle will be a pointer to a file handle to be returned
// handle to movie sequence is returned by function.

View File

@ -100,14 +100,14 @@ std::filesystem::path mve_FindMovieFileRealName(const std::filesystem::path &mov
#endif
// plays a movie using the current screen.
int mve_PlayMovie(const char *pMovieName, oeApplication *pApp) {
int mve_PlayMovie(const std::filesystem::path &pMovieName, oeApplication *pApp) {
#ifndef NO_MOVIES
// first, find that movie..
std::filesystem::path real_name;
#ifdef __LINUX__
real_name = mve_FindMovieFileRealName(pMovieName);
if (real_name.empty()) {
mprintf(0, "MOVIE: No such file %s\n", pMovieName);
mprintf(0, "MOVIE: No such file %s\n", pMovieName.u8string().c_str());
return MVELIB_FILE_ERROR;
}
#else
@ -136,7 +136,7 @@ int mve_PlayMovie(const char *pMovieName, oeApplication *pApp) {
MVESTREAM *mve = MVE_rmPrepMovie(hFile, -1, -1, 0);
if (mve == nullptr) {
mprintf(0, "Failed to prepMovie %s\n", pMovieName);
mprintf(0, "Failed to prepMovie %s\n", pMovieName.u8string().c_str());
fclose(hFile);
mve_CloseSound();
return MVELIB_INIT_ERROR;