diff --git a/source/defines.h b/source/defines.h index fc643e72..477d17ca 100644 --- a/source/defines.h +++ b/source/defines.h @@ -25,6 +25,7 @@ #define CHANNEL_DOMAIN "NAND" #define PLUGIN_DOMAIN "EMULATOR" #define HOMEBREW_DOMAIN "HOMEBREW" +#define MUSIC_DOMAIN "MUSIC" #define AGE_LOCK_DEFAULT 13 diff --git a/source/menu/menu.hpp b/source/menu/menu.hpp index 6af0e5cc..81d9dace 100644 --- a/source/menu/menu.hpp +++ b/source/menu/menu.hpp @@ -988,6 +988,7 @@ private: void _launchChannel(dir_discHdr *hdr); void _launchHomebrew(const char *filepath, vector arguments); void _launchGC(dir_discHdr *hdr, bool disc); + void _launchShutdown(); void _setAA(int aa); void _loadCFCfg(); void _loadCFLayout(int version, bool forceAA = false, bool otherScrnFmt = false); diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index aa77cfb7..684267ef 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -629,11 +629,6 @@ void CMenu::_game(bool launch) currentPartition = SD; } - CoverFlow.clear(); - _showWaitMessage(); - exitHandler(PRIILOADER_DEF); //Making wiiflow ready to boot something - - CurrentBanner.ClearBanner(); // Get banner_title if(hdr->type == TYPE_CHANNEL) _extractChannelBnr(chantitle); @@ -662,8 +657,8 @@ void CMenu::_game(bool launch) WPAD_SetVRes(chan, m_vid.width() + m_cursor[chan].width(), m_vid.height() + m_cursor[chan].height()); m_gcfg2.unload(); _showGame(); - _initCF(); - CoverFlow.select(); + //_initCF(); + //CoverFlow.select(); } else { @@ -799,6 +794,14 @@ void CMenu::directlaunch(const char *GameID) error(sfmt("errgame1", L"Cannot find the game with ID: %s", GameID)); } +void CMenu::_launchShutdown() +{ + CoverFlow.clear(); + _showWaitMessage(); + exitHandler(PRIILOADER_DEF); //Making wiiflow ready to boot something + CurrentBanner.ClearBanner(); +} + void CMenu::_launch(dir_discHdr *hdr) { /* Lets boot that shit */ @@ -810,11 +813,19 @@ void CMenu::_launch(dir_discHdr *hdr) _launchChannel(hdr); else if(hdr->type == TYPE_PLUGIN) { + const char *plugin_dol_name = m_plugin.GetDolName(hdr->settings[0]); + u8 plugin_dol_len = strlen(plugin_dol_name); char title[101]; memset(&title, 0, sizeof(title)); - const char *path; + const char *path = NULL; if(strchr(hdr->path, ':') != NULL) { + if(plugin_dol_len == strlen(MUSIC_DOMAIN) && strcmp(plugin_dol_name, MUSIC_DOMAIN) == 0) + { + MusicPlayer.LoadFile(hdr->path, false); + m_exit = false; + return; + } strncpy(title, strrchr(hdr->path, '/') + 1, 100); *strrchr(hdr->path, '/') = '\0'; path = strchr(hdr->path, '/') + 1; @@ -828,7 +839,7 @@ void CMenu::_launch(dir_discHdr *hdr) const char *device = (currentPartition == 0 ? "sd" : (DeviceHandle.GetFSType(currentPartition) == PART_FS_NTFS ? "ntfs" : "usb")); const char *loader = fmt("%s:/%s/WiiFlowLoader.dol", device, strchr(m_pluginsDir.c_str(), '/') + 1); vector arguments = m_plugin.CreateArgs(device, path, title, loader, hdr->settings[0]); - _launchHomebrew(fmt("%s/%s", m_pluginsDir.c_str(), m_plugin.GetDolName(hdr->settings[0])), arguments); + _launchHomebrew(fmt("%s/%s", m_pluginsDir.c_str(), plugin_dol_name), arguments); } else if(hdr->type == TYPE_HOMEBREW) { @@ -847,6 +858,7 @@ void CMenu::_launch(dir_discHdr *hdr) void CMenu::_launchGC(dir_discHdr *hdr, bool disc) { + _launchShutdown(); const char *id = hdr->id; memcpy((u8*)Disc_ID, id, 6); DCFlushRange((u8*)Disc_ID, 32); @@ -959,6 +971,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) void CMenu::_launchHomebrew(const char *filepath, vector arguments) { + _launchShutdown(); m_gcfg1.save(true); m_gcfg2.save(true); m_cat.save(true); @@ -1063,6 +1076,7 @@ int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id, bool RealNAND_Channels) void CMenu::_launchChannel(dir_discHdr *hdr) { + _launchShutdown(); u32 gameIOS = 0; string id = string(hdr->id); @@ -1182,6 +1196,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr) void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) { + _launchShutdown(); string id(hdr->id); string path(hdr->path); if(neek2o()) diff --git a/source/music/MusicPlayer.cpp b/source/music/MusicPlayer.cpp index f09850cc..51538121 100644 --- a/source/music/MusicPlayer.cpp +++ b/source/music/MusicPlayer.cpp @@ -138,12 +138,17 @@ void Musicplayer::Tick(bool attenuate) void Musicplayer::LoadCurrentFile() { - MusicFile.Load((*CurrentFileName).c_str()); + LoadFile(CurrentFileName->c_str()); +} + +void Musicplayer::LoadFile(const char *name, bool display_change) +{ + MusicFile.Load(name); SetVolume(CurrentVolume); MusicFile.Play(); CurrentPosition = 0; MusicStopped = false; - MusicChanged = true; + MusicChanged = display_change; } /* For our GUI */ diff --git a/source/music/MusicPlayer.hpp b/source/music/MusicPlayer.hpp index a682a7ca..8ee88377 100644 --- a/source/music/MusicPlayer.hpp +++ b/source/music/MusicPlayer.hpp @@ -47,6 +47,8 @@ public: bool SongChanged(); time_t DisplayTime; bool OneSong; + /* Plugin */ + void LoadFile(const char *name, bool display_change = true); protected: bool PosFromPrevFile(); void LoadCurrentFile();