diff --git a/data/help/english.txt b/data/help/english.txt index 9f9519b1..e43c00fe 100644 --- a/data/help/english.txt +++ b/data/help/english.txt @@ -14,6 +14,7 @@ Controls: -- B+Onscreen Arrows = Alphabetic search -- B+Minus = Switch Partition -- B+Plus = Sort Games +-- Z / ZR = Take Screenshot -- A on Star Icon = Favorites -- B on Star Icon = Categories @@ -24,6 +25,7 @@ Controls: -- Hold B for 3 seconds / B on Home Icon (wiimote_gestures enabled) = Display Source menu -- A on Disc Icon (Game Disc in Drive) = Launch game disc -- A on Question Mark Icon = Display credits and this help file +-- B on Question Mark Icon = Boot a random game of the current coverflow - Game: -- A on box = Show the backside diff --git a/source/btnmap.h b/source/btnmap.h index 176d386b..04838028 100644 --- a/source/btnmap.h +++ b/source/btnmap.h @@ -6,6 +6,7 @@ #define WBTN_HOME (WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME) #define WBTN_MINUS (WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_FULL_L) #define WBTN_PLUS (WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_FULL_R) +#define WBTN_Z (WPAD_NUNCHUK_BUTTON_Z | WPAD_CLASSIC_BUTTON_ZR) #define WBTN_A (WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A) #define WBTN_B (WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B) #define WBTN_1 (WPAD_BUTTON_1 | WPAD_CLASSIC_BUTTON_Y) @@ -18,6 +19,7 @@ #define WBTN_HOME_PRESSED (wii_btnsPressed & WBTN_HOME) #define WBTN_MINUS_PRESSED (wii_btnsPressed & WBTN_MINUS) #define WBTN_PLUS_PRESSED (wii_btnsPressed & WBTN_PLUS) +#define WBTN_Z_PRESSED (wii_btnsPressed & WBTN_Z) #define WBTN_A_PRESSED (wii_btnsPressed & WBTN_A) #define WBTN_B_PRESSED (wii_btnsPressed & WBTN_B) #define WBTN_1_PRESSED (wii_btnsPressed & WBTN_1) @@ -42,6 +44,7 @@ #define GBTN_START (PAD_BUTTON_MENU) #define GBTN_L (PAD_TRIGGER_L) #define GBTN_R (PAD_TRIGGER_R) +#define GBTN_Z (PAD_TRIGGER_Z) #define GBTN_A (PAD_BUTTON_A) #define GBTN_B (PAD_BUTTON_B) #define GBTN_1 (PAD_BUTTON_Y) @@ -54,6 +57,7 @@ #define GBTN_START_PRESSED (gc_btnsPressed & GBTN_START) #define GBTN_L_PRESSED (gc_btnsPressed & GBTN_L) #define GBTN_R_PRESSED (gc_btnsPressed & GBTN_R) +#define GBTN_Z_PRESSED (gc_btnsPressed & GBTN_Z) #define GBTN_A_PRESSED (gc_btnsPressed & GBTN_A) #define GBTN_B_PRESSED (gc_btnsPressed & GBTN_B) #define GBTN_1_PRESSED (gc_btnsPressed & GBTN_1) diff --git a/source/gui/coverflow.cpp b/source/gui/coverflow.cpp index 0a3374d8..eb5666f5 100644 --- a/source/gui/coverflow.cpp +++ b/source/gui/coverflow.cpp @@ -1523,6 +1523,12 @@ const dir_discHdr * CCoverFlow::getNextHdr(void) const return m_items[loopNum(m_covers[m_range / 2].index + m_jump + 1, m_items.size())].hdr; } +const dir_discHdr * CCoverFlow::getSpecificHdr(u32 place) const +{ + if (m_covers == NULL || m_items.empty() || place >= m_items.size()) return NULL; + return m_items[place].hdr; +} + wstringEx CCoverFlow::getTitle(void) const { if (m_covers == NULL) return L""; diff --git a/source/gui/coverflow.hpp b/source/gui/coverflow.hpp index c31ff812..28df0266 100644 --- a/source/gui/coverflow.hpp +++ b/source/gui/coverflow.hpp @@ -46,6 +46,7 @@ public: void reserve(u32 capacity); void addItem(dir_discHdr *hdr, int playcount = 0, unsigned int lastPlayed = 0); bool empty(void) const { return m_items.empty(); } + u32 size(void) const { return m_items.size(); } // bool start(); void stopCoverLoader(bool empty = false); @@ -130,6 +131,7 @@ public: const char *getNextId(void) const; const dir_discHdr * getHdr(void) const; const dir_discHdr * getNextHdr(void) const; + const dir_discHdr * getSpecificHdr(u32) const; wstringEx getTitle(void) const; u64 getChanTitle(void) const; // diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index 2cf19fc6..7a8101f2 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -1986,7 +1986,7 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting) } //Take Screenshot - if(gc_btnsPressed & PAD_TRIGGER_Z) + if(WBTN_Z_PRESSED || GBTN_Z_PRESSED) { time_t rawtime; struct tm *timeinfo; diff --git a/source/menu/menu.hpp b/source/menu/menu.hpp index 2548644c..dd12428c 100644 --- a/source/menu/menu.hpp +++ b/source/menu/menu.hpp @@ -988,7 +988,7 @@ private: void _netInit(); bool _loadFile(u8 * &buffer, u32 &size, const char *path, const char *file); int _loadIOS(u8 ios, int userIOS, string id, bool RealNAND_Channels = false); - void _launch(dir_discHdr *hdr); + void _launch(const dir_discHdr *hdr); void _launchGame(dir_discHdr *hdr, bool dvd); void _launchChannel(dir_discHdr *hdr); void _launchHomebrew(const char *filepath, vector arguments); diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index b29e7e2c..1b8e4f19 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -800,53 +800,55 @@ void CMenu::_launchShutdown() exitHandler(PRIILOADER_DEF); //Making wiiflow ready to boot something } -void CMenu::_launch(dir_discHdr *hdr) +void CMenu::_launch(const dir_discHdr *hdr) { + dir_discHdr launchHdr; + memcpy(&launchHdr, hdr, sizeof(dir_discHdr)); /* Lets boot that shit */ - if(hdr->type == TYPE_WII_GAME) - _launchGame(hdr, false); - else if(hdr->type == TYPE_GC_GAME) - _launchGC(hdr, false); - else if(hdr->type == TYPE_CHANNEL) - _launchChannel(hdr); - else if(hdr->type == TYPE_PLUGIN) + if(launchHdr.type == TYPE_WII_GAME) + _launchGame(&launchHdr, false); + else if(launchHdr.type == TYPE_GC_GAME) + _launchGC(&launchHdr, false); + else if(launchHdr.type == TYPE_CHANNEL) + _launchChannel(&launchHdr); + else if(launchHdr.type == TYPE_PLUGIN) { - const char *plugin_dol_name = m_plugin.GetDolName(hdr->settings[0]); + const char *plugin_dol_name = m_plugin.GetDolName(launchHdr.settings[0]); u8 plugin_dol_len = strlen(plugin_dol_name); char title[101]; memset(&title, 0, sizeof(title)); const char *path = NULL; - if(strchr(hdr->path, ':') != NULL) + if(strchr(launchHdr.path, ':') != NULL) { if(plugin_dol_len == strlen(MUSIC_DOMAIN) && strcmp(plugin_dol_name, MUSIC_DOMAIN) == 0) { - MusicPlayer.LoadFile(hdr->path, false); + MusicPlayer.LoadFile(launchHdr.path, false); m_exit = false; return; } - strncpy(title, strrchr(hdr->path, '/') + 1, 100); - *strrchr(hdr->path, '/') = '\0'; - path = strchr(hdr->path, '/') + 1; + strncpy(title, strrchr(launchHdr.path, '/') + 1, 100); + *strrchr(launchHdr.path, '/') = '\0'; + path = strchr(launchHdr.path, '/') + 1; } else { - path = hdr->path; - wcstombs(title, hdr->title, 63); + path = launchHdr.path; + wcstombs(title, launchHdr.title, 63); } m_cfg.setString(PLUGIN_DOMAIN, "current_item", title); 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]); + vector arguments = m_plugin.CreateArgs(device, path, title, loader, launchHdr.settings[0]); _launchHomebrew(fmt("%s/%s", m_pluginsDir.c_str(), plugin_dol_name), arguments); } - else if(hdr->type == TYPE_HOMEBREW) + else if(launchHdr.type == TYPE_HOMEBREW) { - const char *gamepath = fmt("%s/boot.dol", hdr->path); + const char *gamepath = fmt("%s/boot.dol", launchHdr.path); if(!fsop_FileExist(gamepath)) - gamepath = fmt("%s/boot.elf", hdr->path); + gamepath = fmt("%s/boot.elf", launchHdr.path); if(fsop_FileExist(gamepath)) { - m_cfg.setString(HOMEBREW_DOMAIN, "current_item", strrchr(hdr->path, '/') + 1); + m_cfg.setString(HOMEBREW_DOMAIN, "current_item", strrchr(launchHdr.path, '/') + 1); _launchHomebrew(gamepath, m_homebrewArgs); } } diff --git a/source/menu/menu_main.cpp b/source/menu/menu_main.cpp index 0315856f..a58afbdc 100644 --- a/source/menu/menu_main.cpp +++ b/source/menu/menu_main.cpp @@ -549,6 +549,19 @@ int CMenu::main(void) m_btnMgr.show(m_mainLblNotice); } } + else if(m_btnMgr.selected(m_mainBtnInfo) && !CoverFlow.empty()) + { + /* WiiFlow should boot a random game */ + _hideMain(); + srand(time(NULL)); + u16 place = (rand() + rand() + rand()) % CoverFlow.size(); + gprintf("Lets boot the random game number %u\n", place); + const dir_discHdr *gameHdr = CoverFlow.getSpecificHdr(place); + if(gameHdr != NULL) + _launch(gameHdr); + /* Shouldnt happen */ + _showMain(); + } } else if(WROLL_LEFT) {