mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-01 00:55:06 +01:00
- fixed issue #21 downloading covers, gametdb.zip, banners, and cheatfiles. now pausing bg music while downloading to prevent music thread from interfering with the internet network connection. also now clearing downloaded data from memory when done with it. code was missing to free the mem when done which caused out of memory issues of course. my fault i didn't see it till now.
- fixed issue #23 the progress bar and percentage when downloading covers. - fixed issue #26 reload cache when using wii, gc, and channels plugins in plugin view.
This commit is contained in:
parent
46b4a4743c
commit
354bddc664
BIN
out/boot.dol
BIN
out/boot.dol
Binary file not shown.
Before Width: | Height: | Size: 3.4 MiB After Width: | Height: | Size: 3.4 MiB |
@ -1603,12 +1603,13 @@ void CMenu::_addUserLabels(s16 *ids, u32 start, u32 size, const char *domain)
|
||||
}
|
||||
}
|
||||
|
||||
bool musicPaused = false;
|
||||
void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
|
||||
{
|
||||
/*if(m_thrdWorking)
|
||||
if(m_thrdWorking)
|
||||
{
|
||||
if(!MusicPlayer.IsStopped())
|
||||
MusicPlayer.Stop();
|
||||
musicPaused = true;
|
||||
MusicPlayer.Pause();
|
||||
m_btnMgr.tick();
|
||||
m_vid.prepare();
|
||||
m_vid.setup2DProjection(false, true);
|
||||
@ -1618,7 +1619,12 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
|
||||
m_btnMgr.draw();
|
||||
m_vid.render();
|
||||
return;
|
||||
}*/
|
||||
}
|
||||
if(musicPaused && !m_thrdWorking)
|
||||
{
|
||||
musicPaused = false;
|
||||
MusicPlayer.Resume();
|
||||
}
|
||||
|
||||
/* ticks - for moving and scaling covers and gui buttons and text */
|
||||
if(withCF)
|
||||
@ -2389,16 +2395,32 @@ bool CMenu::_loadPluginList()
|
||||
}
|
||||
}
|
||||
if(addHomebrew)
|
||||
{
|
||||
if(updateCache)
|
||||
m_cfg.setBool(HOMEBREW_DOMAIN, "update_cache", true);
|
||||
_loadHomebrewList();
|
||||
}
|
||||
|
||||
if(addGamecube)
|
||||
{
|
||||
if(updateCache)
|
||||
m_cfg.setBool(GC_DOMAIN, "update_cache", true);
|
||||
_loadGamecubeList();
|
||||
}
|
||||
|
||||
if(addWii)
|
||||
{
|
||||
if(updateCache)
|
||||
m_cfg.setBool(WII_DOMAIN, "update_cache", true);
|
||||
_loadWiiList();
|
||||
}
|
||||
|
||||
if(addChannel)
|
||||
{
|
||||
if(updateCache)
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "update_cache", true);
|
||||
_loadChannelList();
|
||||
}
|
||||
|
||||
m_cfg.remove(PLUGIN_DOMAIN, "update_cache");
|
||||
return true;
|
||||
|
@ -30,8 +30,12 @@ int CMenu::_downloadCheatFileAsync()
|
||||
{
|
||||
update_pThread(1);//its downloaded
|
||||
fsop_WriteFile(fmt("%s/%s.txt", m_txtCheatDir.c_str(), id), cheatfile.data, cheatfile.size);
|
||||
if(cheatfile.data != NULL)
|
||||
free(cheatfile.data);
|
||||
return 0;
|
||||
}
|
||||
if(cheatfile.data != NULL)
|
||||
free(cheatfile.data);
|
||||
return -3;// download failed
|
||||
}
|
||||
|
||||
|
@ -221,6 +221,8 @@ void CMenu::_showDownload(void)
|
||||
m_btnMgr.show(m_downloadLblUser[i]);
|
||||
}
|
||||
|
||||
int count, countFlat;
|
||||
u32 n;
|
||||
void CMenu::_download(string gameId)
|
||||
{
|
||||
m_coverDLGameId = gameId;
|
||||
@ -283,14 +285,23 @@ void CMenu::_download(string gameId)
|
||||
_start_pThread();
|
||||
int ret = _coverDownloader(dlAll);
|
||||
_stop_pThread();
|
||||
if(countFlat == 0)
|
||||
{
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg5", L"%i/%i files downloaded."), count, n);
|
||||
m_btnMgr.setText(m_wbfsLblDialog, m_thrdMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg9", L"%i/%i files downloaded. %i are front covers only."), count + countFlat, n, countFlat);
|
||||
m_btnMgr.setText(m_wbfsLblDialog, m_thrdMessage);
|
||||
}
|
||||
|
||||
if(ret == -1)
|
||||
m_btnMgr.setText(m_wbfsLblDialog, _t("dlmsg27", L"Not enough memory!"));
|
||||
else if(ret == -2)
|
||||
m_btnMgr.setText(m_wbfsLblDialog, _t("dlmsg2", L"Network initialization failed!"));
|
||||
else if(ret == -3)
|
||||
m_btnMgr.setText(m_wbfsLblDialog, _t("dlmsg30", L"No covers missing."));
|
||||
else
|
||||
m_btnMgr.setText(m_wbfsLblDialog, _t("dlmsg14", L"Done."));
|
||||
dl_finished = true;
|
||||
gameId.clear();
|
||||
//maybe show back button
|
||||
@ -869,7 +880,8 @@ void CMenu::_downloadProgress(void *obj, int size, int position)
|
||||
|
||||
int CMenu::_coverDownloader(bool download_all)
|
||||
{
|
||||
int count = 0, countFlat = 0;
|
||||
count = 0;
|
||||
countFlat = 0;
|
||||
|
||||
GameTDB c_gameTDB;
|
||||
if(m_settingsDir.size() > 0)
|
||||
@ -916,7 +928,7 @@ int CMenu::_coverDownloader(bool download_all)
|
||||
else
|
||||
coverIDList.push_back(m_coverDLGameId);
|
||||
|
||||
u32 n = coverIDList.size();
|
||||
n = coverIDList.size();
|
||||
m_thrdTotal = n * 3;// 3 = download cover, save png, and make wfc
|
||||
|
||||
if(m_thrdTotal == 0)
|
||||
@ -1106,7 +1118,9 @@ int CMenu::_coverDownloader(bool download_all)
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s.wfc"), coverID.c_str());
|
||||
m_thrdMessageAdded = true;
|
||||
CoverFlow.cacheCoverBuffer(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), download.data, true);//it may fail
|
||||
|
||||
if(download.data != NULL)
|
||||
free(download.data);
|
||||
|
||||
++count;
|
||||
update_pThread(1);
|
||||
success = true;
|
||||
@ -1248,6 +1262,8 @@ int CMenu::_coverDownloader(bool download_all)
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s.wfc"), coverID.c_str());
|
||||
m_thrdMessageAdded = true;
|
||||
CoverFlow.cacheCoverBuffer(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), download.data, true);//it may fail
|
||||
if(download.data != NULL)
|
||||
free(download.data);
|
||||
|
||||
update_pThread(1);
|
||||
++count;
|
||||
@ -1383,7 +1399,9 @@ int CMenu::_coverDownloader(bool download_all)
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverID.c_str()));
|
||||
m_thrdMessageAdded = true;
|
||||
CoverFlow.cacheCoverBuffer(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), download.data, false);//it may fail
|
||||
|
||||
if(download.data != NULL)
|
||||
free(download.data);
|
||||
|
||||
++countFlat;
|
||||
update_pThread(1);
|
||||
success = true;
|
||||
@ -1522,7 +1540,9 @@ int CMenu::_coverDownloader(bool download_all)
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverID.c_str()));
|
||||
m_thrdMessageAdded = true;
|
||||
CoverFlow.cacheCoverBuffer(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), download.data, false);//it may fail
|
||||
|
||||
if(download.data != NULL)
|
||||
free(download.data);
|
||||
|
||||
++countFlat;
|
||||
update_pThread(1);
|
||||
success = true;
|
||||
@ -1532,14 +1552,11 @@ int CMenu::_coverDownloader(bool download_all)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!success)
|
||||
update_pThread(3);
|
||||
}
|
||||
}
|
||||
if(countFlat == 0)
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg5", L"%i/%i files downloaded."), count, n);
|
||||
else
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg9", L"%i/%i files downloaded. %i are front covers only."), count + countFlat, n, countFlat);
|
||||
m_thrdMessageAdded = true;
|
||||
|
||||
/* cover list done and downloading complete */
|
||||
if(c_gameTDB.IsLoaded())
|
||||
c_gameTDB.CloseFile();
|
||||
coverIDList.clear();
|
||||
@ -1583,6 +1600,8 @@ int CMenu::_gametdbDownloaderAsync()
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg4", L"Saving %s"), "wiitdb.zip");
|
||||
m_thrdMessageAdded = true;
|
||||
res = fsop_WriteFile(zippath, download.data, download.size);
|
||||
if(download.data != NULL)
|
||||
free(download.data);
|
||||
}
|
||||
if(res == false)
|
||||
{
|
||||
@ -1654,8 +1673,12 @@ int CMenu::_downloadBannerAsync()
|
||||
if(banner_location != NULL)
|
||||
fsop_WriteFile(banner_location, download.data, download.size);
|
||||
update_pThread(1);// its saved
|
||||
if(download.data != NULL)
|
||||
free(download.data);
|
||||
return 0;
|
||||
}
|
||||
if(download.data != NULL)
|
||||
free(download.data);
|
||||
return -3;// download failed
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,7 @@ void BufferCircle::SetBufferBlockSize(int size)
|
||||
|
||||
void BufferCircle::Resize(int size)
|
||||
{
|
||||
// this while() only gets done if new size is smaller than old size
|
||||
while(size < Size())
|
||||
RemoveBuffer(Size()-1);
|
||||
|
||||
@ -71,6 +72,7 @@ void BufferCircle::Resize(int size)
|
||||
BufferSize.resize(size);
|
||||
BufferReady.resize(size);
|
||||
|
||||
// this for() only gets done if new size is bigger than old size
|
||||
for(int i = oldSize; i < Size(); i++)
|
||||
{
|
||||
if(BufferBlockSize > 0)
|
||||
|
@ -176,12 +176,24 @@ void Musicplayer::Stop()
|
||||
{
|
||||
if(!MusicFile.IsPlaying())
|
||||
return;
|
||||
MusicFile.Pause();// why not Stop()
|
||||
MusicFile.Pause();// pause for now
|
||||
CurrentPosition = SoundHandle.Decoder(MusicFile.GetVoice())->Tell();
|
||||
MusicFile.FreeMemory();
|
||||
MusicFile.FreeMemory();// does MusicFile.Stop() then frees mem
|
||||
MusicStopped = true;
|
||||
}
|
||||
|
||||
void Musicplayer::Pause()
|
||||
{
|
||||
if(!MusicFile.IsPlaying())
|
||||
return;
|
||||
MusicFile.Pause();
|
||||
}
|
||||
|
||||
void Musicplayer::Resume()
|
||||
{
|
||||
MusicFile.Resume();
|
||||
}
|
||||
|
||||
void Musicplayer::Tick(bool attenuate)// attenuate means fade to zero volume
|
||||
{
|
||||
if(FileNames.empty())
|
||||
|
@ -41,6 +41,8 @@ public:
|
||||
void Previous();
|
||||
void Next();
|
||||
void Stop();
|
||||
void Pause();
|
||||
void Resume();
|
||||
|
||||
bool IsStopped() { return MusicStopped; };
|
||||
|
||||
|
@ -48,7 +48,7 @@ static bool VoiceUsed[MAX_SND_VOICES] =
|
||||
|
||||
static inline int GetFirstUnusedVoice()
|
||||
{
|
||||
for(u8 i = 0; i < MAX_SND_VOICES; i++)
|
||||
for(u8 i = 2; i < MAX_SND_VOICES; i++)// voice 0 is bg music, voice 1 is gamesound
|
||||
{
|
||||
if(VoiceUsed[i] == false)
|
||||
return i;
|
||||
|
@ -38,9 +38,12 @@ public:
|
||||
//!Copy Constructor
|
||||
GuiSound(GuiSound *g);
|
||||
//!Constructor
|
||||
//!\param file path
|
||||
//!\param voice number - if blank defaults to first unused voice 2-15
|
||||
GuiSound(const char *path, int voice = -1);
|
||||
//!Constructor
|
||||
//!\param sound Pointer to the sound data
|
||||
//!\param filesize Length of sound data
|
||||
GuiSound(const char *path, int voice = -1);
|
||||
GuiSound(const u8 * snd, u32 len, const char *name, bool allocated = false, int voice = -1);
|
||||
//!Stops sound and frees all memory/closes files
|
||||
void FreeMemory();
|
||||
|
Loading…
Reference in New Issue
Block a user