mirror of
				https://github.com/RetroDECK/ES-DE.git
				synced 2025-04-10 19:15:13 +00:00 
			
		
		
		
	Use local game art ( image, marquee and video ) from romfolder/images if the gamelist didn't specify a path
This commit is contained in:
		
							parent
							
								
									06d38db73b
								
							
						
					
					
						commit
						cd2f2ee42b
					
				|  | @ -43,12 +43,32 @@ std::string FileData::getCleanName() const | |||
| 	return removeParenthesis(this->getDisplayName()); | ||||
| } | ||||
| 
 | ||||
| const std::string& FileData::getThumbnailPath() const | ||||
| const std::string FileData::getThumbnailPath() const | ||||
| { | ||||
| 	if(!metadata.get("thumbnail").empty()) | ||||
| 		return metadata.get("thumbnail"); | ||||
| 	else | ||||
| 		return metadata.get("image"); | ||||
| 	std::string thumbnail = metadata.get("thumbnail"); | ||||
| 
 | ||||
| 	// no thumbnail, try image
 | ||||
| 	if(thumbnail.empty()) | ||||
| 	{ | ||||
| 		thumbnail = metadata.get("image"); | ||||
| 
 | ||||
| 		// no image, try to use local image
 | ||||
| 		if(thumbnail.empty()) | ||||
| 		{ | ||||
| 			const char* extList[2] = { ".png", ".jpg" }; | ||||
| 			for(int i = 0; i < 2; i++) | ||||
| 			{ | ||||
| 				if(thumbnail.empty()) | ||||
| 				{ | ||||
| 					std::string path = mEnvData->mStartPath + "/images/" + getDisplayName() + "-image" + extList[i]; | ||||
| 					if(boost::filesystem::exists(path)) | ||||
| 						thumbnail = path; | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	return thumbnail; | ||||
| } | ||||
| 
 | ||||
| const std::string& FileData::getName() | ||||
|  | @ -76,14 +96,63 @@ const std::vector<FileData*>& FileData::getChildrenListToDisplay() { | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| const std::string& FileData::getVideoPath() const | ||||
| const std::string FileData::getVideoPath() const | ||||
| { | ||||
| 	return metadata.get("video"); | ||||
| 	std::string video = metadata.get("video"); | ||||
| 
 | ||||
| 	// no video, try to use local video
 | ||||
| 	if(video.empty()) | ||||
| 	{ | ||||
| 		std::string path = mEnvData->mStartPath + "/images/" + getDisplayName() + "-video.mp4"; | ||||
| 		if(boost::filesystem::exists(path)) | ||||
| 			video = path; | ||||
| 	} | ||||
| 
 | ||||
| 	return video; | ||||
| } | ||||
| 
 | ||||
| const std::string& FileData::getMarqueePath() const | ||||
| const std::string FileData::getMarqueePath() const | ||||
| { | ||||
| 	return metadata.get("marquee"); | ||||
| 	std::string marquee = metadata.get("marquee"); | ||||
| 
 | ||||
| 	// no marquee, try to use local marquee
 | ||||
| 	if(marquee.empty()) | ||||
| 	{ | ||||
| 		const char* extList[2] = { ".png", ".jpg" }; | ||||
| 		for(int i = 0; i < 2; i++) | ||||
| 		{ | ||||
| 			if(marquee.empty()) | ||||
| 			{ | ||||
| 				std::string path = mEnvData->mStartPath + "/images/" + getDisplayName() + "-marquee" + extList[i]; | ||||
| 				if(boost::filesystem::exists(path)) | ||||
| 					marquee = path; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	return marquee; | ||||
| } | ||||
| 
 | ||||
| const std::string FileData::getImagePath() const | ||||
| { | ||||
| 	std::string image = metadata.get("image"); | ||||
| 
 | ||||
| 	// no image, try to use local image
 | ||||
| 	if(image.empty()) | ||||
| 	{ | ||||
| 		const char* extList[2] = { ".png", ".jpg" }; | ||||
| 		for(int i = 0; i < 2; i++) | ||||
| 		{ | ||||
| 			if(image.empty()) | ||||
| 			{ | ||||
| 				std::string path = mEnvData->mStartPath + "/images/" + getDisplayName() + "-image" + extList[i]; | ||||
| 				if(boost::filesystem::exists(path)) | ||||
| 					image = path; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	return image; | ||||
| } | ||||
| 
 | ||||
| std::vector<FileData*> FileData::getFilesRecursive(unsigned int typeMask, bool displayedOnly) const | ||||
|  |  | |||
|  | @ -43,9 +43,10 @@ public: | |||
| 	inline const std::vector<FileData*>& getChildren() const { return mChildren; } | ||||
| 	inline SystemData* getSystem() const { return mSystem; } | ||||
| 	inline SystemEnvironmentData* getSystemEnvData() const { return mEnvData; } | ||||
| 	virtual const std::string& getThumbnailPath() const; | ||||
| 	virtual const std::string& getVideoPath() const; | ||||
| 	virtual const std::string& getMarqueePath() const; | ||||
| 	virtual const std::string getThumbnailPath() const; | ||||
| 	virtual const std::string getVideoPath() const; | ||||
| 	virtual const std::string getMarqueePath() const; | ||||
| 	virtual const std::string getImagePath() const; | ||||
| 
 | ||||
| 	const std::vector<FileData*>& getChildrenListToDisplay(); | ||||
| 	std::vector<FileData*> getFilesRecursive(unsigned int typeMask, bool displayedOnly = false) const; | ||||
|  |  | |||
|  | @ -194,7 +194,7 @@ void DetailedGameListView::updateInfoPanel() | |||
| 		//mDescription.setText("");
 | ||||
| 		fadingOut = true; | ||||
| 	}else{ | ||||
| 		mImage.setImage(file->metadata.get("image")); | ||||
| 		mImage.setImage(file->getImagePath()); | ||||
| 		mDescription.setText(file->metadata.get("desc")); | ||||
| 		mDescContainer.reset(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -240,37 +240,15 @@ void VideoGameListView::updateInfoPanel() | |||
| 		fadingOut = true; | ||||
| 
 | ||||
| 	}else{ | ||||
| 		std::string				video_path; | ||||
| 		std::string				marquee_path; | ||||
| 		std::string				thumbnail_path; | ||||
| 		video_path 			= file->getVideoPath(); | ||||
| 		marquee_path 		= file->getMarqueePath(); | ||||
| 		thumbnail_path 		= file->getThumbnailPath(); | ||||
| 
 | ||||
| 		if	(!video_path.empty() && (video_path[0] == '~')) | ||||
| 		{ | ||||
| 			video_path.erase(0, 1); | ||||
| 			video_path.insert(0, getHomePath()); | ||||
| 		} | ||||
| 		if	(!marquee_path.empty() && (marquee_path[0] == '~')) | ||||
| 		{ | ||||
| 			marquee_path.erase(0, 1); | ||||
| 			marquee_path.insert(0, getHomePath()); | ||||
| 		} | ||||
| 		if (!thumbnail_path.empty() && (thumbnail_path[0] == '~')) | ||||
| 		{ | ||||
| 			thumbnail_path.erase(0, 1); | ||||
| 			thumbnail_path.insert(0, getHomePath()); | ||||
| 		} | ||||
| 		if (!mVideo->setVideo(video_path)) | ||||
| 		if (!mVideo->setVideo(file->getVideoPath())) | ||||
| 		{ | ||||
| 			mVideo->setDefaultVideo(); | ||||
| 		} | ||||
| 		mVideoPlaying = true; | ||||
| 
 | ||||
| 		mVideo->setImage(thumbnail_path); | ||||
| 		mMarquee.setImage(marquee_path); | ||||
| 		mImage.setImage(thumbnail_path); | ||||
| 		mVideo->setImage(file->getThumbnailPath()); | ||||
| 		mMarquee.setImage(file->getMarqueePath()); | ||||
| 		mImage.setImage(file->getThumbnailPath()); | ||||
| 
 | ||||
| 		mDescription.setText(file->metadata.get("desc")); | ||||
| 		mDescContainer.reset(); | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Tomas Jakobsson
						Tomas Jakobsson