-added a random game boot function, simply press b on the question

mark icon, it will boot something of the current coverflow
-made screenshot feature working with nunchuck/classic controller
too, just press Z/ZR
-updated the english.txt help
This commit is contained in:
fix94.1 2013-03-31 00:57:42 +00:00
parent a40bd5286a
commit b24b4ef37b
8 changed files with 52 additions and 23 deletions

View File

@ -14,6 +14,7 @@ Controls:
-- B+Onscreen Arrows = Alphabetic search -- B+Onscreen Arrows = Alphabetic search
-- B+Minus = Switch Partition -- B+Minus = Switch Partition
-- B+Plus = Sort Games -- B+Plus = Sort Games
-- Z / ZR = Take Screenshot
-- A on Star Icon = Favorites -- A on Star Icon = Favorites
-- B on Star Icon = Categories -- 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 -- 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 Disc Icon (Game Disc in Drive) = Launch game disc
-- A on Question Mark Icon = Display credits and this help file -- 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: - Game:
-- A on box = Show the backside -- A on box = Show the backside

View File

@ -6,6 +6,7 @@
#define WBTN_HOME (WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME) #define WBTN_HOME (WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME)
#define WBTN_MINUS (WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_FULL_L) #define WBTN_MINUS (WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_FULL_L)
#define WBTN_PLUS (WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_FULL_R) #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_A (WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A)
#define WBTN_B (WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B) #define WBTN_B (WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B)
#define WBTN_1 (WPAD_BUTTON_1 | WPAD_CLASSIC_BUTTON_Y) #define WBTN_1 (WPAD_BUTTON_1 | WPAD_CLASSIC_BUTTON_Y)
@ -18,6 +19,7 @@
#define WBTN_HOME_PRESSED (wii_btnsPressed & WBTN_HOME) #define WBTN_HOME_PRESSED (wii_btnsPressed & WBTN_HOME)
#define WBTN_MINUS_PRESSED (wii_btnsPressed & WBTN_MINUS) #define WBTN_MINUS_PRESSED (wii_btnsPressed & WBTN_MINUS)
#define WBTN_PLUS_PRESSED (wii_btnsPressed & WBTN_PLUS) #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_A_PRESSED (wii_btnsPressed & WBTN_A)
#define WBTN_B_PRESSED (wii_btnsPressed & WBTN_B) #define WBTN_B_PRESSED (wii_btnsPressed & WBTN_B)
#define WBTN_1_PRESSED (wii_btnsPressed & WBTN_1) #define WBTN_1_PRESSED (wii_btnsPressed & WBTN_1)
@ -42,6 +44,7 @@
#define GBTN_START (PAD_BUTTON_MENU) #define GBTN_START (PAD_BUTTON_MENU)
#define GBTN_L (PAD_TRIGGER_L) #define GBTN_L (PAD_TRIGGER_L)
#define GBTN_R (PAD_TRIGGER_R) #define GBTN_R (PAD_TRIGGER_R)
#define GBTN_Z (PAD_TRIGGER_Z)
#define GBTN_A (PAD_BUTTON_A) #define GBTN_A (PAD_BUTTON_A)
#define GBTN_B (PAD_BUTTON_B) #define GBTN_B (PAD_BUTTON_B)
#define GBTN_1 (PAD_BUTTON_Y) #define GBTN_1 (PAD_BUTTON_Y)
@ -54,6 +57,7 @@
#define GBTN_START_PRESSED (gc_btnsPressed & GBTN_START) #define GBTN_START_PRESSED (gc_btnsPressed & GBTN_START)
#define GBTN_L_PRESSED (gc_btnsPressed & GBTN_L) #define GBTN_L_PRESSED (gc_btnsPressed & GBTN_L)
#define GBTN_R_PRESSED (gc_btnsPressed & GBTN_R) #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_A_PRESSED (gc_btnsPressed & GBTN_A)
#define GBTN_B_PRESSED (gc_btnsPressed & GBTN_B) #define GBTN_B_PRESSED (gc_btnsPressed & GBTN_B)
#define GBTN_1_PRESSED (gc_btnsPressed & GBTN_1) #define GBTN_1_PRESSED (gc_btnsPressed & GBTN_1)

View File

@ -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; 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 wstringEx CCoverFlow::getTitle(void) const
{ {
if (m_covers == NULL) return L""; if (m_covers == NULL) return L"";

View File

@ -46,6 +46,7 @@ public:
void reserve(u32 capacity); void reserve(u32 capacity);
void addItem(dir_discHdr *hdr, int playcount = 0, unsigned int lastPlayed = 0); void addItem(dir_discHdr *hdr, int playcount = 0, unsigned int lastPlayed = 0);
bool empty(void) const { return m_items.empty(); } bool empty(void) const { return m_items.empty(); }
u32 size(void) const { return m_items.size(); }
// //
bool start(); bool start();
void stopCoverLoader(bool empty = false); void stopCoverLoader(bool empty = false);
@ -130,6 +131,7 @@ public:
const char *getNextId(void) const; const char *getNextId(void) const;
const dir_discHdr * getHdr(void) const; const dir_discHdr * getHdr(void) const;
const dir_discHdr * getNextHdr(void) const; const dir_discHdr * getNextHdr(void) const;
const dir_discHdr * getSpecificHdr(u32) const;
wstringEx getTitle(void) const; wstringEx getTitle(void) const;
u64 getChanTitle(void) const; u64 getChanTitle(void) const;
// //

View File

@ -1986,7 +1986,7 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
} }
//Take Screenshot //Take Screenshot
if(gc_btnsPressed & PAD_TRIGGER_Z) if(WBTN_Z_PRESSED || GBTN_Z_PRESSED)
{ {
time_t rawtime; time_t rawtime;
struct tm *timeinfo; struct tm *timeinfo;

View File

@ -988,7 +988,7 @@ private:
void _netInit(); void _netInit();
bool _loadFile(u8 * &buffer, u32 &size, const char *path, const char *file); bool _loadFile(u8 * &buffer, u32 &size, const char *path, const char *file);
int _loadIOS(u8 ios, int userIOS, string id, bool RealNAND_Channels = false); 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 _launchGame(dir_discHdr *hdr, bool dvd);
void _launchChannel(dir_discHdr *hdr); void _launchChannel(dir_discHdr *hdr);
void _launchHomebrew(const char *filepath, vector<string> arguments); void _launchHomebrew(const char *filepath, vector<string> arguments);

View File

@ -800,53 +800,55 @@ void CMenu::_launchShutdown()
exitHandler(PRIILOADER_DEF); //Making wiiflow ready to boot something 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 */ /* Lets boot that shit */
if(hdr->type == TYPE_WII_GAME) if(launchHdr.type == TYPE_WII_GAME)
_launchGame(hdr, false); _launchGame(&launchHdr, false);
else if(hdr->type == TYPE_GC_GAME) else if(launchHdr.type == TYPE_GC_GAME)
_launchGC(hdr, false); _launchGC(&launchHdr, false);
else if(hdr->type == TYPE_CHANNEL) else if(launchHdr.type == TYPE_CHANNEL)
_launchChannel(hdr); _launchChannel(&launchHdr);
else if(hdr->type == TYPE_PLUGIN) 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); u8 plugin_dol_len = strlen(plugin_dol_name);
char title[101]; char title[101];
memset(&title, 0, sizeof(title)); memset(&title, 0, sizeof(title));
const char *path = NULL; 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) 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; m_exit = false;
return; return;
} }
strncpy(title, strrchr(hdr->path, '/') + 1, 100); strncpy(title, strrchr(launchHdr.path, '/') + 1, 100);
*strrchr(hdr->path, '/') = '\0'; *strrchr(launchHdr.path, '/') = '\0';
path = strchr(hdr->path, '/') + 1; path = strchr(launchHdr.path, '/') + 1;
} }
else else
{ {
path = hdr->path; path = launchHdr.path;
wcstombs(title, hdr->title, 63); wcstombs(title, launchHdr.title, 63);
} }
m_cfg.setString(PLUGIN_DOMAIN, "current_item", title); m_cfg.setString(PLUGIN_DOMAIN, "current_item", title);
const char *device = (currentPartition == 0 ? "sd" : (DeviceHandle.GetFSType(currentPartition) == PART_FS_NTFS ? "ntfs" : "usb")); 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); const char *loader = fmt("%s:/%s/WiiFlowLoader.dol", device, strchr(m_pluginsDir.c_str(), '/') + 1);
vector<string> arguments = m_plugin.CreateArgs(device, path, title, loader, hdr->settings[0]); vector<string> arguments = m_plugin.CreateArgs(device, path, title, loader, launchHdr.settings[0]);
_launchHomebrew(fmt("%s/%s", m_pluginsDir.c_str(), plugin_dol_name), arguments); _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)) if(!fsop_FileExist(gamepath))
gamepath = fmt("%s/boot.elf", hdr->path); gamepath = fmt("%s/boot.elf", launchHdr.path);
if(fsop_FileExist(gamepath)) 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); _launchHomebrew(gamepath, m_homebrewArgs);
} }
} }

View File

@ -549,6 +549,19 @@ int CMenu::main(void)
m_btnMgr.show(m_mainLblNotice); 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) else if(WROLL_LEFT)
{ {