diff --git a/out/boot.dol b/out/boot.dol index 8b6059d3..d5d7c67b 100644 Binary files a/out/boot.dol and b/out/boot.dol differ diff --git a/source/banner/BannerWindow.cpp b/source/banner/BannerWindow.cpp index edfea707..c313b365 100644 --- a/source/banner/BannerWindow.cpp +++ b/source/banner/BannerWindow.cpp @@ -43,7 +43,7 @@ void BannerWindow::Init(u8 *font1, u8 *font2) AnimPosX = 0.5f * (ScreenProps.x - fIconWidth); AnimPosY = 0.5f * (ScreenProps.y - fIconHeight); AnimationRunning = false; - Brightness = 0; + //Brightness = 0; // this just looks better for banner/icon ratio xDiff = 0.5f * (m_vid.wide() ? (m_vid.vid_50hz() ? 616 : 620.0f) : 608.0f); @@ -222,7 +222,7 @@ void BannerWindow::Draw(void) void BannerWindow::ToggleGameSettings() { - ToggleZoom(); + //ToggleZoom(); Brightness = (Brightness == 200 ? 0 : 200); } diff --git a/source/channel/channel_launcher.h b/source/channel/channel_launcher.h index 2c110d6f..e7343995 100644 --- a/source/channel/channel_launcher.h +++ b/source/channel/channel_launcher.h @@ -4,12 +4,12 @@ #include #include -s32 BootChannel(u64 chantitle, u32 ios, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, int aspectRatio); +//s32 BootChannel(u64 chantitle, u32 ios, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, int aspectRatio); -u32 LoadChannel(u8 *buffer); -void PatchChannel(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio); +//u32 LoadChannel(u8 *buffer); +//void PatchChannel(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio); -u8 *GetDol(u64 title, u32 bootcontent); +//u8 *GetDol(u64 title, u32 bootcontent); bool Identify(u64 titleid); bool Identify_GenerateTik(signed_blob **outbuf, u32 *outlen); diff --git a/source/defines.h b/source/defines.h index 13aefab0..8a453c73 100644 --- a/source/defines.h +++ b/source/defines.h @@ -4,7 +4,7 @@ #define APP_DATA_DIR "wiiflow" #define APPS_DIR "apps/wiiflow_lite" -#define EMU_NANDS_DIR "nands" +//#define EMU_NANDS_DIR "nands" #define GAMES_DIR "%s:/wbfs" #define HOMEBREW_DIR "%s:/apps" #define DF_GC_GAMES_DIR "%s:/games" diff --git a/source/gui/coverflow.cpp b/source/gui/coverflow.cpp index 766fa4e8..f0cfefb6 100644 --- a/source/gui/coverflow.cpp +++ b/source/gui/coverflow.cpp @@ -2086,9 +2086,12 @@ bool CCoverFlow::findId(const char *id, bool instant, bool path) { if(path) { + //homebrew folder or rom title.ext const char *name = strrchr(m_items[i].hdr->path, '/'); if(name != NULL && strcmp(name + 1, id) == 0) break; + else if(strcmp(m_items[i].hdr->path, id) == 0)// scummvm + break; } else if(strcmp(m_items[i].hdr->id, id) == 0) break; diff --git a/source/gui/video.cpp b/source/gui/video.cpp index 1e1b0b81..b19cf7a0 100644 --- a/source/gui/video.cpp +++ b/source/gui/video.cpp @@ -114,7 +114,7 @@ GXRModeObj TVPal574IntDfScale = struct movieP normalMoviePos = { 410, 31, 610, 181 }; struct movieP zoomedMoviePos = { 0, 0, 640, 480 }; -struct movieP currentMoviePos = normalMoviePos; +struct movieP currentMoviePos = zoomedMoviePos; const int CVideo::_stencilWidth = 128; const int CVideo::_stencilHeight = 128; diff --git a/source/loader/disc.h b/source/loader/disc.h index f9e22018..821b14de 100644 --- a/source/loader/disc.h +++ b/source/loader/disc.h @@ -75,8 +75,8 @@ struct dir_discHdr { char id[7]; //6+1 for null character - char path[256]; - wchar_t title[64]; + char path[256]; // full path including partion - path - rom.ext or game.iso or id6.wbfs + wchar_t title[64]; // wide character title used for displaying title in coverflow u32 settings[2]; //chantitle, plugin magic, crc32, gamecube game on sd, etc u8 type; diff --git a/source/loader/nk.c b/source/loader/nk.c index b8055bc8..7bfe0278 100644 --- a/source/loader/nk.c +++ b/source/loader/nk.c @@ -79,9 +79,14 @@ bool Load_Neek2o_Kernel() if(neek2o()) return ret; - Kernel = fsop_ReadFile("usb1:/sneek/kernel.bin", &kernelSize); - if(Kernel == NULL) - Kernel = fsop_ReadFile("sd:/sneek/kernel.bin", &kernelSize); + if(IsOnWiiU()) + Kernel = fsop_ReadFile("usb1:/sneek/vwiikernel.bin", &kernelSize); + else + { + Kernel = fsop_ReadFile("usb1:/sneek/kernel.bin", &kernelSize); + if(Kernel == NULL) + Kernel = fsop_ReadFile("sd:/sneek/kernel.bin", &kernelSize); + } if(Kernel == NULL) ret = false; @@ -126,13 +131,14 @@ s32 Launch_nk(u64 TitleID, const char *nandpath, u64 ReturnTo) if(!mini) return 0; + // uses bootmii mini to run wiiflow internal armboot.bin for neek2o memcpy(mini, armboot, armboot_size); DCFlushRange(mini, armboot_size); - *(u32*)0xc150f000 = 0x424d454d; + *(u32*)0xc150f000 = 0x424d454d;//BMEM asm volatile("eieio"); *(u32*)0xc150f004 = MEM_VIRTUAL_TO_PHYSICAL(mini); asm volatile("eieio"); - IOS_ReloadIOS(0xfe); + IOS_ReloadIOS(0xfe);// IOS254 bootmii MEM1_free(mini); return 1; } diff --git a/source/loader/sys.c b/source/loader/sys.c index b1f9a926..b004957d 100644 --- a/source/loader/sys.c +++ b/source/loader/sys.c @@ -110,11 +110,11 @@ void Sys_Exit(void) /* We wanna to boot sth */ WII_Initialize(); if(ExitOption == EXIT_TO_WFNK2O) - Launch_nk(0x1000144574641LL, NeekPath, 0); + Launch_nk(0x1000157464C41LL, NeekPath, 0);// 57464C41 = WFLA : 44574641 = DWFA else if(ExitOption == EXIT_TO_SMNK2O) Launch_nk(0, NeekPath, 0); else if(ExitOption == EXIT_TO_BOOTMII) - IOS_ReloadIOS(0xfe); + IOS_ReloadIOS(0xfe);// IOS254 Bootmii IOS else if(ExitOption == EXIT_TO_HBC) { WII_LaunchTitle(HBC_OHBC); diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index 6a68fd70..3330bcf2 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -304,6 +304,8 @@ void CMenu::init() } /* Emu nands init even if not being used */ + memset(emu_nands_dir, 0, 64); + strncpy(emu_nands_dir, IsOnWiiU() ? "vwiinands" : "nands", 64); _checkEmuNandSettings(false);// emu nand _checkEmuNandSettings(true);// saves nand @@ -478,15 +480,17 @@ void CMenu::cleanup() return; //gprintf("MEM1_freesize(): %i\nMEM2_freesize(): %i\n", MEM1_freesize(), MEM2_freesize()); m_btnMgr.hide(m_mainLblCurMusic); + _stopSounds(); + MusicPlayer.Cleanup(); _cleanupDefaultFont(); CoverFlow.shutdown(); /* possibly plugin flow crash so cleanup early */ m_banner.DeleteBanner(); m_plugin.Cleanup(); m_source.unload(); - _stopSounds(); + //_stopSounds(); _Theme_Cleanup(); - MusicPlayer.Cleanup(); + //MusicPlayer.Cleanup(); m_gameSound.FreeMemory(); SoundHandle.Cleanup(); soundDeinit(); @@ -1718,24 +1722,28 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting) if(Sys_Exiting()) exitHandler(BUTTON_CALLBACK); // check if we need to start playing the game/banner sound - if(withCF && m_gameSelected && m_gamesound_changed && !m_soundThrdBusy && - !m_gameSound.IsPlaying() && MusicPlayer.GetVolume() == 0) + // m_gameSelected means we are on the game selected menu + // m_gamesound_changed means a new game sound is loaded and ready to play + // the previous game sound needs to stop before playing new sound + // and the bg music volume needs to be 0 before playing game sound + if(withCF && m_gameSelected && m_gamesound_changed && !m_gameSound.IsPlaying() && MusicPlayer.GetVolume() == 0) { _stopGameSoundThread();// stop game sound loading thread m_gameSound.Play(m_bnrSndVol);// play game sound m_gamesound_changed = false; } // stop game/banner sound from playing if we exited game selected menu or if we move to new game - else if(!m_gameSelected) + else if((withCF && m_gameSelected && m_gamesound_changed && m_gameSound.IsPlaying()) || (!m_gameSelected && m_gameSound.IsPlaying())) m_gameSound.Stop(); /* decrease music volume to zero if any of these are true: - plugin video playing or + trailer video playing or + game/banner sound is being loaded because we are switching to a new game or game/banner sound is loaded and ready to play or - gamesound hasn't finished - when finishes music volume back to normal + gamesound hasn't finished - when finishes music volume back to normal - some gamesounds don't loop continuously also this switches to next song if current song is done */ - MusicPlayer.Tick(m_video_playing || - (m_gameSelected && m_gamesound_changed && m_gameSound.IsLoaded()) || - (m_gameSound.IsPlaying() && !m_gamesound_changed));//this checks if gamesound has finished and thus allows music to play + MusicPlayer.Tick((withCF && (m_video_playing || (m_gameSelected && m_soundThrdBusy) || + (m_gameSelected && m_gamesound_changed))) || + m_gameSound.IsPlaying()); // set song title and display it if music info is allowed if(MusicPlayer.SongChanged() && m_music_info) { @@ -2160,7 +2168,10 @@ void CMenu::_initCF(void) if(!CoverFlow.empty()) { - bool path = m_sourceflow || m_current_view == COVERFLOW_PLUGIN || m_current_view == COVERFLOW_HOMEBREW; + bool path = false; + if((m_source_cnt > 1 && m_cfg.getInt(_domainFromView(), "current_item_type", 1) == TYPE_PLUGIN) || + m_sourceflow || m_current_view == COVERFLOW_HOMEBREW || m_current_view == COVERFLOW_PLUGIN) + path = true; if(!CoverFlow.findId(m_cfg.getString(_domainFromView(), "current_item").c_str(), true, path)) CoverFlow.defaultLoad(); CoverFlow.startCoverLoader(); diff --git a/source/menu/menu.hpp b/source/menu/menu.hpp index 0851f975..b914e8ce 100644 --- a/source/menu/menu.hpp +++ b/source/menu/menu.hpp @@ -55,6 +55,7 @@ private: u8 m_catStartPage; u8 m_max_categories; bool m_clearCats; + bool m_newGame; bool show_mem; vector m_gameList; @@ -137,6 +138,7 @@ private: string m_helpDir; /* NandEmulation */ + char emu_nands_dir[64]; string m_saveExtGameId; bool m_forceext; bool m_emuSaveNand; @@ -1019,8 +1021,8 @@ private: void _updatePluginText(void); void _updatePluginCheckboxes(void); void _updateCheckboxes(void); - void _getIDCats(void); - void _setIDCats(void); + void _getGameCategories(void); + void _setGameCategories(void); void _setBg(const TexData &bgTex, const TexData &bglqTex); void _updateBg(void); void _drawBg(void); @@ -1087,6 +1089,7 @@ private: void _launchHomebrew(const char *filepath, vector arguments); void _launchGC(dir_discHdr *hdr, bool disc); void _launchShutdown(); + void _setCurrentItem(const dir_discHdr *hdr); void _exitWiiflow(); void exitHandler(int ExitTo); void _setAA(int aa); diff --git a/source/menu/menu_categories.cpp b/source/menu/menu_categories.cpp index 03c8e6dd..eff794c3 100644 --- a/source/menu/menu_categories.cpp +++ b/source/menu/menu_categories.cpp @@ -105,7 +105,7 @@ void CMenu::_updateCheckboxes(void) } -void CMenu::_getIDCats(void) +void CMenu::_getGameCategories(void) { const dir_discHdr *hdr = CoverFlow.getHdr(); switch(hdr->type) @@ -156,7 +156,7 @@ void CMenu::_getIDCats(void) m_btnMgr.setText(m_categoryLblTitle, CoverFlow.getTitle()); } -void CMenu::_setIDCats(void) +void CMenu::_setGameCategories(void) { const dir_discHdr *hdr = CoverFlow.getHdr(); string newIdCats = ""; @@ -176,6 +176,7 @@ void CMenu::_CategorySettings(bool fromGameSet) SetupInput(); curPage = 1; gameSet = fromGameSet; + m_newGame = false; if(m_source.loaded() && m_catStartPage > 0) curPage = m_catStartPage; @@ -188,7 +189,7 @@ void CMenu::_CategorySettings(bool fromGameSet) if(fromGameSet) { - _getIDCats(); + _getGameCategories(); } else { @@ -265,8 +266,8 @@ void CMenu::_CategorySettings(bool fromGameSet) } else { - _setIDCats(); - m_refreshGameList = true; + _setGameCategories(); + //m_refreshGameList = true; } break; } @@ -276,22 +277,26 @@ void CMenu::_CategorySettings(bool fromGameSet) m_btnMgr.down(); if(BTN_PLUS_PRESSED && fromGameSet) { - _setIDCats(); + _setGameCategories(); _hideCategorySettings(); CoverFlow.right(); curPage = 1; + m_newGame = true; m_categories.assign(m_max_categories, '0'); - _getIDCats(); + _playGameSound();//changes banner and game sound + _getGameCategories(); _showCategorySettings(); } if(BTN_MINUS_PRESSED && fromGameSet) { - _setIDCats(); + _setGameCategories(); _hideCategorySettings(); CoverFlow.left(); curPage = 1; + m_newGame = true; m_categories.assign(m_max_categories, '0'); - _getIDCats(); + _playGameSound(); + _getGameCategories(); _showCategorySettings(); } if((BTN_LEFT_PRESSED && m_max_categories>11) || (BTN_A_PRESSED && m_btnMgr.selected(m_categoryBtnPageM))) diff --git a/source/menu/menu_config_game.cpp b/source/menu/menu_config_game.cpp index 352963eb..2e81c371 100644 --- a/source/menu/menu_config_game.cpp +++ b/source/menu/menu_config_game.cpp @@ -467,10 +467,11 @@ void CMenu::_gameSettings(const dir_discHdr *hdr, bool disc) m_gcfg2.load(fmt("%s/" GAME_SETTINGS2_FILENAME, m_settingsDir.c_str())); GameHdr = hdr; const char *id = GameHdr->id; - //const char *id = CoverFlow.getId(); - //const dir_discHdr *GameHdr = CoverFlow.getHdr(); - videoScale = m_gcfg2.getInt(id, "nin_width", 127); - videoOffset = m_gcfg2.getInt(id, "nin_pos", 127); + if(GameHdr->type == TYPE_GC_GAME) + { + videoScale = m_gcfg2.getInt(id, "nin_width", 127); + videoOffset = m_gcfg2.getInt(id, "nin_pos", 127); + } m_gameSettingsPage = 1; _showGameSettings(); while(!m_exit) @@ -529,13 +530,7 @@ void CMenu::_gameSettings(const dir_discHdr *hdr, bool disc) } else if(m_btnMgr.selected(m_gameSettingsBtnLaunchNK)) { - //show error msg if emunand not on USB1 && neek2o doesn't exist - if(m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0) != 1) - error(_t("cfgg48", L"EmuNAND not on USB1!")); - else if(!fsop_FileExist("usb1:/sneek/kernel.bin")) - error(_t("cfgg49", L"Neek2o Not Found!")); - else - m_gcfg2.setBool(id, "useneek", !m_gcfg2.getBool(id, "useneek", 0)); + m_gcfg2.setBool(id, "useneek", !m_gcfg2.getBool(id, "useneek", 0)); _showGameSettings(); } else if(m_btnMgr.selected(m_gameSettingsBtnDevoMemcardEmu)) @@ -753,8 +748,11 @@ void CMenu::_gameSettings(const dir_discHdr *hdr, bool disc) // update these in case the user changed games while in cat menu id = CoverFlow.getId(); GameHdr = CoverFlow.getHdr(); - videoScale = m_gcfg2.getInt(id, "nin_width", 127); - videoOffset = m_gcfg2.getInt(id, "nin_pos", 127); + if(GameHdr->type == TYPE_GC_GAME) + { + videoScale = m_gcfg2.getInt(id, "nin_width", 127); + videoOffset = m_gcfg2.getInt(id, "nin_pos", 127); + } } _showGameSettings(); } diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 8048d34d..35edac6c 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -40,6 +40,7 @@ extern const u8 gc_ogg[]; extern const u32 gc_ogg_size; bool m_zoom_banner = false; +bool m_pluginBanner = false; s16 m_gameBtnPlayFull; s16 m_gameBtnBackFull; s16 m_gameBtnToggle; @@ -275,6 +276,14 @@ static u8 GetRequestedGameIOS(dir_discHdr *hdr) return IOS; } +void CMenu::_setCurrentItem(const dir_discHdr *hdr) +{ + const char *title = CoverFlow.getPathId(hdr, true);// with extension + m_cfg.setString(_domainFromView(), "current_item", title); + if(m_source_cnt > 1) + m_cfg.setInt(_domainFromView(), "current_item_type", hdr->type); +} + void CMenu::_hideGame(bool instant) { _cleanupVideo(); @@ -335,8 +344,11 @@ void CMenu::_cleanupVideo() static const char *getVideoPath(const string &videoDir, const char *videoId) { - const char *coverDir = m_plugin.GetCoverFolderName(CoverFlow.getHdr()->settings[0]); + const char *coverDir = NULL; const char *videoPath = NULL; + if(CoverFlow.getHdr()->type == TYPE_PLUGIN) + coverDir = m_plugin.GetCoverFolderName(CoverFlow.getHdr()->settings[0]); + if(coverDir == NULL || strlen(coverDir) == 0) videoPath = fmt("%s/%s", videoDir.c_str(), videoId); else @@ -356,23 +368,26 @@ bool CMenu::_startVideo() const dir_discHdr *GameHdr = CoverFlow.getHdr(); char curId3[4]; memset(curId3, 0, 4); - const char *videoId = CoverFlow.getPathId(GameHdr); + const char *videoId = CoverFlow.getPathId(GameHdr);//title.ext if(!NoGameID(GameHdr->type)) { //id3 memcpy(curId3, GameHdr->id, 3); videoId = curId3; } + //dev:/wiiflow/trailers/{coverfolder}/title.ext.thp or dev:/wiiflow/trailers/id3.thp const char *videoPath = getVideoPath(m_videoDir, videoId); const char *THP_Path = fmt("%s.thp", videoPath); if(!fsop_FileExist(THP_Path)) { if(GameHdr->type == TYPE_PLUGIN) { + //dev:/wiiflow/trailers/magic#.thp videoPath = getVideoDefaultPath(m_videoDir); THP_Path = fmt("%s.thp", videoPath); } else if(!NoGameID(GameHdr->type)) { + //id6 videoPath = getVideoPath(m_videoDir, GameHdr->id); THP_Path = fmt("%s.thp", videoPath); } @@ -396,6 +411,7 @@ bool CMenu::_startVideo() void CMenu::_game(bool launch) { + m_pluginBanner = false; bool coverFlipped = false; int cf_version = 1; string domain; @@ -405,6 +421,7 @@ void CMenu::_game(bool launch) dir_discHdr *hdr = (dir_discHdr*)MEM2_alloc(sizeof(dir_discHdr)); memcpy(hdr, CoverFlow.getHdr(), sizeof(dir_discHdr)); + _setCurrentItem(hdr); const char *id = NULL; char tmp1[74];// title/magic# @@ -430,17 +447,13 @@ void CMenu::_game(bool launch) } m_zoom_banner = m_cfg.getBool(_domainFromView(), "show_full_banner", false); - if(NoGameID(hdr->type)) - { - bool video_available = (hdr->type == TYPE_PLUGIN && - (fsop_FileExist(fmt("%s.thp", getVideoPath(m_videoDir, CoverFlow.getPathId(hdr)))) || - fsop_FileExist(fmt("%s.thp", getVideoDefaultPath(m_videoDir))))); - m_zoom_banner = m_zoom_banner && video_available; - } - currentMoviePos = (m_zoom_banner ? zoomedMoviePos : normalMoviePos); + if(m_banner.GetZoomSetting() != m_zoom_banner) m_banner.ToggleZoom(); + if(m_banner.GetInGameSettings()) + m_banner.ToggleGameSettings(); + m_gameSelected = true; s8 startGameSound = -7; SetupInput(); @@ -454,24 +467,14 @@ void CMenu::_game(bool launch) if(!launch) _mainLoopCommon(true); - - if(startGameSound == -1) - { - _cleanupBanner(true); - m_gameSelected = false; - } if(startGameSound == 0) { - m_gameSelected = true;// mark game selected and load sound/banner for main loop to start playing startGameSound = 1; _playGameSound(); } /* move and zoom flipped cover */ - if(coverFlipped && - (BTN_PLUS_PRESSED || BTN_MINUS_PRESSED || - BTN_LEFT_PRESSED || BTN_RIGHT_PRESSED || - BTN_UP_PRESSED || BTN_DOWN_PRESSED)) + if(coverFlipped) { float step = 0.05f; if(BTN_PLUS_PRESSED || BTN_MINUS_PRESSED) @@ -494,54 +497,62 @@ void CMenu::_game(bool launch) } CoverFlow.setCoverFlipPos(v); } - /* if B on favorites btn goto game categories */ - if(BTN_B_PRESSED && (m_btnMgr.selected(m_gameBtnFavoriteOn) || m_btnMgr.selected(m_gameBtnFavoriteOff))) + /* exit game menu */ + if(BTN_HOME_PRESSED) { - _hideGame(); - m_banner.SetShowBanner(false); - if(m_locked) - error(_t("errgame15", L"WiiFlow locked! Unlock WiiFlow to use this feature.")); - else - _CategorySettings(true); - _showGame(); - m_banner.SetShowBanner(true); - if(!m_gameSound.IsPlaying()) - startGameSound = -6; - continue; + _cleanupBanner();// also cleans up trailer movie including trailer sound + break; } - /* exit game menu or reset flipped cover */ - if(BTN_HOME_PRESSED || BTN_B_PRESSED) + else if(BTN_B_PRESSED) { - if(BTN_B_PRESSED && coverFlipped) + /* de flip cover */ + if(coverFlipped) { CoverFlow.flip(); coverFlipped = false; + m_banner.SetShowBanner(true); } + /* if B on favorites btn goto game categories */ + else if(m_btnMgr.selected(m_gameBtnFavoriteOn) || m_btnMgr.selected(m_gameBtnFavoriteOff)) + { + _hideGame(); + if(m_locked) + { + m_banner.SetShowBanner(false); + error(_t("errgame15", L"WiiFlow locked! Unlock WiiFlow to use this feature.")); + m_banner.SetShowBanner(true); + } + else + { + // the mainloop handles drawing banner while in settings + m_banner.ToggleZoom();//zoom to full + m_banner.ToggleGameSettings();// dim brightness + _CategorySettings(true); + m_banner.ToggleGameSettings();//reset brightness + m_banner.ToggleZoom();//de zoom to small + } + _showGame(); + if(m_newGame) + startGameSound = -10; + } + /* exit game selected menu */ else { _cleanupBanner(); break; } } - /* press + for game info screen */ - else if(BTN_PLUS_PRESSED && !NoGameID(hdr->type) && !coverFlipped) + /* display game info screen */ + else if(BTN_PLUS_PRESSED && !NoGameID(hdr->type) && !coverFlipped && !m_video_playing) { - GameTDB m_gametdb; - m_gametdb.OpenFile(fmt("%s/wiitdb.xml", m_settingsDir.c_str())); - if(m_gametdb.IsLoaded()) - { - _hideGame(); - m_banner.SetShowBanner(false); - _gameinfo(); - m_gametdb.CloseFile(); - _showGame(); - m_banner.SetShowBanner(true); - if(!m_gameSound.IsPlaying())// this makes the game sound play when we return - startGameSound = -6; - } + _hideGame();// stops trailer movie too + m_banner.SetShowBanner(false); + _gameinfo(); + _showGame(); + m_banner.SetShowBanner(true); } - /* play or stop a video (this is the old video play for non plugin games) */ - else if(BTN_MINUS_PRESSED && !coverFlipped && !NoGameID(hdr->type)) + /* play or stop a trailer video */ + else if(BTN_MINUS_PRESSED && !coverFlipped) { if(m_video_playing) { @@ -555,7 +566,8 @@ void CMenu::_game(bool launch) else _startVideo(); } - else if((BTN_1_PRESSED || BTN_2_PRESSED) && !coverFlipped) + /* switch coverflow layout */ + else if((BTN_1_PRESSED || BTN_2_PRESSED) && !coverFlipped && !m_video_playing) { s8 direction = BTN_1_PRESSED ? 1 : -1; int cfVersion = loopNum((_getCFVersion() - 1) + direction, m_numCFVersions) + 1; @@ -565,6 +577,7 @@ void CMenu::_game(bool launch) } else if(launch || BTN_A_PRESSED) { + /* delete button */ if(m_btnMgr.selected(m_gameBtnDelete)) { _hideGame(); @@ -573,32 +586,22 @@ void CMenu::_game(bool launch) error(_t("errgame15", L"WiiFlow locked! Unlock WiiFlow to use this feature.")); else if(hdr->type == TYPE_CHANNEL) error(_t("errgame17", L"Can not delete real NAND Channels!")); - else if(hdr->type == TYPE_PLUGIN) - { - const char *wfcPath = NULL; - const char *coverDir = NULL; - if(m_cfg.getBool(PLUGIN_DOMAIN, "subfolder_cache")) - coverDir = m_plugin.GetCoverFolderName(hdr->settings[0]); - if(coverDir == NULL || strlen(coverDir) == 0) - wfcPath = fmt("%s/%s.wfc", m_cacheDir.c_str(), CoverFlow.getPathId(hdr, true)); - else - wfcPath = fmt("%s/%s/%s.wfc", m_cacheDir.c_str(), coverDir, CoverFlow.getPathId(hdr, true)); - fsop_deleteFile(wfcPath); - CoverFlow.stopCoverLoader(true); - CoverFlow.startCoverLoader(); - } - else + else /* delete wii, gamecube, emunand game or plugin rom */ { if(_wbfsOp(WO_REMOVE_GAME)) { + m_refreshGameList = false; + _setCurrentItem(CoverFlow.getNextHdr()); _cleanupBanner(); - break; + _loadList(); + _initCF(); + CoverFlow.select(); + CoverFlow.applySettings(); + startGameSound = -10; } } _showGame(); m_banner.SetShowBanner(true); - if(!m_gameSound.IsPlaying()) - startGameSound = -6; } else if(m_btnMgr.selected(m_gameBtnSettings)) { @@ -609,21 +612,18 @@ void CMenu::_game(bool launch) error(_t("errgame15", L"WiiFlow locked! Unlock WiiFlow to use this feature.")); m_banner.SetShowBanner(true); } - /*else if(hdr->type == TYPE_PLUGIN) - { - m_banner.SetShowBanner(false); - error(_t("errgame16", L"Not available for plugin games!")); - m_banner.SetShowBanner(true); - }*/ else { - m_banner.ToggleGameSettings(); + // the mainloop handles drawing banner while in settings + m_banner.ToggleZoom();//zoom to full + m_banner.ToggleGameSettings();// dim brightness _gameSettings(hdr); - m_banner.ToggleGameSettings(); + m_banner.ToggleGameSettings();//reset brightness + m_banner.ToggleZoom();//de zoom to small } _showGame(); - if(!m_gameSound.IsPlaying()) - startGameSound = -6; + if(m_newGame) + startGameSound = -10; } else if(m_btnMgr.selected(m_gameBtnFavoriteOn) || m_btnMgr.selected(m_gameBtnFavoriteOff)) { @@ -631,6 +631,8 @@ void CMenu::_game(bool launch) m_gcfg1.setBool("FAVORITES_PLUGINS", id, !m_gcfg1.getBool("FAVORITES_PLUGINS", id, false)); else m_gcfg1.setBool("FAVORITES", id, !m_gcfg1.getBool("FAVORITES", id, false)); + if(m_favorites) + m_refreshGameList = true; } else if(m_btnMgr.selected(m_gameBtnAdultOn) || m_btnMgr.selected(m_gameBtnAdultOff)) { @@ -640,8 +642,6 @@ void CMenu::_game(bool launch) error(_t("errgame15", L"WiiFlow locked! Unlock WiiFlow to use this feature.")); m_banner.SetShowBanner(true); _showGame(); - if(!m_gameSound.IsPlaying()) - startGameSound = -6; } else { @@ -649,6 +649,8 @@ void CMenu::_game(bool launch) m_gcfg1.setBool("ADULTONLY_PLUGINS", id, !m_gcfg1.getBool("ADULTONLY_PLUGINS", id, false)); else m_gcfg1.setBool("ADULTONLY", id, !m_gcfg1.getBool("ADULTONLY", id, false)); + if(m_locked) + m_refreshGameList = true; } } else if(m_btnMgr.selected(m_gameBtnBack) || m_btnMgr.selected(m_gameBtnBackFull)) @@ -657,17 +659,17 @@ void CMenu::_game(bool launch) break; } else if((m_btnMgr.selected(m_gameBtnToggle) || m_btnMgr.selected(m_gameBtnToggleFull)) - && (!NoGameID(hdr->type) || m_video_playing)) + && (!NoGameID(hdr->type) || m_pluginBanner)) { m_zoom_banner = m_banner.ToggleZoom(); m_cfg.setBool(_domainFromView(), "show_full_banner", m_zoom_banner); - currentMoviePos = (m_zoom_banner ? zoomedMoviePos : normalMoviePos); m_show_zone_game = false; m_btnMgr.hide(m_gameBtnPlayFull); m_btnMgr.hide(m_gameBtnBackFull); m_btnMgr.hide(m_gameBtnToggleFull); } - else if(launch || m_btnMgr.selected(m_gameBtnPlay) || m_btnMgr.selected(m_gameBtnPlayFull) || !ShowPointer()) + else if(launch || m_btnMgr.selected(m_gameBtnPlay) || m_btnMgr.selected(m_gameBtnPlayFull) || + (!ShowPointer() && !m_video_playing && !coverFlipped)) { _hideGame(); MusicPlayer.Stop(); @@ -731,9 +733,9 @@ void CMenu::_game(bool launch) m_gcfg2.unload(); _showGame(); } - /* flip cover if mouse over */ else if(!coverFlipped) { + /* flip cover if mouse over */ for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--) { if(CoverFlow.mouseOver(m_cursor[chan].x(), m_cursor[chan].y())) @@ -746,40 +748,39 @@ void CMenu::_game(bool launch) v = m_coverflow.getVector3D(domain, key); coverFlipped = true; CoverFlow.flip(); + m_banner.SetShowBanner(false); } } } } - if(!coverFlipped) + if(!coverFlipped && !m_video_playing) { + /* move to new cover if needed */ if((startGameSound == 1 || startGameSound < -8) && (BTN_UP_REPEAT || RIGHT_STICK_UP)) { - //_cleanupBanner(true); CoverFlow.up(); startGameSound = -10; } if((startGameSound == 1 || startGameSound < -8) && (BTN_RIGHT_REPEAT || RIGHT_STICK_RIGHT)) { - //_cleanupBanner(true); CoverFlow.right(); startGameSound = -10; } if((startGameSound == 1 || startGameSound < -8) && (BTN_DOWN_REPEAT || RIGHT_STICK_DOWN)) { - //_cleanupBanner(true); CoverFlow.down(); startGameSound = -10; } if((startGameSound == 1 || startGameSound < -8) && (BTN_LEFT_REPEAT || RIGHT_STICK_LEFT)) { - //_cleanupBanner(true); CoverFlow.left(); startGameSound = -10; } if(startGameSound == -10)// if -10 then we moved to new cover { - //m_gameSelected = false; // deselect game if moved to new cover memcpy(hdr, CoverFlow.getHdr(), sizeof(dir_discHdr));// get new game header + _setCurrentItem(hdr); + memset(tmp1, 0, 74); memset(tmp2, 0, 64); if(hdr->type == TYPE_PLUGIN) @@ -799,25 +800,22 @@ void CMenu::_game(bool launch) id = tmp1; } } - m_zoom_banner = m_cfg.getBool(_domainFromView(), "show_full_banner", false); - if(NoGameID(hdr->type)) + if(m_newGame) { - bool video_available = (hdr->type == TYPE_PLUGIN && - (fsop_FileExist(fmt("%s.thp", getVideoPath(m_videoDir, CoverFlow.getPathId(hdr)))) || - fsop_FileExist(fmt("%s.thp", getVideoDefaultPath(m_videoDir))))); - m_zoom_banner = m_zoom_banner && video_available; + m_newGame = false; + startGameSound = 1; + _playGameSound(); } - currentMoviePos = (m_zoom_banner ? zoomedMoviePos : normalMoviePos); - if(m_banner.GetZoomSetting() != m_zoom_banner) - m_banner.ToggleZoom(); } } /* show small banner frame if available */ - if(m_gameLblUser[4] != -1 && !NoGameID(hdr->type) && !m_zoom_banner) + if(!coverFlipped && m_gameLblUser[4] != -1 && (!NoGameID(hdr->type) || m_pluginBanner) && !m_zoom_banner && !m_video_playing) m_btnMgr.show(m_gameLblUser[4]); else m_btnMgr.hide(m_gameLblUser[4]); - if(m_show_zone_game && !m_zoom_banner) + + /* show regular buttons if pointer is in game zone && banner is not zoomed && trailer video is not playing */ + if(m_show_zone_game && !coverFlipped && (!m_zoom_banner || (NoGameID(hdr->type) && !m_pluginBanner)) && !m_video_playing) { m_btnMgr.hide(m_gameBtnPlayFull); m_btnMgr.hide(m_gameBtnBackFull); @@ -846,14 +844,20 @@ void CMenu::_game(bool launch) m_btnMgr.show(b ? m_gameBtnAdultOn : m_gameBtnAdultOff); m_btnMgr.hide(b ? m_gameBtnAdultOff : m_gameBtnAdultOn); } - else + else /* show zoomed banner play and back buttons */ { - if(m_zoom_banner) + if(m_zoom_banner && (!NoGameID(hdr->type) || m_pluginBanner) && !m_video_playing) { m_btnMgr.show(m_gameBtnPlayFull); m_btnMgr.show(m_gameBtnBackFull); m_btnMgr.show(m_gameBtnToggleFull); } + else + { + m_btnMgr.hide(m_gameBtnPlayFull); + m_btnMgr.hide(m_gameBtnBackFull); + m_btnMgr.hide(m_gameBtnToggleFull); + } m_btnMgr.hide(m_gameBtnFavoriteOn); m_btnMgr.hide(m_gameBtnFavoriteOff); m_btnMgr.hide(m_gameBtnAdultOn); @@ -929,52 +933,53 @@ void CMenu::_launch(const dir_discHdr *hdr) _launchChannel(&launchHdr); else if(launchHdr.type == TYPE_PLUGIN) { - //get dol name and name length for music plugin + /* get dol name and name length for music plugin */ const char *plugin_dol_name = m_plugin.GetDolName(launchHdr.settings[0]); u8 plugin_dol_len = strlen(plugin_dol_name); - //get title and path from hdr - //example rom path - sd:/roms/super mario bros.zip - //example scummvm path - kq1-coco3 - char title[101]; - memset(&title, 0, sizeof(title)); + /* check if music player plugin, if so set wiiflow's bckgrnd music player to play this song */ + if(plugin_dol_len == 5 && strcasecmp(plugin_dol_name, "music") == 0) + { + MusicPlayer.LoadFile(launchHdr.path, false); + m_exit = false; + return; + } + /* get title from hdr */ u32 title_len_no_ext = 0; + const char *title = CoverFlow.getPathId(hdr, true);// with extension + //m_cfg.setString(_domainFromView(), "current_item", title); + + /* get path from hdr */ + // example rom path - dev:/roms/super mario bros.zip + // example scummvm path - kq1-coco3 const char *path = NULL; if(strchr(launchHdr.path, ':') != NULL)//it's a rom path { - //check if music player plugin, if so set wiiflow's bckgrnd music player to play this song - if(plugin_dol_len == 5 && strcasecmp(plugin_dol_name, "music") == 0) - { - MusicPlayer.LoadFile(launchHdr.path, false); - m_exit = false; - return; - } - //get rom title after last '/' - strncpy(title, strrchr(launchHdr.path, '/') + 1, 100); - //if there's extension get length of title without extension + // if there's extension get length of title without extension if(strchr(launchHdr.path, '.') != NULL) title_len_no_ext = strlen(title) - strlen(strrchr(title, '.')); - //get path + // get path *strrchr(launchHdr.path, '/') = '\0'; //cut title off end of path - path = strchr(launchHdr.path, '/') + 1; //cut sd:/ off of path + path = strchr(launchHdr.path, '/') + 1; //cut dev:/ off of path } - else //it's a scummvm game - { + else // it's a scummvm game path = launchHdr.path;// kq1-coco3 - wcstombs(title, launchHdr.title, 63);// King's Quest I: Quest for the Crown (CoCo3/English) - } - m_cfg.setString(_domainFromView(), "current_item", title); + /* get device */ const char *device = (currentPartition == 0 ? "sd" : (DeviceHandle.GetFSType(currentPartition) == PART_FS_NTFS ? "ntfs" : "usb")); + + /* get loader */ // I believe the loader is set just in case the user is using a old plugin where the arguments line still requires loader const char *loader = fmt("%s:/%s/WiiFlowLoader.dol", device, strchr(m_pluginsDir.c_str(), '/') + 1); + /* set arguments */ vector arguments = m_plugin.CreateArgs(device, path, title, loader, title_len_no_ext, launchHdr.settings[0]); - // find plugin dol - it does not have to be in dev:/wiiflow/plugins - const char *plugin_file = plugin_dol_name; /* try full path */ - if(strchr(plugin_file, ':') == NULL || !fsop_FileExist(plugin_file)) /* if not found try wiiflow plugin folder */ + + /* find plugin dol - it does not have to be in dev:/wiiflow/plugins */ + const char *plugin_file = plugin_dol_name; // try full path + if(strchr(plugin_file, ':') == NULL || !fsop_FileExist(plugin_file)) // if not found try wiiflow plugin folder { plugin_file = fmt("%s/%s", m_pluginsDir.c_str(), plugin_dol_name); - if(!fsop_FileExist(plugin_file)) /* not found - try device search */ + if(!fsop_FileExist(plugin_file)) // not found - try device search { for(u8 i = SD; i < MAXDEVICES; ++i) { @@ -984,6 +989,7 @@ void CMenu::_launch(const dir_discHdr *hdr) } } } + /* launch plugin with args */ _launchHomebrew(plugin_file, arguments); } else if(launchHdr.type == TYPE_HOMEBREW) @@ -1028,7 +1034,6 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) m_gcfg1.setInt("PLAYCOUNT", id, m_gcfg1.getInt("PLAYCOUNT", id, 0) + 1); m_gcfg1.setUInt("LASTPLAYED", id, time(NULL)); - m_cfg.setString(_domainFromView(), "current_item", id); if(has_enabled_providers() && _initNetwork() == 0) add_game_to_card(id); @@ -1416,16 +1421,15 @@ void CMenu::_launchChannel(dir_discHdr *hdr) if(has_enabled_providers() && _initNetwork() == 0) add_game_to_card(id.c_str()); } - m_cfg.setString(_domainFromView(), "current_item", id); m_gcfg1.setInt("PLAYCOUNT", id, m_gcfg1.getInt("PLAYCOUNT", id, 0) + 1); m_gcfg1.setUInt("LASTPLAYED", id, time(NULL)); - string emuPath = fmt("/%s/%s", EMU_NANDS_DIR, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default").c_str()); + string emuPath = fmt("/%s/%s", emu_nands_dir, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default").c_str()); int emulate_mode = min(max(0, m_cfg.getInt(CHANNEL_DOMAIN, "emulation", 1)), (int)ARRAY_SIZE(CMenu::_NandEmu) - 1); int userIOS = m_gcfg2.getInt(id, "ios", 0); u64 gameTitle = TITLE_ID(hdr->settings[0],hdr->settings[1]); - bool useNK2o = (m_gcfg2.getBool(id, "useneek", false) && !neek2o()); + bool useNK2o = (m_gcfg2.getBool(id, "useneek", false) && !neek2o());//if not in neek2o and use neek is set bool use_led = m_gcfg2.getBool(id, "led", false); u32 gameIOS = ChannelHandle.GetRequestedIOS(gameTitle); @@ -1441,14 +1445,23 @@ void CMenu::_launchChannel(dir_discHdr *hdr) { if(!Load_Neek2o_Kernel()) { - error(_t("errneek1", L"Cannot launch neek2o. Verify your neek2o setup")); + error(_t("errneek1", L"Cannot launch neek2o. Verify your neek2o setup"));//kernal.bin not found _exitWiiflow(); } else { + const char *nkrtrn = NULL; + if(IsOnWiiU()) + nkrtrn = "HCVA";// Return to WiiU system channel + else + nkrtrn = "NK2O"; + u32 nkreturnTo = nkrtrn[0] << 24 | nkrtrn[1] << 16 | nkrtrn[2] << 8 | nkrtrn[3]; cleanup(); ShutdownBeforeExit(); - Launch_nk(gameTitle, NandHandle.Get_NandPath(), returnTo ? (((u64)(0x00010001) << 32) | (returnTo & 0xFFFFFFFF)) : 0); + if(IsOnWiiU()) + Launch_nk(gameTitle, NandHandle.Get_NandPath(), ((u64)(0x00010002) << 32) | (nkreturnTo & 0xFFFFFFFF)); + else + Launch_nk(gameTitle, NandHandle.Get_NandPath(), ((u64)(0x00010001) << 32) | (nkreturnTo & 0xFFFFFFFF)); while(1) usleep(500); } } @@ -1515,7 +1528,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd, bool disc_cfg) if(neek2o()) { int discID = id.c_str()[0] << 24 | id.c_str()[1] << 16 | id.c_str()[2] << 8 | id.c_str()[3]; - if(WDVD_NEEK_LoadDisc((discID&0xFFFFFFFF), 0x5D1C9EA3) > 0) + if(WDVD_NEEK_LoadDisc((discID&0xFFFFFFFF), 0x5D1C9EA3) > 0)//5D1C9EA3 is wii disc magic { dvd = true; sleep(3); @@ -1679,7 +1692,6 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd, bool disc_cfg) u8 *gameconfig = NULL; u32 cheatSize = 0, gameconfigSize = 0, returnTo = 0; - m_cfg.setString(_domainFromView(), "current_item", id); m_gcfg1.setInt("PLAYCOUNT", id, m_gcfg1.getInt("PLAYCOUNT", id, 0) + 1); m_gcfg1.setUInt("LASTPLAYED", id, time(NULL)); @@ -1884,15 +1896,6 @@ void CMenu::_gameSoundThread(CMenu *m) CurrentBanner.ClearBanner(); const dir_discHdr *GameHdr = CoverFlow.getHdr(); - if(GameHdr->type == TYPE_PLUGIN) - { - m_banner.DeleteBanner(); - m->m_gameSound.Load(m_plugin.GetBannerSound(GameHdr->settings[0]), m_plugin.GetBannerSoundSize()); - if(m->m_gameSound.IsLoaded()) - m->m_gamesound_changed = true; - m->m_soundThrdBusy = false; - return; - } u8 *custom_bnr_file = NULL; u32 custom_bnr_size = 0; @@ -1903,18 +1906,40 @@ void CMenu::_gameSoundThread(CMenu *m) cached_banner[255] = '\0'; char custom_banner[256]; custom_banner[255] = '\0'; - /* check custom ID6 first */ - strncpy(custom_banner, fmt("%s/%s.bnr", m->m_customBnrDir.c_str(), GameHdr->id), 255); - fsop_GetFileSizeBytes(custom_banner, &custom_bnr_size); - if(custom_bnr_size > 0) + if(GameHdr->type == TYPE_PLUGIN) { - custom_bnr_file = (u8*)MEM2_lo_alloc(custom_bnr_size); - if(custom_bnr_file != NULL) - fsop_ReadFileLoc(custom_banner, custom_bnr_size, (void*)custom_bnr_file); + const char *coverDir = NULL; + coverDir = m_plugin.GetCoverFolderName(GameHdr->settings[0]); + + if(coverDir == NULL || strlen(coverDir) == 0) + strncpy(custom_banner, fmt("%s/%s.bnr", m->m_customBnrDir.c_str(), CoverFlow.getPathId(GameHdr)), 255); + else + strncpy(custom_banner, fmt("%s/%s/%s.bnr", m->m_customBnrDir.c_str(), coverDir, CoverFlow.getPathId(GameHdr)), 255); + fsop_GetFileSizeBytes(custom_banner, &custom_bnr_size); + if(custom_bnr_size > 0) + { + custom_bnr_file = (u8*)MEM2_lo_alloc(custom_bnr_size); + if(custom_bnr_file != NULL) + { + fsop_ReadFileLoc(custom_banner, custom_bnr_size, (void*)custom_bnr_file); + m_pluginBanner = true; + } + } + else + { + m_pluginBanner = false; + m_banner.DeleteBanner(); + m->m_gameSound.Load(m_plugin.GetBannerSound(GameHdr->settings[0]), m_plugin.GetBannerSoundSize()); + if(m->m_gameSound.IsLoaded()) + m->m_gamesound_changed = true; + m->m_soundThrdBusy = false; + return; + } } - else /* no custom ID6 or too big, try ID3 */ + else { - strncpy(custom_banner, fmt("%s/%.3s.bnr", m->m_customBnrDir.c_str(), GameHdr->id), 255); + /* check custom ID6 first */ + strncpy(custom_banner, fmt("%s/%s.bnr", m->m_customBnrDir.c_str(), GameHdr->id), 255); fsop_GetFileSizeBytes(custom_banner, &custom_bnr_size); if(custom_bnr_size > 0) { @@ -1922,10 +1947,21 @@ void CMenu::_gameSoundThread(CMenu *m) if(custom_bnr_file != NULL) fsop_ReadFileLoc(custom_banner, custom_bnr_size, (void*)custom_bnr_file); } + else /* no custom ID6 or too big, try ID3 */ + { + strncpy(custom_banner, fmt("%s/%.3s.bnr", m->m_customBnrDir.c_str(), GameHdr->id), 255); + fsop_GetFileSizeBytes(custom_banner, &custom_bnr_size); + if(custom_bnr_size > 0) + { + custom_bnr_file = (u8*)MEM2_lo_alloc(custom_bnr_size); + if(custom_bnr_file != NULL) + fsop_ReadFileLoc(custom_banner, custom_bnr_size, (void*)custom_bnr_file); + } + } } if(custom_bnr_file == NULL && GameHdr->type == TYPE_GC_GAME) { - //get the gc games banner without sound + //get the gc games banner without sound from ISO GC_Disc_Reader.init(GameHdr->path); u8 *opening_bnr = GC_Disc_Reader.GetGameCubeBanner(); if(opening_bnr != NULL) @@ -1971,9 +2007,11 @@ void CMenu::_gameSoundThread(CMenu *m) if(cached_bnr_file == NULL && custom_bnr_file == NULL) fsop_WriteFile(cached_banner, CurrentBanner.GetBannerFile(), CurrentBanner.GetBannerFileSize()); + //load and init banner + m_banner.LoadBanner(m->m_wbf1_font, m->m_wbf2_font); + //get sound from wii, channel, or custom banner and load it to play with the banner u32 sndSize = 0; - m_banner.LoadBanner(m->m_wbf1_font, m->m_wbf2_font); u8 *soundBin = CurrentBanner.GetFile("sound.bin", &sndSize); CurrentBanner.ClearBanner(); @@ -2016,17 +2054,7 @@ u8 *GameSoundStack = NULL; u32 GameSoundSize = 0x10000; //64kb void CMenu::_playGameSound(void)// starts banner and gamesound loading thread { - if(NoGameID(CoverFlow.getHdr()->type)) - { - if(_startVideo()) - return; - if(m_zoom_banner == true) - { - m_zoom_banner = m_banner.ToggleZoom(); - //m_cfg.setBool(_domainFromView(), "show_full_banner", m_zoom_banner); - currentMoviePos = normalMoviePos; - } - } + _cleanupBanner(true); m_gamesound_changed = false; if(m_bnrSndVol == 0) return; diff --git a/source/menu/menu_gameinfo.cpp b/source/menu/menu_gameinfo.cpp index 312971a5..9a1af9fb 100644 --- a/source/menu/menu_gameinfo.cpp +++ b/source/menu/menu_gameinfo.cpp @@ -24,7 +24,7 @@ void CMenu::_gameinfo(void) while(!m_exit) { _mainLoopCommon(); - if(BTN_HOME_PRESSED || BTN_B_PRESSED) + if(BTN_HOME_PRESSED || BTN_B_PRESSED || !tdb_found) break; if((BTN_DOWN_PRESSED || BTN_DOWN_HELD) && page == 2 && synopsis_th > synopsis_h) { @@ -174,6 +174,8 @@ void CMenu::_showGameInfo(void) if(m_gameinfoLblControls[i] != -1 && i < cnt_controls) m_btnMgr.show(m_gameinfoLblControls[i]); } + else + error(_t("errgame18", L"No game info!")); } void CMenu::_initGameInfoMenu() @@ -246,6 +248,12 @@ void CMenu::_textGameInfo(void) gameinfo_Title_w.fromUTF8(TMP_Char); m_btnMgr.setText(m_gameinfoLblTitle, gameinfo_Title_w); } + else + { + tdb_found = false; + gametdb.CloseFile(); + return; + } if(gametdb.GetSynopsis(GameID, TMP_Char)) { gameinfo_Synopsis_w.fromUTF8(TMP_Char); diff --git a/source/menu/menu_home.cpp b/source/menu/menu_home.cpp index f8bd757e..14771b8d 100644 --- a/source/menu/menu_home.cpp +++ b/source/menu/menu_home.cpp @@ -195,10 +195,10 @@ bool CMenu::_ExitTo(void) } else { - bool nkWiiflow = m_cfg.getBool("NEEK2O", "launchwiiflow", true); - if(nkWiiflow) - exitHandler(EXIT_TO_WFNK2O); - else + //bool nkWiiflow = m_cfg.getBool("NEEK2O", "launchwiiflow", true); + //if(nkWiiflow) + // exitHandler(EXIT_TO_WFNK2O); + //else exitHandler(EXIT_TO_SMNK2O); } break; diff --git a/source/menu/menu_main.cpp b/source/menu/menu_main.cpp index d9c41534..90fb7668 100644 --- a/source/menu/menu_main.cpp +++ b/source/menu/menu_main.cpp @@ -126,7 +126,7 @@ void CMenu::_showCF(bool refreshList) break; case COVERFLOW_CHANNEL: Msg = _t("main3", L"No titles found in "); - Pth = wstringEx(fmt("%s:/%s/%s", DeviceName[currentPartition], EMU_NANDS_DIR, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand").c_str())); + Pth = wstringEx(fmt("%s:/%s/%s", DeviceName[currentPartition], emu_nands_dir, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand").c_str())); break; case COVERFLOW_HOMEBREW: Msg = _t("main4", L"No apps found in "); @@ -235,8 +235,8 @@ int CMenu::main(void) } m_catStartPage = m_cfg.getInt("GENERAL", "cat_startpage", 1); - if(m_source_cnt == 1) - m_cfg.remove("GENERAL", "cat_startpage"); + //if(m_source_cnt == 1) + // m_cfg.remove("GENERAL", "cat_startpage"); if(m_cfg.getBool("GENERAL", "update_cache", false)) { @@ -307,6 +307,7 @@ int CMenu::main(void) if(BTN_HOME_PRESSED) { _hideMain(); + /* sourceflow config menu */ if(m_sourceflow) { _CfgSrc(); @@ -324,6 +325,7 @@ int CMenu::main(void) } _showMain(); } + /* homebrew flow config menu */ else if(m_current_view == COVERFLOW_HOMEBREW) { _CfgHB(); @@ -334,10 +336,11 @@ int CMenu::main(void) } _showMain(); } + /* Home menu */ else { - if(_Home()) //home menu - break; + if(_Home()) + break;// exit wiiflow if(BTN_B_HELD) bUsed = true; _showMain(); @@ -351,15 +354,17 @@ int CMenu::main(void) CoverFlow.pageDown(); else if(m_btnMgr.selected(m_mainBtnHome)) { + /* home menu via main menu button */ _hideMain(); - if(_Home()) //home menu - break; + if(_Home()) + break;// exit wiiflow if(BTN_B_HELD) bUsed = true; _showMain(); } else if(m_btnMgr.selected(m_mainBtnChannel) || m_btnMgr.selected(m_mainBtnWii) || m_btnMgr.selected(m_mainBtnGamecube) || m_btnMgr.selected(m_mainBtnPlugin)) { + /* change source via view button on main menu */ if(m_current_view == COVERFLOW_WII) m_current_view = show_gamecube ? COVERFLOW_GAMECUBE : (show_channel ? COVERFLOW_CHANNEL : (show_plugin ? COVERFLOW_PLUGIN : COVERFLOW_WII)); else if(m_current_view == COVERFLOW_GAMECUBE) @@ -375,10 +380,12 @@ int CMenu::main(void) } else if(m_btnMgr.selected(m_mainBtnConfig)) { + /* main menu global settings */ _hideMain(); _config(1); if(strcmp(prevTheme, m_cfg.getString("GENERAL", "theme").c_str()) != 0) { + /* new theme - exit wiiflow and reload */ m_reload = true; break; } @@ -388,6 +395,7 @@ int CMenu::main(void) } else if(m_btnMgr.selected(m_mainBtnHomebrew)) { + /* launch homebrew flow */ if(m_locked && m_cfg.getBool(HOMEBREW_DOMAIN, "parental", false)) { error(_t("errgame15", L"WiiFlow locked! Unlock WiiFlow to use this feature.")); @@ -404,9 +412,8 @@ int CMenu::main(void) } else if(m_btnMgr.selected(m_mainBtnDVD)) { - /* Cleanup for Disc Booter */ + /* Boot DVD in drive */ _hideMain(true); - //CoverFlow.clear(); /* Create Fake Header */ dir_discHdr hdr; memset(&hdr, 0, sizeof(dir_discHdr)); @@ -419,13 +426,14 @@ int CMenu::main(void) } else if(m_btnMgr.selected(m_mainBtnFavoritesOn) || m_btnMgr.selected(m_mainBtnFavoritesOff)) { + /* switch favorite games only on/off */ m_favorites = !m_favorites; m_cfg.setBool(_domainFromView(), "favorites", m_favorites); _initCF(); } - /* select game cover or sourceflow cover */ else if(!CoverFlow.empty() && CoverFlow.select()) { + /* select game cover or sourceflow cover */ _hideMain(); if(m_sourceflow) { @@ -440,10 +448,14 @@ int CMenu::main(void) break; if(BTN_B_HELD) bUsed = true; - CoverFlow.cancel(); if(m_refreshGameList) - //_initCF(); - _showCF(m_refreshGameList); + { + /* if changes were made to favorites, parental lock, or categories */ + _initCF(); + m_refreshGameList = false; + } + else + CoverFlow.cancel(); } } } @@ -734,6 +746,7 @@ int CMenu::main(void) } Sys_SetNeekPath(ReturnPath); } + cleanup(); //gprintf("Saving configuration files\n"); m_gcfg1.save(true);// save configs on power off or exit wiiflow m_gcfg2.save(true); diff --git a/source/menu/menu_nandemu.cpp b/source/menu/menu_nandemu.cpp index bc237446..c145a050 100644 --- a/source/menu/menu_nandemu.cpp +++ b/source/menu/menu_nandemu.cpp @@ -114,7 +114,7 @@ void CMenu::_checkEmuNandSettings(bool savesnand) emuNand = m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default").c_str(); emuPart = m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0); } - const char *tmpPath = fmt("/%s/%s", EMU_NANDS_DIR, emuNand); + const char *tmpPath = fmt("/%s/%s", emu_nands_dir, emuNand); /* check if partition is FAT && emuNAND directory exist*/ if(!DeviceHandle.PartitionUsableForNandEmu(emuPart) || !_TestEmuNand(emuPart, tmpPath, false)) { @@ -138,12 +138,12 @@ int CMenu::_FindEmuPart(string &emuPath, bool skipchecks, bool savesnand) if(savesnand) { emuPart = m_cfg.getInt(WII_DOMAIN, "savepartition"); - tmpPath = fmt("/%s/%s", EMU_NANDS_DIR, m_cfg.getString(WII_DOMAIN, "current_save_emunand").c_str()); + tmpPath = fmt("/%s/%s", emu_nands_dir, m_cfg.getString(WII_DOMAIN, "current_save_emunand").c_str()); } else { emuPart = m_cfg.getInt(CHANNEL_DOMAIN, "partition"); - tmpPath = fmt("/%s/%s", EMU_NANDS_DIR, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand").c_str()); + tmpPath = fmt("/%s/%s", emu_nands_dir, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand").c_str()); } if(!DeviceHandle.PartitionUsableForNandEmu(emuPart)) return -1; @@ -211,7 +211,7 @@ bool CMenu::_checkSave(string id, bool nand) else { int emuPartition = m_cfg.getInt(WII_DOMAIN, "savepartition"); - const char *emuPath = fmt("/%s/%s", EMU_NANDS_DIR, m_cfg.getString(WII_DOMAIN, "current_save_emunand").c_str()); + const char *emuPath = fmt("/%s/%s", emu_nands_dir, m_cfg.getString(WII_DOMAIN, "current_save_emunand").c_str()); if(emuPartition < 0 || emuPath == NULL) return false; struct stat fstat; @@ -435,7 +435,7 @@ int CMenu::_NandEmuCfg(void) string savesNand = m_cfg.getString(WII_DOMAIN, "current_save_emunand"); int savesPart = m_cfg.getInt(WII_DOMAIN, "savepartition"); - _listEmuNands(fmt("%s:/%s", DeviceName[emuPart], EMU_NANDS_DIR), emuNands); + _listEmuNands(fmt("%s:/%s", DeviceName[emuPart], emu_nands_dir), emuNands); int curEmuNand = 0; for(u8 i = 0; i < emuNands.size(); ++i) { @@ -446,7 +446,7 @@ int CMenu::_NandEmuCfg(void) } } - _listEmuNands(fmt("%s:/%s", DeviceName[savesPart], EMU_NANDS_DIR), savesNands); + _listEmuNands(fmt("%s:/%s", DeviceName[savesPart], emu_nands_dir), savesNands); int curSavesNand = 0; for(u8 i = 0; i < savesNands.size(); ++i) { @@ -623,7 +623,7 @@ int CMenu::_FlashSave(string gameId) { int emuPartition = m_cfg.getInt(WII_DOMAIN, "savepartition"); char basepath[MAX_FAT_PATH]; - snprintf(basepath, sizeof(basepath), "%s:/%s/%s", DeviceName[emuPartition], EMU_NANDS_DIR, m_cfg.getString(WII_DOMAIN, "current_save_emunand").c_str()); + snprintf(basepath, sizeof(basepath), "%s:/%s/%s", DeviceName[emuPartition], emu_nands_dir, m_cfg.getString(WII_DOMAIN, "current_save_emunand").c_str()); if(!_checkSave(gameId, false))// if save not on emu nand return 0; @@ -751,7 +751,7 @@ int CMenu::_AutoExtractSave(string gameId)// called from wii game config menu or else if(BTN_A_PRESSED && m_btnMgr.selected(m_nandemuBtnDisable))//create new save { int emuPart = m_cfg.getInt(WII_DOMAIN, "savepartition"); - const char *emuPath = fmt("/%s/%s", EMU_NANDS_DIR, m_cfg.getString(WII_DOMAIN, "current_save_emunand").c_str()); + const char *emuPath = fmt("/%s/%s", emu_nands_dir, m_cfg.getString(WII_DOMAIN, "current_save_emunand").c_str()); char basepath[MAX_FAT_PATH]; snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPart], emuPath); NandHandle.CreatePath("%s/import", basepath); diff --git a/source/menu/menu_plugin.cpp b/source/menu/menu_plugin.cpp index 9ccb8dd5..7d6a20a5 100644 --- a/source/menu/menu_plugin.cpp +++ b/source/menu/menu_plugin.cpp @@ -147,18 +147,20 @@ void CMenu::_PluginSettings() m_refreshGameList = true; if(m_current_view != COVERFLOW_PLUGIN) { + /* clear all plugins */ for(u8 j = 0; m_plugin.PluginExist(j); j++) m_plugin.SetEnablePlugin(m_cfg, j, 1); m_current_view = COVERFLOW_PLUGIN; } - if(i == 0) + if(i == 0)// all button to clear all or set all { - m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount); + m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);// get enabled plugins count + // if all clear then set(2) them else clear(1) them all for(u8 j = 0; m_plugin.PluginExist(j); j++) m_plugin.SetEnablePlugin(m_cfg, j, (enabledPluginsCount == 0) ? 2 : 1); } else - m_plugin.SetEnablePlugin(m_cfg, i+IteratorHelp-1); + m_plugin.SetEnablePlugin(m_cfg, i+IteratorHelp-1);// switch plugin from off to on or vice versa _updatePluginCheckboxes(); break; } @@ -171,6 +173,7 @@ void CMenu::_PluginSettings() { m_cfg.setUInt("GENERAL", "sources", m_current_view); m_source_cnt = 1; + m_catStartPage = 1; } else m_current_view = m_cfg.getUInt("GENERAL", "sources"); diff --git a/source/menu/menu_wad.cpp b/source/menu/menu_wad.cpp index 2c867385..5ac05adb 100644 --- a/source/menu/menu_wad.cpp +++ b/source/menu/menu_wad.cpp @@ -438,7 +438,7 @@ void CMenu::_Wad(const char *wad_path) vector emuNands; string emuNand = m_cfg.getString(CHANNEL_DOMAIN, "current_emunand"); int emuPart = m_cfg.getInt(CHANNEL_DOMAIN, "partition"); - _listEmuNands(fmt("%s:/%s", DeviceName[emuPart], EMU_NANDS_DIR), emuNands); + _listEmuNands(fmt("%s:/%s", DeviceName[emuPart], emu_nands_dir), emuNands); int curEmuNand = 0; for(u8 i = 0; i < emuNands.size(); ++i) { @@ -476,7 +476,7 @@ void CMenu::_Wad(const char *wad_path) /* mios is real nand, chans are emu */ if(mios == false) { - const char *emu_char = fmt("/%s/%s", EMU_NANDS_DIR, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default").c_str()); + const char *emu_char = fmt("/%s/%s", emu_nands_dir, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default").c_str()); NandHandle.SetPaths(emu_char, DeviceName[currentPartition]); } _start_pThread(); diff --git a/wii/wiiflow/Languages/english.ini b/wii/wiiflow/Languages/english.ini index a185089f..bdba72c2 100644 --- a/wii/wiiflow/Languages/english.ini +++ b/wii/wiiflow/Languages/english.ini @@ -119,8 +119,7 @@ cfgg44=Video Deflicker cfgg45=Private Server cfgg46=WiiU Widescreen cfgg47=Emulated MemCard -cfgg48=EmuNAND not on USB1! -cfgg49=Neek2o Not Found! +cfgg48=Triforce Arcade Mode cfgg50=No save to extract! cfgg51=No save to flash to real NAND! cfgg52=Wiimote CC Rumble @@ -290,6 +289,7 @@ errgame14=app_booter.bin not found! errgame15=WiiFlow locked! Unlock WiiFlow to use this feature. errgame16=Not available for plugin games! errgame17=Can not delete real NAND Channels! +errgame18=No game info! errneek1=Cannot launch neek2o. Verify your neek2o setup errsource1=Homebrew locked! errsource2=Homebrew and multisource not allowed!