-huge code cleanup

-fixed some fatal theme memory management bugs
-fixed some cover loading memory management bugs
-speed up thp trailer playback
This commit is contained in:
fix94.1 2012-11-03 19:16:03 +00:00
parent edc886ecdc
commit 9665ea5dc7
45 changed files with 1443 additions and 1420 deletions

View File

@ -31,12 +31,11 @@
#include <stdio.h>
#include <ogc/conf.h>
#include <ogc/isfs.h>
#include <malloc.h>
#include "banner.h"
#include "MD5.h"
#include "gecko/gecko.h"
#include "loader/fs.h"
#include "memory/smartptr.hpp"
#include "unzip/U8Archive.h"
#define IMET_OFFSET 0x40

View File

@ -31,8 +31,6 @@
#include <vector>
#include <string>
#include "memory/smartptr.hpp"
#include "banner.h"
#define IMET_MAX_NAME_LEN 0x2a

View File

@ -27,10 +27,9 @@
***************************************************************************/
#include <unistd.h>
#include <asndlib.h>
#include <malloc.h>
#include "WiiMovie.hpp"
#include "gecko/gecko.h"
#include "memory/mem2.hpp"
#define SND_BUFFERS 8
#define FRAME_BUFFERS 8
@ -86,7 +85,7 @@ WiiMovie::WiiMovie(const char * filepath)
WiiMovie::~WiiMovie()
{
gprintf("Destructing WiiMovie object\n");
Playing = true;
Playing = false;
ExitRequested = true;
Stop();
@ -310,9 +309,7 @@ void WiiMovie::ReadNextFrame()
void WiiMovie::LoadNextFrame()
{
if(!Video || !Playing)
{
return;
}
VideoFrame VideoF;
LWP_MutexLock(mutex);
@ -336,14 +333,15 @@ void WiiMovie::LoadNextFrame()
}
STexture frame;
if (frame.fromRAW(VideoF.getData(), VideoF.getWidth(), VideoF.getHeight()) == STexture::TE_OK)
if(frame.fromTHP(VideoF.getData(), VideoF.getWidth(), VideoF.getHeight()) == STexture::TE_OK)
Frames.push_back(frame);
VideoF.dealloc();
}
bool WiiMovie::GetNextFrame(STexture *tex)
{
if (!Video || Frames.size() == 0) return false;
if(!Video || !Playing || Frames.size() == 0)
return false;
*tex = Frames.at(0);
Frames.erase(Frames.begin());
return true;

View File

@ -15,6 +15,7 @@
#include "fonts.h"
#include "types.h"
#include "gecko/gecko.h"
#include "memory/mem2.hpp"
#include "wstringEx/wstringEx.hpp"
extern const u8 dvdskin_jpg[];
@ -228,7 +229,7 @@ CCoverFlow::CCoverFlow(void)
LWP_MutexInit(&m_mutex, 0);
}
bool CCoverFlow::init(u8 *font, u32 font_size, bool vid_50hz)
bool CCoverFlow::init(const u8 *font, const u32 font_size, bool vid_50hz)
{
// Load font
m_font.fromBuffer(font, font_size, TITLEFONT);
@ -261,12 +262,14 @@ void CCoverFlow::simulateOtherScreenFormat(bool s)
CCoverFlow::~CCoverFlow(void)
{
clear();
/* for(u8 i = 0; i < 4; i++) */
if(m_sound[0].get())
m_sound[0].release();
m_hoverSound.release();
m_selectSound.release();
m_cancelSound.release();
if(m_sound[0])
delete m_sound[0];
if(m_hoverSound)
delete m_hoverSound;
if(m_selectSound)
delete m_selectSound;
if(m_cancelSound)
delete m_cancelSound;
LWP_MutexDestroy(m_mutex);
}
@ -320,9 +323,11 @@ void CCoverFlow::setTextures(const string &loadingPic, const string &loadingPicF
m_pngNoCoverFlat = noCoverPicFlat;
}
void CCoverFlow::setFont(SFont font, const CColor &color)
void CCoverFlow::setFont(const SFont &font, const CColor &color)
{
if (!!font.data) m_font = font;
if(m_font.font != NULL)
delete m_font.font;
m_font = font;
m_fontColor = color;
if (!m_covers.empty())
{
@ -563,22 +568,24 @@ void CCoverFlow::setBlur(u32 blurResolution, u32 blurRadius, float blurFactor)
u32 i = min(max(0u, blurResolution), sizeof blurRes / sizeof blurRes[0] - 1u);
m_effectTex.width = blurRes[i].x;
m_effectTex.height = blurRes[i].y;
if(m_effectTex.data.get())
m_effectTex.data.release();
if(m_effectTex.data != NULL)
{
free(m_effectTex.data);
m_effectTex.data = NULL;
}
m_blurRadius = min(max(1u, blurRadius), 3u);
m_blurFactor = min(max(1.f, blurFactor), 2.f);
}
bool CCoverFlow::setSorting(Sorting sorting)
void CCoverFlow::setSorting(Sorting sorting)
{
m_sorting = sorting;
return start();
}
void CCoverFlow::setSounds(const SmartGuiSound &sound, const SmartGuiSound &hoverSound, const SmartGuiSound &selectSound, const SmartGuiSound &cancelSound)
void CCoverFlow::setSounds(GuiSound *sound, GuiSound *hoverSound, GuiSound *selectSound, GuiSound *cancelSound)
{
for(u8 i = 0; i < 4; i++)
m_sound[i] = sound;
//for(u8 i = 0; i < 4; i++)
m_sound[0] = sound;
m_hoverSound = hoverSound;
m_selectSound = selectSound;
m_cancelSound = cancelSound;
@ -589,13 +596,15 @@ void CCoverFlow::setSoundVolume(u8 vol)
m_soundVolume = vol;
}
void CCoverFlow::_stopSound(SmartGuiSound snd)
void CCoverFlow::_stopSound(GuiSound *snd)
{
if(snd == NULL) return;
snd->Stop();
}
void CCoverFlow::_playSound(SmartGuiSound snd)
void CCoverFlow::_playSound(GuiSound *snd)
{
if(snd == NULL) return;
snd->Play(m_soundVolume);
}
@ -603,7 +612,6 @@ void CCoverFlow::stopSound(void)
{
for(u8 i = 0; i < 4; i++)
_stopSound(m_sound[i]);
_stopSound(m_hoverSound);
}
@ -629,11 +637,10 @@ void CCoverFlow::stopCoverLoader(bool empty)
if(empty)
{
for (u32 i = 0; i < m_items.size(); ++i)
for(u32 i = 0; i < m_items.size(); ++i)
{
if(m_items[i].texture.data.get())
m_items[i].texture.data.release();
m_items[i].state = CCoverFlow::STATE_Loading;
m_items[i].texture.Cleanup();
m_items[i].state = STATE_Loading;
}
}
//gprintf("Coverflow stopped!\n");
@ -665,20 +672,26 @@ void CCoverFlow::shutdown(void)
gprintf("Cleanup Coverflow\n");
clear();
m_dvdSkin.data.release();
m_dvdSkin_Red.data.release();
m_dvdSkin_Black.data.release();
m_dvdSkin_Yellow.data.release();
m_dvdSkin_GreenOne.data.release();
m_dvdSkin_GreenTwo.data.release();
m_dvdSkin.Cleanup();
m_dvdSkin_Red.Cleanup();
m_dvdSkin_Black.Cleanup();
m_dvdSkin_Yellow.Cleanup();
m_dvdSkin_GreenOne.Cleanup();
m_dvdSkin_GreenTwo.Cleanup();
m_loadingTexture.Cleanup();
m_noCoverTexture.Cleanup();
for(u8 i = 0; i < 4; i++)
{
if(m_sound[i].get())
m_sound[i].release();
if(m_sound[i] != NULL)
delete m_sound[i];
m_sound[i] = NULL;
}
m_hoverSound.release();
m_selectSound.release();
m_cancelSound.release();
if(m_hoverSound != NULL) delete m_hoverSound;
m_hoverSound = NULL;
if(m_selectSound) delete m_selectSound;
m_selectSound = NULL;
if(m_cancelSound) delete m_cancelSound;
m_cancelSound = NULL;
LWP_MutexDestroy(m_mutex);
}
@ -743,7 +756,7 @@ void CCoverFlow::_effectBg(const STexture &tex)
GX_SetZMode(GX_DISABLE, GX_ALWAYS, GX_FALSE);
guMtxIdentity(modelViewMtx);
GX_LoadPosMtxImm(modelViewMtx, GX_PNMTX0);
GX_InitTexObj(&texObj, tex.data.get(), tex.width, tex.height, tex.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
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_Position3f32(0.f, 0.f, 0.f);
@ -783,7 +796,7 @@ void CCoverFlow::_effectBlur(CVideo &vid, bool vertical)
GX_SetPixelFmt(GX_PF_RGBA6_Z24, GX_ZC_LINEAR);
GX_InvVtxCache();
GX_InvalidateTexAll();
GX_InitTexObj(&texObj, m_effectTex.data.get(), m_effectTex.width, m_effectTex.height, m_effectTex.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj, m_effectTex.data, m_effectTex.width, m_effectTex.height, m_effectTex.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_LoadTexObj(&texObj, GX_TEXMAP0);
GX_SetNumTevStages(kSize);
GX_SetNumTexGens(kSize);
@ -964,7 +977,7 @@ void CCoverFlow::drawEffect(void)
GX_SetZMode(GX_ENABLE, GX_LEQUAL, GX_FALSE);
guMtxIdentity(modelViewMtx);
GX_LoadPosMtxImm(modelViewMtx, GX_PNMTX0);
GX_InitTexObj(&texObj, m_effectTex.data.get(), m_effectTex.width, m_effectTex.height, m_effectTex.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj, m_effectTex.data, m_effectTex.width, m_effectTex.height, m_effectTex.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_LoadTexObj(&texObj, GX_TEXMAP0);
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
GX_Position3f32(x, y, -999.f);
@ -1287,8 +1300,8 @@ void CCoverFlow::_drawCover(int i, bool mirror, CCoverFlow::DrawMode dm)
STexture &CCoverFlow::_coverTexture(int i)
{
if (!m_items[i].texture.data)
return m_items[i].state == CCoverFlow::STATE_Loading ? m_loadingTexture : m_noCoverTexture;
if(m_items[i].texture.data == NULL)
return (m_items[i].state == STATE_Loading) ? m_loadingTexture : m_noCoverTexture;
return m_items[i].texture;
}
@ -1322,7 +1335,7 @@ void CCoverFlow::_drawCoverFlat(int i, bool mirror, CCoverFlow::DrawMode dm)
}
if (dm == CCoverFlow::CFDR_NORMAL)
{
GX_InitTexObj(&texObj, tex.data.get(), tex.width, tex.height, tex.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj, tex.data, tex.width, tex.height, tex.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
if (tex.maxLOD > 0)
GX_InitTexObjLOD(&texObj, GX_LIN_MIP_LIN, GX_LINEAR, 0.f, (float)tex.maxLOD, mirror ? 1.f : m_lodBias, GX_FALSE, m_edgeLOD ? GX_TRUE : GX_FALSE, m_aniso);
GX_LoadTexObj(&texObj, GX_TEXMAP0);
@ -1384,46 +1397,46 @@ void CCoverFlow::_drawCoverBox(int i, bool mirror, CCoverFlow::DrawMode dm)
u32 casecolor = m_items[m_covers[i].index].hdr->casecolor;
// set dvd box texture, depending on game
if(casecolor == 0xFFFFFF)
GX_InitTexObj(&texObj, m_dvdSkin.data.get(), m_dvdSkin.width, m_dvdSkin.height, m_dvdSkin.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj, m_dvdSkin.data, m_dvdSkin.width, m_dvdSkin.height, m_dvdSkin.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
else if (casecolor == 0xFF0000)
GX_InitTexObj(&texObj, m_dvdSkin_Red.data.get(), m_dvdSkin_Red.width, m_dvdSkin_Red.height, m_dvdSkin_Red.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj, m_dvdSkin_Red.data, m_dvdSkin_Red.width, m_dvdSkin_Red.height, m_dvdSkin_Red.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
else if (casecolor == 0x000000 || casecolor == 0x181919)
GX_InitTexObj(&texObj, m_dvdSkin_Black.data.get(), m_dvdSkin_Black.width, m_dvdSkin_Black.height, m_dvdSkin_Black.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj, m_dvdSkin_Black.data, m_dvdSkin_Black.width, m_dvdSkin_Black.height, m_dvdSkin_Black.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
else if (casecolor == 0xFCFF00)
GX_InitTexObj(&texObj, m_dvdSkin_Yellow.data.get(), m_dvdSkin_Yellow.width, m_dvdSkin_Yellow.height, m_dvdSkin_Yellow.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj, m_dvdSkin_Yellow.data, m_dvdSkin_Yellow.width, m_dvdSkin_Yellow.height, m_dvdSkin_Yellow.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
else if (casecolor == 0x01A300)
GX_InitTexObj(&texObj, m_dvdSkin_GreenOne.data.get(), m_dvdSkin_GreenOne.width, m_dvdSkin_GreenOne.height, m_dvdSkin_GreenOne.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj, m_dvdSkin_GreenOne.data, m_dvdSkin_GreenOne.width, m_dvdSkin_GreenOne.height, m_dvdSkin_GreenOne.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
else if (casecolor == 0x00E360)
GX_InitTexObj(&texObj, m_dvdSkin_GreenTwo.data.get(), m_dvdSkin_GreenTwo.width, m_dvdSkin_GreenTwo.height, m_dvdSkin_GreenTwo.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj, m_dvdSkin_GreenTwo.data, m_dvdSkin_GreenTwo.width, m_dvdSkin_GreenTwo.height, m_dvdSkin_GreenTwo.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
else if(_checkCoverColor((char *)m_items[m_covers[i].index].hdr->id,red,red_len))
{
m_items[m_covers[i].index].hdr->casecolor = 0xFF0000;
GX_InitTexObj(&texObj, m_dvdSkin_Red.data.get(), m_dvdSkin_Red.width, m_dvdSkin_Red.height, m_dvdSkin_Red.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj, m_dvdSkin_Red.data, m_dvdSkin_Red.width, m_dvdSkin_Red.height, m_dvdSkin_Red.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
}
else if(_checkCoverColor((char *)m_items[m_covers[i].index].hdr->id,black,black_len))
{
m_items[m_covers[i].index].hdr->casecolor = 0x000000;
GX_InitTexObj(&texObj, m_dvdSkin_Black.data.get(), m_dvdSkin_Black.width, m_dvdSkin_Black.height, m_dvdSkin_Black.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj, m_dvdSkin_Black.data, m_dvdSkin_Black.width, m_dvdSkin_Black.height, m_dvdSkin_Black.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
}
else if(_checkCoverColor((char *)m_items[m_covers[i].index].hdr->id,yellow,yellow_len))
{
m_items[m_covers[i].index].hdr->casecolor = 0xFCFF00;
GX_InitTexObj(&texObj, m_dvdSkin_Yellow.data.get(), m_dvdSkin_Yellow.width, m_dvdSkin_Yellow.height, m_dvdSkin_Yellow.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj, m_dvdSkin_Yellow.data, m_dvdSkin_Yellow.width, m_dvdSkin_Yellow.height, m_dvdSkin_Yellow.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
}
else if(_checkCoverColor((char *)m_items[m_covers[i].index].hdr->id,greenOne,greenOne_len))
{
m_items[m_covers[i].index].hdr->casecolor = 0x01A300;
GX_InitTexObj(&texObj, m_dvdSkin_GreenOne.data.get(), m_dvdSkin_GreenOne.width, m_dvdSkin_GreenOne.height, m_dvdSkin_GreenOne.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj, m_dvdSkin_GreenOne.data, m_dvdSkin_GreenOne.width, m_dvdSkin_GreenOne.height, m_dvdSkin_GreenOne.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
}
else if(_checkCoverColor((char *)m_items[m_covers[i].index].hdr->id,greenTwo,greenTwo_len))
{
m_items[m_covers[i].index].hdr->casecolor = 0x00E360;
GX_InitTexObj(&texObj, m_dvdSkin_GreenTwo.data.get(), m_dvdSkin_GreenTwo.width, m_dvdSkin_GreenTwo.height, m_dvdSkin_GreenTwo.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj, m_dvdSkin_GreenTwo.data, m_dvdSkin_GreenTwo.width, m_dvdSkin_GreenTwo.height, m_dvdSkin_GreenTwo.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
}
else
{
m_items[m_covers[i].index].hdr->casecolor = 0xFFFFFF;
GX_InitTexObj(&texObj, m_dvdSkin.data.get(), m_dvdSkin.width, m_dvdSkin.height, m_dvdSkin.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj, m_dvdSkin.data, m_dvdSkin.width, m_dvdSkin.height, m_dvdSkin.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
}
GX_LoadTexObj(&texObj, GX_TEXMAP0);
}
@ -1449,7 +1462,7 @@ void CCoverFlow::_drawCoverBox(int i, bool mirror, CCoverFlow::DrawMode dm)
STexture *myTex = &tex;
if (flatTex)
myTex = &m_noCoverTexture;
GX_InitTexObj(&texObj, myTex->data.get(), myTex->width, myTex->height, myTex->format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj, myTex->data, myTex->width, myTex->height, myTex->format, GX_CLAMP, GX_CLAMP, GX_FALSE);
if (myTex->maxLOD > 0)
GX_InitTexObjLOD(&texObj, GX_LIN_MIP_LIN, GX_LINEAR, 0.f, (float)myTex->maxLOD, mirror ? 1.f : m_lodBias, GX_FALSE, m_edgeLOD ? GX_TRUE : GX_FALSE, m_aniso);
GX_LoadTexObj(&texObj, GX_TEXMAP0);
@ -1464,7 +1477,7 @@ void CCoverFlow::_drawCoverBox(int i, bool mirror, CCoverFlow::DrawMode dm)
GX_End();
if (dm == CCoverFlow::CFDR_NORMAL && flatTex)
{
GX_InitTexObj(&texObj, tex.data.get(), tex.width, tex.height, tex.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj, tex.data, tex.width, tex.height, tex.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
if (tex.maxLOD > 0)
GX_InitTexObjLOD(&texObj, GX_LIN_MIP_LIN, GX_LINEAR, 0.f, (float)tex.maxLOD, mirror ? 1.f : m_lodBias, GX_FALSE, m_edgeLOD ? GX_TRUE : GX_FALSE, m_aniso);
GX_LoadTexObj(&texObj, GX_TEXMAP0);
@ -1851,21 +1864,19 @@ bool CCoverFlow::start(const char *id)
if(m_box)
{
if (m_pngLoadCover.empty() || STexture::TE_OK != m_loadingTexture.fromImageFile(m_pngLoadCover.c_str(), GX_TF_CMPR, ALLOC_MEM2, 32, 512))
if (STexture::TE_OK != m_loadingTexture.fromPNG(loading_png, GX_TF_CMPR, ALLOC_MEM2, 32, 512)) return false;
if (m_pngNoCover.empty() || STexture::TE_OK != m_noCoverTexture.fromImageFile(m_pngNoCover.c_str(), GX_TF_CMPR, ALLOC_MEM2, 32, 512))
if (STexture::TE_OK != m_noCoverTexture.fromPNG(nopic_png, GX_TF_CMPR, ALLOC_MEM2, 32, 512)) return false;
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;
}
else
{
if (m_pngLoadCoverFlat.empty() || STexture::TE_OK != m_loadingTexture.fromImageFile(m_pngLoadCoverFlat.c_str(), GX_TF_CMPR, ALLOC_MEM2, 32, 512))
if (STexture::TE_OK != m_loadingTexture.fromJPG(flatloading_jpg, flatloading_jpg_size, GX_TF_CMPR, ALLOC_MEM2, 32, 512)) return false;
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, ALLOC_MEM2, 32, 512))
if (STexture::TE_OK != m_noCoverTexture.fromPNG(flatnopic_png, GX_TF_CMPR, ALLOC_MEM2, 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;
}
m_covers.clear();
m_covers.resize(m_range);
m_jump = 0;
@ -1920,7 +1931,7 @@ void CCoverFlow::_playSound(void)
{
sndCopyNum++;
if(sndCopyNum == 4) sndCopyNum = 0;
_playSound( m_sound[sndCopyNum] );
_playSound(m_sound[sndCopyNum]);
//gprintf("\n\nPlaying flipsound copy # %u\n\n", sndCopyNum);
}
}
@ -2535,23 +2546,23 @@ bool CCoverFlow::preCacheCover(const char *id, const u8 *png, bool full)
STexture tex;
u8 textureFmt = m_compressTextures ? GX_TF_CMPR : GX_TF_RGB565;
if (STexture::TE_OK != tex.fromPNG(png, textureFmt, ALLOC_MEM2, 32)) return false;
if (STexture::TE_OK != tex.fromPNG(png, textureFmt, 32)) 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;
SmartBuf zBuffer = m_compressCache ? smartMem2Alloc(zBufferSize) : tex.data;
if (!!zBuffer && (!m_compressCache || compress(zBuffer.get(), &zBufferSize, tex.data.get(), bufSize) == Z_OK))
u8 *zBuffer = m_compressCache ? (u8*)MEM2_alloc(zBufferSize) : tex.data;
if (!!zBuffer && (!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)
{
SWFCHeader header(tex, full, m_compressCache);
fwrite(&header, 1, sizeof header, file);
fwrite(zBuffer.get(), 1, zBufferSize, file);
fwrite(zBuffer, 1, zBufferSize, file);
fclose(file);
}
}
tex.Cleanup();
return true;
}
@ -2580,14 +2591,15 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
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, ALLOC_MEM2, 32)) return false;
if (STexture::TE_OK != tex.fromImageFile(path, textureFmt, 32)) return false;
if (!m_loadingCovers) return false;
LWP_MutexLock(m_mutex);
m_items[i].texture.Cleanup();
m_items[i].texture = tex;
m_items[i].boxTexture = box;
m_items[i].state = CCoverFlow::STATE_Ready;
m_items[i].state = STATE_Ready;
LWP_MutexUnlock(m_mutex);
// Save the texture to the cache folder for the next time
@ -2595,8 +2607,8 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
{
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;
SmartBuf zBuffer = m_compressCache ? smartMem2Alloc(zBufferSize) : tex.data;
if (!!zBuffer && (!m_compressCache || compress(zBuffer.get(), &zBufferSize, tex.data.get(), bufSize) == Z_OK))
u8 *zBuffer = m_compressCache ? (u8*)MEM2_alloc(zBufferSize) : tex.data;
if (!!zBuffer && (!m_compressCache || compress(zBuffer, &zBufferSize, tex.data, bufSize) == Z_OK))
{
char gamePath[256];
if(blankBoxCover)
@ -2619,7 +2631,7 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
{
SWFCHeader header(tex, box, m_compressCache);
fwrite(&header, 1, sizeof header, file);
fwrite(zBuffer.get(), 1, zBufferSize, file);
fwrite(zBuffer, 1, zBufferSize, file);
fclose(file);
if (m_deletePicsAfterCaching)
remove(path);
@ -2651,7 +2663,9 @@ void CCoverFlow::_dropHQLOD(int i)
LockMutex lock(m_mutex);
STexture &prevTex = m_items[i].texture;
const STexture &prevTex = m_items[i].texture;
if(prevTex.data == NULL)
return;
STexture newTex;
newTex.maxLOD = prevTex.maxLOD;
@ -2663,12 +2677,13 @@ void CCoverFlow::_dropHQLOD(int i)
u32 prevTexLen = fixGX_GetTexBufferSize(prevTex.width, prevTex.height, prevTex.format, prevTex.maxLOD > 0 ? GX_TRUE : GX_FALSE, prevTex.maxLOD);
u32 newTexLen = fixGX_GetTexBufferSize(newTex.width, newTex.height, newTex.format, newTex.maxLOD > 0 ? GX_TRUE : GX_FALSE, newTex.maxLOD);
newTex.data = smartMem2Alloc(newTexLen);
if (!newTex.data) return;
if (!prevTex.data) return;
memcpy(newTex.data.get(), prevTex.data.get() + (prevTexLen - newTexLen), newTexLen);
DCFlushRange(newTex.data.get(), newTexLen);
prevTex = newTex;
newTex.data = (u8*)MEM2_alloc(newTexLen);
if(newTex.data == NULL)
return;
memcpy(newTex.data, prevTex.data + (prevTexLen - newTexLen), newTexLen);
DCFlushRange(newTex.data, newTexLen);
m_items[i].texture.Cleanup();
m_items[i].texture = newTex;
}
CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blankBoxCover)
@ -2684,9 +2699,9 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank
char gamePath[256];
if(blankBoxCover)
{
string tempName = m_items[i].blankBoxPicPath.c_str();
tempName.assign(&tempName[tempName.find_last_of('/') + 1]);
strncpy(gamePath, tempName.c_str(), sizeof(gamePath));
string tempName = m_items[i].blankBoxPicPath.c_str();
tempName.assign(&tempName[tempName.find_last_of('/') + 1]);
strncpy(gamePath, tempName.c_str(), sizeof(gamePath));
}
else if(NoGameID(m_items[i].hdr->type))
{
@ -2697,17 +2712,17 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank
}
else
strncpy(gamePath, m_items[i].hdr->id, sizeof(gamePath));
FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), gamePath), "rb");
if(file != 0)
FILE *fp = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), gamePath), "rb");
if(fp != NULL)
{
bool success = false;
fseek(file, 0, SEEK_END);
u32 fileSize = ftell(file);
fseek(fp, 0, SEEK_END);
u32 fileSize = ftell(fp);
rewind(fp);
SWFCHeader header;
if(fileSize > sizeof header)
if(fileSize > sizeof(header))
{
fseek(file, 0, SEEK_SET);
fread(&header, 1, sizeof header, file);
fread(&header, 1, sizeof(header), fp);
// Try to find a matching cache file, otherwise try the PNG file, otherwise try again with the cache file with less constraints
if(header.newFmt != 0 && (((!box || header.full != 0) && (header.cmpr != 0) == m_compressTextures) || (!_loadCoverTexPNG(i, box, hq, blankBoxCover))))
{
@ -2718,57 +2733,65 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank
tex.maxLOD = header.maxLOD;
u32 bufSize = fixGX_GetTexBufferSize(tex.width, tex.height, tex.format, tex.maxLOD > 0 ? GX_TRUE : GX_FALSE, tex.maxLOD);
if (!hq) CCoverFlow::_calcTexLQLOD(tex);
if(!hq)
CCoverFlow::_calcTexLQLOD(tex);
u32 texLen = fixGX_GetTexBufferSize(tex.width, tex.height, tex.format, tex.maxLOD > 0 ? GX_TRUE : GX_FALSE, tex.maxLOD);
tex.data = smartMem2Alloc(texLen);
SmartBuf ptrTex = (header.zipped != 0) ? smartMem2Alloc(bufSize) : tex.data;
if (!ptrTex || !tex.data)
tex.data = (u8*)MEM2_alloc(texLen);
u8 *ptrTex = (header.zipped != 0) ? (u8*)MEM2_alloc(bufSize) : tex.data;
if(ptrTex == NULL || tex.data == NULL)
allocFailed = true;
else
{
SmartBuf zBuffer = (header.zipped != 0) ? smartMem2Alloc(fileSize - sizeof header) : ptrTex;
if (!!zBuffer && ((header.zipped != 0) || fileSize - sizeof header == bufSize))
u8 *zBuffer = (header.zipped != 0) ? (u8*)MEM2_alloc(fileSize - sizeof(header)) : tex.data;
if(zBuffer != NULL && ((header.zipped != 0) || fileSize - sizeof(header) == bufSize))
{
if (header.zipped == 0)
if(!header.zipped)
{
fseek(file, fileSize - sizeof header - texLen, SEEK_CUR);
fread(tex.data.get(), 1, texLen, file);
fseek(fp, fileSize - sizeof(header) - texLen, SEEK_CUR);
fread(tex.data, 1, texLen, fp);
}
else
fread(zBuffer.get(), 1, fileSize - sizeof header, file);
fread(zBuffer, 1, fileSize - sizeof(header), fp);
uLongf size = bufSize;
if (header.zipped == 0 || (uncompress(ptrTex.get(), &size, zBuffer.get(), fileSize - sizeof header) == Z_OK && size == bufSize))
if(header.zipped == 0 || (uncompress(ptrTex, &size, zBuffer, fileSize - sizeof(header)) == Z_OK && size == bufSize))
{
if (header.zipped != 0) memcpy(tex.data.get(), ptrTex.get() + bufSize - texLen, texLen);
if(header.zipped != 0)
memcpy(tex.data, ptrTex + bufSize - texLen, texLen);
LockMutex lock(m_mutex);
m_items[i].texture.Cleanup();
m_items[i].texture = tex;
DCFlushRange(tex.data.get(), texLen);
m_items[i].state = CCoverFlow::STATE_Ready;
DCFlushRange(tex.data, texLen);
m_items[i].state = STATE_Ready;
m_items[i].boxTexture = header.full != 0;
success = true;
}
}
if(header.zipped != 0)
{
if(zBuffer != NULL)
free(zBuffer);
if(ptrTex != NULL)
free(ptrTex);
}
}
}
}
//
fclose(file);
fclose(fp);
if(success)
return CCoverFlow::CL_OK;
return CL_OK;
}
}
if(allocFailed)
return CCoverFlow::CL_NOMEM;
return CL_NOMEM;
// If not found, load the PNG
return _loadCoverTexPNG(i, box, hq, blankBoxCover) ? CCoverFlow::CL_OK : CCoverFlow::CL_ERROR;
return _loadCoverTexPNG(i, box, hq, blankBoxCover) ? CL_OK : CL_ERROR;
}
int CCoverFlow::_coverLoader(CCoverFlow *cf)
{
CCoverFlow::CLRet ret;
CLRet ret;
u32 firstItem;
bool update;
u32 i;
@ -2779,36 +2802,34 @@ int CCoverFlow::_coverLoader(CCoverFlow *cf)
{
update = cf->m_moved;
cf->m_moved = false;
for(u32 j = cf->m_items.size(); j >= bufferSize && cf->m_loadingCovers && !cf->m_moved && update; --j)
{
firstItem = cf->m_covers[cf->m_range / 2].index;
i = loopNum((j & 1) ? firstItem - (j + 1) / 2 : firstItem + j / 2, cf->m_items.size());
LWP_MutexLock(cf->m_mutex);
if(cf->m_items[i].texture.data.get())
cf->m_items[i].texture.data.release();
cf->m_items[i].state = CCoverFlow::STATE_Loading;
cf->m_items[i].texture.Cleanup();
cf->m_items[i].state = STATE_Loading;
LWP_MutexUnlock(cf->m_mutex);
}
ret = CCoverFlow::CL_OK;
for(u32 j = 0; j <= bufferSize && cf->m_loadingCovers && !cf->m_moved && update && ret != CCoverFlow::CL_NOMEM; ++j)
ret = CL_OK;
for(u32 j = 0; j <= bufferSize && cf->m_loadingCovers && !cf->m_moved && update && ret != CL_NOMEM; ++j)
{
firstItem = cf->m_covers[cf->m_range / 2].index;
i = loopNum((j & 1) ? firstItem - (j + 1) / 2 : firstItem + j / 2, cf->m_items.size());
if(!cf->m_useHQcover && cf->m_items[i].state != CCoverFlow::STATE_Loading)
if(!cf->m_useHQcover && cf->m_items[i].state != STATE_Loading)
continue;
else if(cf->m_useHQcover && firstItem == (u32)cf->m_hqCover && cf->m_items[i].state != CCoverFlow::STATE_Loading)
else if(cf->m_useHQcover && firstItem == (u32)cf->m_hqCover && cf->m_items[i].state != STATE_Loading)
continue;
if((ret = cf->_loadCoverTex(i, cf->m_box, i == (u32)firstItem, false)) == CCoverFlow::CL_ERROR)
if((ret = cf->_loadCoverTex(i, cf->m_box, i == (u32)firstItem, false)) == CL_ERROR)
{
if ((ret = cf->_loadCoverTex(i, !cf->m_box, i == (u32)firstItem, false)) == CCoverFlow::CL_ERROR)
if ((ret = cf->_loadCoverTex(i, !cf->m_box, i == (u32)firstItem, false)) == CL_ERROR)
{
if((ret = cf->_loadCoverTex(i, cf->m_box, i == (u32)firstItem, true)) == CCoverFlow::CL_ERROR)
cf->m_items[i].state = CCoverFlow::STATE_NoCover;
if((ret = cf->_loadCoverTex(i, cf->m_box, i == (u32)firstItem, true)) == CL_ERROR)
cf->m_items[i].state = STATE_NoCover;
}
}
}
if(ret == CCoverFlow::CL_NOMEM && bufferSize > 3)
if(ret == CL_NOMEM && bufferSize > 3)
bufferSize -= 2;
}
return 0;

View File

@ -16,7 +16,6 @@
#include "config/config.hpp"
#include "loader/disc.h"
#include "loader/utils.h"
#include "memory/smartptr.hpp"
#include "music/gui_sound.h"
using namespace std;
@ -40,7 +39,7 @@ public:
CCoverFlow(void);
~CCoverFlow(void);
//
bool init(u8 *font, u32 font_size, bool vid_50hz);
bool init(const u8 *font, const u32 font_size, bool vid_50hz);
// Cover list management
void clear(void);
void shutdown(void);
@ -48,7 +47,7 @@ public:
void addItem(dir_discHdr *hdr, const char *picPath, const char *boxPicPath, const char *blankBoxPicPath, int playcount = 0, unsigned int lastPlayed = 0);
bool empty(void) const { return m_items.empty(); }
//
bool start(const char *id = 0);
bool start(const char *id = NULL);
void stopCoverLoader(bool empty = false);
void startCoverLoader(void);
//
@ -85,7 +84,7 @@ public:
bool getBoxMode(void) const { return m_box;}
void setBufferSize(u32 numCovers);
void setTextures(const string &loadingPic, const string &loadingPicFlat, const string &noCoverPic, const string &noCoverPicFlat);
void setFont(SFont font, const CColor &color);
void setFont(const SFont &font, const CColor &color);
void setRange(u32 rows, u32 columns);
void setBoxMode(bool box);
void setHQcover(bool HQ);
@ -115,9 +114,9 @@ public:
void setRowAngles(bool selected, const Vector3D &top, const Vector3D &bottom);
void setCoverFlipping(const Vector3D &pos, const Vector3D &angle, const Vector3D &scale);
void setBlur(u32 blurResolution, u32 blurRadius, float blurFactor);
bool setSorting(Sorting sorting);
void setSorting(Sorting sorting);
//
void setSounds(const SmartGuiSound &sound, const SmartGuiSound &hoverSound, const SmartGuiSound &selectSound, const SmartGuiSound &cancelSound);
void setSounds(GuiSound *sound, GuiSound *hoverSound, GuiSound *selectSound, GuiSound *cancelSound);
void setSoundVolume(u8 vol);
void stopSound(void);
//
@ -286,10 +285,10 @@ private:
Vector3D m_flipCoverAngle;
Vector3D m_flipCoverScale;
u8 sndCopyNum;
SmartGuiSound m_sound[4];
SmartGuiSound m_hoverSound;
SmartGuiSound m_selectSound;
SmartGuiSound m_cancelSound;
GuiSound *m_sound[4];
GuiSound *m_hoverSound;
GuiSound *m_selectSound;
GuiSound *m_cancelSound;
u8 m_soundVolume;
float m_lodBias;
u8 m_aniso;
@ -332,8 +331,8 @@ private:
void _transposeCover(vector<CCover> &dst, u32 rows, u32 columns, int pos);
void _playSound(void);
void _stopSound(SmartGuiSound snd);
void _playSound(SmartGuiSound snd);
void _stopSound(GuiSound *snd);
void _playSound(GuiSound *snd);
static bool _sortByPlayCount(CItem item1, CItem item2);
static bool _sortByLastPlayed(CItem item1, CItem item2);

View File

@ -1,7 +1,7 @@
#include "cursor.hpp"
#include "pngu.h"
#include "memory/mem2.hpp"
#include <algorithm>
using namespace std;
@ -49,16 +49,15 @@ bool CCursor::init(const char *png, bool wideFix, CColor shadowColor, float shad
m_shadow.height = m_texture.height;
m_shadow.maxLOD = 0;
m_shadow.format = GX_TF_I8;
m_shadow.data = smartMem2Alloc(GX_GetTexBufferSize(m_shadow.width, m_shadow.height, m_shadow.format, GX_FALSE, 0));
if (!!m_shadow.data)
m_shadow.data = (u8*)MEM2_alloc(GX_GetTexBufferSize(m_shadow.width, m_shadow.height, m_shadow.format, GX_FALSE, 0));
if(m_shadow.data != NULL)
{
const u8 *src = m_texture.data.get();
u8 *dst = m_shadow.data.get();
const u8 *src = m_texture.data;
u8 *dst = m_shadow.data;
u32 w = m_shadow.width;
for (u32 yy = 0; yy < m_shadow.height; ++yy)
for (u32 xx = 0; xx < m_shadow.width; ++xx)
dst[coordsI8(xx, yy, w)] = src[coordsRGBA8(xx, yy, w)];
if (blur) _blur();
}
}
@ -94,12 +93,12 @@ void CCursor::draw(int x, int y, float a)
GX_SetCullMode(GX_CULL_NONE);
GX_SetZMode(GX_DISABLE, GX_LEQUAL, GX_TRUE);
// Shadow
if (!!m_shadow.data)
if(m_shadow.data != NULL)
{
guMtxIdentity(modelViewMtx);
guMtxTransApply(modelViewMtx, modelViewMtx, (float)x - w + m_shadowX * xScale, (float)y - h + m_shadowY, 0.f);
GX_LoadPosMtxImm(modelViewMtx, GX_PNMTX0);
GX_InitTexObj(&texObj, m_shadow.data.get(), m_shadow.width, m_shadow.height, m_shadow.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj, m_shadow.data, m_shadow.width, m_shadow.height, m_shadow.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_LoadTexObj(&texObj, GX_TEXMAP0);
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
v = Vector3D(w, h, 0.f).rotateZ(a);
@ -124,7 +123,7 @@ void CCursor::draw(int x, int y, float a)
guMtxIdentity(modelViewMtx);
guMtxTransApply(modelViewMtx, modelViewMtx, (float)x - w, (float)y - h, 0.f);
GX_LoadPosMtxImm(modelViewMtx, GX_PNMTX0);
GX_InitTexObj(&texObj, m_texture.data.get(), m_texture.width, m_texture.height, m_texture.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj, m_texture.data, m_texture.width, m_texture.height, m_texture.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_LoadTexObj(&texObj, GX_TEXMAP0);
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
v = Vector3D(w, h, 0.f).rotateZ(a);
@ -152,24 +151,18 @@ void CCursor::_blur(void)
int w = m_shadow.width;
int h = m_shadow.height;
int div = 2 * radius + 1;
u8 *r = 0;
u8 *pic = m_shadow.data.get();
u8 *pic = m_shadow.data;
int sum;
int yp;
int yi;
int pass = 2;
SmartBuf xMinBuf = smartMem2Alloc(w * sizeof (int));
SmartBuf xMaxBuf = smartMem2Alloc(w * sizeof (int));
SmartBuf yMinBuf = smartMem2Alloc(h * sizeof (int));
SmartBuf yMaxBuf = smartMem2Alloc(h * sizeof (int));
SmartBuf buf = smartMem2Alloc(m_shadow.width * m_shadow.height);
if (!xMinBuf || !xMaxBuf || !yMinBuf || !yMaxBuf || !buf)
s32 *xmin = (s32*)MEM2_alloc(w * sizeof(s32));
s32 *xmax = (s32*)MEM2_alloc(w * sizeof(s32));
s32 *ymin = (s32*)MEM2_alloc(h * sizeof(s32));
s32 *ymax = (s32*)MEM2_alloc(h * sizeof(s32));
u8 *r = (u8*)MEM2_alloc(m_shadow.width * m_shadow.height);
if(!xmin || !xmax || !ymin || !ymax || !r)
return;
int *xmin = (int *)xMinBuf.get();
int *xmax = (int *)xMaxBuf.get();
int *ymin = (int *)yMinBuf.get();
int *ymax = (int *)yMaxBuf.get();
r = buf.get();
for (int i = 0; i < w; ++i)
{
xmax[i] = min(i + radius + 1, w - 1);
@ -215,4 +208,9 @@ void CCursor::_blur(void)
}
}
}
free(xmin);
free(xmax);
free(ymin);
free(ymax);
free(r);
}

View File

@ -24,10 +24,16 @@ void CFanart::unload()
m_cfg.unload();
m_loaded = false;
m_elms.clear();
if(m_bg.data.get() != NULL)
m_bg.data.release();
if(m_bglq.data.get() != NULL)
m_bglq.data.release();
if(m_bg.data != NULL)
{
free(m_bg.data);
m_bg.data = NULL;
}
if(m_bglq.data != NULL)
{
free(m_bglq.data);
m_bglq.data = NULL;
}
}
bool CFanart::load(Config &m_globalConfig, const char *path, const char *id)
@ -222,8 +228,11 @@ CFanartElement::CFanartElement(Config &cfg, const char *dir, int artwork)
CFanartElement::~CFanartElement(void)
{
if(m_art.data.get() != NULL)
m_art.data.release();
if(m_art.data != NULL)
{
free(m_art.data);
m_art.data = NULL;
}
}
bool CFanartElement::IsValid()
@ -283,7 +292,7 @@ void CFanartElement::draw()
guMtxTransApply(modelViewMtx, modelViewMtx, m_event_x, m_event_y, 0.f);
GX_LoadPosMtxImm(modelViewMtx, GX_PNMTX0);
GX_InitTexObj(&artwork, m_art.data.get(), m_art.width, m_art.height, m_art.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&artwork, m_art.data, m_art.width, m_art.height, m_art.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_LoadTexObj(&artwork, GX_TEXMAP0);
float w = (float)(m_art.width / 2); // * m_event_scaleX;

View File

@ -302,6 +302,7 @@ void VideoFrame::dealloc()
{
if(_data != NULL)
free(_data);
_data = NULL;
_w = _h = _p = 0;
}

View File

@ -9,7 +9,6 @@ template <class T> static inline T loopNum(T i, T s)
}
STexture CButtonsMgr::_noTexture;
SmartGuiSound CButtonsMgr::_noSound = SmartGuiSound(new GuiSound());
bool CButtonsMgr::init(CVideo &vid)
{
@ -31,10 +30,9 @@ bool CButtonsMgr::init(CVideo &vid)
}
s16 CButtonsMgr::addButton(SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color,
const SButtonTextureSet &texSet, const SmartGuiSound &clickSound, const SmartGuiSound &hoverSound)
const SButtonTextureSet &texSet, GuiSound *clickSound, GuiSound *hoverSound)
{
CButtonsMgr::SButton *b = new CButtonsMgr::SButton;
SmartPtr<CButtonsMgr::SElement> elt(b);
SButton *b = new SButton;
b->font = font;
b->visible = false;
@ -59,7 +57,7 @@ s16 CButtonsMgr::addButton(SFont font, const wstringEx &text, int x, int y, u32
b->moveByY = 0;
u16 sz = m_elts.size();
m_elts.push_back(elt);
m_elts.push_back(b);
return m_elts.size() > sz ? m_elts.size() - 1 : -2;
}
@ -69,7 +67,7 @@ void CButtonsMgr::reset(s16 id, bool instant)
if (id == -1) return;
if (id < (s32)m_elts.size())
{
CButtonsMgr::SElement &b = *m_elts[id];
SElement &b = *m_elts[id];
b.x -= b.moveByX;
b.y -= b.moveByY;
if (instant)
@ -114,10 +112,9 @@ void CButtonsMgr::getDimensions(s16 id, int &x, int &y, u32 &width, u32 &height)
y = b.targetPos.y;
width = b.w;
height = b.h;
if (b.t == GUIELT_LABEL)
if(b.t == GUIELT_LABEL)
{
CButtonsMgr::SLabel *s = (CButtonsMgr::SLabel *) m_elts[id].get();
SLabel *s = (SLabel*)m_elts[id];
// Calculate height
height = s->text.getTotalHeight();
}
@ -129,7 +126,7 @@ void CButtonsMgr::hide(s16 id, int dx, int dy, float scaleX, float scaleY, bool
if (id == -1) return;
if (id < (s32)m_elts.size())
{
CButtonsMgr::SElement &b = *m_elts[id];
SElement &b = *m_elts[id];
b.hideParam.dx = dx;
b.hideParam.dy = dy;
b.hideParam.scaleX = scaleX;
@ -165,13 +162,11 @@ void CButtonsMgr::hide(s16 id, bool instant)
void CButtonsMgr::stopSounds(void)
{
for (u32 i = 0; i < m_elts.size(); ++i)
if (m_elts[i]->t == CButtonsMgr::GUIELT_BUTTON)
if (m_elts[i]->t == GUIELT_BUTTON)
{
CButtonsMgr::SButton &b = (CButtonsMgr::SButton &)*m_elts[i];
if (!!b.hoverSound)
b.hoverSound->Stop();
if (!!b.clickSound)
b.clickSound->Stop();
SButton *b = (SButton*)m_elts[i];
b->hoverSound->Stop();
b->clickSound->Stop();
}
}
@ -185,13 +180,12 @@ void CButtonsMgr::show(s16 id, bool instant)
if (id == -1) return;
if (id < (s32)m_elts.size())
{
CButtonsMgr::SElement &b = *m_elts[id];
SElement &b = *m_elts[id];
b.visible = true;
b.targetScaleX = 1.0f;
b.targetScaleY = 1.0f;
b.targetPos = Vector3D((float)b.x, (float)b.y, 0);
b.targetAlpha = 0xFF;
if (instant)
{
b.scaleX = b.targetScaleX;
@ -223,10 +217,10 @@ void CButtonsMgr::mouse(int chan, int x, int y)
m_selected[chan] = -1;
for(int i = (int)m_elts.size() - 1; i >= 0; --i)
{
CButtonsMgr::SElement &b = *m_elts[i];
if(b.t == CButtonsMgr::GUIELT_BUTTON)
SElement &b = *m_elts[i];
if(b.t == GUIELT_BUTTON)
{
SButton &but = *(CButtonsMgr::SButton *)&b;
SButton &but = *(SButton*)&b;
w = (float)(but.w / 2);
h = (float)(but.h / 2);
if(but.visible && (float)x >= but.pos.x - w && (float)x < but.pos.x + w && (float)y >= but.pos.y - h && (float)y < but.pos.y + h)
@ -237,9 +231,11 @@ void CButtonsMgr::mouse(int chan, int x, int y)
//
if(start != m_selected[chan])
{
if(m_soundVolume > 0 && !!but.hoverSound)
if(m_soundVolume > 0)
{
if(!m_nohover)
but.hoverSound->Play(m_soundVolume);
}
if(m_rumbleEnabled)
{
m_rumble[chan] = 4;
@ -290,8 +286,8 @@ void CButtonsMgr::up(void)
for(u32 i = 1; i <= m_elts.size(); ++i)
{
u32 j = loopNum(start - i, m_elts.size());
CButtonsMgr::SElement &b = *m_elts[j];
if (b.t == CButtonsMgr::GUIELT_BUTTON && b.visible)
SElement &b = *m_elts[j];
if (b.t == GUIELT_BUTTON && b.visible)
{
m_selected[0] = j;
b.targetScaleX = 1.1f;
@ -319,8 +315,8 @@ void CButtonsMgr::down(void)
for(u32 i = 1; i <= m_elts.size(); ++i)
{
u32 j = loopNum(start + i, m_elts.size());
CButtonsMgr::SElement &b = *m_elts[j];
if (b.t == CButtonsMgr::GUIELT_BUTTON && b.visible)
SElement &b = *m_elts[j];
if (b.t == GUIELT_BUTTON && b.visible)
{
m_selected[0] = j;
b.targetScaleX = 1.1f;
@ -349,13 +345,13 @@ void CButtonsMgr::click(s16 id)
if (id == -1) id = m_selected[chan];
if (id == -1) continue;
if (id < (s32)m_elts.size() && m_elts[id]->t == CButtonsMgr::GUIELT_BUTTON)
if (id < (s32)m_elts.size() && m_elts[id]->t == GUIELT_BUTTON)
{
CButtonsMgr::SButton &b = *((CButtonsMgr::SButton *)m_elts[id].get());
b.click = 1.f;
b.scaleX = 1.1f;
b.scaleY = 1.1f;
if (m_soundVolume > 0 && !!b.clickSound) b.clickSound->Play(m_soundVolume);
SButton *b = (SButton*)m_elts[id];
b->click = 1.f;
b->scaleX = 1.1f;
b->scaleY = 1.1f;
if (m_soundVolume > 0) b->clickSound->Play(m_soundVolume);
}
}
}
@ -404,8 +400,7 @@ void CButtonsMgr::tick(void)
s16 CButtonsMgr::addLabel(SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color, s16 style, const STexture &bg)
{
CButtonsMgr::SLabel *b = new CButtonsMgr::SLabel;
SmartPtr<CButtonsMgr::SElement> elt(b);
SLabel *b = new SLabel;
b->font = font;
b->visible = false;
@ -428,15 +423,14 @@ s16 CButtonsMgr::addLabel(SFont font, const wstringEx &text, int x, int y, u32 w
b->moveByY = 0;
u32 sz = m_elts.size();
m_elts.push_back(elt);
m_elts.push_back(b);
return m_elts.size() > sz ? m_elts.size() - 1 : -2;
}
s16 CButtonsMgr::addProgressBar(int x, int y, u32 width, u32 height, SButtonTextureSet &texSet)
{
CButtonsMgr::SProgressBar *b = new CButtonsMgr::SProgressBar;
SmartPtr<CButtonsMgr::SElement> elt(b);
SProgressBar *b = new SProgressBar;
b->visible = false;
b->x = x + width / 2;
@ -456,12 +450,12 @@ s16 CButtonsMgr::addProgressBar(int x, int y, u32 width, u32 height, SButtonText
b->moveByY = 0;
u32 sz = m_elts.size();
m_elts.push_back(elt);
m_elts.push_back(b);
return m_elts.size() > sz ? m_elts.size() - 1 : -2;
}
s16 CButtonsMgr::addPicButton(STexture &texNormal, STexture &texSelected, int x, int y, u32 width, u32 height, const SmartGuiSound &clickSound, const SmartGuiSound &hoverSound)
s16 CButtonsMgr::addPicButton(STexture &texNormal, STexture &texSelected, int x, int y, u32 width, u32 height, GuiSound *clickSound, GuiSound *hoverSound)
{
SButtonTextureSet texSet;
@ -470,7 +464,7 @@ s16 CButtonsMgr::addPicButton(STexture &texNormal, STexture &texSelected, int x,
return addButton(SFont(), wstringEx(), x, y, width, height, CColor(), texSet, clickSound, hoverSound);
}
s16 CButtonsMgr::addPicButton(const u8 *pngNormal, const u8 *pngSelected, int x, int y, u32 width, u32 height, const SmartGuiSound &clickSound, const SmartGuiSound &hoverSound)
s16 CButtonsMgr::addPicButton(const u8 *pngNormal, const u8 *pngSelected, int x, int y, u32 width, u32 height, GuiSound *clickSound, GuiSound *hoverSound)
{
SButtonTextureSet texSet;
@ -484,22 +478,21 @@ void CButtonsMgr::setText(s16 id, const wstringEx &text, bool unwrap)
if (id == -1) return;
if (id < (s32)m_elts.size())
{
CButtonsMgr::SLabel *lbl;
CButtonsMgr::SButton *btn;
SLabel *lbl = NULL;
SButton *btn = NULL;
switch (m_elts[id]->t)
{
case CButtonsMgr::GUIELT_BUTTON:
//((CButtonsMgr::SButton *)m_elts[id].get())->text = text;
btn = (CButtonsMgr::SButton *)m_elts[id].get();
case GUIELT_BUTTON:
btn = (SButton*)m_elts[id];
btn->text.setText(btn->font, text);
break;
case CButtonsMgr::GUIELT_LABEL:
lbl = (CButtonsMgr::SLabel *)m_elts[id].get();
case GUIELT_LABEL:
lbl = (SLabel*)m_elts[id];
lbl->text.setText(lbl->font, text);
if (unwrap) lbl->text.setFrame(100000, lbl->textStyle, true, true);
lbl->text.setFrame(lbl->w, lbl->textStyle, false, !unwrap);
break;
case CButtonsMgr::GUIELT_PROGRESS:
case GUIELT_PROGRESS:
break;
}
}
@ -510,22 +503,22 @@ void CButtonsMgr::setText(s16 id, const wstringEx &text, u32 startline,bool unwr
if (id == -1) return;
if (id < (s32)m_elts.size())
{
CButtonsMgr::SLabel *lbl;
CButtonsMgr::SButton *btn;
switch (m_elts[id]->t)
SButton *btn = NULL;
SLabel *lbl = NULL;
switch(m_elts[id]->t)
{
case CButtonsMgr::GUIELT_BUTTON:
case GUIELT_BUTTON:
//((CButtonsMgr::SButton *)m_elts[id].get())->text = text;
btn = (CButtonsMgr::SButton *)m_elts[id].get();
btn = (SButton*)m_elts[id];
btn->text.setText(btn->font, text);
break;
case CButtonsMgr::GUIELT_LABEL:
lbl = (CButtonsMgr::SLabel *)m_elts[id].get();
case GUIELT_LABEL:
lbl = (SLabel*)m_elts[id];
lbl->text.setText(lbl->font, text, startline);
if (unwrap) lbl->text.setFrame(100000, lbl->textStyle, true, true);
lbl->text.setFrame(lbl->w, lbl->textStyle, false, !unwrap);
break;
case CButtonsMgr::GUIELT_PROGRESS:
case GUIELT_PROGRESS:
break;
}
}
@ -541,8 +534,7 @@ void CButtonsMgr::setBtnTexture(s16 id, STexture &texNormal, STexture &texSelect
if (id < (s32)m_elts.size())
{
CButtonsMgr::SButton *b;
b = (CButtonsMgr::SButton *)m_elts[id].get();
SButton *b = (SButton*)m_elts[id];
b->tex = texSet;//change texture
}
}
@ -552,16 +544,16 @@ void CButtonsMgr::setTexture(s16 id, STexture &bg)
if (id == -1) return;
if (id < (s32)m_elts.size())
{
CButtonsMgr::SLabel *lbl;
switch (m_elts[id]->t)
SLabel *lbl = NULL;
switch(m_elts[id]->t)
{
case CButtonsMgr::GUIELT_BUTTON:
case GUIELT_BUTTON:
break;
case CButtonsMgr::GUIELT_LABEL:
lbl = (CButtonsMgr::SLabel *)m_elts[id].get();
case GUIELT_LABEL:
lbl = (SLabel*)m_elts[id];
lbl->texBg = bg;//change texture
break;
case CButtonsMgr::GUIELT_PROGRESS:
case GUIELT_PROGRESS:
break;
}
}
@ -572,18 +564,18 @@ void CButtonsMgr::setTexture(s16 id, STexture &bg, int width, int height)
if (id == -1) return;
if (id < (s32)m_elts.size())
{
CButtonsMgr::SLabel *lbl;
switch (m_elts[id]->t)
SLabel *lbl = NULL;
switch(m_elts[id]->t)
{
case CButtonsMgr::GUIELT_BUTTON:
case GUIELT_BUTTON:
break;
case CButtonsMgr::GUIELT_LABEL:
lbl = (CButtonsMgr::SLabel *)m_elts[id].get();
case GUIELT_LABEL:
lbl = (SLabel*)m_elts[id];
lbl->texBg = bg;//change texture
lbl->w = width;
lbl->h = height;
break;
case CButtonsMgr::GUIELT_PROGRESS:
case GUIELT_PROGRESS:
break;
}
}
@ -591,9 +583,9 @@ void CButtonsMgr::setTexture(s16 id, STexture &bg, int width, int height)
void CButtonsMgr::setProgress(s16 id, float f, bool instant)
{
if (m_elts[id]->t == CButtonsMgr::GUIELT_PROGRESS)
if(m_elts[id]->t == GUIELT_PROGRESS)
{
CButtonsMgr::SProgressBar *b = (CButtonsMgr::SProgressBar *)m_elts[id].get();
SProgressBar *b = (SProgressBar*)m_elts[id];
b->targetVal = std::min(std::max(0.f, f), 1.f);
if (instant) b->val = b->targetVal;
}
@ -622,15 +614,15 @@ void CButtonsMgr::_drawBtn(CButtonsMgr::SButton &b, bool selected, bool click)
{
if (selected)
{
GX_InitTexObj(&texObjLeft, b.tex.leftSel.data.get(), b.tex.leftSel.width, b.tex.leftSel.height, b.tex.leftSel.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjCenter, b.tex.centerSel.data.get(), b.tex.centerSel.width, b.tex.centerSel.height, b.tex.centerSel.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjRight, b.tex.rightSel.data.get(), b.tex.rightSel.width, b.tex.rightSel.height, b.tex.rightSel.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjLeft, b.tex.leftSel.data, b.tex.leftSel.width, b.tex.leftSel.height, b.tex.leftSel.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjCenter, b.tex.centerSel.data, b.tex.centerSel.width, b.tex.centerSel.height, b.tex.centerSel.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjRight, b.tex.rightSel.data, b.tex.rightSel.width, b.tex.rightSel.height, b.tex.rightSel.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
}
else
{
GX_InitTexObj(&texObjLeft, b.tex.left.data.get(), b.tex.left.width, b.tex.left.height, b.tex.left.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjCenter, b.tex.center.data.get(), b.tex.center.width, b.tex.center.height, b.tex.center.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjRight, b.tex.right.data.get(), b.tex.right.width, b.tex.right.height, b.tex.right.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjLeft, b.tex.left.data, b.tex.left.width, b.tex.left.height, b.tex.left.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjCenter, b.tex.center.data, b.tex.center.width, b.tex.center.height, b.tex.center.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjRight, b.tex.right.data, b.tex.right.width, b.tex.right.height, b.tex.right.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
}
w = (float)(b.w / 2) * scaleX;
h = (float)(b.h / 2) * scaleY;
@ -684,9 +676,9 @@ void CButtonsMgr::_drawBtn(CButtonsMgr::SButton &b, bool selected, bool click)
else if (!!b.tex.center.data && !!b.tex.centerSel.data)
{
if (selected)
GX_InitTexObj(&texObjLeft, b.tex.centerSel.data.get(), b.tex.centerSel.width, b.tex.centerSel.height, b.tex.centerSel.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjLeft, b.tex.centerSel.data, b.tex.centerSel.width, b.tex.centerSel.height, b.tex.centerSel.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
else
GX_InitTexObj(&texObjLeft, b.tex.center.data.get(), b.tex.center.width, b.tex.center.height, b.tex.center.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjLeft, b.tex.center.data, b.tex.center.width, b.tex.center.height, b.tex.center.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
w = (float)(b.w / 2) * scaleX;
h = (float)(b.h / 2) * scaleY;
GX_LoadTexObj(&texObjLeft, GX_TEXMAP0);
@ -731,9 +723,9 @@ void CButtonsMgr::_drawLbl(CButtonsMgr::SLabel &b)
guMtxIdentity(modelViewMtx);
guMtxTransApply(modelViewMtx, modelViewMtx, b.pos.x, b.pos.y, 0.f);
GX_LoadPosMtxImm(modelViewMtx, GX_PNMTX0);
if (!!b.texBg.data)
if (b.texBg.data != NULL)
{
GX_InitTexObj(&texObj, b.texBg.data.get(), b.texBg.width, b.texBg.height, b.texBg.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj, b.texBg.data, b.texBg.width, b.texBg.height, b.texBg.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_LoadTexObj(&texObj, GX_TEXMAP0);
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
GX_Position3f32(-w, -h, 0.f);
@ -802,12 +794,12 @@ void CButtonsMgr::_drawPBar(const CButtonsMgr::SProgressBar &b)
{
GXTexObj texObjBg, texObjBgL, texObjBgR, texObjBar, texObjBarL, texObjBarR;
float w, h, wh, x1,x2, tx;
GX_InitTexObj(&texObjBarL, b.tex.leftSel.data.get(), b.tex.leftSel.width, b.tex.leftSel.height, b.tex.leftSel.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjBar, b.tex.centerSel.data.get(), b.tex.centerSel.width, b.tex.centerSel.height, b.tex.centerSel.format, GX_REPEAT, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjBarR, b.tex.rightSel.data.get(), b.tex.rightSel.width, b.tex.rightSel.height, b.tex.rightSel.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjBgL, b.tex.left.data.get(), b.tex.left.width, b.tex.left.height, b.tex.left.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjBg, b.tex.center.data.get(), b.tex.center.width, b.tex.center.height, b.tex.center.format, GX_REPEAT, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjBgR, b.tex.right.data.get(), b.tex.right.width, b.tex.right.height, b.tex.right.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjBarL, b.tex.leftSel.data, b.tex.leftSel.width, b.tex.leftSel.height, b.tex.leftSel.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjBar, b.tex.centerSel.data, b.tex.centerSel.width, b.tex.centerSel.height, b.tex.centerSel.format, GX_REPEAT, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjBarR, b.tex.rightSel.data, b.tex.rightSel.width, b.tex.rightSel.height, b.tex.rightSel.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjBgL, b.tex.left.data, b.tex.left.width, b.tex.left.height, b.tex.left.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjBg, b.tex.center.data, b.tex.center.width, b.tex.center.height, b.tex.center.format, GX_REPEAT, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObjBgR, b.tex.right.data, b.tex.right.width, b.tex.right.height, b.tex.right.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
w = (float)(b.w / 2) * scaleX;
h = (float)(b.h / 2) * scaleY;
wh = (float)(b.h / 2) * scaleX;
@ -931,12 +923,14 @@ void CButtonsMgr::draw(void)
for(s32 i = 0; i < (s32)m_elts.size(); ++i)
{
switch (m_elts[i]->t)
SButton *btn = NULL;
SLabel *lbl = NULL;
SProgressBar *prg = NULL;
switch(m_elts[i]->t)
{
case CButtonsMgr::GUIELT_BUTTON:
case GUIELT_BUTTON:
{
CButtonsMgr::SButton &b = (CButtonsMgr::SButton &)*m_elts[i];
btn = (SButton*)m_elts[i];
bool drawSelected = false;
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
{
@ -947,21 +941,21 @@ void CButtonsMgr::draw(void)
}
}
CButtonsMgr::_drawBtn(b, drawSelected, false);
if (b.click > 0.f)
CButtonsMgr::_drawBtn(b, true, true);
_drawBtn(*btn, drawSelected, false);
if (btn->click > 0.f)
_drawBtn(*btn, true, true);
break;
}
case CButtonsMgr::GUIELT_LABEL:
case GUIELT_LABEL:
{
CButtonsMgr::SLabel &b = (CButtonsMgr::SLabel &)*m_elts[i];
CButtonsMgr::_drawLbl(b);
lbl = (SLabel*)m_elts[i];
_drawLbl(*lbl);
break;
}
case CButtonsMgr::GUIELT_PROGRESS:
{
CButtonsMgr::SProgressBar &b = (CButtonsMgr::SProgressBar &)*m_elts[i];
CButtonsMgr::_drawPBar(b);
prg = (SProgressBar*)m_elts[i];
_drawPBar(*prg);
break;
}
}

View File

@ -10,7 +10,6 @@
#include "video.hpp"
#include "FreeTypeGX.h"
#include "text.hpp"
#include "memory/smartptr.hpp"
#include "music/gui_sound.h"
#include "wstringEx/wstringEx.hpp"
@ -31,12 +30,12 @@ public:
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,
const SButtonTextureSet &texSet, const SmartGuiSound &clickSound = _noSound, const SmartGuiSound &hoverSound = _noSound);
const SButtonTextureSet &texSet, GuiSound *clickSound = NULL, GuiSound *hoverSound = NULL);
s16 addLabel(SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color, s16 style, const STexture &bg = _noTexture);
s16 addPicButton(const u8 *pngNormal, const u8 *pngSelected, int x, int y, u32 width, u32 height,
const SmartGuiSound &clickSound = _noSound, const SmartGuiSound &hoverSound = _noSound);
GuiSound *clickSound = NULL, GuiSound *hoverSound = NULL);
s16 addPicButton(STexture &texNormal, STexture &texSelected, int x, int y, u32 width, u32 height,
const SmartGuiSound &clickSound = _noSound, const SmartGuiSound &hoverSound = _noSound);
GuiSound *clickSound = NULL, GuiSound *hoverSound = NULL);
s16 addProgressBar(int x, int y, u32 width, u32 height, SButtonTextureSet &texSet);
void setText(s16 id, const wstringEx &text, bool unwrap = false);
void setText(s16 id, const wstringEx &text, u32 startline, bool unwrap = false);
@ -111,8 +110,8 @@ private:
CText text;
CColor textColor;
float click;
SmartGuiSound clickSound;
SmartGuiSound hoverSound;
GuiSound *clickSound;
GuiSound *hoverSound;
public:
SButton(void) { t = GUIELT_BUTTON; }
virtual void tick(void);
@ -138,14 +137,14 @@ private:
virtual void tick(void);
};
private:
vector<SmartPtr<SElement> > m_elts;
vector<SElement*> m_elts;
s32 m_selected[WPAD_MAX_WIIMOTES];
bool m_rumbleEnabled;
u8 m_rumble[WPAD_MAX_WIIMOTES];
bool wii_rumble[WPAD_MAX_WIIMOTES];
bool gc_rumble[WPAD_MAX_WIIMOTES];
SmartGuiSound m_sndHover;
SmartGuiSound m_sndClick;
GuiSound *m_sndHover;
GuiSound *m_sndClick;
u8 m_soundVolume;
bool m_noclick;
bool m_nohover;
@ -156,7 +155,6 @@ private:
void _drawLbl(SLabel &b);
void _drawPBar(const SProgressBar &b);
static STexture _noTexture;
static SmartGuiSound _noSound;
};
#endif // !defined(__GUI_HPP)

View File

@ -1,5 +1,6 @@
#include <algorithm>
#include "text.hpp"
#include "memory/mem2.hpp"
int currentStr = 0;
static char fmt_buffer[MAX_USES][MAX_MSG_SIZE];
@ -166,31 +167,42 @@ vector<wstringEx> stringToVector(const wstringEx &text, char sep)
return v;
}
bool SFont::fromBuffer(u8 *buffer, u32 bufferSize, u32 size, u32 lspacing, u32 w, u32 idx, const char *)
void SFont::ClearData(void)
{
if (!buffer || !font) return false;
if(font != NULL)
delete font;
font = NULL;
if(data != NULL)
free(data);
data = NULL;
dataSize = 0;
}
bool SFont::fromBuffer(const u8 *buffer, const u32 bufferSize, u32 size, u32 lspacing, u32 w, u32 idx, const char *)
{
if(buffer == NULL)
return false;
size = min(max(6u, size), 1000u);
lineSpacing = min(max(6u, lspacing), 1000u);
weight = min(w, 32u);
index = idx;
if(data.get())
data.release();
data = smartMem2Alloc(bufferSize);
if(!data) return false;
memcpy(data.get(), buffer, bufferSize);
if(data != NULL)
free(data);
data = (u8*)MEM2_alloc(bufferSize);
if(data == NULL) return false;
dataSize = bufferSize;
font->loadFont(data.get(), dataSize, size, weight, index, false);
memcpy(data, buffer, bufferSize);
DCFlushRange(data, dataSize);
font = new FreeTypeGX();
font->loadFont(data, dataSize, size, weight, index, false);
return true;
}
bool SFont::fromFile(const char *filename, u32 size, u32 lspacing, u32 w, u32 idx)
{
if (!font) return false;
size = min(max(6u, size), 1000u);
weight = min(w, 32u);
index = idx = 0;
@ -204,30 +216,33 @@ bool SFont::fromFile(const char *filename, u32 size, u32 lspacing, u32 w, u32 id
fseek(file, 0, SEEK_SET);
if (fileSize == 0) return false;
if(data.get())
data.release();
data = smartMem2Alloc(fileSize);
if(data != NULL)
free(data);
data = (u8*)MEM2_alloc(fileSize);
if (!data)
{
fclose(file);
return false;
}
fread(data.get(), 1, fileSize, file);
fread(data, 1, fileSize, file);
dataSize = fileSize;
DCFlushRange(data, dataSize);
font->loadFont(data.get(), dataSize, size, weight, index, false);
font = new FreeTypeGX();
font->loadFont(data, dataSize, size, weight, index, false);
return true;
}
static const wchar_t *g_whitespaces = L" \f\n\r\t\v";
void CText::setText(SFont font, const wstringEx &t)
void CText::setText(const SFont &font, const wstringEx &t)
{
CText::SWord w;
m_lines.clear();
if (!!font.font) m_font = font;
if (!m_font.font) return;
if(font.font != NULL)
m_font = font;
if(m_font.font == NULL)
return;
firstLine = 0;
// Don't care about performance
@ -260,14 +275,16 @@ void CText::setText(SFont font, const wstringEx &t)
}
}
void CText::setText(SFont font, const wstringEx &t, u32 startline)
void CText::setText(const SFont &font, const wstringEx &t, u32 startline)
{
CText::SWord w;
totalHeight = 0;
m_lines.clear();
if (!!font.font) m_font = font;
if (!m_font.font) return;
if(font.font != NULL)
m_font = font;
if(m_font.font == NULL)
return;
firstLine = startline;
// Don't care about performance
@ -300,15 +317,13 @@ void CText::setText(SFont font, const wstringEx &t, u32 startline)
}
}
void CText::setFrame(float width, u16 style, bool ignoreNewlines, bool instant)
{
if(m_font.font == NULL)
return;
float shift;
totalHeight = 0;
if (!m_font.font) return;
float space = m_font.font->getWidth(L" ");
float posX = 0.f;
float posY = 0.f;
@ -390,7 +405,8 @@ void CText::tick(void)
void CText::draw(void)
{
if (!m_font.font) return;
if(m_font.font == NULL)
return;
for (u32 k = firstLine; k < m_lines.size(); ++k)
for (u32 i = 0; i < m_lines[k].size(); ++i)

View File

@ -7,38 +7,38 @@
#include "FreeTypeGX.h"
#include "video.hpp"
#include "memory/smartptr.hpp"
#include "wstringEx/wstringEx.hpp"
using namespace std;
struct SFont
class SFont
{
SmartBuf data;
size_t dataSize;
SmartPtr<FreeTypeGX> font;
public:
SFont(void) : font(NULL), lineSpacing(0), weight(0), index(0), data(NULL), dataSize(0) { }
~SFont(void) { };
void ClearData(void);
bool fromBuffer(const u8 *buffer, const u32 bufferSize, u32 size, u32 lspacing, u32 w = 0, u32 idx = 0, const char *genKey = NULL);
bool fromFile(const char *filename, u32 size, u32 lspacing, u32 w = 0, u32 idx = 0);
FreeTypeGX *font;
u32 lineSpacing;
u32 weight;
u32 index;
public:
bool fromBuffer(u8 *buffer, u32 bufferSize, u32 size, u32 lspacing, u32 w = 0, u32 idx = 0, const char *genKey = NULL);
bool fromFile(const char *filename, u32 size, u32 lspacing, u32 w = 0, u32 idx = 0);
SFont(void) : data(SmartBuf(NULL, SmartBuf::SRCALL_MEM2)), dataSize(0), font(SmartPtr<FreeTypeGX>(new FreeTypeGX)), lineSpacing(0), weight(0), index(0) { }
~SFont(void) { }
private:
u8 *data;
size_t dataSize;
};
class CText
{
public:
void setText(SFont font, const wstringEx &t);
void setText(SFont font, const wstringEx &t, u32 startline);
void setText(const SFont &font, const wstringEx &t);
void setText(const SFont &font, const wstringEx &t, u32 startline);
void setColor(const CColor &c);
void setFrame(float width, u16 style, bool ignoreNewlines = false, bool instant = false);
void tick(void);
void draw(void);
int getTotalHeight();
private:
struct SWord
{
wstringEx text;

View File

@ -1,7 +1,9 @@
#include <string.h>
#include <stdio.h>
#include <ogcsys.h>
#include <malloc.h>
#include <cmath>
#include "memory/mem2.hpp"
#include "texture.hpp"
#include "pngu.h"
#include "gcvid.h"
@ -181,7 +183,18 @@ static inline void _convertToCMPR(u8 *dst, const u8 *src, u32 width, u32 height)
}
}
STexture::TexErr STexture::fromImageFile(const char *filename, u8 f, Alloc alloc, u32 minMipSize, u32 maxMipSize)
void STexture::Cleanup(void)
{
if(data != NULL)
free(data);
data = NULL;
width = 0;
height = 0;
format = -1;
maxLOD = 0;
}
STexture::TexErr STexture::fromImageFile(const char *filename, u8 f, u32 minMipSize, u32 maxMipSize)
{
FILE *file = fopen(filename, "rb");
if(file == NULL)
@ -199,7 +212,7 @@ STexture::TexErr STexture::fromImageFile(const char *filename, u8 f, Alloc alloc
u8 *Image = NULL;
if(fileSize)
{
Image = (u8*)malloc(fileSize);
Image = (u8*)MEM2_alloc(fileSize);
if(Image != NULL)
fread(Image, 1, fileSize, file);
}
@ -209,24 +222,25 @@ STexture::TexErr STexture::fromImageFile(const char *filename, u8 f, Alloc alloc
if(Image != NULL)
{
if(strstr(filename, ".png") != NULL)
result = fromPNG(Image, f, alloc, minMipSize, maxMipSize);
result = fromPNG(Image, f, minMipSize, maxMipSize);
else
result = fromJPG(Image, fileSize, f, alloc, minMipSize, maxMipSize);
result = fromJPG(Image, fileSize, f, minMipSize, maxMipSize);
free(Image);
}
return result;
}
STexture::TexErr STexture::fromRAW(const u8 *buffer, u32 w, u32 h, u8 f, Alloc alloc, u32 minMipSize, u32 maxMipSize)
STexture::TexErr STexture::fromRAW(const u8 *buffer, u32 w, u32 h, u8 f, u32 minMipSize, u32 maxMipSize)
{
// Convert our raw stuff to a usable format
SmartBuf rawData = smartMem2Alloc(w * h * 4);
if(rawData.get() == NULL)
u8 *rawData = (u8*)MEM2_alloc(w * h * 4);
if(rawData == NULL)
return TE_NOMEM;
_convertToFlippedRGBA(rawData.get(), buffer, w, h);
_convertToFlippedRGBA(rawData, buffer, w, h);
//Let the real work begin
SmartBuf tmpData;
Cleanup();
u32 BufSize = 0;
u8 maxLODTmp = 0;
u8 minLODTmp = 0;
u32 baseWidth;
@ -249,9 +263,8 @@ STexture::TexErr STexture::fromRAW(const u8 *buffer, u32 w, u32 h, u8 f, Alloc a
_calcMipMaps(maxLODTmp, minLODTmp, baseWidth, baseHeight, w, h, minMipSize, maxMipSize);
if (maxLODTmp > 0)
{
DCFlushRange(rawData.get(), width * height * 4);
rawData = _genMipMaps(rawData.get(), width, height, maxLODTmp, baseWidth, baseHeight);
if(!rawData)
rawData = _genMipMaps(rawData, width, height, maxLODTmp, baseWidth, baseHeight);
if(rawData == NULL)
return TE_NOMEM;
u32 newWidth = baseWidth;
@ -261,22 +274,19 @@ STexture::TexErr STexture::fromRAW(const u8 *buffer, u32 w, u32 h, u8 f, Alloc a
newWidth >>= 1;
newHeight >>= 1;
}
switch(alloc)
BufSize = fixGX_GetTexBufferSize(newWidth, newHeight, f, GX_TRUE, maxLODTmp - minLODTmp);
data = (u8*)MEM2_alloc(BufSize);
if(data == NULL)
{
case ALLOC_MEM2:
tmpData = smartMem2Alloc(fixGX_GetTexBufferSize(newWidth, newHeight, f, GX_TRUE, maxLODTmp - minLODTmp));
break;
case ALLOC_MALLOC:
tmpData = smartMemAlign32(fixGX_GetTexBufferSize(newWidth, newHeight, f, GX_TRUE, maxLODTmp - minLODTmp));
break;
free(rawData);
return TE_NOMEM;
}
u32 nWidth = newWidth;
u32 nHeight = newHeight;
u8 *pSrc = rawData.get();
u8 *pSrc = rawData;
if (minLODTmp > 0)
pSrc += fixGX_GetTexBufferSize(baseWidth, baseHeight, GX_TF_RGBA8, minLODTmp > 1 ? GX_TRUE : GX_FALSE, minLODTmp - 1);
u8 *pDst = tmpData.get();
pSrc += fixGX_GetTexBufferSize(baseWidth, baseHeight, f, minLODTmp > 1 ? GX_TRUE : GX_FALSE, minLODTmp - 1);
u8 *pDst = data;
for (u8 i = minLODTmp; i <= maxLODTmp; ++i)
{
switch(f)
@ -299,74 +309,102 @@ STexture::TexErr STexture::fromRAW(const u8 *buffer, u32 w, u32 h, u8 f, Alloc a
maxLOD = maxLODTmp - minLODTmp;
width = newWidth;
height = newHeight;
data = tmpData;
DCFlushRange(data.get(), fixGX_GetTexBufferSize(width, height, format, maxLOD > 0 ? GX_TRUE : GX_FALSE, maxLOD));
}
else
{
switch(alloc)
BufSize = GX_GetTexBufferSize(w, h, format, GX_FALSE, 0);
data = (u8*)MEM2_alloc(BufSize);
if(data == NULL)
{
case ALLOC_MEM2:
tmpData = smartMem2Alloc(GX_GetTexBufferSize(w, h, format, GX_FALSE, 0));
break;
case ALLOC_MALLOC:
tmpData = smartMemAlign32(GX_GetTexBufferSize(w, h, format, GX_FALSE, 0));
break;
}
if(tmpData.get() == NULL)
{
rawData.release();
free(rawData);
return TE_NOMEM;
}
switch(f)
{
case GX_TF_RGBA8:
_convertToRGBA8(tmpData.get(), rawData.get(), width, height);
_convertToRGBA8(data, rawData, width, height);
break;
case GX_TF_RGB565:
_convertToRGB565(tmpData.get(), rawData.get(), width, height);
_convertToRGB565(data, rawData, width, height);
break;
case GX_TF_CMPR:
_convertToCMPR(tmpData.get(), rawData.get(), width, height);
_convertToCMPR(data, rawData, width, height);
break;
}
data = tmpData;
DCFlushRange(data.get(), GX_GetTexBufferSize(width, height, format, GX_FALSE, 0));
}
rawData.release();
DCFlushRange(data, BufSize);
free(rawData);
return TE_OK;
}
STexture::TexErr STexture::fromJPG(const u8 *buffer, const u32 buffer_size, u8 f, Alloc alloc, u32 minMipSize, u32 maxMipSize)
STexture::TexErr STexture::fromTHP(const u8 *src, u32 w, u32 h)
{
VideoFrame VideoF;
decodeRealJpeg(buffer, buffer_size, VideoF, true);
if(!VideoF.getData() || (VideoF.getWidth() % 4) != 0 || (VideoF.getHeight() % 4) != 0)
return TE_ERROR;
return fromRAW(VideoF.getData(), VideoF.getWidth(), VideoF.getHeight(), f, alloc, minMipSize, maxMipSize);
width = w;
height = h;
format = GX_TF_RGBA8;
u32 BufSize = GX_GetTexBufferSize(width, height, format, GX_FALSE, 0);
data = (u8*)MEM2_alloc(BufSize);
if(data == NULL)
return TE_NOMEM;
for(u32 block = 0; block < height; block += 4)
{
for(u32 i = 0; i < width; i += 4)
{
for(u32 c = 0; c < 4; ++c)
{
for(u32 argb = 0; argb < 4; ++argb)
{
u32 y = h - 1 - (c + block);
u32 x = argb + i;
u32 src_offset = ((i + argb) + ((block + c) * width)) * 3;
u32 dst_offset = coordsRGBA8(x, y, width);
/* Alpha */
data[dst_offset] = 0xFF;
/* RGB */
data[dst_offset + 1] = src[src_offset];
data[dst_offset + 32] = src[src_offset + 1];
data[dst_offset + 33] = src[src_offset + 2];
}
}
}
}
DCFlushRange(data, BufSize);
return TE_OK;
}
STexture::TexErr STexture::fromPNG(const u8 *buffer, u8 f, Alloc alloc, u32 minMipSize, u32 maxMipSize)
STexture::TexErr STexture::fromJPG(const u8 *buffer, const u32 buffer_size, u8 f, u32 minMipSize, u32 maxMipSize)
{
PNGUPROP imgProp;
SmartBuf tmpData;
TexErr result = TE_ERROR;
VideoFrame VideoF;
decodeRealJpeg(buffer, buffer_size, VideoF, true);
if(!VideoF.getData())
return result;
result = fromRAW(VideoF.getData(), VideoF.getWidth(), VideoF.getHeight(), f, minMipSize, maxMipSize);
VideoF.dealloc();
return result;
}
STexture::TexErr STexture::fromPNG(const u8 *buffer, u8 f, u32 minMipSize, u32 maxMipSize)
{
Cleanup();
u8 maxLODTmp = 0;
u8 minLODTmp = 0;
u32 baseWidth;
u32 baseHeight;
IMGCTX ctx = PNGU_SelectImageFromBuffer(buffer);
if (ctx == 0) return STexture::TE_ERROR;
if (PNGU_GetImageProperties(ctx, &imgProp) != PNGU_OK)
if(ctx == 0)
return TE_ERROR;
PNGUPROP imgProp;
if(PNGU_GetImageProperties(ctx, &imgProp) != PNGU_OK)
{
PNGU_ReleaseImageContext(ctx);
return STexture::TE_ERROR;
return TE_ERROR;
}
if (imgProp.imgWidth > 1090 || imgProp.imgHeight > 1090)
if(imgProp.imgWidth > 1090 || imgProp.imgHeight > 1090)
{
PNGU_ReleaseImageContext(ctx);
return STexture::TE_ERROR;
return TE_ERROR;
}
switch (f)
{
@ -379,8 +417,8 @@ STexture::TexErr STexture::fromPNG(const u8 *buffer, u8 f, Alloc alloc, u32 minM
}
u32 pngWidth = imgProp.imgWidth & (f == GX_TF_CMPR ? ~7u : ~3u);
u32 pngHeight = imgProp.imgHeight & (f == GX_TF_CMPR ? ~7u : ~3u);
if (minMipSize > 0 || maxMipSize > 0)
STexture::_calcMipMaps(maxLODTmp, minLODTmp, baseWidth, baseHeight, imgProp.imgWidth, imgProp.imgHeight, minMipSize, maxMipSize);
if(minMipSize > 0 || maxMipSize > 0)
_calcMipMaps(maxLODTmp, minLODTmp, baseWidth, baseHeight, imgProp.imgWidth, imgProp.imgHeight, minMipSize, maxMipSize);
if (maxLODTmp > 0)
{
u32 newWidth = baseWidth;
@ -391,44 +429,37 @@ STexture::TexErr STexture::fromPNG(const u8 *buffer, u8 f, Alloc alloc, u32 minM
newHeight >>= 1;
}
u32 Size2 = imgProp.imgWidth * imgProp.imgHeight * 4;
SmartBuf tmpData2 = smartMem2Alloc(Size2);
u32 Size = fixGX_GetTexBufferSize(newWidth, newHeight, f, GX_TRUE, maxLODTmp - minLODTmp);
switch (alloc)
u8 *tmpData2 = (u8*)MEM2_alloc(Size2);
if(tmpData2 == NULL)
{
case ALLOC_MEM2:
tmpData = smartMem2Alloc(Size);
break;
case ALLOC_MALLOC:
tmpData = smartMemAlign32(Size);
break;
}
if (!tmpData || !tmpData2)
{
tmpData.release();
tmpData2.release();
PNGU_ReleaseImageContext(ctx);
return STexture::TE_NOMEM;
return TE_NOMEM;
}
memset(tmpData2.get(), 0, Size2);
DCFlushRange(tmpData2.get(), Size2);
PNGU_DecodeToRGBA8(ctx, imgProp.imgWidth, imgProp.imgHeight, tmpData2.get(), 0, 0xFF);
memset(tmpData2, 0, Size2);
PNGU_DecodeToRGBA8(ctx, imgProp.imgWidth, imgProp.imgHeight, tmpData2, 0, 0xFF);
PNGU_ReleaseImageContext(ctx);
DCFlushRange(tmpData2.get(), Size2);
tmpData2 = STexture::_genMipMaps(tmpData2.get(), imgProp.imgWidth, imgProp.imgHeight, maxLODTmp, baseWidth, baseHeight);
if (!tmpData2) return STexture::TE_NOMEM;
tmpData2 = _genMipMaps(tmpData2, imgProp.imgWidth, imgProp.imgHeight, maxLODTmp, baseWidth, baseHeight);
if(tmpData2 == NULL)
return TE_NOMEM;
u32 nWidth = newWidth;
u32 nHeight = newHeight;
u8 *pSrc = tmpData2.get();
if (minLODTmp > 0)
pSrc += fixGX_GetTexBufferSize(baseWidth, baseHeight, GX_TF_RGBA8, minLODTmp > 1 ? GX_TRUE : GX_FALSE, minLODTmp - 1);
memset(tmpData.get(), 0, Size);
DCFlushRange(tmpData.get(), Size);
u8 *pDst = tmpData.get();
for (u8 i = minLODTmp; i <= maxLODTmp; ++i)
u8 *pSrc = tmpData2;
if(minLODTmp > 0)
pSrc += fixGX_GetTexBufferSize(baseWidth, baseHeight, f, minLODTmp > 1 ? GX_TRUE : GX_FALSE, minLODTmp - 1);
u32 Size = fixGX_GetTexBufferSize(newWidth, newHeight, f, GX_TRUE, maxLODTmp - minLODTmp);
data = (u8*)MEM2_alloc(Size);
if(data == NULL)
{
switch (f)
free(tmpData2);
return TE_NOMEM;
}
memset(data, 0, Size);
u8 *pDst = data;
for(u8 i = minLODTmp; i <= maxLODTmp; ++i)
{
switch(f)
{
case GX_TF_RGBA8:
_convertToRGBA8(pDst, pSrc, nWidth, nHeight);
@ -445,53 +476,43 @@ STexture::TexErr STexture::fromPNG(const u8 *buffer, u8 f, Alloc alloc, u32 minM
nWidth >>= 1;
nHeight >>= 1;
}
free(tmpData2);
maxLOD = maxLODTmp - minLODTmp;
data = tmpData;
format = f;
width = newWidth;
height = newHeight;
DCFlushRange(data.get(), fixGX_GetTexBufferSize(width, height, format, maxLOD > 0 ? GX_TRUE : GX_FALSE, maxLOD));
DCFlushRange(data, Size);
}
else
{
u32 Size = GX_GetTexBufferSize(pngWidth, pngHeight, f, GX_FALSE, 0);
switch (alloc)
{
case ALLOC_MEM2:
tmpData = smartMem2Alloc(Size);
break;
case ALLOC_MALLOC:
tmpData = smartMemAlign32(Size);
break;
}
if (!tmpData)
data = (u8*)MEM2_alloc(Size);
if(data == NULL)
{
PNGU_ReleaseImageContext(ctx);
return STexture::TE_NOMEM;
return TE_NOMEM;
}
memset(tmpData.get(), 0, Size);
DCFlushRange(tmpData.get(), Size);
memset(data, 0, Size);
format = f;
width = pngWidth;
height = pngHeight;
maxLOD = 0;
data = tmpData;
switch (f)
{
case GX_TF_RGBA8:
PNGU_DecodeTo4x4RGBA8(ctx, imgProp.imgWidth, imgProp.imgHeight, data.get(), 0xFF);
PNGU_DecodeTo4x4RGBA8(ctx, imgProp.imgWidth, imgProp.imgHeight, data, 0xFF);
break;
case GX_TF_RGB565:
PNGU_DecodeTo4x4RGB565(ctx, imgProp.imgWidth, imgProp.imgHeight, data.get());
PNGU_DecodeTo4x4RGB565(ctx, imgProp.imgWidth, imgProp.imgHeight, data);
break;
case GX_TF_CMPR:
PNGU_DecodeToCMPR(ctx, imgProp.imgWidth, imgProp.imgHeight, data.get());
PNGU_DecodeToCMPR(ctx, imgProp.imgWidth, imgProp.imgHeight, data);
break;
}
PNGU_ReleaseImageContext(ctx);
DCFlushRange(data.get(), Size);
DCFlushRange(data, Size);
}
return STexture::TE_OK;
return TE_OK;
}
void STexture::_resize(u8 *dst, u32 dstWidth, u32 dstHeight, const u8 *src, u32 srcWidth, u32 srcHeight)
@ -607,23 +628,26 @@ void STexture::_calcMipMaps(u8 &maxLOD, u8 &minLOD, u32 &lod0Width, u32 &lod0Hei
maxLOD = minLOD;
}
SmartBuf STexture::_genMipMaps(const u8 *src, u32 width, u32 height, u8 maxLOD, u32 lod0Width, u32 lod0Height)
u8 *STexture::_genMipMaps(u8 *src, u32 width, u32 height, u8 maxLOD, u32 lod0Width, u32 lod0Height)
{
u32 bufSize = fixGX_GetTexBufferSize(lod0Width, lod0Height, GX_TF_RGBA8, GX_TRUE, maxLOD);
SmartBuf dst = smartMem2Alloc(bufSize);
if (!dst) return dst;
memset(dst.get(), 0, bufSize);
DCFlushRange(dst.get(), bufSize);
STexture::_resize(dst.get(), lod0Width, lod0Height, src, width, height);
DCFlushRange(dst.get(), lod0Width * lod0Height * 4);
u8 *dst = (u8*)MEM2_alloc(bufSize);
if(dst == NULL)
return src;
memset(dst, 0, bufSize);
_resize(dst, lod0Width, lod0Height, src, width, height);
DCFlushRange(dst, lod0Width * lod0Height * 4);
free(src);
src = NULL;
u32 nWidth = lod0Width;
u32 nHeight = lod0Height;
u8 *pDst = dst.get();
for (u8 i = 0; i < maxLOD; ++i)
u8 *pDst = dst;
for(u8 i = 0; i < maxLOD; ++i)
{
u8 *pSrc = pDst;
pDst += nWidth * nHeight * 4;
STexture::_resizeD2x2(pDst, pSrc, nWidth, nHeight);
_resizeD2x2(pDst, pSrc, nWidth, nHeight);
DCFlushRange(pDst, nWidth * nWidth);
nWidth >>= 1;
nHeight >>= 1;

View File

@ -4,29 +4,31 @@
#include <gccore.h>
#include "memory/smartptr.hpp"
struct STexture
class STexture
{
SmartBuf data;
public:
STexture(void) : data(NULL), width(0), height(0), format(-1), maxLOD(0) { }
void Cleanup();
u8 *data;
u32 width;
u32 height;
u8 format;
u8 maxLOD;
STexture(void) : data(), width(0), height(0), format(-1), maxLOD(0) { }
// Utility funcs
enum TexErr { TE_OK, TE_ERROR, TE_NOMEM };
// Get from PNG, if not found from JPG
TexErr fromImageFile(const char *filename, u8 f = -1, Alloc alloc = ALLOC_MEM2, u32 minMipSize = 0, u32 maxMipSize = 0);
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
TexErr fromPNG(const u8 *buffer, u8 f = -1, Alloc alloc = ALLOC_MEM2, u32 minMipSize = 0, u32 maxMipSize = 0);
TexErr fromRAW(const u8 *buffer, u32 w, u32 h, u8 f = -1, Alloc alloc = ALLOC_MEM2, u32 minMipSize = 0, u32 maxMipSize = 0);
TexErr fromJPG(const u8 *buffer, const u32 buffer_size, u8 f = -1, Alloc alloc = ALLOC_MEM2, u32 minMipSize = 0, u32 maxMipSize = 0);
TexErr fromPNG(const u8 *buffer, u8 f = -1, u32 minMipSize = 0, u32 maxMipSize = 0);
TexErr fromRAW(const u8 *buffer, u32 w, u32 h, u8 f = -1, u32 minMipSize = 0, u32 maxMipSize = 0);
TexErr fromJPG(const u8 *buffer, const u32 buffer_size, u8 f = -1, u32 minMipSize = 0, u32 maxMipSize = 0);
/* Just for THP */
TexErr fromTHP(const u8 *buffer, u32 w, u32 h);
private:
static void _resize(u8 *dst, u32 dstWidth, u32 dstHeight, const u8 *src, u32 srcWidth, u32 srcHeight);
static void _resizeD2x2(u8 *dst, const u8 *src, u32 srcWidth, u32 srcHeight);
static SmartBuf _genMipMaps(const u8 *src, u32 width, u32 height, u8 maxLOD, u32 lod0Width, u32 lod0Height);
static void _calcMipMaps(u8 &maxLOD, u8 &minLOD, u32 &lod0Width, u32 &lod0Height, u32 width, u32 height, u32 minSize, u32 maxSize);
void _resize(u8 *dst, u32 dstWidth, u32 dstHeight, const u8 *src, u32 srcWidth, u32 srcHeight);
void _resizeD2x2(u8 *dst, const u8 *src, u32 srcWidth, u32 srcHeight);
u8 *_genMipMaps(u8 *src, u32 width, u32 height, u8 maxLOD, u32 lod0Width, u32 lod0Height);
void _calcMipMaps(u8 &maxLOD, u8 &minLOD, u32 &lod0Width, u32 &lod0Height, u32 width, u32 height, u32 minSize, u32 maxSize);
};
u32 fixGX_GetTexBufferSize(u16 wd, u16 ht, u32 fmt, u8 mipmap, u8 maxlod);

View File

@ -1,7 +1,8 @@
#include <string.h>
#include <unistd.h>
#include <malloc.h>
#include "memory/mem2.hpp"
#include "video.hpp"
#include "pngu.h"
#include "Gekko.h"
@ -79,7 +80,7 @@ const int CVideo::_stencilWidth = 128;
const int CVideo::_stencilHeight = 128;
static lwp_t waitThread = LWP_THREAD_NULL;
SmartBuf waitThreadStack;
u8 *waitThreadStack;
CVideo m_vid;
CVideo::CVideo(void) :
@ -232,16 +233,16 @@ void CVideo::setup2DProjection(bool setViewPort, bool noScale)
void CVideo::renderToTexture(STexture &tex, bool clear)
{
if (!tex.data) tex.data = smartMem2Alloc(GX_GetTexBufferSize(tex.width, tex.height, tex.format, GX_FALSE, 0));
if (!tex.data) tex.data = (u8*)MEM2_alloc(GX_GetTexBufferSize(tex.width, tex.height, tex.format, GX_FALSE, 0));
if (!tex.data) return;
GX_DrawDone();
GX_SetCopyFilter(GX_FALSE, NULL, GX_FALSE, NULL);
GX_SetTexCopySrc(0, 0, tex.width, tex.height);
GX_SetTexCopyDst(tex.width, tex.height, tex.format, GX_FALSE);
GX_CopyTex(tex.data.get(), clear ? GX_TRUE : GX_FALSE);
GX_CopyTex(tex.data, clear ? GX_TRUE : GX_FALSE);
GX_PixModeSync();
GX_SetCopyFilter(m_rmode->aa, m_rmode->sample_pattern, GX_TRUE, m_rmode->vfilter);
DCFlushRange(tex.data.get(), GX_GetTexBufferSize(tex.width, tex.height, tex.format, GX_FALSE, 0));
DCFlushRange(tex.data, GX_GetTexBufferSize(tex.width, tex.height, tex.format, GX_FALSE, 0));
GX_SetScissor(0, 0, m_rmode->fbWidth, m_rmode->efbHeight);
}
@ -269,15 +270,18 @@ void CVideo::cleanup(void)
for(u8 i = 0; i < sizeof m_aaBuffer / sizeof m_aaBuffer[0]; ++i)
{
if(m_aaBuffer[i].get())
m_aaBuffer[i].release();
if(m_aaBuffer[i])
free(m_aaBuffer[i]);
m_aaBuffer[i] = NULL;
m_aaBufferSize[i] = 0;
}
for(u8 i = 0; i < m_defaultWaitMessages.size(); i++)
m_defaultWaitMessages[i].data.release();
if(waitThreadStack.get())
waitThreadStack.release();
{
if(m_defaultWaitMessages[i].data != NULL)
free(m_defaultWaitMessages[i].data);
}
if(waitThreadStack != NULL)
free(waitThreadStack);
free(MEM_K1_TO_K0(m_frameBuf[0]));
free(MEM_K1_TO_K0(m_frameBuf[1]));
free(m_stencil);
@ -333,8 +337,8 @@ void CVideo::renderAAPass(int aaStep)
if (!m_aaBuffer[aaStep] || m_aaBufferSize[aaStep] < bufLen)
{
m_aaBuffer[aaStep] = smartMem2Alloc(bufLen);
if (!!m_aaBuffer[aaStep])
m_aaBuffer[aaStep] = (u8*)MEM2_alloc(bufLen);
if (m_aaBuffer[aaStep] != NULL)
m_aaBufferSize[aaStep] = bufLen;
}
if (!m_aaBuffer[aaStep] || m_aaBufferSize[aaStep] < bufLen)
@ -344,7 +348,7 @@ void CVideo::renderAAPass(int aaStep)
GX_SetCopyFilter(GX_FALSE, NULL, GX_FALSE, NULL);
GX_SetTexCopySrc(0, 0, w, h);
GX_SetTexCopyDst(w, h, texFmt, GX_FALSE);
GX_CopyTex(m_aaBuffer[aaStep].get(), GX_TRUE);
GX_CopyTex(m_aaBuffer[aaStep], GX_TRUE);
GX_PixModeSync();
GX_SetCopyFilter(m_rmode->aa, m_rmode->sample_pattern, GX_TRUE, m_rmode->vfilter);
}
@ -374,7 +378,7 @@ void CVideo::drawAAScene(bool fs)
GX_SetNumChans(0);
for (int i = 0; i < aa; ++i)
{
GX_InitTexObj(&texObj[i], m_aaBuffer[i].get(), tw , th, texFmt, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj[i], m_aaBuffer[i], tw , th, texFmt, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_LoadTexObj(&texObj[i], GX_TEXMAP0 + i);
}
GX_SetNumTexGens(1);
@ -593,9 +597,9 @@ void CVideo::waitMessage(const vector<STexture> &tex, float delay)
else if(m_waitMessages.size() > 1)
{
m_showWaitMessage = true;
if(!waitThreadStack.get())
waitThreadStack = smartMem2Alloc(8192);
LWP_CreateThread(&waitThread, (void *(*)(void *))CVideo::_showWaitMessages, (void *)this, waitThreadStack.get(), 8192, LWP_PRIO_HIGHEST);
if(waitThreadStack != NULL)
waitThreadStack = (u8*)MEM2_alloc(8192);
LWP_CreateThread(&waitThread, (void *(*)(void *))_showWaitMessages, (void *)this, waitThreadStack, 8192, LWP_PRIO_HIGHEST);
}
}
@ -622,7 +626,7 @@ void CVideo::waitMessage(const STexture &tex)
GX_SetZMode(GX_DISABLE, GX_ALWAYS, GX_FALSE);
guMtxIdentity(modelViewMtx);
GX_LoadPosMtxImm(modelViewMtx, GX_PNMTX0);
GX_InitTexObj(&texObj, tex.data.get(), tex.width, tex.height, tex.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
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_Position3f32((float)((640 - tex.width) / 2), (float)((480 - tex.height) / 2), 0.f);

View File

@ -4,8 +4,6 @@
#include <gccore.h>
#include <vector>
#include "memory/smartptr.hpp"
#include "vector.hpp"
#include "texture.hpp"
@ -93,7 +91,7 @@ private:
bool m_aaAlpha;
int m_aaWidth;
int m_aaHeight;
SmartBuf m_aaBuffer[8];
u8 *m_aaBuffer[8];
u32 m_aaBufferSize[8];
float m_vpX;
float m_vpY;

View File

@ -1,22 +0,0 @@
#include "smartptr.hpp"
SmartBuf smartMemAlign32(unsigned int size)
{
return smartAnyAlloc(size);
}
SmartBuf smartMem2Alloc(unsigned int size)
{
return SmartBuf((unsigned char *)MEM2_alloc(size), SmartBuf::SRCALL_MEM2);
}
SmartBuf smartMem1Alloc(unsigned int size)
{
return SmartBuf((unsigned char *)MEM1_alloc(size), SmartBuf::SRCALL_MEM1);
}
SmartBuf smartAnyAlloc(unsigned int size)
{
SmartBuf p(smartMem2Alloc(size));
return !!p ? p : smartMem1Alloc(size);
}

View File

@ -1,75 +0,0 @@
// A simple smart pointer class i made a long time ago, quickly adpated to the multiple alloc functions
// Not thread-safe (on copy & on destruction)
#ifndef __SMARTPTR_HPP
#define __SMARTPTR_HPP
#include <algorithm>
#include <malloc.h>
#include "mem2.hpp"
#include "loader/utils.h"
#include "music/gui_sound.h"
template <class T> class SmartPtr
{
public:
enum SrcAlloc { SRCALL_NEW, SRCALL_MEM1, SRCALL_MEM2 };
T &operator*(void) const { return *m_p; }
T *operator->(void) const { return m_p; }
bool operator!(void) const { return m_p == NULL; }
T *get(void) const { return m_p; }
virtual void release(void)
{
if (m_p != NULL && m_refcount != NULL && --*m_refcount == 0)
{
switch(m_srcAlloc)
{
case SRCALL_NEW:
delete m_p;
break;
default:
free(m_p);
break;
}
delete m_refcount;
}
m_p = NULL;
m_refcount = NULL;
}
SmartPtr<T> &operator=(const SmartPtr<T> &sp)
{
SmartPtr<T> temp(sp);
_swap(temp);
return *this;
}
explicit SmartPtr<T>(T *p = NULL, SrcAlloc t = SRCALL_NEW) : m_p(p), m_refcount(p != NULL ? new int(1) : NULL), m_srcAlloc(t) { }
SmartPtr<T>(const SmartPtr<T> &sp) : m_p(sp.m_p), m_refcount(sp.m_refcount), m_srcAlloc(sp.m_srcAlloc)
{
if (m_refcount != NULL)
++*m_refcount;
}
virtual ~SmartPtr<T>(void) { release(); }
protected:
T *m_p;
int *m_refcount;
SrcAlloc m_srcAlloc;
protected:
void _swap(SmartPtr<T> &sp) throw()
{
std::swap(m_p, sp.m_p);
std::swap(m_refcount, sp.m_refcount);
std::swap(m_srcAlloc, sp.m_srcAlloc);
}
};
typedef SmartPtr<unsigned char> SmartBuf;
typedef SmartPtr<GuiSound> SmartGuiSound;
SmartBuf smartMemAlign32(unsigned int size);
SmartBuf smartMem2Alloc(unsigned int size);
SmartBuf smartAnyAlloc(unsigned int size);
SmartBuf smartMem1Alloc(unsigned int size);
#endif // !defined(__SMARTPTR_HPP)

File diff suppressed because it is too large Load Diff

View File

@ -661,7 +661,6 @@ private:
volatile bool m_thrdMessageAdded;
volatile bool m_gameSelected;
GuiSound m_gameSound;
SmartGuiSound m_cameraSound;
dir_discHdr *m_gameSoundHdr;
lwp_t m_gameSoundThread;
bool m_gamesound_changed;
@ -680,7 +679,7 @@ private:
typedef pair<string, u32> FontDesc;
typedef map<FontDesc, SFont> FontSet;
typedef map<string, STexture> TexSet;
typedef map<string, SmartGuiSound> SoundSet;
typedef map<string, GuiSound*> SoundSet;
struct SThemeData
{
TexSet texSet;
@ -775,9 +774,9 @@ private:
STexture btnTexPlusS;
STexture btnTexMinus;
STexture btnTexMinusS;
SmartGuiSound clickSound;
SmartGuiSound hoverSound;
SmartGuiSound cameraSound;
GuiSound *clickSound;
GuiSound *hoverSound;
GuiSound *cameraSound;
};
SThemeData theme;
struct SCFParamDesc
@ -814,30 +813,30 @@ private:
bool _loadHomebrewList(void);
void _initCF(void);
//
void _initMainMenu(SThemeData &theme);
void _initErrorMenu(SThemeData &theme);
void _initConfigMenu(SThemeData &theme);
void _initConfigAdvMenu(SThemeData &theme);
void _initConfig3Menu(SThemeData &theme);
void _initConfig4Menu(SThemeData &theme);
void _initConfigSndMenu(SThemeData &theme);
void _initConfigScreenMenu(SThemeData &theme);
void _initGameMenu(SThemeData &theme);
void _initDownloadMenu(SThemeData &theme);
void _initCodeMenu(SThemeData &theme);
void _initAboutMenu(SThemeData &theme);
void _initWBFSMenu(SThemeData &theme);
void _initCFThemeMenu(SThemeData &theme);
void _initGameSettingsMenu(SThemeData &theme);
void _initCheatSettingsMenu(SThemeData &theme);
void _initMainMenu();
void _initErrorMenu();
void _initConfigMenu();
void _initConfigAdvMenu();
void _initConfig3Menu();
void _initConfig4Menu();
void _initConfigSndMenu();
void _initConfigScreenMenu();
void _initGameMenu();
void _initDownloadMenu();
void _initCodeMenu();
void _initAboutMenu();
void _initWBFSMenu();
void _initCFThemeMenu();
void _initGameSettingsMenu();
void _initCheatSettingsMenu();
void _initCheatButtons();
void _initSourceMenu(SThemeData &theme);
void _initPluginSettingsMenu(SThemeData &theme);
void _initCategorySettingsMenu(SThemeData &theme);
void _initSystemMenu(SThemeData &theme);
void _initGameInfoMenu(SThemeData &theme);
void _initNandEmuMenu(CMenu::SThemeData &theme);
void _initHomeAndExitToMenu(CMenu::SThemeData &theme);
void _initSourceMenu();
void _initPluginSettingsMenu();
void _initCategorySettingsMenu();
void _initSystemMenu();
void _initGameInfoMenu();
void _initNandEmuMenu();
void _initHomeAndExitToMenu();
//
void _textSource(void);
void _textPluginSettings(void);
@ -973,7 +972,7 @@ public:
private:
bool m_use_wifi_gecko;
void _reload_wifi_gecko();
bool _loadFile(SmartBuf &buffer, u32 &size, const char *path, const char *file);
bool _loadFile(u8 *buffer, u32 &size, const char *path, const char *file);
int _loadIOS(u8 ios, int userIOS, string id);
void _launch(dir_discHdr *hdr);
void _launchGame(dir_discHdr *hdr, bool dvd);
@ -981,7 +980,7 @@ private:
void _launchHomebrew(const char *filepath, vector<string> arguments);
void _launchGC(dir_discHdr *hdr, bool disc);
void _setAA(int aa);
void _loadCFCfg(SThemeData &theme);
void _loadCFCfg();
void _loadCFLayout(int version, bool forceAA = false, bool otherScrnFmt = false);
Vector3D _getCFV3D(const string &domain, const string &key, const Vector3D &def, bool otherScrnFmt = false);
int _getCFInt(const string &domain, const string &key, int def, bool otherScrnFmt = false);
@ -990,6 +989,7 @@ private:
void _buildMenus(void);
void _loadDefaultFont(bool korean);
void _cleanupDefaultFont();
void _Theme_Cleanup();
string _getId(void);
const char *_domainFromView(void);
const char *_cfDomain(bool selected = false);
@ -997,27 +997,27 @@ private:
int MIOSisDML();
void RemoveCover(const char *id);
SFont _font(CMenu::FontSet &fontSet, const char *domain, const char *key, u32 fontSize, u32 lineSpacing, u32 weight, u32 index, const char *genKey);
STexture _texture(TexSet &texSet, const char *domain, const char *key, STexture def);
vector<STexture> _textures(TexSet &texSet, const char *domain, const char *key);
STexture _texture(const char *domain, const char *key, STexture &def, bool freeDef = true);
vector<STexture> _textures(const char *domain, const char *key);
void _showWaitMessage();
public:
void _hideWaitMessage();
bool m_Emulator_boot;
private:
SmartGuiSound _sound(CMenu::SoundSet &soundSet, const char *domain, const char *key, const u8 * snd, u32 len, string name, bool isAllocated);
SmartGuiSound _sound(CMenu::SoundSet &soundSet, const char *domain, const char *key, string name);
GuiSound *_sound(CMenu::SoundSet &soundSet, const char *domain, const char *key, const u8 * snd, u32 len, string name, bool isAllocated);
GuiSound *_sound(CMenu::SoundSet &soundSet, const char *domain, const char *key, string name);
u16 _textStyle(const char *domain, const char *key, u16 def);
s16 _addButton(SThemeData &theme, const char *domain, SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color);
s16 _addSelButton(SThemeData &theme, const char *domain, SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color);
s16 _addPicButton(SThemeData &theme, const char *domain, STexture &texNormal, STexture &texSelected, int x, int y, u32 width, u32 height);
s16 _addTitle(SThemeData &theme, const char *domain, SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color, s16 style);
s16 _addText(SThemeData &theme, const char *domain, SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color, s16 style);
s16 _addLabel(SThemeData &theme, const char *domain, SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color, s16 style);
s16 _addLabel(SThemeData &theme, const char *domain, SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color, s16 style, STexture &bg);
s16 _addProgressBar(SThemeData &theme, const char *domain, int x, int y, u32 width, u32 height);
s16 _addButton(const char *domain, SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color);
s16 _addSelButton(const char *domain, SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color);
s16 _addPicButton(const char *domain, STexture &texNormal, STexture &texSelected, int x, int y, u32 width, u32 height);
s16 _addTitle(const char *domain, SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color, s16 style);
s16 _addText(const char *domain, SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color, s16 style);
s16 _addLabel(const char *domain, SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color, s16 style);
s16 _addLabel(const char *domain, SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color, s16 style, STexture &bg);
s16 _addProgressBar(const char *domain, int x, int y, u32 width, u32 height);
void _setHideAnim(s16 id, const char *domain, int dx, int dy, float scaleX, float scaleY);
void _addUserLabels(CMenu::SThemeData &theme, s16 *ids, u32 size, const char *domain);
void _addUserLabels(CMenu::SThemeData &theme, s16 *ids, u32 start, u32 size, const char *domain);
void _addUserLabels(s16 *ids, u32 size, const char *domain);
void _addUserLabels(s16 *ids, u32 start, u32 size, const char *domain);
//
const wstringEx _t(const char *key, const wchar_t *def = L"") { return m_loc.getWString(m_curLanguage, key, def); }
const wstringEx _fmt(const char *key, const wchar_t *def);

View File

@ -91,14 +91,14 @@ void CMenu::_showAbout(void)
}
}
void CMenu::_initAboutMenu(CMenu::SThemeData &theme)
void CMenu::_initAboutMenu()
{
STexture emptyTex;
_addUserLabels(theme, m_aboutLblUser, ARRAY_SIZE(m_aboutLblUser), "ABOUT");
m_aboutBg = _texture(theme.texSet, "ABOUT/BG", "texture", theme.bg);
m_aboutLblTitle = _addTitle(theme, "ABOUT/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_aboutLblInfo = _addText(theme, "ABOUT/INFO", theme.txtFont, L"", 40, 115, 560, 270, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
m_aboutLblIOS = _addLabel(theme, "ABOUT/IOS", theme.txtFont, L"", 240, 400, 360, 56, theme.txtFontColor, FTGX_JUSTIFY_RIGHT | FTGX_ALIGN_MIDDLE);
_addUserLabels(m_aboutLblUser, ARRAY_SIZE(m_aboutLblUser), "ABOUT");
m_aboutBg = _texture("ABOUT/BG", "texture", theme.bg, false);
m_aboutLblTitle = _addTitle("ABOUT/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_aboutLblInfo = _addText("ABOUT/INFO", theme.txtFont, L"", 40, 115, 560, 270, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
m_aboutLblIOS = _addLabel("ABOUT/IOS", theme.txtFont, L"", 240, 400, 360, 56, theme.txtFontColor, FTGX_JUSTIFY_RIGHT | FTGX_ALIGN_MIDDLE);
_setHideAnim(m_aboutLblTitle, "ABOUT/TITLE", 0, 0, -2.f, 0.f);
_setHideAnim(m_aboutLblInfo, "ABOUT/INFO", 0, 100, 0.f, 0.f);

View File

@ -356,29 +356,29 @@ void CMenu::_CategorySettings(bool fromGameSet)
_hideCategorySettings();
}
void CMenu::_initCategorySettingsMenu(CMenu::SThemeData &theme)
void CMenu::_initCategorySettingsMenu()
{
_addUserLabels(theme, m_categoryLblUser, ARRAY_SIZE(m_categoryLblUser), "CATEGORY");
m_categoryBg = _texture(theme.texSet, "CATEGORY/BG", "texture", theme.bg);
m_categoryLblTitle = _addTitle(theme, "CATEGORY/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_categoryBtnPageM = _addPicButton(theme, "CATEGORY/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 20, 400, 56, 56);
m_categoryLblPage = _addLabel(theme, "CATEGORY/PAGE_BTN", theme.btnFont, L"", 76, 400, 100, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_categoryBtnPageP = _addPicButton(theme, "CATEGORY/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 176, 400, 56, 56);
m_categoryBtnBack = _addButton(theme, "CATEGORY/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
m_categoryBtnClear = _addButton(theme, "CATEGORY/CLEAR_BTN", theme.btnFont, L"", 255, 400, 150, 56, theme.btnFontColor);
_addUserLabels(m_categoryLblUser, ARRAY_SIZE(m_categoryLblUser), "CATEGORY");
m_categoryBg = _texture("CATEGORY/BG", "texture", theme.bg, false);
m_categoryLblTitle = _addTitle("CATEGORY/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_categoryBtnPageM = _addPicButton("CATEGORY/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 20, 400, 56, 56);
m_categoryLblPage = _addLabel("CATEGORY/PAGE_BTN", theme.btnFont, L"", 76, 400, 100, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_categoryBtnPageP = _addPicButton("CATEGORY/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 176, 400, 56, 56);
m_categoryBtnBack = _addButton("CATEGORY/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
m_categoryBtnClear = _addButton("CATEGORY/CLEAR_BTN", theme.btnFont, L"", 255, 400, 150, 56, theme.btnFontColor);
for(u8 i = 1; i < 6; ++i)
{ // left half
m_categoryBtnCat[i] = _addPicButton(theme, fmt("CATEGORY/CAT_%i_BTN", i), theme.checkboxoff, theme.checkboxoffs, 30, (42+i*58), 44, 48);
m_categoryBtnCats[i] = _addPicButton(theme, fmt("CATEGORY/CAT_%i_BTNS", i), theme.checkboxon, theme.checkboxons, 30, (42+i*58), 44, 48);
m_categoryBtnCatHid[i] = _addPicButton(theme, fmt("CATEGORY/CAT_%i_BTNHID", i), theme.checkboxHid, theme.checkboxHids, 30, (42+i*58), 44, 48);
m_categoryBtnCatReq[i] = _addPicButton(theme, fmt("CATEGORY/CAT_%i_BTNREQ", i), theme.checkboxReq, theme.checkboxReqs, 30, (42+i*58), 44, 48);
m_categoryLblCat[i] = _addLabel(theme, fmt("CATEGORY/CAT_%i", i), theme.lblFont, L"", 85, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_categoryBtnCat[i] = _addPicButton(fmt("CATEGORY/CAT_%i_BTN", i), theme.checkboxoff, theme.checkboxoffs, 30, (42+i*58), 44, 48);
m_categoryBtnCats[i] = _addPicButton(fmt("CATEGORY/CAT_%i_BTNS", i), theme.checkboxon, theme.checkboxons, 30, (42+i*58), 44, 48);
m_categoryBtnCatHid[i] = _addPicButton(fmt("CATEGORY/CAT_%i_BTNHID", i), theme.checkboxHid, theme.checkboxHids, 30, (42+i*58), 44, 48);
m_categoryBtnCatReq[i] = _addPicButton(fmt("CATEGORY/CAT_%i_BTNREQ", i), theme.checkboxReq, theme.checkboxReqs, 30, (42+i*58), 44, 48);
m_categoryLblCat[i] = _addLabel(fmt("CATEGORY/CAT_%i", i), theme.lblFont, L"", 85, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
// right half
m_categoryBtnCat[i+5] = _addPicButton(theme, fmt("CATEGORY/CAT_%i_BTN", i+5), theme.checkboxoff, theme.checkboxoffs, 325, (42+i*58), 44, 48);
m_categoryBtnCats[i+5] = _addPicButton(theme, fmt("CATEGORY/CAT_%i_BTNS", i+5), theme.checkboxon, theme.checkboxons, 325, (42+i*58), 44, 48);
m_categoryBtnCatHid[i+5] = _addPicButton(theme, fmt("CATEGORY/CAT_%i_BTNHID", i+5), theme.checkboxHid, theme.checkboxHids, 325, (42+i*58), 44, 48);
m_categoryBtnCatReq[i+5] = _addPicButton(theme, fmt("CATEGORY/CAT_%i_BTNREQ", i+5), theme.checkboxReq, theme.checkboxReqs, 325, (42+i*58), 44, 48);
m_categoryLblCat[i+5] = _addLabel(theme, fmt("CATEGORY/CAT_%i", i+5), theme.txtFont, L"", 380, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_categoryBtnCat[i+5] = _addPicButton(fmt("CATEGORY/CAT_%i_BTN", i+5), theme.checkboxoff, theme.checkboxoffs, 325, (42+i*58), 44, 48);
m_categoryBtnCats[i+5] = _addPicButton(fmt("CATEGORY/CAT_%i_BTNS", i+5), theme.checkboxon, theme.checkboxons, 325, (42+i*58), 44, 48);
m_categoryBtnCatHid[i+5] = _addPicButton(fmt("CATEGORY/CAT_%i_BTNHID", i+5), theme.checkboxHid, theme.checkboxHids, 325, (42+i*58), 44, 48);
m_categoryBtnCatReq[i+5] = _addPicButton(fmt("CATEGORY/CAT_%i_BTNREQ", i+5), theme.checkboxReq, theme.checkboxReqs, 325, (42+i*58), 44, 48);
m_categoryLblCat[i+5] = _addLabel(fmt("CATEGORY/CAT_%i", i+5), theme.txtFont, L"", 380, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
}
_setHideAnim(m_categoryLblTitle, "CATEGORY/TITLE", 0, 0, -2.f, 0.f);
_setHideAnim(m_categoryLblPage, "CATEGORY/PAGE_BTN", 0, 0, 1.f, -1.f);

View File

@ -563,33 +563,33 @@ const char *CMenu::_cfDomain(bool selected)
}
}
void CMenu::_initCFThemeMenu(CMenu::SThemeData &theme)
void CMenu::_initCFThemeMenu()
{
STexture emptyTex;
string domain;
int x;
int y;
m_cfThemeBtnAlt = _addButton(theme, "CFTHEME/ALT_BTN", theme.btnFont, L"", 20, 20, 60, 30, theme.btnFontColor);
m_cfThemeBtnSelect = _addButton(theme, "CFTHEME/SELECT_BTN", theme.btnFont, L"", 80, 20, 60, 30, theme.btnFontColor);
m_cfThemeBtnWide = _addButton(theme, "CFTHEME/WIDE_BTN", theme.btnFont, L"", 20, 60, 60, 30, theme.btnFontColor);
m_cfThemeLblParam = _addLabel(theme, "CFTHEME/PARAM_BTN", theme.btnFont, L"", 176, 20, 300, 36, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_cfThemeBtnParamM = _addPicButton(theme, "CFTHEME/PARAM_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 140, 20, 36, 36);
m_cfThemeBtnParamP = _addPicButton(theme, "CFTHEME/PARAM_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 476, 20, 36, 36);
m_cfThemeBtnSave = _addButton(theme, "CFTHEME/SAVE_BTN", theme.btnFont, L"Save", 530, 20, 80, 40, theme.btnFontColor);
m_cfThemeBtnCancel = _addButton(theme, "CFTHEME/CANCEL_BTN", theme.btnFont, L"Cancel", 530, 70, 80, 40, theme.btnFontColor);
m_cfThemeBtnAlt = _addButton("CFTHEME/ALT_BTN", theme.btnFont, L"", 20, 20, 60, 30, theme.btnFontColor);
m_cfThemeBtnSelect = _addButton("CFTHEME/SELECT_BTN", theme.btnFont, L"", 80, 20, 60, 30, theme.btnFontColor);
m_cfThemeBtnWide = _addButton("CFTHEME/WIDE_BTN", theme.btnFont, L"", 20, 60, 60, 30, theme.btnFontColor);
m_cfThemeLblParam = _addLabel("CFTHEME/PARAM_BTN", theme.btnFont, L"", 176, 20, 300, 36, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_cfThemeBtnParamM = _addPicButton("CFTHEME/PARAM_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 140, 20, 36, 36);
m_cfThemeBtnParamP = _addPicButton("CFTHEME/PARAM_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 476, 20, 36, 36);
m_cfThemeBtnSave = _addButton("CFTHEME/SAVE_BTN", theme.btnFont, L"Save", 530, 20, 80, 40, theme.btnFontColor);
m_cfThemeBtnCancel = _addButton("CFTHEME/CANCEL_BTN", theme.btnFont, L"Cancel", 530, 70, 80, 40, theme.btnFontColor);
//
for (int i = 0; i < 16; ++i)
{
domain = sfmt("CFTHEME/VAL%i%c_%%s", i / 3 + 1, (char)(i % 3) + 'A');
x = 20 + (i / 4) * 150;
y = 340 + (i % 4) * 32;
m_cfThemeLblVal[i] = _addLabel(theme, fmt(domain.c_str(), "BTN"), theme.btnFont, L"", x + 32, y, 86, 32, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_cfThemeBtnValM[i] = _addPicButton(theme, fmt(domain.c_str(), "MINUS"), theme.btnTexMinus, theme.btnTexMinusS, x, y, 32, 32);
m_cfThemeBtnValP[i] = _addPicButton(theme, fmt(domain.c_str(), "PLUS"), theme.btnTexPlus, theme.btnTexPlusS, x + 118, y, 32, 32);
m_cfThemeLblVal[i] = _addLabel(fmt(domain.c_str(), "BTN"), theme.btnFont, L"", x + 32, y, 86, 32, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_cfThemeBtnValM[i] = _addPicButton(fmt(domain.c_str(), "MINUS"), theme.btnTexMinus, theme.btnTexMinusS, x, y, 32, 32);
m_cfThemeBtnValP[i] = _addPicButton(fmt(domain.c_str(), "PLUS"), theme.btnTexPlus, theme.btnTexPlusS, x + 118, y, 32, 32);
}
for (int i = 0; i < 4; ++i)
m_cfThemeLblValTxt[i] = _addLabel(theme, fmt("CFTHEME/VAL%i_LBL", i + 1), theme.lblFont, L"", 20 + i * 150, 100, 150, 240, theme.lblFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_BOTTOM, emptyTex);
m_cfThemeLblValTxt[i] = _addLabel(fmt("CFTHEME/VAL%i_LBL", i + 1), theme.lblFont, L"", 20 + i * 150, 100, 150, 240, theme.lblFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_BOTTOM, emptyTex);
_hideCFTheme(true);
}

View File

@ -46,8 +46,8 @@ u32 CMenu::_downloadCheatFileAsync(void *obj)
}
u32 bufferSize = 0x080000; // Maximum download size 512kb
SmartBuf buffer = smartAnyAlloc(bufferSize);
if (!buffer)
u8 *buffer = (u8*)MEM2_alloc(bufferSize);
if(buffer == NULL)
{
m->m_thrdWorking = false;
return -2;
@ -56,7 +56,7 @@ u32 CMenu::_downloadCheatFileAsync(void *obj)
string id = m->m_cf.getId();
char type = id[0] == 'S' ? 'R' : id[0];
block cheatfile = downloadfile(buffer.get(), bufferSize, fmt(GECKOURL, type, id.c_str()), CMenu::_downloadProgress, m);
block cheatfile = downloadfile(buffer, bufferSize, fmt(GECKOURL, type, id.c_str()), CMenu::_downloadProgress, m);
if (cheatfile.data != NULL && cheatfile.size > 65 && cheatfile.data[0] != '<')
{
@ -66,13 +66,13 @@ u32 CMenu::_downloadCheatFileAsync(void *obj)
{
fwrite(cheatfile.data, 1, cheatfile.size, file);
fclose(file);
buffer.release();
free(buffer);
m->m_thrdWorking = false;
return 0;
}
}
buffer.release();
free(buffer);
m->m_thrdWorking = false;
return -3;
}
@ -333,27 +333,27 @@ void CMenu::_showCheatSettings(void)
}
void CMenu::_initCheatSettingsMenu(CMenu::SThemeData &theme)
void CMenu::_initCheatSettingsMenu()
{
_addUserLabels(theme, m_cheatLblUser, ARRAY_SIZE(m_cheatLblUser), "CHEAT");
m_cheatBg = _texture(theme.texSet, "CHEAT/BG", "texture", theme.bg);
m_cheatLblTitle = _addLabel(theme, "CHEAT/TITLE", theme.titleFont, L"Cheats", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_cheatBtnBack = _addButton(theme, "CHEAT/BACK_BTN", theme.btnFont, L"", 460, 400, 150, 56, theme.btnFontColor);
m_cheatBtnApply = _addButton(theme, "CHEAT/APPLY_BTN", theme.btnFont, L"", 240, 400, 150, 56, theme.btnFontColor);
m_cheatBtnDownload = _addButton(theme, "CHEAT/DOWNLOAD_BTN", theme.btnFont, L"", 240, 400, 200, 56, theme.btnFontColor);
_addUserLabels(m_cheatLblUser, ARRAY_SIZE(m_cheatLblUser), "CHEAT");
m_cheatBg = _texture("CHEAT/BG", "texture", theme.bg, false);
m_cheatLblTitle = _addLabel("CHEAT/TITLE", theme.titleFont, L"Cheats", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_cheatBtnBack = _addButton("CHEAT/BACK_BTN", theme.btnFont, L"", 460, 400, 150, 56, theme.btnFontColor);
m_cheatBtnApply = _addButton("CHEAT/APPLY_BTN", theme.btnFont, L"", 240, 400, 150, 56, theme.btnFontColor);
m_cheatBtnDownload = _addButton("CHEAT/DOWNLOAD_BTN", theme.btnFont, L"", 240, 400, 200, 56, theme.btnFontColor);
m_cheatLblPage = _addLabel(theme, "CHEAT/PAGE_BTN", theme.btnFont, L"", 76, 400, 100, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_cheatBtnPageM = _addPicButton(theme, "CHEAT/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 20, 400, 56, 56);
m_cheatBtnPageP = _addPicButton(theme, "CHEAT/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 176, 400, 56, 56);
m_cheatLblPage = _addLabel("CHEAT/PAGE_BTN", theme.btnFont, L"", 76, 400, 100, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_cheatBtnPageM = _addPicButton("CHEAT/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 20, 400, 56, 56);
m_cheatBtnPageP = _addPicButton("CHEAT/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 176, 400, 56, 56);
m_cheatLblItem[0] = _addLabel(theme, "CHEAT/ITEM_0", theme.lblFont, L"", 40, 100, 460, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_cheatBtnItem[0] = _addButton(theme, "CHEAT/ITEM_0_BTN", theme.btnFont, L"", 500, 100, 120, 56, theme.btnFontColor);
m_cheatLblItem[1] = _addLabel(theme, "CHEAT/ITEM_1", theme.lblFont, L"", 40, 160, 460, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_cheatBtnItem[1] = _addButton(theme, "CHEAT/ITEM_1_BTN", theme.btnFont, L"", 500, 160, 120, 56, theme.btnFontColor);
m_cheatLblItem[2] = _addLabel(theme, "CHEAT/ITEM_2", theme.lblFont, L"", 40, 220, 460, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_cheatBtnItem[2] = _addButton(theme, "CHEAT/ITEM_2_BTN", theme.btnFont, L"", 500, 220, 120, 56, theme.btnFontColor);
m_cheatLblItem[3] = _addLabel(theme, "CHEAT/ITEM_3", theme.lblFont, L"", 40, 280, 460, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_cheatBtnItem[3] = _addButton(theme, "CHEAT/ITEM_3_BTN", theme.btnFont, L"", 500, 280, 120, 56, theme.btnFontColor);
m_cheatLblItem[0] = _addLabel("CHEAT/ITEM_0", theme.lblFont, L"", 40, 100, 460, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_cheatBtnItem[0] = _addButton("CHEAT/ITEM_0_BTN", theme.btnFont, L"", 500, 100, 120, 56, theme.btnFontColor);
m_cheatLblItem[1] = _addLabel("CHEAT/ITEM_1", theme.lblFont, L"", 40, 160, 460, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_cheatBtnItem[1] = _addButton("CHEAT/ITEM_1_BTN", theme.btnFont, L"", 500, 160, 120, 56, theme.btnFontColor);
m_cheatLblItem[2] = _addLabel("CHEAT/ITEM_2", theme.lblFont, L"", 40, 220, 460, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_cheatBtnItem[2] = _addButton("CHEAT/ITEM_2_BTN", theme.btnFont, L"", 500, 220, 120, 56, theme.btnFontColor);
m_cheatLblItem[3] = _addLabel("CHEAT/ITEM_3", theme.lblFont, L"", 40, 280, 460, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_cheatBtnItem[3] = _addButton("CHEAT/ITEM_3_BTN", theme.btnFont, L"", 500, 280, 120, 56, theme.btnFontColor);
_setHideAnim(m_cheatLblTitle, "CHEAT/TITLE", 0, 100, 0.f, 0.f);
_setHideAnim(m_cheatBtnApply, "CHEAT/APPLY_BTN", 0, 0, 1.f, -1.f);

View File

@ -194,16 +194,16 @@ void CMenu::_code(void)
_showConfig();
}
void CMenu::_initCodeMenu(CMenu::SThemeData &theme)
void CMenu::_initCodeMenu()
{
_addUserLabels(theme, m_codeLblUser, ARRAY_SIZE(m_codeLblUser), "CODE");
m_codeBg = _texture(theme.texSet, "CODE/BG", "texture", theme.bg);
m_codeLblTitle = _addLabel(theme, "CODE/CODE", theme.titleFont, L"_ _ _ _", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_codeBtnKey[0] = _addButton(theme, "CODE/0_BTN", theme.btnFont, L"0", 270, 340, 210, 50, theme.btnFontColor);
m_codeBtnErase = _addButton(theme, "CODE/ERASE_BTN", theme.btnFont, L"", 20, 400, 200, 56, theme.btnFontColor);
m_codeBtnBack = _addButton(theme, "CODE/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
m_codeBtnAge = _addButton(theme, "CODE/AGE_BTN", theme.btnFont, L"", 20, 340, 200, 56, theme.btnFontColor);
m_codeLblAge = _addTitle(theme, "CODE/AGE", theme.titleFont, L"", 20, 340, 200, 20, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
_addUserLabels(m_codeLblUser, ARRAY_SIZE(m_codeLblUser), "CODE");
m_codeBg = _texture("CODE/BG", "texture", theme.bg, false);
m_codeLblTitle = _addLabel("CODE/CODE", theme.titleFont, L"_ _ _ _", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_codeBtnKey[0] = _addButton("CODE/0_BTN", theme.btnFont, L"0", 270, 340, 210, 50, theme.btnFontColor);
m_codeBtnErase = _addButton("CODE/ERASE_BTN", theme.btnFont, L"", 20, 400, 200, 56, theme.btnFontColor);
m_codeBtnBack = _addButton("CODE/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
m_codeBtnAge = _addButton("CODE/AGE_BTN", theme.btnFont, L"", 20, 340, 200, 56, theme.btnFontColor);
m_codeLblAge = _addTitle("CODE/AGE", theme.titleFont, L"", 20, 340, 200, 20, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
for (int i = 0; i < 10; ++i)
{
@ -215,7 +215,7 @@ void CMenu::_initCodeMenu(CMenu::SThemeData &theme)
x %= 3;
x = 160 + x * 110;
y = 260 - y * 80;
m_codeBtnKey[i] = _addButton(theme, codeText, theme.btnFont, wfmt(L"%i", i), x, y, 100, 50, theme.btnFontColor);
m_codeBtnKey[i] = _addButton(codeText, theme.btnFont, wfmt(L"%i", i), x, y, 100, 50, theme.btnFontColor);
}
_setHideAnim(m_codeBtnKey[i], codeText, 0, 0, 0.f, 0.f);
}

View File

@ -234,26 +234,26 @@ int CMenu::_config1(void)
return change;
}
void CMenu::_initConfigMenu(CMenu::SThemeData &theme)
void CMenu::_initConfigMenu()
{
_addUserLabels(theme, m_configLblUser, ARRAY_SIZE(m_configLblUser), "CONFIG");
m_configBg = _texture(theme.texSet, "CONFIG/BG", "texture", theme.bg);
m_configLblTitle = _addTitle(theme, "CONFIG/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_configLblDownload = _addLabel(theme, "CONFIG/DOWNLOAD", theme.lblFont, L"", 40, 130, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configBtnDownload = _addButton(theme, "CONFIG/DOWNLOAD_BTN", theme.btnFont, L"", 400, 130, 200, 56, theme.btnFontColor);
m_configLblParental = _addLabel(theme, "CONFIG/PARENTAL", theme.lblFont, L"", 40, 190, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configBtnUnlock = _addButton(theme, "CONFIG/UNLOCK_BTN", theme.btnFont, L"", 400, 190, 200, 56, theme.btnFontColor);
m_configBtnSetCode = _addButton(theme, "CONFIG/SETCODE_BTN", theme.btnFont, L"", 400, 190, 200, 56, theme.btnFontColor);
m_configLblPartitionName = _addLabel(theme, "CONFIG/PARTITION", theme.lblFont, L"", 40, 250, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configLblPartition = _addLabel(theme, "CONFIG/PARTITION_BTN", theme.btnFont, L"", 456, 250, 88, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configBtnPartitionM = _addPicButton(theme, "CONFIG/PARTITION_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 400, 250, 56, 56);
m_configBtnPartitionP = _addPicButton(theme, "CONFIG/PARTITION_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 250, 56, 56);
m_configLblCfg4 = _addLabel(theme, "CONFIG/CFG4", theme.lblFont, L"", 40, 310, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configBtnCfg4 = _addButton(theme, "CONFIG/CFG4_BTN", theme.btnFont, L"", 400, 310, 200, 56, theme.btnFontColor);
m_configLblPage = _addLabel(theme, "CONFIG/PAGE_BTN", theme.btnFont, L"", 76, 400, 80, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configBtnPageM = _addPicButton(theme, "CONFIG/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 20, 400, 56, 56);
m_configBtnPageP = _addPicButton(theme, "CONFIG/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 156, 400, 56, 56);
m_configBtnBack = _addButton(theme, "CONFIG/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
_addUserLabels(m_configLblUser, ARRAY_SIZE(m_configLblUser), "CONFIG");
m_configBg = _texture("CONFIG/BG", "texture", theme.bg, false);
m_configLblTitle = _addTitle("CONFIG/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_configLblDownload = _addLabel("CONFIG/DOWNLOAD", theme.lblFont, L"", 40, 130, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configBtnDownload = _addButton("CONFIG/DOWNLOAD_BTN", theme.btnFont, L"", 400, 130, 200, 56, theme.btnFontColor);
m_configLblParental = _addLabel("CONFIG/PARENTAL", theme.lblFont, L"", 40, 190, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configBtnUnlock = _addButton("CONFIG/UNLOCK_BTN", theme.btnFont, L"", 400, 190, 200, 56, theme.btnFontColor);
m_configBtnSetCode = _addButton("CONFIG/SETCODE_BTN", theme.btnFont, L"", 400, 190, 200, 56, theme.btnFontColor);
m_configLblPartitionName = _addLabel("CONFIG/PARTITION", theme.lblFont, L"", 40, 250, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configLblPartition = _addLabel("CONFIG/PARTITION_BTN", theme.btnFont, L"", 456, 250, 88, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configBtnPartitionM = _addPicButton("CONFIG/PARTITION_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 400, 250, 56, 56);
m_configBtnPartitionP = _addPicButton("CONFIG/PARTITION_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 250, 56, 56);
m_configLblCfg4 = _addLabel("CONFIG/CFG4", theme.lblFont, L"", 40, 310, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configBtnCfg4 = _addButton("CONFIG/CFG4_BTN", theme.btnFont, L"", 400, 310, 200, 56, theme.btnFontColor);
m_configLblPage = _addLabel("CONFIG/PAGE_BTN", theme.btnFont, L"", 76, 400, 80, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configBtnPageM = _addPicButton("CONFIG/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 20, 400, 56, 56);
m_configBtnPageP = _addPicButton("CONFIG/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 156, 400, 56, 56);
m_configBtnBack = _addButton("CONFIG/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
_setHideAnim(m_configLblTitle, "CONFIG/TITLE", 0, 0, -2.f, 0.f);

View File

@ -154,32 +154,32 @@ int CMenu::_config3(void)
return change;
}
void CMenu::_initConfig3Menu(CMenu::SThemeData &theme)
void CMenu::_initConfig3Menu()
{
_addUserLabels(theme, m_config3LblUser, ARRAY_SIZE(m_config3LblUser), "CONFIG3");
m_config3Bg = _texture(theme.texSet, "CONFIG3/BG", "texture", theme.bg);
m_config3LblGameVideo = _addLabel(theme, "CONFIG3/VIDEO", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_config3LblVideo = _addLabel(theme, "CONFIG3/VIDEO_BTN", theme.btnFont, L"", 386, 130, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_config3BtnVideoM = _addPicButton(theme, "CONFIG3/VIDEO_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 130, 56, 56);
m_config3BtnVideoP = _addPicButton(theme, "CONFIG3/VIDEO_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 130, 56, 56);
m_config3LblGameLanguage = _addLabel(theme, "CONFIG3/GAME_LANG", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_config3LblLanguage = _addLabel(theme, "CONFIG3/GAME_LANG_BTN", theme.btnFont, L"", 386, 190, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_config3BtnLanguageM = _addPicButton(theme, "CONFIG3/GAME_LANG_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 190, 56, 56);
m_config3BtnLanguageP = _addPicButton(theme, "CONFIG3/GAME_LANG_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 190, 56, 56);
_addUserLabels(m_config3LblUser, ARRAY_SIZE(m_config3LblUser), "CONFIG3");
m_config3Bg = _texture("CONFIG3/BG", "texture", theme.bg, false);
m_config3LblGameVideo = _addLabel("CONFIG3/VIDEO", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_config3LblVideo = _addLabel("CONFIG3/VIDEO_BTN", theme.btnFont, L"", 386, 130, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_config3BtnVideoM = _addPicButton("CONFIG3/VIDEO_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 130, 56, 56);
m_config3BtnVideoP = _addPicButton("CONFIG3/VIDEO_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 130, 56, 56);
m_config3LblGameLanguage = _addLabel("CONFIG3/GAME_LANG", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_config3LblLanguage = _addLabel("CONFIG3/GAME_LANG_BTN", theme.btnFont, L"", 386, 190, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_config3BtnLanguageM = _addPicButton("CONFIG3/GAME_LANG_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 190, 56, 56);
m_config3BtnLanguageP = _addPicButton("CONFIG3/GAME_LANG_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 190, 56, 56);
m_config3LblDMLGameVideo = _addLabel(theme, "CONFIG3/DML_VIDEO", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_config3LblDMLVideo = _addLabel(theme, "CONFIG3/DML_VIDEO_BTN", theme.btnFont, L"", 386, 130, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_config3BtnDMLVideoM = _addPicButton(theme, "CONFIG3/DML_VIDEO_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 130, 56, 56);
m_config3BtnDMLVideoP = _addPicButton(theme, "CONFIG3/DML_VIDEO_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 130, 56, 56);
m_config3LblDMLGameLanguage = _addLabel(theme, "CONFIG3/DML_LANG", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_config3LblDMLLanguage = _addLabel(theme, "CONFIG3/DML_LANG_BTN", theme.btnFont, L"", 386, 190, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_config3BtnDMLLanguageM = _addPicButton(theme, "CONFIG3/DML_LANG_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 190, 56, 56);
m_config3BtnDMLLanguageP = _addPicButton(theme, "CONFIG3/DML_LANG_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 190, 56, 56);
m_config3LblDMLGameVideo = _addLabel("CONFIG3/DML_VIDEO", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_config3LblDMLVideo = _addLabel("CONFIG3/DML_VIDEO_BTN", theme.btnFont, L"", 386, 130, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_config3BtnDMLVideoM = _addPicButton("CONFIG3/DML_VIDEO_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 130, 56, 56);
m_config3BtnDMLVideoP = _addPicButton("CONFIG3/DML_VIDEO_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 130, 56, 56);
m_config3LblDMLGameLanguage = _addLabel("CONFIG3/DML_LANG", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_config3LblDMLLanguage = _addLabel("CONFIG3/DML_LANG_BTN", theme.btnFont, L"", 386, 190, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_config3BtnDMLLanguageM = _addPicButton("CONFIG3/DML_LANG_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 190, 56, 56);
m_config3BtnDMLLanguageP = _addPicButton("CONFIG3/DML_LANG_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 190, 56, 56);
m_config3LblAsyncNet = _addLabel(theme, "CONFIG3/ASYNCNET", theme.lblFont, L"", 40, 250, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_config3BtnAsyncNet = _addButton(theme, "CONFIG3/ASYNCNET_BTN", theme.btnFont, L"", 330, 250, 270, 56, theme.btnFontColor);
m_config3LblOcarina = _addLabel(theme, "CONFIG3/OCARINA", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_config3BtnOcarina = _addButton(theme, "CONFIG3/OCARINA_BTN", theme.btnFont, L"", 330, 310, 270, 56, theme.btnFontColor);
m_config3LblAsyncNet = _addLabel("CONFIG3/ASYNCNET", theme.lblFont, L"", 40, 250, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_config3BtnAsyncNet = _addButton("CONFIG3/ASYNCNET_BTN", theme.btnFont, L"", 330, 250, 270, 56, theme.btnFontColor);
m_config3LblOcarina = _addLabel("CONFIG3/OCARINA", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_config3BtnOcarina = _addButton("CONFIG3/OCARINA_BTN", theme.btnFont, L"", 330, 310, 270, 56, theme.btnFontColor);
_setHideAnim(m_config3LblGameVideo, "CONFIG3/VIDEO", 100, 0, -2.f, 0.f);
_setHideAnim(m_config3LblVideo, "CONFIG3/VIDEO_BTN", 0, 0, 1.f, -1.f);

View File

@ -151,20 +151,20 @@ int CMenu::_config4(void)
return change;
}
void CMenu::_initConfig4Menu(CMenu::SThemeData &theme)
void CMenu::_initConfig4Menu()
{
_addUserLabels(theme, m_config4LblUser, ARRAY_SIZE(m_config4LblUser), "CONFIG4");
m_config4Bg = _texture(theme.texSet, "CONFIG4/BG", "texture", theme.bg);
m_config4LblHome = _addLabel(theme, "CONFIG4/WIIMENU", theme.lblFont, L"", 40, 130, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_config4BtnHome = _addButton(theme, "CONFIG4/WIIMENU_BTN", theme.btnFont, L"", 370, 130, 230, 56, theme.btnFontColor);
m_config4LblSaveFavMode = _addLabel(theme, "CONFIG4/SAVE_FAVMODE", theme.lblFont, L"", 40, 190, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_config4BtnSaveFavMode = _addButton(theme, "CONFIG4/SAVE_FAVMODE_BTN", theme.btnFont, L"", 370, 190, 230, 56, theme.btnFontColor);
m_config4LblCategoryOnBoot = _addLabel(theme, "CONFIG4/CAT_ON_START", theme.lblFont, L"", 40, 250, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_config4BtnCategoryOnBoot = _addButton(theme, "CONFIG4/CAT_ON_START_BTN", theme.btnFont, L"", 370, 250, 230, 56, theme.btnFontColor);
m_config4LblReturnTo = _addLabel(theme, "CONFIG4/RETURN_TO", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_config4LblReturnToVal = _addLabel(theme, "CONFIG4/RETURN_TO_BTN", theme.btnFont, L"", 426, 310, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_config4BtnReturnToM = _addPicButton(theme, "CONFIG4/RETURN_TO_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 310, 56, 56);
m_config4BtnReturnToP = _addPicButton(theme, "CONFIG4/RETURN_TO_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 310, 56, 56);
_addUserLabels(m_config4LblUser, ARRAY_SIZE(m_config4LblUser), "CONFIG4");
m_config4Bg = _texture("CONFIG4/BG", "texture", theme.bg, false);
m_config4LblHome = _addLabel("CONFIG4/WIIMENU", theme.lblFont, L"", 40, 130, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_config4BtnHome = _addButton("CONFIG4/WIIMENU_BTN", theme.btnFont, L"", 370, 130, 230, 56, theme.btnFontColor);
m_config4LblSaveFavMode = _addLabel("CONFIG4/SAVE_FAVMODE", theme.lblFont, L"", 40, 190, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_config4BtnSaveFavMode = _addButton("CONFIG4/SAVE_FAVMODE_BTN", theme.btnFont, L"", 370, 190, 230, 56, theme.btnFontColor);
m_config4LblCategoryOnBoot = _addLabel("CONFIG4/CAT_ON_START", theme.lblFont, L"", 40, 250, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_config4BtnCategoryOnBoot = _addButton("CONFIG4/CAT_ON_START_BTN", theme.btnFont, L"", 370, 250, 230, 56, theme.btnFontColor);
m_config4LblReturnTo = _addLabel("CONFIG4/RETURN_TO", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_config4LblReturnToVal = _addLabel("CONFIG4/RETURN_TO_BTN", theme.btnFont, L"", 426, 310, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_config4BtnReturnToM = _addPicButton("CONFIG4/RETURN_TO_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 310, 56, 56);
m_config4BtnReturnToP = _addPicButton("CONFIG4/RETURN_TO_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 310, 56, 56);
//
_setHideAnim(m_config4LblHome, "CONFIG4/WIIMENU", 100, 0, -2.f, 0.f);
_setHideAnim(m_config4BtnHome, "CONFIG4/WIIMENU_BTN", 0, 0, 1.f, -1.f);

View File

@ -3,7 +3,7 @@
#include <sys/param.h>
#include <sys/stat.h>
#include <unistd.h>
#include <algorithm>
#include "menu.hpp"
#include "loader/wbfs.h"
@ -181,22 +181,22 @@ int CMenu::_configAdv(void)
return change;
}
void CMenu::_initConfigAdvMenu(CMenu::SThemeData &theme)
void CMenu::_initConfigAdvMenu()
{
_addUserLabels(theme, m_configAdvLblUser, ARRAY_SIZE(m_configAdvLblUser), "CONFIG_ADV");
m_configAdvBg = _texture(theme.texSet, "CONFIG_ADV/BG", "texture", theme.bg);
m_configAdvLblTheme = _addLabel(theme, "CONFIG_ADV/THEME", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configAdvLblCurTheme = _addLabel(theme, "CONFIG_ADV/THEME_BTN", theme.btnFont, L"", 386, 130, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configAdvBtnCurThemeM = _addPicButton(theme, "CONFIG_ADV/THEME_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 130, 56, 56);
m_configAdvBtnCurThemeP = _addPicButton(theme, "CONFIG_ADV/THEME_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 130, 56, 56);
m_configAdvLblLanguage = _addLabel(theme, "CONFIG_ADV/LANGUAGE", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configAdvLblCurLanguage = _addLabel(theme, "CONFIG_ADV/LANGUAGE_BTN", theme.btnFont, L"", 386, 190, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configAdvBtnCurLanguageM = _addPicButton(theme, "CONFIG_ADV/LANGUAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 190, 56, 56);
m_configAdvBtnCurLanguageP = _addPicButton(theme, "CONFIG_ADV/LANGUAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 190, 56, 56);
m_configAdvLblCFTheme = _addLabel(theme, "CONFIG_ADV/CUSTOMIZE_CF", theme.lblFont, L"", 40, 250, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configAdvBtnCFTheme = _addButton(theme, "CONFIG_ADV/CUSTOMIZE_CF_BTN", theme.btnFont, L"", 330, 250, 270, 56, theme.btnFontColor);
m_configAdvLblInstall = _addLabel(theme, "CONFIG_ADV/INSTALL", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configAdvBtnInstall = _addButton(theme, "CONFIG_ADV/INSTALL_BTN", theme.btnFont, L"", 330, 310, 270, 56, theme.btnFontColor);
_addUserLabels(m_configAdvLblUser, ARRAY_SIZE(m_configAdvLblUser), "CONFIG_ADV");
m_configAdvBg = _texture("CONFIG_ADV/BG", "texture", theme.bg, false);
m_configAdvLblTheme = _addLabel("CONFIG_ADV/THEME", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configAdvLblCurTheme = _addLabel("CONFIG_ADV/THEME_BTN", theme.btnFont, L"", 386, 130, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configAdvBtnCurThemeM = _addPicButton("CONFIG_ADV/THEME_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 130, 56, 56);
m_configAdvBtnCurThemeP = _addPicButton("CONFIG_ADV/THEME_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 130, 56, 56);
m_configAdvLblLanguage = _addLabel("CONFIG_ADV/LANGUAGE", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configAdvLblCurLanguage = _addLabel("CONFIG_ADV/LANGUAGE_BTN", theme.btnFont, L"", 386, 190, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configAdvBtnCurLanguageM = _addPicButton("CONFIG_ADV/LANGUAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 190, 56, 56);
m_configAdvBtnCurLanguageP = _addPicButton("CONFIG_ADV/LANGUAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 190, 56, 56);
m_configAdvLblCFTheme = _addLabel("CONFIG_ADV/CUSTOMIZE_CF", theme.lblFont, L"", 40, 250, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configAdvBtnCFTheme = _addButton("CONFIG_ADV/CUSTOMIZE_CF_BTN", theme.btnFont, L"", 330, 250, 270, 56, theme.btnFontColor);
m_configAdvLblInstall = _addLabel("CONFIG_ADV/INSTALL", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configAdvBtnInstall = _addButton("CONFIG_ADV/INSTALL_BTN", theme.btnFont, L"", 330, 310, 270, 56, theme.btnFontColor);
_setHideAnim(m_configAdvLblTheme, "CONFIG_ADV/THEME", 100, 0, -2.f, 0.f);
_setHideAnim(m_configAdvLblCurTheme, "CONFIG_ADV/THEME_BTN", 0, 0, 1.f, -1.f);

View File

@ -735,125 +735,125 @@ void CMenu::_gameSettings(void)
_hideGameSettings();
}
void CMenu::_initGameSettingsMenu(CMenu::SThemeData &theme)
void CMenu::_initGameSettingsMenu()
{
_addUserLabels(theme, m_gameSettingsLblUser, ARRAY_SIZE(m_gameSettingsLblUser), "GAME_SETTINGS");
m_gameSettingsBg = _texture(theme.texSet, "GAME_SETTINGS/BG", "texture", theme.bg);
m_gameSettingsLblTitle = _addTitle(theme, "GAME_SETTINGS/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
_addUserLabels(m_gameSettingsLblUser, ARRAY_SIZE(m_gameSettingsLblUser), "GAME_SETTINGS");
m_gameSettingsBg = _texture("GAME_SETTINGS/BG", "texture", theme.bg, false);
m_gameSettingsLblTitle = _addTitle("GAME_SETTINGS/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
// Page 1
m_gameSettingsLblCover = _addLabel(theme, "GAME_SETTINGS/COVER", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCover = _addButton(theme, "GAME_SETTINGS/COVER_BTN", theme.btnFont, L"", 330, 130, 270, 56, theme.btnFontColor);
m_gameSettingsLblCover = _addLabel("GAME_SETTINGS/COVER", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCover = _addButton("GAME_SETTINGS/COVER_BTN", theme.btnFont, L"", 330, 130, 270, 56, theme.btnFontColor);
m_gameSettingsLblCategoryMain = _addLabel(theme, "GAME_SETTINGS/CAT_MAIN", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCategoryMain = _addButton(theme, "GAME_SETTINGS/CAT_MAIN_BTN", theme.btnFont, L"", 330, 190, 270, 56, theme.btnFontColor);
m_gameSettingsLblCategoryMain = _addLabel("GAME_SETTINGS/CAT_MAIN", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCategoryMain = _addButton("GAME_SETTINGS/CAT_MAIN_BTN", theme.btnFont, L"", 330, 190, 270, 56, theme.btnFontColor);
m_gameSettingsLblGameLanguage = _addLabel(theme, "GAME_SETTINGS/GAME_LANG", theme.lblFont, L"", 40, 250, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblLanguage = _addLabel(theme, "GAME_SETTINGS/GAME_LANG_BTN", theme.btnFont, L"", 386, 250, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnLanguageM = _addPicButton(theme, "GAME_SETTINGS/GAME_LANG_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 250, 56, 56);
m_gameSettingsBtnLanguageP = _addPicButton(theme, "GAME_SETTINGS/GAME_LANG_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 250, 56, 56);
m_gameSettingsLblGameLanguage = _addLabel("GAME_SETTINGS/GAME_LANG", theme.lblFont, L"", 40, 250, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblLanguage = _addLabel("GAME_SETTINGS/GAME_LANG_BTN", theme.btnFont, L"", 386, 250, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnLanguageM = _addPicButton("GAME_SETTINGS/GAME_LANG_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 250, 56, 56);
m_gameSettingsBtnLanguageP = _addPicButton("GAME_SETTINGS/GAME_LANG_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 250, 56, 56);
m_gameSettingsLblGameVideo = _addLabel(theme, "GAME_SETTINGS/VIDEO", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblVideo = _addLabel(theme, "GAME_SETTINGS/VIDEO_BTN", theme.btnFont, L"", 386, 310, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnVideoM = _addPicButton(theme, "GAME_SETTINGS/VIDEO_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 310, 56, 56);
m_gameSettingsBtnVideoP = _addPicButton(theme, "GAME_SETTINGS/VIDEO_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 310, 56, 56);
m_gameSettingsLblGameVideo = _addLabel("GAME_SETTINGS/VIDEO", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblVideo = _addLabel("GAME_SETTINGS/VIDEO_BTN", theme.btnFont, L"", 386, 310, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnVideoM = _addPicButton("GAME_SETTINGS/VIDEO_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 310, 56, 56);
m_gameSettingsBtnVideoP = _addPicButton("GAME_SETTINGS/VIDEO_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 310, 56, 56);
//DML Page 1
m_gameSettingsLblDMLGameVideo = _addLabel(theme, "GAME_SETTINGS/DML_VIDEO", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblDMLVideo = _addLabel(theme, "GAME_SETTINGS/DML_VIDEO_BTN", theme.btnFont, L"", 386, 190, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnDMLVideoM = _addPicButton(theme, "GAME_SETTINGS/DML_VIDEO_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 190, 56, 56);
m_gameSettingsBtnDMLVideoP = _addPicButton(theme, "GAME_SETTINGS/DML_VIDEO_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 190, 56, 56);
m_gameSettingsLblDMLGameVideo = _addLabel("GAME_SETTINGS/DML_VIDEO", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblDMLVideo = _addLabel("GAME_SETTINGS/DML_VIDEO_BTN", theme.btnFont, L"", 386, 190, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnDMLVideoM = _addPicButton("GAME_SETTINGS/DML_VIDEO_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 190, 56, 56);
m_gameSettingsBtnDMLVideoP = _addPicButton("GAME_SETTINGS/DML_VIDEO_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 190, 56, 56);
m_gameSettingsLblGClanguage = _addLabel(theme, "GAME_SETTINGS/GC_LANG", theme.lblFont, L"", 40, 250, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblGClanguageVal = _addLabel(theme, "GAME_SETTINGS/GC_LANG_BTN", theme.btnFont, L"", 386, 250, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnGClanguageM = _addPicButton(theme, "GAME_SETTINGS/GC_LANG_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 250, 56, 56);
m_gameSettingsBtnGClanguageP = _addPicButton(theme, "GAME_SETTINGS/GC_LANG_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 250, 56, 56);
m_gameSettingsLblGClanguage = _addLabel("GAME_SETTINGS/GC_LANG", theme.lblFont, L"", 40, 250, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblGClanguageVal = _addLabel("GAME_SETTINGS/GC_LANG_BTN", theme.btnFont, L"", 386, 250, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnGClanguageM = _addPicButton("GAME_SETTINGS/GC_LANG_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 250, 56, 56);
m_gameSettingsBtnGClanguageP = _addPicButton("GAME_SETTINGS/GC_LANG_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 250, 56, 56);
// Page 2
m_gameSettingsLblDebugger = _addLabel(theme, "GAME_SETTINGS/GAME_DEBUGGER", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblDebuggerV = _addLabel(theme, "GAME_SETTINGS/GAME_DEBUGGER_BTN", theme.btnFont, L"", 386, 130, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnDebuggerM = _addPicButton(theme, "GAME_SETTINGS/GAME_DEBUGGER_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 130, 56, 56);
m_gameSettingsBtnDebuggerP = _addPicButton(theme, "GAME_SETTINGS/GAME_DEBUGGER_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 130, 56, 56);
m_gameSettingsLblDebugger = _addLabel("GAME_SETTINGS/GAME_DEBUGGER", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblDebuggerV = _addLabel("GAME_SETTINGS/GAME_DEBUGGER_BTN", theme.btnFont, L"", 386, 130, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnDebuggerM = _addPicButton("GAME_SETTINGS/GAME_DEBUGGER_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 130, 56, 56);
m_gameSettingsBtnDebuggerP = _addPicButton("GAME_SETTINGS/GAME_DEBUGGER_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 130, 56, 56);
m_gameSettingsLblHooktype = _addLabel(theme, "GAME_SETTINGS/HOOKTYPE", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblHooktypeVal = _addLabel(theme, "GAME_SETTINGS/HOOKTYPE_BTN", theme.btnFont, L"", 386, 190, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnHooktypeM = _addPicButton(theme, "GAME_SETTINGS/HOOKTYPE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 190, 56, 56);
m_gameSettingsBtnHooktypeP = _addPicButton(theme, "GAME_SETTINGS/HOOKTYPE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 190, 56, 56);
m_gameSettingsLblHooktype = _addLabel("GAME_SETTINGS/HOOKTYPE", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblHooktypeVal = _addLabel("GAME_SETTINGS/HOOKTYPE_BTN", theme.btnFont, L"", 386, 190, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnHooktypeM = _addPicButton("GAME_SETTINGS/HOOKTYPE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 190, 56, 56);
m_gameSettingsBtnHooktypeP = _addPicButton("GAME_SETTINGS/HOOKTYPE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 190, 56, 56);
m_gameSettingsLblOcarina = _addLabel(theme, "GAME_SETTINGS/OCARINA", theme.lblFont, L"", 40, 250, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnOcarina = _addButton(theme, "GAME_SETTINGS/OCARINA_BTN", theme.btnFont, L"", 330, 250, 270, 56, theme.btnFontColor);
m_gameSettingsLblOcarina = _addLabel("GAME_SETTINGS/OCARINA", theme.lblFont, L"", 40, 250, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnOcarina = _addButton("GAME_SETTINGS/OCARINA_BTN", theme.btnFont, L"", 330, 250, 270, 56, theme.btnFontColor);
m_gameSettingsLblCheat = _addLabel(theme, "GAME_SETTINGS/CHEAT", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCheat = _addButton(theme, "GAME_SETTINGS/CHEAT_BTN", theme.btnFont, L"", 330, 310, 270, 56, theme.btnFontColor);
m_gameSettingsLblCheat = _addLabel("GAME_SETTINGS/CHEAT", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCheat = _addButton("GAME_SETTINGS/CHEAT_BTN", theme.btnFont, L"", 330, 310, 270, 56, theme.btnFontColor);
// Page 3
m_gameSettingsLblCountryPatch = _addLabel(theme, "GAME_SETTINGS/COUNTRY_PATCH", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCountryPatch = _addButton(theme, "GAME_SETTINGS/COUNTRY_PATCH_BTN", theme.btnFont, L"", 330, 130, 270, 56, theme.btnFontColor);
m_gameSettingsLblCountryPatch = _addLabel("GAME_SETTINGS/COUNTRY_PATCH", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCountryPatch = _addButton("GAME_SETTINGS/COUNTRY_PATCH_BTN", theme.btnFont, L"", 330, 130, 270, 56, theme.btnFontColor);
m_gameSettingsLblVipatch = _addLabel(theme, "GAME_SETTINGS/VIPATCH", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnVipatch = _addButton(theme, "GAME_SETTINGS/VIPATCH_BTN", theme.btnFont, L"", 330, 190, 270, 56, theme.btnFontColor);
m_gameSettingsLblVipatch = _addLabel("GAME_SETTINGS/VIPATCH", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnVipatch = _addButton("GAME_SETTINGS/VIPATCH_BTN", theme.btnFont, L"", 330, 190, 270, 56, theme.btnFontColor);
m_gameSettingsLblPatchVidModes = _addLabel(theme, "GAME_SETTINGS/PATCH_VIDEO_MODE", theme.lblFont, L"", 40, 250, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblPatchVidModesVal = _addLabel(theme, "GAME_SETTINGS/PATCH_VIDEO_MODE_BTN", theme.btnFont, L"", 386, 250, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnPatchVidModesM = _addPicButton(theme, "GAME_SETTINGS/PATCH_VIDEO_MODE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 250, 56, 56);
m_gameSettingsBtnPatchVidModesP = _addPicButton(theme, "GAME_SETTINGS/PATCH_VIDEO_MODE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 250, 56, 56);
m_gameSettingsLblPatchVidModes = _addLabel("GAME_SETTINGS/PATCH_VIDEO_MODE", theme.lblFont, L"", 40, 250, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblPatchVidModesVal = _addLabel("GAME_SETTINGS/PATCH_VIDEO_MODE_BTN", theme.btnFont, L"", 386, 250, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnPatchVidModesM = _addPicButton("GAME_SETTINGS/PATCH_VIDEO_MODE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 250, 56, 56);
m_gameSettingsBtnPatchVidModesP = _addPicButton("GAME_SETTINGS/PATCH_VIDEO_MODE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 250, 56, 56);
m_gameSettingsLblAspectRatio = _addLabel(theme, "GAME_SETTINGS/ASPECT_RATIO", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblAspectRatioVal = _addLabel(theme, "GAME_SETTINGS/ASPECT_RATIO_BTN", theme.btnFont, L"", 386, 310, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnAspectRatioM = _addPicButton(theme, "GAME_SETTINGS/ASPECT_RATIO_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 310, 56, 56);
m_gameSettingsBtnAspectRatioP = _addPicButton(theme, "GAME_SETTINGS/ASPECT_RATIO_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 310, 56, 56);
m_gameSettingsLblAspectRatio = _addLabel("GAME_SETTINGS/ASPECT_RATIO", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblAspectRatioVal = _addLabel("GAME_SETTINGS/ASPECT_RATIO_BTN", theme.btnFont, L"", 386, 310, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnAspectRatioM = _addPicButton("GAME_SETTINGS/ASPECT_RATIO_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 310, 56, 56);
m_gameSettingsBtnAspectRatioP = _addPicButton("GAME_SETTINGS/ASPECT_RATIO_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 310, 56, 56);
//DML Page 3
m_gameSettingsLblNMM = _addLabel(theme, "GAME_SETTINGS/DML_NMM", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblNMM_Val = _addLabel(theme, "GAME_SETTINGS/DML_NMM_BTN", theme.btnFont, L"", 386, 130, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnNMM_M = _addPicButton(theme, "GAME_SETTINGS/DML_NMM_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 130, 56, 56);
m_gameSettingsBtnNMM_P = _addPicButton(theme, "GAME_SETTINGS/DML_NMM_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 130, 56, 56);
m_gameSettingsLblNMM = _addLabel("GAME_SETTINGS/DML_NMM", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblNMM_Val = _addLabel("GAME_SETTINGS/DML_NMM_BTN", theme.btnFont, L"", 386, 130, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnNMM_M = _addPicButton("GAME_SETTINGS/DML_NMM_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 130, 56, 56);
m_gameSettingsBtnNMM_P = _addPicButton("GAME_SETTINGS/DML_NMM_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 130, 56, 56);
m_gameSettingsLblNoDVD = _addLabel(theme, "GAME_SETTINGS/NO_DVD_PATCH", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblNoDVD_Val = _addLabel(theme, "GAME_SETTINGS/NO_DVD_PATCH_BTN", theme.btnFont, L"", 386, 190, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnNoDVD_M = _addPicButton(theme, "GAME_SETTINGS/NO_DVD_PATCH_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 190, 56, 56);
m_gameSettingsBtnNoDVD_P = _addPicButton(theme, "GAME_SETTINGS/NO_DVD_PATCH_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 190, 56, 56);
m_gameSettingsLblNoDVD = _addLabel("GAME_SETTINGS/NO_DVD_PATCH", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblNoDVD_Val = _addLabel("GAME_SETTINGS/NO_DVD_PATCH_BTN", theme.btnFont, L"", 386, 190, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnNoDVD_M = _addPicButton("GAME_SETTINGS/NO_DVD_PATCH_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 190, 56, 56);
m_gameSettingsBtnNoDVD_P = _addPicButton("GAME_SETTINGS/NO_DVD_PATCH_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 190, 56, 56);
m_gameSettingsLblDevoMemcardEmu = _addLabel(theme, "GAME_SETTINGS/DEVO_MEMCARD_EMU", theme.lblFont, L"", 40, 250, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnDevoMemcardEmu = _addButton(theme, "GAME_SETTINGS/DEVO_MEMCARD_EMU_BTN", theme.btnFont, L"", 330, 250, 270, 56, theme.btnFontColor);
m_gameSettingsLblDevoMemcardEmu = _addLabel("GAME_SETTINGS/DEVO_MEMCARD_EMU", theme.lblFont, L"", 40, 250, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnDevoMemcardEmu = _addButton("GAME_SETTINGS/DEVO_MEMCARD_EMU_BTN", theme.btnFont, L"", 330, 250, 270, 56, theme.btnFontColor);
m_gameSettingsLblGCLoader = _addLabel(theme, "GAME_SETTINGS/GC_LOADER", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblGCLoader_Val = _addLabel(theme, "GAME_SETTINGS/GC_LOADER_BTN", theme.btnFont, L"", 386, 310, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnGCLoader_M = _addPicButton(theme, "GAME_SETTINGS/GC_LOADER_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 310, 56, 56);
m_gameSettingsBtnGCLoader_P = _addPicButton(theme, "GAME_SETTINGS/GC_LOADER_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 310, 56, 56);
m_gameSettingsLblGCLoader = _addLabel("GAME_SETTINGS/GC_LOADER", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblGCLoader_Val = _addLabel("GAME_SETTINGS/GC_LOADER_BTN", theme.btnFont, L"", 386, 310, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnGCLoader_M = _addPicButton("GAME_SETTINGS/GC_LOADER_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 310, 56, 56);
m_gameSettingsBtnGCLoader_P = _addPicButton("GAME_SETTINGS/GC_LOADER_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 310, 56, 56);
m_gameSettingsLblDM_Widescreen = _addLabel(theme, "GAME_SETTINGS/DM_WIDESCREEN", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnDM_Widescreen = _addButton(theme, "GAME_SETTINGS/DM_WIDESCREEN_BTN", theme.btnFont, L"", 330, 310, 270, 56, theme.btnFontColor);
m_gameSettingsLblDM_Widescreen = _addLabel("GAME_SETTINGS/DM_WIDESCREEN", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnDM_Widescreen = _addButton("GAME_SETTINGS/DM_WIDESCREEN_BTN", theme.btnFont, L"", 330, 310, 270, 56, theme.btnFontColor);
//Page 4
m_gameSettingsLblCustom = _addLabel(theme, "GAME_SETTINGS/CUSTOM", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCustom = _addButton(theme, "GAME_SETTINGS/CUSTOM_BTN", theme.btnFont, L"", 330, 130, 270, 56, theme.btnFontColor);
m_gameSettingsLblCustom = _addLabel("GAME_SETTINGS/CUSTOM", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCustom = _addButton("GAME_SETTINGS/CUSTOM_BTN", theme.btnFont, L"", 330, 130, 270, 56, theme.btnFontColor);
m_gameSettingsLblEmulation = _addLabel(theme, "GAME_SETTINGS/EMU_SAVE", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblEmulationVal = _addLabel(theme, "GAME_SETTINGS/EMU_SAVE_BTN", theme.btnFont, L"", 386, 130, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnEmulationM = _addPicButton(theme, "GAME_SETTINGS/EMU_SAVE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 130, 56, 56);
m_gameSettingsBtnEmulationP = _addPicButton(theme, "GAME_SETTINGS/EMU_SAVE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 130, 56, 56);
m_gameSettingsLblEmulation = _addLabel("GAME_SETTINGS/EMU_SAVE", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblEmulationVal = _addLabel("GAME_SETTINGS/EMU_SAVE_BTN", theme.btnFont, L"", 386, 130, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnEmulationM = _addPicButton("GAME_SETTINGS/EMU_SAVE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 130, 56, 56);
m_gameSettingsBtnEmulationP = _addPicButton("GAME_SETTINGS/EMU_SAVE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 130, 56, 56);
m_gameSettingsLblGameIOS = _addLabel(theme, "GAME_SETTINGS/IOS", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblIOS = _addLabel(theme, "GAME_SETTINGS/IOS_BTN", theme.btnFont, L"", 386, 190, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnIOSM = _addPicButton(theme, "GAME_SETTINGS/IOS_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 190, 56, 56);
m_gameSettingsBtnIOSP = _addPicButton(theme, "GAME_SETTINGS/IOS_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 190, 56, 56);
m_gameSettingsLblGameIOS = _addLabel("GAME_SETTINGS/IOS", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblIOS = _addLabel("GAME_SETTINGS/IOS_BTN", theme.btnFont, L"", 386, 190, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnIOSM = _addPicButton("GAME_SETTINGS/IOS_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 190, 56, 56);
m_gameSettingsBtnIOSP = _addPicButton("GAME_SETTINGS/IOS_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 190, 56, 56);
m_gameSettingsLblLaunchNK = _addLabel(theme, "GAME_SETTINGS/LAUNCHNEEK", theme.lblFont, L"", 40, 250, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnLaunchNK = _addButton(theme, "GAME_SETTINGS/LAUNCHNEEK_BTN", theme.btnFont, L"", 330, 250, 270, 56, theme.btnFontColor);
m_gameSettingsLblLaunchNK = _addLabel("GAME_SETTINGS/LAUNCHNEEK", theme.lblFont, L"", 40, 250, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnLaunchNK = _addButton("GAME_SETTINGS/LAUNCHNEEK_BTN", theme.btnFont, L"", 330, 250, 270, 56, theme.btnFontColor);
m_gameSettingsLblExtractSave = _addLabel(theme, "GAME_SETTINGS/EXTRACT_SAVE", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnExtractSave = _addButton(theme, "GAME_SETTINGS/EXTRACT_SAVE_BTN", theme.btnFont, L"", 330, 310, 270, 56, theme.btnFontColor);
m_gameSettingsLblExtractSave = _addLabel("GAME_SETTINGS/EXTRACT_SAVE", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnExtractSave = _addButton("GAME_SETTINGS/EXTRACT_SAVE_BTN", theme.btnFont, L"", 330, 310, 270, 56, theme.btnFontColor);
//Page 5
m_gameSettingsLblFlashSave = _addLabel(theme, "GAME_SETTINGS/FLASH_SAVE", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnFlashSave = _addButton(theme, "GAME_SETTINGS/FLASH_SAVE_BTN", theme.btnFont, L"", 330, 130, 270, 56, theme.btnFontColor);
m_gameSettingsLblFlashSave = _addLabel("GAME_SETTINGS/FLASH_SAVE", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnFlashSave = _addButton("GAME_SETTINGS/FLASH_SAVE_BTN", theme.btnFont, L"", 330, 130, 270, 56, theme.btnFontColor);
//Footer
m_gameSettingsLblPage = _addLabel(theme, "GAME_SETTINGS/PAGE_BTN", theme.btnFont, L"", 76, 400, 80, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnPageM = _addPicButton(theme, "GAME_SETTINGS/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 20, 400, 56, 56);
m_gameSettingsBtnPageP = _addPicButton(theme, "GAME_SETTINGS/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 156, 400, 56, 56);
m_gameSettingsBtnBack = _addButton(theme, "GAME_SETTINGS/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
m_gameSettingsLblPage = _addLabel("GAME_SETTINGS/PAGE_BTN", theme.btnFont, L"", 76, 400, 80, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnPageM = _addPicButton("GAME_SETTINGS/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 20, 400, 56, 56);
m_gameSettingsBtnPageP = _addPicButton("GAME_SETTINGS/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 156, 400, 56, 56);
m_gameSettingsBtnBack = _addButton("GAME_SETTINGS/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
_setHideAnim(m_gameSettingsLblTitle, "GAME_SETTINGS/TITLE", 0, -200, 0.f, 1.f);
_setHideAnim(m_gameSettingsLblGameVideo, "GAME_SETTINGS/VIDEO", -200, 0, 1.f, 0.f);

View File

@ -102,26 +102,26 @@ int CMenu::_configScreen(void)
return change;
}
void CMenu::_initConfigScreenMenu(CMenu::SThemeData &theme)
void CMenu::_initConfigScreenMenu()
{
_addUserLabels(theme, m_configScreenLblUser, ARRAY_SIZE(m_configScreenLblUser), "SCREEN");
m_configScreenBg = _texture(theme.texSet, "SCREEN/BG", "texture", theme.bg);
m_configScreenLblTVWidth = _addLabel(theme, "SCREEN/TVWIDTH", theme.lblFont, L"", 40, 130, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configScreenLblTVWidthVal = _addLabel(theme, "SCREEN/TVWIDTH_BTN", theme.btnFont, L"", 426, 130, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configScreenBtnTVWidthM = _addPicButton(theme, "SCREEN/TVWIDTH_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 130, 56, 56);
m_configScreenBtnTVWidthP = _addPicButton(theme, "SCREEN/TVWIDTH_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 130, 56, 56);
m_configScreenLblTVHeight = _addLabel(theme, "SCREEN/TVHEIGHT", theme.lblFont, L"", 40, 190, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configScreenLblTVHeightVal = _addLabel(theme, "SCREEN/TVHEIGHT_BTN", theme.btnFont, L"", 426, 190, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configScreenBtnTVHeightM = _addPicButton(theme, "SCREEN/TVHEIGHT_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 190, 56, 56);
m_configScreenBtnTVHeightP = _addPicButton(theme, "SCREEN/TVHEIGHT_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 190, 56, 56);
m_configScreenLblTVX = _addLabel(theme, "SCREEN/TVX", theme.lblFont, L"", 40, 250, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configScreenLblTVXVal = _addLabel(theme, "SCREEN/TVX_BTN", theme.btnFont, L"", 426, 250, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configScreenBtnTVXM = _addPicButton(theme, "SCREEN/TVX_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 250, 56, 56);
m_configScreenBtnTVXP = _addPicButton(theme, "SCREEN/TVX_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 250, 56, 56);
m_configScreenLblTVY = _addLabel(theme, "SCREEN/TVY", theme.lblFont, L"", 40, 310, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configScreenLblTVYVal = _addLabel(theme, "SCREEN/TVY_BTN", theme.btnFont, L"", 426, 310, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configScreenBtnTVYM = _addPicButton(theme, "SCREEN/TVY_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 310, 56, 56);
m_configScreenBtnTVYP = _addPicButton(theme, "SCREEN/TVY_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 310, 56, 56);
_addUserLabels(m_configScreenLblUser, ARRAY_SIZE(m_configScreenLblUser), "SCREEN");
m_configScreenBg = _texture("SCREEN/BG", "texture", theme.bg, false);
m_configScreenLblTVWidth = _addLabel("SCREEN/TVWIDTH", theme.lblFont, L"", 40, 130, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configScreenLblTVWidthVal = _addLabel("SCREEN/TVWIDTH_BTN", theme.btnFont, L"", 426, 130, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configScreenBtnTVWidthM = _addPicButton("SCREEN/TVWIDTH_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 130, 56, 56);
m_configScreenBtnTVWidthP = _addPicButton("SCREEN/TVWIDTH_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 130, 56, 56);
m_configScreenLblTVHeight = _addLabel("SCREEN/TVHEIGHT", theme.lblFont, L"", 40, 190, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configScreenLblTVHeightVal = _addLabel("SCREEN/TVHEIGHT_BTN", theme.btnFont, L"", 426, 190, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configScreenBtnTVHeightM = _addPicButton("SCREEN/TVHEIGHT_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 190, 56, 56);
m_configScreenBtnTVHeightP = _addPicButton("SCREEN/TVHEIGHT_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 190, 56, 56);
m_configScreenLblTVX = _addLabel("SCREEN/TVX", theme.lblFont, L"", 40, 250, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configScreenLblTVXVal = _addLabel("SCREEN/TVX_BTN", theme.btnFont, L"", 426, 250, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configScreenBtnTVXM = _addPicButton("SCREEN/TVX_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 250, 56, 56);
m_configScreenBtnTVXP = _addPicButton("SCREEN/TVX_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 250, 56, 56);
m_configScreenLblTVY = _addLabel("SCREEN/TVY", theme.lblFont, L"", 40, 310, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configScreenLblTVYVal = _addLabel("SCREEN/TVY_BTN", theme.btnFont, L"", 426, 310, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configScreenBtnTVYM = _addPicButton("SCREEN/TVY_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 310, 56, 56);
m_configScreenBtnTVYP = _addPicButton("SCREEN/TVY_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 310, 56, 56);
//
_setHideAnim(m_configScreenLblTVWidth, "SCREEN/TVWIDTH", 100, 0, -2.f, 0.f);
_setHideAnim(m_configScreenLblTVWidthVal, "SCREEN/TVWIDTH_BTN", 0, 0, 1.f, -1.f);

View File

@ -128,26 +128,26 @@ int CMenu::_configSnd(void)
return change;
}
void CMenu::_initConfigSndMenu(CMenu::SThemeData &theme)
void CMenu::_initConfigSndMenu()
{
_addUserLabels(theme, m_configSndLblUser, ARRAY_SIZE(m_configSndLblUser), "CONFIGSND");
m_configSndBg = _texture(theme.texSet, "CONFIGSND/BG", "texture", theme.bg);
m_configSndLblMusicVol = _addLabel(theme, "CONFIGSND/MUSIC_VOL", theme.lblFont, L"", 40, 130, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configSndLblMusicVolVal = _addLabel(theme, "CONFIGSND/MUSIC_VOL_BTN", theme.btnFont, L"", 426, 130, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configSndBtnMusicVolM = _addPicButton(theme, "CONFIGSND/MUSIC_VOL_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 130, 56, 56);
m_configSndBtnMusicVolP = _addPicButton(theme, "CONFIGSND/MUSIC_VOL_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 130, 56, 56);
m_configSndLblGuiVol = _addLabel(theme, "CONFIGSND/GUI_VOL", theme.lblFont, L"", 40, 190, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configSndLblGuiVolVal = _addLabel(theme, "CONFIGSND/GUI_VOL_BTN", theme.btnFont, L"", 426, 190, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configSndBtnGuiVolM = _addPicButton(theme, "CONFIGSND/GUI_VOL_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 190, 56, 56);
m_configSndBtnGuiVolP = _addPicButton(theme, "CONFIGSND/GUI_VOL_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 190, 56, 56);
m_configSndLblCFVol = _addLabel(theme, "CONFIGSND/CF_VOL", theme.lblFont, L"", 40, 250, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configSndLblCFVolVal = _addLabel(theme, "CONFIGSND/CF_VOL_BTN", theme.btnFont, L"", 426, 250, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configSndBtnCFVolM = _addPicButton(theme, "CONFIGSND/CF_VOL_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 250, 56, 56);
m_configSndBtnCFVolP = _addPicButton(theme, "CONFIGSND/CF_VOL_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 250, 56, 56);
m_configSndLblBnrVol = _addLabel(theme, "CONFIGSND/BNR_VOL", theme.lblFont, L"", 40, 310, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configSndLblBnrVolVal = _addLabel(theme, "CONFIGSND/BNR_VOL_BTN", theme.btnFont, L"", 426, 310, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configSndBtnBnrVolM = _addPicButton(theme, "CONFIGSND/BNR_VOL_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 310, 56, 56);
m_configSndBtnBnrVolP = _addPicButton(theme, "CONFIGSND/BNR_VOL_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 310, 56, 56);
_addUserLabels(m_configSndLblUser, ARRAY_SIZE(m_configSndLblUser), "CONFIGSND");
m_configSndBg = _texture("CONFIGSND/BG", "texture", theme.bg, false);
m_configSndLblMusicVol = _addLabel("CONFIGSND/MUSIC_VOL", theme.lblFont, L"", 40, 130, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configSndLblMusicVolVal = _addLabel("CONFIGSND/MUSIC_VOL_BTN", theme.btnFont, L"", 426, 130, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configSndBtnMusicVolM = _addPicButton("CONFIGSND/MUSIC_VOL_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 130, 56, 56);
m_configSndBtnMusicVolP = _addPicButton("CONFIGSND/MUSIC_VOL_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 130, 56, 56);
m_configSndLblGuiVol = _addLabel("CONFIGSND/GUI_VOL", theme.lblFont, L"", 40, 190, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configSndLblGuiVolVal = _addLabel("CONFIGSND/GUI_VOL_BTN", theme.btnFont, L"", 426, 190, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configSndBtnGuiVolM = _addPicButton("CONFIGSND/GUI_VOL_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 190, 56, 56);
m_configSndBtnGuiVolP = _addPicButton("CONFIGSND/GUI_VOL_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 190, 56, 56);
m_configSndLblCFVol = _addLabel("CONFIGSND/CF_VOL", theme.lblFont, L"", 40, 250, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configSndLblCFVolVal = _addLabel("CONFIGSND/CF_VOL_BTN", theme.btnFont, L"", 426, 250, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configSndBtnCFVolM = _addPicButton("CONFIGSND/CF_VOL_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 250, 56, 56);
m_configSndBtnCFVolP = _addPicButton("CONFIGSND/CF_VOL_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 250, 56, 56);
m_configSndLblBnrVol = _addLabel("CONFIGSND/BNR_VOL", theme.lblFont, L"", 40, 310, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configSndLblBnrVolVal = _addLabel("CONFIGSND/BNR_VOL_BTN", theme.btnFont, L"", 426, 310, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configSndBtnBnrVolM = _addPicButton("CONFIGSND/BNR_VOL_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 310, 56, 56);
m_configSndBtnBnrVolP = _addPicButton("CONFIGSND/BNR_VOL_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 310, 56, 56);
//
_setHideAnim(m_configSndLblMusicVol, "CONFIGSND/MUSIC_VOL", 100, 0, -2.f, 0.f);
_setHideAnim(m_configSndLblMusicVolVal, "CONFIGSND/MUSIC_VOL_BTN", 0, 0, 1.f, -1.f);

View File

@ -364,7 +364,7 @@ static bool checkPNGBuf(u8 *data)
static bool checkPNGFile(const char *filename)
{
SmartBuf buffer;
u8 *buffer = NULL;
FILE *file = fopen(filename, "rb");
if (file == NULL) return false;
fseek(file, 0, SEEK_END);
@ -372,11 +372,12 @@ static bool checkPNGFile(const char *filename)
fseek(file, 0, SEEK_SET);
if (fileSize > 0)
{
buffer = smartAnyAlloc(fileSize);
if (!!buffer) fread(buffer.get(), 1, fileSize, file);
buffer = (u8*)MEM2_alloc(fileSize);
if(buffer != NULL)
fread(buffer, 1, fileSize, file);
}
fclose(file);
return !buffer ? false : checkPNGBuf(buffer.get());
return buffer == NULL ? false : checkPNGBuf(buffer);
}
void CMenu::_initAsyncNetwork()
@ -459,14 +460,13 @@ int CMenu::_coverDownloader(bool missingOnly)
float dlWeight = 1.f - listWeight;
u32 bufferSize = 0x280000; // Maximum download size 2 MB
SmartBuf buffer = smartAnyAlloc(bufferSize);
if(!buffer)
u8 *buffer = (u8*)MEM2_alloc(bufferSize);
if(buffer == NULL)
{
LWP_MutexLock(m_mutex);
_setThrdMsg(L"Not enough memory!", 1.f);
LWP_MutexUnlock(m_mutex);
m_thrdWorking = false;
buffer.release();
return 0;
}
bool savePNG = m_cfg.getBool("GENERAL", "keep_png", true);
@ -539,7 +539,7 @@ int CMenu::_coverDownloader(bool missingOnly)
_setThrdMsg(_t("dlmsg2", L"Network initialization failed!"), 1.f);
LWP_MutexUnlock(m_mutex);
m_thrdWorking = false;
buffer.release();
free(buffer);
return 0;
}
m_thrdStepLen = dlWeight / (float)nbSteps;
@ -609,7 +609,7 @@ int CMenu::_coverDownloader(bool missingOnly)
LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg3", L"Downloading from %s"), url.c_str()), m_thrdStep);
LWP_MutexUnlock(m_mutex);
download = downloadfile(buffer.get(), bufferSize, url.c_str(), CMenu::_downloadProgress, this);
download = downloadfile(buffer, bufferSize, url.c_str(), CMenu::_downloadProgress, this);
for( int o = 0; o < 12; ++o )
{
@ -703,7 +703,7 @@ int CMenu::_coverDownloader(bool missingOnly)
LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg3", L"Downloading from %s"), url.c_str()), m_thrdStep);
LWP_MutexUnlock(m_mutex);
download = downloadfile(buffer.get(), bufferSize, url.c_str(), CMenu::_downloadProgress, this);
download = downloadfile(buffer, bufferSize, url.c_str(), CMenu::_downloadProgress, this);
}
}
@ -755,7 +755,7 @@ int CMenu::_coverDownloader(bool missingOnly)
LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg3", L"Downloading from %s"), url.c_str()), m_thrdStep);
LWP_MutexUnlock(m_mutex);
download = downloadfile(buffer.get(), bufferSize, url.c_str(), CMenu::_downloadProgress, this);
download = downloadfile(buffer, bufferSize, url.c_str(), CMenu::_downloadProgress, this);
for( int o = 0; o < 12; ++o )
{
bool tdl = false;
@ -851,7 +851,7 @@ int CMenu::_coverDownloader(bool missingOnly)
LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg3", L"Downloading from %s"), url.c_str()), m_thrdStep);
LWP_MutexUnlock(m_mutex);
download = downloadfile(buffer.get(), bufferSize, url.c_str(), CMenu::_downloadProgress, this);
download = downloadfile(buffer, bufferSize, url.c_str(), CMenu::_downloadProgress, this);
}
}
@ -902,7 +902,7 @@ int CMenu::_coverDownloader(bool missingOnly)
LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg8", L"Full cover not found. Downloading from %s"), url.c_str()), listWeight + dlWeight * (float)step / (float)nbSteps);
LWP_MutexUnlock(m_mutex);
download = downloadfile(buffer.get(), bufferSize, url.c_str(), CMenu::_downloadProgress, this);
download = downloadfile(buffer, bufferSize, url.c_str(), CMenu::_downloadProgress, this);
for( int o = 0; o < 12; ++o )
{
@ -998,7 +998,7 @@ int CMenu::_coverDownloader(bool missingOnly)
LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg3", L"Downloading from %s"), url.c_str()), m_thrdStep);
LWP_MutexUnlock(m_mutex);
download = downloadfile(buffer.get(), bufferSize, url.c_str(), CMenu::_downloadProgress, this);
download = downloadfile(buffer, bufferSize, url.c_str(), CMenu::_downloadProgress, this);
}
}
@ -1046,7 +1046,7 @@ int CMenu::_coverDownloader(bool missingOnly)
LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg8", L"Full cover not found. Downloading from %s"), url.c_str()), listWeight + dlWeight * (float)step / (float)nbSteps);
LWP_MutexUnlock(m_mutex);
download = downloadfile(buffer.get(), bufferSize, url.c_str(), CMenu::_downloadProgress, this);
download = downloadfile(buffer, bufferSize, url.c_str(), CMenu::_downloadProgress, this);
for( int o = 0; o < 12; ++o )
{
@ -1141,7 +1141,7 @@ int CMenu::_coverDownloader(bool missingOnly)
LWP_MutexLock(m_mutex);
_setThrdMsg(wfmt(_fmt("dlmsg3", L"Downloading from %s"), url.c_str()), m_thrdStep);
LWP_MutexUnlock(m_mutex);
download = downloadfile(buffer.get(), bufferSize, url.c_str(), CMenu::_downloadProgress, this);
download = downloadfile(buffer, bufferSize, url.c_str(), CMenu::_downloadProgress, this);
}
}
@ -1192,7 +1192,7 @@ int CMenu::_coverDownloader(bool missingOnly)
LWP_MutexUnlock(m_mutex);
m_thrdWorking = false;
pluginCoverList.clear();
buffer.release();
free(buffer);
return 0;
}
@ -1534,57 +1534,57 @@ void CMenu::_download(string gameId)
_hideSettings();
}
void CMenu::_initDownloadMenu(CMenu::SThemeData &theme)
void CMenu::_initDownloadMenu()
{
// Download menu
_addUserLabels(theme, m_downloadLblUser, ARRAY_SIZE(m_downloadLblUser), "DOWNLOAD");
m_downloadBg = _texture(theme.texSet, "DOWNLOAD/BG", "texture", theme.bg);
m_downloadLblTitle = _addTitle(theme, "DOWNLOAD/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_downloadPBar = _addProgressBar(theme, "DOWNLOAD/PROGRESS_BAR", 40, 200, 560, 20);
m_downloadBtnCancel = _addButton(theme, "DOWNLOAD/CANCEL_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
m_downloadLblCovers = _addLabel(theme, "DOWNLOAD/COVERS", theme.btnFont, L"", 40, 130, 320, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_downloadBtnAll = _addButton(theme, "DOWNLOAD/ALL_BTN", theme.btnFont, L"", 370, 130, 230, 56, theme.btnFontColor);
m_downloadBtnMissing = _addButton(theme, "DOWNLOAD/MISSING_BTN", theme.btnFont, L"", 370, 190, 230, 56, theme.btnFontColor);
m_downloadLblCoverSet = _addLabel(theme, "DOWNLOAD/COVERSSET", theme.btnFont, L"", 40, 250, 320, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_downloadBtnCoverSet = _addButton(theme, "DOWNLOAD/COVERSET_BTN", theme.btnFont, L"", 370, 250, 230, 56, theme.btnFontColor);
m_downloadLblGameTDBDownload = _addLabel(theme, "DOWNLOAD/GAMETDB_DOWNLOAD", theme.btnFont, L"", 40, 310, 320, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_downloadBtnGameTDBDownload = _addButton(theme, "DOWNLOAD/GAMETDB_DOWNLOAD_BTN", theme.btnFont, L"", 370, 310, 230, 56, theme.btnFontColor);
m_downloadLblGameTDB = _addLabel(theme, "DOWNLOAD/GAMETDB", theme.lblFont, L"", 40, 390, 370, 60, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_downloadLblMessage[0] = _addLabel(theme, "DOWNLOAD/MESSAGE1", theme.lblFont, L"", 40, 228, 560, 100, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
m_downloadLblMessage[1] = _addLabel(theme, "DOWNLOAD/MESSAGE2", theme.lblFont, L"", 40, 228, 560, 100, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
_addUserLabels(m_downloadLblUser, ARRAY_SIZE(m_downloadLblUser), "DOWNLOAD");
m_downloadBg = _texture("DOWNLOAD/BG", "texture", theme.bg, false);
m_downloadLblTitle = _addTitle("DOWNLOAD/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_downloadPBar = _addProgressBar("DOWNLOAD/PROGRESS_BAR", 40, 200, 560, 20);
m_downloadBtnCancel = _addButton("DOWNLOAD/CANCEL_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
m_downloadLblCovers = _addLabel("DOWNLOAD/COVERS", theme.btnFont, L"", 40, 130, 320, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_downloadBtnAll = _addButton("DOWNLOAD/ALL_BTN", theme.btnFont, L"", 370, 130, 230, 56, theme.btnFontColor);
m_downloadBtnMissing = _addButton("DOWNLOAD/MISSING_BTN", theme.btnFont, L"", 370, 190, 230, 56, theme.btnFontColor);
m_downloadLblCoverSet = _addLabel("DOWNLOAD/COVERSSET", theme.btnFont, L"", 40, 250, 320, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_downloadBtnCoverSet = _addButton("DOWNLOAD/COVERSET_BTN", theme.btnFont, L"", 370, 250, 230, 56, theme.btnFontColor);
m_downloadLblGameTDBDownload = _addLabel("DOWNLOAD/GAMETDB_DOWNLOAD", theme.btnFont, L"", 40, 310, 320, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_downloadBtnGameTDBDownload = _addButton("DOWNLOAD/GAMETDB_DOWNLOAD_BTN", theme.btnFont, L"", 370, 310, 230, 56, theme.btnFontColor);
m_downloadLblGameTDB = _addLabel("DOWNLOAD/GAMETDB", theme.lblFont, L"", 40, 390, 370, 60, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_downloadLblMessage[0] = _addLabel("DOWNLOAD/MESSAGE1", theme.lblFont, L"", 40, 228, 560, 100, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
m_downloadLblMessage[1] = _addLabel("DOWNLOAD/MESSAGE2", theme.lblFont, L"", 40, 228, 560, 100, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
// Cover settings
m_downloadLblSetTitle = _addTitle(theme, "DOWNLOAD/SETTITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_downloadLblCoverPrio = _addLabel(theme, "DOWNLOAD/COVERPRIO", theme.lblFont, L"", 40, 100, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_downloadLblPrio = _addLabel(theme, "DOWNLOAD/PRIO_BTN", theme.btnFont, L"", 366, 100, 178, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_downloadBtnPrioM = _addPicButton(theme, "DOWNLOAD/PRIO_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 310, 100, 56, 56);
m_downloadBtnPrioP = _addPicButton(theme, "DOWNLOAD/PRIO_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 100, 56, 56);
m_downloadLblRegion = _addLabel(theme, "DOWNLOAD/REGION", theme.lblFont, L"", 40, 160, 600, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_downloadBtnEN = _addPicButton(theme, "DOWNLOAD/EN", theme.btnENOff, theme.btnENOffs, 60, 220, 120, 56);
m_downloadBtnJA = _addPicButton(theme, "DOWNLOAD/JA", theme.btnJAOff, theme.btnJAOffs, 195, 220, 120, 56);
m_downloadBtnFR = _addPicButton(theme, "DOWNLOAD/FR", theme.btnFROff, theme.btnFROffs, 330, 220, 120, 56);
m_downloadBtnDE = _addPicButton(theme, "DOWNLOAD/DE", theme.btnDEOff, theme.btnDEOffs, 465, 220, 120, 56);
m_downloadBtnES = _addPicButton(theme, "DOWNLOAD/ES", theme.btnESOff, theme.btnESOffs, 60, 280, 120, 56);
m_downloadBtnIT = _addPicButton(theme, "DOWNLOAD/IT", theme.btnITOff, theme.btnITOffs, 195, 280, 120, 56);
m_downloadBtnNL = _addPicButton(theme, "DOWNLOAD/NL", theme.btnNLOff, theme.btnNLOffs, 330, 280, 120, 56);
m_downloadBtnPT = _addPicButton(theme, "DOWNLOAD/PT", theme.btnPTOff, theme.btnPTOffs, 465, 280, 120, 56);
m_downloadBtnRU = _addPicButton(theme, "DOWNLOAD/RU", theme.btnRUOff, theme.btnRUOffs, 60, 340, 120, 56);
m_downloadBtnKO = _addPicButton(theme, "DOWNLOAD/KO", theme.btnKOOff, theme.btnKOOffs, 195, 340, 120, 56);
m_downloadBtnZHCN = _addPicButton(theme, "DOWNLOAD/ZHCN", theme.btnZHCNOff, theme.btnZHCNOffs, 330, 340, 120, 56);
m_downloadBtnAU = _addPicButton(theme, "DOWNLOAD/AU", theme.btnAUOff, theme.btnAUOffs, 465, 340, 120, 56);
m_downloadBtnENs = _addPicButton(theme, "DOWNLOAD/ENS", theme.btnENOn, theme.btnENOns, 60, 220, 120, 56);
m_downloadBtnJAs = _addPicButton(theme, "DOWNLOAD/JAS", theme.btnJAOn, theme.btnJAOns, 195, 220, 120, 56);
m_downloadBtnFRs = _addPicButton(theme, "DOWNLOAD/FRS", theme.btnFROn, theme.btnFROns, 330, 220, 120, 56);
m_downloadBtnDEs = _addPicButton(theme, "DOWNLOAD/DES", theme.btnDEOn, theme.btnDEOns, 465, 220, 120, 56);
m_downloadBtnESs = _addPicButton(theme, "DOWNLOAD/ESS", theme.btnESOn, theme.btnESOns, 60, 280, 120, 56);
m_downloadBtnITs = _addPicButton(theme, "DOWNLOAD/ITS", theme.btnITOn, theme.btnITOns, 195, 280, 120, 56);
m_downloadBtnNLs = _addPicButton(theme, "DOWNLOAD/NLS", theme.btnNLOn, theme.btnNLOns, 330, 280, 120, 56);
m_downloadBtnPTs = _addPicButton(theme, "DOWNLOAD/PTS", theme.btnPTOn, theme.btnPTOns, 465, 280, 120, 56);
m_downloadBtnRUs = _addPicButton(theme, "DOWNLOAD/RUS", theme.btnRUOn, theme.btnRUOns, 60, 340, 120, 56);
m_downloadBtnKOs = _addPicButton(theme, "DOWNLOAD/KOS", theme.btnKOOn, theme.btnKOOns, 195, 340, 120, 56);
m_downloadBtnZHCNs = _addPicButton(theme, "DOWNLOAD/ZHCNS", theme.btnZHCNOn, theme.btnZHCNOns, 330, 340, 120, 56);
m_downloadBtnAUs = _addPicButton(theme, "DOWNLOAD/AUS", theme.btnAUOn, theme.btnAUOns, 465, 340, 120, 56);
m_downloadBtnBack = _addButton(theme, "DOWNLOAD/BACK_BTN", theme.btnFont, L"", 420, 410, 200, 56, theme.btnFontColor);
m_downloadLblSetTitle = _addTitle("DOWNLOAD/SETTITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_downloadLblCoverPrio = _addLabel("DOWNLOAD/COVERPRIO", theme.lblFont, L"", 40, 100, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_downloadLblPrio = _addLabel("DOWNLOAD/PRIO_BTN", theme.btnFont, L"", 366, 100, 178, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_downloadBtnPrioM = _addPicButton("DOWNLOAD/PRIO_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 310, 100, 56, 56);
m_downloadBtnPrioP = _addPicButton("DOWNLOAD/PRIO_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 100, 56, 56);
m_downloadLblRegion = _addLabel("DOWNLOAD/REGION", theme.lblFont, L"", 40, 160, 600, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_downloadBtnEN = _addPicButton("DOWNLOAD/EN", theme.btnENOff, theme.btnENOffs, 60, 220, 120, 56);
m_downloadBtnJA = _addPicButton("DOWNLOAD/JA", theme.btnJAOff, theme.btnJAOffs, 195, 220, 120, 56);
m_downloadBtnFR = _addPicButton("DOWNLOAD/FR", theme.btnFROff, theme.btnFROffs, 330, 220, 120, 56);
m_downloadBtnDE = _addPicButton("DOWNLOAD/DE", theme.btnDEOff, theme.btnDEOffs, 465, 220, 120, 56);
m_downloadBtnES = _addPicButton("DOWNLOAD/ES", theme.btnESOff, theme.btnESOffs, 60, 280, 120, 56);
m_downloadBtnIT = _addPicButton("DOWNLOAD/IT", theme.btnITOff, theme.btnITOffs, 195, 280, 120, 56);
m_downloadBtnNL = _addPicButton("DOWNLOAD/NL", theme.btnNLOff, theme.btnNLOffs, 330, 280, 120, 56);
m_downloadBtnPT = _addPicButton("DOWNLOAD/PT", theme.btnPTOff, theme.btnPTOffs, 465, 280, 120, 56);
m_downloadBtnRU = _addPicButton("DOWNLOAD/RU", theme.btnRUOff, theme.btnRUOffs, 60, 340, 120, 56);
m_downloadBtnKO = _addPicButton("DOWNLOAD/KO", theme.btnKOOff, theme.btnKOOffs, 195, 340, 120, 56);
m_downloadBtnZHCN = _addPicButton("DOWNLOAD/ZHCN", theme.btnZHCNOff, theme.btnZHCNOffs, 330, 340, 120, 56);
m_downloadBtnAU = _addPicButton("DOWNLOAD/AU", theme.btnAUOff, theme.btnAUOffs, 465, 340, 120, 56);
m_downloadBtnENs = _addPicButton("DOWNLOAD/ENS", theme.btnENOn, theme.btnENOns, 60, 220, 120, 56);
m_downloadBtnJAs = _addPicButton("DOWNLOAD/JAS", theme.btnJAOn, theme.btnJAOns, 195, 220, 120, 56);
m_downloadBtnFRs = _addPicButton("DOWNLOAD/FRS", theme.btnFROn, theme.btnFROns, 330, 220, 120, 56);
m_downloadBtnDEs = _addPicButton("DOWNLOAD/DES", theme.btnDEOn, theme.btnDEOns, 465, 220, 120, 56);
m_downloadBtnESs = _addPicButton("DOWNLOAD/ESS", theme.btnESOn, theme.btnESOns, 60, 280, 120, 56);
m_downloadBtnITs = _addPicButton("DOWNLOAD/ITS", theme.btnITOn, theme.btnITOns, 195, 280, 120, 56);
m_downloadBtnNLs = _addPicButton("DOWNLOAD/NLS", theme.btnNLOn, theme.btnNLOns, 330, 280, 120, 56);
m_downloadBtnPTs = _addPicButton("DOWNLOAD/PTS", theme.btnPTOn, theme.btnPTOns, 465, 280, 120, 56);
m_downloadBtnRUs = _addPicButton("DOWNLOAD/RUS", theme.btnRUOn, theme.btnRUOns, 60, 340, 120, 56);
m_downloadBtnKOs = _addPicButton("DOWNLOAD/KOS", theme.btnKOOn, theme.btnKOOns, 195, 340, 120, 56);
m_downloadBtnZHCNs = _addPicButton("DOWNLOAD/ZHCNS", theme.btnZHCNOn, theme.btnZHCNOns, 330, 340, 120, 56);
m_downloadBtnAUs = _addPicButton("DOWNLOAD/AUS", theme.btnAUOn, theme.btnAUOns, 465, 340, 120, 56);
m_downloadBtnBack = _addButton("DOWNLOAD/BACK_BTN", theme.btnFont, L"", 420, 410, 200, 56, theme.btnFontColor);
// Download menu
_setHideAnim(m_downloadLblTitle, "DOWNLOAD/TITLE", 0, 0, -2.f, 0.f);
@ -1689,8 +1689,8 @@ s8 CMenu::_versionTxtDownloaderInit(CMenu *m) //Handler to download versions txt
s8 CMenu::_versionTxtDownloader() // code to download new version txt file
{
u32 bufferSize = 0x010000; // Maximum download size 64kb
SmartBuf buffer = smartAnyAlloc(bufferSize);
if (!buffer)
u8 *buffer = (u8*)MEM2_alloc(bufferSize);
if(buffer == NULL)
{
LWP_MutexLock(m_mutex);
_setThrdMsg(L"Not enough memory", 1.f);
@ -1719,7 +1719,7 @@ s8 CMenu::_versionTxtDownloader() // code to download new version txt file
m_thrdStep = 0.2f;
m_thrdStepLen = 0.9f - 0.2f;
gprintf("TXT update URL: %s\n\n", m_cfg.getString("GENERAL", "updatetxturl", UPDATE_URL_VERSION).c_str());
download = downloadfile(buffer.get(), bufferSize, m_cfg.getString("GENERAL", "updatetxturl", UPDATE_URL_VERSION).c_str(),CMenu::_downloadProgress, this);
download = downloadfile(buffer, bufferSize, m_cfg.getString("GENERAL", "updatetxturl", UPDATE_URL_VERSION).c_str(),CMenu::_downloadProgress, this);
if (download.data == 0 || download.size < 19)
{
LWP_MutexLock(m_mutex);
@ -1770,7 +1770,7 @@ s8 CMenu::_versionTxtDownloader() // code to download new version txt file
}
}
m_thrdWorking = false;
buffer.release();
free(buffer);
return 0;
}
@ -1815,8 +1815,8 @@ s8 CMenu::_versionDownloader() // code to download new version
filestr.close();
u32 bufferSize = max(m_app_update_size, m_data_update_size); // Buffer for size of the biggest file.
SmartBuf buffer = smartAnyAlloc(bufferSize);
if (!buffer)
u8 *buffer = (u8*)MEM2_alloc(bufferSize);
if(buffer == NULL)
{
LWP_MutexLock(m_mutex);
_setThrdMsg(L"Not enough memory!", 1.f);
@ -1837,7 +1837,7 @@ s8 CMenu::_versionDownloader() // code to download new version
LWP_MutexUnlock(m_mutex);
sleep(3);
m_thrdWorking = false;
buffer.release();
free(buffer);
return 0;
}
@ -1851,7 +1851,7 @@ s8 CMenu::_versionDownloader() // code to download new version
gprintf("App Update URL: %s\n", m_app_update_url);
gprintf("Data Update URL: %s\n", m_data_update_url);
download = downloadfile(buffer.get(), bufferSize, m_app_update_url, CMenu::_downloadProgress, this);
download = downloadfile(buffer, bufferSize, m_app_update_url, CMenu::_downloadProgress, this);
if (download.data == 0 || download.size < m_app_update_size)
{
LWP_MutexLock(m_mutex);
@ -1859,7 +1859,7 @@ s8 CMenu::_versionDownloader() // code to download new version
LWP_MutexUnlock(m_mutex);
sleep(3);
m_thrdWorking = false;
buffer.release();
free(buffer);
return 0;
}
@ -1894,13 +1894,13 @@ s8 CMenu::_versionDownloader() // code to download new version
download.data = NULL;
download.size = 0;
//memset(&buffer, 0, bufferSize); should we be clearing the buffer of any possible data before downloading?
memset(buffer, 0, bufferSize); //should we be clearing the buffer of any possible data before downloading?
LWP_MutexLock(m_mutex);
_setThrdMsg(_t("dlmsg23", L"Updating data directory..."), 0.2f);
LWP_MutexUnlock(m_mutex);
download = downloadfile(buffer.get(), bufferSize, m_data_update_url, CMenu::_downloadProgress, this);
download = downloadfile(buffer, bufferSize, m_data_update_url, CMenu::_downloadProgress, this);
if (download.data == 0 || download.size < m_data_update_size)
{
LWP_MutexLock(m_mutex);
@ -1967,7 +1967,7 @@ fail:
_setThrdMsg(_t("dlmsg15", L"Saving failed!"), 1.f);
LWP_MutexUnlock(m_mutex);
out:
buffer.release();
free(buffer);
sleep(3);
m_thrdWorking = false;
return 0;
@ -1984,8 +1984,8 @@ int CMenu::_gametdbDownloaderAsync()
string langCode;
u32 bufferSize = 0x800000; // 8 MB
SmartBuf buffer = smartAnyAlloc(bufferSize);
if (!buffer)
u8 *buffer = (u8*)MEM2_alloc(bufferSize);
if (buffer == NULL)
{
LWP_MutexLock(m_mutex);
_setThrdMsg(L"Not enough memory", 1.f);
@ -2009,7 +2009,7 @@ int CMenu::_gametdbDownloaderAsync()
LWP_MutexUnlock(m_mutex);
m_thrdStep = 0.0f;
m_thrdStepLen = 1.0f;
download = downloadfile(buffer.get(), bufferSize, fmt(GAMETDB_URL, langCode.c_str()), CMenu::_downloadProgress, this);
download = downloadfile(buffer, bufferSize, fmt(GAMETDB_URL, langCode.c_str()), CMenu::_downloadProgress, this);
if (download.data == 0)
{
LWP_MutexLock(m_mutex);
@ -2068,7 +2068,7 @@ int CMenu::_gametdbDownloaderAsync()
}
}
}
buffer.release();
free(buffer);
m_thrdWorking = false;
return 0;
}

View File

@ -59,15 +59,15 @@ void CMenu::_showError(void)
m_btnMgr.show(m_errorLblUser[i]);
}
void CMenu::_initErrorMenu(CMenu::SThemeData &theme)
void CMenu::_initErrorMenu()
{
STexture texIcon;
texIcon.fromPNG(error_png);
_addUserLabels(theme, m_errorLblUser, ARRAY_SIZE(m_errorLblUser), "ERROR");
m_errorBg = _texture(theme.texSet, "ERROR/BG", "texture", theme.bg);
m_errorLblMessage = _addLabel(theme, "ERROR/MESSAGE", theme.lblFont, L"", 112, 20, 500, 440, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_errorLblIcon = _addLabel(theme, "ERROR/ICON", theme.lblFont, L"", 40, 200, 64, 64, theme.lblFontColor, 0, texIcon);
_addUserLabels(m_errorLblUser, ARRAY_SIZE(m_errorLblUser), "ERROR");
m_errorBg = _texture("ERROR/BG", "texture", theme.bg, false);
m_errorLblMessage = _addLabel("ERROR/MESSAGE", theme.lblFont, L"", 112, 20, 500, 440, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_errorLblIcon = _addLabel("ERROR/ICON", theme.lblFont, L"", 40, 200, 64, 64, theme.lblFontColor, 0, texIcon);
//
_setHideAnim(m_errorLblMessage, "ERROR/MESSAGE", 0, 0, 0.f, 0.f);
_setHideAnim(m_errorLblIcon, "ERROR/ICON", -50, 0, 0.f, 0.f);

View File

@ -8,7 +8,6 @@
#include "menu.hpp"
#include "types.h"
#include "const_str.hpp"
#include "banner/BannerWindow.hpp"
#include "booter/external_booter.hpp"
#include "channel/channel_launcher.h"
@ -440,18 +439,18 @@ 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());
FILE *file = fopen(videoPath, "r");
if(file)
{
fclose(file);
MusicPlayer.Stop();
m_gameSound.Stop();
m_banner.SetShowBanner(false);
fclose(file);
_hideGame();
/* Backup Background */
STexture Current_LQ_BG = m_lqBg;
STexture Current_HQ_BG = m_curBg;
/* Set Background empty */
STexture EmptyBG;
_setBg(EmptyBG, EmptyBG);
/* Lets play the movie */
@ -467,14 +466,15 @@ void CMenu::_game(bool launch)
/* Draw movie BG and render */
_drawBg();
m_vid.render();
m_curBg.data.release();
free(m_curBg.data);
/* Check if we want to stop */
WPAD_ScanPads();
PAD_ScanPads();
ButtonsPressed();
}
movie.Stop();
m_curBg.data.release();
free(m_curBg.data);
m_curBg.data = NULL;
/* Finished, so lets re-setup the background */
_setBg(Current_HQ_BG, Current_LQ_BG);
_updateBg();
@ -1040,7 +1040,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
int aspectRatio = min((u32)m_gcfg2.getInt(id, "aspect_ratio", 0), ARRAY_SIZE(CMenu::_AspectRatio) - 1u)-1;
u32 returnTo = rtrn[0] << 24 | rtrn[1] << 16 | rtrn[2] << 8 | rtrn[3];
SmartBuf cheatFile;
u8 *cheatFile = NULL;
u32 cheatSize = 0;
if(!WII_Launch)
{
@ -1127,7 +1127,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
else
{
setLanguage(language);
ocarina_load_code(cheatFile.get(), cheatSize);
ocarina_load_code(cheatFile, cheatSize);
Identify(gameTitle);
ExternalBooter_ChannelSetup(gameTitle);
WiiFlow_ExternalBooter(videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, 0, TYPE_CHANNEL);
@ -1293,7 +1293,8 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
debuggerselect = false;
hooktype = (u32)m_gcfg2.getInt(id, "hooktype", 0); // hooktype is defined in patchcode.h
SmartBuf cheatFile, gameconfig;
u8 *cheatFile = NULL;
u8 *gameconfig = NULL;
u32 cheatSize = 0, gameconfigSize = 0, returnTo = 0;
m_cfg.setString("GAMES", "current_item", id);
@ -1309,7 +1310,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
if(cheat)
_loadFile(cheatFile, cheatSize, m_cheatDir.c_str(), fmt("%s.gct", id.c_str()));
_loadFile(gameconfig, gameconfigSize, m_txtCheatDir.c_str(), "gameconfig.txt");
if(!debuggerselect && !cheatFile.get())
if(!debuggerselect && cheatFile == NULL)
hooktype = 0;
if(rtrn != NULL && strlen(rtrn) == 4)
@ -1363,21 +1364,21 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
Sys_Exit();
WBFS_Close();
}
if(cheatFile.get() != NULL)
if(cheatFile != NULL)
{
ocarina_load_code(cheatFile.get(), cheatSize);
cheatFile.release();
ocarina_load_code(cheatFile, cheatSize);
free(cheatFile);
}
if(gameconfig.get() != NULL)
if(gameconfig != NULL)
{
app_gameconfig_load(id.c_str(), gameconfig.get(), gameconfigSize);
gameconfig.release();
app_gameconfig_load(id.c_str(), gameconfig, gameconfigSize);
free(gameconfig);
}
ExternalBooter_WiiGameSetup(wbfs_partition, dvd, id.c_str());
WiiFlow_ExternalBooter(videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, returnTo, TYPE_WII_GAME);
}
void CMenu::_initGameMenu(CMenu::SThemeData &theme)
void CMenu::_initGameMenu()
{
CColor fontColor(0xD0BFDFFF);
STexture texFavOn;
@ -1409,23 +1410,23 @@ void CMenu::_initGameMenu(CMenu::SThemeData &theme)
texSettingsSel.fromPNG(btngamecfgs_png);
texToogleBanner.fromPNG(blank_png);
_addUserLabels(theme, m_gameLblUser, ARRAY_SIZE(m_gameLblUser), "GAME");
m_gameBg = _texture(theme.texSet, "GAME/BG", "texture", theme.bg);
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, ALLOC_MEM2, 64, 64))
_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))
m_gameBgLQ = bgLQ;
m_gameBtnPlay = _addButton(theme, "GAME/PLAY_BTN", theme.btnFont, L"", 420, 344, 200, 56, theme.btnFontColor);
m_gameBtnBack = _addButton(theme, "GAME/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
m_gameBtnFavoriteOn = _addPicButton(theme, "GAME/FAVORITE_ON", texFavOn, texFavOnSel, 460, 200, 48, 48);
m_gameBtnFavoriteOff = _addPicButton(theme, "GAME/FAVORITE_OFF", texFavOff, texFavOffSel, 460, 200, 48, 48);
m_gameBtnAdultOn = _addPicButton(theme, "GAME/ADULTONLY_ON", texAdultOn, texAdultOnSel, 532, 200, 48, 48);
m_gameBtnAdultOff = _addPicButton(theme, "GAME/ADULTONLY_OFF", texAdultOff, texAdultOffSel, 532, 200, 48, 48);
m_gameBtnSettings = _addPicButton(theme, "GAME/SETTINGS_BTN", texSettings, texSettingsSel, 460, 272, 48, 48);
m_gameBtnDelete = _addPicButton(theme, "GAME/DELETE_BTN", texDelete, texDeleteSel, 532, 272, 48, 48);
m_gameBtnBackFull = _addButton(theme, "GAME/BACK_FULL_BTN", theme.btnFont, L"", 100, 390, 200, 56, theme.btnFontColor);
m_gameBtnPlayFull = _addButton(theme, "GAME/PLAY_FULL_BTN", theme.btnFont, L"", 340, 390, 200, 56, theme.btnFontColor);
m_gameBtnToogle = _addPicButton(theme, "GAME/TOOGLE_BTN", texToogleBanner, texToogleBanner, 385, 31, 236, 127);
m_gameBtnToogleFull = _addPicButton(theme, "GAME/TOOGLE_FULL_BTN", texToogleBanner, texToogleBanner, 20, 12, 608, 344);
m_gameBtnPlay = _addButton("GAME/PLAY_BTN", theme.btnFont, L"", 420, 344, 200, 56, theme.btnFontColor);
m_gameBtnBack = _addButton("GAME/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
m_gameBtnFavoriteOn = _addPicButton("GAME/FAVORITE_ON", texFavOn, texFavOnSel, 460, 200, 48, 48);
m_gameBtnFavoriteOff = _addPicButton("GAME/FAVORITE_OFF", texFavOff, texFavOffSel, 460, 200, 48, 48);
m_gameBtnAdultOn = _addPicButton("GAME/ADULTONLY_ON", texAdultOn, texAdultOnSel, 532, 200, 48, 48);
m_gameBtnAdultOff = _addPicButton("GAME/ADULTONLY_OFF", texAdultOff, texAdultOffSel, 532, 200, 48, 48);
m_gameBtnSettings = _addPicButton("GAME/SETTINGS_BTN", texSettings, texSettingsSel, 460, 272, 48, 48);
m_gameBtnDelete = _addPicButton("GAME/DELETE_BTN", texDelete, texDeleteSel, 532, 272, 48, 48);
m_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", texToogleBanner, texToogleBanner, 385, 31, 236, 127);
m_gameBtnToogleFull = _addPicButton("GAME/TOOGLE_FULL_BTN", texToogleBanner, texToogleBanner, 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);
@ -1465,7 +1466,7 @@ struct IMD5Header
u8 crypto[16];
} __attribute__((packed));
SmartBuf gameSoundThreadStack;
u8 *gameSoundThreadStack;
u32 gameSoundThreadStackSize = (u32)32768;
void CMenu::_gameSoundThread(CMenu *m)
{
@ -1624,9 +1625,9 @@ void CMenu::_playGameSound(void)
if(m_gameSoundThread != LWP_THREAD_NULL)
CheckGameSoundThread();
if(!gameSoundThreadStack.get())
gameSoundThreadStack = smartMem2Alloc(gameSoundThreadStackSize);
LWP_CreateThread(&m_gameSoundThread, (void *(*)(void *))CMenu::_gameSoundThread, (void *)this, gameSoundThreadStack.get(), gameSoundThreadStackSize, 60);
if(gameSoundThreadStack == NULL)
gameSoundThreadStack = (u8*)MEM2_alloc(gameSoundThreadStackSize);
LWP_CreateThread(&m_gameSoundThread, (void *(*)(void *))CMenu::_gameSoundThread, (void *)this, gameSoundThreadStack, gameSoundThreadStackSize, 60);
}
void CMenu::CheckGameSoundThread()
@ -1646,6 +1647,9 @@ void CMenu::CheckGameSoundThread()
void CMenu::ClearGameSoundThreadStack()
{
if(gameSoundThreadStack.get())
gameSoundThreadStack.release();
if(gameSoundThreadStack != NULL)
{
free(gameSoundThreadStack);
gameSoundThreadStack = NULL;
}
}

View File

@ -255,39 +255,39 @@ void CMenu::_showGameInfo(void)
}
}
void CMenu::_initGameInfoMenu(CMenu::SThemeData &theme)
void CMenu::_initGameInfoMenu()
{
STexture emptyTex;
_addUserLabels(theme, m_gameinfoLblUser, 0, 1, "GAMEINFO");
_addUserLabels(theme, m_gameinfoLblUser, 2, 1, "GAMEINFO");
_addUserLabels(m_gameinfoLblUser, 0, 1, "GAMEINFO");
_addUserLabels(m_gameinfoLblUser, 2, 1, "GAMEINFO");
m_gameinfoBg = _texture(theme.texSet, "GAMEINFO/BG", "texture", theme.bg);
m_gameinfoLblID = _addText(theme, "GAMEINFO/GAMEID", theme.txtFont, L"", 40, 110, 420, 75, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
m_gameinfoLblGenre = _addText(theme, "GAMEINFO/GENRE", theme.txtFont, L"", 40, 140, 460, 56, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
m_gameinfoLblDev = _addText(theme, "GAMEINFO/DEVELOPER", theme.txtFont, L"", 40, 170, 460, 56, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
m_gameinfoLblPublisher = _addText(theme, "GAMEINFO/PUBLISHER", theme.txtFont, L"", 40, 200, 460, 56, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
m_gameinfoLblRlsdate = _addText(theme, "GAMEINFO/RLSDATE", theme.txtFont, L"", 40, 230, 460, 56, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
m_gameinfoLblRegion = _addText(theme, "GAMEINFO/REGION", theme.txtFont, L"", 40, 260, 460, 56, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
m_gameinfoLblRating = _addLabel(theme, "GAMEINFO/RATING", theme.titleFont, L"", 550, 380, 48, 60, theme.titleFontColor, 0, m_rating);
m_gameinfoLblSynopsis = _addText(theme, "GAMEINFO/SYNOPSIS", theme.txtFont, L"", 40, 120, 560, 280, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
m_gameinfoLblWifiplayers = _addLabel(theme, "GAMEINFO/WIFIPLAYERS", theme.txtFont, L"", 550, 110, 68, 60, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP,m_wifi);
m_gameinfoBg = _texture("GAMEINFO/BG", "texture", theme.bg, false);
m_gameinfoLblID = _addText("GAMEINFO/GAMEID", theme.txtFont, L"", 40, 110, 420, 75, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
m_gameinfoLblGenre = _addText("GAMEINFO/GENRE", theme.txtFont, L"", 40, 140, 460, 56, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
m_gameinfoLblDev = _addText("GAMEINFO/DEVELOPER", theme.txtFont, L"", 40, 170, 460, 56, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
m_gameinfoLblPublisher = _addText("GAMEINFO/PUBLISHER", theme.txtFont, L"", 40, 200, 460, 56, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
m_gameinfoLblRlsdate = _addText("GAMEINFO/RLSDATE", theme.txtFont, L"", 40, 230, 460, 56, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
m_gameinfoLblRegion = _addText("GAMEINFO/REGION", theme.txtFont, L"", 40, 260, 460, 56, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
m_gameinfoLblRating = _addLabel("GAMEINFO/RATING", theme.titleFont, L"", 550, 380, 48, 60, theme.titleFontColor, 0, m_rating);
m_gameinfoLblSynopsis = _addText("GAMEINFO/SYNOPSIS", theme.txtFont, L"", 40, 120, 560, 280, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
m_gameinfoLblWifiplayers = _addLabel("GAMEINFO/WIFIPLAYERS", theme.txtFont, L"", 550, 110, 68, 60, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP,m_wifi);
_addUserLabels(theme, m_gameinfoLblUser, 1, 1, "GAMEINFO");
_addUserLabels(theme, m_gameinfoLblUser, 3, 2, "GAMEINFO");
_addUserLabels(m_gameinfoLblUser, 1, 1, "GAMEINFO");
_addUserLabels(m_gameinfoLblUser, 3, 2, "GAMEINFO");
m_gameinfoLblTitle = _addLabel(theme, "GAMEINFO/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_gameinfoLblTitle = _addLabel("GAMEINFO/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
for(u8 i = 0; i < ARRAY_SIZE(m_gameinfoLblControlsReq); ++i)
{
string dom(sfmt("GAMEINFO/CONTROLSREQ%i", i + 1));
m_gameinfoLblControlsReq[i] = _addLabel(theme, dom.c_str(), theme.txtFont, L"", 40 + (i*60), 310, 60, 40, theme.txtFontColor, 0, emptyTex);
m_gameinfoLblControlsReq[i] = _addLabel(dom.c_str(), theme.txtFont, L"", 40 + (i*60), 310, 60, 40, theme.txtFontColor, 0, emptyTex);
_setHideAnim(m_gameinfoLblControlsReq[i], dom.c_str(), 0, -100, 0.f, 0.f);
}
for(u8 i = 0; i < ARRAY_SIZE(m_gameinfoLblControls); ++i)
{
string dom(sfmt("GAMEINFO/CONTROLS%i", i + 1));
m_gameinfoLblControls[i] = _addLabel(theme, dom.c_str(), theme.txtFont, L"", 40 + (i*60), 380, 60, 40, theme.txtFontColor, 0, emptyTex);
m_gameinfoLblControls[i] = _addLabel(dom.c_str(), theme.txtFont, L"", 40 + (i*60), 380, 60, 40, theme.txtFontColor, 0, emptyTex);
_setHideAnim(m_gameinfoLblControls[i], dom.c_str(), 0, -100, 0.f, 0.f);
}
//

View File

@ -216,22 +216,22 @@ void CMenu::_hideExitTo(bool instant)
m_btnMgr.hide(m_homeBtnExitToNeek, instant);
}
void CMenu::_initHomeAndExitToMenu(CMenu::SThemeData &theme)
void CMenu::_initHomeAndExitToMenu()
{
//Home Menu
//Home Menu
STexture emptyTex;
m_homeBg = _texture(theme.texSet, "HOME/BG", "texture", theme.bg);
m_homeBg = _texture("HOME/BG", "texture", theme.bg, false);
m_homeLblTitle = _addTitle(theme, "HOME/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_homeLblTitle = _addTitle("HOME/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
_setHideAnim(m_homeLblTitle, "HOME/TITLE", 0, 0, -2.f, 0.f);
m_homeBtnSettings = _addButton(theme, "HOME/SETTINGS", theme.btnFont, L"", 60, 120, 250, 56, theme.btnFontColor);
m_homeBtnReloadCache = _addButton(theme, "HOME/RELOAD_CACHE", theme.btnFont, L"", 60, 230, 250, 56, theme.btnFontColor);
m_homeBtnUpdate = _addButton(theme, "HOME/UPDATE", theme.btnFont, L"", 60, 340, 250, 56, theme.btnFontColor);
m_homeBtnHelp = _addButton(theme, "HOME/HELP", theme.btnFont, L"", 330, 120, 250, 56, theme.btnFontColor);
m_homeBtnAbout = _addButton(theme, "HOME/ABOUT", theme.btnFont, L"", 330, 230, 250, 56, theme.btnFontColor);
m_homeBtnExitTo = _addButton(theme, "HOME/EXIT_TO", theme.btnFont, L"", 330, 340, 250, 56, theme.btnFontColor);
m_homeBtnSettings = _addButton("HOME/SETTINGS", theme.btnFont, L"", 60, 120, 250, 56, theme.btnFontColor);
m_homeBtnReloadCache = _addButton("HOME/RELOAD_CACHE", theme.btnFont, L"", 60, 230, 250, 56, theme.btnFontColor);
m_homeBtnUpdate = _addButton("HOME/UPDATE", theme.btnFont, L"", 60, 340, 250, 56, theme.btnFontColor);
m_homeBtnHelp = _addButton("HOME/HELP", theme.btnFont, L"", 330, 120, 250, 56, theme.btnFontColor);
m_homeBtnAbout = _addButton("HOME/ABOUT", theme.btnFont, L"", 330, 230, 250, 56, theme.btnFontColor);
m_homeBtnExitTo = _addButton("HOME/EXIT_TO", theme.btnFont, L"", 330, 340, 250, 56, theme.btnFontColor);
_setHideAnim(m_homeBtnSettings, "HOME/SETTINGS", 0, 0, -2.f, 0.f);
_setHideAnim(m_homeBtnReloadCache, "HOME/RELOAD_CACHE", 0, 0, -2.f, 0.f);
@ -243,16 +243,16 @@ void CMenu::_initHomeAndExitToMenu(CMenu::SThemeData &theme)
_textHome();
_hideHome(true);
//ExitTo Menu
m_exittoLblTitle = _addTitle(theme, "EXIT_TO/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
//ExitTo Menu
m_exittoLblTitle = _addTitle("EXIT_TO/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
_setHideAnim(m_exittoLblTitle, "EXIT_TO/TITLE", 0, 0, -2.f, 0.f);
m_homeBtnExitToHBC = _addButton(theme, "EXIT_TO/HBC", theme.btnFont, L"", 185, 120, 270, 56, theme.btnFontColor);
m_homeBtnExitToMenu = _addButton(theme, "EXIT_TO/MENU", theme.btnFont, L"", 185, 180, 270, 56, theme.btnFontColor);
m_homeBtnExitToPriiloader = _addButton(theme, "EXIT_TO/PRIILOADER", theme.btnFont, L"", 185, 240, 270, 56, theme.btnFontColor);
m_homeBtnExitToBootmii = _addButton(theme, "EXIT_TO/BOOTMII", theme.btnFont, L"", 185, 300, 270, 56, theme.btnFontColor);
m_homeBtnExitToNeek = _addButton(theme, "EXIT_TO/NEEK", theme.btnFont, L"", 185, 360, 270, 56, theme.btnFontColor);
m_homeBtnExitToHBC = _addButton("EXIT_TO/HBC", theme.btnFont, L"", 185, 120, 270, 56, theme.btnFontColor);
m_homeBtnExitToMenu = _addButton("EXIT_TO/MENU", theme.btnFont, L"", 185, 180, 270, 56, theme.btnFontColor);
m_homeBtnExitToPriiloader = _addButton("EXIT_TO/PRIILOADER", theme.btnFont, L"", 185, 240, 270, 56, theme.btnFontColor);
m_homeBtnExitToBootmii = _addButton("EXIT_TO/BOOTMII", theme.btnFont, L"", 185, 300, 270, 56, theme.btnFontColor);
m_homeBtnExitToNeek = _addButton("EXIT_TO/NEEK", theme.btnFont, L"", 185, 360, 270, 56, theme.btnFontColor);
_setHideAnim(m_homeBtnExitToHBC, "EXIT_TO/HBC", 0, 0, -2.f, 0.f);
_setHideAnim(m_homeBtnExitToMenu, "EXIT_TO/MENU", 0, 0, -2.f, 0.f);
_setHideAnim(m_homeBtnExitToPriiloader, "EXIT_TO/PRIILOADER", 0, 0, -2.f, 0.f);

View File

@ -182,19 +182,16 @@ void CMenu::_showMain(void)
void CMenu::LoadView(void)
{
m_curGameId = m_cf.getId();
_hideMain(true);
m_cf.clear();
if(!m_vid.showingWaitMessage())
_showWaitMessage();
m_favorites = false;
if (m_cfg.getBool("GENERAL", "save_favorites_mode", false))
m_favorites = m_cfg.getBool(_domainFromView(), "favorites", false);
_loadList();
_showMain();
_initCF();
_loadCFLayout(m_cfg.getInt(_domainFromView(), "last_cf_mode", 1));
m_cf.applySettings();
@ -669,9 +666,7 @@ int CMenu::main(void)
for(u8 i = 0; strncmp((const char *)&partition[i], "\0", 1) != 0; i++)
partition[i] = toupper(partition[i]);
gprintf("Next item: %s\n", partition);
//gprintf("Next item: %s\n", partition);
m_showtimer=60;
char gui_name[20];
snprintf(gui_name, sizeof(gui_name), "%s [%s]", _domainFromView(),partition);
@ -830,14 +825,14 @@ int CMenu::main(void)
_FindEmuPart(&emuPath, m_cfg.getInt("NAND", "partition", 0), false);
Sys_SetNeekPath(emuPath.size() > 1 ? emuPath.c_str() : NULL);
}
gprintf("Saving configuration files\n");
//gprintf("Saving configuration files\n");
m_cfg.save();
m_cat.save();
// m_loc.save();
return 0;
}
void CMenu::_initMainMenu(CMenu::SThemeData &theme)
void CMenu::_initMainMenu()
{
STexture texQuit;
STexture texQuitS;
@ -868,8 +863,8 @@ void CMenu::_initMainMenu(CMenu::SThemeData &theme)
STexture bgLQ;
STexture emptyTex;
m_mainBg = _texture(theme.texSet, "MAIN/BG", "texture", theme.bg);
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, ALLOC_MEM2, 64, 64))
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))
m_mainBgLQ = bgLQ;
texQuit.fromPNG(btnquit_png);
@ -899,29 +894,29 @@ void CMenu::_initMainMenu(CMenu::SThemeData &theme)
texFavOff.fromPNG(favoritesoff_png);
texFavOffS.fromPNG(favoritesoffs_png);
_addUserLabels(theme, m_mainLblUser, ARRAY_SIZE(m_mainLblUser), "MAIN");
_addUserLabels(m_mainLblUser, ARRAY_SIZE(m_mainLblUser), "MAIN");
m_mainBtnInfo = _addPicButton(theme, "MAIN/INFO_BTN", texInfo, texInfoS, 20, 400, 48, 48);
m_mainBtnConfig = _addPicButton(theme, "MAIN/CONFIG_BTN", texConfig, texConfigS, 70, 400, 48, 48);
m_mainBtnQuit = _addPicButton(theme, "MAIN/QUIT_BTN", texQuit, texQuitS, 570, 400, 48, 48);
m_mainBtnChannel = _addPicButton(theme, "MAIN/CHANNEL_BTN", texChannel, texChannels, 520, 400, 48, 48);
m_mainBtnHomebrew = _addPicButton(theme, "MAIN/HOMEBREW_BTN", texHomebrew, texHomebrews, 520, 400, 48, 48);
m_mainBtnUsb = _addPicButton(theme, "MAIN/USB_BTN", texUsb, texUsbs, 520, 400, 48, 48);
m_mainBtnDML = _addPicButton(theme, "MAIN/DML_BTN", texDML, texDMLs, 520, 400, 48, 48);
m_mainBtnEmu = _addPicButton(theme, "MAIN/EMU_BTN", texEmu, texEmus, 520, 400, 48, 48);
m_mainBtnDVD = _addPicButton(theme, "MAIN/DVD_BTN", texDVD, texDVDs, 470, 400, 48, 48);
m_mainBtnNext = _addPicButton(theme, "MAIN/NEXT_BTN", texNext, texNextS, 540, 146, 80, 80);
m_mainBtnPrev = _addPicButton(theme, "MAIN/PREV_BTN", texPrev, texPrevS, 20, 146, 80, 80);
m_mainBtnInit = _addButton(theme, "MAIN/BIG_SETTINGS_BTN", theme.titleFont, L"", 72, 180, 496, 56, theme.titleFontColor);
m_mainBtnInit2 = _addButton(theme, "MAIN/BIG_SETTINGS_BTN2", theme.titleFont, L"", 72, 290, 496, 56, theme.titleFontColor);
m_mainLblInit = _addLabel(theme, "MAIN/MESSAGE", theme.lblFont, L"", 40, 40, 560, 140, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_mainBtnFavoritesOn = _addPicButton(theme, "MAIN/FAVORITES_ON", texFavOn, texFavOnS, 300, 400, 56, 56);
m_mainBtnFavoritesOff = _addPicButton(theme, "MAIN/FAVORITES_OFF", texFavOff, texFavOffS, 300, 400, 56, 56);
m_mainLblLetter = _addLabel(theme, "MAIN/LETTER", theme.titleFont, L"", 540, 40, 80, 80, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, emptyTex);
m_mainLblNotice = _addLabel(theme, "MAIN/NOTICE", theme.titleFont, L"", 340, 40, 280, 80, theme.titleFontColor, FTGX_JUSTIFY_RIGHT | FTGX_ALIGN_MIDDLE, emptyTex);
m_mainLblCurMusic = _addLabel(theme, "MAIN/MUSIC", theme.btnFont, L"", 0, 20, 640, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_mainBtnInfo = _addPicButton("MAIN/INFO_BTN", texInfo, texInfoS, 20, 400, 48, 48);
m_mainBtnConfig = _addPicButton("MAIN/CONFIG_BTN", texConfig, texConfigS, 70, 400, 48, 48);
m_mainBtnQuit = _addPicButton("MAIN/QUIT_BTN", texQuit, texQuitS, 570, 400, 48, 48);
m_mainBtnChannel = _addPicButton("MAIN/CHANNEL_BTN", texChannel, texChannels, 520, 400, 48, 48);
m_mainBtnHomebrew = _addPicButton("MAIN/HOMEBREW_BTN", texHomebrew, texHomebrews, 520, 400, 48, 48);
m_mainBtnUsb = _addPicButton("MAIN/USB_BTN", texUsb, texUsbs, 520, 400, 48, 48);
m_mainBtnDML = _addPicButton("MAIN/DML_BTN", texDML, texDMLs, 520, 400, 48, 48);
m_mainBtnEmu = _addPicButton("MAIN/EMU_BTN", texEmu, texEmus, 520, 400, 48, 48);
m_mainBtnDVD = _addPicButton("MAIN/DVD_BTN", texDVD, texDVDs, 470, 400, 48, 48);
m_mainBtnNext = _addPicButton("MAIN/NEXT_BTN", texNext, texNextS, 540, 146, 80, 80);
m_mainBtnPrev = _addPicButton("MAIN/PREV_BTN", texPrev, texPrevS, 20, 146, 80, 80);
m_mainBtnInit = _addButton("MAIN/BIG_SETTINGS_BTN", theme.titleFont, L"", 72, 180, 496, 56, theme.titleFontColor);
m_mainBtnInit2 = _addButton("MAIN/BIG_SETTINGS_BTN2", theme.titleFont, L"", 72, 290, 496, 56, theme.titleFontColor);
m_mainLblInit = _addLabel("MAIN/MESSAGE", theme.lblFont, L"", 40, 40, 560, 140, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_mainBtnFavoritesOn = _addPicButton("MAIN/FAVORITES_ON", texFavOn, texFavOnS, 300, 400, 56, 56);
m_mainBtnFavoritesOff = _addPicButton("MAIN/FAVORITES_OFF", texFavOff, texFavOffS, 300, 400, 56, 56);
m_mainLblLetter = _addLabel("MAIN/LETTER", theme.titleFont, L"", 540, 40, 80, 80, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, emptyTex);
m_mainLblNotice = _addLabel("MAIN/NOTICE", theme.titleFont, L"", 340, 40, 280, 80, theme.titleFontColor, FTGX_JUSTIFY_RIGHT | FTGX_ALIGN_MIDDLE, emptyTex);
m_mainLblCurMusic = _addLabel("MAIN/MUSIC", theme.btnFont, L"", 0, 20, 640, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
#ifdef SHOWMEM
m_mem2FreeSize = _addLabel(theme, "MEM2", theme.titleFont, L"", 40, 300, 480, 80, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, emptyTex);
m_mem2FreeSize = _addLabel("MEM2", theme.titleFont, L"", 40, 300, 480, 80, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, emptyTex);
#endif
//
m_mainPrevZone.x = m_theme.getInt("MAIN/ZONES", "prev_x", -32);

View File

@ -842,32 +842,32 @@ int CMenu::_NandDumper(void *obj)
return 0;
}
void CMenu::_initNandEmuMenu(CMenu::SThemeData &theme)
void CMenu::_initNandEmuMenu()
{
_addUserLabels(theme, m_nandemuLblUser, ARRAY_SIZE(m_nandemuLblUser), "NANDEMU");
m_nandemuBg = _texture(theme.texSet, "NANDEMU/BG", "texture", theme.bg);
m_nandemuLblTitle = _addTitle(theme, "NANDEMU/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_nandfileLblMessage = _addLabel(theme, "NANDEMU/FMESSAGE", theme.lblFont, L"", 40, 230, 560, 100, theme.lblFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_TOP);
m_nandemuLblMessage = _addLabel(theme, "NANDEMU/MESSAGE", theme.lblFont, L"", 40, 350, 560, 100, theme.lblFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_TOP);
m_nandfileLblDialog = _addLabel(theme, "NANDEMU/FDIALOG", theme.lblFont, L"", 40, 60, 560, 200, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_nandfinLblDialog = _addLabel(theme, "NANDEMU/FINDIALOG", theme.lblFont, L"", 40, 120, 560, 200, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_nandemuLblDialog = _addLabel(theme, "NANDEMU/DIALOG", theme.lblFont, L"", 40, 180, 560, 200, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_nandfilePBar = _addProgressBar(theme, "NANDEMU/FILEPROGRESS_BAR", 40, 200, 560, 20);
m_nandemuPBar = _addProgressBar(theme, "NANDEMU/PROGRESS_BAR", 40, 320, 560, 20);
m_nandemuLblEmulation = _addLabel(theme, "NANDEMU/EMU_SAVE", theme.lblFont, L"", 40, 130, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_nandemuLblEmulationVal = _addLabel(theme, "NANDEMU/EMU_SAVE_BTN_GLOBAL", theme.btnFont, L"", 400, 130, 144, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_nandemuBtnEmulationM = _addPicButton(theme, "NANDEMU/EMU_SAVE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 344, 130, 56, 56);
m_nandemuBtnEmulationP = _addPicButton(theme, "NANDEMU/EMU_SAVE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 130, 56, 56);
m_nandemuLblSaveDump = _addLabel(theme, "NANDEMU/SAVE_DUMP", theme.lblFont, L"", 40, 190, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_nandemuBtnAll = _addButton(theme, "NANDEMU/ALL_BTN", theme.btnFont, L"", 350, 190, 250, 56, theme.btnFontColor);
m_nandemuBtnMissing = _addButton(theme, "NANDEMU/MISSING_BTN", theme.btnFont, L"", 350, 250, 250, 56, theme.btnFontColor);
m_nandemuLblNandDump = _addLabel(theme, "NANDEMU/NAND_DUMP", theme.lblFont, L"", 40, 310, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_nandemuBtnNandDump = _addButton(theme, "NANDEMU/NAND_DUMP_BTN", theme.btnFont, L"", 350, 310, 250, 56, theme.btnFontColor);
m_nandemuBtnBack = _addButton(theme, "NANDEMU/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
m_nandemuBtnExtract = _addButton(theme, "NANDEMU/EXTRACT", theme.titleFont, L"", 72, 180, 496, 56, theme.titleFontColor);
m_nandemuBtnDisable = _addButton(theme, "NANDEMU/DISABLE", theme.titleFont, L"", 72, 270, 496, 56, theme.titleFontColor);
m_nandemuBtnPartition = _addButton(theme, "NANDEMU/PARTITION", theme.titleFont, L"", 72, 360, 496, 56, theme.titleFontColor);
m_nandemuLblInit = _addLabel(theme, "NANDEMU/INIT", theme.lblFont, L"", 40, 40, 560, 140, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
_addUserLabels(m_nandemuLblUser, ARRAY_SIZE(m_nandemuLblUser), "NANDEMU");
m_nandemuBg = _texture("NANDEMU/BG", "texture", theme.bg, false);
m_nandemuLblTitle = _addTitle("NANDEMU/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_nandfileLblMessage = _addLabel("NANDEMU/FMESSAGE", theme.lblFont, L"", 40, 230, 560, 100, theme.lblFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_TOP);
m_nandemuLblMessage = _addLabel("NANDEMU/MESSAGE", theme.lblFont, L"", 40, 350, 560, 100, theme.lblFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_TOP);
m_nandfileLblDialog = _addLabel("NANDEMU/FDIALOG", theme.lblFont, L"", 40, 60, 560, 200, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_nandfinLblDialog = _addLabel("NANDEMU/FINDIALOG", theme.lblFont, L"", 40, 120, 560, 200, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_nandemuLblDialog = _addLabel("NANDEMU/DIALOG", theme.lblFont, L"", 40, 180, 560, 200, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_nandfilePBar = _addProgressBar("NANDEMU/FILEPROGRESS_BAR", 40, 200, 560, 20);
m_nandemuPBar = _addProgressBar("NANDEMU/PROGRESS_BAR", 40, 320, 560, 20);
m_nandemuLblEmulation = _addLabel("NANDEMU/EMU_SAVE", theme.lblFont, L"", 40, 130, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_nandemuLblEmulationVal = _addLabel("NANDEMU/EMU_SAVE_BTN_GLOBAL", theme.btnFont, L"", 400, 130, 144, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_nandemuBtnEmulationM = _addPicButton("NANDEMU/EMU_SAVE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 344, 130, 56, 56);
m_nandemuBtnEmulationP = _addPicButton("NANDEMU/EMU_SAVE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 130, 56, 56);
m_nandemuLblSaveDump = _addLabel("NANDEMU/SAVE_DUMP", theme.lblFont, L"", 40, 190, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_nandemuBtnAll = _addButton("NANDEMU/ALL_BTN", theme.btnFont, L"", 350, 190, 250, 56, theme.btnFontColor);
m_nandemuBtnMissing = _addButton("NANDEMU/MISSING_BTN", theme.btnFont, L"", 350, 250, 250, 56, theme.btnFontColor);
m_nandemuLblNandDump = _addLabel("NANDEMU/NAND_DUMP", theme.lblFont, L"", 40, 310, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_nandemuBtnNandDump = _addButton("NANDEMU/NAND_DUMP_BTN", theme.btnFont, L"", 350, 310, 250, 56, theme.btnFontColor);
m_nandemuBtnBack = _addButton("NANDEMU/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
m_nandemuBtnExtract = _addButton("NANDEMU/EXTRACT", theme.titleFont, L"", 72, 180, 496, 56, theme.titleFontColor);
m_nandemuBtnDisable = _addButton("NANDEMU/DISABLE", theme.titleFont, L"", 72, 270, 496, 56, theme.titleFontColor);
m_nandemuBtnPartition = _addButton("NANDEMU/PARTITION", theme.titleFont, L"", 72, 360, 496, 56, theme.titleFontColor);
m_nandemuLblInit = _addLabel("NANDEMU/INIT", theme.lblFont, L"", 40, 40, 560, 140, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
_setHideAnim(m_nandemuLblTitle, "NANDEMU/TITLE", 0, -100, 0.f, 0.f);
_setHideAnim(m_nandfileLblMessage, "NANDEMU/FMESSAGE", 0, 0, -2.f, 0.f);

View File

@ -168,27 +168,27 @@ void CMenu::_PluginSettings()
_hidePluginSettings();
}
void CMenu::_initPluginSettingsMenu(CMenu::SThemeData &theme)
void CMenu::_initPluginSettingsMenu()
{
_addUserLabels(theme, m_pluginLblUser, ARRAY_SIZE(m_pluginLblUser), "PLUGIN");
m_pluginBg = _texture(theme.texSet, "PLUGIN/BG", "texture", theme.bg);
m_pluginLblTitle = _addTitle(theme, "PLUGIN/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_pluginBtnBack = _addButton(theme, "PLUGIN/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
m_pluginLblPage = _addLabel(theme, "PLUGIN/PAGE_BTN", theme.btnFont, L"", 256, 400, 100, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_pluginBtnPageM = _addPicButton(theme, "PLUGIN/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 200, 400, 56, 56);
m_pluginBtnPageP = _addPicButton(theme, "PLUGIN/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 356, 400, 56, 56);
m_pluginBtnCat[0] = _addPicButton(theme, "PLUGIN/PLUGIN_0_BTN", theme.checkboxoff, theme.checkboxoffs, 30, 390, 44, 48);
m_pluginBtnCats[0] = _addPicButton(theme, "PLUGIN/PLUGIN_0_BTNS", theme.checkboxon, theme.checkboxons, 30, 390, 44, 48);
m_pluginLblCat[0] = _addLabel(theme, "PLUGIN/PLUGIN_0", theme.lblFont, L"", 85, 390, 100, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
_addUserLabels(m_pluginLblUser, ARRAY_SIZE(m_pluginLblUser), "PLUGIN");
m_pluginBg = _texture("PLUGIN/BG", "texture", theme.bg, false);
m_pluginLblTitle = _addTitle("PLUGIN/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_pluginBtnBack = _addButton("PLUGIN/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
m_pluginLblPage = _addLabel("PLUGIN/PAGE_BTN", theme.btnFont, L"", 256, 400, 100, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_pluginBtnPageM = _addPicButton("PLUGIN/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 200, 400, 56, 56);
m_pluginBtnPageP = _addPicButton("PLUGIN/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 356, 400, 56, 56);
m_pluginBtnCat[0] = _addPicButton("PLUGIN/PLUGIN_0_BTN", theme.checkboxoff, theme.checkboxoffs, 30, 390, 44, 48);
m_pluginBtnCats[0] = _addPicButton("PLUGIN/PLUGIN_0_BTNS", theme.checkboxon, theme.checkboxons, 30, 390, 44, 48);
m_pluginLblCat[0] = _addLabel("PLUGIN/PLUGIN_0", theme.lblFont, L"", 85, 390, 100, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
for(int i = 1; i < 6; ++i)
{ // Page 1
m_pluginBtnCat[i] = _addPicButton(theme, fmt("PLUGIN/PLUGIN_%i_BTN", i), theme.checkboxoff, theme.checkboxoffs, 30, (42+i*58), 44, 48);
m_pluginBtnCats[i] = _addPicButton(theme, fmt("PLUGIN/PLUGIN_%i_BTNS", i), theme.checkboxon, theme.checkboxons, 30, (42+i*58), 44, 48);
m_pluginLblCat[i] = _addLabel(theme, fmt("PLUGIN/PLUGIN_%i", i), theme.lblFont, L"", 85, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_pluginBtnCat[i] = _addPicButton(fmt("PLUGIN/PLUGIN_%i_BTN", i), theme.checkboxoff, theme.checkboxoffs, 30, (42+i*58), 44, 48);
m_pluginBtnCats[i] = _addPicButton(fmt("PLUGIN/PLUGIN_%i_BTNS", i), theme.checkboxon, theme.checkboxons, 30, (42+i*58), 44, 48);
m_pluginLblCat[i] = _addLabel(fmt("PLUGIN/PLUGIN_%i", i), theme.lblFont, L"", 85, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
// right half
m_pluginBtnCat[i+5] = _addPicButton(theme, fmt("PLUGIN/PLUGIN_%i_BTN", i+5), theme.checkboxoff, theme.checkboxoffs, 325, (42+i*58), 44, 48);
m_pluginBtnCats[i+5] = _addPicButton(theme, fmt("PLUGIN/PLUGIN_%i_BTNS", i+5), theme.checkboxon, theme.checkboxons, 325, (42+i*58), 44, 48);
m_pluginLblCat[i+5] = _addLabel(theme, fmt("PLUGIN/PLUGIN_%i", i+5), theme.txtFont, L"", 380, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_pluginBtnCat[i+5] = _addPicButton(fmt("PLUGIN/PLUGIN_%i_BTN", i+5), theme.checkboxoff, theme.checkboxoffs, 325, (42+i*58), 44, 48);
m_pluginBtnCats[i+5] = _addPicButton(fmt("PLUGIN/PLUGIN_%i_BTNS", i+5), theme.checkboxon, theme.checkboxons, 325, (42+i*58), 44, 48);
m_pluginLblCat[i+5] = _addLabel(fmt("PLUGIN/PLUGIN_%i", i+5), theme.txtFont, L"", 380, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
}
_setHideAnim(m_pluginLblTitle, "PLUGIN/TITLE", 0, 0, -2.f, 0.f);
_setHideAnim(m_pluginLblPage, "PLUGIN/PAGE_BTN", 0, 0, 1.f, -1.f);

View File

@ -380,7 +380,7 @@ bool CMenu::_Source()
return back;
}
void CMenu::_initSourceMenu(CMenu::SThemeData &theme)
void CMenu::_initSourceMenu()
{
STexture texDML;
STexture texDMLs;
@ -404,19 +404,19 @@ void CMenu::_initSourceMenu(CMenu::SThemeData &theme)
texHomebrew.fromPNG(btnhomebrew_png);
texHomebrews.fromPNG(btnhomebrews_png);
m_sourceBtnChannel = _addPicButton(theme, "SOURCE/CHANNEL_BTN", texChannel, texChannels, 265, 260, 48, 48);
m_sourceBtnHomebrew = _addPicButton(theme, "SOURCE/HOMEBREW_BTN", texHomebrew, texHomebrews, 325, 260, 48, 48);
m_sourceBtnUsb = _addPicButton(theme, "SOURCE/USB_BTN", texUsb, texUsbs, 235, 200, 48, 48);
m_sourceBtnDML = _addPicButton(theme, "SOURCE/DML_BTN", texDML, texDMLs, 295, 200, 48, 48);
m_sourceBtnEmu = _addPicButton(theme, "SOURCE/EMU_BTN", texEmu, texEmus, 355, 200, 48, 48);
m_sourceBtnChannel = _addPicButton("SOURCE/CHANNEL_BTN", texChannel, texChannels, 265, 260, 48, 48);
m_sourceBtnHomebrew = _addPicButton("SOURCE/HOMEBREW_BTN", texHomebrew, texHomebrews, 325, 260, 48, 48);
m_sourceBtnUsb = _addPicButton("SOURCE/USB_BTN", texUsb, texUsbs, 235, 200, 48, 48);
m_sourceBtnDML = _addPicButton("SOURCE/DML_BTN", texDML, texDMLs, 295, 200, 48, 48);
m_sourceBtnEmu = _addPicButton("SOURCE/EMU_BTN", texEmu, texEmus, 355, 200, 48, 48);
_addUserLabels(theme, m_sourceLblUser, ARRAY_SIZE(m_sourceLblUser), "SOURCE");
m_sourceBg = _texture(theme.texSet, "SOURCE/BG", "texture", theme.bg);
m_sourceLblTitle = _addTitle(theme, "SOURCE/TITLE", theme.titleFont, L"", 20, 20, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_sourceLblNotice = _addLabel(theme, "SOURCE/NOTICE", theme.btnFont, L"", 20, 400, 600, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_TOP);
m_sourceLblPage = _addLabel(theme, "SOURCE/PAGE_BTN", theme.btnFont, L"", 62, 400, 98, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_sourceBtnPageM = _addPicButton(theme, "SOURCE/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 10, 400, 52, 56);
m_sourceBtnPageP = _addPicButton(theme, "SOURCE/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 160, 400, 52, 56);
_addUserLabels(m_sourceLblUser, ARRAY_SIZE(m_sourceLblUser), "SOURCE");
m_sourceBg = _texture("SOURCE/BG", "texture", theme.bg, false);
m_sourceLblTitle = _addTitle("SOURCE/TITLE", theme.titleFont, L"", 20, 20, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_sourceLblNotice = _addLabel("SOURCE/NOTICE", theme.btnFont, L"", 20, 400, 600, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_TOP);
m_sourceLblPage = _addLabel("SOURCE/PAGE_BTN", theme.btnFont, L"", 62, 400, 98, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_sourceBtnPageM = _addPicButton("SOURCE/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 10, 400, 52, 56);
m_sourceBtnPageP = _addPicButton("SOURCE/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 160, 400, 52, 56);
m_sourceDir = m_cfg.getString("GENERAL", "dir_Source", sfmt("%s/source_menu", m_dataDir.c_str()));
@ -451,7 +451,7 @@ void CMenu::_initSourceMenu(CMenu::SThemeData &theme)
row = i / 4;
col = i - (row * 4);
m_sourceBtnSource[i] = _addPicButton(theme, fmt("SOURCE/SOURCE_BTN_%i", i), texConsoleImg, texConsoleImgs, (30 + 150 * col), (90 + 100 * row), 120, 90);
m_sourceBtnSource[i] = _addPicButton(fmt("SOURCE/SOURCE_BTN_%i", i), texConsoleImg, texConsoleImgs, (30 + 150 * col), (90 + 100 * row), 120, 90);
}
_setHideAnim(m_sourceBtnChannel, "SOURCE/CHANNEL_BTN", 0, 40, 0.f, 0.f);
_setHideAnim(m_sourceBtnHomebrew, "SOURCE/HOMEBREW_BTN", 0, 40, 0.f, 0.f);

View File

@ -241,22 +241,22 @@ void CMenu::_showSystem(void)
_textSystem();
}
void CMenu::_initSystemMenu(CMenu::SThemeData &theme)
void CMenu::_initSystemMenu()
{
STexture emptyTex;
_addUserLabels(theme, m_systemLblUser, ARRAY_SIZE(m_systemLblUser), "SYSTEM");
m_systemBg = _texture(theme.texSet, "SYSTEM/BG", "texture", theme.bg);
m_systemLblTitle = _addTitle(theme, "SYSTEM/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_systemLblVersionTxt = _addLabel(theme, "SYSTEM/VERSION_TXT", theme.lblFont, L"", 40, 90, 220, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_systemLblVersion = _addLabel(theme, "SYSTEM/VERSION", theme.lblFont, L"", 260, 90, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_systemBtnDownload = _addButton(theme, "SYSTEM/DOWNLOAD_BTN", theme.btnFont, L"", 20, 410, 200, 56, theme.btnFontColor);
m_systemBtnBack = _addButton(theme, "SYSTEM/BACK_BTN", theme.btnFont, L"", 420, 410, 200, 56, theme.btnFontColor);
_addUserLabels(m_systemLblUser, ARRAY_SIZE(m_systemLblUser), "SYSTEM");
m_systemBg = _texture("SYSTEM/BG", "texture", theme.bg, false);
m_systemLblTitle = _addTitle("SYSTEM/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_systemLblVersionTxt = _addLabel("SYSTEM/VERSION_TXT", theme.lblFont, L"", 40, 90, 220, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_systemLblVersion = _addLabel("SYSTEM/VERSION", theme.lblFont, L"", 260, 90, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_systemBtnDownload = _addButton("SYSTEM/DOWNLOAD_BTN", theme.btnFont, L"", 20, 410, 200, 56, theme.btnFontColor);
m_systemBtnBack = _addButton("SYSTEM/BACK_BTN", theme.btnFont, L"", 420, 410, 200, 56, theme.btnFontColor);
m_systemLblInfo = _addText(theme, "SYSTEM/INFO", theme.txtFont, L"", 20, 300, 600, 280, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
m_systemLblVerSelectVal = _addLabel(theme, "SYSTEM/VER_SELECT_BTN", theme.btnFont, L"", 296, 150, 50, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_systemBtnVerSelectM = _addPicButton(theme, "SYSTEM/VER_SELECT_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 240, 150, 56, 56);
m_systemBtnVerSelectP = _addPicButton(theme, "SYSTEM/VER_SELECT_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 346, 150, 56, 56);
m_systemLblInfo = _addText("SYSTEM/INFO", theme.txtFont, L"", 20, 300, 600, 280, theme.txtFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
m_systemLblVerSelectVal = _addLabel("SYSTEM/VER_SELECT_BTN", theme.btnFont, L"", 296, 150, 50, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_systemBtnVerSelectM = _addPicButton("SYSTEM/VER_SELECT_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 240, 150, 56, 56);
m_systemBtnVerSelectP = _addPicButton("SYSTEM/VER_SELECT_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 346, 150, 56, 56);
//
_setHideAnim(m_systemLblTitle, "SYSTEM/TITLE", 0, 0, -2.f, 0.f);
_setHideAnim(m_systemBtnDownload, "SYSTEM/DOWNLOAD_BTN", 0, 0, -2.f, 0.f);

View File

@ -496,16 +496,16 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
return done;
}
void CMenu::_initWBFSMenu(CMenu::SThemeData &theme)
void CMenu::_initWBFSMenu()
{
_addUserLabels(theme, m_wbfsLblUser, ARRAY_SIZE(m_wbfsLblUser), "WBFS");
m_wbfsBg = _texture(theme.texSet, "WBFS/BG", "texture", theme.bg);
m_wbfsLblTitle = _addTitle(theme, "WBFS/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_wbfsLblDialog = _addLabel(theme, "WBFS/DIALOG", theme.lblFont, L"", 40, 90, 560, 200, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_wbfsLblMessage = _addLabel(theme, "WBFS/MESSAGE", theme.lblFont, L"", 40, 300, 560, 100, theme.lblFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_TOP);
m_wbfsPBar = _addProgressBar(theme, "WBFS/PROGRESS_BAR", 40, 270, 560, 20);
m_wbfsBtnBack = _addButton(theme, "WBFS/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
m_wbfsBtnGo = _addButton(theme, "WBFS/GO_BTN", theme.btnFont, L"", 245, 260, 150, 56, theme.btnFontColor);
_addUserLabels(m_wbfsLblUser, ARRAY_SIZE(m_wbfsLblUser), "WBFS");
m_wbfsBg = _texture("WBFS/BG", "texture", theme.bg, false);
m_wbfsLblTitle = _addTitle("WBFS/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_wbfsLblDialog = _addLabel("WBFS/DIALOG", theme.lblFont, L"", 40, 90, 560, 200, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_wbfsLblMessage = _addLabel("WBFS/MESSAGE", theme.lblFont, L"", 40, 300, 560, 100, theme.lblFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_TOP);
m_wbfsPBar = _addProgressBar("WBFS/PROGRESS_BAR", 40, 270, 560, 20);
m_wbfsBtnBack = _addButton("WBFS/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
m_wbfsBtnGo = _addButton("WBFS/GO_BTN", theme.btnFont, L"", 245, 260, 150, 56, theme.btnFontColor);
_setHideAnim(m_wbfsLblTitle, "WBFS/TITLE", 0, 0, -2.f, 0.f);
_setHideAnim(m_wbfsLblDialog, "WBFS/DIALOG", 0, 0, -2.f, 0.f);

View File

@ -15,6 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <cstdio>
#include <algorithm>
#include "MusicPlayer.hpp"
#include "SoundHandler.hpp"
#include "list/ListGenerator.hpp"

View File

@ -25,7 +25,7 @@
***************************************************************************/
#include <unistd.h>
#include <string.h>
#include <malloc.h>
#include "gui_sound.h"
#include "SoundHandler.hpp"
#include "MusicPlayer.hpp"
@ -169,10 +169,6 @@ bool GuiSound::Load(const char * filepath)
return false;
}
u32 magic;
fread(&magic, 1, 4, f);
fclose(f);
SoundHandle.AddDecoder(this->voice, filepath);
//gprintf("gui_sound.cpp: Loading %s using voice %d\n", filepath, this->voice);
SoundDecoder *decoder = SoundHandle.Decoder(this->voice);
@ -199,7 +195,7 @@ bool GuiSound::Load(const u8 * snd, u32 len, bool isallocated)
{
FreeMemory();
if(!snd)
if(snd == NULL || len == 0)
return false;
if(!isallocated && memcmp(snd, "RIFF", 4) == 0)