mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-23 11:49:15 +01:00
sorry for r666 but it was too funny :P
-fixed deleting gamecube games -fixed wiiflow displaying broken gamecube iso files and then crash on selection
This commit is contained in:
parent
046153be4d
commit
3c4bdd228e
Binary file not shown.
Before Width: | Height: | Size: 591 B After Width: | Height: | Size: 854 B |
Binary file not shown.
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 2.9 KiB |
Binary file not shown.
@ -328,7 +328,7 @@ bool fsop_CopyFolder(char *source, char *target, progress_callback_t spinner, vo
|
||||
return doCopyFolder(source, target, spinner, spinner_data);
|
||||
}
|
||||
|
||||
void fsop_deleteFolder(char *source)
|
||||
void fsop_deleteFolder(const char *source)
|
||||
{
|
||||
DIR *pdir;
|
||||
struct dirent *pent;
|
||||
|
@ -18,7 +18,7 @@ void fsop_MakeFolder(char *path);
|
||||
bool fsop_CopyFile(char *source, char *target, progress_callback_t spinner, void *spinner_data);
|
||||
bool fsop_CopyFolder(char *source, char *target, progress_callback_t spinner, void *spinner_data);
|
||||
void fsop_deleteFile(const char *source);
|
||||
void fsop_deleteFolder(char *source);
|
||||
void fsop_deleteFolder(const char *source);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1286,7 +1286,9 @@ void CCoverFlow::_drawCover(int i, bool mirror, CCoverFlow::DrawMode dm)
|
||||
|
||||
STexture &CCoverFlow::_coverTexture(int i)
|
||||
{
|
||||
return m_noCoverTexture;
|
||||
if (!m_items[i].texture.data)
|
||||
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)
|
||||
@ -1845,7 +1847,24 @@ bool CCoverFlow::start(const char *id)
|
||||
return false;
|
||||
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.resize(m_range);
|
||||
m_jump = 0;
|
||||
|
@ -44,28 +44,22 @@ void CList<T>::GetPaths(vector<string> &pathlist, string containing, string dire
|
||||
}
|
||||
closedir(dir_itr);
|
||||
|
||||
bool FoundFile;
|
||||
while(temp_pathlist.size())
|
||||
{
|
||||
while((dir_itr = opendir(temp_pathlist[0].c_str())) && !dir_itr)
|
||||
temp_pathlist.erase(temp_pathlist.begin());
|
||||
|
||||
FoundFile = false;
|
||||
|
||||
/* Read subdirectory */
|
||||
while((ent = readdir(dir_itr)) != NULL)
|
||||
{
|
||||
if(ent->d_name[0] == '.')
|
||||
continue;
|
||||
if(dml && FoundFile)
|
||||
break;
|
||||
if(ent->d_type == DT_REG)
|
||||
{
|
||||
for(vector<string>::iterator compare = compares.begin(); compare != compares.end(); compare++)
|
||||
{
|
||||
if(strcasestr(ent->d_name, (*compare).c_str()) != NULL)
|
||||
{
|
||||
FoundFile = true;
|
||||
//gprintf("Pushing %s to the list.\n", sfmt("%s/%s", temp_pathlist[0].c_str(), ent->d_name).c_str());
|
||||
pathlist.push_back(sfmt("%s/%s", temp_pathlist[0].c_str(), ent->d_name));
|
||||
break;
|
||||
@ -76,11 +70,8 @@ void CList<T>::GetPaths(vector<string> &pathlist, string containing, string dire
|
||||
{
|
||||
if(!depth_limit)
|
||||
temp_pathlist.push_back(sfmt("%s/%s", temp_pathlist[0].c_str(), ent->d_name));
|
||||
else if(dml && !FoundFile && strncasecmp(ent->d_name, "sys", 3) == 0 &&
|
||||
fsop_FileExist(fmt("%s/%s/boot.bin", temp_pathlist[0].c_str(), ent->d_name)) &&
|
||||
!fsop_FileExist(fmt("%s/game.iso", temp_pathlist[0].c_str())))
|
||||
else if(dml && strncasecmp(ent->d_name, "sys", 3) == 0 && fsop_DirExist(fmt("%s/root", temp_pathlist[0].c_str())))
|
||||
{
|
||||
FoundFile = true;
|
||||
//gprintf("Pushing %s to the list.\n", sfmt("%s/%s/boot.bin", temp_pathlist[0].c_str(), ent->d_name).c_str());
|
||||
pathlist.push_back(sfmt("%s/%s/boot.bin", temp_pathlist[0].c_str(), ent->d_name));
|
||||
}
|
||||
@ -107,20 +98,6 @@ void CList<T>::GetPaths(vector<string> &pathlist, string containing, string dire
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
void CList<string>::GetHeaders(vector<string> pathlist, vector<string> &headerlist, string, string, string, Config&)
|
||||
{
|
||||
//gprintf("Getting headers for CList<string>\n");
|
||||
|
||||
if(pathlist.size() < 1)
|
||||
return;
|
||||
|
||||
headerlist.reserve(pathlist.size() + headerlist.size());
|
||||
|
||||
for(vector<string>::iterator itr = pathlist.begin(); itr != pathlist.end(); itr++)
|
||||
headerlist.push_back((*itr).c_str());
|
||||
}
|
||||
|
||||
template <>
|
||||
void CList<dir_discHdr>::GetHeaders(vector<string> pathlist, vector<dir_discHdr> &headerlist, string settingsDir, string curLanguage, string DMLgameUSBDir, Config &plugin)
|
||||
{
|
||||
@ -133,6 +110,7 @@ void CList<dir_discHdr>::GetHeaders(vector<string> pathlist, vector<dir_discHdr>
|
||||
vector<char*> GC_SD_IDs;
|
||||
bool GC_SD_IDs_loaded = false;
|
||||
|
||||
discHdr gc_hdr;
|
||||
dir_discHdr tmp;
|
||||
u32 count = 0;
|
||||
string GTitle;
|
||||
@ -200,7 +178,7 @@ void CList<dir_discHdr>::GetHeaders(vector<string> pathlist, vector<dir_discHdr>
|
||||
{
|
||||
char* filename = &(*itr)[(*itr).find_last_of('/')+1];
|
||||
const char* dml_partition = DeviceName[DeviceHandler::Instance()->PathToDriveType((*itr).c_str())];
|
||||
if((strcasecmp(filename, "game.iso") == 0 || strcasecmp(filename, "boot.bin") == 0) && strstr((*itr).c_str(), sfmt((strncmp(dml_partition, "sd", 2) != 0) ? DMLgameUSBDir.c_str() : DML_DIR, dml_partition).c_str()) != NULL)
|
||||
if(strcasecmp(filename, "game.iso") == 0 || strcasecmp(filename, "gam1.iso") == 0 || strcasecmp(filename, "boot.bin") == 0)
|
||||
{
|
||||
FILE *fp = fopen((*itr).c_str(), "rb");
|
||||
if(fp)
|
||||
@ -209,7 +187,7 @@ void CList<dir_discHdr>::GetHeaders(vector<string> pathlist, vector<dir_discHdr>
|
||||
fseek(fp, 6, SEEK_SET);
|
||||
fread(gc_disc, 1, 1, fp);
|
||||
|
||||
discHdr gc_hdr;
|
||||
memset(&gc_hdr, 0, sizeof(discHdr));
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
fread(&gc_hdr, sizeof(discHdr), 1, fp);
|
||||
fclose(fp);
|
||||
|
@ -377,14 +377,17 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
|
||||
case CMenu::WO_REMOVE_GAME:
|
||||
if(m_cf.getHdr()->type == TYPE_GC_GAME)
|
||||
{
|
||||
char source[300];
|
||||
snprintf(source, sizeof(source), "%s/%s", fmt((currentPartition != SD) ? m_DMLgameDir.c_str() : DML_DIR, DeviceName[currentPartition]), (char *)m_cf.getHdr()->path);
|
||||
fsop_deleteFolder(source);
|
||||
string GC_Path(m_cf.getHdr()->path);
|
||||
if(strcasestr(GC_Path.c_str(), "boot.bin") != NULL)
|
||||
GC_Path.erase(GC_Path.end() - 13, GC_Path.end());
|
||||
else
|
||||
GC_Path.erase(GC_Path.end() - 9, GC_Path.end());
|
||||
fsop_deleteFolder(GC_Path.c_str());
|
||||
upd_dml = true;
|
||||
}
|
||||
else if(m_cf.getHdr()->type == TYPE_PLUGIN)
|
||||
{
|
||||
fsop_deleteFile((char*)m_cf.getHdr()->path);
|
||||
fsop_deleteFile(m_cf.getHdr()->path);
|
||||
upd_emu = true;
|
||||
}
|
||||
else if(m_cf.getHdr()->type == TYPE_WII_GAME)
|
||||
|
@ -7,15 +7,13 @@
|
||||
#include "gui/text.hpp"
|
||||
|
||||
MusicPlayer m_music;
|
||||
extern const u8 gc_ogg[];
|
||||
extern const u32 gc_ogg_size;
|
||||
|
||||
void MusicPlayer::cleanup()
|
||||
{
|
||||
MusicFile.FreeMemory();
|
||||
}
|
||||
|
||||
void MusicPlayer::Init(Config &cfg, string, string)
|
||||
void MusicPlayer::Init(Config &cfg, string musicDir, string themeMusicDir)
|
||||
{
|
||||
m_stopped = true;
|
||||
m_fade_rate = cfg.getInt("GENERAL", "music_fade_rate", 8);
|
||||
@ -23,6 +21,33 @@ void MusicPlayer::Init(Config &cfg, string, string)
|
||||
|
||||
SetVolume(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)
|
||||
@ -33,11 +58,25 @@ void MusicPlayer::SetVolume(u8 volume)
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@ -57,6 +96,8 @@ void MusicPlayer::Stop()
|
||||
|
||||
void MusicPlayer::Tick(bool attenuate)
|
||||
{
|
||||
if(m_music_files.empty())
|
||||
return;
|
||||
if(!attenuate && m_music_current_volume < m_music_volume)
|
||||
{
|
||||
SetVolume(m_music_current_volume + m_fade_rate > m_music_volume ? m_music_volume
|
||||
@ -73,6 +114,6 @@ void MusicPlayer::Tick(bool attenuate)
|
||||
|
||||
void MusicPlayer::LoadCurrentFile()
|
||||
{
|
||||
MusicFile.Load(gc_ogg, gc_ogg_size, false);
|
||||
MusicFile.Load((*m_current_music).c_str());
|
||||
Play();
|
||||
}
|
||||
|
@ -35,6 +35,8 @@ protected:
|
||||
bool m_stopped;
|
||||
|
||||
GuiSound MusicFile;
|
||||
vector<string> m_music_files;
|
||||
vector<string>::iterator m_current_music;
|
||||
};
|
||||
|
||||
extern MusicPlayer m_music;
|
||||
|
Loading…
Reference in New Issue
Block a user