From b47d1285e701d94734a1d16a4254fc07a6245cf2 Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Fri, 29 Jun 2012 14:49:59 +0000 Subject: [PATCH] -fixed bug which broke cover loading in plugin coverflow for plugins where coverFolder is not set in the ini --- source/menu/menu.cpp | 12 ++++++++++-- source/plugin/plugin.cpp | 23 +++++++++++++++++------ source/plugin/plugin.hpp | 26 ++++++++++++++++++-------- 3 files changed, 45 insertions(+), 16 deletions(-) diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index e3378633..3e2f1ac2 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -1665,14 +1665,22 @@ void CMenu::_initCF(void) tempname.assign(&tempname[tempname.find_last_of("/") + 1]); string coverFolder(m_plugin.GetCoverFolderName(m_gameList[i].settings[0])); if(EnabledPlugins.size() == 0) //all plugins - m_cf.addItem(&m_gameList[i], fmt("%s/%s/%s.png", m_picDir.c_str(), coverFolder.c_str(), tempname.c_str()), fmt("%s/%s/%s.png", m_boxPicDir.c_str(), coverFolder.c_str(), tempname.c_str()), playcount, lastPlayed); + { + if(coverFolder.size() > 0) + m_cf.addItem(&m_gameList[i], fmt("%s/%s/%s.png", m_picDir.c_str(), coverFolder.c_str(), tempname.c_str()), fmt("%s/%s/%s.png", m_boxPicDir.c_str(), coverFolder.c_str(), tempname.c_str()), playcount, lastPlayed); + else + m_cf.addItem(&m_gameList[i], fmt("%s/%s.png", m_picDir.c_str(), tempname.c_str()), fmt("%s/%s.png", m_boxPicDir.c_str(), tempname.c_str()), playcount, lastPlayed); + } else { for(u8 j = 0; j < EnabledPlugins.size(); j++) { if(EnabledPlugins[j] == true && m_gameList[i].settings[0] == m_plugin.getPluginMagic(j)) { - m_cf.addItem(&m_gameList[i], fmt("%s/%s/%s.png", m_picDir.c_str(), coverFolder.c_str(), tempname.c_str()), fmt("%s/%s/%s.png", m_boxPicDir.c_str(), coverFolder.c_str(), tempname.c_str()), playcount, lastPlayed); + if(coverFolder.size() > 0) + m_cf.addItem(&m_gameList[i], fmt("%s/%s/%s.png", m_picDir.c_str(), coverFolder.c_str(), tempname.c_str()), fmt("%s/%s/%s.png", m_boxPicDir.c_str(), coverFolder.c_str(), tempname.c_str()), playcount, lastPlayed); + else + m_cf.addItem(&m_gameList[i], fmt("%s/%s.png", m_picDir.c_str(), tempname.c_str()), fmt("%s/%s.png", m_boxPicDir.c_str(), tempname.c_str()), playcount, lastPlayed); break; } } diff --git a/source/plugin/plugin.cpp b/source/plugin/plugin.cpp index 764e053e..0340f0ab 100644 --- a/source/plugin/plugin.cpp +++ b/source/plugin/plugin.cpp @@ -1,13 +1,24 @@ - -//============================================================================ -// Name : plugin.cpp -// Copyright : 2012 FIX94 -//============================================================================ - +/**************************************************************************** + * Copyright (C) 2012 FIX94 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + ****************************************************************************/ #include #include #include #include + #include "plugin.hpp" #include "memory/mem2.hpp" #include "gui/text.hpp" diff --git a/source/plugin/plugin.hpp b/source/plugin/plugin.hpp index 44d5d56a..cf65ac82 100644 --- a/source/plugin/plugin.hpp +++ b/source/plugin/plugin.hpp @@ -1,9 +1,19 @@ - -//============================================================================ -// Name : plugin.hpp -// Copyright : 2012 FIX94 -//============================================================================ - +/**************************************************************************** + * Copyright (C) 2012 FIX94 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + ****************************************************************************/ #ifndef _PLUGIN_HPP_ #define _PLUGIN_HPP_ @@ -12,11 +22,11 @@ #include #include -using namespace std; - #include "config/config.hpp" #include "loader/disc.h" +using namespace std; + #define SWAP32(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) | (((x) & 0xff0000) >> 8) | (((x) >> 24) & 0xff)) #define TAG_GAME_ID "{gameid}"