-666666666666666

-66666
-66666 66666666 666666
-666HE666LP666
-666HHH666ME66
This commit is contained in:
fix94.1 2012-08-20 13:41:00 +00:00
parent dc419f9f75
commit 046153be4d
6 changed files with 6 additions and 68 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 854 B

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

View File

@ -1286,9 +1286,7 @@ void CCoverFlow::_drawCover(int i, bool mirror, CCoverFlow::DrawMode dm)
STexture &CCoverFlow::_coverTexture(int i) STexture &CCoverFlow::_coverTexture(int i)
{ {
if (!m_items[i].texture.data) return m_noCoverTexture;
return m_items[i].state == CCoverFlow::STATE_Loading ? m_loadingTexture : m_noCoverTexture;
return m_items[i].texture;
} }
void CCoverFlow::_drawCoverFlat(int i, bool mirror, CCoverFlow::DrawMode dm) void CCoverFlow::_drawCoverFlat(int i, bool mirror, CCoverFlow::DrawMode dm)
@ -1847,24 +1845,7 @@ bool CCoverFlow::start(const char *id)
return false; return false;
m_dvdskin_loaded = true; m_dvdskin_loaded = true;
} }
m_noCoverTexture.fromPNG(flatnopic_png, GX_TF_CMPR, ALLOC_MEM2, 32, 512);
if(m_box)
{
if (m_pngLoadCover.empty() || STexture::TE_OK != m_loadingTexture.fromImageFile(m_pngLoadCover.c_str(), GX_TF_CMPR, ALLOC_MEM2, 32, 512))
if (STexture::TE_OK != m_loadingTexture.fromPNG(loading_png, GX_TF_CMPR, ALLOC_MEM2, 32, 512)) return false;
if (m_pngNoCover.empty() || STexture::TE_OK != m_noCoverTexture.fromImageFile(m_pngNoCover.c_str(), GX_TF_CMPR, ALLOC_MEM2, 32, 512))
if (STexture::TE_OK != m_noCoverTexture.fromPNG(nopic_png, GX_TF_CMPR, ALLOC_MEM2, 32, 512)) return false;
}
else
{
if (m_pngLoadCoverFlat.empty() || STexture::TE_OK != m_loadingTexture.fromImageFile(m_pngLoadCoverFlat.c_str(), GX_TF_CMPR, ALLOC_MEM2, 32, 512))
if (STexture::TE_OK != m_loadingTexture.fromJPG(flatloading_jpg, flatloading_jpg_size, GX_TF_CMPR, ALLOC_MEM2, 32, 512)) return false;
if (m_pngNoCoverFlat.empty() || STexture::TE_OK != m_noCoverTexture.fromImageFile(m_pngNoCoverFlat.c_str(), GX_TF_CMPR, ALLOC_MEM2, 32, 512))
if (STexture::TE_OK != m_noCoverTexture.fromPNG(flatnopic_png, GX_TF_CMPR, ALLOC_MEM2, 32, 512)) return false;
}
m_covers.clear(); m_covers.clear();
m_covers.resize(m_range); m_covers.resize(m_range);
m_jump = 0; m_jump = 0;

View File

@ -7,13 +7,15 @@
#include "gui/text.hpp" #include "gui/text.hpp"
MusicPlayer m_music; MusicPlayer m_music;
extern const u8 gc_ogg[];
extern const u32 gc_ogg_size;
void MusicPlayer::cleanup() void MusicPlayer::cleanup()
{ {
MusicFile.FreeMemory(); MusicFile.FreeMemory();
} }
void MusicPlayer::Init(Config &cfg, string musicDir, string themeMusicDir) void MusicPlayer::Init(Config &cfg, string, string)
{ {
m_stopped = true; m_stopped = true;
m_fade_rate = cfg.getInt("GENERAL", "music_fade_rate", 8); m_fade_rate = cfg.getInt("GENERAL", "music_fade_rate", 8);
@ -21,33 +23,6 @@ void MusicPlayer::Init(Config &cfg, string musicDir, string themeMusicDir)
SetVolume(0); SetVolume(0);
MusicFile.SetVoice(0); MusicFile.SetVoice(0);
m_music_files.clear();
ScanDirectories(themeMusicDir.c_str());
ScanDirectories(musicDir.c_str());
if(cfg.getBool("GENERAL", "randomize_music", true) && m_music_files.size() > 0)
{
srand(unsigned(time(NULL)));
random_shuffle(m_music_files.begin(), m_music_files.end());
}
m_current_music = m_music_files.begin();
}
void MusicPlayer::ScanDirectories(const char *directory)
{
struct dirent *pent = NULL;
DIR *pdir = opendir(directory);
while((pent = readdir(pdir)) != NULL)
{
if(strcmp(pent->d_name, ".") == 0 || strcmp(pent->d_name, "..") == 0)
continue;
string CurrentItem = sfmt("%s/%s", directory, pent->d_name);
if(fsop_DirExist(CurrentItem.c_str()))
ScanDirectories(CurrentItem.c_str());
else if(strcasestr(pent->d_name, ".mp3") != NULL || strcasestr(pent->d_name, ".ogg") != NULL)
m_music_files.push_back(CurrentItem);
}
closedir(pdir);
} }
void MusicPlayer::SetVolume(u8 volume) void MusicPlayer::SetVolume(u8 volume)
@ -58,25 +33,11 @@ void MusicPlayer::SetVolume(u8 volume)
void MusicPlayer::Previous() void MusicPlayer::Previous()
{ {
if(m_music_files.empty())
return;
if(m_current_music == m_music_files.begin())
m_current_music = m_music_files.end();
m_current_music--;
LoadCurrentFile(); LoadCurrentFile();
} }
void MusicPlayer::Next() void MusicPlayer::Next()
{ {
if(m_music_files.empty())
return;
m_current_music++;
if (m_current_music == m_music_files.end())
m_current_music = m_music_files.begin();
LoadCurrentFile(); LoadCurrentFile();
} }
@ -96,8 +57,6 @@ void MusicPlayer::Stop()
void MusicPlayer::Tick(bool attenuate) void MusicPlayer::Tick(bool attenuate)
{ {
if(m_music_files.empty())
return;
if(!attenuate && m_music_current_volume < m_music_volume) if(!attenuate && m_music_current_volume < m_music_volume)
{ {
SetVolume(m_music_current_volume + m_fade_rate > m_music_volume ? m_music_volume SetVolume(m_music_current_volume + m_fade_rate > m_music_volume ? m_music_volume
@ -114,6 +73,6 @@ void MusicPlayer::Tick(bool attenuate)
void MusicPlayer::LoadCurrentFile() void MusicPlayer::LoadCurrentFile()
{ {
MusicFile.Load((*m_current_music).c_str()); MusicFile.Load(gc_ogg, gc_ogg_size, false);
Play(); Play();
} }

View File

@ -35,8 +35,6 @@ protected:
bool m_stopped; bool m_stopped;
GuiSound MusicFile; GuiSound MusicFile;
vector<string> m_music_files;
vector<string>::iterator m_current_music;
}; };
extern MusicPlayer m_music; extern MusicPlayer m_music;