diff --git a/out/bins/ext_booter.bin b/out/bins/ext_booter.bin index 5632afcd..ce362f28 100644 Binary files a/out/bins/ext_booter.bin and b/out/bins/ext_booter.bin differ diff --git a/out/boot.dol b/out/boot.dol index 8cf2f256..c8c01dbf 100644 Binary files a/out/boot.dol and b/out/boot.dol differ diff --git a/source/defines.h b/source/defines.h index 0642f4e9..b81d92d7 100644 --- a/source/defines.h +++ b/source/defines.h @@ -6,7 +6,7 @@ #else #define APP_NAME "WiiFlow Lite" #endif -#define APP_VERSION "5.3.0 beta 8" +#define APP_VERSION "5.3.0 beta 9" #define APP_DATA_DIR "wiiflow" #ifdef APP_WIIFLOW diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index 1ed4e3ec..26a3ddc9 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -80,6 +80,7 @@ CMenu::CMenu() m_catStartPage = 1; cacheCovers = false; SF_cacheCovers = true; + m_snapshot_loaded = false; /* Explorer stuff */ m_txt_view = false; m_txt_path = NULL; @@ -1670,7 +1671,7 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting) CoverFlow.draw(); m_vid.setup2DProjection(false, true); CoverFlow.drawEffect(); - if(!m_banner.GetSelectedGame()) + if(!m_banner.GetSelectedGame() && !m_snapshot_loaded) CoverFlow.drawText(adjusting); m_vid.renderAAPass(i); } @@ -1686,7 +1687,7 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting) CoverFlow.draw(); m_vid.setup2DProjection(); CoverFlow.drawEffect(); - if(!m_banner.GetSelectedGame()) + if(!m_banner.GetSelectedGame() && !m_snapshot_loaded) CoverFlow.drawText(adjusting); } } diff --git a/source/menu/menu.hpp b/source/menu/menu.hpp index 12e82ee1..2a866e2e 100644 --- a/source/menu/menu.hpp +++ b/source/menu/menu.hpp @@ -64,6 +64,7 @@ private: bool SF_cacheCovers; bool CFLocked; bool Auto_hide_icons; + bool m_snapshot_loaded; vector m_gameList; struct SZone @@ -638,6 +639,8 @@ private: s16 m_gameinfoLblSnap; s16 m_gameinfoLblCartDisk; s16 m_gameinfoLblOverlay; + s16 m_gameLblSnap; + s16 m_gameLblOverlay; TexData m_snap; TexData m_cart; TexData m_overlay; diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 3028e42f..98b60f7d 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -248,6 +248,8 @@ void CMenu::_hideGame(bool instant) m_btnMgr.hide(m_gameBtnFavoriteOn, instant); m_btnMgr.hide(m_gameBtnFavoriteOff, instant); m_btnMgr.hide(m_gameBtnCategories, instant); + m_btnMgr.hide(m_gameLblSnap, instant); + m_btnMgr.hide(m_gameLblOverlay, instant); for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser); ++i) if(m_gameLblUser[i] != -1) m_btnMgr.hide(m_gameLblUser[i], instant); @@ -257,15 +259,15 @@ void CMenu::_showGame(void) { const dir_discHdr *GameHdr = CoverFlow.getHdr(); const char *coverDir = NULL; - const char *Path = NULL; + const char *FanartPath = NULL; if(GameHdr->type == TYPE_PLUGIN) coverDir = m_plugin.GetCoverFolderName(GameHdr->settings[0]); if(coverDir == NULL || strlen(coverDir) == 0) - Path = fmt("%s", m_fanartDir.c_str()); + FanartPath = fmt("%s", m_fanartDir.c_str()); else - Path = fmt("%s/%s", m_fanartDir.c_str(), coverDir); - if(m_fa.load(m_cfg, Path, CoverFlow.getHdr())) + FanartPath = fmt("%s/%s", m_fanartDir.c_str(), coverDir); + if(m_fa.load(m_cfg, FanartPath, CoverFlow.getHdr())) { const TexData *bg = NULL; const TexData *bglq = NULL; @@ -786,13 +788,26 @@ void CMenu::_game(bool launch) } /* showing and hiding buttons based on banner zoomed state */ - if(!m_zoom_banner && !m_fa.isLoaded()) + if(((!m_banner_loaded && !m_soundThrdBusy) || !m_zoom_banner) && !m_fa.isLoaded()) { /* always hide full banner buttons */ m_btnMgr.hide(m_gameBtnPlayFull); m_btnMgr.hide(m_gameBtnBackFull); m_btnMgr.hide(m_gameBtnToggleFull); + // show snapshot label here if !coverFlipped && !m_video_playing && hdr->type == TYPE_PLUGIN + // load snapshot texture in banner sound loading thread + if(hdr->type == TYPE_PLUGIN && (!m_banner_loaded && !m_soundThrdBusy) && !coverFlipped && !m_video_playing) + { + m_btnMgr.show(m_gameLblSnap); + m_btnMgr.show(m_gameLblOverlay); + } + else + { + m_btnMgr.hide(m_gameLblSnap); + m_btnMgr.hide(m_gameLblOverlay); + } + if((!Auto_hide_icons || m_show_zone_game) && !coverFlipped && !m_video_playing) { m_btnMgr.show(m_gameBtnPlay); @@ -912,6 +927,12 @@ void CMenu::_game(bool launch) _loadCFLayout(cf_version, true);// true? CoverFlow.applySettings(); } + m_snapshot_loaded = false; + TexData emptyTex; + m_btnMgr.setTexture(m_gameLblSnap, emptyTex); + m_btnMgr.setTexture(m_gameLblOverlay, emptyTex); + TexHandle.Cleanup(m_snap); + TexHandle.Cleanup(m_overlay); m_gameSelected = false; MEM2_free(hdr); _hideGame(); @@ -953,14 +974,16 @@ void CMenu::_initGameMenu() m_gameBtnPlay = _addButton("GAME/PLAY_BTN", theme.btnFont, L"", 420, 344, 200, 48, theme.btnFontColor); m_gameBtnBack = _addButton("GAME/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 48, theme.btnFontColor); m_gameBtnFavoriteOn = _addPicButton("GAME/FAVORITE_ON", texGameFavOn, texGameFavOnSel, 460, 200, 48, 48); - m_gameBtnFavoriteOff = _addPicButton("GAME/FAVORITE_OFF", texGameFavOff, texGameFavOffSel, 460, 200, 48, 48); - m_gameBtnCategories = _addPicButton("GAME/CATEGORIES_BTN", texCategories, texCategoriesSel, 532, 200, 48, 48); - m_gameBtnSettings = _addPicButton("GAME/SETTINGS_BTN", texSettings, texSettingsSel, 460, 272, 48, 48); - m_gameBtnDelete = _addPicButton("GAME/DELETE_BTN", texDelete, texDeleteSel, 532, 272, 48, 48); + m_gameBtnFavoriteOff = _addPicButton("GAME/FAVORITE_OFF", texGameFavOff, texGameFavOffSel, 460, 220, 48, 48); + m_gameBtnCategories = _addPicButton("GAME/CATEGORIES_BTN", texCategories, texCategoriesSel, 532, 220, 48, 48); + m_gameBtnSettings = _addPicButton("GAME/SETTINGS_BTN", texSettings, texSettingsSel, 460, 280, 48, 48); + m_gameBtnDelete = _addPicButton("GAME/DELETE_BTN", texDelete, texDeleteSel, 532, 280, 48, 48); m_gameBtnBackFull = _addButton("GAME/BACK_FULL_BTN", theme.btnFont, L"", 100, 390, 200, 56, theme.btnFontColor); m_gameBtnPlayFull = _addButton("GAME/PLAY_FULL_BTN", theme.btnFont, L"", 340, 390, 200, 56, theme.btnFontColor); m_gameBtnToggle = _addPicButton("GAME/TOOGLE_BTN", texToggleBanner, texToggleBanner, 385, 31, 236, 127); m_gameBtnToggleFull = _addPicButton("GAME/TOOGLE_FULL_BTN", texToggleBanner, texToggleBanner, 20, 12, 608, 344); + m_gameLblSnap = _addLabel("GAME/SNAP", theme.txtFont, L"", 420, 40, 100, 100, theme.txtFontColor, 0, m_snap); + m_gameLblOverlay = _addLabel("GAME/OVERLAY", theme.txtFont, L"", 420, 40, 100, 100, theme.txtFontColor, 0, m_overlay); m_gameButtonsZone.x = m_theme.getInt("GAME/ZONES", "buttons_x", 380); m_gameButtonsZone.y = m_theme.getInt("GAME/ZONES", "buttons_y", 0); @@ -979,6 +1002,8 @@ void CMenu::_initGameMenu() _setHideAnim(m_gameBtnBackFull, "GAME/BACK_FULL_BTN", 0, 0, 1.f, 0.f); _setHideAnim(m_gameBtnToggle, "GAME/TOOGLE_BTN", 200, 0, 1.f, 0.f); _setHideAnim(m_gameBtnToggleFull, "GAME/TOOGLE_FULL_BTN", 200, 0, 1.f, 0.f); + _setHideAnim(m_gameLblSnap, "GAME/SNAP", 0, 0, 0.f, 0.f); + _setHideAnim(m_gameLblOverlay, "GAME/OVERLAY", 0, 0, 0.f, 0.f); _hideGame(true); _textGame(); } @@ -1050,8 +1075,74 @@ void * CMenu::_gameSoundThread(void *obj) m_banner_loaded = true; } } - else // if no banner get plugin rom gamesound or just the default plugin gamesound + /* if no banner try getting snap shot */ + if((custom_bnr_size == 0 || custom_bnr_file == NULL) && m->m_platform.loaded()) { + char GameID[7]; + GameID[6] = '\0'; + char platformName[264]; + const char *TMP_Char = NULL; + GameTDB gametdb; + TexData emptyTex; + + snprintf(platformName, sizeof(platformName), "%s", m->m_platform.getString("PLUGINS", m_plugin.PluginMagicWord).c_str()); + strncpy(GameID, GameHdr->id, 6); + + if(strlen(platformName) != 0 && strcasecmp(GameID, "PLUGIN") != 0) + { + string newName = m->m_platform.getString("COMBINED", platformName); + if(newName.empty()) + m->m_platform.remove("COMBINED", platformName); + else + snprintf(platformName, sizeof(platformName), "%s", newName.c_str()); + + /* Load platform name.xml database to get game's info using the gameID */ + gametdb.OpenFile(fmt("%s/%s/%s.xml", m->m_pluginDataDir.c_str(), platformName, platformName)); + if(gametdb.IsLoaded()) + { + gametdb.SetLanguageCode(m->m_loc.getString(m->m_curLanguage, "gametdb_code", "EN").c_str()); + + /* Get roms's title without the extra ()'s or []'s */ + string ShortName = m_plugin.GetRomName(GameHdr->path); + + /* Set to empty textures in case images not found */ + m_btnMgr.setTexture(m->m_gameLblSnap, emptyTex); + m_btnMgr.setTexture(m->m_gameLblOverlay, emptyTex); + + const char *snap_path = NULL; + if(strcasestr(platformName, "ARCADE") || strcasestr(platformName, "CPS") || !strncasecmp(platformName, "NEOGEO", 6)) + snap_path = fmt("%s/%s/%s.png", m->m_snapDir.c_str(), platformName, ShortName.c_str()); + else if(gametdb.GetName(GameID, TMP_Char)) + snap_path = fmt("%s/%s/%s.png", m->m_snapDir.c_str(), platformName, TMP_Char); + + gametdb.CloseFile(); + if(snap_path == NULL || !fsop_FileExist(snap_path)) + snap_path = fmt("%s/%s/%s.png", m->m_snapDir.c_str(), platformName, GameID); + + if(fsop_FileExist(snap_path)) + { + m->m_snapshot_loaded = true; + TexHandle.fromImageFile(m->m_snap, snap_path); + m_btnMgr.setTexture(m->m_gameLblSnap, m->m_snap, m->m_snap.width*.75, m->m_snap.height*.75); + + const char *overlay_path = fmt("%s/%s_overlay.png", m->m_snapDir.c_str(), platformName); + if(fsop_FileExist(overlay_path)) + { + TexHandle.fromImageFile(m->m_overlay, overlay_path); + m_btnMgr.setTexture(m->m_gameLblOverlay, m->m_overlay, m->m_overlay.width*.75, m->m_overlay.height*.75); + } + else + TexHandle.Cleanup(m->m_overlay); + } + else + { + m->m_snapshot_loaded = false; + TexHandle.Cleanup(m->m_snap); + TexHandle.Cleanup(m->m_overlay); + } + } + } + /* try to get plugin rom gamesound or just the default plugin gamesound */ m_banner.DeleteBanner(); bool found = false; if(fsop_FileExist(fmt("%s.mp3", game_sound))) diff --git a/source/menu/menu_gameinfo.cpp b/source/menu/menu_gameinfo.cpp index 1eb1408e..8eef7f36 100644 --- a/source/menu/menu_gameinfo.cpp +++ b/source/menu/menu_gameinfo.cpp @@ -306,9 +306,9 @@ void CMenu::_initGameInfoMenu() _setHideAnim(m_gameinfoLblRlsdate, "GAMEINFO/RLSDATE", 0, -100, 0.f, 0.f); _setHideAnim(m_gameinfoLblGenre, "GAMEINFO/GENRE", 0, -100, 0.f, 0.f); _setHideAnim(m_gameinfoLblWifiplayers, "GAMEINFO/WIFIPLAYERS", 0, -100, 0.f, 0.f); - _setHideAnim(m_gameinfoLblSnap, "GAMEINFO/SNAP", 0, -100, 0.f, 0.f); - _setHideAnim(m_gameinfoLblCartDisk, "GAMEINFO/CART", 0, -100, 0.f, 0.f); - _setHideAnim(m_gameinfoLblOverlay, "GAMEINFO/OVERLAY", 0, -100, 0.f, 0.f); + _setHideAnim(m_gameinfoLblSnap, "GAMEINFO/SNAP", 0, 0, 0.f, 0.f); + _setHideAnim(m_gameinfoLblCartDisk, "GAMEINFO/CART", 0, 0, 0.f, 0.f); + _setHideAnim(m_gameinfoLblOverlay, "GAMEINFO/OVERLAY", 0, 0, 0.f, 0.f); _setHideAnim(m_gameinfoLblRomInfo, "GAMEINFO/ROMINFO", 0, -100, 0.f, 0.f); // _hideGameInfo(true); @@ -341,23 +341,8 @@ void CMenu::_textGameInfo(void) /* Search platform.ini to find plugin magic to get platformName */ snprintf(platformName, sizeof(platformName), "%s", m_platform.getString("PLUGINS", m_plugin.PluginMagicWord).c_str()); - if(strstr(platformName, "multi") != NULL)// if multi platform ie. vbagx, genplusgx, get file extension - { - return; //if multi found (old platform.ini) - /*char ext[4]; - if(strstr(GameHdr->path, ".zip") != NULL)// if zip get internal filename extension - { - ZipFile zFile(GameHdr->path); - const char *fileName = zFile.GetFileName(); - strcpy(ext, strrchr(fileName, '.') + 1); - } - else - { - strcpy(ext, strrchr(GameHdr->path, '.') + 1); - } - snprintf(platformName, sizeof(platformName), "%s", m_platform.getString("ext", ext).c_str());*/ - } - if(strlen(platformName) == 0) + strncpy(GameID, GameHdr->id, 6); + if(strlen(platformName) == 0 || strcasecmp(GameID, "PLUGIN") == 0) return;// no platform name found to match plugin magic # /* check COMBINED for platform names that mean the same system just different region */ @@ -369,14 +354,6 @@ void CMenu::_textGameInfo(void) else snprintf(platformName, sizeof(platformName), "%s", newName.c_str()); - /* Get roms's title without the extra ()'s or []'s */ - string ShortName = m_plugin.GetRomName(GameHdr->path); - - /* copy rom ID to be used as gameID to get game info from xml */ - strncpy(GameID, GameHdr->id, 6); - if(strcasecmp(GameID, "PLUGIN") == 0) - return; - /* Load platform name.xml database to get game's info using the gameID */ gametdb.OpenFile(fmt("%s/%s/%s.xml", m_pluginDataDir.c_str(), platformName, platformName)); tdb_found = gametdb.IsLoaded(); @@ -385,81 +362,43 @@ void CMenu::_textGameInfo(void) gametdb.SetLanguageCode(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str()); + /* Get roms's title without the extra ()'s or []'s */ + string ShortName = m_plugin.GetRomName(GameHdr->path); + /* Set to empty textures in case images not found */ m_btnMgr.setTexture(m_gameinfoLblSnap, emptyTex); m_btnMgr.setTexture(m_gameinfoLblCartDisk, emptyTex); m_btnMgr.setTexture(m_gameinfoLblOverlay, emptyTex); - /* Get rom name from current xml and get rom images if name is found */ - if(gametdb.GetName(GameID, TMP_Char)) - { - const char *snap_path = NULL; - const char *cart_path = NULL; - const char *overlay_path = NULL; - - // Use real filename without extension for arcade games. - if(strcasestr(platformName, "ARCADE") || strcasestr(platformName, "CPS") || !strncasecmp(platformName, "NEOGEO", 6)) - { - snap_path = fmt("%s/%s/%s.png", m_snapDir.c_str(), platformName, ShortName.c_str()); - cart_path = fmt("%s/%s/%s_2D.png", m_cartDir.c_str(), platformName, ShortName.c_str()); - } - // Name from the database. - else - { - snap_path = fmt("%s/%s/%s.png", m_snapDir.c_str(), platformName, TMP_Char); - cart_path = fmt("%s/%s/%s_2D.png", m_cartDir.c_str(), platformName, TMP_Char); - } - - // Try to find images by game's ID - if(!fsop_FileExist(snap_path)) - { - snap_path = fmt("%s/%s/%s.png", m_snapDir.c_str(), platformName, GameID); - cart_path = fmt("%s/%s/%s_2D.png", m_cartDir.c_str(), platformName, GameID); - - if(!fsop_FileExist(snap_path)) - { - TexHandle.Cleanup(m_snap); - TexHandle.Cleanup(m_cart); - } - } - - TexHandle.fromImageFile(m_snap, snap_path); + if(m_snap.data != NULL) m_btnMgr.setTexture(m_gameinfoLblSnap, m_snap, m_snap.width, m_snap.height); + if(m_overlay.data != NULL) + m_btnMgr.setTexture(m_gameinfoLblOverlay, m_overlay, m_overlay.width, m_overlay.height); + + const char *cart_path = NULL; + if(strcasestr(platformName, "ARCADE") || strcasestr(platformName, "CPS") || !strncasecmp(platformName, "NEOGEO", 6)) + cart_path = fmt("%s/%s/%s_2D.png", m_cartDir.c_str(), platformName, ShortName.c_str()); + else if(gametdb.GetName(GameID, TMP_Char)) + cart_path = fmt("%s/%s/%s_2D.png", m_cartDir.c_str(), platformName, TMP_Char); + + if(cart_path == NULL || !fsop_FileExist(cart_path)) + cart_path = fmt("%s/%s/%s_2D.png", m_cartDir.c_str(), platformName, GameID); + + if(fsop_FileExist(cart_path)) + { TexHandle.fromImageFile(m_cart, cart_path); if(m_cart.height > 112) m_btnMgr.setTexture(m_gameinfoLblCartDisk, m_cart, 114, 128); else m_btnMgr.setTexture(m_gameinfoLblCartDisk, m_cart, 160, 112); - - overlay_path = fmt("%s/%s_overlay.png", m_snapDir.c_str(), platformName); - - if(fsop_FileExist(overlay_path)) - { - TexHandle.fromImageFile(m_overlay, overlay_path); - m_btnMgr.setTexture(m_gameinfoLblOverlay, m_overlay, m_overlay.width, m_overlay.height); - } - else - { - m_btnMgr.setTexture(m_gameinfoLblOverlay, emptyTex); - } } + else + TexHandle.Cleanup(m_cart); // Get title m_btnMgr.setText(m_gameinfoLblTitle, GameHdr->title); - /*if(gametdb.GetTitle(GameID, TMP_Char)) - { - gameinfo_Title_w.fromUTF8(TMP_Char); - m_btnMgr.setText(m_gameinfoLblTitle, gameinfo_Title_w); - } - else - { - tdb_found = false; - gametdb.CloseFile();// gameID not found in xml - return; - }*/ - // Get Synopsis if(gametdb.GetSynopsis(GameID, TMP_Char)) gameinfo_Synopsis_w.fromUTF8(TMP_Char); @@ -531,7 +470,6 @@ void CMenu::_textGameInfo(void) break; } } - //m_btnMgr.setText(m_gameinfoLblRomInfo, rom_info); // u8 players = gametdb.GetPlayers(GameID); diff --git a/source/plugin/plugin.cpp b/source/plugin/plugin.cpp index 457977d5..3ab1502d 100644 --- a/source/plugin/plugin.cpp +++ b/source/plugin/plugin.cpp @@ -139,7 +139,11 @@ const char *Plugin::GetDolName(u32 magic) const char *Plugin::GetCoverFolderName(u32 magic) { if((Plugin_Pos = GetPluginPosition(magic)) >= 0) - return Plugins[Plugin_Pos].coverFolder.c_str(); + { + string cf = Plugins[Plugin_Pos].coverFolder; + if(!cf.empty()) + return cf.c_str(); + } return NULL; }