- removed the ability to change the wii games directory and the gc games directory. may bring them back some day. Today it's standard for wii games to go in dev:/wbfs and gc games in dev:/games.

- also changed all toogle's to toggle, the correct spelling.
This commit is contained in:
fledge68 2016-04-02 17:19:19 +00:00
parent 1541cb0a4a
commit 9dc3eaaad1
10 changed files with 402 additions and 402 deletions

View File

@ -1,258 +1,258 @@
/****************************************************************************
* Copyright (C) 2012 Dimok
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <unistd.h>
#include "BannerWindow.hpp"
#include "gx_addons.h"
#include "gecko/gecko.hpp"
#include "loader/utils.h"
#include "menu/menu.hpp"
BannerWindow m_banner;
extern const u8 custombanner_bin[];
extern const u32 custombanner_bin_size;
void BannerWindow::Init(u8 *font1, u8 *font2)
{
MaxAnimSteps = 30;
returnVal = -1;
reducedVol = false;
ScreenProps.x = 620; //620
ScreenProps.y = 400; //400
sysFont1 = font1;
sysFont2 = font2;
ShowBanner = true;
guMtxIdentity(modelview);
guMtxTransApply(modelview, modelview, (!m_vid.wide() || m_vid.vid_50hz()) ? 0.0f : 2.0f, m_vid.vid_50hz() ? -1.0f : 0.0f, 0.0F);
AnimPosX = 0.5f * (ScreenProps.x - fIconWidth);
AnimPosY = 0.5f * (ScreenProps.y - fIconHeight);
AnimationRunning = false;
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);
yDiff = 0.5f * (m_vid.vid_50hz() ? 448.0f : 470.0f);
iconWidth = fIconWidth - 20;
iconHeight = fIconHeight - 20;
ratioX = xDiff * 2.f / iconWidth;
ratioY = yDiff * 2.f / iconHeight;
stepx1 = ((ScreenProps.x * 0.1f - xDiff) - (AnimPosX + 0.5f * fIconWidth - 0.5f * iconWidth)) * ratioX;
stepx2 = ((ScreenProps.x * 0.1f + xDiff) - (AnimPosX + 0.5f * fIconWidth + 0.5f * iconWidth)) * ratioX;
stepy1 = ((ScreenProps.y * 0.9f - yDiff) - (AnimPosY + 0.5f * fIconHeight - 0.5f * iconHeight)) * ratioY;
stepy2 = ((ScreenProps.y * 0.9f + yDiff) - (AnimPosY + 0.5f * fIconHeight + 0.5f * iconHeight)) * ratioY;
gameBanner.Clear();
if(!FontLoaded)
{
gameBanner.LoadFont(sysFont1, sysFont2);
FontLoaded = true;
}
}
void BannerWindow::LoadBanner(u8 *font1, u8 *font2)
{
changing = true;
Init(font1, font2);
gameBanner.LoadBanner();
gameSelected = 1;
changing = false;
ShowBanner = true;
}
void BannerWindow::DeleteBanner(bool gamechange)
{
if(!gamechange)
gameSelected = 0;
gameBanner.Clear();
}
BannerWindow::BannerWindow()
{
ShowBanner = true;
FontLoaded = false;
changing = false;
AnimZoom = false;
AnimStep = 20;
gameSelected = 0;
}
void BannerWindow::LoadBannerBin(u8 *bnr, u32 bnr_size, u8 *font1, u8 *font2)
{
changing = true;
Init(font1, font2);
gameBanner.LoadBannerBin(bnr, bnr_size);
gameSelected = 1;
changing = false;
ShowBanner = true;
}
void BannerWindow::CreateGCBanner(u8 *bnr, u8 *font1, u8 *font2, const wchar_t *title)
{
GC_OpeningBnr *openingBnr = (GC_OpeningBnr *)bnr;
LoadBannerBin((u8*)custombanner_bin, (u32)custombanner_bin_size, font1, font2);
gameBanner.SetBannerTexture("GCIcon.tpl", openingBnr->tpl_data, 96, 32, GX_TF_RGB5A3);
gameBanner.SetBannerText("T_GameTitle", title);
}
bool BannerWindow::ToogleZoom(void)
{
if(AnimZoom)
{
AnimStep = 30;
AnimZoom = false;
}
else
{
AnimStep = 20;
AnimZoom = true;
}
return AnimZoom;
}
void BannerWindow::Animate(void)
{
// animation is on going
if(AnimStep <= MaxAnimSteps)
{
AnimationRunning = true;
if(AnimZoom && AnimStep < MaxAnimSteps)
AnimStep++;
else if(!AnimZoom && AnimStep > 20)
AnimStep--;
float curAnimStep = ((float)(MaxAnimSteps - AnimStep)/(float)MaxAnimSteps);
//! This works good for banners
float top = (ScreenProps.y * 0.5f - yDiff) + stepy1 * curAnimStep;
float bottom = (ScreenProps.y * 0.5f + yDiff) + stepy2 * curAnimStep;
float left = (ScreenProps.x * 0.5f - xDiff) + stepx1 * curAnimStep;
float right = (ScreenProps.x * 0.5f + xDiff) + stepx2 * curAnimStep;
// set banner projection
guOrtho(projection, top, bottom, left, right, -100, 10000);
}
// last animation step
else if(AnimationRunning)
AnimationRunning = false;
}
void BannerWindow::Draw(void)
{
if(!ShowBanner)
return;
// draw a black background image first
if(AnimStep >= MaxAnimSteps)
DrawRectangle(0.0f, 0.0f, m_vid.width(), m_vid.height(), (GXColor) {0, 0, 0, 0xFF});
if(changing)
return;
// Run window animation
Animate();
// cut the unneeded crap
Mtx mv1, mv2, mv3;
guMtxIdentity(mv2);
guMtxIdentity(mv3);
guMtxScaleApply(modelview,mv1, 1.f, -1.f, 1.f);
guMtxTransApply(mv1,mv1, 0.5f * ScreenProps.x, 0.5f * ScreenProps.y, 0.f);
guMtxTransApply(mv2,mv2, -0.5f * fBannerWidth, 0.5f * fBannerHeight, 0.f);
guMtxTransApply(mv3,mv3, 0.5f * fBannerWidth, -0.5f * fBannerHeight + 104.f, 0.f);
guMtxConcat(mv1, mv2, mv2);
guMtxConcat(mv1, mv3, mv3);
f32 viewportv[6];
f32 projectionv[7];
GX_GetViewportv(viewportv, m_vid.vid_mode());
GX_GetProjectionv(projectionv, projection, GX_ORTHOGRAPHIC);
guVector vecTL;
guVector vecBR;
GX_Project(0.0f, 0.0f, 0.0f, mv2, projectionv, viewportv, &vecTL.x, &vecTL.y, &vecTL.z);
GX_Project(0.0f, 0.0f, 0.0f, mv3, projectionv, viewportv, &vecBR.x, &vecBR.y, &vecBR.z);
// round up scissor box offset and round down the size
u32 scissorX = (u32)(0.5f + std::max(vecTL.x, 0.0f));
u32 scissorY = (u32)(0.5f + std::max(vecTL.y, 0.0f));
u32 scissorW = (u32)std::max(vecBR.x - vecTL.x, 0.0f);
u32 scissorH = (u32)std::max(vecBR.y - vecTL.y, 0.0f);
GX_SetScissor(scissorX, scissorY, scissorW, scissorH);
// load projection matrix
GX_LoadProjectionMtx(projection, GX_ORTHOGRAPHIC);
if(gameBanner.getBanner())
{
gameBanner.getBanner()->Render(modelview, ScreenProps, m_vid.wide(), 255.f);
gameBanner.getBanner()->AdvanceFrame();
}
// Setup GX
ReSetup_GX();
GX_SetScissor(0, 0, m_vid.width(), m_vid.height());
// Clear and back to previous projection
m_vid.setup2DProjection();
// If wanted
if(Brightness == 200)
DrawRectangle(0.0f, 0.0f, m_vid.width(), m_vid.height(), (GXColor) {0, 0, 0, Brightness});
}
void BannerWindow::ToogleGameSettings()
{
ToogleZoom();
Brightness = (Brightness == 200 ? 0 : 200);
}
void BannerWindow::ReSetup_GX(void)
{
// channel control
GX_SetNumChans(1);
GX_SetChanCtrl(GX_COLOR0A0,GX_DISABLE,GX_SRC_REG,GX_SRC_VTX,GX_LIGHTNULL,GX_DF_NONE,GX_AF_NONE);
// texture gen.
GX_SetNumTexGens(1);
GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
// texture environment
GX_SetNumTevStages(1);
GX_SetNumIndStages(0);
for(u8 i = 0; i < m_vid.getAA(); i++)
{
GX_SetTevOp(i, GX_MODULATE);
GX_SetTevOrder(i, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
GX_SetTevSwapMode(i, GX_TEV_SWAP0, GX_TEV_SWAP0);
GX_SetTevKColorSel(i, GX_TEV_KCSEL_1_4);
GX_SetTevKAlphaSel(i, GX_TEV_KASEL_1);
GX_SetTevDirect(i);
}
// swap table
GX_SetTevSwapModeTable(GX_TEV_SWAP0, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA);
GX_SetTevSwapModeTable(GX_TEV_SWAP1, GX_CH_RED, GX_CH_RED, GX_CH_RED, GX_CH_ALPHA);
GX_SetTevSwapModeTable(GX_TEV_SWAP2, GX_CH_GREEN, GX_CH_GREEN, GX_CH_GREEN, GX_CH_ALPHA);
GX_SetTevSwapModeTable(GX_TEV_SWAP3, GX_CH_BLUE, GX_CH_BLUE, GX_CH_BLUE, GX_CH_ALPHA);
// alpha compare and blend mode
GX_SetAlphaCompare(GX_ALWAYS, 0, GX_AOP_AND, GX_ALWAYS, 0);
GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_SET);
}
/****************************************************************************
* Copyright (C) 2012 Dimok
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <unistd.h>
#include "BannerWindow.hpp"
#include "gx_addons.h"
#include "gecko/gecko.hpp"
#include "loader/utils.h"
#include "menu/menu.hpp"
BannerWindow m_banner;
extern const u8 custombanner_bin[];
extern const u32 custombanner_bin_size;
void BannerWindow::Init(u8 *font1, u8 *font2)
{
MaxAnimSteps = 30;
returnVal = -1;
reducedVol = false;
ScreenProps.x = 620; //620
ScreenProps.y = 400; //400
sysFont1 = font1;
sysFont2 = font2;
ShowBanner = true;
guMtxIdentity(modelview);
guMtxTransApply(modelview, modelview, (!m_vid.wide() || m_vid.vid_50hz()) ? 0.0f : 2.0f, m_vid.vid_50hz() ? -1.0f : 0.0f, 0.0F);
AnimPosX = 0.5f * (ScreenProps.x - fIconWidth);
AnimPosY = 0.5f * (ScreenProps.y - fIconHeight);
AnimationRunning = false;
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);
yDiff = 0.5f * (m_vid.vid_50hz() ? 448.0f : 470.0f);
iconWidth = fIconWidth - 20;
iconHeight = fIconHeight - 20;
ratioX = xDiff * 2.f / iconWidth;
ratioY = yDiff * 2.f / iconHeight;
stepx1 = ((ScreenProps.x * 0.1f - xDiff) - (AnimPosX + 0.5f * fIconWidth - 0.5f * iconWidth)) * ratioX;
stepx2 = ((ScreenProps.x * 0.1f + xDiff) - (AnimPosX + 0.5f * fIconWidth + 0.5f * iconWidth)) * ratioX;
stepy1 = ((ScreenProps.y * 0.9f - yDiff) - (AnimPosY + 0.5f * fIconHeight - 0.5f * iconHeight)) * ratioY;
stepy2 = ((ScreenProps.y * 0.9f + yDiff) - (AnimPosY + 0.5f * fIconHeight + 0.5f * iconHeight)) * ratioY;
gameBanner.Clear();
if(!FontLoaded)
{
gameBanner.LoadFont(sysFont1, sysFont2);
FontLoaded = true;
}
}
void BannerWindow::LoadBanner(u8 *font1, u8 *font2)
{
changing = true;
Init(font1, font2);
gameBanner.LoadBanner();
gameSelected = 1;
changing = false;
ShowBanner = true;
}
void BannerWindow::DeleteBanner(bool gamechange)
{
if(!gamechange)
gameSelected = 0;
gameBanner.Clear();
}
BannerWindow::BannerWindow()
{
ShowBanner = true;
FontLoaded = false;
changing = false;
AnimZoom = false;
AnimStep = 20;
gameSelected = 0;
}
void BannerWindow::LoadBannerBin(u8 *bnr, u32 bnr_size, u8 *font1, u8 *font2)
{
changing = true;
Init(font1, font2);
gameBanner.LoadBannerBin(bnr, bnr_size);
gameSelected = 1;
changing = false;
ShowBanner = true;
}
void BannerWindow::CreateGCBanner(u8 *bnr, u8 *font1, u8 *font2, const wchar_t *title)
{
GC_OpeningBnr *openingBnr = (GC_OpeningBnr *)bnr;
LoadBannerBin((u8*)custombanner_bin, (u32)custombanner_bin_size, font1, font2);
gameBanner.SetBannerTexture("GCIcon.tpl", openingBnr->tpl_data, 96, 32, GX_TF_RGB5A3);
gameBanner.SetBannerText("T_GameTitle", title);
}
bool BannerWindow::ToggleZoom(void)
{
if(AnimZoom)
{
AnimStep = 30;
AnimZoom = false;
}
else
{
AnimStep = 20;
AnimZoom = true;
}
return AnimZoom;
}
void BannerWindow::Animate(void)
{
// animation is on going
if(AnimStep <= MaxAnimSteps)
{
AnimationRunning = true;
if(AnimZoom && AnimStep < MaxAnimSteps)
AnimStep++;
else if(!AnimZoom && AnimStep > 20)
AnimStep--;
float curAnimStep = ((float)(MaxAnimSteps - AnimStep)/(float)MaxAnimSteps);
//! This works good for banners
float top = (ScreenProps.y * 0.5f - yDiff) + stepy1 * curAnimStep;
float bottom = (ScreenProps.y * 0.5f + yDiff) + stepy2 * curAnimStep;
float left = (ScreenProps.x * 0.5f - xDiff) + stepx1 * curAnimStep;
float right = (ScreenProps.x * 0.5f + xDiff) + stepx2 * curAnimStep;
// set banner projection
guOrtho(projection, top, bottom, left, right, -100, 10000);
}
// last animation step
else if(AnimationRunning)
AnimationRunning = false;
}
void BannerWindow::Draw(void)
{
if(!ShowBanner)
return;
// draw a black background image first
if(AnimStep >= MaxAnimSteps)
DrawRectangle(0.0f, 0.0f, m_vid.width(), m_vid.height(), (GXColor) {0, 0, 0, 0xFF});
if(changing)
return;
// Run window animation
Animate();
// cut the unneeded crap
Mtx mv1, mv2, mv3;
guMtxIdentity(mv2);
guMtxIdentity(mv3);
guMtxScaleApply(modelview,mv1, 1.f, -1.f, 1.f);
guMtxTransApply(mv1,mv1, 0.5f * ScreenProps.x, 0.5f * ScreenProps.y, 0.f);
guMtxTransApply(mv2,mv2, -0.5f * fBannerWidth, 0.5f * fBannerHeight, 0.f);
guMtxTransApply(mv3,mv3, 0.5f * fBannerWidth, -0.5f * fBannerHeight + 104.f, 0.f);
guMtxConcat(mv1, mv2, mv2);
guMtxConcat(mv1, mv3, mv3);
f32 viewportv[6];
f32 projectionv[7];
GX_GetViewportv(viewportv, m_vid.vid_mode());
GX_GetProjectionv(projectionv, projection, GX_ORTHOGRAPHIC);
guVector vecTL;
guVector vecBR;
GX_Project(0.0f, 0.0f, 0.0f, mv2, projectionv, viewportv, &vecTL.x, &vecTL.y, &vecTL.z);
GX_Project(0.0f, 0.0f, 0.0f, mv3, projectionv, viewportv, &vecBR.x, &vecBR.y, &vecBR.z);
// round up scissor box offset and round down the size
u32 scissorX = (u32)(0.5f + std::max(vecTL.x, 0.0f));
u32 scissorY = (u32)(0.5f + std::max(vecTL.y, 0.0f));
u32 scissorW = (u32)std::max(vecBR.x - vecTL.x, 0.0f);
u32 scissorH = (u32)std::max(vecBR.y - vecTL.y, 0.0f);
GX_SetScissor(scissorX, scissorY, scissorW, scissorH);
// load projection matrix
GX_LoadProjectionMtx(projection, GX_ORTHOGRAPHIC);
if(gameBanner.getBanner())
{
gameBanner.getBanner()->Render(modelview, ScreenProps, m_vid.wide(), 255.f);
gameBanner.getBanner()->AdvanceFrame();
}
// Setup GX
ReSetup_GX();
GX_SetScissor(0, 0, m_vid.width(), m_vid.height());
// Clear and back to previous projection
m_vid.setup2DProjection();
// If wanted
if(Brightness == 200)
DrawRectangle(0.0f, 0.0f, m_vid.width(), m_vid.height(), (GXColor) {0, 0, 0, Brightness});
}
void BannerWindow::ToggleGameSettings()
{
ToggleZoom();
Brightness = (Brightness == 200 ? 0 : 200);
}
void BannerWindow::ReSetup_GX(void)
{
// channel control
GX_SetNumChans(1);
GX_SetChanCtrl(GX_COLOR0A0,GX_DISABLE,GX_SRC_REG,GX_SRC_VTX,GX_LIGHTNULL,GX_DF_NONE,GX_AF_NONE);
// texture gen.
GX_SetNumTexGens(1);
GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
// texture environment
GX_SetNumTevStages(1);
GX_SetNumIndStages(0);
for(u8 i = 0; i < m_vid.getAA(); i++)
{
GX_SetTevOp(i, GX_MODULATE);
GX_SetTevOrder(i, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
GX_SetTevSwapMode(i, GX_TEV_SWAP0, GX_TEV_SWAP0);
GX_SetTevKColorSel(i, GX_TEV_KCSEL_1_4);
GX_SetTevKAlphaSel(i, GX_TEV_KASEL_1);
GX_SetTevDirect(i);
}
// swap table
GX_SetTevSwapModeTable(GX_TEV_SWAP0, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA);
GX_SetTevSwapModeTable(GX_TEV_SWAP1, GX_CH_RED, GX_CH_RED, GX_CH_RED, GX_CH_ALPHA);
GX_SetTevSwapModeTable(GX_TEV_SWAP2, GX_CH_GREEN, GX_CH_GREEN, GX_CH_GREEN, GX_CH_ALPHA);
GX_SetTevSwapModeTable(GX_TEV_SWAP3, GX_CH_BLUE, GX_CH_BLUE, GX_CH_BLUE, GX_CH_ALPHA);
// alpha compare and blend mode
GX_SetAlphaCompare(GX_ALWAYS, 0, GX_AOP_AND, GX_ALWAYS, 0);
GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_SET);
}

View File

@ -1,103 +1,103 @@
/****************************************************************************
* Copyright (C) 2012 Dimok
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#ifndef BANNERWINDOW_HPP_
#define BANNERWINDOW_HPP_
#include <gccore.h>
#include "AnimatedBanner.h"
#include "channel/banner.h"
#include "gui/video.hpp"
#include "loader/disc.h"
#include "music/gui_sound.h"
#define FAVORITE_STARS 5
typedef struct _GC_OpeningBnr
{
u32 magic; // BNR1 or BNR2
u8 pad[0x1C];
u8 tpl_data[0x1800]; // 96x32 pixel format GX_TF_RGB5A3
struct
{
u8 disc_title[0x20]; // Gamename
u8 developer_short[0x20]; // Company/Developer
u8 full_title[0x40]; // Full Game Title
u8 developer[0x40]; // Company/Developer Full name, or description
u8 long_description[0x80]; // Game Description
} description[6]; // 6 only on BNR2 => English, German, French, Spanish, Italian, Dutch ??
} GC_OpeningBnr;
class BannerWindow
{
public:
BannerWindow();
void DeleteBanner(bool gamechange = false);
void LoadBanner(u8 *font1, u8 *font2);
void LoadBannerBin(u8 *bnr, u32 bnr_size, u8 *font1, u8 *font2);
int GetSelectedGame() { return gameSelected; }
bool GetZoomSetting() { return AnimZoom; }
bool GetInGameSettings() { return (Brightness == 200 ? true : false); }
void CreateGCBanner(u8 *bnr, u8 *font1, u8 *font2, const wchar_t *title);
void Draw(void);
bool ToogleZoom(void);
void ToogleGameSettings();
bool GetShowBanner() { return ShowBanner; }
void SetShowBanner(bool show) { ShowBanner = show; }
void ReSetup_GX(void);
protected:
int MainLoop();
void Animate(void);
void ChangeGame(Banner *banner);
void Init(u8 *font1, u8 *font2);
static const float fBannerWidth = 608.f;
static const float fBannerHeight = 448.f;
static const float fIconWidth = 128.f;
static const float fIconHeight = 96.f;
bool reducedVol;
int returnVal;
int gameSelected;
u8 Brightness;
int MaxAnimSteps;
int AnimStep;
float AnimPosX, AnimPosY;
float fAnimScale;
bool AnimZoom;
bool AnimationRunning;
bool changing;
bool ShowBanner;
float xDiff, yDiff;
float iconWidth, iconHeight;
float stepx1, stepx2, stepy1, stepy2;
f32 ratioX, ratioY;
Mtx modelview;
Mtx44 projection;
Vec2f ScreenProps;
u8 *sysFont1;
u8 *sysFont2;
bool FontLoaded;
};
extern BannerWindow m_banner;
#endif
/****************************************************************************
* Copyright (C) 2012 Dimok
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#ifndef BANNERWINDOW_HPP_
#define BANNERWINDOW_HPP_
#include <gccore.h>
#include "AnimatedBanner.h"
#include "channel/banner.h"
#include "gui/video.hpp"
#include "loader/disc.h"
#include "music/gui_sound.h"
#define FAVORITE_STARS 5
typedef struct _GC_OpeningBnr
{
u32 magic; // BNR1 or BNR2
u8 pad[0x1C];
u8 tpl_data[0x1800]; // 96x32 pixel format GX_TF_RGB5A3
struct
{
u8 disc_title[0x20]; // Gamename
u8 developer_short[0x20]; // Company/Developer
u8 full_title[0x40]; // Full Game Title
u8 developer[0x40]; // Company/Developer Full name, or description
u8 long_description[0x80]; // Game Description
} description[6]; // 6 only on BNR2 => English, German, French, Spanish, Italian, Dutch ??
} GC_OpeningBnr;
class BannerWindow
{
public:
BannerWindow();
void DeleteBanner(bool gamechange = false);
void LoadBanner(u8 *font1, u8 *font2);
void LoadBannerBin(u8 *bnr, u32 bnr_size, u8 *font1, u8 *font2);
int GetSelectedGame() { return gameSelected; }
bool GetZoomSetting() { return AnimZoom; }
bool GetInGameSettings() { return (Brightness == 200 ? true : false); }
void CreateGCBanner(u8 *bnr, u8 *font1, u8 *font2, const wchar_t *title);
void Draw(void);
bool ToggleZoom(void);
void ToggleGameSettings();
bool GetShowBanner() { return ShowBanner; }
void SetShowBanner(bool show) { ShowBanner = show; }
void ReSetup_GX(void);
protected:
int MainLoop();
void Animate(void);
void ChangeGame(Banner *banner);
void Init(u8 *font1, u8 *font2);
static const float fBannerWidth = 608.f;
static const float fBannerHeight = 448.f;
static const float fIconWidth = 128.f;
static const float fIconHeight = 96.f;
bool reducedVol;
int returnVal;
int gameSelected;
u8 Brightness;
int MaxAnimSteps;
int AnimStep;
float AnimPosX, AnimPosY;
float fAnimScale;
bool AnimZoom;
bool AnimationRunning;
bool changing;
bool ShowBanner;
float xDiff, yDiff;
float iconWidth, iconHeight;
float stepx1, stepx2, stepy1, stepy2;
f32 ratioX, ratioY;
Mtx modelview;
Mtx44 projection;
Vec2f ScreenProps;
u8 *sysFont1;
u8 *sysFont2;
bool FontLoaded;
};
extern BannerWindow m_banner;
#endif

View File

@ -7,7 +7,7 @@
#define STDEMU_DIR "/wiiflow/nandemu"
#define GAMES_DIR "%s:/wbfs"
#define HOMEBREW_DIR "%s:/apps"
#define DML_DIR "%s:/games"
#define GC_GAMES_DIR "%s:/games"
#define CFG_FILENAME "wiiflow_lite.ini"
#define LANG_FILENAME "languages.ini"
#define CAT_FILENAME "categories_lite.ini"

View File

@ -296,7 +296,7 @@ s32 GCDump::DumpGame()
memset(gamepath, 0, MAX_FAT_PATH);
char basedir[MAX_FAT_PATH];
memset(basedir, 0, MAX_FAT_PATH);
strncpy(basedir, fmt((strncmp(gamepartition, "sd", 2) != 0) ? usb_dml_game_dir : DML_DIR, gamepartition), MAX_FAT_PATH);
strncpy(basedir, fmt(GC_GAMES_DIR, gamepartition), MAX_FAT_PATH);
while(!gamedone)
{

View File

@ -69,7 +69,7 @@ struct FST
class GCDump
{
public:
void Init(bool skip, bool comp, bool wexf, bool align, u32 nretry, u32 rsize, const char* partition, const char* m_DMLgameDir)
void Init(bool skip, bool comp, bool wexf, bool align, u32 nretry, u32 rsize, const char* partition)
{
skiponerror = skip;
compressed = comp;
@ -78,7 +78,7 @@ public:
gc_nbrretry = nretry;
gc_readsize = rsize;
gamepartition = partition;
usb_dml_game_dir = m_DMLgameDir;
//gc_games_dir = m_gc_gamesDir;
gc_skipped = 0;
waitonerror = true;
}
@ -95,7 +95,7 @@ private:
bool gamedone;
bool multigamedisc;
const char *gamepartition;
const char *usb_dml_game_dir;
//const char *gc_games_dir;
char minfo[74];
u8 Disc;
u8 Disc2;

View File

@ -254,7 +254,6 @@ void CMenu::init()
MIOSisDML();
if(m_show_dml == false)
m_show_dml = (m_mios_ver > 0);
m_DMLgameDir = fmt("%%s:/%s", m_cfg.getString(GC_DOMAIN, "dir_usb_games", "games").c_str());
/* Emu NAND */
m_cfg.getString(CHANNEL_DOMAIN, "path", "");
m_cfg.getInt(CHANNEL_DOMAIN, "partition", 1);
@ -2257,7 +2256,7 @@ bool CMenu::_loadDmlList()
return false;
m_gameList.clear();
string gameDir(fmt(currentPartition == SD ? DML_DIR : m_DMLgameDir.c_str(), DeviceName[currentPartition]));
string gameDir(fmt(GC_GAMES_DIR, DeviceName[currentPartition]));
string cacheDir(fmt("%s/%s_gamecube.db", m_listCacheDir.c_str(), DeviceName[currentPartition]));
bool updateCache = m_cfg.getBool(GC_DOMAIN, "update_cache");
m_gameList.CreateList(COVERFLOW_GAMECUBE, currentPartition, gameDir,

View File

@ -124,7 +124,6 @@ private:
string m_screenshotDir;
string m_settingsDir;
string m_languagesDir;
string m_DMLgameDir;
string m_helpDir;
/* Explorer stuff */

View File

@ -43,8 +43,8 @@ extern const u32 gc_ogg_size;
bool m_zoom_banner = false;
s16 m_gameBtnPlayFull;
s16 m_gameBtnBackFull;
s16 m_gameBtnToogle;
s16 m_gameBtnToogleFull;
s16 m_gameBtnToggle;
s16 m_gameBtnToggleFull;
const CMenu::SOption CMenu::_languages[11] = {
{ "lngdef", L"Default" },
@ -304,8 +304,8 @@ void CMenu::_hideGame(bool instant)
m_btnMgr.hide(m_gameBtnBackFull, instant);
m_btnMgr.hide(m_gameBtnDelete, instant);
m_btnMgr.hide(m_gameBtnSettings, instant);
m_btnMgr.hide(m_gameBtnToogle, instant);
m_btnMgr.hide(m_gameBtnToogleFull, instant);
m_btnMgr.hide(m_gameBtnToggle, instant);
m_btnMgr.hide(m_gameBtnToggleFull, instant);
m_btnMgr.hide(m_gameBtnFavoriteOn, instant);
m_btnMgr.hide(m_gameBtnFavoriteOff, instant);
@ -342,13 +342,13 @@ void CMenu::_showGame(void)
}
m_btnMgr.show(m_gameBtnPlay);
m_btnMgr.show(m_gameBtnBack);
m_btnMgr.show(m_gameBtnToogle);
m_btnMgr.show(m_gameBtnToggle);
}
else
{
m_btnMgr.show(m_gameBtnPlayFull);
m_btnMgr.show(m_gameBtnBackFull);
m_btnMgr.show(m_gameBtnToogleFull);
m_btnMgr.show(m_gameBtnToggleFull);
}
}
@ -453,7 +453,7 @@ void CMenu::_game(bool launch)
}
currentMoviePos = (m_zoom_banner ? zoomedMoviePos : normalMoviePos);
if(m_banner.GetZoomSetting() != m_zoom_banner)
m_banner.ToogleZoom();
m_banner.ToggleZoom();
if(!launch)
{
@ -559,25 +559,25 @@ void CMenu::_game(bool launch)
_cleanupBanner();
break;
}
else if((m_btnMgr.selected(m_gameBtnToogle) || m_btnMgr.selected(m_gameBtnToogleFull))
else if((m_btnMgr.selected(m_gameBtnToggle) || m_btnMgr.selected(m_gameBtnToggleFull))
&& (!NoGameID(CoverFlow.getHdr()->type) || m_video_playing))
{
m_zoom_banner = m_banner.ToogleZoom();
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_gameBtnToogleFull);
m_btnMgr.hide(m_gameBtnToggleFull);
}
else if(m_btnMgr.selected(m_gameBtnSettings) && (CoverFlow.getHdr()->type == TYPE_WII_GAME || CoverFlow.getHdr()->type == TYPE_GC_GAME || CoverFlow.getHdr()->type == TYPE_CHANNEL))
{
_hideGame();
m_gameSelected = true;
m_banner.ToogleGameSettings();
m_banner.ToggleGameSettings();
_gameSettings();
m_banner.ToogleGameSettings();
m_banner.ToggleGameSettings();
_showGame();
if(!m_gameSound.IsPlaying())
@ -700,12 +700,12 @@ void CMenu::_game(bool launch)
m_btnMgr.show(m_gameBtnPlay);
m_btnMgr.show(m_gameBtnBack);
if(!m_fa.isLoaded())
m_btnMgr.show(m_gameBtnToogle);
m_btnMgr.show(m_gameBtnToggle);
else
m_btnMgr.hide(m_gameBtnToogle);
m_btnMgr.hide(m_gameBtnToggle);
m_btnMgr.hide(m_gameBtnPlayFull);
m_btnMgr.hide(m_gameBtnBackFull);
m_btnMgr.hide(m_gameBtnToogleFull);
m_btnMgr.hide(m_gameBtnToggleFull);
if(m_gameLblUser[4] != -1 && !NoGameID(CoverFlow.getHdr()->type) && !m_fa.isLoaded())
m_btnMgr.show(m_gameLblUser[4]);
else
@ -732,7 +732,7 @@ void CMenu::_game(bool launch)
{
m_btnMgr.show(m_gameBtnPlayFull);
m_btnMgr.show(m_gameBtnBackFull);
m_btnMgr.show(m_gameBtnToogleFull);
m_btnMgr.show(m_gameBtnToggleFull);
}
m_btnMgr.hide(m_gameBtnFavoriteOn);
m_btnMgr.hide(m_gameBtnFavoriteOff);
@ -742,7 +742,7 @@ void CMenu::_game(bool launch)
m_btnMgr.hide(m_gameBtnDelete);
m_btnMgr.hide(m_gameBtnPlay);
m_btnMgr.hide(m_gameBtnBack);
m_btnMgr.hide(m_gameBtnToogle);
m_btnMgr.hide(m_gameBtnToggle);
if(m_gameLblUser[4] != -1)
{
if(!NoGameID(CoverFlow.getHdr()->type) && !m_zoom_banner && !m_fa.isLoaded())
@ -1002,7 +1002,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
{
bool foundOnSD = false;
ListGenerator SD_List;
string gameDir(fmt(DML_DIR, DeviceName[SD]));
string gameDir(fmt(GC_GAMES_DIR, DeviceName[SD]));
string cacheDir(fmt("%s/%s_gamecube.db", m_listCacheDir.c_str(), DeviceName[SD]));
SD_List.CreateList(COVERFLOW_GAMECUBE, SD, gameDir,
stringToVector(".iso|root", '|'), cacheDir, false);
@ -1030,7 +1030,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
u32 Place = GC_Path.find_last_of("/");
GC_Path = hdr->path;
memset(hdr->path, 0, sizeof(hdr->path));
snprintf(folder, sizeof(folder), DML_DIR, DeviceName[SD]);
snprintf(folder, sizeof(folder), GC_GAMES_DIR, DeviceName[SD]);
snprintf(hdr->path, sizeof(hdr->path), "%s/%s", folder, &GC_Path[Place]+1);
}
else
@ -1675,8 +1675,8 @@ void CMenu::_initGameMenu()
m_gameBtnDelete = _addPicButton("GAME/DELETE_BTN", texDelete, texDeleteSel, 532, 272, 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_gameBtnToogle = _addPicButton("GAME/TOOGLE_BTN", texToggleBanner, texToggleBanner, 385, 31, 236, 127);
m_gameBtnToogleFull = _addPicButton("GAME/TOOGLE_FULL_BTN", texToggleBanner, texToggleBanner, 20, 12, 608, 344);
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_gameButtonsZone.x = m_theme.getInt("GAME/ZONES", "buttons_x", 0);
m_gameButtonsZone.y = m_theme.getInt("GAME/ZONES", "buttons_y", 0);
@ -1694,8 +1694,8 @@ void CMenu::_initGameMenu()
_setHideAnim(m_gameBtnDelete, "GAME/DELETE_BTN", 0, 0, 1.f, -1.f);
_setHideAnim(m_gameBtnPlayFull, "GAME/PLAY_FULL_BTN", 0, 0, 1.f, 0.f);
_setHideAnim(m_gameBtnBackFull, "GAME/BACK_FULL_BTN", 0, 0, 1.f, 0.f);
_setHideAnim(m_gameBtnToogle, "GAME/TOOGLE_BTN", 200, 0, 1.f, 0.f);
_setHideAnim(m_gameBtnToogleFull, "GAME/TOOGLE_FULL_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);
_hideGame(true);
_textGame();
}
@ -1860,7 +1860,7 @@ void CMenu::_playGameSound(void)
return;
if(m_zoom_banner == true)
{
m_zoom_banner = m_banner.ToogleZoom();
m_zoom_banner = m_banner.ToggleZoom();
m_cfg.setBool(_domainFromView(), "show_full_banner", m_zoom_banner);
currentMoviePos = normalMoviePos;
}

View File

@ -171,7 +171,7 @@ void CMenu::_Paths(void)
}
else if (BTN_A_PRESSED && paths_curPage == 2)
{
if (m_btnMgr.selected(m_pathsBtn1))
/*if (m_btnMgr.selected(m_pathsBtn1))
{
_hidePaths();
currentPartition = m_cfg.getInt(WII_DOMAIN, "partition", USB1);
@ -202,9 +202,10 @@ void CMenu::_Paths(void)
{
_hidePaths();
currentPartition = m_cfg.getInt(GC_DOMAIN, "partition", USB1);
string gameDir(fmt(currentPartition == SD ? DML_DIR : m_DMLgameDir.c_str(), DeviceName[currentPartition]));
string gameDir(fmt(m_usb_gc_gamesDir.c_str(), DeviceName[currentPartition]));
path = _FolderExplorer(gameDir.c_str());
if(strlen(path) > 0)
//can only change usb1 folder name.
if(strlen(path) > 0 && (strncmp(path, "usb1:/", 6) == 0))
{
if(strncmp(path, "sd:/", 4) == 0)
m_cfg.setInt(GC_DOMAIN, "partition", 0);
@ -216,14 +217,15 @@ void CMenu::_Paths(void)
char tmpPath[MAX_FAT_PATH];
strncpy(tmpPath, strchr(path, '/')+1, MAX_FAT_PATH-1);
m_cfg.setString(GC_DOMAIN, "dir_usb_games", tmpPath);
m_DMLgameDir = fmt("%%s:/%s", m_cfg.getString(GC_DOMAIN, "dir_usb_games", "games").c_str());
m_usb_gc_gamesDir = fmt("%%s:/%s", tmpPath);
//m_usb_gc_gamesDir = fmt("%%s:/%s", m_cfg.getString(GC_DOMAIN, "dir_usb_games", "games").c_str());
m_cfg.setBool(GC_DOMAIN, "update_cache", true);
if(m_cfg.getBool(GC_DOMAIN, "source"))
m_load_view = true;
}
_showPaths();
}
else if (m_btnMgr.selected(m_pathsBtn3))
}*/
if (m_btnMgr.selected(m_pathsBtn3))
{
_hidePaths();
path = _FolderExplorer(m_cfg.getString("GENERAL", "dir_music").c_str());

View File

@ -170,7 +170,7 @@ int CMenu::_GCgameInstaller()
if(skip)
rsize = 8192; // Use small chunks when skip on error is enabled
m_gcdump.Init(skip, comp, wexf, alig, nretry, rsize, DeviceName[currentPartition], m_DMLgameDir.c_str());
m_gcdump.Init(skip, comp, wexf, alig, nretry, rsize, DeviceName[currentPartition]);
int ret;
m_progress = 0.f;
@ -235,7 +235,7 @@ int CMenu::_GCcopyGame(void *obj)
source[299] = '\0';
char folder[50];
strncpy(folder, fmt(DML_DIR, DeviceName[SD]), sizeof(folder));
strncpy(folder, fmt(GC_GAMES_DIR, DeviceName[SD]), sizeof(folder));
folder[49] = '\0';
char target[300];
@ -396,7 +396,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
{
strncpy(GC_Path, CF_Hdr->path, 1023);
*strrchr(GC_Path, '/') = '\0'; //iso path
const char *cmp = fmt(currentPartition == SD ? DML_DIR : m_DMLgameDir.c_str(), DeviceName[currentPartition]);
const char *cmp = fmt(GC_GAMES_DIR, DeviceName[currentPartition]);
if(strcasecmp(GC_Path, cmp) == 0)
fsop_deleteFile(CF_Hdr->path);
else