-removed a few things from banner code which we dont use

-added setting to wiiflow.ini to toogle banner view per
coverflow view
-moved icons down a bit in game view
This commit is contained in:
fix94.1 2012-07-04 11:56:02 +00:00
parent 8fec6f98ce
commit 365884d556
4 changed files with 57 additions and 118 deletions

View File

@ -21,6 +21,8 @@
#include "gx_addons.h" #include "gx_addons.h"
#include "gecko.h" #include "gecko.h"
BannerWindow *m_banner;
void BannerWindow::LoadBanner(Banner *banner, CVideo *vid, u8 *font1, u8 *font2) void BannerWindow::LoadBanner(Banner *banner, CVideo *vid, u8 *font1, u8 *font2)
{ {
changing = true; changing = true;
@ -38,11 +40,7 @@ void BannerWindow::LoadBanner(Banner *banner, CVideo *vid, u8 *font1, u8 *font2)
AnimPosX = 0.5f * (ScreenProps.x - fIconWidth); AnimPosX = 0.5f * (ScreenProps.x - fIconWidth);
AnimPosY = 0.5f * (ScreenProps.y - fIconHeight); AnimPosY = 0.5f * (ScreenProps.y - fIconHeight);
AnimZoomIn = false;
AnimZoomOut = false;
AnimationRunning = false; AnimationRunning = false;
BannerAlpha = 255.f;
BGAlpha = 255.f;
ChangeGame(banner); ChangeGame(banner);
gameSelected = 1; gameSelected = 1;
@ -57,7 +55,9 @@ void BannerWindow::DeleteBanner()
BannerWindow::BannerWindow() BannerWindow::BannerWindow()
{ {
FontLoaded = false;
changing = false; changing = false;
AnimZoom = false;
AnimStep = 20; AnimStep = 20;
gameSelected = 0; gameSelected = 0;
gameBanner = new AnimatedBanner; gameBanner = new AnimatedBanner;
@ -66,62 +66,39 @@ BannerWindow::BannerWindow()
void BannerWindow::ChangeGame(Banner *banner) void BannerWindow::ChangeGame(Banner *banner)
{ {
gameBanner->Clear(); gameBanner->Clear();
gameBanner->LoadFont(sysFont1, sysFont2); if(!FontLoaded)
{
gameBanner->LoadFont(sysFont1, sysFont2);
FontLoaded = true;
}
gameBanner->LoadBanner(banner); gameBanner->LoadBanner(banner);
} }
void BannerWindow::ZoomIn(void) bool BannerWindow::ToogleZoom(void)
{ {
AnimZoomIn = true; if(AnimZoom)
AnimZoomOut = false; {
if(AnimStep <= 20) AnimStep = 30;
AnimStep++; AnimZoom = false;
} }
else
void BannerWindow::PauseZoom(void) {
{ AnimStep = 20;
AnimZoomIn = false; AnimZoom = true;
AnimZoomOut = false; }
} return AnimZoom;
void BannerWindow::ZoomOut(void)
{
AnimZoomIn = false;
AnimZoomOut = true;
if(AnimStep >= MaxAnimSteps)
AnimStep--;
} }
void BannerWindow::Animate(void) void BannerWindow::Animate(void)
{ {
// animation is on going // animation is on going
if(AnimStep < MaxAnimSteps) if(AnimStep <= MaxAnimSteps)
{ {
AnimationRunning = true; AnimationRunning = true;
if(AnimZoomIn && AnimStep < MaxAnimSteps) if(AnimZoom && AnimStep < MaxAnimSteps)
AnimStep++; AnimStep++;
else if(AnimZoomOut && AnimStep > 20) else if(!AnimZoom && AnimStep > 20)
AnimStep--; AnimStep--;
/*
// zoom in animation
if(AnimZoomIn) {
BGAlpha = std::min(255.f * AnimStep * 2.f / MaxAnimSteps, 255.f);
//if(AnimStep < 0.4f * MaxAnimSteps)
//BannerAlpha = 0;
//else
//BannerAlpha = std::min(255.f * (AnimStep - 0.4f * MaxAnimSteps) / (0.6f * MaxAnimSteps), 255.f);
}
// zoom out animation
else {
BGAlpha = std::min(255.f * (MaxAnimSteps-AnimStep) * 2.f / MaxAnimSteps, 255.f);
//if((MaxAnimSteps - AnimStep) < 0.4f * MaxAnimSteps)
//BannerAlpha = 0;
//else
//BannerAlpha = std::min(255.f * ((MaxAnimSteps - AnimStep) - 0.4f * MaxAnimSteps) / (0.6f * MaxAnimSteps), 255.f);
}
*/
float curAnimStep = ((float)(MaxAnimSteps - AnimStep)/(float)MaxAnimSteps); float curAnimStep = ((float)(MaxAnimSteps - AnimStep)/(float)MaxAnimSteps);
float stepx1 = -AnimPosX; float stepx1 = -AnimPosX;
@ -134,10 +111,6 @@ void BannerWindow::Animate(void)
float left = AnimPosX + stepx1 * curAnimStep; float left = AnimPosX + stepx1 * curAnimStep;
float right = AnimPosX + fIconWidth + stepx2 * curAnimStep; float right = AnimPosX + fIconWidth + stepx2 * curAnimStep;
// set main projection of all GUI stuff if we are using the banner browser
//if(dynamic_cast<GuiBannerGrid *>(browserMenu->GetGameBrowser()) != NULL)
// guOrtho(FSProjection2D, top, bottom, left, right, 0, 10000);
float xDiff = 0.5f * (video->wide() ? (video->vid_50hz() ? 616 : 620.0f) : 608.0f); float xDiff = 0.5f * (video->wide() ? (video->vid_50hz() ? 616 : 620.0f) : 608.0f);
float yDiff = 0.5f * (video->vid_50hz() ? 448.0f : 470.0f); float yDiff = 0.5f * (video->vid_50hz() ? 448.0f : 470.0f);
@ -163,18 +136,14 @@ void BannerWindow::Animate(void)
} }
// last animation step // last animation step
else if(AnimationRunning) else if(AnimationRunning)
{
// set back original projection and stop animation/render of the browser (save some CPU ;P)
//memcpy(&video->projMtx, &originalProjection, sizeof(Mtx44));
AnimationRunning = false; AnimationRunning = false;
}
} }
void BannerWindow::Draw(void) void BannerWindow::Draw(void)
{ {
// draw a black background image first // draw a black background image first
if(AnimStep >= MaxAnimSteps) if(AnimStep >= MaxAnimSteps)
DrawRectangle(0.0f, 0.0f, video->width(), video->height(), (GXColor) {0, 0, 0, BGAlpha}, true); DrawRectangle(0.0f, 0.0f, video->width(), video->height(), (GXColor) {0, 0, 0, 255.f});
if(changing) if(changing)
return; return;
@ -182,10 +151,6 @@ void BannerWindow::Draw(void)
// Run window animation // Run window animation
Animate(); Animate();
// no banner alpha means its the start of the animation
if(BannerAlpha == 0)
return;
// cut the unneeded crap // cut the unneeded crap
Mtx mv1, mv2, mv3; Mtx mv1, mv2, mv3;
guMtxIdentity(mv2); guMtxIdentity(mv2);
@ -221,14 +186,12 @@ void BannerWindow::Draw(void)
if(gameBanner->getBanner()) if(gameBanner->getBanner())
{ {
gameBanner->getBanner()->Render(modelview, ScreenProps, video->wide(), BannerAlpha); gameBanner->getBanner()->Render(modelview, ScreenProps, video->wide(), 255.f);
gameBanner->getBanner()->AdvanceFrame(); gameBanner->getBanner()->AdvanceFrame();
} }
// Setup GX // Setup GX
ReSetup_GX(); ReSetup_GX();
//if(AnimationRunning)
GX_SetScissor(0, 0, video->width(), video->height()); GX_SetScissor(0, 0, video->width(), video->height());
// Clear and back to previous projection // Clear and back to previous projection
@ -237,7 +200,7 @@ void BannerWindow::Draw(void)
GX_InvalidateTexAll(); GX_InvalidateTexAll();
} }
void BannerWindow::DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 filled) void BannerWindow::DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color)
{ {
Mtx modelViewMtx; Mtx modelViewMtx;
guMtxIdentity(modelViewMtx); guMtxIdentity(modelViewMtx);
@ -250,26 +213,13 @@ void BannerWindow::DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor co
GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT); GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT);
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE); GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
u8 fmt;
long n;
int i; int i;
f32 x2 = x + width; f32 x2 = x + width;
f32 y2 = y + height; f32 y2 = y + height;
guVector v[] = { { x, y, 0.0f }, { x2, y, 0.0f }, { x2, y2, 0.0f }, { x, y2, 0.0f }, { x, y, 0.0f } }; guVector v[] = { { x, y, 0.0f }, { x2, y, 0.0f }, { x2, y2, 0.0f }, { x, y2, 0.0f }, { x, y, 0.0f } };
if (!filled) GX_Begin(GX_TRIANGLEFAN, GX_VTXFMT0, 4);
{ for(i = 0; i < 4; i++)
fmt = GX_LINESTRIP;
n = 5;
}
else
{
fmt = GX_TRIANGLEFAN;
n = 4;
}
GX_Begin(fmt, GX_VTXFMT0, n);
for (i = 0; i < n; i++)
{ {
GX_Position3f32(v[i].x, v[i].y, v[i].z); GX_Position3f32(v[i].x, v[i].y, v[i].z);
GX_Color4u8(color.r, color.g, color.b, color.a); GX_Color4u8(color.r, color.g, color.b, color.a);

View File

@ -34,15 +34,14 @@ class BannerWindow
void DeleteBanner(); void DeleteBanner();
void LoadBanner(Banner *banner, CVideo *vid, u8 *font1, u8 *font2); void LoadBanner(Banner *banner, CVideo *vid, u8 *font1, u8 *font2);
int GetSelectedGame() { return gameSelected; } int GetSelectedGame() { return gameSelected; }
bool GetZoomSetting() { return AnimZoom; }
void Draw(void); void Draw(void);
void ZoomIn(void); bool ToogleZoom(void);
void PauseZoom(void);
void ZoomOut(void);
protected: protected:
int MainLoop(); int MainLoop();
void Animate(void); void Animate(void);
void ChangeGame(Banner *banner); void ChangeGame(Banner *banner);
void DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 filled); void DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color);
void ReSetup_GX(void); void ReSetup_GX(void);
static const float fBannerWidth = 608.f; static const float fBannerWidth = 608.f;
@ -61,23 +60,20 @@ class BannerWindow
int AnimStep; int AnimStep;
float AnimPosX, AnimPosY; float AnimPosX, AnimPosY;
float fAnimScale; float fAnimScale;
bool AnimZoomIn; bool AnimZoom;
bool AnimZoomOut;
bool AnimationRunning; bool AnimationRunning;
bool oldAnimationRunning;
bool changing; bool changing;
u8 BGAlpha;
u8 BannerAlpha;
Mtx modelview; Mtx modelview;
Mtx44 projection; Mtx44 projection;
Mtx44 originalProjection;
Vec2f ScreenProps; Vec2f ScreenProps;
AnimatedBanner *gameBanner; AnimatedBanner *gameBanner;
u8 *sysFont1; u8 *sysFont1;
u8 *sysFont2; u8 *sysFont2;
bool FontLoaded;
}; };
extern BannerWindow *m_banner;
#endif #endif

View File

@ -112,7 +112,6 @@ extern const u8 checkboxs_png[];
SmartBuf m_wbf1_font; SmartBuf m_wbf1_font;
SmartBuf m_wbf2_font; SmartBuf m_wbf2_font;
BannerWindow m_banner;
CMenu::CMenu(CVideo &vid) : CMenu::CMenu(CVideo &vid) :
m_vid(vid) m_vid(vid)
@ -143,6 +142,7 @@ CMenu::CMenu(CVideo &vid) :
m_base_font_size = 0; m_base_font_size = 0;
m_current_view = COVERFLOW_USB; m_current_view = COVERFLOW_USB;
m_Emulator_boot = false; m_Emulator_boot = false;
m_banner = new BannerWindow;
} }
void CMenu::init(void) void CMenu::init(void)
@ -477,7 +477,7 @@ void CMenu::cleanup(bool ios_reload)
m_cf.stopCoverLoader(); m_cf.stopCoverLoader();
m_cf.clear(); m_cf.clear();
ClearGameSoundThreadStack(); ClearGameSoundThreadStack();
m_banner.DeleteBanner(); m_banner->DeleteBanner();
m_plugin.Cleanup(); m_plugin.Cleanup();
_stopSounds(); _stopSounds();
@ -1741,7 +1741,7 @@ void CMenu::_mainLoopCommon(bool withCF, bool blockReboot, bool adjusting)
m_cf.draw(); m_cf.draw();
m_vid.setup2DProjection(false, true); m_vid.setup2DProjection(false, true);
m_cf.drawEffect(); m_cf.drawEffect();
if(!m_banner.GetSelectedGame()) if(!m_banner->GetSelectedGame())
m_cf.drawText(adjusting); m_cf.drawText(adjusting);
m_vid.renderAAPass(i); m_vid.renderAAPass(i);
} }
@ -1759,14 +1759,14 @@ void CMenu::_mainLoopCommon(bool withCF, bool blockReboot, bool adjusting)
m_cf.draw(); m_cf.draw();
m_vid.setup2DProjection(); m_vid.setup2DProjection();
m_cf.drawEffect(); m_cf.drawEffect();
if(!m_banner.GetSelectedGame()) if(!m_banner->GetSelectedGame())
m_cf.drawText(adjusting); m_cf.drawText(adjusting);
} }
} }
m_fa.draw(); m_fa.draw();
if(m_banner.GetSelectedGame()) if(m_banner->GetSelectedGame())
m_banner.Draw(); m_banner->Draw();
m_btnMgr.draw(); m_btnMgr.draw();
ScanInput(); ScanInput();

View File

@ -376,7 +376,10 @@ void CMenu::_game(bool launch)
m_gameSelected = true; m_gameSelected = true;
} }
extern BannerWindow m_banner; m_zoom_banner = m_cfg.getBool(_domainFromView(), "show_full_banner", false);
if(m_banner->GetZoomSetting() != m_zoom_banner)
m_banner->ToogleZoom();
string id(m_cf.getId()); string id(m_cf.getId());
s8 startGameSound = 1; s8 startGameSound = 1;
while(true) while(true)
@ -411,7 +414,7 @@ void CMenu::_game(bool launch)
m_gameSound.FreeMemory(); m_gameSound.FreeMemory();
CheckGameSoundThread(); CheckGameSoundThread();
ClearGameSoundThreadStack(); ClearGameSoundThreadStack();
m_banner.DeleteBanner(); m_banner->DeleteBanner();
break; break;
} }
else if(BTN_PLUS_PRESSED && m_GameTDBLoaded && (m_cf.getHdr()->type == TYPE_WII_GAME || m_cf.getHdr()->type == TYPE_GC_GAME || m_cf.getHdr()->type == TYPE_CHANNEL)) else if(BTN_PLUS_PRESSED && m_GameTDBLoaded && (m_cf.getHdr()->type == TYPE_WII_GAME || m_cf.getHdr()->type == TYPE_GC_GAME || m_cf.getHdr()->type == TYPE_CHANNEL))
@ -489,18 +492,9 @@ void CMenu::_game(bool launch)
//m_gameSound.Stop(); //m_gameSound.Stop();
//CheckGameSoundThread(); //CheckGameSoundThread();
//break; //break;
if(m_zoom_banner) m_zoom_banner = m_banner->ToogleZoom();
{ m_cfg.setBool(_domainFromView(), "show_full_banner", m_zoom_banner);
m_banner.ZoomOut(); m_show_zone_game = false;
m_zoom_banner = false;
m_show_zone_game = false;
}
else
{
m_banner.ZoomIn();
m_zoom_banner = true;
m_show_zone_game = false;
}
} }
else if(m_btnMgr.selected(m_gameBtnSettings)) else if(m_btnMgr.selected(m_gameBtnSettings))
{ {
@ -1441,12 +1435,12 @@ void CMenu::_initGameMenu(CMenu::SThemeData &theme)
m_gameBtnPlay = _addButton(theme, "GAME/PLAY_BTN", theme.btnFont, L"", 420, 344, 200, 56, theme.btnFontColor); m_gameBtnPlay = _addButton(theme, "GAME/PLAY_BTN", theme.btnFont, L"", 420, 344, 200, 56, theme.btnFontColor);
m_gameBtnBack = _addButton(theme, "GAME/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor); m_gameBtnBack = _addButton(theme, "GAME/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
m_gameBtnFavoriteOn = _addPicButton(theme, "GAME/FAVORITE_ON", texFavOn, texFavOnSel, 460, 170, 48, 48); m_gameBtnFavoriteOn = _addPicButton(theme, "GAME/FAVORITE_ON", texFavOn, texFavOnSel, 460, 200, 48, 48);
m_gameBtnFavoriteOff = _addPicButton(theme, "GAME/FAVORITE_OFF", texFavOff, texFavOffSel, 460, 170, 48, 48); m_gameBtnFavoriteOff = _addPicButton(theme, "GAME/FAVORITE_OFF", texFavOff, texFavOffSel, 460, 200, 48, 48);
m_gameBtnAdultOn = _addPicButton(theme, "GAME/ADULTONLY_ON", texAdultOn, texAdultOnSel, 532, 170, 48, 48); m_gameBtnAdultOn = _addPicButton(theme, "GAME/ADULTONLY_ON", texAdultOn, texAdultOnSel, 532, 200, 48, 48);
m_gameBtnAdultOff = _addPicButton(theme, "GAME/ADULTONLY_OFF", texAdultOff, texAdultOffSel, 532, 170, 48, 48); m_gameBtnAdultOff = _addPicButton(theme, "GAME/ADULTONLY_OFF", texAdultOff, texAdultOffSel, 532, 200, 48, 48);
m_gameBtnSettings = _addPicButton(theme, "GAME/SETTINGS_BTN", texSettings, texSettingsSel, 460, 242, 48, 48); m_gameBtnSettings = _addPicButton(theme, "GAME/SETTINGS_BTN", texSettings, texSettingsSel, 460, 272, 48, 48);
m_gameBtnDelete = _addPicButton(theme, "GAME/DELETE_BTN", texDelete, texDeleteSel, 532, 242, 48, 48); m_gameBtnDelete = _addPicButton(theme, "GAME/DELETE_BTN", texDelete, texDeleteSel, 532, 272, 48, 48);
m_gameBtnPlayFull = _addButton(theme, "GAME/PLAY_FULL_BTN", theme.btnFont, L"", 100, 380, 200, 56, theme.btnFontColor); m_gameBtnPlayFull = _addButton(theme, "GAME/PLAY_FULL_BTN", theme.btnFont, L"", 100, 380, 200, 56, theme.btnFontColor);
m_gameBtnBackFull = _addButton(theme, "GAME/BACK_FULL_BTN", theme.btnFont, L"", 340, 380, 200, 56, theme.btnFontColor); m_gameBtnBackFull = _addButton(theme, "GAME/BACK_FULL_BTN", theme.btnFont, L"", 340, 380, 200, 56, theme.btnFontColor);
@ -1523,10 +1517,9 @@ void CMenu::_gameSoundThread(CMenu *m)
extern SmartBuf m_wbf1_font; extern SmartBuf m_wbf1_font;
extern SmartBuf m_wbf2_font; extern SmartBuf m_wbf2_font;
extern BannerWindow m_banner;
const u8 *soundBin = banner->GetFile((char *) "sound.bin", &sndSize); const u8 *soundBin = banner->GetFile((char *) "sound.bin", &sndSize);
m_banner.LoadBanner(banner, &m->m_vid, m_wbf1_font.get(), m_wbf2_font.get()); m_banner->LoadBanner(banner, &m->m_vid, m_wbf1_font.get(), m_wbf2_font.get());
delete banner; delete banner;
if (soundBin == NULL || (((IMD5Header *)soundBin)->fcc != 'IMD5' && ((IMD5Header *)soundBin)->fcc != 'RIFF')) if (soundBin == NULL || (((IMD5Header *)soundBin)->fcc != 'IMD5' && ((IMD5Header *)soundBin)->fcc != 'RIFF'))