1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

- fixed crash on missing videos

- fixed savegames name selection
This commit is contained in:
Ivan Savenko
2012-08-11 11:34:49 +00:00
parent edbc7f1223
commit eec4d3579d
4 changed files with 15 additions and 6 deletions

View File

@ -1284,7 +1284,7 @@ void SelectionTab::select( int position )
if(txt) if(txt)
{ {
std::string filename = CResourceHandler::get()->getResourceName( std::string filename = CResourceHandler::get()->getResourceName(
ResourceID(curItems[py]->fileURI, EResType::MAP)); ResourceID(curItems[py]->fileURI, EResType::LIB_SAVEGAME));
txt->setTxt(CFileInfo(filename).getBaseName()); txt->setTxt(CFileInfo(filename).getBaseName());
} }

View File

@ -685,12 +685,20 @@ bool CVideoPlayer::open(std::string fname, bool loop, bool useOverlay)
refreshCount = -1; refreshCount = -1;
doLoop = loop; doLoop = loop;
auto extracted = CResourceHandler::get()->loadData(ResourceID(std::string("Video/") + fname, EResType::VIDEO)); ResourceID resource(std::string("Video/") + fname, EResType::VIDEO);
if (CResourceHandler::get()->existsResource(resource))
{
auto extracted = CResourceHandler::get()->loadData(resource);
data = (char *)extracted.first.release(); data = (char *)extracted.first.release();
length = extracted.second; length = extracted.second;
}
if (!data) else
{
data = nullptr;
length = 0;
return false; return false;
}
std::string filePath; std::string filePath;
filePath.resize(100); filePath.resize(100);

View File

@ -237,6 +237,7 @@ EResType::Type EResTypeHelper::getTypeFromExtension(std::string extension)
(".SMK", EResType::VIDEO) (".SMK", EResType::VIDEO)
(".BIK", EResType::VIDEO) (".BIK", EResType::VIDEO)
(".MJPG", EResType::VIDEO) (".MJPG", EResType::VIDEO)
(".MPG", EResType::VIDEO)
(".MP3", EResType::MUSIC) (".MP3", EResType::MUSIC)
(".OGG", EResType::MUSIC) (".OGG", EResType::MUSIC)
(".LOD", EResType::ARCHIVE) (".LOD", EResType::ARCHIVE)

View File

@ -30,7 +30,7 @@ class ISimpleResourceLoader;
* Font: .fnt * Font: .fnt
* Image: .bmp, .jpg, .pcx, .png, .tga * Image: .bmp, .jpg, .pcx, .png, .tga
* Sound: .wav .82m * Sound: .wav .82m
* Video: .smk, .bik .mjpg * Video: .smk, .bik .mjpg .mpg
* Music: .mp3, .ogg * Music: .mp3, .ogg
* Archive: .lod, .snd, .vid .pac * Archive: .lod, .snd, .vid .pac
* Palette: .pal * Palette: .pal