- snapshots are now centered to fit inside the mini banner frame if theme available. plugin snapshot changes:

[GAME/SNAP] is the snapshot. width and height are just random numbers. wiiflow sets those. and the texture is of course set by wiiflow. the x and y are the upper left and the only thing to worry about.

[GAME/OVERLAY] is the snapshot overlay for handhelds. same info as [GAME/SNAP]

[GAME/SNAP_BG] is used for 2 things.
1. the dimensions of the window inside the frame. (x,y,width,height) used so wiiflow can center the snapshot.
2. the texture of the window inside the frame. wiiflow has it set to a transparent image. but you can make and use a solid colored image if you like.

the frame is still [GAME/USER4]
This commit is contained in:
Fledge68 2019-10-07 12:15:41 -05:00
parent 9d3c65cf9d
commit 1384e475b0
12 changed files with 169 additions and 116 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 MiB

After

Width:  |  Height:  |  Size: 3.4 MiB

View File

@ -6,7 +6,7 @@
#else #else
#define APP_NAME "WiiFlow Lite" #define APP_NAME "WiiFlow Lite"
#endif #endif
#define APP_VERSION "5.3.0 beta 9" #define APP_VERSION "5.3.0 beta 10"
#define APP_DATA_DIR "wiiflow" #define APP_DATA_DIR "wiiflow"
#ifdef APP_WIIFLOW #ifdef APP_WIIFLOW

View File

@ -250,11 +250,13 @@ void CButtonsMgr::setTexture(s16 id, TexData &bg, int width, int height)
case GUIELT_LABEL: case GUIELT_LABEL:
lbl = (SLabel*)m_elts[id]; lbl = (SLabel*)m_elts[id];
lbl->texBg = bg;//change texture lbl->texBg = bg;//change texture
/* x and y are currently the center of the w and h plus x and y */
/* we need to set x and y back to upper left corner */
lbl->x = lbl->x - lbl->w / 2; lbl->x = lbl->x - lbl->w / 2;
lbl->y = lbl->y - lbl->h / 2; lbl->y = lbl->y - lbl->h / 2;
lbl->w = width; lbl->w = width;
lbl->h = height; lbl->h = height;
lbl->x = lbl->x + width / 2; lbl->x = lbl->x + width / 2;// set to new center based on new w and h
lbl->y = lbl->y + height / 2; lbl->y = lbl->y + height / 2;
break; break;
case GUIELT_PROGRESS: case GUIELT_PROGRESS:
@ -263,6 +265,30 @@ void CButtonsMgr::setTexture(s16 id, TexData &bg, int width, int height)
} }
} }
void CButtonsMgr::setTexture(s16 id, TexData &bg, int x_pos, int y_pos, int width, int height)
{
if (id == -1) return;
if (id < (s32)m_elts.size())
{
SLabel *lbl = NULL;
switch(m_elts[id]->t)
{
case GUIELT_BUTTON:
break;
case GUIELT_LABEL:
lbl = (SLabel*)m_elts[id];
lbl->texBg = bg;//change texture
lbl->w = width;
lbl->h = height;
lbl->x = x_pos + width / 2;
lbl->y = y_pos + height / 2;
break;
case GUIELT_PROGRESS:
break;
}
}
}
void CButtonsMgr::setProgress(s16 id, float f, bool instant) void CButtonsMgr::setProgress(s16 id, float f, bool instant)
{ {
if(m_elts[id]->t == GUIELT_PROGRESS) if(m_elts[id]->t == GUIELT_PROGRESS)

View File

@ -45,6 +45,7 @@ public:
void freeBtnTexture(s16 id); void freeBtnTexture(s16 id);
void setTexture(s16 id ,TexData &bg); void setTexture(s16 id ,TexData &bg);
void setTexture(s16 id, TexData &bg, int width, int height); void setTexture(s16 id, TexData &bg, int width, int height);
void setTexture(s16 id, TexData &bg, int x_pos, int y_pos, int width, int height);
void setProgress(s16 id, float f, bool instant = false); void setProgress(s16 id, float f, bool instant = false);
void reset(s16 id, bool instant = false); void reset(s16 id, bool instant = false);
void moveBy(s16 id, int x, int y, bool instant = false); void moveBy(s16 id, int x, int y, bool instant = false);

View File

@ -280,17 +280,15 @@ static void Add_Plugin_Game(char *FullPath)
const char *RomFilename = strrchr(FullPath, '/') + 1; const char *RomFilename = strrchr(FullPath, '/') + 1;
*strrchr(RomFilename, '.') = '\0'; *strrchr(RomFilename, '.') = '\0';
char CustomTitle[64]; string customTitle = CustomTitles.getString(m_plugin.PluginMagicWord, RomFilename, "");
memset(CustomTitle, 0, sizeof(CustomTitle));
strncpy(CustomTitle, CustomTitles.getString(m_plugin.PluginMagicWord, RomFilename).c_str(), 63);
const char *gameTDB_Title = NULL; const char *gameTDB_Title = NULL;
if(gameTDB.IsLoaded() && strlen(CustomTitle) == 0) if(gameTDB.IsLoaded() && customTitle.empty())
gameTDB.GetTitle(ListElement.id, gameTDB_Title); gameTDB.GetTitle(ListElement.id, gameTDB_Title);
/* set the roms title */ /* set the roms title */
if(strlen(CustomTitle) > 0) if(!customTitle.empty())
mbstowcs(ListElement.title, CustomTitle, 63); mbstowcs(ListElement.title, customTitle.c_str(), 63);
else if(gameTDB_Title != NULL && gameTDB_Title[0] != '\0') else if(gameTDB_Title != NULL && gameTDB_Title[0] != '\0')
mbstowcs(ListElement.title, gameTDB_Title, 63); mbstowcs(ListElement.title, gameTDB_Title, 63);
else else

View File

@ -1671,7 +1671,7 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
CoverFlow.draw(); CoverFlow.draw();
m_vid.setup2DProjection(false, true); m_vid.setup2DProjection(false, true);
CoverFlow.drawEffect(); CoverFlow.drawEffect();
if(!m_banner.GetSelectedGame() && !m_snapshot_loaded) if(!m_banner.GetSelectedGame() && (!m_snapshot_loaded && !m_soundThrdBusy && m_gameSelected))
CoverFlow.drawText(adjusting); CoverFlow.drawText(adjusting);
m_vid.renderAAPass(i); m_vid.renderAAPass(i);
} }
@ -1687,7 +1687,7 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
CoverFlow.draw(); CoverFlow.draw();
m_vid.setup2DProjection(); m_vid.setup2DProjection();
CoverFlow.drawEffect(); CoverFlow.drawEffect();
if(!m_banner.GetSelectedGame() && !m_snapshot_loaded) if(!m_banner.GetSelectedGame() && (!m_snapshot_loaded && !m_soundThrdBusy && m_gameSelected))
CoverFlow.drawText(adjusting); CoverFlow.drawText(adjusting);
} }
} }

View File

@ -431,6 +431,7 @@ private:
s16 m_gameBtnPlay; s16 m_gameBtnPlay;
s16 m_gameBtnBack; s16 m_gameBtnBack;
s16 m_gameLblUser[5]; s16 m_gameLblUser[5];
int snapbg_x, snapbg_y, snapbg_w, snapbg_h;
// Parental code menu // Parental code menu
s16 m_codeLblTitle; s16 m_codeLblTitle;
s16 m_codeBtnKey[10]; s16 m_codeBtnKey[10];

View File

@ -16,6 +16,7 @@ s16 m_gameBtnPlayFull;
s16 m_gameBtnBackFull; s16 m_gameBtnBackFull;
s16 m_gameBtnToggle; s16 m_gameBtnToggle;
s16 m_gameBtnToggleFull; s16 m_gameBtnToggleFull;
s16 m_gameLblSnapBg;
const CMenu::SOption CMenu::_GlobalVideoModes[6] = { const CMenu::SOption CMenu::_GlobalVideoModes[6] = {
{ "vidgame", L"Game" }, { "vidgame", L"Game" },
@ -787,82 +788,19 @@ void CMenu::_game(bool launch)
} }
} }
/* showing and hiding buttons based on banner zoomed state */ if(!m_fa.isLoaded() && !coverFlipped && !m_video_playing)
if(((!m_banner_loaded && !m_soundThrdBusy) || !m_zoom_banner) && !m_fa.isLoaded())
{ {
/* always hide full banner buttons */ if(m_banner_loaded && !m_soundThrdBusy && m_zoom_banner)
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);
m_btnMgr.show(m_gameBtnBack);
m_btnMgr.show(m_gameBtnSettings);
m_btnMgr.show(m_gameBtnDelete);
m_btnMgr.show(m_gameBtnCategories);
bool b;
if(hdr->type == TYPE_PLUGIN)
b = m_gcfg1.getBool("FAVORITES_PLUGINS", id, false);
else
b = m_gcfg1.getBool("FAVORITES", id, false);
m_btnMgr.show(b ? m_gameBtnFavoriteOn : m_gameBtnFavoriteOff);
m_btnMgr.hide(b ? m_gameBtnFavoriteOff : m_gameBtnFavoriteOn);
for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser) - 2; ++i)// #4 is used for banner frame
if(m_gameLblUser[i] != -1)
m_btnMgr.show(m_gameLblUser[i]);
}
else
{
m_btnMgr.hide(m_gameBtnFavoriteOn);
m_btnMgr.hide(m_gameBtnFavoriteOff);
m_btnMgr.hide(m_gameBtnCategories);
m_btnMgr.hide(m_gameBtnSettings);
m_btnMgr.hide(m_gameBtnDelete);
m_btnMgr.hide(m_gameBtnPlay);
m_btnMgr.hide(m_gameBtnBack);
for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser) - 2; ++i)
if (m_gameLblUser[i] != -1)
m_btnMgr.hide(m_gameLblUser[i]);
}
/* show or hide small banner toggle btn and frame */
if(m_banner_loaded && !m_soundThrdBusy && !coverFlipped && !m_video_playing && !m_fa.isLoaded())
{
/* show only if the game has a banner */
m_btnMgr.show(m_gameBtnToggle);
if(m_gameLblUser[4] != -1)
m_btnMgr.show(m_gameLblUser[4]);
}
else
{
m_btnMgr.hide(m_gameBtnToggle);
if(m_gameLblUser[4] != -1)
m_btnMgr.hide(m_gameLblUser[4]);
}
}
else if(!m_fa.isLoaded())// banner zoomed full screen
{
if(m_banner_loaded && !m_soundThrdBusy)// there is a banner
{ {
m_btnMgr.show(m_gameBtnPlayFull); m_btnMgr.show(m_gameBtnPlayFull);
m_btnMgr.show(m_gameBtnBackFull); m_btnMgr.show(m_gameBtnBackFull);
m_btnMgr.show(m_gameBtnToggleFull); m_btnMgr.show(m_gameBtnToggleFull);
m_btnMgr.hide(m_gameLblSnapBg, true);
m_btnMgr.hide(m_gameLblSnap, true);
m_btnMgr.hide(m_gameLblOverlay, true);
m_btnMgr.hide(m_gameBtnToggle, true);
m_btnMgr.hide(m_gameBtnFavoriteOn); m_btnMgr.hide(m_gameBtnFavoriteOn);
m_btnMgr.hide(m_gameBtnFavoriteOff); m_btnMgr.hide(m_gameBtnFavoriteOff);
m_btnMgr.hide(m_gameBtnCategories); m_btnMgr.hide(m_gameBtnCategories);
@ -870,22 +808,13 @@ void CMenu::_game(bool launch)
m_btnMgr.hide(m_gameBtnDelete); m_btnMgr.hide(m_gameBtnDelete);
m_btnMgr.hide(m_gameBtnPlay); m_btnMgr.hide(m_gameBtnPlay);
m_btnMgr.hide(m_gameBtnBack); m_btnMgr.hide(m_gameBtnBack);
for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser); ++i)// hide all including mini banner frame
m_btnMgr.hide(m_gameBtnToggle);
for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser); ++i)
if(m_gameLblUser[i] != -1) if(m_gameLblUser[i] != -1)
m_btnMgr.hide(m_gameLblUser[i]); m_btnMgr.hide(m_gameLblUser[i]);
} }
else // no banner for whatever reason else
{ {
if(!m_soundThrdBusy) if(!Auto_hide_icons || m_show_zone_game)
{
m_btnMgr.hide(m_gameBtnPlayFull);
m_btnMgr.hide(m_gameBtnBackFull);
m_btnMgr.hide(m_gameBtnToggleFull);
}
if(m_show_zone_game && !m_soundThrdBusy)
{ {
m_btnMgr.show(m_gameBtnPlay); m_btnMgr.show(m_gameBtnPlay);
m_btnMgr.show(m_gameBtnBack); m_btnMgr.show(m_gameBtnBack);
@ -899,7 +828,7 @@ void CMenu::_game(bool launch)
b = m_gcfg1.getBool("FAVORITES", id, false); b = m_gcfg1.getBool("FAVORITES", id, false);
m_btnMgr.show(b ? m_gameBtnFavoriteOn : m_gameBtnFavoriteOff); m_btnMgr.show(b ? m_gameBtnFavoriteOn : m_gameBtnFavoriteOff);
m_btnMgr.hide(b ? m_gameBtnFavoriteOff : m_gameBtnFavoriteOn); m_btnMgr.hide(b ? m_gameBtnFavoriteOff : m_gameBtnFavoriteOn);
for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser) - 2; ++i)// don't include small banner frame for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser) - 1; ++i)// #4 is used for banner frame
if(m_gameLblUser[i] != -1) if(m_gameLblUser[i] != -1)
m_btnMgr.show(m_gameLblUser[i]); m_btnMgr.show(m_gameLblUser[i]);
} }
@ -912,14 +841,73 @@ void CMenu::_game(bool launch)
m_btnMgr.hide(m_gameBtnDelete); m_btnMgr.hide(m_gameBtnDelete);
m_btnMgr.hide(m_gameBtnPlay); m_btnMgr.hide(m_gameBtnPlay);
m_btnMgr.hide(m_gameBtnBack); m_btnMgr.hide(m_gameBtnBack);
m_btnMgr.hide(m_gameBtnToggle);
for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser) - 1; ++i) for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser) - 1; ++i)
if (m_gameLblUser[i] != -1) if (m_gameLblUser[i] != -1)
m_btnMgr.hide(m_gameLblUser[i]); m_btnMgr.hide(m_gameLblUser[i]);
} }
if(m_banner_loaded && !m_soundThrdBusy && !m_zoom_banner)
{
m_btnMgr.hide(m_gameBtnPlayFull);
m_btnMgr.hide(m_gameBtnBackFull);
m_btnMgr.hide(m_gameBtnToggleFull);
m_btnMgr.hide(m_gameLblSnapBg, true);
m_btnMgr.hide(m_gameLblSnap, true);
m_btnMgr.hide(m_gameLblOverlay, true);
m_btnMgr.show(m_gameBtnToggle);
if(m_gameLblUser[4] != -1)// show mini banner frame if available
m_btnMgr.show(m_gameLblUser[4]);
}
if(m_snapshot_loaded && !m_soundThrdBusy)
{
m_btnMgr.hide(m_gameBtnPlayFull);
m_btnMgr.hide(m_gameBtnBackFull);
m_btnMgr.hide(m_gameBtnToggleFull);
m_btnMgr.hide(m_gameBtnToggle);
m_btnMgr.show(m_gameLblSnapBg);
m_btnMgr.show(m_gameLblSnap);
m_btnMgr.show(m_gameLblOverlay);
if(m_gameLblUser[4] != -1)// frame if available
m_btnMgr.show(m_gameLblUser[4]);
}
if(!m_banner_loaded && !m_snapshot_loaded && !m_soundThrdBusy)
{
m_btnMgr.hide(m_gameBtnPlayFull);
m_btnMgr.hide(m_gameBtnBackFull);
m_btnMgr.hide(m_gameBtnToggleFull);
m_btnMgr.hide(m_gameBtnToggle);
m_btnMgr.hide(m_gameLblSnapBg);
m_btnMgr.hide(m_gameLblSnap);
m_btnMgr.hide(m_gameLblOverlay);
if(m_gameLblUser[4] != -1)// hide frame
m_btnMgr.hide(m_gameLblUser[4]);
}
} }
} }
else
{
m_btnMgr.hide(m_gameLblSnapBg);
m_btnMgr.hide(m_gameLblSnap);
m_btnMgr.hide(m_gameLblOverlay);
m_btnMgr.hide(m_gameBtnPlayFull);
m_btnMgr.hide(m_gameBtnBackFull);
m_btnMgr.hide(m_gameBtnToggle);
m_btnMgr.hide(m_gameBtnToggleFull);
m_btnMgr.hide(m_gameBtnPlay);
m_btnMgr.hide(m_gameBtnBack);
m_btnMgr.hide(m_gameBtnDelete);
m_btnMgr.hide(m_gameBtnSettings);
m_btnMgr.hide(m_gameBtnFavoriteOn);
m_btnMgr.hide(m_gameBtnFavoriteOff);
m_btnMgr.hide(m_gameBtnCategories);
for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser); ++i)
if(m_gameLblUser[i] != -1)
m_btnMgr.hide(m_gameLblUser[i]);
}
} }
if(coverFlipped) if(coverFlipped)
{ {
@ -952,6 +940,7 @@ void CMenu::_initGameMenu()
TexData texSettings; TexData texSettings;
TexData texSettingsSel; TexData texSettingsSel;
TexData texToggleBanner; TexData texToggleBanner;
TexData texSnapShotBg;
TexData bgLQ; TexData bgLQ;
TexHandle.fromImageFile(texGameFavOn, fmt("%s/gamefavon.png", m_imgsDir.c_str())); TexHandle.fromImageFile(texGameFavOn, fmt("%s/gamefavon.png", m_imgsDir.c_str()));
@ -965,6 +954,7 @@ void CMenu::_initGameMenu()
TexHandle.fromImageFile(texSettings, fmt("%s/btnconfig.png", m_imgsDir.c_str())); TexHandle.fromImageFile(texSettings, fmt("%s/btnconfig.png", m_imgsDir.c_str()));
TexHandle.fromImageFile(texSettingsSel, fmt("%s/btnconfigs.png", m_imgsDir.c_str())); TexHandle.fromImageFile(texSettingsSel, fmt("%s/btnconfigs.png", m_imgsDir.c_str()));
TexHandle.fromImageFile(texToggleBanner, fmt("%s/blank.png", m_imgsDir.c_str())); TexHandle.fromImageFile(texToggleBanner, fmt("%s/blank.png", m_imgsDir.c_str()));
TexHandle.fromImageFile(texSnapShotBg, fmt("%s/blank.png", m_imgsDir.c_str()));
_addUserLabels(m_gameLblUser, ARRAY_SIZE(m_gameLblUser), "GAME"); _addUserLabels(m_gameLblUser, ARRAY_SIZE(m_gameLblUser), "GAME");
m_gameBg = _texture("GAME/BG", "texture", theme.bg, false); m_gameBg = _texture("GAME/BG", "texture", theme.bg, false);
@ -982,8 +972,9 @@ void CMenu::_initGameMenu()
m_gameBtnPlayFull = _addButton("GAME/PLAY_FULL_BTN", theme.btnFont, L"", 340, 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_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_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_gameLblSnapBg = _addLabel("GAME/SNAP_BG", theme.txtFont, L"", 385, 31, 246, 127, theme.txtFontColor, 0, texSnapShotBg);
m_gameLblOverlay = _addLabel("GAME/OVERLAY", theme.txtFont, L"", 420, 40, 100, 100, theme.txtFontColor, 0, m_overlay); m_gameLblSnap = _addLabel("GAME/SNAP", theme.txtFont, L"", 385, 31, 100, 100, theme.txtFontColor, 0, m_snap);
m_gameLblOverlay = _addLabel("GAME/OVERLAY", theme.txtFont, L"", 385, 31, 100, 100, theme.txtFontColor, 0, m_overlay);
m_gameButtonsZone.x = m_theme.getInt("GAME/ZONES", "buttons_x", 380); m_gameButtonsZone.x = m_theme.getInt("GAME/ZONES", "buttons_x", 380);
m_gameButtonsZone.y = m_theme.getInt("GAME/ZONES", "buttons_y", 0); m_gameButtonsZone.y = m_theme.getInt("GAME/ZONES", "buttons_y", 0);
@ -1002,10 +993,15 @@ void CMenu::_initGameMenu()
_setHideAnim(m_gameBtnBackFull, "GAME/BACK_FULL_BTN", 0, 0, 1.f, 0.f); _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_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_gameBtnToggleFull, "GAME/TOOGLE_FULL_BTN", 200, 0, 1.f, 0.f);
_setHideAnim(m_gameLblSnapBg, "GAME/SNAP_BG", 0, 0, 0.f, 0.f);
_setHideAnim(m_gameLblSnap, "GAME/SNAP", 0, 0, 0.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); _setHideAnim(m_gameLblOverlay, "GAME/OVERLAY", 0, 0, 0.f, 0.f);
_hideGame(true); _hideGame(true);
_textGame(); _textGame();
snapbg_x = m_theme.getInt("GAME/SNAP_BG", "x", 385);
snapbg_y = m_theme.getInt("GAME/SNAP_BG", "y", 31);
snapbg_w = m_theme.getInt("GAME/SNAP_BG", "width", 246);
snapbg_h = m_theme.getInt("GAME/SNAP_BG", "height", 127);
} }
void CMenu::_textGame(void) void CMenu::_textGame(void)
@ -1046,6 +1042,7 @@ void * CMenu::_gameSoundThread(void *obj)
char game_sound[256]; char game_sound[256];
game_sound[255] = '\0'; game_sound[255] = '\0';
m->m_snapshot_loaded = false;
m_banner_loaded = false; m_banner_loaded = false;
const dir_discHdr *GameHdr = CoverFlow.getHdr(); const dir_discHdr *GameHdr = CoverFlow.getHdr();
if(GameHdr->type == TYPE_PLUGIN) if(GameHdr->type == TYPE_PLUGIN)
@ -1085,6 +1082,10 @@ void * CMenu::_gameSoundThread(void *obj)
GameTDB gametdb; GameTDB gametdb;
TexData emptyTex; TexData emptyTex;
/* Set to empty textures in case images not found */
m_btnMgr.setTexture(m->m_gameLblSnap, emptyTex);
m_btnMgr.setTexture(m->m_gameLblOverlay, emptyTex);
snprintf(platformName, sizeof(platformName), "%s", m->m_platform.getString("PLUGINS", m_plugin.PluginMagicWord).c_str()); snprintf(platformName, sizeof(platformName), "%s", m->m_platform.getString("PLUGINS", m_plugin.PluginMagicWord).c_str());
strncpy(GameID, GameHdr->id, 6); strncpy(GameID, GameHdr->id, 6);
@ -1105,10 +1106,6 @@ void * CMenu::_gameSoundThread(void *obj)
/* Get roms's title without the extra ()'s or []'s */ /* Get roms's title without the extra ()'s or []'s */
string ShortName = m_plugin.GetRomName(GameHdr->path); 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; const char *snap_path = NULL;
if(strcasestr(platformName, "ARCADE") || strcasestr(platformName, "CPS") || !strncasecmp(platformName, "NEOGEO", 6)) 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()); snap_path = fmt("%s/%s/%s.png", m->m_snapDir.c_str(), platformName, ShortName.c_str());
@ -1123,25 +1120,50 @@ void * CMenu::_gameSoundThread(void *obj)
{ {
m->m_snapshot_loaded = true; m->m_snapshot_loaded = true;
TexHandle.fromImageFile(m->m_snap, snap_path); 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); /* get snapshot position and dimensions to center it on the snap background */
int snap_w = m->m_snap.width;
int snap_h = m->m_snap.height;
int width_over = snap_w - m->snapbg_w;
int height_over = snap_h - m->snapbg_h;
float aspect_ratio = (float)snap_w / (float)snap_h;
if(width_over > 0 || height_over > 0)
{
if(width_over > height_over)
{
snap_w = m->snapbg_w;
snap_h = (int)((float)snap_w / aspect_ratio);
}
else
{
snap_h = m->snapbg_h;
snap_w = (int)((float)snap_h * aspect_ratio);
}
}
int x_pos = (m->snapbg_w - snap_w) / 2 + m->snapbg_x;
int y_pos = (m->snapbg_h - snap_h) / 2 + m->snapbg_y;
m_btnMgr.setTexture(m->m_gameLblSnap, m->m_snap, x_pos, y_pos, snap_w, snap_h);
/* get possible overlay */
const char *overlay_path = fmt("%s/%s_overlay.png", m->m_snapDir.c_str(), platformName); const char *overlay_path = fmt("%s/%s_overlay.png", m->m_snapDir.c_str(), platformName);
if(fsop_FileExist(overlay_path)) if(fsop_FileExist(overlay_path))
{ {
TexHandle.fromImageFile(m->m_overlay, 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); m_btnMgr.setTexture(m->m_gameLblOverlay, m->m_overlay, x_pos, y_pos, snap_w, snap_h);
} }
else else
TexHandle.Cleanup(m->m_overlay); TexHandle.Cleanup(m->m_overlay);
} }
else
{
m->m_snapshot_loaded = false;
TexHandle.Cleanup(m->m_snap);
TexHandle.Cleanup(m->m_overlay);
}
} }
} }
if(!m->m_snapshot_loaded)
{
TexHandle.Cleanup(m->m_snap);
TexHandle.Cleanup(m->m_overlay);
}
}
if(custom_bnr_size == 0 || custom_bnr_file == NULL)
{
/* try to get plugin rom gamesound or just the default plugin gamesound */ /* try to get plugin rom gamesound or just the default plugin gamesound */
m_banner.DeleteBanner(); m_banner.DeleteBanner();
bool found = false; bool found = false;
@ -1170,12 +1192,16 @@ void * CMenu::_gameSoundThread(void *obj)
m->m_gameSound.Load(m_plugin.GetBannerSound(GameHdr->settings[0]), m_plugin.GetBannerSoundSize()); m->m_gameSound.Load(m_plugin.GetBannerSound(GameHdr->settings[0]), m_plugin.GetBannerSoundSize());
if(m->m_gameSound.IsLoaded()) if(m->m_gameSound.IsLoaded())
m->m_gamesound_changed = true; m->m_gamesound_changed = true;
}
if(custom_bnr_size == 0 || custom_bnr_file == NULL)// no custom banner so we are done. exit sound thread.
{
m->m_soundThrdBusy = false; m->m_soundThrdBusy = false;
return NULL; return NULL;
} }
} }
else else
{ {
/* try to get custom banner for wii, gc, and channels */
/* check custom ID6 first */ /* check custom ID6 first */
strncpy(custom_banner, fmt("%s/%s.bnr", m->m_customBnrDir.c_str(), GameHdr->id), 255); strncpy(custom_banner, fmt("%s/%s.bnr", m->m_customBnrDir.c_str(), GameHdr->id), 255);
fsop_GetFileSizeBytes(custom_banner, &custom_bnr_size); fsop_GetFileSizeBytes(custom_banner, &custom_bnr_size);
@ -1205,6 +1231,7 @@ void * CMenu::_gameSoundThread(void *obj)
} }
if(GameHdr->type == TYPE_GC_GAME && custom_bnr_file == NULL) if(GameHdr->type == TYPE_GC_GAME && custom_bnr_file == NULL)
{ {
/* gc game but no custom banner. so we make one ourselves. and exit sound thread. */
//get the gc game's opening.bnr from ISO - a 96x32 image to add to the gc banner included with wiiflow //get the gc game's opening.bnr from ISO - a 96x32 image to add to the gc banner included with wiiflow
GC_Disc_Reader.init(GameHdr->path); GC_Disc_Reader.init(GameHdr->path);
u8 *opening_bnr = GC_Disc_Reader.GetGameCubeBanner(); u8 *opening_bnr = GC_Disc_Reader.GetGameCubeBanner();
@ -1227,7 +1254,7 @@ void * CMenu::_gameSoundThread(void *obj)
m->m_soundThrdBusy = false; m->m_soundThrdBusy = false;
return NULL; return NULL;
} }
if(custom_bnr_file == NULL)/* no custom and not GC game try cached banner id6 only*/ if(custom_bnr_file == NULL)/* no custom banner load and if wii or channel game try cached banner id6 only*/
{ {
strncpy(cached_banner, fmt("%s/%s.bnr", m->m_bnrCacheDir.c_str(), GameHdr->id), 255); strncpy(cached_banner, fmt("%s/%s.bnr", m->m_bnrCacheDir.c_str(), GameHdr->id), 255);
fsop_GetFileSizeBytes(cached_banner, &cached_bnr_size); fsop_GetFileSizeBytes(cached_banner, &cached_bnr_size);

View File

@ -121,7 +121,8 @@ void CMenu::_launchPlugin(dir_discHdr *hdr)
/* 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(hdr->settings[0]); const char *plugin_dol_name = m_plugin.GetDolName(hdr->settings[0]);
u8 plugin_dol_len = strlen(plugin_dol_name); u8 plugin_dol_len = strlen(plugin_dol_name);
/* check if music player plugin, if so set wiiflow's bckgrnd music player to play this song */
/* check if music player plugin, if so set wiiflow's bckgrnd music player to play this song or playlist */
if(plugin_dol_len == 5 && strcasecmp(plugin_dol_name, "music") == 0) if(plugin_dol_len == 5 && strcasecmp(plugin_dol_name, "music") == 0)
{ {
if(strstr(hdr->path, ".pls") == NULL && strstr(hdr->path, ".m3u") == NULL) if(strstr(hdr->path, ".pls") == NULL && strstr(hdr->path, ".m3u") == NULL)
@ -130,6 +131,7 @@ void CMenu::_launchPlugin(dir_discHdr *hdr)
MusicPlayer.InitPlaylist(m_cfg, hdr->path, currentPartition);// maybe error msg if trouble loading playlist MusicPlayer.InitPlaylist(m_cfg, hdr->path, currentPartition);// maybe error msg if trouble loading playlist
return; return;
} }
/* get title from hdr */ /* get title from hdr */
u32 title_len_no_ext = 0; u32 title_len_no_ext = 0;
const char *title = CoverFlow.getFilenameId(hdr);// with extension const char *title = CoverFlow.getFilenameId(hdr);// with extension
@ -177,6 +179,7 @@ void CMenu::_launchPlugin(dir_discHdr *hdr)
} }
} }
} }
/* launch plugin with args */ /* launch plugin with args */
gprintf("launching plugin app\n"); gprintf("launching plugin app\n");
_launchHomebrew(plugin_file, arguments); _launchHomebrew(plugin_file, arguments);

View File

@ -177,6 +177,7 @@ void CMenu::_gameinfo(void)
} }
} }
_hideGameInfo(false); _hideGameInfo(false);
TexHandle.Cleanup(m_cart);
} }
void CMenu::_hideGameInfo(bool instant) void CMenu::_hideGameInfo(bool instant)

View File

@ -139,11 +139,7 @@ const char *Plugin::GetDolName(u32 magic)
const char *Plugin::GetCoverFolderName(u32 magic) const char *Plugin::GetCoverFolderName(u32 magic)
{ {
if((Plugin_Pos = GetPluginPosition(magic)) >= 0) 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; return NULL;
} }