-some cleanup stuff

-added alpha channel handling to covers up to 640x480
(homebrew icons should look fine now)
This commit is contained in:
fix94.1 2012-11-11 18:28:03 +00:00
parent ce84e11259
commit b2fdc18998
29 changed files with 547 additions and 428 deletions

View File

@ -226,34 +226,6 @@ void BannerWindow::ToogleGameSettings()
Brightness = (Brightness > 1.f ? 0.f : 200.f);
}
void BannerWindow::DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color)
{
Mtx modelViewMtx;
guMtxIdentity(modelViewMtx);
GX_LoadPosMtxImm(modelViewMtx, GX_PNMTX0);
GX_SetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
GX_ClearVtxDesc();
GX_InvVtxCache();
GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT);
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
int i;
f32 x2 = x + width;
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 } };
GX_Begin(GX_TRIANGLEFAN, GX_VTXFMT0, 4);
for(i = 0; i < 4; i++)
{
GX_Position3f32(v[i].x, v[i].y, v[i].z);
GX_Color4u8(color.r, color.g, color.b, color.a);
}
GX_End();
GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
}
void BannerWindow::ReSetup_GX(void)
{
// channel control

View File

@ -44,60 +44,59 @@ typedef struct _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 > 1.f ? 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 DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color);
void Init(u8 *font1, u8 *font2);
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 > 1.f ? 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;
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;
dir_discHdr dvdheader;
float Brightness;
int MaxAnimSteps;
bool reducedVol;
int returnVal;
int gameSelected;
dir_discHdr dvdheader;
float Brightness;
int MaxAnimSteps;
int AnimStep;
float AnimPosX, AnimPosY;
float fAnimScale;
bool AnimZoom;
bool AnimationRunning;
bool changing;
bool ShowBanner;
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;
float xDiff, yDiff;
float iconWidth, iconHeight;
float stepx1, stepx2, stepy1, stepy2;
f32 ratioX, ratioY;
Mtx modelview;
Mtx44 projection;
Vec2f ScreenProps;
Mtx modelview;
Mtx44 projection;
Vec2f ScreenProps;
u8 *sysFont1;
u8 *sysFont2;
bool FontLoaded;
u8 *sysFont1;
u8 *sysFont2;
bool FontLoaded;
};
extern BannerWindow m_banner;

View File

@ -333,7 +333,7 @@ void WiiMovie::LoadNextFrame()
}
STexture frame;
if(frame.fromTHP(VideoF.getData(), VideoF.getWidth(), VideoF.getHeight()) == STexture::TE_OK)
if(frame.fromTHP(VideoF.getData(), VideoF.getWidth(), VideoF.getHeight()) == TE_OK)
Frames.push_back(frame);
VideoF.dealloc();
}

View File

@ -59,6 +59,8 @@ static inline int loopNum(int i, int s)
return i < 0 ? (s - (-i % s)) % s : i % s;
}
CCoverFlow CoverFlow;
CCoverFlow::CCover::CCover(void)
{
index = 0;
@ -189,6 +191,8 @@ CCoverFlow::CCoverFlow(void)
m_dvdskin_loaded = false;
m_loadingCovers = false;
m_coverThrdBusy = false;
m_renderTex = false;
m_renderingTex = NULL;
m_moved = false;
m_selected = false;
m_hideCover = false;
@ -760,7 +764,7 @@ void CCoverFlow::_effectBg(const STexture &tex)
GX_End();
}
void CCoverFlow::_effectBlur(CVideo &vid, bool vertical)
void CCoverFlow::_effectBlur(bool vertical)
{
int kSize = m_blurRadius * 2 + 1;
GXTexObj texObj;
@ -892,7 +896,7 @@ void CCoverFlow::_effectBlur(CVideo &vid, bool vertical)
GX_Position3f32(x, y + h, 0.f);
GX_TexCoord2f32(0.f, 1.f);
GX_End();
vid.renderToTexture(m_effectTex, true);
m_vid.renderToTexture(m_effectTex, true);
}
bool CCoverFlow::_effectVisible(void)
@ -903,34 +907,34 @@ bool CCoverFlow::_effectVisible(void)
|| lo.shadowColorEnd.a > 0 || lo.shadowColorOff.a > 0;
}
void CCoverFlow::makeEffectTexture(CVideo &vid, const STexture &bg)
void CCoverFlow::makeEffectTexture(const STexture &bg)
{
if (!_effectVisible()) return;
int aa = 8;
GX_SetDither(GX_DISABLE);
vid.setAA(aa, true, m_effectTex.width, m_effectTex.height);
m_vid.setAA(aa, true, m_effectTex.width, m_effectTex.height);
for (int i = 0; i < aa; ++i)
{
vid.prepareAAPass(i);
vid.setup2DProjection(false, true);
m_vid.prepareAAPass(i);
m_vid.setup2DProjection(false, true);
_effectBg(bg);
if (m_mirrorBlur)
_draw(CCoverFlow::CFDR_NORMAL, true, false);
vid.shiftViewPort(m_shadowX, m_shadowY);
m_vid.shiftViewPort(m_shadowX, m_shadowY);
_draw(CCoverFlow::CFDR_SHADOW, false, true);
vid.renderAAPass(i);
m_vid.renderAAPass(i);
}
GX_SetPixelFmt(GX_PF_RGBA6_Z24, GX_ZC_LINEAR);
GX_InvVtxCache();
GX_InvalidateTexAll();
vid.setup2DProjection(false, true);
m_vid.setup2DProjection(false, true);
GX_SetViewport(0.f, 0.f, (float)m_effectTex.width, (float)m_effectTex.height, 0.f, 1.f);
GX_SetScissor(0, 0, m_effectTex.width, m_effectTex.height);
vid.drawAAScene();
vid.renderToTexture(m_effectTex, true);
_effectBlur(vid, false);
_effectBlur(vid, true);
m_vid.drawAAScene();
m_vid.renderToTexture(m_effectTex, true);
_effectBlur(false);
_effectBlur(true);
GX_SetDither(GX_ENABLE);
}
@ -1532,6 +1536,24 @@ u64 CCoverFlow::getChanTitle(void) const
m_items[loopNum(m_covers[m_range / 2].index + m_jump, m_items.size())].hdr->settings[1]);
}
bool CCoverFlow::getRenderTex(void)
{
return m_renderTex;
}
void CCoverFlow::setRenderTex(bool val)
{
m_renderTex = val;
}
void CCoverFlow::RenderTex(void)
{
if(m_renderingTex == NULL || m_renderingTex->data == NULL)
return;
DrawTexture(m_renderingTex);
m_vid.renderToTexture(*m_renderingTex, true);
setRenderTex(false);
}
bool CCoverFlow::select(void)
{
@ -1837,34 +1859,46 @@ bool CCoverFlow::start(const char *id)
// Load resident textures
if(!m_dvdskin_loaded)
{
if(m_dvdSkin.fromJPG(dvdskin_jpg, dvdskin_jpg_size) != STexture::TE_OK)
if(m_dvdSkin.fromJPG(dvdskin_jpg, dvdskin_jpg_size) != TE_OK)
return false;
if(m_dvdSkin_Red.fromJPG(dvdskin_red_jpg, dvdskin_red_jpg_size) != STexture::TE_OK)
if(m_dvdSkin_Red.fromJPG(dvdskin_red_jpg, dvdskin_red_jpg_size) != TE_OK)
return false;
if(m_dvdSkin_Black.fromJPG(dvdskin_black_jpg, dvdskin_black_jpg_size) != STexture::TE_OK)
if(m_dvdSkin_Black.fromJPG(dvdskin_black_jpg, dvdskin_black_jpg_size) != TE_OK)
return false;
if(m_dvdSkin_Yellow.fromJPG(dvdskin_yellow_jpg, dvdskin_yellow_jpg_size) != STexture::TE_OK)
if(m_dvdSkin_Yellow.fromJPG(dvdskin_yellow_jpg, dvdskin_yellow_jpg_size) != TE_OK)
return false;
if(m_dvdSkin_GreenOne.fromJPG(dvdskin_greenone_jpg, dvdskin_greenone_jpg_size) != STexture::TE_OK)
if(m_dvdSkin_GreenOne.fromJPG(dvdskin_greenone_jpg, dvdskin_greenone_jpg_size) != TE_OK)
return false;
if(m_dvdSkin_GreenTwo.fromJPG(dvdskin_greentwo_jpg, dvdskin_greentwo_jpg_size) != STexture::TE_OK)
if(m_dvdSkin_GreenTwo.fromJPG(dvdskin_greentwo_jpg, dvdskin_greentwo_jpg_size) != TE_OK)
return false;
m_dvdskin_loaded = true;
}
if(m_box)
{
if (m_pngLoadCover.empty() || STexture::TE_OK != m_loadingTexture.fromImageFile(m_pngLoadCover.c_str(), GX_TF_CMPR, 32, 512))
if (STexture::TE_OK != m_loadingTexture.fromPNG(loading_png, GX_TF_CMPR, 32, 512)) return false;
if (m_pngNoCover.empty() || STexture::TE_OK != m_noCoverTexture.fromImageFile(m_pngNoCover.c_str(), GX_TF_CMPR, 32, 512))
if (STexture::TE_OK != m_noCoverTexture.fromPNG(nopic_png, GX_TF_CMPR, 32, 512)) return false;
if(m_pngLoadCover.empty() || m_loadingTexture.fromImageFile(m_pngLoadCover.c_str(), GX_TF_CMPR, 32, 512) != TE_OK)
{
if(m_loadingTexture.fromPNG(loading_png, GX_TF_CMPR, 32, 512) != TE_OK)
return false;
}
if(m_pngNoCover.empty() || m_noCoverTexture.fromImageFile(m_pngNoCover.c_str(), GX_TF_CMPR, 32, 512) != TE_OK)
{
if(m_noCoverTexture.fromPNG(nopic_png, GX_TF_CMPR, 32, 512) != TE_OK)
return false;
}
}
else
{
if (m_pngLoadCoverFlat.empty() || STexture::TE_OK != m_loadingTexture.fromImageFile(m_pngLoadCoverFlat.c_str(), GX_TF_CMPR, 32, 512))
if (STexture::TE_OK != m_loadingTexture.fromJPG(flatloading_jpg, flatloading_jpg_size, GX_TF_CMPR, 32, 512)) return false;
if (m_pngNoCoverFlat.empty() || STexture::TE_OK != m_noCoverTexture.fromImageFile(m_pngNoCoverFlat.c_str(), GX_TF_CMPR, 32, 512))
if (STexture::TE_OK != m_noCoverTexture.fromPNG(flatnopic_png, GX_TF_CMPR, 32, 512)) return false;
if(m_pngLoadCoverFlat.empty() || m_loadingTexture.fromImageFile(m_pngLoadCoverFlat.c_str(), GX_TF_CMPR, 32, 512) != TE_OK)
{
if(m_loadingTexture.fromJPG(flatloading_jpg, flatloading_jpg_size, GX_TF_CMPR, 32, 512) != TE_OK)
return false;
}
if(m_pngNoCoverFlat.empty() || m_noCoverTexture.fromImageFile(m_pngNoCoverFlat.c_str(), GX_TF_CMPR, 32, 512) != TE_OK)
{
if(m_noCoverTexture.fromPNG(flatnopic_png, GX_TF_CMPR, 32, 512) != TE_OK)
return false;
}
}
m_covers.clear();
m_covers.resize(m_range);
@ -2003,7 +2037,7 @@ u32 CCoverFlow::_currentPos(void) const
return m_covers[m_range / 2].index;
}
void CCoverFlow::mouse(CVideo &vid, int chan, int x, int y)
void CCoverFlow::mouse(int chan, int x, int y)
{
if (m_covers.empty()) return;
@ -2012,10 +2046,10 @@ void CCoverFlow::mouse(CVideo &vid, int chan, int x, int y)
m_mouse[chan] = -1;
else
{
vid.prepareStencil();
m_vid.prepareStencil();
_draw(CCoverFlow::CFDR_STENCIL, false, false);
vid.renderStencil();
m_mouse[chan] = vid.stencilVal(x, y) - 1;
m_vid.renderStencil();
m_mouse[chan] = m_vid.stencilVal(x, y) - 1;
}
if (m != m_mouse[chan])
{
@ -2025,17 +2059,17 @@ void CCoverFlow::mouse(CVideo &vid, int chan, int x, int y)
}
}
bool CCoverFlow::mouseOver(CVideo &vid, int x, int y)
bool CCoverFlow::mouseOver(int x, int y)
{
if (m_covers.empty()) return false;
vid.prepareStencil();
m_vid.prepareStencil();
_draw(CCoverFlow::CFDR_STENCIL, false, false);
vid.renderStencil();
vid.prepareStencil();
m_vid.renderStencil();
m_vid.prepareStencil();
_draw(CCoverFlow::CFDR_STENCIL, false, false);
vid.renderStencil();
return vid.stencilVal(x, y) == (int)m_range / 2 + 1;
m_vid.renderStencil();
return m_vid.stencilVal(x, y) == (int)m_range / 2 + 1;
}
bool CCoverFlow::findId(const char *id, bool instant)
@ -2519,20 +2553,21 @@ public:
bool CCoverFlow::preCacheCover(const char *id, const u8 *png, bool full)
{
if (m_cachePath.empty()) return false;
if(m_cachePath.empty())
return false;
STexture tex;
u8 textureFmt = m_compressTextures ? GX_TF_CMPR : GX_TF_RGB565;
if (STexture::TE_OK != tex.fromPNG(png, textureFmt, 32)) return false;
if(tex.fromPNG(png, textureFmt, 32) != TE_OK)
return false;
u32 bufSize = fixGX_GetTexBufferSize(tex.width, tex.height, tex.format, tex.maxLOD > 0 ? GX_TRUE : GX_FALSE, tex.maxLOD);
uLongf zBufferSize = m_compressCache ? bufSize + bufSize / 100 + 12 : bufSize;
u8 *zBuffer = m_compressCache ? (u8*)MEM2_alloc(zBufferSize) : tex.data;
if (!!zBuffer && (!m_compressCache || compress(zBuffer, &zBufferSize, tex.data, bufSize) == Z_OK))
if(zBuffer != NULL && (!m_compressCache || compress(zBuffer, &zBufferSize, tex.data, bufSize) == Z_OK))
{
FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), id), "wb");
if (file != 0)
if(file != NULL)
{
SWFCHeader header(tex, full, m_compressCache);
fwrite(&header, 1, sizeof header, file);
@ -2549,7 +2584,7 @@ bool CCoverFlow::fullCoverCached(const char *id)
bool found = false;
FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), id), "rb");
if (file != 0)
if(file != NULL)
{
SWFCHeader header;
found = fread(&header, 1, sizeof header, file) == sizeof header
@ -2566,12 +2601,19 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
if (!m_loadingCovers) return false;
u8 textureFmt = m_compressTextures ? GX_TF_CMPR : GX_TF_RGB565;
const char *path = box ? (blankBoxCover ? m_items[i].blankBoxPicPath.c_str() :
m_items[i].boxPicPath.c_str()) : m_items[i].picPath.c_str();
STexture tex;
const char *path = box ? (blankBoxCover ? m_items[i].blankBoxPicPath.c_str() : m_items[i].boxPicPath.c_str()) : m_items[i].picPath.c_str();
if (STexture::TE_OK != tex.fromImageFile(path, textureFmt, 32)) return false;
if (!m_loadingCovers) return false;
tex.thread = true;
m_renderingTex = &tex;
if(tex.fromImageFile(path, textureFmt, 32) != TE_OK)
{
m_renderingTex = NULL;
return false;
}
m_renderingTex = NULL;
if(!m_loadingCovers)
return false;
LWP_MutexLock(m_mutex);
m_items[i].texture.Cleanup();
@ -2605,7 +2647,7 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
else
strncpy(gamePath, m_items[i].hdr->id, sizeof(gamePath));
FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), gamePath), "wb");
if (file != 0)
if(file != NULL)
{
SWFCHeader header(tex, box, m_compressCache);
fwrite(&header, 1, sizeof header, file);

View File

@ -71,14 +71,14 @@ public:
void flip(bool force = false, bool f = true);
void cancel(void);
bool selected(void) const { return m_selected; }
void makeEffectTexture(CVideo &vid, const STexture &bg);
void makeEffectTexture(const STexture &bg);
void drawText(bool withRectangle = false);
void draw(void);
void drawEffect(void);
void hideCover(void);
void showCover(void);
void mouse(CVideo &vid, int chan, int x, int y);
bool mouseOver(CVideo &vid, int x, int y);
void mouse(int chan, int x, int y);
bool mouseOver(int x, int y);
// Accessors for settings
void setCompression(bool enable) { m_compressTextures = enable; }
bool getBoxMode(void) const { return m_box;}
@ -131,6 +131,10 @@ public:
dir_discHdr * getNextHdr(void) const;
wstringEx getTitle(void) const;
u64 getChanTitle(void) const;
//
bool getRenderTex(void);
void setRenderTex(bool);
void RenderTex(void);
private:
enum DrawMode { CFDR_NORMAL, CFDR_STENCIL, CFDR_SHADOW };
struct SLayout
@ -238,6 +242,10 @@ private:
volatile bool m_loadingCovers;
volatile bool m_coverThrdBusy;
volatile bool m_moved;
//
volatile bool m_renderTex;
STexture *m_renderingTex;
//
volatile int m_hqCover;
bool m_selected;
int m_tickCount;
@ -299,7 +307,7 @@ private:
void _draw(DrawMode dm = CFDR_NORMAL, bool mirror = false, bool blend = true);
u32 _currentPos(void) const;
void _effectBg(const STexture &tex);
void _effectBlur(CVideo &vid, bool vertical);
void _effectBlur(bool vertical);
bool _effectVisible(void);
void _drawMirrorZ(void);
void _drawTitle(int i, bool mirror, bool rectangle);
@ -349,4 +357,6 @@ private:
CCoverFlow &operator=(const CCoverFlow &);
};
extern CCoverFlow CoverFlow;
#endif // !defined(__COVERFLOW_HPP)

View File

@ -29,16 +29,16 @@ bool CCursor::init(const char *png, bool wideFix, CColor shadowColor, float shad
m_wideFix = wideFix;
m_x = -1;
m_y = -1;
if (STexture::TE_OK != m_texture.fromImageFile(png))
if(m_texture.fromImageFile(png) != TE_OK)
{
if (chan == 0)
ok = STexture::TE_OK == m_texture.fromPNG(player1_point_png);
else if (chan == 1)
ok = STexture::TE_OK == m_texture.fromPNG(player2_point_png);
else if (chan == 2)
ok = STexture::TE_OK == m_texture.fromPNG(player3_point_png);
else if (chan == 3)
ok = STexture::TE_OK == m_texture.fromPNG(player4_point_png);
if(chan == 0)
ok = (m_texture.fromPNG(player1_point_png) == TE_OK);
else if(chan == 1)
ok = (m_texture.fromPNG(player2_point_png) == TE_OK);
else if(chan == 2)
ok = (m_texture.fromPNG(player3_point_png) == TE_OK);
else if(chan == 3)
ok = (m_texture.fromPNG(player4_point_png) == TE_OK);
}
if (ok && shadow)
{

View File

@ -50,15 +50,14 @@ bool CFanart::load(Config &m_globalConfig, const char *path, const char *id)
strncpy(dir, fmt("%s/%s", path, id), 63);
STexture fanBg, fanBgLq;
STexture::TexErr texErr = fanBg.fromImageFile(fmt("%s/background.png", dir));
if(texErr == STexture::TE_ERROR)
TexErr texErr = fanBg.fromImageFile(fmt("%s/background.png", dir));
if(texErr == TE_ERROR)
{
memset(dir,0, 64);
strncpy(dir, fmt("%s/%.3s", path, id), 63);
texErr = fanBg.fromImageFile(fmt("%s/background.png", dir));
}
if (texErr == STexture::TE_OK)
if(texErr == TE_OK)
{
char cfg_char[64];
memset(cfg_char,0, 64);
@ -195,7 +194,7 @@ void CFanart::draw(bool front)
CFanartElement::CFanartElement(Config &cfg, const char *dir, int artwork)
: m_artwork(artwork), m_isValid(false)
{
m_isValid = m_art.fromImageFile(fmt("%s/artwork%d.png", dir, artwork)) == STexture::TE_OK;
m_isValid = (m_art.fromImageFile(fmt("%s/artwork%d.png", dir, artwork)) == TE_OK);
if (!m_isValid) return;
const char *section = fmt("artwork%d", artwork);

View File

@ -10,7 +10,7 @@ template <class T> static inline T loopNum(T i, T s)
STexture CButtonsMgr::_noTexture;
bool CButtonsMgr::init(CVideo &vid)
bool CButtonsMgr::init()
{
m_elts.clear();
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
@ -23,7 +23,6 @@ bool CButtonsMgr::init(CVideo &vid)
m_noclick = false;
m_nohover = false;
m_mouse = false;
m_vid = vid;
soundInit();
return true;

View File

@ -26,7 +26,7 @@ struct SButtonTextureSet
class CButtonsMgr
{
public:
bool init(CVideo &vid);
bool init();
void setRumble(bool enabled) { m_rumbleEnabled = enabled; }
void reserve(u32 capacity) { m_elts.reserve(capacity); }
s16 addButton(SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color,
@ -149,7 +149,6 @@ private:
bool m_noclick;
bool m_nohover;
bool m_mouse;
CVideo m_vid;
private:
void _drawBtn(SButton &b, bool selected, bool click);
void _drawLbl(SLabel &b);

View File

@ -1,10 +1,13 @@
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <ogcsys.h>
#include <malloc.h>
#include <cmath>
#include "memory/mem2.hpp"
#include "texture.hpp"
#include "coverflow.hpp"
#include "memory/mem2.hpp"
#include "pngu.h"
#include "gcvid.h"
@ -59,6 +62,21 @@ static inline void _convertToFlippedRGBA(u8 *dst, const u8 *src, u32 width, u32
}
}
static inline void _convertToRGBA(u8 *dst, const u8 *src, u32 width, u32 height)
{
for (u32 y = 0; y < height; ++y)
{
for (u32 x = 0; x < width; ++x)
{
u32 i = (x + y * width) * 4;
dst[i] = src[coordsRGBA8(x, y, width) + 1];
dst[i + 1] = src[coordsRGBA8(x, y, width) + 32];
dst[i + 2] = src[coordsRGBA8(x, y, width) + 33];
dst[i + 3] = src[coordsRGBA8(x, y, width)];
}
}
}
static inline void _convertToRGBA8(u8 *dst, const u8 *src, u32 width, u32 height)
{
for (u32 y = 0; y < height; ++y)
@ -213,7 +231,7 @@ bool STexture::CopyTexture(const STexture &tex)
return true;
}
STexture::TexErr STexture::fromImageFile(const char *filename, u8 f, u32 minMipSize, u32 maxMipSize)
TexErr STexture::fromImageFile(const char *filename, u8 f, u32 minMipSize, u32 maxMipSize)
{
Cleanup();
FILE *file = fopen(filename, "rb");
@ -250,7 +268,7 @@ STexture::TexErr STexture::fromImageFile(const char *filename, u8 f, u32 minMipS
return result;
}
STexture::TexErr STexture::fromTHP(const u8 *src, u32 w, u32 h)
TexErr STexture::fromTHP(const u8 *src, u32 w, u32 h)
{
width = w;
height = h;
@ -288,7 +306,7 @@ STexture::TexErr STexture::fromTHP(const u8 *src, u32 w, u32 h)
return TE_OK;
}
STexture::TexErr STexture::fromJPG(const u8 *buffer, const u32 buffer_size, u8 f, u32 minMipSize, u32 maxMipSize)
TexErr STexture::fromJPG(const u8 *buffer, const u32 buffer_size, u8 f, u32 minMipSize, u32 maxMipSize)
{
Cleanup();
@ -413,7 +431,7 @@ STexture::TexErr STexture::fromJPG(const u8 *buffer, const u32 buffer_size, u8 f
return TE_OK;
}
STexture::TexErr STexture::fromPNG(const u8 *buffer, u8 f, u32 minMipSize, u32 maxMipSize)
TexErr STexture::fromPNG(const u8 *buffer, u8 f, u32 minMipSize, u32 maxMipSize)
{
Cleanup();
u8 maxLODTmp = 0;
@ -467,7 +485,24 @@ STexture::TexErr STexture::fromPNG(const u8 *buffer, u8 f, u32 minMipSize, u32 m
memset(tmpData2, 0, Size2);
PNGU_DecodeToRGBA8(ctx, imgProp.imgWidth, imgProp.imgHeight, tmpData2, 0, 0xFF);
PNGU_ReleaseImageContext(ctx);
if((imgProp.imgColorType == PNGU_COLOR_TYPE_GRAY_ALPHA
|| imgProp.imgColorType == PNGU_COLOR_TYPE_RGB_ALPHA)
&& imgProp.imgWidth <= 640 && imgProp.imgHeight <= 480 && thread)
{
format = GX_TF_RGBA8;
width = imgProp.imgWidth;
height = imgProp.imgHeight;
dataSize = GX_GetTexBufferSize(width, height, format, GX_FALSE, 0);
data = (u8*)MEM2_alloc(dataSize);
_convertToRGBA8(data, tmpData2, width, height);
DCFlushRange(data, dataSize);
CoverFlow.setRenderTex(true);
while(CoverFlow.getRenderTex())
usleep(50);
_convertToRGBA(tmpData2, data, width, height);
DCFlushRange(tmpData2, Size2);
Cleanup();
}
tmpData2 = _genMipMaps(tmpData2, imgProp.imgWidth, imgProp.imgHeight, maxLODTmp, baseWidth, baseHeight);
if(tmpData2 == NULL)
{

View File

@ -4,10 +4,17 @@
#include <gccore.h>
enum TexErr
{
TE_OK = 0,
TE_ERROR,
TE_NOMEM
};
class STexture
{
public:
STexture(void) : data(NULL), dataSize(0), width(0), height(0), format(-1), maxLOD(0) { }
STexture(void) : data(NULL), dataSize(0), width(0), height(0), format(-1), maxLOD(0), thread(false) { }
void Cleanup();
bool CopyTexture(const STexture &tex);
u8 *data;
@ -16,8 +23,7 @@ public:
u32 height;
u8 format;
u8 maxLOD;
// Utility funcs
enum TexErr { TE_OK, TE_ERROR, TE_NOMEM };
bool thread;
// Get from PNG, if not found from JPG
TexErr fromImageFile(const char *filename, u8 f = -1, u32 minMipSize = 0, u32 maxMipSize = 0);
// This function doesn't use MEM2 if the PNG is loaded from memory and there's no mip mapping

View File

@ -236,9 +236,9 @@ void CVideo::renderToTexture(STexture &tex, bool clear)
{
tex.dataSize = GX_GetTexBufferSize(tex.width, tex.height, tex.format, GX_FALSE, 0);
tex.data = (u8*)MEM2_alloc(tex.dataSize);
if(tex.data == NULL)
return;
}
if(tex.data == NULL)
return;
GX_DrawDone();
GX_SetCopyFilter(GX_FALSE, NULL, GX_FALSE, NULL);
GX_SetTexCopySrc(0, 0, tex.width, tex.height);
@ -542,6 +542,7 @@ void CVideo::_showWaitMessages(CVideo *m)
if(waitItr + 1 == m->m_waitMessages.end() || waitItr == m->m_waitMessages.begin())
PNGfadeDirection *= (-1);
waitFrames = frames;
m->render();
}
else
VIDEO_WaitVSync();
@ -643,7 +644,6 @@ void CVideo::waitMessage(const STexture &tex)
GX_Position3f32((float)((640 - tex.width) / 2), (float)((480 + tex.height) / 2), 0.f);
GX_TexCoord2f32(0.f, 1.f);
GX_End();
render();
}
s32 CVideo::TakeScreenshot(const char *path)
@ -653,3 +653,74 @@ s32 CVideo::TakeScreenshot(const char *path)
PNGU_ReleaseImageContext (ctx);
return ret;
}
void DrawTexture(const STexture *tex)
{
if(tex == NULL)
return;
Mtx modelViewMtx;
GXTexObj texObj;
GX_SetNumChans(1);
GX_ClearVtxDesc();
GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XY, GX_F32, 0);
GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT);
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
GX_SetNumTexGens(1);
GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR);
GX_SetAlphaUpdate(GX_TRUE);
GX_SetCullMode(GX_CULL_NONE);
GX_SetZMode(GX_DISABLE, GX_LEQUAL, GX_TRUE);
guMtxIdentity(modelViewMtx);
GX_LoadPosMtxImm(modelViewMtx, GX_PNMTX0);
GX_InitTexObj(&texObj, tex->data, tex->width, tex->height, tex->format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_LoadTexObj(&texObj, GX_TEXMAP0);
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
GX_Position2f32(0.f, 0.f);
GX_Color4u8(0xFF, 0xFF, 0xFF, 0xFF);
GX_TexCoord2f32(0.f, 0.f);
GX_Position2f32(tex->width, 0.f);
GX_Color4u8(0xFF, 0xFF, 0xFF, 0xFF);
GX_TexCoord2f32(1.f, 0.f);
GX_Position2f32(tex->width, tex->height);
GX_Color4u8(0xFF, 0xFF, 0xFF, 0xFF);
GX_TexCoord2f32(1.f, 1.f);
GX_Position2f32(0.f, tex->height);
GX_Color4u8(0xFF, 0xFF, 0xFF, 0xFF);
GX_TexCoord2f32(0.f, 1.f);
GX_End();
}
void DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color)
{
Mtx modelViewMtx;
guMtxIdentity(modelViewMtx);
GX_LoadPosMtxImm(modelViewMtx, GX_PNMTX0);
GX_SetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
GX_ClearVtxDesc();
GX_InvVtxCache();
GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT);
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
int i;
f32 x2 = x + width;
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 } };
GX_Begin(GX_TRIANGLEFAN, GX_VTXFMT0, 4);
for(i = 0; i < 4; i++)
{
GX_Position3f32(v[i].x, v[i].y, v[i].z);
GX_Color4u8(color.r, color.g, color.b, color.a);
}
GX_End();
GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
}

View File

@ -119,5 +119,8 @@ private:
CVideo(const CVideo &);
};
void DrawTexture(const STexture *tex);
void DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color);
extern CVideo m_vid;
#endif //!defined(__VIDEO_HPP)

View File

@ -340,7 +340,7 @@ void CMenu::init()
}
}
}
m_cf.init(m_base_font, m_base_font_size, m_vid.vid_50hz());
CoverFlow.init(m_base_font, m_base_font_size, m_vid.vid_50hz());
//Make important folders first.
fsop_MakeFolder((char *)m_dataDir.c_str()); //D'OH!
@ -434,7 +434,7 @@ void CMenu::init()
WPAD_SetVRes(chan, m_vid.width() + m_cursor[chan].width(), m_vid.height() + m_cursor[chan].height());
}
m_btnMgr.init(m_vid);
m_btnMgr.init();
MusicPlayer.Init(m_cfg, m_musicDir, sfmt("%s/music", m_themeDataDir.c_str()));
m_music_info = m_cfg.getBool("GENERAL", "display_music_info", true);
@ -452,7 +452,7 @@ void CMenu::init()
LWP_MutexInit(&m_mutex, 0);
m_cf.setSoundVolume(m_cfg.getInt("GENERAL", "sound_volume_coverflow", 255));
CoverFlow.setSoundVolume(m_cfg.getInt("GENERAL", "sound_volume_coverflow", 255));
m_btnMgr.setSoundVolume(m_cfg.getInt("GENERAL", "sound_volume_gui", 255));
m_bnrSndVol = m_cfg.getInt("GENERAL", "sound_volume_bnr", 255);
m_bnr_settings = m_cfg.getBool("GENERAL", "banner_in_settings", true);
@ -502,7 +502,7 @@ void CMenu::cleanup()
soundDeinit();
m_vid.cleanup();
m_cf.shutdown();
CoverFlow.shutdown();
wiiLightOff();
_deinitNetwork();
@ -652,10 +652,10 @@ void CMenu::_loadCFCfg()
const char *domain = "_COVERFLOW";
//gprintf("Preparing to load sounds from %s\n", m_themeDataDir.c_str());
m_cf.setCachePath(m_cacheDir.c_str(), !m_cfg.getBool("GENERAL", "keep_png", true), m_cfg.getBool("GENERAL", "compress_cache", false));
m_cf.setBufferSize(m_cfg.getInt("GENERAL", "cover_buffer", 20));
CoverFlow.setCachePath(m_cacheDir.c_str(), !m_cfg.getBool("GENERAL", "keep_png", true), m_cfg.getBool("GENERAL", "compress_cache", false));
CoverFlow.setBufferSize(m_cfg.getInt("GENERAL", "cover_buffer", 20));
// Coverflow Sounds
m_cf.setSounds(
CoverFlow.setSounds(
new GuiSound(fmt("%s/%s", m_themeDataDir.c_str(), m_theme.getString(domain, "sound_flip").c_str())),
_sound(theme.soundSet, domain, "sound_hover", hover_wav, hover_wav_size, "default_btn_hover", false),
_sound(theme.soundSet, domain, "sound_select", click_wav, click_wav_size, "default_btn_click", false),
@ -666,9 +666,9 @@ void CMenu::_loadCFCfg()
string texNoCover = sfmt("%s/%s", m_themeDataDir.c_str(), m_theme.getString(domain, "missing_cover_box").c_str());
string texLoadingFlat = sfmt("%s/%s", m_themeDataDir.c_str(), m_theme.getString(domain, "loading_cover_flat").c_str());
string texNoCoverFlat = sfmt("%s/%s", m_themeDataDir.c_str(), m_theme.getString(domain, "missing_cover_flat").c_str());
m_cf.setTextures(texLoading, texLoadingFlat, texNoCover, texNoCoverFlat);
CoverFlow.setTextures(texLoading, texLoadingFlat, texNoCover, texNoCoverFlat);
// Font
m_cf.setFont(_font(theme.fontSet, domain, "font", TITLEFONT), m_theme.getColor(domain, "font_color", CColor(0xFFFFFFFF)));
CoverFlow.setFont(_font(theme.fontSet, domain, "font", TITLEFONT), m_theme.getColor(domain, "font_color", CColor(0xFFFFFFFF)));
// Coverflow Count
m_numCFVersions = min(max(2, m_theme.getInt("_COVERFLOW", "number_of_modes", 2)), 15);
}
@ -735,31 +735,31 @@ void CMenu::_loadCFLayout(int version, bool forceAA, bool otherScrnFmt)
int max_fsaa = m_theme.getInt(domain, "max_fsaa", 3);
_setAA(forceAA ? max_fsaa : min(max_fsaa, m_cfg.getInt("GENERAL", "max_fsaa", 3)));
m_cf.setTextureQuality(m_theme.getFloat(domain, "tex_lod_bias", -3.f),
CoverFlow.setTextureQuality(m_theme.getFloat(domain, "tex_lod_bias", -3.f),
m_theme.getInt(domain, "tex_aniso", 2),
m_theme.getBool(domain, "tex_edge_lod", true));
m_cf.setRange(_getCFInt(domain, "rows", (smallbox && homebrew) ? 5 : 1, sf), _getCFInt(domain, "columns", 9, sf));
CoverFlow.setRange(_getCFInt(domain, "rows", (smallbox && homebrew) ? 5 : 1, sf), _getCFInt(domain, "columns", 9, sf));
m_cf.setCameraPos(false,
CoverFlow.setCameraPos(false,
_getCFV3D(domain, "camera_pos", Vector3D(0.f, 1.5f, 5.f), sf),
_getCFV3D(domain, "camera_aim", Vector3D(0.f, 0.f, -1.f), sf));
m_cf.setCameraPos(true,
CoverFlow.setCameraPos(true,
_getCFV3D(domainSel, "camera_pos", Vector3D(0.f, 1.5f, 5.f), sf),
_getCFV3D(domainSel, "camera_aim", Vector3D(0.f, 0.f, -1.f), sf));
m_cf.setCameraOsc(false,
CoverFlow.setCameraOsc(false,
_getCFV3D(domain, "camera_osc_speed", Vector3D(2.f, 1.1f, 1.3f), sf),
_getCFV3D(domain, "camera_osc_amp", Vector3D(0.1f, 0.2f, 0.1f), sf));
m_cf.setCameraOsc(true,
CoverFlow.setCameraOsc(true,
_getCFV3D(domainSel, "camera_osc_speed", Vector3D(), sf),
_getCFV3D(domainSel, "camera_osc_amp", Vector3D(), sf));
float def_cvr_posX = (smallbox && homebrew) ? 1.f : 1.6f;
float def_cvr_posY = (smallbox && homebrew) ? -0.6f : 0.f;
m_cf.setCoverPos(false,
CoverFlow.setCoverPos(false,
_getCFV3D(domain, "left_pos", Vector3D(-def_cvr_posX, def_cvr_posY, 0.f), sf),
_getCFV3D(domain, "right_pos", Vector3D(def_cvr_posX, def_cvr_posY, 0.f), sf),
_getCFV3D(domain, "center_pos", Vector3D(0.f, def_cvr_posY, 1.f), sf),
@ -767,47 +767,47 @@ void CMenu::_loadCFLayout(int version, bool forceAA, bool otherScrnFmt)
def_cvr_posX = (smallbox && homebrew) ? 1.f : 4.6f;
float def_cvr_posX1 = (smallbox && homebrew) ? 0.f : -0.6f;
m_cf.setCoverPos(true,
CoverFlow.setCoverPos(true,
_getCFV3D(domainSel, "left_pos", Vector3D(-def_cvr_posX, def_cvr_posY, 0.f), sf),
_getCFV3D(domainSel, "right_pos", Vector3D(def_cvr_posX, def_cvr_posY, 0.f), sf),
_getCFV3D(domainSel, "center_pos", Vector3D(def_cvr_posX1, 0.f, 2.6f), sf),
_getCFV3D(domainSel, "row_center_pos", Vector3D(0.f, def_cvr_posY, 0.f), sf));
m_cf.setCoverAngleOsc(false,
CoverFlow.setCoverAngleOsc(false,
m_theme.getVector3D(domain, "cover_osc_speed", Vector3D(2.f, 2.f, 0.f)),
m_theme.getVector3D(domain, "cover_osc_amp", Vector3D(5.f, 10.f, 0.f)));
m_cf.setCoverAngleOsc(true,
CoverFlow.setCoverAngleOsc(true,
m_theme.getVector3D(domainSel, "cover_osc_speed", Vector3D(2.1f, 2.1f, 0.f)),
m_theme.getVector3D(domainSel, "cover_osc_amp", Vector3D(2.f, 5.f, 0.f)));
m_cf.setCoverPosOsc(false,
CoverFlow.setCoverPosOsc(false,
m_theme.getVector3D(domain, "cover_pos_osc_speed"),
m_theme.getVector3D(domain, "cover_pos_osc_amp"));
m_cf.setCoverPosOsc(true,
CoverFlow.setCoverPosOsc(true,
m_theme.getVector3D(domainSel, "cover_pos_osc_speed"),
m_theme.getVector3D(domainSel, "cover_pos_osc_amp"));
float spacerX = (smallbox && homebrew) ? 1.f : 0.35f;
m_cf.setSpacers(false,
CoverFlow.setSpacers(false,
m_theme.getVector3D(domain, "left_spacer", Vector3D(-spacerX, 0.f, 0.f)),
m_theme.getVector3D(domain, "right_spacer", Vector3D(spacerX, 0.f, 0.f)));
m_cf.setSpacers(true,
CoverFlow.setSpacers(true,
m_theme.getVector3D(domainSel, "left_spacer", Vector3D(-spacerX, 0.f, 0.f)),
m_theme.getVector3D(domainSel, "right_spacer", Vector3D(spacerX, 0.f, 0.f)));
m_cf.setDeltaAngles(false,
CoverFlow.setDeltaAngles(false,
m_theme.getVector3D(domain, "left_delta_angle"),
m_theme.getVector3D(domain, "right_delta_angle"));
m_cf.setDeltaAngles(true,
CoverFlow.setDeltaAngles(true,
m_theme.getVector3D(domainSel, "left_delta_angle"),
m_theme.getVector3D(domainSel, "right_delta_angle"));
float angleY = (smallbox && homebrew) ? 0.f : 70.f;
m_cf.setAngles(false,
CoverFlow.setAngles(false,
m_theme.getVector3D(domain, "left_angle", Vector3D(0.f, angleY, 0.f)),
m_theme.getVector3D(domain, "right_angle", Vector3D(0.f, -angleY, 0.f)),
m_theme.getVector3D(domain, "center_angle"),
@ -816,101 +816,101 @@ void CMenu::_loadCFLayout(int version, bool forceAA, bool otherScrnFmt)
angleY = (smallbox && homebrew) ? 0.f : 90.f;
float angleY1 = (smallbox && homebrew) ? 0.f : 380.f;
float angleX = (smallbox && homebrew) ? 0.f : -45.f;
m_cf.setAngles(true,
CoverFlow.setAngles(true,
m_theme.getVector3D(domainSel, "left_angle", Vector3D(angleX, angleY, 0.f)),
m_theme.getVector3D(domainSel, "right_angle", Vector3D(angleX, -angleY, 0.f)),
m_theme.getVector3D(domainSel, "center_angle", Vector3D(0.f, angleY1, 0.f)),
m_theme.getVector3D(domainSel, "row_center_angle"));
angleX = smallbox ? 0.f : 55.f;
m_cf.setTitleAngles(false,
CoverFlow.setTitleAngles(false,
_getCFFloat(domain, "text_left_angle", -angleX, sf),
_getCFFloat(domain, "text_right_angle", angleX, sf),
_getCFFloat(domain, "text_center_angle", 0.f, sf));
m_cf.setTitleAngles(true,
CoverFlow.setTitleAngles(true,
_getCFFloat(domainSel, "text_left_angle", -angleX, sf),
_getCFFloat(domainSel, "text_right_angle", angleX, sf),
_getCFFloat(domainSel, "text_center_angle", 0.f, sf));
m_cf.setTitlePos(false,
CoverFlow.setTitlePos(false,
_getCFV3D(domain, "text_left_pos", Vector3D(-4.f, 0.f, 1.3f), sf),
_getCFV3D(domain, "text_right_pos", Vector3D(4.f, 0.f, 1.3f), sf),
_getCFV3D(domain, "text_center_pos", Vector3D(0.f, 0.f, 2.6f), sf));
m_cf.setTitlePos(true,
CoverFlow.setTitlePos(true,
_getCFV3D(domainSel, "text_left_pos", Vector3D(-4.f, 0.f, 1.3f), sf),
_getCFV3D(domainSel, "text_right_pos", Vector3D(4.f, 0.f, 1.3f), sf),
_getCFV3D(domainSel, "text_center_pos", Vector3D(1.7f, 1.8f, 1.6f), sf));
m_cf.setTitleWidth(false,
CoverFlow.setTitleWidth(false,
_getCFFloat(domain, "text_side_wrap_width", 500.f, sf),
_getCFFloat(domain, "text_center_wrap_width", 500.f, sf));
m_cf.setTitleWidth(true,
CoverFlow.setTitleWidth(true,
_getCFFloat(domainSel, "text_side_wrap_width", 500.f, sf),
_getCFFloat(domainSel, "text_center_wrap_width", 310.f, sf));
m_cf.setTitleStyle(false,
CoverFlow.setTitleStyle(false,
_textStyle(domain.c_str(), "text_side_style", FTGX_ALIGN_MIDDLE | FTGX_JUSTIFY_CENTER),
_textStyle(domain.c_str(), "text_center_style", FTGX_ALIGN_MIDDLE | FTGX_JUSTIFY_CENTER));
m_cf.setTitleStyle(true,
CoverFlow.setTitleStyle(true,
_textStyle(domainSel.c_str(), "text_side_style", FTGX_ALIGN_MIDDLE | FTGX_JUSTIFY_CENTER),
_textStyle(domainSel.c_str(), "text_center_style", FTGX_ALIGN_TOP | FTGX_JUSTIFY_RIGHT));
m_cf.setColors(false,
CoverFlow.setColors(false,
m_theme.getColor(domain, "color_beg", 0xCFFFFFFF),
m_theme.getColor(domain, "color_end", 0x3FFFFFFF),
m_theme.getColor(domain, "color_off", 0x7FFFFFFF));
m_cf.setColors(true,
CoverFlow.setColors(true,
m_theme.getColor(domainSel, "color_beg", 0x7FFFFFFF),
m_theme.getColor(domainSel, "color_end", 0x1FFFFFFF),
m_theme.getColor(domain, "color_off", 0x7FFFFFFF)); // Mouse not used once a selection has been made
m_cf.setMirrorAlpha(m_theme.getFloat(domain, "mirror_alpha", 0.25f), m_theme.getFloat(domain, "title_mirror_alpha", 0.2f)); // Doesn't depend on selection
CoverFlow.setMirrorAlpha(m_theme.getFloat(domain, "mirror_alpha", 0.25f), m_theme.getFloat(domain, "title_mirror_alpha", 0.2f)); // Doesn't depend on selection
m_cf.setMirrorBlur(m_theme.getBool(domain, "mirror_blur", true)); // Doesn't depend on selection
CoverFlow.setMirrorBlur(m_theme.getBool(domain, "mirror_blur", true)); // Doesn't depend on selection
m_cf.setShadowColors(false,
CoverFlow.setShadowColors(false,
m_theme.getColor(domain, "color_shadow_center", 0x00000000),
m_theme.getColor(domain, "color_shadow_beg", 0x00000000),
m_theme.getColor(domain, "color_shadow_end", 0x00000000),
m_theme.getColor(domain, "color_shadow_off", 0x00000000));
m_cf.setShadowColors(true,
CoverFlow.setShadowColors(true,
m_theme.getColor(domainSel, "color_shadow_center", 0x0000007F),
m_theme.getColor(domainSel, "color_shadow_beg", 0x0000007F),
m_theme.getColor(domainSel, "color_shadow_end", 0x0000007F),
m_theme.getColor(domainSel, "color_shadow_off", 0x0000007F));
m_cf.setShadowPos(m_theme.getFloat(domain, "shadow_scale", 1.1f),
CoverFlow.setShadowPos(m_theme.getFloat(domain, "shadow_scale", 1.1f),
m_theme.getFloat(domain, "shadow_x"),
m_theme.getFloat(domain, "shadow_y"));
float spacerY = (smallbox && homebrew) ? 0.60f : 2.f;
m_cf.setRowSpacers(false,
CoverFlow.setRowSpacers(false,
m_theme.getVector3D(domain, "top_spacer", Vector3D(0.f, spacerY, 0.f)),
m_theme.getVector3D(domain, "bottom_spacer", Vector3D(0.f, -spacerY, 0.f)));
m_cf.setRowSpacers(true,
CoverFlow.setRowSpacers(true,
m_theme.getVector3D(domainSel, "top_spacer", Vector3D(0.f, spacerY, 0.f)),
m_theme.getVector3D(domainSel, "bottom_spacer", Vector3D(0.f, -spacerY, 0.f)));
m_cf.setRowDeltaAngles(false,
CoverFlow.setRowDeltaAngles(false,
m_theme.getVector3D(domain, "top_delta_angle"),
m_theme.getVector3D(domain, "bottom_delta_angle"));
m_cf.setRowDeltaAngles(true,
CoverFlow.setRowDeltaAngles(true,
m_theme.getVector3D(domainSel, "top_delta_angle"),
m_theme.getVector3D(domainSel, "bottom_delta_angle"));
m_cf.setRowAngles(false,
CoverFlow.setRowAngles(false,
m_theme.getVector3D(domain, "top_angle"),
m_theme.getVector3D(domain, "bottom_angle"));
m_cf.setRowAngles(true,
CoverFlow.setRowAngles(true,
m_theme.getVector3D(domainSel, "top_angle"),
m_theme.getVector3D(domainSel, "bottom_angle"));
@ -921,25 +921,25 @@ void CMenu::_loadCFLayout(int version, bool forceAA, bool otherScrnFmt)
: Vector3D(1.f, 0.5f, 1.f))
: Vector3D(1.f, 1.f, 1.f);
m_cf.setCoverScale(false,
CoverFlow.setCoverScale(false,
m_theme.getVector3D(domain, "left_scale", def_cvr_scale),
m_theme.getVector3D(domain, "right_scale", def_cvr_scale),
m_theme.getVector3D(domain, "center_scale", def_cvr_scale),
m_theme.getVector3D(domain, "row_center_scale", def_cvr_scale));
m_cf.setCoverScale(true,
CoverFlow.setCoverScale(true,
m_theme.getVector3D(domainSel, "left_scale", def_cvr_scale),
m_theme.getVector3D(domainSel, "right_scale", def_cvr_scale),
m_theme.getVector3D(domainSel, "center_scale", def_cvr_scale),
m_theme.getVector3D(domainSel, "row_center_scale", def_cvr_scale));
float flipX = (smallbox && homebrew) ? 359.f : 180.f;
m_cf.setCoverFlipping(
CoverFlow.setCoverFlipping(
_getCFV3D(domainSel, "flip_pos", Vector3D(), sf),
_getCFV3D(domainSel, "flip_angle", Vector3D(0.f, flipX, 0.f), sf),
_getCFV3D(domainSel, "flip_scale", def_cvr_scale, sf));
m_cf.setBlur(
CoverFlow.setBlur(
m_theme.getInt(domain, "blur_resolution", 1),
m_theme.getInt(domain, "blur_radius", 2),
m_theme.getFloat(domain, "blur_factor", 1.f));
@ -1248,7 +1248,7 @@ vector<STexture> CMenu::_textures(const char *domain, const char *key)
if (i != theme.texSet.end())
textures.push_back(i->second);
STexture tex;
if (STexture::TE_OK == tex.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), filename.c_str())))
if(tex.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), filename.c_str())) == TE_OK)
{
theme.texSet[filename] = tex;
textures.push_back(tex);
@ -1274,7 +1274,7 @@ STexture CMenu::_texture(const char *domain, const char *key, STexture &def, boo
return i->second;
/* Load from image file */
STexture tex;
if(STexture::TE_OK == tex.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), filename.c_str())))
if(tex.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), filename.c_str())) == TE_OK)
{
if(freeDef && def.data != NULL)
{
@ -1596,8 +1596,8 @@ void CMenu::_initCF(void)
GameTDB gametdb;
const char *domain = _domainFromView();
m_cf.clear();
m_cf.reserve(m_gameList.size());
CoverFlow.clear();
CoverFlow.reserve(m_gameList.size());
const vector<bool> &EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg);
@ -1880,9 +1880,9 @@ void CMenu::_initCF(void)
if(EnabledPlugins.size() == 0) //all plugins
{
if(coverFolder.size() > 0)
m_cf.addItem(&(*element), fmt("%s/%s/%s.png", m_picDir.c_str(), coverFolder.c_str(), tempname.c_str()), fmt("%s/%s/%s.png", m_boxPicDir.c_str(), coverFolder.c_str(), tempname.c_str()), fmt("%s/%s", m_boxPicDir.c_str(), blankCoverName.c_str()), playcount, lastPlayed);
CoverFlow.addItem(&(*element), fmt("%s/%s/%s.png", m_picDir.c_str(), coverFolder.c_str(), tempname.c_str()), fmt("%s/%s/%s.png", m_boxPicDir.c_str(), coverFolder.c_str(), tempname.c_str()), fmt("%s/%s", m_boxPicDir.c_str(), blankCoverName.c_str()), playcount, lastPlayed);
else
m_cf.addItem(&(*element), fmt("%s/%s.png", m_picDir.c_str(), tempname.c_str()), fmt("%s/%s.png", m_boxPicDir.c_str(), tempname.c_str()), fmt("%s/%s", m_boxPicDir.c_str(), blankCoverName.c_str()), playcount, lastPlayed);
CoverFlow.addItem(&(*element), fmt("%s/%s.png", m_picDir.c_str(), tempname.c_str()), fmt("%s/%s.png", m_boxPicDir.c_str(), tempname.c_str()), fmt("%s/%s", m_boxPicDir.c_str(), blankCoverName.c_str()), playcount, lastPlayed);
}
else
{
@ -1891,18 +1891,18 @@ void CMenu::_initCF(void)
if(EnabledPlugins.at(j) == true && element->settings[0] == m_plugin.getPluginMagic(j))
{
if(coverFolder.size() > 0)
m_cf.addItem(&(*element), fmt("%s/%s/%s.png", m_picDir.c_str(), coverFolder.c_str(), tempname.c_str()), fmt("%s/%s/%s.png", m_boxPicDir.c_str(), coverFolder.c_str(), tempname.c_str()), fmt("%s/%s", m_boxPicDir.c_str(), blankCoverName.c_str()), playcount, lastPlayed);
CoverFlow.addItem(&(*element), fmt("%s/%s/%s.png", m_picDir.c_str(), coverFolder.c_str(), tempname.c_str()), fmt("%s/%s/%s.png", m_boxPicDir.c_str(), coverFolder.c_str(), tempname.c_str()), fmt("%s/%s", m_boxPicDir.c_str(), blankCoverName.c_str()), playcount, lastPlayed);
else
m_cf.addItem(&(*element), fmt("%s/%s.png", m_picDir.c_str(), tempname.c_str()), fmt("%s/%s.png", m_boxPicDir.c_str(), tempname.c_str()), fmt("%s/%s", m_boxPicDir.c_str(), blankCoverName.c_str()), playcount, lastPlayed);
CoverFlow.addItem(&(*element), fmt("%s/%s.png", m_picDir.c_str(), tempname.c_str()), fmt("%s/%s.png", m_boxPicDir.c_str(), tempname.c_str()), fmt("%s/%s", m_boxPicDir.c_str(), blankCoverName.c_str()), playcount, lastPlayed);
break;
}
}
}
}
else if(element->type == TYPE_HOMEBREW)
m_cf.addItem(&(*element), fmt("%s/icon.png", element->path), fmt("%s/%s.png", m_boxPicDir.c_str(), id.c_str()), fmt("%s/%s", m_boxPicDir.c_str(), blankCoverName.c_str()), playcount, lastPlayed);
CoverFlow.addItem(&(*element), fmt("%s/icon.png", element->path), fmt("%s/%s.png", m_boxPicDir.c_str(), id.c_str()), fmt("%s/%s", m_boxPicDir.c_str(), blankCoverName.c_str()), playcount, lastPlayed);
else
m_cf.addItem(&(*element), fmt("%s/%s.png", m_picDir.c_str(), id.c_str()), fmt("%s/%s.png", m_boxPicDir.c_str(), id.c_str()), fmt("%s/%s", m_boxPicDir.c_str(), blankCoverName.c_str()), playcount, lastPlayed);
CoverFlow.addItem(&(*element), fmt("%s/%s.png", m_picDir.c_str(), id.c_str()), fmt("%s/%s.png", m_boxPicDir.c_str(), id.c_str()), fmt("%s/%s", m_boxPicDir.c_str(), blankCoverName.c_str()), playcount, lastPlayed);
}
}
m_gcfg1.unload();
@ -1911,33 +1911,34 @@ void CMenu::_initCF(void)
dump.save(true);
m_cfg.setBool(domain, "dump_list", false);
}
m_cf.setBoxMode(m_cfg.getBool("GENERAL", "box_mode", true));
m_cf.setCompression(m_cfg.getBool("GENERAL", "allow_texture_compression", true));
m_cf.setBufferSize(m_cfg.getInt("GENERAL", "cover_buffer", 20));
m_cf.setSorting((Sorting)m_cfg.getInt(domain, "sort", 0));
m_cf.setHQcover(m_cfg.getBool("GENERAL", "cover_use_hq", false));
CoverFlow.setBoxMode(m_cfg.getBool("GENERAL", "box_mode", true));
CoverFlow.setCompression(m_cfg.getBool("GENERAL", "allow_texture_compression", true));
CoverFlow.setBufferSize(m_cfg.getInt("GENERAL", "cover_buffer", 20));
CoverFlow.setSorting((Sorting)m_cfg.getInt(domain, "sort", 0));
CoverFlow.setHQcover(m_cfg.getBool("GENERAL", "cover_use_hq", false));
m_cf.start();
if (m_curGameId.empty() || !m_cf.findId(m_curGameId.c_str(), true))
m_cf.findId(m_cfg.getString(domain, "current_item").c_str(), true);
CoverFlow.start();
if (m_curGameId.empty() || !CoverFlow.findId(m_curGameId.c_str(), true))
CoverFlow.findId(m_cfg.getString(domain, "current_item").c_str(), true);
}
void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
{
if(withCF)
m_cf.tick();
CoverFlow.tick();
m_btnMgr.tick();
m_fa.tick();
m_cf.setFanartPlaying(m_fa.isLoaded());
m_cf.setFanartTextColor(m_fa.getTextColor(m_theme.getColor("_COVERFLOW", "font_color", CColor(0xFFFFFFFF))));
m_fa.hideCover() ? CoverFlow.hideCover() : CoverFlow.showCover();
CoverFlow.setFanartPlaying(m_fa.isLoaded());
CoverFlow.setFanartTextColor(m_fa.getTextColor(m_theme.getColor("_COVERFLOW", "font_color", CColor(0xFFFFFFFF))));
m_vid.prepare();
m_vid.setup2DProjection();
_updateBg();
m_fa.hideCover() ? m_cf.hideCover() : m_cf.showCover();
if(CoverFlow.getRenderTex())
CoverFlow.RenderTex();
if(withCF)
m_cf.makeEffectTexture(m_vid, m_lqBg);
CoverFlow.makeEffectTexture(m_lqBg);
if(withCF && m_aa > 0)
{
m_vid.setAA(m_aa, true);
@ -1947,11 +1948,11 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
m_vid.setup2DProjection(false, true);
_drawBg();
m_fa.draw(false);
m_cf.draw();
CoverFlow.draw();
m_vid.setup2DProjection(false, true);
m_cf.drawEffect();
CoverFlow.drawEffect();
if(!m_banner.GetSelectedGame())
m_cf.drawText(adjusting);
CoverFlow.drawText(adjusting);
m_vid.renderAAPass(i);
}
m_vid.setup2DProjection();
@ -1959,17 +1960,15 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
}
else
{
m_vid.prepare();
m_vid.setup2DProjection();
_drawBg();
m_fa.draw(false);
if(withCF)
{
m_cf.draw();
CoverFlow.draw();
m_vid.setup2DProjection();
m_cf.drawEffect();
CoverFlow.drawEffect();
if(!m_banner.GetSelectedGame())
m_cf.drawText(adjusting);
CoverFlow.drawText(adjusting);
}
}
if(m_fa.isLoaded())
@ -2061,7 +2060,6 @@ void CMenu::_updateBg(void)
Mtx modelViewMtx;
GXTexObj texObj;
GXTexObj texObj2;
Mtx44 projMtx;
if (m_bgCrossFade == 0) return;
m_bgCrossFade = max(0, (int)m_bgCrossFade - 14);
@ -2071,10 +2069,6 @@ void CMenu::_updateBg(void)
m_curBg = m_nextBg;
return;
}
m_vid.prepare();
GX_SetViewport(0.f, 0.f, 640.f, 480.f, 0.f, 1.f);
guOrtho(projMtx, 0.f, 480.f, 0.f, 640.f, 0.f, 1000.0f);
GX_LoadProjectionMtx(projMtx, GX_ORTHOGRAPHIC);
GX_ClearVtxDesc();
GX_SetNumTevStages(m_prevBg.data == NULL ? 1 : 2);
GX_SetNumChans(0);
@ -2252,7 +2246,7 @@ bool CMenu::_loadChannelList(void)
bool CMenu::_loadList(void)
{
m_cf.clear();
CoverFlow.clear();
if((m_current_view == COVERFLOW_CHANNEL && m_cfg.getBool(CHANNEL_DOMAIN, "disable", true))
|| (m_current_view != COVERFLOW_CHANNEL && NandHandle.EmulationEnabled()))
{
@ -2419,7 +2413,7 @@ void CMenu::_stopSounds(void)
}
}
m_btnMgr.stopSounds();
m_cf.stopSound();
CoverFlow.stopSound();
m_gameSound.Stop();
}
@ -2582,11 +2576,11 @@ void CMenu::_cleanupDefaultFont()
string CMenu::_getId()
{
string id;
if(!NoGameID(m_cf.getHdr()->type))
id = m_cf.getId();
if(!NoGameID(CoverFlow.getHdr()->type))
id = CoverFlow.getId();
else
{
dir_discHdr *hdr = m_cf.getHdr();
dir_discHdr *hdr = CoverFlow.getHdr();
string tempname(hdr->path);
if(hdr->type == TYPE_HOMEBREW)
{

View File

@ -53,7 +53,6 @@ private:
};
CCursor m_cursor[WPAD_MAX_WIIMOTES];
CButtonsMgr m_btnMgr;
CCoverFlow m_cf;
CFanart m_fa;
Config m_cfg;
Config m_loc;

View File

@ -123,7 +123,7 @@ void CMenu::_getIDCats(void)
m_categories.at(k) = '1';
}
}
m_btnMgr.setText(m_categoryLblTitle, m_cf.getTitle());
m_btnMgr.setText(m_categoryLblTitle, CoverFlow.getTitle());
}
void CMenu::_setIDCats(void)
@ -213,7 +213,7 @@ void CMenu::_CategorySettings(bool fromGameSet)
while(!m_exit)
{
_mainLoopCommon();
m_cf.tick();
CoverFlow.tick();
if(!m_btnMgr.selected(lastBtn))
m_btnMgr.noHover(false);
@ -260,7 +260,7 @@ void CMenu::_CategorySettings(bool fromGameSet)
{
_setIDCats();
_hideCategorySettings();
m_cf.right();
CoverFlow.right();
curPage = 1;
m_categories.assign(m_max_categories, '0');
_getIDCats();
@ -270,7 +270,7 @@ void CMenu::_CategorySettings(bool fromGameSet)
{
_setIDCats();
_hideCategorySettings();
m_cf.left();
CoverFlow.left();
curPage = 1;
m_categories.assign(m_max_categories, '0');
_getIDCats();

View File

@ -174,11 +174,11 @@ void CMenu::_hideCFTheme(bool instant)
void CMenu::_showCFTheme(u32 curParam, int version, bool wide)
{
const CMenu::SCFParamDesc &p = CMenu::_cfParams[curParam];
bool selected = m_cf.selected();
bool selected = CoverFlow.selected();
string domUnsel(sfmt(_cfDomain(), version));
string domSel(sfmt(_cfDomain(true), version));
m_cf.simulateOtherScreenFormat(p.scrnFmt && wide != m_vid.wide());
CoverFlow.simulateOtherScreenFormat(p.scrnFmt && wide != m_vid.wide());
_setBg(m_mainBg, m_mainBgLQ);
m_btnMgr.show(m_cfThemeBtnSave);
m_btnMgr.show(m_cfThemeBtnCancel);
@ -292,7 +292,7 @@ void CMenu::_showCFTheme(u32 curParam, int version, bool wide)
m_btnMgr.show(m_cfThemeBtnValP[k]);
break;
case CMenu::SCFParamDesc::PDT_TXTSTYLE:
m_btnMgr.setText(m_cfThemeLblVal[k], styleToTxt(_textStyle(domain.c_str(), key.c_str(), m_cf.selected() ? FTGX_JUSTIFY_RIGHT | FTGX_ALIGN_TOP : FTGX_JUSTIFY_CENTER | FTGX_ALIGN_BOTTOM)));
m_btnMgr.setText(m_cfThemeLblVal[k], styleToTxt(_textStyle(domain.c_str(), key.c_str(), CoverFlow.selected() ? FTGX_JUSTIFY_RIGHT | FTGX_ALIGN_TOP : FTGX_JUSTIFY_CENTER | FTGX_ALIGN_BOTTOM)));
for (int j = 1; j < 4; ++j)
{
m_btnMgr.hide(m_cfThemeLblVal[k + j]);
@ -320,7 +320,7 @@ void CMenu::_cfTheme(void)
_initCF();
_showCFTheme(curParam, cfVersion, wide);
_loadCFLayout(cfVersion, true, wide != m_vid.wide());
m_cf.applySettings();
CoverFlow.applySettings();
while(!m_exit)
{
_mainLoopCommon(true);
@ -338,14 +338,14 @@ void CMenu::_cfTheme(void)
if(BTN_B_HELD && BTN_1_PRESSED)
{
copyVersion = cfVersion;
copySelected = m_cf.selected();
copySelected = CoverFlow.selected();
copyWide = wide;
}
else if(copyVersion > 0 && BTN_B_HELD && BTN_2_PRESSED)
{
string domSrc(sfmt(_cfDomain(copySelected), copyVersion));
string domDst(sfmt(_cfDomain(m_cf.selected()), cfVersion));
if (copyVersion != cfVersion || copySelected != m_cf.selected())
string domDst(sfmt(_cfDomain(CoverFlow.selected()), cfVersion));
if (copyVersion != cfVersion || copySelected != CoverFlow.selected())
m_theme.copyDomain(domDst, domSrc);
else if (copyWide != wide)
for (u32 i = 0; i < ARRAY_SIZE(CMenu::_cfParams); ++i)
@ -370,9 +370,9 @@ void CMenu::_cfTheme(void)
}
_showCFTheme(curParam, cfVersion, wide);
_loadCFLayout(cfVersion, true, wide != m_vid.wide());
m_cf.applySettings();
CoverFlow.applySettings();
}
bool sel = m_cf.selected();
bool sel = CoverFlow.selected();
if (BTN_B_HELD)
{
if (BTN_PLUS_PRESSED || BTN_MINUS_PRESSED)
@ -380,28 +380,28 @@ void CMenu::_cfTheme(void)
s8 direction = BTN_PLUS_PRESSED ? 1 : -1;
curParam = loopNum(curParam + direction, ARRAY_SIZE(CMenu::_cfParams));
if (CMenu::_cfParams[curParam].domain == CMenu::SCFParamDesc::PDD_SELECTED)
m_cf.select();
CoverFlow.select();
_showCFTheme(curParam, cfVersion, wide);
}
}
else if (!sel)
{
if (BTN_PLUS_PRESSED)
m_cf.pageDown();
CoverFlow.pageDown();
else if (BTN_MINUS_PRESSED)
m_cf.pageUp();
CoverFlow.pageUp();
}
if (BTN_LEFT_REPEAT)
m_cf.left();
CoverFlow.left();
else if (BTN_RIGHT_REPEAT)
m_cf.right();
if (sel && !m_cf.selected())
m_cf.select();
CoverFlow.right();
if (sel && !CoverFlow.selected())
CoverFlow.select();
if (BTN_A_PRESSED)
{
if (m_btnMgr.selected(m_cfThemeBtnSave))
{
m_cf.stopCoverLoader();
CoverFlow.stopCoverLoader();
m_theme.save();
break;
}
@ -417,31 +417,31 @@ void CMenu::_cfTheme(void)
cfVersion = 1 + loopNum(cfVersion, m_numCFVersions);
_showCFTheme(curParam, cfVersion, wide);
_loadCFLayout(cfVersion, true, wide != m_vid.wide());
m_cf.applySettings();
CoverFlow.applySettings();
}
else if (m_btnMgr.selected(m_cfThemeBtnSelect))
{
if (m_cf.selected())
m_cf.cancel();
if (CoverFlow.selected())
CoverFlow.cancel();
else
m_cf.select();
CoverFlow.select();
_showCFTheme(curParam, cfVersion, wide);
_loadCFLayout(cfVersion, true, wide != m_vid.wide());
m_cf.applySettings();
CoverFlow.applySettings();
}
else if (m_btnMgr.selected(m_cfThemeBtnWide))
{
wide = !wide;
_showCFTheme(curParam, cfVersion, wide);
_loadCFLayout(cfVersion, true, wide != m_vid.wide());
m_cf.applySettings();
CoverFlow.applySettings();
}
else if (m_btnMgr.selected(m_cfThemeBtnParamP) || m_btnMgr.selected(m_cfThemeBtnParamM))
{
s8 direction = m_btnMgr.selected(m_cfThemeBtnParamP) ? 1 : -1;
curParam = loopNum(curParam + direction, ARRAY_SIZE(CMenu::_cfParams));
if (CMenu::_cfParams[curParam].domain == CMenu::SCFParamDesc::PDD_SELECTED)
m_cf.select();
CoverFlow.select();
_showCFTheme(curParam, cfVersion, wide);
}
}
@ -453,7 +453,7 @@ void CMenu::_cfTheme(void)
_cfParam(m_btnMgr.selected(m_cfThemeBtnValP[i]), i, CMenu::_cfParams[curParam], cfVersion, wide);
_showCFTheme(curParam, cfVersion, wide);
_loadCFLayout(cfVersion, true, wide != m_vid.wide());
m_cf.applySettings();
CoverFlow.applySettings();
break;
}
}
@ -461,19 +461,19 @@ void CMenu::_cfTheme(void)
_showCFTheme(curParam, cfVersion, wide);
else
_hideCFTheme();
m_cf.flip(true, curParam == 16);
CoverFlow.flip(true, curParam == 16);
}
_hideCFTheme();
_loadCFLayout(1);
m_cf.clear();
m_cf.simulateOtherScreenFormat(false);
CoverFlow.clear();
CoverFlow.simulateOtherScreenFormat(false);
}
void CMenu::_cfParam(bool inc, int i, const CMenu::SCFParamDesc &p, int cfVersion, bool wide)
{
int k = i / 4;
string key(p.key[k]);
const char *d = _cfDomain((p.domain != CMenu::SCFParamDesc::PDD_NORMAL && m_cf.selected()) || p.domain == CMenu::SCFParamDesc::PDD_SELECTED);
const char *d = _cfDomain((p.domain != CMenu::SCFParamDesc::PDD_NORMAL && CoverFlow.selected()) || p.domain == CMenu::SCFParamDesc::PDD_SELECTED);
string domain(sfmt(d, cfVersion));
float step = p.step[k];
if (!wide && p.scrnFmt && (p.paramType[k] == CMenu::SCFParamDesc::PDT_V3D || p.paramType[k] == CMenu::SCFParamDesc::PDT_FLOAT || p.paramType[k] == CMenu::SCFParamDesc::PDT_INT))
@ -542,7 +542,7 @@ void CMenu::_cfParam(bool inc, int i, const CMenu::SCFParamDesc &p, int cfVersio
}
case CMenu::SCFParamDesc::PDT_TXTSTYLE:
{
int i = styleToIdx(_textStyle(domain.c_str(), key.c_str(), m_cf.selected() ? FTGX_JUSTIFY_RIGHT | FTGX_ALIGN_TOP : FTGX_JUSTIFY_CENTER | FTGX_ALIGN_BOTTOM));
int i = styleToIdx(_textStyle(domain.c_str(), key.c_str(), CoverFlow.selected() ? FTGX_JUSTIFY_RIGHT | FTGX_ALIGN_TOP : FTGX_JUSTIFY_CENTER | FTGX_ALIGN_BOTTOM));
i = loopNum(i + (int)step, 9);
m_theme.setString(domain, key, styleToTxt(g_txtStyles[i]));
break;

View File

@ -53,7 +53,7 @@ u32 CMenu::_downloadCheatFileAsync(void *obj)
return -2;
}
string id = m->m_cf.getId();
string id = CoverFlow.getId();
char type = id[0] == 'S' ? 'R' : id[0];
block cheatfile = downloadfile(buffer, bufferSize, fmt(GECKOURL, type, id.c_str()), CMenu::_downloadProgress, m);
@ -81,7 +81,7 @@ void CMenu::_CheatSettings()
{
SetupInput();
string id = m_cf.getId();
string id = CoverFlow.getId();
m_cheatSettingsPage = 1;
int txtavailable = m_cheatfile.openTxtfile(fmt("%s/%s.txt", m_txtCheatDir.c_str(), id.c_str()));

View File

@ -82,13 +82,13 @@ void CMenu::_showConfig(void)
void CMenu::_cfNeedsUpdate(void)
{
if (!m_cfNeedsUpdate)
m_cf.clear();
CoverFlow.clear();
m_cfNeedsUpdate = true;
}
void CMenu::_config(int page)
{
m_curGameId = m_cf.getId();
m_curGameId = CoverFlow.getId();
m_cfNeedsUpdate = false;
int change = CONFIG_PAGE_NO_CHANGE;
while(!m_exit)
@ -183,11 +183,11 @@ int CMenu::_config1(void)
if (m_btnMgr.selected(m_configBtnDownload))
{
_cfNeedsUpdate();
m_cf.stopCoverLoader(true);
CoverFlow.stopCoverLoader(true);
_hideConfig();
_download();
_showConfig();
m_cf.startCoverLoader();
CoverFlow.startCoverLoader();
}
else if ((m_btnMgr.selected(m_configBtnUnlock)) || (m_btnMgr.selected(m_configBtnSetCode)))
_code();
@ -199,14 +199,14 @@ int CMenu::_config1(void)
else if (m_btnMgr.selected(m_configBtnCfg4))
{
_cfNeedsUpdate();
m_cf.stopCoverLoader(true);
CoverFlow.stopCoverLoader(true);
_hideConfig();
if(m_current_view != COVERFLOW_PLUGIN)
_NandEmuCfg();
else
_PluginSettings();
_showConfig();
m_cf.startCoverLoader();
CoverFlow.startCoverLoader();
}
}
}

View File

@ -122,7 +122,7 @@ void CMenu::_showGameSettings(void)
{
wstringEx title(_t("cfgg1", L"Settings"));
title += L" [";
title += wstringEx(m_cf.getId());
title += wstringEx(CoverFlow.getId());
title += L"]";
m_btnMgr.setText(m_gameSettingsLblTitle, title);
_setBg(m_gameSettingsBg, m_gameSettingsBg);
@ -131,7 +131,7 @@ void CMenu::_showGameSettings(void)
m_btnMgr.show(m_gameSettingsBtnPageP);
m_btnMgr.show(m_gameSettingsBtnBack);
m_btnMgr.show(m_gameSettingsLblTitle);
if(m_cf.getHdr()->type == TYPE_GC_GAME)
if(CoverFlow.getHdr()->type == TYPE_GC_GAME)
{
if(m_new_dml)
g_numGCfPages = 3;
@ -140,7 +140,7 @@ void CMenu::_showGameSettings(void)
}
else
{
if(m_current_view == COVERFLOW_USB && _checkSave(string((const char *)m_cf.getHdr()->id), false))
if(m_current_view == COVERFLOW_USB && _checkSave(string((const char *)CoverFlow.getHdr()->id), false))
g_numGCfPages = 5;
else
g_numGCfPages = 4;
@ -150,7 +150,7 @@ void CMenu::_showGameSettings(void)
{
m_btnMgr.show(m_gameSettingsLblCover);
m_btnMgr.show(m_gameSettingsBtnCover);
if(m_cf.getHdr()->type == TYPE_GC_GAME)
if(CoverFlow.getHdr()->type == TYPE_GC_GAME)
{
m_btnMgr.show(m_gameSettingsLblDMLGameVideo);
m_btnMgr.show(m_gameSettingsLblDMLVideo);
@ -187,7 +187,7 @@ void CMenu::_showGameSettings(void)
{
m_btnMgr.hide(m_gameSettingsLblCover);
m_btnMgr.hide(m_gameSettingsBtnCover);
if(m_cf.getHdr()->type == TYPE_GC_GAME)
if(CoverFlow.getHdr()->type == TYPE_GC_GAME)
{
m_btnMgr.hide(m_gameSettingsLblGClanguage);
m_btnMgr.hide(m_gameSettingsLblGClanguageVal);
@ -227,7 +227,7 @@ void CMenu::_showGameSettings(void)
m_btnMgr.show(m_gameSettingsBtnDebuggerP);
m_btnMgr.show(m_gameSettingsBtnDebuggerM);
if(m_cf.getHdr()->type != TYPE_GC_GAME)
if(CoverFlow.getHdr()->type != TYPE_GC_GAME)
{
m_btnMgr.show(m_gameSettingsLblHooktype);
m_btnMgr.show(m_gameSettingsLblHooktypeVal);
@ -248,7 +248,7 @@ void CMenu::_showGameSettings(void)
m_btnMgr.hide(m_gameSettingsBtnDebuggerP);
m_btnMgr.hide(m_gameSettingsBtnDebuggerM);
if(m_cf.getHdr()->type != TYPE_GC_GAME)
if(CoverFlow.getHdr()->type != TYPE_GC_GAME)
{
m_btnMgr.hide(m_gameSettingsLblHooktype);
m_btnMgr.hide(m_gameSettingsLblHooktypeVal);
@ -264,7 +264,7 @@ void CMenu::_showGameSettings(void)
}
if (m_gameSettingsPage == 3)
{
if(m_cf.getHdr()->type != TYPE_GC_GAME)
if(CoverFlow.getHdr()->type != TYPE_GC_GAME)
{
m_btnMgr.show(m_gameSettingsLblPatchVidModes);
m_btnMgr.show(m_gameSettingsLblPatchVidModesVal);
@ -276,7 +276,7 @@ void CMenu::_showGameSettings(void)
m_btnMgr.show(m_gameSettingsLblCountryPatch);
m_btnMgr.show(m_gameSettingsBtnCountryPatch);
if(m_cf.getHdr()->type == TYPE_WII_GAME)
if(CoverFlow.getHdr()->type == TYPE_WII_GAME)
{
m_btnMgr.show(m_gameSettingsLblAspectRatio);
m_btnMgr.show(m_gameSettingsLblAspectRatioVal);
@ -305,7 +305,7 @@ void CMenu::_showGameSettings(void)
}
else
{
if(m_cf.getHdr()->type != TYPE_GC_GAME)
if(CoverFlow.getHdr()->type != TYPE_GC_GAME)
{
m_btnMgr.hide(m_gameSettingsLblPatchVidModes);
m_btnMgr.hide(m_gameSettingsLblPatchVidModesVal);
@ -344,7 +344,7 @@ void CMenu::_showGameSettings(void)
}
if (m_gameSettingsPage == 4)
{
if(m_cf.getHdr()->type == TYPE_CHANNEL)
if(CoverFlow.getHdr()->type == TYPE_CHANNEL)
{
m_btnMgr.show(m_gameSettingsLblCustom);
m_btnMgr.show(m_gameSettingsBtnCustom);
@ -354,13 +354,13 @@ void CMenu::_showGameSettings(void)
m_btnMgr.show(m_gameSettingsBtnLaunchNK);
}
}
else if(m_cf.getHdr()->type == TYPE_WII_GAME)
else if(CoverFlow.getHdr()->type == TYPE_WII_GAME)
{
m_btnMgr.show(m_gameSettingsLblEmulationVal);
m_btnMgr.show(m_gameSettingsLblEmulation);
m_btnMgr.show(m_gameSettingsBtnEmulationP);
m_btnMgr.show(m_gameSettingsBtnEmulationM);
if(_checkSave(string((const char *)m_cf.getHdr()->id), true))
if(_checkSave(string((const char *)CoverFlow.getHdr()->id), true))
{
m_btnMgr.show(m_gameSettingsLblExtractSave);
m_btnMgr.show(m_gameSettingsBtnExtractSave);
@ -407,13 +407,13 @@ void CMenu::_showGameSettings(void)
if(m_gameSettingsLblUser[i] != -1)
m_btnMgr.show(m_gameSettingsLblUser[i]);
string id(m_cf.getId());
string id(CoverFlow.getId());
int page = m_gameSettingsPage;
u32 maxpage = g_numGCfPages;
m_btnMgr.setText(m_gameSettingsLblPage, wfmt(L"%i / %i", page, maxpage));
m_btnMgr.setText(m_gameSettingsBtnOcarina, _optBoolToString(m_gcfg2.getOptBool(id, "cheat")));
if(m_cf.getHdr()->type == TYPE_GC_GAME)
if(CoverFlow.getHdr()->type == TYPE_GC_GAME)
{
m_btnMgr.setText(m_gameSettingsBtnDM_Widescreen, _optBoolToString(m_gcfg2.getOptBool(id, "dm_widescreen", 0)));
m_btnMgr.setText(m_gameSettingsBtnDevoMemcardEmu, _optBoolToString(m_gcfg2.getOptBool(id, "devo_memcard_emu", 0)));
@ -475,7 +475,7 @@ void CMenu::_showGameSettings(void)
void CMenu::_gameSettings(void)
{
m_gcfg2.load(fmt("%s/" GAME_SETTINGS2_FILENAME, m_settingsDir.c_str()));
string id(m_cf.getId());
string id(CoverFlow.getId());
m_gameSettingsPage = 1;
_showGameSettings();
@ -664,11 +664,11 @@ void CMenu::_gameSettings(void)
}
else if (m_btnMgr.selected(m_gameSettingsBtnCover))
{
m_cf.stopCoverLoader(true);
CoverFlow.stopCoverLoader(true);
_hideGameSettings();
_download(id);
_showGameSettings();
m_cf.startCoverLoader();
CoverFlow.startCoverLoader();
}
else if (m_btnMgr.selected(m_gameSettingsBtnCheat))
{
@ -722,11 +722,11 @@ void CMenu::_gameSettings(void)
{
if (m_btnMgr.selected(m_gameSettingsBtnCover))
{
m_cf.stopCoverLoader(true); // Empty cover cache
remove(fmt("%s/%s.png", m_picDir.c_str(), m_cf.getId().c_str()));
remove(fmt("%s/%s.png", m_boxPicDir.c_str(), m_cf.getId().c_str()));
remove(fmt("%s/%s.wfc", m_cacheDir.c_str(), m_cf.getId().c_str()));
m_cf.startCoverLoader();
CoverFlow.stopCoverLoader(true); // Empty cover cache
remove(fmt("%s/%s.png", m_picDir.c_str(), CoverFlow.getId().c_str()));
remove(fmt("%s/%s.png", m_boxPicDir.c_str(), CoverFlow.getId().c_str()));
remove(fmt("%s/%s.wfc", m_cacheDir.c_str(), CoverFlow.getId().c_str()));
CoverFlow.startCoverLoader();
}
}

View File

@ -114,13 +114,13 @@ int CMenu::_configSnd(void)
{
m_cfg.setInt("GENERAL", "sound_volume_coverflow", min(m_cfg.getInt("GENERAL", "sound_volume_coverflow", 255) + step, 255));
_showConfigSnd();
m_cf.setSoundVolume(m_cfg.getInt("GENERAL", "sound_volume_coverflow", 255));
CoverFlow.setSoundVolume(m_cfg.getInt("GENERAL", "sound_volume_coverflow", 255));
}
else if (m_btnMgr.selected(m_configSndBtnCFVolM))
{
m_cfg.setInt("GENERAL", "sound_volume_coverflow", max(m_cfg.getInt("GENERAL", "sound_volume_coverflow", 255) - step, 0));
_showConfigSnd();
m_cf.setSoundVolume(m_cfg.getInt("GENERAL", "sound_volume_coverflow", 255));
CoverFlow.setSoundVolume(m_cfg.getInt("GENERAL", "sound_volume_coverflow", 255));
}
}
}

View File

@ -514,7 +514,7 @@ int CMenu::_coverDownloader(bool missingOnly)
id = (const char *)m_gameList[i].id;
path = sfmt("%s/%s.png", m_boxPicDir.c_str(), id.c_str());
}
if(!missingOnly || (!m_cf.fullCoverCached(id.c_str()) && !checkPNGFile(path.c_str())))
if(!missingOnly || (!CoverFlow.fullCoverCached(id.c_str()) && !checkPNGFile(path.c_str())))
{
if(m_gameList[i].type == TYPE_PLUGIN)
pluginCoverList.push_back(m_gameList[i]);
@ -726,7 +726,7 @@ int CMenu::_coverDownloader(bool missingOnly)
LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverList[i].c_str()).c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps);
LWP_MutexUnlock(m_mutex);
if (m_cf.preCacheCover(coverList[i].c_str(), download.data, true))
if (CoverFlow.preCacheCover(coverList[i].c_str(), download.data, true))
{
++count;
success = true;
@ -874,7 +874,7 @@ int CMenu::_coverDownloader(bool missingOnly)
LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverList[i].c_str()).c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps);
LWP_MutexUnlock(m_mutex);
if (m_cf.preCacheCover(coverList[i].c_str(), download.data, true))
if (CoverFlow.preCacheCover(coverList[i].c_str(), download.data, true))
{
++count;
success = true;
@ -1021,7 +1021,7 @@ int CMenu::_coverDownloader(bool missingOnly)
LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverList[i].c_str()).c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps);
LWP_MutexUnlock(m_mutex);
if (m_cf.preCacheCover(coverList[i].c_str(), download.data, false))
if (CoverFlow.preCacheCover(coverList[i].c_str(), download.data, false))
{
++countFlat;
success = true;
@ -1164,7 +1164,7 @@ int CMenu::_coverDownloader(bool missingOnly)
LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverList[i].c_str()).c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps);
LWP_MutexUnlock(m_mutex);
if (m_cf.preCacheCover(coverList[i].c_str(), download.data, false))
if (CoverFlow.preCacheCover(coverList[i].c_str(), download.data, false))
{
++countFlat;
success = true;
@ -1210,13 +1210,13 @@ void CMenu::_download(string gameId)
m_thrdStop = false;
m_thrdMessageAdded = false;
if(gameId.size() && m_cf.getHdr()->type == TYPE_PLUGIN)
if(gameId.size() && CoverFlow.getHdr()->type == TYPE_PLUGIN)
{
char gamePath[256];
if(string(m_cf.getHdr()->path).find_last_of("/") != string::npos)
strncpy(gamePath, &m_cf.getHdr()->path[string(m_cf.getHdr()->path).find_last_of("/")+1], sizeof(gamePath));
if(string(CoverFlow.getHdr()->path).find_last_of("/") != string::npos)
strncpy(gamePath, &CoverFlow.getHdr()->path[string(CoverFlow.getHdr()->path).find_last_of("/")+1], sizeof(gamePath));
else
strncpy(gamePath, m_cf.getHdr()->path, sizeof(gamePath));
strncpy(gamePath, CoverFlow.getHdr()->path, sizeof(gamePath));
m_coverDLGameId = gamePath;
}
else

View File

@ -309,7 +309,7 @@ void CMenu::_hideGame(bool instant)
{
m_gameSelected = false;
m_fa.unload();
m_cf.showCover();
CoverFlow.showCover();
m_btnMgr.hide(m_gameBtnPlay, instant);
m_btnMgr.hide(m_gameBtnBack, instant);
m_btnMgr.hide(m_gameBtnPlayFull, instant);
@ -330,16 +330,16 @@ void CMenu::_hideGame(bool instant)
void CMenu::_showGame(void)
{
m_cf.showCover();
CoverFlow.showCover();
if (m_fa.load(m_cfg, m_fanartDir.c_str(), m_cf.getId().c_str()))
if (m_fa.load(m_cfg, m_fanartDir.c_str(), CoverFlow.getId().c_str()))
{
STexture bg, bglq;
m_fa.getBackground(bg, bglq);
_setBg(bg, bglq);
if (m_fa.hideCover())
m_cf.hideCover();
CoverFlow.hideCover();
}
else
_setBg(m_mainBg, m_mainBgLQ);
@ -382,7 +382,7 @@ void CMenu::_game(bool launch)
m_gameSelected = true;
}
m_zoom_banner = m_cfg.getBool(_domainFromView(), "show_full_banner", false) && !NoGameID(m_cf.getHdr()->type);
m_zoom_banner = m_cfg.getBool(_domainFromView(), "show_full_banner", false) && !NoGameID(CoverFlow.getHdr()->type);
if(m_banner.GetZoomSetting() != m_zoom_banner)
m_banner.ToogleZoom();
@ -392,7 +392,7 @@ void CMenu::_game(bool launch)
if(startGameSound < 1)
startGameSound++;
u64 chantitle = m_cf.getChanTitle();
u64 chantitle = CoverFlow.getChanTitle();
if(startGameSound == -5)
{
@ -424,7 +424,7 @@ void CMenu::_game(bool launch)
m_banner.DeleteBanner();
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 && (CoverFlow.getHdr()->type == TYPE_WII_GAME || CoverFlow.getHdr()->type == TYPE_GC_GAME || CoverFlow.getHdr()->type == TYPE_CHANNEL))
{
_hideGame();
m_banner.SetShowBanner(false);
@ -437,7 +437,7 @@ void CMenu::_game(bool launch)
}
else if(BTN_MINUS_PRESSED)
{
const char *videoPath = fmt("%s/%.3s.thp", m_videoDir.c_str(), m_cf.getId().c_str());
const char *videoPath = fmt("%s/%.3s.thp", m_videoDir.c_str(), CoverFlow.getId().c_str());
FILE *file = fopen(videoPath, "r");
if(file)
{
@ -490,7 +490,7 @@ void CMenu::_game(bool launch)
const char *domain = _domainFromView();
int cfVersion = 1+loopNum((m_cfg.getInt(domain, "last_cf_mode", 1)-1) + direction, m_numCFVersions);
_loadCFLayout(cfVersion);
m_cf.applySettings();
CoverFlow.applySettings();
m_cfg.setInt(domain, "last_cf_mode" , cfVersion);
}
else if(launch || BTN_A_PRESSED)
@ -527,7 +527,7 @@ void CMenu::_game(bool launch)
m_banner.DeleteBanner();
break;
}
else if((m_btnMgr.selected(m_gameBtnToogle) || m_btnMgr.selected(m_gameBtnToogleFull)) && !NoGameID(m_cf.getHdr()->type))
else if((m_btnMgr.selected(m_gameBtnToogle) || m_btnMgr.selected(m_gameBtnToogleFull)) && !NoGameID(CoverFlow.getHdr()->type))
{
m_zoom_banner = m_banner.ToogleZoom();
m_cfg.setBool(_domainFromView(), "show_full_banner", m_zoom_banner);
@ -553,7 +553,7 @@ void CMenu::_game(bool launch)
m_gameSound.FreeMemory();
CheckGameSoundThread();
m_banner.DeleteBanner();
dir_discHdr *hdr = m_cf.getHdr();
dir_discHdr *hdr = CoverFlow.getHdr();
m_gcfg2.load(fmt("%s/" GAME_SETTINGS2_FILENAME, m_settingsDir.c_str()));
if(currentPartition != SD && hdr->type == TYPE_GC_GAME && m_show_dml == 2 && (strstr(hdr->path, ".iso") == NULL ||
!m_devo_installed || min((u32)m_gcfg2.getInt(hdr->id, "gc_loader", 0), ARRAY_SIZE(CMenu::_GCLoader) - 1u) == 1))
@ -597,7 +597,7 @@ void CMenu::_game(bool launch)
currentPartition = SD;
}
m_cf.clear();
CoverFlow.clear();
_showWaitMessage();
exitHandler(PRIILOADER_DEF); //Making wiiflow ready to boot something
@ -631,41 +631,41 @@ void CMenu::_game(bool launch)
m_gcfg2.unload();
_showGame();
_initCF();
m_cf.select();
CoverFlow.select();
}
else
{
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
if (m_cf.mouseOver(m_vid, m_cursor[chan].x(), m_cursor[chan].y()))
m_cf.flip();
if (CoverFlow.mouseOver(m_cursor[chan].x(), m_cursor[chan].y()))
CoverFlow.flip();
}
}
if((startGameSound == 1 || startGameSound < -8) && (BTN_UP_REPEAT || RIGHT_STICK_UP))
{
if(m_gameSoundThread != LWP_THREAD_NULL)
CheckGameSoundThread();
m_cf.up();
CoverFlow.up();
startGameSound = -10;
}
if((startGameSound == 1 || startGameSound < -8) && (BTN_RIGHT_REPEAT || RIGHT_STICK_RIGHT))
{
if(m_gameSoundThread != LWP_THREAD_NULL)
CheckGameSoundThread();
m_cf.right();
CoverFlow.right();
startGameSound = -10;
}
if((startGameSound == 1 || startGameSound < -8) && (BTN_DOWN_REPEAT || RIGHT_STICK_DOWN))
{
if(m_gameSoundThread != LWP_THREAD_NULL)
CheckGameSoundThread();
m_cf.down();
CoverFlow.down();
startGameSound = -10;
}
if((startGameSound == 1 || startGameSound < -8) && (BTN_LEFT_REPEAT || RIGHT_STICK_LEFT))
{
if(m_gameSoundThread != LWP_THREAD_NULL)
CheckGameSoundThread();
m_cf.left();
CoverFlow.left();
startGameSound = -10;
}
if(startGameSound == -10)
@ -687,7 +687,7 @@ void CMenu::_game(bool launch)
m_btnMgr.hide(m_gameBtnPlayFull);
m_btnMgr.hide(m_gameBtnBackFull);
m_btnMgr.hide(m_gameBtnToogleFull);
if(m_gameLblUser[4] != -1 && !NoGameID(m_cf.getHdr()->type))
if(m_gameLblUser[4] != -1 && !NoGameID(CoverFlow.getHdr()->type))
m_btnMgr.show(m_gameLblUser[4]);
for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser) - 1; ++i)
{
@ -701,7 +701,7 @@ void CMenu::_game(bool launch)
m_btnMgr.hide(b ? m_gameBtnAdultOff : m_gameBtnAdultOn);
m_btnMgr.show(m_gameBtnSettings);
}
if ((m_cf.getHdr()->type != TYPE_HOMEBREW && m_cf.getHdr()->type != TYPE_CHANNEL) && !m_locked)
if ((CoverFlow.getHdr()->type != TYPE_HOMEBREW && CoverFlow.getHdr()->type != TYPE_CHANNEL) && !m_locked)
m_btnMgr.show(m_gameBtnDelete);
}
else
@ -723,7 +723,7 @@ void CMenu::_game(bool launch)
m_btnMgr.hide(m_gameBtnToogle);
if(m_gameLblUser[4] != -1)
{
if(!NoGameID(m_cf.getHdr()->type) && !m_zoom_banner)
if(!NoGameID(CoverFlow.getHdr()->type) && !m_zoom_banner)
m_btnMgr.show(m_gameLblUser[4]);
else
m_btnMgr.hide(m_gameLblUser[4], true);
@ -1408,7 +1408,7 @@ void CMenu::_initGameMenu()
_addUserLabels(m_gameLblUser, ARRAY_SIZE(m_gameLblUser), "GAME");
m_gameBg = _texture("GAME/BG", "texture", theme.bg, false);
if (m_theme.loaded() && STexture::TE_OK == bgLQ.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), m_theme.getString("GAME/BG", "texture").c_str()), GX_TF_CMPR, 64, 64))
if(m_theme.loaded() && bgLQ.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), m_theme.getString("GAME/BG", "texture").c_str()), GX_TF_CMPR, 64, 64) == TE_OK)
m_gameBgLQ = bgLQ;
m_gameBtnPlay = _addButton("GAME/PLAY_BTN", theme.btnFont, L"", 420, 344, 200, 56, theme.btnFontColor);
@ -1468,7 +1468,7 @@ void CMenu::_gameSoundThread(CMenu *m)
m->m_gamesound_changed = false;
CurrentBanner.ClearBanner();
dir_discHdr *GameHdr = m->m_cf.getHdr();
dir_discHdr *GameHdr = CoverFlow.getHdr();
if(GameHdr->type == TYPE_PLUGIN)
{
m_banner.DeleteBanner();

View File

@ -318,7 +318,7 @@ void CMenu::_textGameInfo(void)
{
char GameID[7];
GameID[6] = '\0';
strncpy(GameID, m_cf.getId().c_str(), 6);
strncpy(GameID, CoverFlow.getId().c_str(), 6);
if(gametdb.GetTitle(GameID, TMP_Char))
{
gameinfo_Title_w.fromUTF8(TMP_Char);

View File

@ -55,7 +55,7 @@ bool CMenu::_Home(void)
}
else if(m_btnMgr.selected(m_homeBtnUpdate) && !m_locked)
{
m_cf.stopCoverLoader(true);
CoverFlow.stopCoverLoader(true);
_hideHome();
_system();
remove(m_ver.c_str());
@ -65,7 +65,7 @@ bool CMenu::_Home(void)
break;
}
_showHome();
m_cf.startCoverLoader();
CoverFlow.startCoverLoader();
}
else if(m_btnMgr.selected(m_homeBtnHelp))
{

View File

@ -478,16 +478,16 @@ void CMenu::_getGrabStatus(void)
gGrabStatus[chan] = GBTN_B & PAD_ButtonsHeld(chan);
if((wGrabStatus[chan] && wX[chan] > 0 && wd[chan]->ir.x < wX[chan] - 30)
|| (gGrabStatus[chan] && gX[chan] > 0 && stickPointer_x[chan] < gX[chan]))
m_cf.left();
CoverFlow.left();
if((wGrabStatus[chan] && wX[chan] > 0 && wd[chan]->ir.x > wX[chan] + 30)
|| (gGrabStatus[chan] && gX[chan] > 0 && stickPointer_x[chan] > gX[chan]))
m_cf.right();
CoverFlow.right();
if((wGrabStatus[chan] && wY[chan] > 0 && wd[chan]->ir.y < wY[chan] - 30)
|| (gGrabStatus[chan] && gY[chan] > 0 && stickPointer_y[chan] < gY[chan]))
m_cf.up();
CoverFlow.up();
if((wGrabStatus[chan] && wY[chan] > 0 && wd[chan]->ir.y > wY[chan] + 30)
|| (gGrabStatus[chan] && gY[chan] > 0 && stickPointer_y[chan] > gY[chan]))
m_cf.down();
CoverFlow.down();
if(wGrabStatus[chan])
{
wX[chan] = wd[chan]->ir.x;

View File

@ -181,9 +181,9 @@ void CMenu::_showMain(void)
void CMenu::LoadView(void)
{
m_curGameId = m_cf.getId();
m_curGameId = CoverFlow.getId();
_hideMain(true);
m_cf.clear();
CoverFlow.clear();
if(!m_vid.showingWaitMessage())
_showWaitMessage();
m_favorites = false;
@ -193,7 +193,7 @@ void CMenu::LoadView(void)
_showMain();
_initCF();
_loadCFLayout(m_cfg.getInt(_domainFromView(), "last_cf_mode", 1));
m_cf.applySettings();
CoverFlow.applySettings();
char *mode = (m_current_view == COVERFLOW_CHANNEL && m_cfg.getBool(CHANNEL_DOMAIN, "disable", true))
? (char *)CHANNEL_DOMAIN : (char *)DeviceName[currentPartition];
@ -325,9 +325,9 @@ int CMenu::main(void)
else if(BTN_A_PRESSED)
{
if(m_btnMgr.selected(m_mainBtnPrev))
m_cf.pageUp();
CoverFlow.pageUp();
else if(m_btnMgr.selected(m_mainBtnNext))
m_cf.pageDown();
CoverFlow.pageDown();
else if(m_btnMgr.selected(m_mainBtnQuit))
{
_hideMain();
@ -405,7 +405,7 @@ int CMenu::main(void)
{
/* Cleanup for Disc Booter */
_hideMain(true);
m_cf.clear();
CoverFlow.clear();
_showWaitMessage();
m_gameSound.Stop();
CheckGameSoundThread();
@ -424,10 +424,10 @@ int CMenu::main(void)
{
m_favorites = !m_favorites;
m_cfg.setBool(_domainFromView(), "favorites", m_favorites);
m_curGameId = m_cf.getId();
m_curGameId = CoverFlow.getId();
_initCF();
}
else if(!m_cf.empty() && m_cf.select())
else if(!CoverFlow.empty() && CoverFlow.select())
{
_hideMain();
_game(BTN_B_HELD);
@ -435,7 +435,7 @@ int CMenu::main(void)
break;
if(BTN_B_HELD)
bUsed = true;
m_cf.cancel();
CoverFlow.cancel();
_showMain();
}
}
@ -482,11 +482,11 @@ int CMenu::main(void)
int sorting = m_cfg.getInt(domain, "sort", SORT_ALPHA);
if (sorting != SORT_ALPHA && sorting != SORT_PLAYERS && sorting != SORT_WIFIPLAYERS && sorting != SORT_GAMEID)
{
m_cf.setSorting((Sorting)SORT_ALPHA);
CoverFlow.setSorting((Sorting)SORT_ALPHA);
m_cfg.setInt(domain, "sort", SORT_ALPHA);
}
wchar_t c[2] = {0, 0};
m_btnMgr.selected(m_mainBtnPrev) ? m_cf.prevLetter(c) : m_cf.nextLetter(c);
m_btnMgr.selected(m_mainBtnPrev) ? CoverFlow.prevLetter(c) : CoverFlow.nextLetter(c);
m_showtimer = 60;
curLetter.clear();
curLetter = wstringEx(c);
@ -506,24 +506,24 @@ int CMenu::main(void)
}
else if(WROLL_LEFT)
{
m_cf.left();
CoverFlow.left();
bUsed = true;
}
else if(WROLL_RIGHT)
{
m_cf.right();
CoverFlow.right();
bUsed = true;
}
if(!BTN_B_HELD)
{
if(BTN_UP_REPEAT || RIGHT_STICK_UP)
m_cf.up();
CoverFlow.up();
else if(BTN_RIGHT_REPEAT || RIGHT_STICK_RIGHT)
m_cf.right();
CoverFlow.right();
else if(BTN_DOWN_REPEAT || RIGHT_STICK_DOWN)
m_cf.down();
CoverFlow.down();
else if(BTN_LEFT_REPEAT || RIGHT_STICK_LEFT)
m_cf.left();
CoverFlow.left();
else if(BTN_1_PRESSED || BTN_2_PRESSED)
{
if (!m_btnMgr.selected(m_mainBtnQuit))
@ -532,7 +532,7 @@ int CMenu::main(void)
s8 direction = BTN_1_PRESSED ? 1 : -1;
int cfVersion = 1+loopNum((m_cfg.getInt(domain, "last_cf_mode", 1)-1) + direction, m_numCFVersions);
_loadCFLayout(cfVersion);
m_cf.applySettings();
CoverFlow.applySettings();
m_cfg.setInt(domain, "last_cf_mode", cfVersion);
}
}
@ -541,14 +541,14 @@ int CMenu::main(void)
if(b_lr_mode)
MusicPlayer.Previous();
else
m_cf.pageUp();
CoverFlow.pageUp();
}
else if(BTN_PLUS_PRESSED)
{
if(b_lr_mode)
MusicPlayer.Next();
else
m_cf.pageDown();
CoverFlow.pageDown();
}
}
else
@ -562,11 +562,11 @@ int CMenu::main(void)
int sorting = m_cfg.getInt(domain, "sort", SORT_ALPHA);
if(sorting != SORT_ALPHA && sorting != SORT_PLAYERS && sorting != SORT_WIFIPLAYERS && sorting != SORT_GAMEID)
{
m_cf.setSorting((Sorting)SORT_ALPHA);
CoverFlow.setSorting((Sorting)SORT_ALPHA);
m_cfg.setInt(domain, "sort", SORT_ALPHA);
}
wchar_t c[2] = {0, 0};
BTN_UP_PRESSED ? m_cf.prevLetter(c) : m_cf.nextLetter(c);
BTN_UP_PRESSED ? CoverFlow.prevLetter(c) : CoverFlow.nextLetter(c);
curLetter.clear();
curLetter = wstringEx(c);
@ -588,7 +588,7 @@ int CMenu::main(void)
{
bUsed = true;
if(b_lr_mode)
m_cf.pageUp();
CoverFlow.pageUp();
else
MusicPlayer.Previous();
}
@ -596,7 +596,7 @@ int CMenu::main(void)
{
bUsed = true;
if(b_lr_mode)
m_cf.pageDown();
CoverFlow.pageDown();
else
MusicPlayer.Next();
}
@ -605,7 +605,7 @@ int CMenu::main(void)
bUsed = true;
u32 sort = 0;
sort = loopNum((m_cfg.getInt(domain, "sort", 0)) + 1, SORT_MAX - 1);
m_cf.setSorting((Sorting)sort);
CoverFlow.setSorting((Sorting)sort);
m_cfg.setInt(domain, "sort", sort);
wstringEx curSort ;
if(sort == SORT_ALPHA)
@ -802,15 +802,15 @@ int CMenu::main(void)
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
{
if(WPadIR_Valid(chan) || (m_show_pointer[chan] && !WPadIR_Valid(chan)))
m_cf.mouse(m_vid, chan, m_cursor[chan].x(), m_cursor[chan].y());
CoverFlow.mouse(chan, m_cursor[chan].x(), m_cursor[chan].y());
else
m_cf.mouse(m_vid, chan, -1, -1);
CoverFlow.mouse(chan, -1, -1);
}
}
ScanInput();
if(m_reload || BTN_B_HELD)
{
m_cf.clear();
CoverFlow.clear();
_showWaitMessage();
exitHandler(PRIILOADER_DEF); //Making wiiflow ready to boot something
_launchHomebrew(fmt("%s/boot.dol", m_appDir.c_str()), m_homebrewArgs);
@ -861,7 +861,7 @@ void CMenu::_initMainMenu()
STexture emptyTex;
m_mainBg = _texture("MAIN/BG", "texture", theme.bg, false);
if (m_theme.loaded() && STexture::TE_OK == bgLQ.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), m_theme.getString("MAIN/BG", "texture").c_str()), GX_TF_CMPR, 64, 64))
if(m_theme.loaded() && bgLQ.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), m_theme.getString("MAIN/BG", "texture").c_str()), GX_TF_CMPR, 64, 64) == TE_OK)
m_mainBgLQ = bgLQ;
texQuit.fromPNG(btnquit_png);

View File

@ -103,28 +103,23 @@ void CMenu::_updateSourceBtns(void)
string ImgName;
u8 j = (Source_curPage - 1) * 12;
for (u8 i = 0; i < 12; ++i)
for(u8 i = 0; i < 12; ++i)
{
STexture texConsoleImg;
STexture texConsoleImgs;
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image", "");
if(!STexture::TE_OK == texConsoleImg.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), ImgName.c_str())))
if(texConsoleImg.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), ImgName.c_str())) != TE_OK)
{
if(!STexture::TE_OK == texConsoleImg.fromImageFile(fmt("%s/%s", m_sourceDir.c_str(), ImgName.c_str())))
{
if(texConsoleImg.fromImageFile(fmt("%s/%s", m_sourceDir.c_str(), ImgName.c_str())) != TE_OK)
texConsoleImg.fromPNG(favoriteson_png);
}
}
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image_s", "");
if(!STexture::TE_OK == texConsoleImgs.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), ImgName.c_str())))
if(texConsoleImgs.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), ImgName.c_str())) != TE_OK)
{
if(!STexture::TE_OK == texConsoleImgs.fromImageFile(fmt("%s/%s", m_sourceDir.c_str(), ImgName.c_str())))
{
if(texConsoleImgs.fromImageFile(fmt("%s/%s", m_sourceDir.c_str(), ImgName.c_str())) != TE_OK)
texConsoleImgs.fromPNG(favoritesons_png);
}
}
m_btnMgr.setBtnTexture(m_sourceBtnSource[i], texConsoleImg, texConsoleImgs);
string source = m_source.getString(fmt("BUTTON_%i", i + j), "source", "");
@ -426,26 +421,22 @@ void CMenu::_initSourceMenu()
int col;
string ImgName;
for ( int i = 0; i < 12; ++i)
for(u8 i = 0; i < 12; ++i)
{
STexture texConsoleImg;
STexture texConsoleImgs;
ImgName = m_source.getString(fmt("BUTTON_%i", i),"image", "");
if(!STexture::TE_OK == texConsoleImg.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), ImgName.c_str())))
if(texConsoleImg.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), ImgName.c_str())) != TE_OK)
{
if(!STexture::TE_OK == texConsoleImg.fromImageFile(fmt("%s/%s", m_sourceDir.c_str(), ImgName.c_str())))
{
if(texConsoleImg.fromImageFile(fmt("%s/%s", m_sourceDir.c_str(), ImgName.c_str())) != TE_OK)
texConsoleImg.fromPNG(favoriteson_png);
}
}
ImgName = m_source.getString(fmt("BUTTON_%i", i),"image_s", "");
if(!STexture::TE_OK == texConsoleImgs.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), ImgName.c_str())))
if(texConsoleImgs.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), ImgName.c_str())) != TE_OK)
{
if(!STexture::TE_OK == texConsoleImgs.fromImageFile(fmt("%s/%s", m_sourceDir.c_str(), ImgName.c_str())))
{
if(texConsoleImgs.fromImageFile(fmt("%s/%s", m_sourceDir.c_str(), ImgName.c_str())) != TE_OK)
texConsoleImgs.fromPNG(favoritesons_png);
}
}
row = i / 4;

View File

@ -227,7 +227,7 @@ int CMenu::_GCcopyGame(void *obj)
{
CMenu &m = *(CMenu *)obj;
string GC_Path(m.m_cf.getHdr()->path);
string GC_Path(CoverFlow.getHdr()->path);
if(strcasestr(GC_Path.c_str(), "boot.bin") != NULL)
GC_Path.erase(GC_Path.end() - 13, GC_Path.end());
else
@ -274,7 +274,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
bool upd_dml = false;
bool upd_emu = false;
bool out = false;
string cfPos = m_cf.getNextId();
string cfPos = CoverFlow.getNextId();
SetupInput();
_showWBFS(op);
@ -284,7 +284,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
m_btnMgr.setText(m_wbfsLblDialog, _t("wbfsadddlg", L"Please insert the disc you want to copy, then click on Go."));
break;
case CMenu::WO_REMOVE_GAME:
m_btnMgr.setText(m_wbfsLblDialog, wfmt(_fmt("wbfsremdlg", L"To permanently remove the game: %s, click on Go."), (u8*)m_cf.getTitle().toUTF8().c_str()));
m_btnMgr.setText(m_wbfsLblDialog, wfmt(_fmt("wbfsremdlg", L"To permanently remove the game: %s, click on Go."), (u8*)CoverFlow.getTitle().toUTF8().c_str()));
break;
case CMenu::WO_FORMAT:
break;
@ -377,30 +377,30 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
}
break;
case CMenu::WO_REMOVE_GAME:
if(m_cf.getHdr()->type == TYPE_GC_GAME)
if(CoverFlow.getHdr()->type == TYPE_GC_GAME)
{
if(strcasestr(m_cf.getHdr()->path, "boot.bin") != NULL)
if(strcasestr(CoverFlow.getHdr()->path, "boot.bin") != NULL)
{
string GC_Path(m_cf.getHdr()->path);
string GC_Path(CoverFlow.getHdr()->path);
GC_Path.erase(GC_Path.end() - 13, GC_Path.end());
fsop_deleteFolder(GC_Path.c_str());
}
else
fsop_deleteFile(m_cf.getHdr()->path);
fsop_deleteFile(CoverFlow.getHdr()->path);
upd_dml = true;
}
else if(m_cf.getHdr()->type == TYPE_PLUGIN)
else if(CoverFlow.getHdr()->type == TYPE_PLUGIN)
{
fsop_deleteFile(m_cf.getHdr()->path);
fsop_deleteFile(CoverFlow.getHdr()->path);
upd_emu = true;
}
else if(m_cf.getHdr()->type == TYPE_WII_GAME)
else if(CoverFlow.getHdr()->type == TYPE_WII_GAME)
{
WBFS_RemoveGame((u8 *)m_cf.getId().c_str(), m_cf.getHdr()->path);
WBFS_RemoveGame((u8 *)CoverFlow.getId().c_str(), CoverFlow.getHdr()->path);
upd_usb = true;
}
if(m_cfg.getBool("GENERAL", "delete_cover_and_game", false))
RemoveCover(m_cf.getId().c_str());
RemoveCover(CoverFlow.getId().c_str());
m_btnMgr.show(m_wbfsPBar);
m_btnMgr.setProgress(m_wbfsPBar, 0.f, true);
m_btnMgr.setProgress(m_wbfsPBar, 1.f);
@ -413,7 +413,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
case CMenu::WO_FORMAT:
break;
case CMenu::WO_COPY_GAME:
string GC_Path(m_cf.getHdr()->path);
string GC_Path(CoverFlow.getHdr()->path);
if(strcasestr(GC_Path.c_str(), "boot.bin") != NULL)
GC_Path.erase(GC_Path.end() - 13, GC_Path.end());
else
@ -430,8 +430,8 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
m_btnMgr.hide(m_wbfsBtnBack);
m_btnMgr.show(m_wbfsLblMessage);
m_btnMgr.setText(m_wbfsLblMessage, L"");
cfPos = string(m_cf.getHdr()->id);
m_btnMgr.setText(m_wbfsLblDialog, wfmt(_fmt("wbfsop10", L"Copying [%s] %s..."), m_cf.getHdr()->id, m_cf.getTitle().toUTF8().c_str()));
cfPos = string(CoverFlow.getHdr()->id);
m_btnMgr.setText(m_wbfsLblDialog, wfmt(_fmt("wbfsop10", L"Copying [%s] %s..."), CoverFlow.getHdr()->id, CoverFlow.getTitle().toUTF8().c_str()));
done = true;
upd_dml = true;
m_thrdWorking = true;
@ -481,7 +481,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
_loadList();
_initCF();
m_cf.findId(cfPos.c_str(), true);
CoverFlow.findId(cfPos.c_str(), true);
}
else if(done && op == CMenu::WO_COPY_GAME)
{