-some more cleanup and hopefully fix of that strange codedump in

plugin coverflow
This commit is contained in:
fix94.1 2012-12-28 14:19:40 +00:00
parent c05d9e4fd1
commit 1a2f1aa028
29 changed files with 924 additions and 930 deletions

View File

@ -31,40 +31,39 @@
#include "WiiMovie.hpp"
#include "gecko/gecko.hpp"
#define SND_BUFFERS 8
#define SND_BUFFERS 8
#define FRAME_BUFFERS 8
static BufferCircle * soundBuffer = NULL;
WiiMovie::WiiMovie(const char * filepath)
{
VideoFrameCount = 0;
VideoFrameCount = 0;
fps = 0.0f;
ExitRequested = false;
ExitRequested = false;
fullScreen = false;
Playing = false;
volume = 128;
Playing = false;
volume = 128;
ThreadStack = NULL;
PlayThread = LWP_THREAD_NULL;
gprintf("Opening video '%s'\n", filepath);
string file(filepath);
Video = openVideo(file);
if(!Video)
{
string file(filepath);
Video = openVideo(file);
if(!Video)
{
gprintf("Open video failed\n");
ExitRequested = true;
ExitRequested = true;
return;
}
SndChannels = (Video->getNumChannels() > 1) ? VOICE_STEREO_16BIT : VOICE_MONO_16BIT;
SndFrequence = Video->getFrequency();
}
SndChannels = (Video->getNumChannels() > 1) ? VOICE_STEREO_16BIT : VOICE_MONO_16BIT;
SndFrequence = Video->getFrequency();
fps = Video->getFps();
maxSoundSize = Video->getMaxAudioSamples()*Video->getNumChannels()*2;
maxSoundSize = Video->getMaxAudioSamples()*Video->getNumChannels()*2;
gprintf("Open video succeeded: sound channels: %d, Frequency: %d, FPS: %4.3f\n", SndChannels, SndFrequence, fps);
if (Video->hasSound())
if(Video->hasSound())
{
gprintf("Video has sound\n");
soundBuffer = &SoundBuffer;
@ -74,10 +73,10 @@ WiiMovie::WiiMovie(const char * filepath)
PlayThreadStack = NULL;
ThreadStack = (u8 *)malloc(32768);
if (!ThreadStack)
if(!ThreadStack)
return;
LWP_MutexInit(&mutex, true);
LWP_MutexInit(&mutex, true);
LWP_CreateThread (&ReadThread, UpdateThread, this, ThreadStack, 32768, LWP_PRIO_HIGHEST);
gprintf("Reading frames thread started\n");
}
@ -85,27 +84,27 @@ WiiMovie::WiiMovie(const char * filepath)
WiiMovie::~WiiMovie()
{
gprintf("Destructing WiiMovie object\n");
Playing = false;
ExitRequested = true;
Playing = false;
ExitRequested = true;
Stop();
LWP_ResumeThread(ReadThread);
LWP_JoinThread(ReadThread, NULL);
LWP_MutexDestroy(mutex);
LWP_ResumeThread(ReadThread);
LWP_JoinThread(ReadThread, NULL);
LWP_MutexDestroy(mutex);
ASND_StopVoice(10);
if (ReadThread != LWP_THREAD_NULL)
ASND_StopVoice(10);
if(ReadThread != LWP_THREAD_NULL)
{
LWP_ResumeThread(ReadThread);
LWP_JoinThread(ReadThread, NULL);
}
if (mutex != LWP_MUTEX_NULL)
if(mutex != LWP_MUTEX_NULL)
{
LWP_MutexUnlock(mutex);
LWP_MutexDestroy(mutex);
}
if (ThreadStack != NULL)
if(ThreadStack != NULL)
{
free(ThreadStack);
ThreadStack = NULL;
@ -113,40 +112,39 @@ WiiMovie::~WiiMovie()
soundBuffer = NULL;
Frames.clear();
Frames.clear();
if(Video)
closeVideo(Video);
if(Video)
closeVideo(Video);
}
bool WiiMovie::Play(bool loop)
{
if(!Video) return false;
if(!Video)
return false;
gprintf("Start playing video\n");
PlayThreadStack = (u8 *)malloc(32768);
if (PlayThreadStack == NULL)
if(PlayThreadStack == NULL)
return false;
Playing = true;
PlayTime.reset();
Playing = true;
PlayTime.reset();
Video->loop = loop;
gprintf("Start playing thread\n");
LWP_ResumeThread(ReadThread);
LWP_ResumeThread(ReadThread);
LWP_CreateThread(&PlayThread, PlayingThread, this, PlayThreadStack, 32768, 70);
return true;
}
void WiiMovie::Stop()
{
gprintf("Stopping WiiMovie video\n");
ExitRequested = true;
if (PlayThread != LWP_THREAD_NULL)
ExitRequested = true;
if(PlayThread != LWP_THREAD_NULL)
LWP_JoinThread(PlayThread, NULL);
PlayThread = LWP_THREAD_NULL;
@ -158,8 +156,8 @@ void WiiMovie::Stop()
void WiiMovie::SetVolume(int vol)
{
volume = 255 * vol/100;
ASND_ChangeVolumeVoice(10, volume, volume);
volume = 255 * vol/100;
ASND_ChangeVolumeVoice(10, volume, volume);
}
void WiiMovie::SetScreenSize(int width, int height, int top, int left)
@ -172,67 +170,65 @@ void WiiMovie::SetScreenSize(int width, int height, int top, int left)
void WiiMovie::SetFullscreen()
{
if(!Video) return;
if(!Video)
return;
float newscale = 1000.0f;
float newscale = 1000.0f;
float vidwidth = (float) width * 1.0f;
float vidheight = (float) height * 1.0f;
int retries = 100;
float vidwidth = (float) width * 1.0f;
float vidheight = (float) height * 1.0f;
int retries = 100;
fullScreen = true;
while(vidheight * newscale > screenheight || vidwidth * newscale > screenwidth)
{
if(vidheight * newscale > screenheight)
newscale = screenheight/vidheight;
if(vidwidth * newscale > screenwidth)
newscale = screenwidth/vidwidth;
retries--;
if(retries == 0)
{
newscale = 1.0f;
break;
}
}
scaleX = scaleY = newscale;
while(vidheight * newscale > screenheight || vidwidth * newscale > screenwidth)
{
if(vidheight * newscale > screenheight)
newscale = screenheight/vidheight;
if(vidwidth * newscale > screenwidth)
newscale = screenwidth/vidwidth;
retries--;
if(retries == 0)
{
newscale = 1.0f;
break;
}
}
scaleX = scaleY = newscale;
}
void WiiMovie::SetFrameSize(int w, int h)
{
if(!Video) return;
scaleX = (float) w /(float) width;
scaleY = (float) h /(float) height;
if(!Video)
return;
scaleX = (float) w /(float) width;
scaleY = (float) h /(float) height;
}
void WiiMovie::SetAspectRatio(float Aspect)
{
if(!Video) return;
float vidwidth = (float) height*scaleY*Aspect;
scaleX = (float) width/vidwidth;
if(!Video)
return;
float vidwidth = (float) height*scaleY*Aspect;
scaleX = (float) width/vidwidth;
}
extern "C" void THPSoundCallback(int voice)
{
if (!soundBuffer || !soundBuffer->IsBufferReady()) return;
if(ASND_AddVoice(voice, soundBuffer->GetBuffer(), soundBuffer->GetBufferSize()) != SND_OK)
return;
if(!soundBuffer || !soundBuffer->IsBufferReady())
return;
if(ASND_AddVoice(voice, soundBuffer->GetBuffer(), soundBuffer->GetBufferSize()) != SND_OK)
return;
soundBuffer->LoadNext();
}
void WiiMovie::FrameLoadLoop()
{
while (!ExitRequested)
while(!ExitRequested)
{
LoadNextFrame();
while (Frames.size() > FRAME_BUFFERS && !ExitRequested)
while(Frames.size() > FRAME_BUFFERS && !ExitRequested)
usleep(100);
}
}
@ -240,7 +236,7 @@ void WiiMovie::FrameLoadLoop()
void * WiiMovie::UpdateThread(void *arg)
{
WiiMovie *movie = static_cast<WiiMovie *>(arg);
while (!movie->ExitRequested)
while(!movie->ExitRequested)
{
movie->ReadNextFrame();
usleep(100);
@ -252,77 +248,76 @@ void * WiiMovie::PlayingThread(void *arg)
{
WiiMovie *movie = static_cast<WiiMovie *>(arg);
movie->FrameLoadLoop();
return NULL;
}
void WiiMovie::ReadNextFrame()
{
if(!Playing) LWP_SuspendThread(ReadThread);
if(!Playing)
LWP_SuspendThread(ReadThread);
u32 FramesNeeded = (u32) (PlayTime.elapsed()*fps);
u32 FramesNeeded = (u32) (PlayTime.elapsed()*fps);
//gprintf("Reading needed frames: %d\n", FramesNeeded);
while(VideoFrameCount < FramesNeeded)
{
LWP_MutexLock(mutex);
Video->loadNextFrame();
LWP_MutexUnlock(mutex);
while(VideoFrameCount < FramesNeeded)
{
LWP_MutexLock(mutex);
Video->loadNextFrame();
LWP_MutexUnlock(mutex);
++VideoFrameCount;
++VideoFrameCount;
//gprintf("Loaded video frame: %d\n", VideoFrameCount);
if(Video->hasSound())
{
if(Video->hasSound())
{
u32 newWhich = SoundBuffer.Which();
int i = 0;
for (i = 0; i < SoundBuffer.Size()-2; ++i)
for(i = 0; i < SoundBuffer.Size()-2; ++i)
{
if (!SoundBuffer.IsBufferReady(newWhich)) break;
if(!SoundBuffer.IsBufferReady(newWhich))
break;
newWhich = (newWhich + 1) % SoundBuffer.Size();
}
if (i == SoundBuffer.Size() - 2) return;
if(i == SoundBuffer.Size() - 2)
return;
int currentSize = SoundBuffer.GetBufferSize(newWhich);
currentSize += Video->getCurrentBuffer((s16 *) (&SoundBuffer.GetBuffer(newWhich)[currentSize]))*SndChannels*2;
SoundBuffer.SetBufferSize(newWhich, currentSize);
if(currentSize >= (FRAME_BUFFERS-1)*maxSoundSize)
SoundBuffer.SetBufferReady(newWhich, true);
if(ASND_StatusVoice(10) == SND_UNUSED && SoundBuffer.IsBufferReady())
{
ASND_StopVoice(10);
ASND_SetVoice(10, SndChannels, SndFrequence, 0, SoundBuffer.GetBuffer(), SoundBuffer.GetBufferSize(), volume, volume, THPSoundCallback);
SoundBuffer.LoadNext();
}
}
}
// usleep(100);
if(ASND_StatusVoice(10) == SND_UNUSED && SoundBuffer.IsBufferReady())
{
ASND_StopVoice(10);
ASND_SetVoice(10, SndChannels, SndFrequence, 0, SoundBuffer.GetBuffer(), SoundBuffer.GetBufferSize(), volume, volume, THPSoundCallback);
SoundBuffer.LoadNext();
}
}
}
}
void WiiMovie::LoadNextFrame()
{
if(!Video || !Playing)
return;
if(!Video || !Playing)
return;
VideoFrame VideoF;
LWP_MutexLock(mutex);
Video->getCurrentFrame(VideoF);
LWP_MutexUnlock(mutex);
VideoFrame VideoF;
LWP_MutexLock(mutex);
Video->getCurrentFrame(VideoF);
LWP_MutexUnlock(mutex);
if(!VideoF.getData()) return;
if(!VideoF.getData())
return;
if(width != VideoF.getWidth())
{
width = VideoF.getWidth();
height = VideoF.getHeight();
if (fullScreen)
if(width != VideoF.getWidth())
{
width = VideoF.getWidth();
height = VideoF.getHeight();
if(fullScreen)
SetFullscreen();
else
{
@ -330,15 +325,15 @@ void WiiMovie::LoadNextFrame()
screenleft = (screenwidth - width) / 2;
screentop = (screenheight - height) / 2;
}
}
}
STexture frame;
if(frame.fromTHP(VideoF.getData(), VideoF.getWidth(), VideoF.getHeight()) == TE_OK)
TexData frame;
if(TexHandle.fromTHP(frame, VideoF.getData(), VideoF.getWidth(), VideoF.getHeight()) == TE_OK)
Frames.push_back(frame);
VideoF.dealloc();
}
bool WiiMovie::GetNextFrame(STexture *tex)
bool WiiMovie::GetNextFrame(TexData *tex)
{
if(!Video || !Playing || Frames.size() == 0)
return false;

View File

@ -10,52 +10,52 @@ using namespace std;
class WiiMovie
{
public:
WiiMovie(const char * filepath);
~WiiMovie();
bool Play(bool loop = false);
void Stop();
void SetVolume(int vol);
void SetScreenSize(int width, int height, int top, int left);
void SetFullscreen();
void SetFrameSize(int w, int h);
void SetAspectRatio(float Aspect);
bool GetNextFrame(STexture *tex);
protected:
static void * UpdateThread(void *arg);
static void * PlayingThread(void *arg);
void FrameLoadLoop();
void ReadNextFrame();
void LoadNextFrame();
public:
WiiMovie(const char * filepath);
~WiiMovie();
bool Play(bool loop = false);
void Stop();
void SetVolume(int vol);
void SetScreenSize(int width, int height, int top, int left);
void SetFullscreen();
void SetFrameSize(int w, int h);
void SetAspectRatio(float Aspect);
bool GetNextFrame(TexData *tex);
protected:
static void * UpdateThread(void *arg);
static void * PlayingThread(void *arg);
void FrameLoadLoop();
void ReadNextFrame();
void LoadNextFrame();
u8 * ThreadStack;
u8 * PlayThreadStack;
lwp_t ReadThread;
lwp_t PlayThread;
mutex_t mutex;
u8 * ThreadStack;
u8 * PlayThreadStack;
lwp_t ReadThread;
lwp_t PlayThread;
mutex_t mutex;
VideoFile * Video;
BufferCircle SoundBuffer;
float fps;
Timer PlayTime;
u32 VideoFrameCount;
vector<STexture> Frames;
bool Playing;
bool ExitRequested;
bool fullScreen;
int maxSoundSize;
int SndChannels;
int SndFrequence;
int volume;
int screentop;
int screenleft;
int screenwidth;
int screenheight;
float scaleX;
float scaleY;
int width;
int height;
VideoFile *Video;
BufferCircle SoundBuffer;
float fps;
Timer PlayTime;
u32 VideoFrameCount;
vector<TexData> Frames;
bool Playing;
bool ExitRequested;
bool fullScreen;
int maxSoundSize;
int SndChannels;
int SndFrequence;
int volume;
int screentop;
int screenleft;
int screenwidth;
int screenheight;
float scaleX;
float scaleY;
int width;
int height;
};
#endif

View File

@ -643,7 +643,7 @@ void CCoverFlow::stopCoverLoader(bool empty)
{
for(u32 i = 0; i < m_items.size(); ++i)
{
m_items[i].texture.Cleanup();
TexHandle.Cleanup(m_items[i].texture);
m_items[i].state = STATE_Loading;
}
}
@ -673,12 +673,12 @@ void CCoverFlow::clear(void)
void CCoverFlow::shutdown(void)
{
gprintf("Cleanup Coverflow\n");
m_dvdSkin.Cleanup();
m_dvdSkin_Red.Cleanup();
m_dvdSkin_Black.Cleanup();
m_dvdSkin_Yellow.Cleanup();
m_dvdSkin_GreenOne.Cleanup();
m_dvdSkin_GreenTwo.Cleanup();
TexHandle.Cleanup(m_dvdSkin);
TexHandle.Cleanup(m_dvdSkin_Red);
TexHandle.Cleanup(m_dvdSkin_Black);
TexHandle.Cleanup(m_dvdSkin_Yellow);
TexHandle.Cleanup(m_dvdSkin_GreenOne);
TexHandle.Cleanup(m_dvdSkin_GreenTwo);
clear();
if(m_flipSound != NULL)
@ -726,7 +726,7 @@ void CCoverFlow::_drawMirrorZ(void)
GX_SetColorUpdate(GX_TRUE);
}
void CCoverFlow::_effectBg(const STexture * &tex)
void CCoverFlow::_effectBg(const TexData * &tex)
{
Mtx modelViewMtx;
GXTexObj texObj;
@ -909,7 +909,7 @@ bool CCoverFlow::_effectVisible(void)
|| lo.shadowColorEnd.a > 0 || lo.shadowColorOff.a > 0;
}
void CCoverFlow::makeEffectTexture(const STexture * &bg)
void CCoverFlow::makeEffectTexture(const TexData * &bg)
{
if (!_effectVisible()) return;
int aa = 8;
@ -1294,7 +1294,7 @@ void CCoverFlow::_drawCover(int i, bool mirror, CCoverFlow::DrawMode dm)
_drawCoverFlat(i, mirror, dm);
}
STexture &CCoverFlow::_coverTexture(int i)
TexData &CCoverFlow::_coverTexture(int i)
{
if(m_items[i].texture.data == NULL)
return (m_items[i].state == STATE_Loading) ? m_loadingTexture : m_noCoverTexture;
@ -1304,7 +1304,7 @@ STexture &CCoverFlow::_coverTexture(int i)
void CCoverFlow::_drawCoverFlat(int i, bool mirror, CCoverFlow::DrawMode dm)
{
GXTexObj texObj;
STexture &tex = _coverTexture(m_covers[i].index);
TexData &tex = _coverTexture(m_covers[i].index);
bool boxTex = m_items[m_covers[i].index].boxTexture && !!m_items[m_covers[i].index].texture.data;
switch (dm)
@ -1366,7 +1366,7 @@ bool CCoverFlow::_checkCoverColor(char* gameID, const char* checkID[], int len)
void CCoverFlow::_drawCoverBox(int i, bool mirror, CCoverFlow::DrawMode dm)
{
GXTexObj texObj;
STexture &tex = _coverTexture(m_covers[i].index);
TexData &tex = _coverTexture(m_covers[i].index);
CColor color;
bool flatTex = !m_items[m_covers[i].index].boxTexture && !!m_items[m_covers[i].index].texture.data;
@ -1455,7 +1455,7 @@ void CCoverFlow::_drawCoverBox(int i, bool mirror, CCoverFlow::DrawMode dm)
GX_End();
if (dm == CCoverFlow::CFDR_NORMAL)
{
STexture *myTex = &tex;
TexData *myTex = &tex;
if (flatTex)
myTex = &m_noCoverTexture;
GX_InitTexObj(&texObj, myTex->data, myTex->width, myTex->height, myTex->format, GX_CLAMP, GX_CLAMP, GX_FALSE);
@ -1867,44 +1867,44 @@ bool CCoverFlow::start()
// Load resident textures
if(!m_dvdskin_loaded)
{
if(m_dvdSkin.fromJPG(dvdskin_jpg, dvdskin_jpg_size) != TE_OK)
if(TexHandle.fromJPG(m_dvdSkin, dvdskin_jpg, dvdskin_jpg_size) != TE_OK)
return false;
if(m_dvdSkin_Red.fromJPG(dvdskin_red_jpg, dvdskin_red_jpg_size) != TE_OK)
if(TexHandle.fromJPG(m_dvdSkin_Red, dvdskin_red_jpg, dvdskin_red_jpg_size) != TE_OK)
return false;
if(m_dvdSkin_Black.fromJPG(dvdskin_black_jpg, dvdskin_black_jpg_size) != TE_OK)
if(TexHandle.fromJPG(m_dvdSkin_Black, dvdskin_black_jpg, dvdskin_black_jpg_size) != TE_OK)
return false;
if(m_dvdSkin_Yellow.fromJPG(dvdskin_yellow_jpg, dvdskin_yellow_jpg_size) != TE_OK)
if(TexHandle.fromJPG(m_dvdSkin_Yellow, dvdskin_yellow_jpg, dvdskin_yellow_jpg_size) != TE_OK)
return false;
if(m_dvdSkin_GreenOne.fromJPG(dvdskin_greenone_jpg, dvdskin_greenone_jpg_size) != TE_OK)
if(TexHandle.fromJPG(m_dvdSkin_GreenOne, dvdskin_greenone_jpg, dvdskin_greenone_jpg_size) != TE_OK)
return false;
if(m_dvdSkin_GreenTwo.fromJPG(dvdskin_greentwo_jpg, dvdskin_greentwo_jpg_size) != TE_OK)
if(TexHandle.fromJPG(m_dvdSkin_GreenTwo, dvdskin_greentwo_jpg, dvdskin_greentwo_jpg_size) != TE_OK)
return false;
m_dvdskin_loaded = true;
}
if(m_box)
{
if(m_pngLoadCover.empty() || m_loadingTexture.fromImageFile(m_pngLoadCover.c_str(), GX_TF_CMPR, 32, 512) != TE_OK)
if(m_pngLoadCover.empty() || TexHandle.fromImageFile(m_loadingTexture, m_pngLoadCover.c_str(), GX_TF_CMPR, 32, 512) != TE_OK)
{
if(m_loadingTexture.fromJPG(loading_jpg, loading_jpg_size, GX_TF_CMPR, 32, 512) != TE_OK)
if(TexHandle.fromJPG(m_loadingTexture, loading_jpg, loading_jpg_size, GX_TF_CMPR, 32, 512) != TE_OK)
return false;
}
if(m_pngNoCover.empty() || m_noCoverTexture.fromImageFile(m_pngNoCover.c_str(), GX_TF_CMPR, 32, 512) != TE_OK)
if(m_pngNoCover.empty() || TexHandle.fromImageFile(m_noCoverTexture, m_pngNoCover.c_str(), GX_TF_CMPR, 32, 512) != TE_OK)
{
if(m_noCoverTexture.fromPNG(nopic_png, GX_TF_CMPR, 32, 512) != TE_OK)
if(TexHandle.fromPNG(m_noCoverTexture, nopic_png, GX_TF_CMPR, 32, 512) != TE_OK)
return false;
}
}
else
{
if(m_pngLoadCoverFlat.empty() || m_loadingTexture.fromImageFile(m_pngLoadCoverFlat.c_str(), GX_TF_CMPR, 32, 512) != TE_OK)
if(m_pngLoadCoverFlat.empty() || TexHandle.fromImageFile(m_loadingTexture, m_pngLoadCoverFlat.c_str(), GX_TF_CMPR, 32, 512) != TE_OK)
{
if(m_loadingTexture.fromJPG(flatloading_jpg, flatloading_jpg_size, GX_TF_CMPR, 32, 512) != TE_OK)
if(TexHandle.fromJPG(m_loadingTexture, flatloading_jpg, flatloading_jpg_size, GX_TF_CMPR, 32, 512) != TE_OK)
return false;
}
if(m_pngNoCoverFlat.empty() || m_noCoverTexture.fromImageFile(m_pngNoCoverFlat.c_str(), GX_TF_CMPR, 32, 512) != TE_OK)
if(m_pngNoCoverFlat.empty() || TexHandle.fromImageFile(m_noCoverTexture, m_pngNoCoverFlat.c_str(), GX_TF_CMPR, 32, 512) != TE_OK)
{
if(m_noCoverTexture.fromPNG(flatnopic_png, GX_TF_CMPR, 32, 512) != TE_OK)
if(TexHandle.fromPNG(m_noCoverTexture, flatnopic_png, GX_TF_CMPR, 32, 512) != TE_OK)
return false;
}
}
@ -2084,11 +2084,15 @@ bool CCoverFlow::findId(const char *id, bool instant, bool path)
if(m_items.empty() || (instant && m_covers.empty()) || strlen(id) == 0)
return false;
//
for (i = 0; i < m_items.size(); ++i)
for(i = 0; i < m_items.size(); ++i)
{
if(path && memcmp(strrchr(m_items[i].hdr->path, '/')+1, id, strlen(id)) == 0)
break;
else if(!path && memcmp(m_items[i].hdr->id, id, strlen(id)) == 0)
if(path)
{
const char *name = strrchr(m_items[i].hdr->path, '/');
if(name != NULL && strcmp(name + 1, id) == 0)
break;
}
else if(strcmp(m_items[i].hdr->id, id) == 0)
break;
}
if(i >= m_items.size())
@ -2541,7 +2545,7 @@ public:
{
memset(this, 0, sizeof *this);
}
SWFCHeader(const STexture &tex, bool f, bool z, const STexture &backTex = STexture())
SWFCHeader(const TexData &tex, bool f, bool z, const TexData &backTex = TexData())
{
newFmt = 1;
full = f ? 1 : 0;
@ -2562,9 +2566,9 @@ bool CCoverFlow::preCacheCover(const char *id, const u8 *png, bool full)
if(m_cachePath.empty())
return false;
STexture tex;
TexData tex;
u8 textureFmt = m_compressTextures ? GX_TF_CMPR : GX_TF_RGB565;
if(tex.fromPNG(png, textureFmt, 32) != TE_OK)
if(TexHandle.fromPNG(tex, png, textureFmt, 32) != TE_OK)
return false;
u32 bufSize = fixGX_GetTexBufferSize(tex.width, tex.height, tex.format, tex.maxLOD > 0 ? GX_TRUE : GX_FALSE, tex.maxLOD);
@ -2581,7 +2585,7 @@ bool CCoverFlow::preCacheCover(const char *id, const u8 *png, bool full)
fclose(file);
}
}
tex.Cleanup();
TexHandle.Cleanup(tex);
return true;
}
@ -2609,10 +2613,10 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
u8 textureFmt = m_compressTextures ? GX_TF_CMPR : GX_TF_RGB565;
const char *path = box ? (blankBoxCover ? m_items[i].blankBoxPicPath.c_str() :
m_items[i].boxPicPath.c_str()) : m_items[i].picPath.c_str();
STexture tex;
TexData tex;
tex.thread = true;
m_renderingTex = &tex;
if(tex.fromImageFile(path, textureFmt, 32) != TE_OK)
if(TexHandle.fromImageFile(tex, path, textureFmt, 32) != TE_OK)
{
m_renderingTex = NULL;
return false;
@ -2622,7 +2626,7 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
return false;
LWP_MutexLock(m_mutex);
m_items[i].texture.Cleanup();
TexHandle.Cleanup(m_items[i].texture);
m_items[i].texture = tex;
m_items[i].boxTexture = box;
m_items[i].state = STATE_Ready;
@ -2669,7 +2673,7 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
return true;
}
bool CCoverFlow::_calcTexLQLOD(STexture &tex)
bool CCoverFlow::_calcTexLQLOD(TexData &tex)
{
bool done = false;
@ -2689,10 +2693,10 @@ void CCoverFlow::_dropHQLOD(int i)
LockMutex lock(m_mutex);
const STexture &prevTex = m_items[i].texture;
const TexData &prevTex = m_items[i].texture;
if(prevTex.data == NULL)
return;
STexture newTex;
TexData newTex;
newTex.maxLOD = prevTex.maxLOD;
newTex.width = prevTex.width;
@ -2708,7 +2712,7 @@ void CCoverFlow::_dropHQLOD(int i)
return;
memcpy(newTex.data, prevTex.data + (prevTexLen - newTexLen), newTexLen);
DCFlushRange(newTex.data, newTexLen);
m_items[i].texture.Cleanup();
TexHandle.Cleanup(m_items[i].texture);
m_items[i].texture = newTex;
}
@ -2752,7 +2756,7 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank
// 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))))
{
STexture tex;
TexData tex;
tex.format = header.cmpr != 0 ? GX_TF_CMPR : GX_TF_RGB565;
tex.width = header.getWidth();
tex.height = header.getHeight();
@ -2785,7 +2789,7 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank
if(header.zipped != 0)
memcpy(tex.data, ptrTex + bufSize - texLen, texLen);
LockMutex lock(m_mutex);
m_items[i].texture.Cleanup();
TexHandle.Cleanup(m_items[i].texture);
m_items[i].texture = tex;
DCFlushRange(tex.data, texLen);
m_items[i].state = STATE_Ready;
@ -2834,7 +2838,7 @@ int CCoverFlow::_coverLoader(CCoverFlow *cf)
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);
cf->m_items[i].texture.Cleanup();
TexHandle.Cleanup(cf->m_items[i].texture);
cf->m_items[i].state = STATE_Loading;
LWP_MutexUnlock(cf->m_mutex);
}

View File

@ -72,7 +72,7 @@ public:
void flip(bool force = false, bool f = true);
void cancel(void);
bool selected(void) const { return m_selected; }
void makeEffectTexture(const STexture * &bg);
void makeEffectTexture(const TexData * &bg);
void drawText(bool withRectangle = false);
void draw(void);
void drawEffect(void);
@ -197,7 +197,7 @@ private:
string blankBoxPicPath;
int playcount;
unsigned int lastPlayed;
STexture texture;
TexData texture;
volatile bool boxTexture;
volatile enum TexState state;
//
@ -245,19 +245,19 @@ private:
volatile bool m_moved;
//
volatile bool m_renderTex;
STexture *m_renderingTex;
TexData *m_renderingTex;
//
volatile int m_hqCover;
bool m_selected;
int m_tickCount;
STexture m_loadingTexture;
STexture m_noCoverTexture;
STexture m_dvdSkin;
STexture m_dvdSkin_Red;
STexture m_dvdSkin_Black;
STexture m_dvdSkin_Yellow;
STexture m_dvdSkin_GreenOne;
STexture m_dvdSkin_GreenTwo;
TexData m_loadingTexture;
TexData m_noCoverTexture;
TexData m_dvdSkin;
TexData m_dvdSkin_Red;
TexData m_dvdSkin_Black;
TexData m_dvdSkin_Yellow;
TexData m_dvdSkin_GreenOne;
TexData m_dvdSkin_GreenTwo;
// Settings
string m_pngLoadCover;
string m_pngLoadCoverFlat;
@ -288,7 +288,7 @@ private:
float m_shadowScale;
float m_shadowX;
float m_shadowY;
STexture m_effectTex;
TexData m_effectTex;
u32 m_blurRadius;
float m_blurFactor;
Vector3D m_flipCoverPos;
@ -307,7 +307,7 @@ private:
private:
void _draw(DrawMode dm = CFDR_NORMAL, bool mirror = false, bool blend = true);
u32 _currentPos(void) const;
void _effectBg(const STexture * &tex);
void _effectBg(const TexData * &tex);
void _effectBlur(bool vertical);
bool _effectVisible(void);
void _drawMirrorZ(void);
@ -325,14 +325,14 @@ private:
Vector3D _cameraMoves(void);
Vector3D _coverMovesA(void);
Vector3D _coverMovesP(void);
STexture &_coverTexture(int i);
TexData &_coverTexture(int i);
void _left(int repeatDelay, u32 step);
void _right(int repeatDelay, u32 step);
void _jump(void);
void _completeJump(void);
void _setJump(int j);
void _loadAllCovers(int i);
static bool _calcTexLQLOD(STexture &tex);
static bool _calcTexLQLOD(TexData &tex);
void _dropHQLOD(int i);
bool _loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover);
CLRet _loadCoverTex(u32 i, bool box, bool hq, bool blankBoxCover);

View File

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

View File

@ -14,8 +14,8 @@ public:
int x(void) const { return m_x; }
int y(void) const { return m_y; }
private:
STexture m_texture;
STexture m_shadow;
TexData m_texture;
TexData m_shadow;
Mtx m_projMtx;
Mtx m_viewMtx;
int m_x;

View File

@ -26,8 +26,8 @@ void CFanart::unload()
for(vector<CFanartElement>::iterator Elm = m_elms.begin(); Elm != m_elms.end(); Elm++)
Elm->Cleanup();
m_elms.clear();
m_bg.Cleanup();
m_bglq.Cleanup();
TexHandle.Cleanup(m_bg);
TexHandle.Cleanup(m_bglq);
}
bool CFanart::load(Config &m_globalConfig, const char *path, const char *id)
@ -43,11 +43,11 @@ bool CFanart::load(Config &m_globalConfig, const char *path, const char *id)
dir[63] = '\0';
strncpy(dir, fmt("%s/%s", path, id), 63);
TexErr texErr = m_bg.fromImageFile(fmt("%s/background.png", dir));
TexErr texErr = TexHandle.fromImageFile(m_bg, fmt("%s/background.png", dir));
if(texErr == TE_ERROR)
{
strncpy(dir, fmt("%s/%.3s", path, id), 63);
texErr = m_bg.fromImageFile(fmt("%s/background.png", dir));
texErr = TexHandle.fromImageFile(m_bg, fmt("%s/background.png", dir));
}
if(texErr == TE_OK)
{
@ -60,7 +60,7 @@ bool CFanart::load(Config &m_globalConfig, const char *path, const char *id)
strncpy(cfg_char, fmt("%s/%.3s.ini", dir, id), 63);
m_cfg.load(cfg_char);
}
m_bglq.fromImageFile(fmt("%s/background_lq.png", dir));
TexHandle.fromImageFile(m_bglq, fmt("%s/background_lq.png", dir));
for(int i = 1; i <= 6; i++)
{
CFanartElement elm(m_cfg, dir, i);
@ -77,7 +77,7 @@ bool CFanart::load(Config &m_globalConfig, const char *path, const char *id)
return retval;
}
void CFanart::getBackground(const STexture * &hq, const STexture * &lq)
void CFanart::getBackground(const TexData * &hq, const TexData * &lq)
{
if(m_loaded)
{
@ -183,7 +183,7 @@ void CFanart::draw(bool front)
CFanartElement::CFanartElement(Config &cfg, const char *dir, int artwork)
: m_artwork(artwork), m_isValid(false)
{
m_isValid = (m_art.fromImageFile(fmt("%s/artwork%d.png", dir, artwork)) == TE_OK);
m_isValid = (TexHandle.fromImageFile(m_art, fmt("%s/artwork%d.png", dir, artwork)) == TE_OK);
if (!m_isValid) return;
const char *section = fmt("artwork%d", artwork);
@ -216,7 +216,7 @@ CFanartElement::CFanartElement(Config &cfg, const char *dir, int artwork)
void CFanartElement::Cleanup(void)
{
m_art.Cleanup();
TexHandle.Cleanup(m_art);
}
bool CFanartElement::IsValid()

View File

@ -24,7 +24,7 @@ public:
bool IsAnimationComplete();
bool ShowOnTop();
private:
STexture m_art;
TexData m_art;
int m_artwork;
int m_delay;
int m_event_duration;
@ -60,13 +60,13 @@ class CFanart
public:
CFanart(void);
~CFanart(void);
void unload();
bool load(Config &m_globalConfig, const char *path, const char *id);
bool isAnimationComplete();
bool isLoaded();
void getBackground(const STexture * &hq, const STexture * &lq);
void getBackground(const TexData * &hq, const TexData * &lq);
CColor getTextColor(CColor themeTxtColor = CColor(0xFFFFFFFF));
bool hideCover();
void draw(bool front = true);
@ -80,12 +80,12 @@ private:
u8 m_globalHideCover;
u8 m_globalShowCoverAfterAnimation;
u16 m_defaultDelay;
bool m_allowArtworkOnTop;
bool m_allowArtworkOnTop;
bool m_loaded;
Config m_cfg;
STexture m_bg;
STexture m_bglq;
TexData m_bg;
TexData m_bglq;
};
#endif // __FANART_HPP

View File

@ -8,7 +8,7 @@ template <class T> static inline T loopNum(T i, T s)
return (i + s) % s;
}
STexture CButtonsMgr::_noTexture;
TexData CButtonsMgr::_noTexture;
CButtonsMgr m_btnMgr;
@ -399,7 +399,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)
s16 CButtonsMgr::addLabel(SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color, s16 style, const TexData &bg)
{
SLabel *b = new SLabel;
@ -456,7 +456,7 @@ s16 CButtonsMgr::addProgressBar(int x, int y, u32 width, u32 height, SButtonText
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, GuiSound *clickSound, GuiSound *hoverSound)
s16 CButtonsMgr::addPicButton(TexData &texNormal, TexData &texSelected, int x, int y, u32 width, u32 height, GuiSound *clickSound, GuiSound *hoverSound)
{
SButtonTextureSet texSet;
@ -469,8 +469,8 @@ s16 CButtonsMgr::addPicButton(const u8 *pngNormal, const u8 *pngSelected, int x,
{
SButtonTextureSet texSet;
texSet.center.fromPNG(pngNormal);
texSet.centerSel.fromPNG(pngSelected);
TexHandle.fromPNG(texSet.center, pngNormal);
TexHandle.fromPNG(texSet.centerSel, pngSelected);
return addButton(SFont(), wstringEx(), x, y, width, height, CColor(), texSet, clickSound, hoverSound);
}
@ -525,15 +525,15 @@ void CButtonsMgr::setText(s16 id, const wstringEx &text, u32 startline,bool unwr
}
}
void CButtonsMgr::setBtnTexture(s16 id, STexture &texNormal, STexture &texSelected)
void CButtonsMgr::setBtnTexture(s16 id, TexData &texNormal, TexData &texSelected)
{
if (id == -1) return;
if (id < (s32)m_elts.size())
{
SButton *b = (SButton*)m_elts[id];
/* free old textures */
b->tex.center.Cleanup();
b->tex.centerSel.Cleanup();
TexHandle.Cleanup(b->tex.center);
TexHandle.Cleanup(b->tex.centerSel);
/*change textures */
b->tex.center = texNormal;
b->tex.centerSel = texSelected;
@ -546,12 +546,12 @@ void CButtonsMgr::freeBtnTexture(s16 id)
if(id < (s32)m_elts.size())
{
SButton *b = (SButton*)m_elts[id];
b->tex.center.Cleanup();
b->tex.centerSel.Cleanup();
TexHandle.Cleanup(b->tex.center);
TexHandle.Cleanup(b->tex.centerSel);
}
}
void CButtonsMgr::setTexture(s16 id, STexture &bg)
void CButtonsMgr::setTexture(s16 id, TexData &bg)
{
if (id == -1) return;
if (id < (s32)m_elts.size())
@ -571,7 +571,7 @@ void CButtonsMgr::setTexture(s16 id, STexture &bg)
}
}
void CButtonsMgr::setTexture(s16 id, STexture &bg, int width, int height)
void CButtonsMgr::setTexture(s16 id, TexData &bg, int width, int height)
{
if (id == -1) return;
if (id < (s32)m_elts.size())

View File

@ -15,12 +15,12 @@
struct SButtonTextureSet
{
STexture left;
STexture right;
STexture center;
STexture leftSel;
STexture rightSel;
STexture centerSel;
TexData left;
TexData right;
TexData center;
TexData leftSel;
TexData rightSel;
TexData centerSel;
};
class CButtonsMgr
@ -31,18 +31,18 @@ public:
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, 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 addLabel(SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color, s16 style, const TexData &bg = _noTexture);
s16 addPicButton(const u8 *pngNormal, const u8 *pngSelected, int x, int y, u32 width, u32 height,
GuiSound *clickSound = NULL, GuiSound *hoverSound = NULL);
s16 addPicButton(STexture &texNormal, STexture &texSelected, int x, int y, u32 width, u32 height,
s16 addPicButton(TexData &texNormal, TexData &texSelected, int x, int y, u32 width, u32 height,
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);
void setBtnTexture(s16 id, STexture &texNormal, STexture &texSelected);
void setBtnTexture(s16 id, TexData &texNormal, TexData &texSelected);
void freeBtnTexture(s16 id);
void setTexture(s16 id ,STexture &bg);
void setTexture(s16 id, STexture &bg, int width, int height);
void setTexture(s16 id ,TexData &bg);
void setTexture(s16 id, TexData &bg, int width, int height);
void setProgress(s16 id, float f, bool instant = false);
void reset(s16 id, bool instant = false);
void moveBy(s16 id, int x, int y, bool instant = false);
@ -123,7 +123,7 @@ private:
CText text;
CColor textColor;
u16 textStyle;
STexture texBg;
TexData texBg;
public:
SLabel(void) { t = GUIELT_LABEL; }
virtual void tick(void);
@ -154,7 +154,7 @@ private:
void _drawBtn(SButton &b, bool selected, bool click);
void _drawLbl(SLabel &b);
void _drawPBar(const SProgressBar &b);
static STexture _noTexture;
static TexData _noTexture;
};
extern CButtonsMgr m_btnMgr;

View File

@ -13,6 +13,8 @@
using namespace std;
STexture TexHandle;
static u32 upperPower(u32 width)
{
u32 i = 8;
@ -201,41 +203,41 @@ static inline void _convertToCMPR(u8 *dst, const u8 *src, u32 width, u32 height)
}
}
void STexture::Cleanup(void)
void STexture::Cleanup(TexData &tex)
{
if(data != NULL)
free(data);
data = NULL;
dataSize = 0;
width = 0;
height = 0;
format = -1;
maxLOD = 0;
if(tex.data != NULL)
free(tex.data);
tex.data = NULL;
tex.dataSize = 0;
tex.width = 0;
tex.height = 0;
tex.format = -1;
tex.maxLOD = 0;
}
bool STexture::CopyTexture(const STexture &tex)
bool STexture::CopyTexture(const TexData &src, TexData &dest)
{
if(tex.data == NULL || tex.dataSize == 0 || tex.data == data)
if(src.data == NULL || src.dataSize == 0 || src.data == dest.data)
return false;
if(dataSize != tex.dataSize)
Cleanup();
if(data == NULL)
data = (u8*)MEM2_alloc(tex.dataSize);
if(data == NULL)
if(src.dataSize != dest.dataSize)
Cleanup(dest);
if(dest.data == NULL)
dest.data = (u8*)MEM2_alloc(src.dataSize);
if(dest.data == NULL)
return false;
dataSize = tex.dataSize;
memcpy(data, tex.data, dataSize);
DCFlushRange(data, dataSize);
width = tex.width;
height = tex.height;
format = tex.format;
maxLOD = tex.maxLOD;
dest.dataSize = src.dataSize;
memcpy(dest.data, src.data, dest.dataSize);
DCFlushRange(dest.data, dest.dataSize);
dest.width = src.width;
dest.height = src.height;
dest.format = src.format;
dest.maxLOD = src.maxLOD;
return true;
}
TexErr STexture::fromImageFile(const char *filename, u8 f, u32 minMipSize, u32 maxMipSize)
TexErr STexture::fromImageFile(TexData &dest, const char *filename, u8 f, u32 minMipSize, u32 maxMipSize)
{
Cleanup();
Cleanup(dest);
FILE *file = fopen(filename, "rb");
if(file == NULL)
{
@ -261,30 +263,30 @@ TexErr STexture::fromImageFile(const char *filename, u8 f, u32 minMipSize, u32 m
TexErr result = TE_NOMEM;
if(Image != NULL)
{
if(strstr(filename, ".png") != NULL)
result = fromPNG(Image, f, minMipSize, maxMipSize);
if(*(vu32*)Image == 0x89504E47) /* PNG Magic */
result = fromPNG(dest, Image, f, minMipSize, maxMipSize);
else
result = fromJPG(Image, fileSize, f, minMipSize, maxMipSize);
result = fromJPG(dest, Image, fileSize, f, minMipSize, maxMipSize);
free(Image);
}
return result;
}
TexErr STexture::fromTHP(const u8 *src, u32 w, u32 h)
TexErr STexture::fromTHP(TexData &dest, const u8 *src, u32 w, u32 h)
{
width = w;
height = h;
format = GX_TF_RGBA8;
dataSize = GX_GetTexBufferSize(width, height, format, GX_FALSE, 0);
data = (u8*)MEM2_alloc(dataSize);
if(data == NULL)
dest.width = w;
dest.height = h;
dest.format = GX_TF_RGBA8;
dest.dataSize = GX_GetTexBufferSize(dest.width, dest.height, dest.format, GX_FALSE, 0);
dest.data = (u8*)MEM2_alloc(dest.dataSize);
if(dest.data == NULL)
{
Cleanup();
Cleanup(dest);
return TE_NOMEM;
}
for(u32 block = 0; block < height; block += 4)
for(u32 block = 0; block < dest.height; block += 4)
{
for(u32 i = 0; i < width; i += 4)
for(u32 i = 0; i < dest.width; i += 4)
{
for(u32 c = 0; c < 4; ++c)
{
@ -292,47 +294,47 @@ TexErr STexture::fromTHP(const u8 *src, u32 w, u32 h)
{
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);
u32 src_offset = ((i + argb) + ((block + c) * dest.width)) * 3;
u32 dst_offset = coordsRGBA8(x, y, dest.width);
/* Alpha */
data[dst_offset] = 0xFF;
dest.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];
dest.data[dst_offset + 1] = src[src_offset];
dest.data[dst_offset + 32] = src[src_offset + 1];
dest.data[dst_offset + 33] = src[src_offset + 2];
}
}
}
}
DCFlushRange(data, dataSize);
DCFlushRange(dest.data, dest.dataSize);
return TE_OK;
}
TexErr STexture::fromJPG(const u8 *buffer, const u32 buffer_size, u8 f, u32 minMipSize, u32 maxMipSize)
TexErr STexture::fromJPG(TexData &dest, const u8 *buffer, const u32 buffer_size, u8 f, u32 minMipSize, u32 maxMipSize)
{
Cleanup();
Cleanup(dest);
// Decode our JPG to raw
VideoFrame VideoF;
decodeRealJpeg(buffer, buffer_size, VideoF, true);
if(!VideoF.getData())
return TE_ERROR;
data = VideoF.getData();
width = VideoF.getWidth();
height = VideoF.getHeight();
dest.data = VideoF.getData();
dest.width = VideoF.getWidth();
dest.height = VideoF.getHeight();
// Convert our raw stuff to a usable format
u8 *rawData = (u8*)MEM2_alloc(width * height * 4);
u8 *rawData = (u8*)MEM2_alloc(dest.width * dest.height * 4);
if(rawData == NULL)
{
Cleanup();
Cleanup(dest);
return TE_NOMEM;
}
_convertToFlippedRGBA(rawData, data, width, height);
_convertToFlippedRGBA(rawData, dest.data, dest.width, dest.height);
//Free our raw stuff
VideoF.dealloc();
data = NULL;
dest.data = NULL;
//Let the real work begin
u8 maxLODTmp = 0;
@ -349,16 +351,16 @@ TexErr STexture::fromJPG(const u8 *buffer, const u32 buffer_size, u8 f, u32 minM
default:
f = GX_TF_RGBA8;
}
format = f;
dest.format = f;
if (minMipSize > 0 || maxMipSize > 0)
_calcMipMaps(maxLODTmp, minLODTmp, baseWidth, baseHeight, width, height, minMipSize, maxMipSize);
_calcMipMaps(maxLODTmp, minLODTmp, baseWidth, baseHeight, dest.width, dest.height, minMipSize, maxMipSize);
if (maxLODTmp > 0)
{
rawData = _genMipMaps(rawData, width, height, maxLODTmp, baseWidth, baseHeight);
rawData = _genMipMaps(rawData, dest.width, dest.height, maxLODTmp, baseWidth, baseHeight);
if(rawData == NULL)
{
Cleanup();
Cleanup(dest);
return TE_NOMEM;
}
u32 newWidth = baseWidth;
@ -368,11 +370,11 @@ TexErr STexture::fromJPG(const u8 *buffer, const u32 buffer_size, u8 f, u32 minM
newWidth >>= 1;
newHeight >>= 1;
}
dataSize = fixGX_GetTexBufferSize(newWidth, newHeight, f, GX_TRUE, maxLODTmp - minLODTmp);
data = (u8*)MEM2_alloc(dataSize);
if(data == NULL)
dest.dataSize = fixGX_GetTexBufferSize(newWidth, newHeight, dest.format, GX_TRUE, maxLODTmp - minLODTmp);
dest.data = (u8*)MEM2_alloc(dest.dataSize);
if(dest.data == NULL)
{
Cleanup();
Cleanup(dest);
free(rawData);
return TE_NOMEM;
}
@ -380,8 +382,8 @@ TexErr STexture::fromJPG(const u8 *buffer, const u32 buffer_size, u8 f, u32 minM
u32 nHeight = newHeight;
u8 *pSrc = rawData;
if (minLODTmp > 0)
pSrc += fixGX_GetTexBufferSize(baseWidth, baseHeight, f, minLODTmp > 1 ? GX_TRUE : GX_FALSE, minLODTmp - 1);
u8 *pDst = data;
pSrc += fixGX_GetTexBufferSize(baseWidth, baseHeight, dest.format, minLODTmp > 1 ? GX_TRUE : GX_FALSE, minLODTmp - 1);
u8 *pDst = dest.data;
for (u8 i = minLODTmp; i <= maxLODTmp; ++i)
{
switch(f)
@ -397,45 +399,45 @@ TexErr STexture::fromJPG(const u8 *buffer, const u32 buffer_size, u8 f, u32 minM
break;
}
pSrc += nWidth * nHeight * 4;
pDst += GX_GetTexBufferSize(nWidth, nHeight, f, GX_FALSE, 0);
pDst += GX_GetTexBufferSize(nWidth, nHeight, dest.format, GX_FALSE, 0);
nWidth >>= 1;
nHeight >>= 1;
}
maxLOD = maxLODTmp - minLODTmp;
width = newWidth;
height = newHeight;
dest.maxLOD = maxLODTmp - minLODTmp;
dest.width = newWidth;
dest.height = newHeight;
}
else
{
dataSize = GX_GetTexBufferSize(width, height, format, GX_FALSE, 0);
data = (u8*)MEM2_alloc(dataSize);
if(data == NULL)
dest.dataSize = GX_GetTexBufferSize(dest.width, dest.height, dest.format, GX_FALSE, 0);
dest.data = (u8*)MEM2_alloc(dest.dataSize);
if(dest.data == NULL)
{
Cleanup();
Cleanup(dest);
free(rawData);
return TE_NOMEM;
}
switch(f)
{
case GX_TF_RGBA8:
_convertToRGBA8(data, rawData, width, height);
_convertToRGBA8(dest.data, rawData, dest.width, dest.height);
break;
case GX_TF_RGB565:
_convertToRGB565(data, rawData, width, height);
_convertToRGB565(dest.data, rawData, dest.width, dest.height);
break;
case GX_TF_CMPR:
_convertToCMPR(data, rawData, width, height);
_convertToCMPR(dest.data, rawData, dest.width, dest.height);
break;
}
}
DCFlushRange(data, dataSize);
DCFlushRange(dest.data, dest.dataSize);
free(rawData);
return TE_OK;
}
TexErr STexture::fromPNG(const u8 *buffer, u8 f, u32 minMipSize, u32 maxMipSize)
TexErr STexture::fromPNG(TexData &dest, const u8 *buffer, u8 f, u32 minMipSize, u32 maxMipSize)
{
Cleanup();
Cleanup(dest);
u8 maxLODTmp = 0;
u8 minLODTmp = 0;
u32 baseWidth;
@ -487,28 +489,28 @@ TexErr STexture::fromPNG(const u8 *buffer, u8 f, u32 minMipSize, u32 maxMipSize)
memset(tmpData2, 0, Size2);
PNGU_DecodeToRGBA8(ctx, imgProp.imgWidth, imgProp.imgHeight, tmpData2, 0, 0xFF);
PNGU_ReleaseImageContext(ctx);
if((imgProp.imgColorType == PNGU_COLOR_TYPE_GRAY_ALPHA
if(dest.thread && (imgProp.imgColorType == PNGU_COLOR_TYPE_GRAY_ALPHA
|| imgProp.imgColorType == PNGU_COLOR_TYPE_RGB_ALPHA)
&& imgProp.imgWidth <= 640 && imgProp.imgHeight <= 480 && thread)
&& imgProp.imgWidth <= 640 && imgProp.imgHeight <= 480)
{
format = GX_TF_RGBA8;
width = imgProp.imgWidth;
height = imgProp.imgHeight;
dataSize = GX_GetTexBufferSize(width, height, format, GX_FALSE, 0);
data = (u8*)MEM2_alloc(dataSize);
_convertToRGBA8(data, tmpData2, width, height);
DCFlushRange(data, dataSize);
dest.format = GX_TF_RGBA8;
dest.width = imgProp.imgWidth;
dest.height = imgProp.imgHeight;
dest.dataSize = GX_GetTexBufferSize(dest.width, dest.height, dest.format, GX_FALSE, 0);
dest.data = (u8*)MEM2_alloc(dest.dataSize);
_convertToRGBA8(dest.data, tmpData2, dest.width, dest.height);
DCFlushRange(dest.data, dest.dataSize);
CoverFlow.setRenderTex(true);
while(CoverFlow.getRenderTex())
usleep(50);
_convertToRGBA(tmpData2, data, width, height);
_convertToRGBA(tmpData2, dest.data, dest.width, dest.height);
DCFlushRange(tmpData2, Size2);
Cleanup();
Cleanup(dest);
}
tmpData2 = _genMipMaps(tmpData2, imgProp.imgWidth, imgProp.imgHeight, maxLODTmp, baseWidth, baseHeight);
if(tmpData2 == NULL)
{
Cleanup();
Cleanup(dest);
return TE_NOMEM;
}
u32 nWidth = newWidth;
@ -516,16 +518,16 @@ TexErr STexture::fromPNG(const u8 *buffer, u8 f, u32 minMipSize, u32 maxMipSize)
u8 *pSrc = tmpData2;
if(minLODTmp > 0)
pSrc += fixGX_GetTexBufferSize(baseWidth, baseHeight, f, minLODTmp > 1 ? GX_TRUE : GX_FALSE, minLODTmp - 1);
dataSize = fixGX_GetTexBufferSize(newWidth, newHeight, f, GX_TRUE, maxLODTmp - minLODTmp);
data = (u8*)MEM2_alloc(dataSize);
if(data == NULL)
dest.dataSize = fixGX_GetTexBufferSize(newWidth, newHeight, f, GX_TRUE, maxLODTmp - minLODTmp);
dest.data = (u8*)MEM2_alloc(dest.dataSize);
if(dest.data == NULL)
{
Cleanup();
Cleanup(dest);
free(tmpData2);
return TE_NOMEM;
}
memset(data, 0, dataSize);
u8 *pDst = data;
memset(dest.data, 0, dest.dataSize);
u8 *pDst = dest.data;
for(u8 i = minLODTmp; i <= maxLODTmp; ++i)
{
switch(f)
@ -546,41 +548,41 @@ TexErr STexture::fromPNG(const u8 *buffer, u8 f, u32 minMipSize, u32 maxMipSize)
nHeight >>= 1;
}
free(tmpData2);
maxLOD = maxLODTmp - minLODTmp;
format = f;
width = newWidth;
height = newHeight;
dest.maxLOD = maxLODTmp - minLODTmp;
dest.format = f;
dest.width = newWidth;
dest.height = newHeight;
}
else
{
dataSize = GX_GetTexBufferSize(pngWidth, pngHeight, f, GX_FALSE, 0);
data = (u8*)MEM2_alloc(dataSize);
if(data == NULL)
dest.dataSize = GX_GetTexBufferSize(pngWidth, pngHeight, f, GX_FALSE, 0);
dest.data = (u8*)MEM2_alloc(dest.dataSize);
if(dest.data == NULL)
{
Cleanup();
Cleanup(dest);
PNGU_ReleaseImageContext(ctx);
return TE_NOMEM;
}
memset(data, 0, dataSize);
format = f;
width = pngWidth;
height = pngHeight;
maxLOD = 0;
memset(dest.data, 0, dest.dataSize);
dest.format = f;
dest.width = pngWidth;
dest.height = pngHeight;
dest.maxLOD = 0;
switch (f)
{
case GX_TF_RGBA8:
PNGU_DecodeTo4x4RGBA8(ctx, imgProp.imgWidth, imgProp.imgHeight, data, 0xFF);
PNGU_DecodeTo4x4RGBA8(ctx, imgProp.imgWidth, imgProp.imgHeight, dest.data, 0xFF);
break;
case GX_TF_RGB565:
PNGU_DecodeTo4x4RGB565(ctx, imgProp.imgWidth, imgProp.imgHeight, data);
PNGU_DecodeTo4x4RGB565(ctx, imgProp.imgWidth, imgProp.imgHeight, dest.data);
break;
case GX_TF_CMPR:
PNGU_DecodeToCMPR(ctx, imgProp.imgWidth, imgProp.imgHeight, data);
PNGU_DecodeToCMPR(ctx, imgProp.imgWidth, imgProp.imgHeight, dest.data);
break;
}
PNGU_ReleaseImageContext(ctx);
}
DCFlushRange(data, dataSize);
DCFlushRange(dest.data, dest.dataSize);
return TE_OK;
}
@ -700,21 +702,19 @@ void STexture::_calcMipMaps(u8 &maxLOD, u8 &minLOD, u32 &lod0Width, u32 &lod0Hei
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);
u8 *dst = (u8*)MEM2_alloc(bufSize);
if(dst == NULL)
{
Cleanup();
u8 *dstData = (u8*)MEM2_alloc(bufSize);
if(dstData == NULL)
return NULL;
}
memset(dst, 0, bufSize);
_resize(dst, lod0Width, lod0Height, src, width, height);
DCFlushRange(dst, lod0Width * lod0Height * 4);
memset(dstData, 0, bufSize);
_resize(dstData, lod0Width, lod0Height, src, width, height);
DCFlushRange(dstData, lod0Width * lod0Height * 4);
free(src);
src = NULL;
u32 nWidth = lod0Width;
u32 nHeight = lod0Height;
u8 *pDst = dst;
u8 *pDst = dstData;
for(u8 i = 0; i < maxLOD; ++i)
{
u8 *pSrc = pDst;
@ -724,5 +724,5 @@ u8 *STexture::_genMipMaps(u8 *src, u32 width, u32 height, u8 maxLOD, u32 lod0Wid
nWidth >>= 1;
nHeight >>= 1;
}
return dst;
return dstData;
}

View File

@ -11,12 +11,9 @@ enum TexErr
TE_NOMEM
};
class STexture
struct TexData
{
public:
STexture(void) : data(NULL), dataSize(0), width(0), height(0), format(-1), maxLOD(0), thread(false) { }
void Cleanup();
bool CopyTexture(const STexture &tex);
TexData() : data(NULL), dataSize(0), width(0), height(0), format(-1), maxLOD(0), thread(false) { }
u8 *data;
u32 dataSize;
u32 width;
@ -24,13 +21,20 @@ public:
u8 format;
u8 maxLOD;
bool thread;
} __attribute__((packed));
class STexture
{
public:
void Cleanup(TexData &tex);
bool CopyTexture(const TexData &src, TexData &dest);
// Get from PNG, if not found from JPG
TexErr fromImageFile(const char *filename, u8 f = -1, u32 minMipSize = 0, u32 maxMipSize = 0);
TexErr fromImageFile(TexData &dest, 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, u32 minMipSize = 0, u32 maxMipSize = 0);
TexErr fromJPG(const u8 *buffer, const u32 buffer_size, u8 f = -1, u32 minMipSize = 0, u32 maxMipSize = 0);
TexErr fromPNG(TexData &dest, const u8 *buffer, u8 f = -1, u32 minMipSize = 0, u32 maxMipSize = 0);
TexErr fromJPG(TexData &dest, 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);
TexErr fromTHP(TexData &dest, const u8 *buffer, u32 w, u32 h);
private:
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);
@ -40,4 +44,6 @@ private:
u32 fixGX_GetTexBufferSize(u16 wd, u16 ht, u32 fmt, u8 mipmap, u8 maxlod);
extern STexture TexHandle;
#endif //!defined(__TEXTURE_HPP)

View File

@ -28,7 +28,7 @@ extern const u32 wait_07_jpg_size;
extern const u8 wait_08_jpg[];
extern const u32 wait_08_jpg_size;
vector<STexture> m_defaultWaitMessages;
vector<TexData> m_defaultWaitMessages;
const float CVideo::_jitter2[2][2] = {
{ 0.246490f, 0.249999f },
@ -230,7 +230,7 @@ void CVideo::setup2DProjection(bool setViewPort, bool noScale)
GX_LoadProjectionMtx(projMtx, GX_ORTHOGRAPHIC);
}
void CVideo::renderToTexture(STexture &tex, bool clear)
void CVideo::renderToTexture(TexData &tex, bool clear)
{
if(tex.data == NULL)
{
@ -511,7 +511,7 @@ void CVideo::_showWaitMessages(CVideo *m)
s8 PNGfadeDirection = 1;
s16 currentLightLevel = 0;
vector<STexture>::iterator waitItr = m->m_waitMessages.begin();
vector<TexData>::iterator waitItr = m->m_waitMessages.begin();
m->_clearScreen();
m->prepare();
@ -571,22 +571,22 @@ void CVideo::waitMessage(float delay)
{
if(m_defaultWaitMessages.size() == 0)
{
STexture m_wTextures[8];
m_wTextures[0].fromJPG(wait_01_jpg, wait_01_jpg_size);
m_wTextures[1].fromJPG(wait_02_jpg, wait_02_jpg_size);
m_wTextures[2].fromJPG(wait_03_jpg, wait_03_jpg_size);
m_wTextures[3].fromJPG(wait_04_jpg, wait_04_jpg_size);
m_wTextures[4].fromJPG(wait_05_jpg, wait_05_jpg_size);
m_wTextures[5].fromJPG(wait_06_jpg, wait_06_jpg_size);
m_wTextures[6].fromJPG(wait_07_jpg, wait_07_jpg_size);
m_wTextures[7].fromJPG(wait_08_jpg, wait_08_jpg_size);
TexData m_wTextures[8];
TexHandle.fromJPG(m_wTextures[0], wait_01_jpg, wait_01_jpg_size);
TexHandle.fromJPG(m_wTextures[1], wait_02_jpg, wait_02_jpg_size);
TexHandle.fromJPG(m_wTextures[2], wait_03_jpg, wait_03_jpg_size);
TexHandle.fromJPG(m_wTextures[3], wait_04_jpg, wait_04_jpg_size);
TexHandle.fromJPG(m_wTextures[4], wait_05_jpg, wait_05_jpg_size);
TexHandle.fromJPG(m_wTextures[5], wait_06_jpg, wait_06_jpg_size);
TexHandle.fromJPG(m_wTextures[6], wait_07_jpg, wait_07_jpg_size);
TexHandle.fromJPG(m_wTextures[7], wait_08_jpg, wait_08_jpg_size);
for(int i = 0; i < 8; i++)
m_defaultWaitMessages.push_back(m_wTextures[i]);
}
waitMessage(vector<STexture>(), delay);
waitMessage(vector<TexData>(), delay);
}
void CVideo::waitMessage(const vector<STexture> &tex, float delay)
void CVideo::waitMessage(const vector<TexData> &tex, float delay)
{
hideWaitMessage();
if(tex.size() == 0)
@ -609,7 +609,7 @@ void CVideo::waitMessage(const vector<STexture> &tex, float delay)
}
}
void CVideo::waitMessage(const STexture &tex)
void CVideo::waitMessage(const TexData &tex)
{
Mtx modelViewMtx;
GXTexObj texObj;
@ -654,7 +654,7 @@ s32 CVideo::TakeScreenshot(const char *path)
return ret;
}
void DrawTexture(STexture * &tex)
void DrawTexture(TexData * &tex)
{
if(tex == NULL)
return;

View File

@ -51,7 +51,7 @@ public:
void render(void);
void renderAAPass(int aaStep);
void drawAAScene(bool fs = true);
void renderToTexture(STexture &tex, bool clear);
void renderToTexture(TexData &tex, bool clear);
void cleanup(void);
void setup2DProjection(bool setViewPort = true, bool noScale = false);
u32 width(void) const { return m_rmode->fbWidth; }
@ -69,8 +69,8 @@ public:
int stencilVal(int x, int y);
void hideWaitMessage();
void waitMessage(float delay);
void waitMessage(const vector<STexture> &tex, float delay);
void waitMessage(const STexture &tex);
void waitMessage(const vector<TexData> &tex, float delay);
void waitMessage(const TexData &tex);
s32 TakeScreenshot(const char *);
void shiftViewPort(float x, float y);
private:
@ -100,7 +100,7 @@ private:
float m_waitMessageDelay;
volatile bool m_showWaitMessage;
volatile bool m_showingWaitMessages;
vector<STexture> m_waitMessages;
vector<TexData> m_waitMessages;
//
static const int _stencilWidth;
static const int _stencilHeight;
@ -119,7 +119,7 @@ private:
CVideo(const CVideo &);
};
void DrawTexture(STexture * &tex);
void DrawTexture(TexData * &tex);
void DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color);
extern CVideo m_vid;

View File

@ -149,7 +149,6 @@ CMenu::CMenu()
m_use_sd_logging = false;
m_use_wifi_gecko = false;
init_network = false;
m_curGameId = NULL;
}
void CMenu::init()
@ -544,95 +543,95 @@ void CMenu::cleanup()
void CMenu::_Theme_Cleanup(void)
{
/* Backgrounds */
theme.bg.Cleanup();
TexHandle.Cleanup(theme.bg);
m_prevBg = NULL;
m_nextBg = NULL;
m_curBg.Cleanup();
TexHandle.Cleanup(m_curBg);
m_lqBg = NULL;
/* Buttons */
theme.btnTexL.Cleanup();
theme.btnTexR.Cleanup();
theme.btnTexC.Cleanup();
theme.btnTexLS.Cleanup();
theme.btnTexRS.Cleanup();
theme.btnTexCS.Cleanup();
theme.btnTexLH.Cleanup();
theme.btnTexRH.Cleanup();
theme.btnTexCH.Cleanup();
theme.btnTexLSH.Cleanup();
theme.btnTexRSH.Cleanup();
theme.btnTexCSH.Cleanup();
theme.btnAUOn.Cleanup();
theme.btnAUOns.Cleanup();
theme.btnAUOff.Cleanup();
theme.btnAUOffs.Cleanup();
theme.btnENOn.Cleanup();
theme.btnENOns.Cleanup();
theme.btnENOff.Cleanup();
theme.btnENOffs.Cleanup();
theme.btnJAOn.Cleanup();
theme.btnJAOns.Cleanup();
theme.btnJAOff.Cleanup();
theme.btnJAOffs.Cleanup();
theme.btnFROn.Cleanup();
theme.btnFROns.Cleanup();
theme.btnFROff.Cleanup();
theme.btnFROffs.Cleanup();
theme.btnDEOn.Cleanup();
theme.btnDEOns.Cleanup();
theme.btnDEOff.Cleanup();
theme.btnDEOffs.Cleanup();
theme.btnESOn.Cleanup();
theme.btnESOns.Cleanup();
theme.btnESOff.Cleanup();
theme.btnESOffs.Cleanup();
theme.btnITOn.Cleanup();
theme.btnITOns.Cleanup();
theme.btnITOff.Cleanup();
theme.btnITOffs.Cleanup();
theme.btnNLOn.Cleanup();
theme.btnNLOns.Cleanup();
theme.btnNLOff.Cleanup();
theme.btnNLOffs.Cleanup();
theme.btnPTOn.Cleanup();
theme.btnPTOns.Cleanup();
theme.btnPTOff.Cleanup();
theme.btnPTOffs.Cleanup();
theme.btnRUOn.Cleanup();
theme.btnRUOns.Cleanup();
theme.btnRUOff.Cleanup();
theme.btnRUOffs.Cleanup();
theme.btnKOOn.Cleanup();
theme.btnKOOns.Cleanup();
theme.btnKOOff.Cleanup();
theme.btnKOOffs.Cleanup();
theme.btnZHCNOn.Cleanup();
theme.btnZHCNOns.Cleanup();
theme.btnZHCNOff.Cleanup();
theme.btnZHCNOffs.Cleanup();
theme.btnTexPlus.Cleanup();
theme.btnTexPlusS.Cleanup();
theme.btnTexMinus.Cleanup();
theme.btnTexMinusS.Cleanup();
TexHandle.Cleanup(theme.btnTexL);
TexHandle.Cleanup(theme.btnTexR);
TexHandle.Cleanup(theme.btnTexC);
TexHandle.Cleanup(theme.btnTexLS);
TexHandle.Cleanup(theme.btnTexRS);
TexHandle.Cleanup(theme.btnTexCS);
TexHandle.Cleanup(theme.btnTexLH);
TexHandle.Cleanup(theme.btnTexRH);
TexHandle.Cleanup(theme.btnTexCH);
TexHandle.Cleanup(theme.btnTexLSH);
TexHandle.Cleanup(theme.btnTexRSH);
TexHandle.Cleanup(theme.btnTexCSH);
TexHandle.Cleanup(theme.btnAUOn);
TexHandle.Cleanup(theme.btnAUOns);
TexHandle.Cleanup(theme.btnAUOff);
TexHandle.Cleanup(theme.btnAUOffs);
TexHandle.Cleanup(theme.btnENOn);
TexHandle.Cleanup(theme.btnENOns);
TexHandle.Cleanup(theme.btnENOff);
TexHandle.Cleanup(theme.btnENOffs);
TexHandle.Cleanup(theme.btnJAOn);
TexHandle.Cleanup(theme.btnJAOns);
TexHandle.Cleanup(theme.btnJAOff);
TexHandle.Cleanup(theme.btnJAOffs);
TexHandle.Cleanup(theme.btnFROn);
TexHandle.Cleanup(theme.btnFROns);
TexHandle.Cleanup(theme.btnFROff);
TexHandle.Cleanup(theme.btnFROffs);
TexHandle.Cleanup(theme.btnDEOn);
TexHandle.Cleanup(theme.btnDEOns);
TexHandle.Cleanup(theme.btnDEOff);
TexHandle.Cleanup(theme.btnDEOffs);
TexHandle.Cleanup(theme.btnESOn);
TexHandle.Cleanup(theme.btnESOns);
TexHandle.Cleanup(theme.btnESOff);
TexHandle.Cleanup(theme.btnESOffs);
TexHandle.Cleanup(theme.btnITOn);
TexHandle.Cleanup(theme.btnITOns);
TexHandle.Cleanup(theme.btnITOff);
TexHandle.Cleanup(theme.btnITOffs);
TexHandle.Cleanup(theme.btnNLOn);
TexHandle.Cleanup(theme.btnNLOns);
TexHandle.Cleanup(theme.btnNLOff);
TexHandle.Cleanup(theme.btnNLOffs);
TexHandle.Cleanup(theme.btnPTOn);
TexHandle.Cleanup(theme.btnPTOns);
TexHandle.Cleanup(theme.btnPTOff);
TexHandle.Cleanup(theme.btnPTOffs);
TexHandle.Cleanup(theme.btnRUOn);
TexHandle.Cleanup(theme.btnRUOns);
TexHandle.Cleanup(theme.btnRUOff);
TexHandle.Cleanup(theme.btnRUOffs);
TexHandle.Cleanup(theme.btnKOOn);
TexHandle.Cleanup(theme.btnKOOns);
TexHandle.Cleanup(theme.btnKOOff);
TexHandle.Cleanup(theme.btnKOOffs);
TexHandle.Cleanup(theme.btnZHCNOn);
TexHandle.Cleanup(theme.btnZHCNOns);
TexHandle.Cleanup(theme.btnZHCNOff);
TexHandle.Cleanup(theme.btnZHCNOffs);
TexHandle.Cleanup(theme.btnTexPlus);
TexHandle.Cleanup(theme.btnTexPlusS);
TexHandle.Cleanup(theme.btnTexMinus);
TexHandle.Cleanup(theme.btnTexMinusS);
/* Checkboxes */
theme.checkboxoff.Cleanup();
theme.checkboxoffs.Cleanup();
theme.checkboxon.Cleanup();
theme.checkboxons.Cleanup();
theme.checkboxHid.Cleanup();
theme.checkboxHids.Cleanup();
theme.checkboxReq.Cleanup();
theme.checkboxReqs.Cleanup();
TexHandle.Cleanup(theme.checkboxoff);
TexHandle.Cleanup(theme.checkboxoffs);
TexHandle.Cleanup(theme.checkboxon);
TexHandle.Cleanup(theme.checkboxons);
TexHandle.Cleanup(theme.checkboxHid);
TexHandle.Cleanup(theme.checkboxHids);
TexHandle.Cleanup(theme.checkboxReq);
TexHandle.Cleanup(theme.checkboxReqs);
/* Progress Bars */
theme.pbarTexL.Cleanup();
theme.pbarTexR.Cleanup();
theme.pbarTexC.Cleanup();
theme.pbarTexLS.Cleanup();
theme.pbarTexRS.Cleanup();
theme.pbarTexCS.Cleanup();
TexHandle.Cleanup(theme.pbarTexL);
TexHandle.Cleanup(theme.pbarTexR);
TexHandle.Cleanup(theme.pbarTexC);
TexHandle.Cleanup(theme.pbarTexLS);
TexHandle.Cleanup(theme.pbarTexRS);
TexHandle.Cleanup(theme.pbarTexCS);
/* Other Theme Stuff */
for(TexSet::iterator texture = theme.texSet.begin(); texture != theme.texSet.end(); ++texture)
texture->second.Cleanup();
TexHandle.Cleanup(texture->second);
for(FontSet::iterator font = theme.fontSet.begin(); font != theme.fontSet.end(); ++font)
font->second.ClearData();
for(SoundSet::iterator sound = theme.soundSet.begin(); sound != theme.soundSet.end(); ++sound)
@ -993,181 +992,181 @@ void CMenu::_buildMenus(void)
theme.cameraSound = _sound(theme.soundSet, "GENERAL", "camera_sound", camera_wav, camera_wav_size, "default_camera", false);
// Default textures
theme.btnTexL.fromPNG(butleft_png);
TexHandle.fromPNG(theme.btnTexL, butleft_png);
theme.btnTexL = _texture("GENERAL", "button_texture_left", theme.btnTexL);
theme.btnTexR.fromPNG(butright_png);
TexHandle.fromPNG(theme.btnTexR, butright_png);
theme.btnTexR = _texture("GENERAL", "button_texture_right", theme.btnTexR);
theme.btnTexC.fromPNG(butcenter_png);
TexHandle.fromPNG(theme.btnTexC, butcenter_png);
theme.btnTexC = _texture("GENERAL", "button_texture_center", theme.btnTexC);
theme.btnTexLS.fromPNG(butsleft_png);
TexHandle.fromPNG(theme.btnTexLS, butsleft_png);
theme.btnTexLS = _texture("GENERAL", "button_texture_left_selected", theme.btnTexLS);
theme.btnTexRS.fromPNG(butsright_png);
TexHandle.fromPNG(theme.btnTexRS, butsright_png);
theme.btnTexRS = _texture("GENERAL", "button_texture_right_selected", theme.btnTexRS);
theme.btnTexCS.fromPNG(butscenter_png);
TexHandle.fromPNG(theme.btnTexCS, butscenter_png);
theme.btnTexCS = _texture("GENERAL", "button_texture_center_selected", theme.btnTexCS);
theme.btnTexLH.fromPNG(buthleft_png);
TexHandle.fromPNG(theme.btnTexLH, buthleft_png);
theme.btnTexLH = _texture("GENERAL", "button_texture_hlleft", theme.btnTexLH);
theme.btnTexRH.fromPNG(buthright_png);
TexHandle.fromPNG(theme.btnTexRH, buthright_png);
theme.btnTexRH = _texture("GENERAL", "button_texture_hlright", theme.btnTexRH);
theme.btnTexCH.fromPNG(buthcenter_png);
TexHandle.fromPNG(theme.btnTexCH, buthcenter_png);
theme.btnTexCH = _texture("GENERAL", "button_texture_hlcenter", theme.btnTexCH);
theme.btnTexLSH.fromPNG(buthsleft_png);
TexHandle.fromPNG(theme.btnTexLSH, buthsleft_png);
theme.btnTexLSH = _texture("GENERAL", "button_texture_hlleft_selected", theme.btnTexLSH);
theme.btnTexRSH.fromPNG(buthsright_png);
TexHandle.fromPNG(theme.btnTexRSH, buthsright_png);
theme.btnTexRSH = _texture("GENERAL", "button_texture_hlright_selected", theme.btnTexRSH);
theme.btnTexCSH.fromPNG(buthscenter_png);
TexHandle.fromPNG(theme.btnTexCSH, buthscenter_png);
theme.btnTexCSH = _texture("GENERAL", "button_texture_hlcenter_selected", theme.btnTexCSH);
theme.btnAUOn.fromPNG(butauon_png);
TexHandle.fromPNG(theme.btnAUOn, butauon_png);
theme.btnAUOn = _texture("GENERAL", "button_au_on", theme.btnAUOn);
theme.btnAUOns.fromPNG(butauons_png);
TexHandle.fromPNG(theme.btnAUOns, butauons_png);
theme.btnAUOns = _texture("GENERAL", "button_au_on_selected", theme.btnAUOns);
theme.btnAUOff.fromPNG(butauoff_png);
TexHandle.fromPNG(theme.btnAUOff, butauoff_png);
theme.btnAUOff = _texture("GENERAL", "button_au_off", theme.btnAUOff);
theme.btnAUOffs.fromPNG(butauoffs_png);
TexHandle.fromPNG(theme.btnAUOffs, butauoffs_png);
theme.btnAUOffs = _texture("GENERAL", "button_au_off_selected", theme.btnAUOffs);
theme.btnENOn.fromPNG(butenon_png);
TexHandle.fromPNG(theme.btnENOn, butenon_png);
theme.btnENOn = _texture("GENERAL", "button_en_on", theme.btnENOn);
theme.btnENOns.fromPNG(butenons_png);
TexHandle.fromPNG(theme.btnENOns, butenons_png);
theme.btnENOns = _texture("GENERAL", "button_en_on_selected", theme.btnENOns);
theme.btnENOff.fromPNG(butenoff_png);
TexHandle.fromPNG(theme.btnENOff, butenoff_png);
theme.btnENOff = _texture("GENERAL", "button_en_off", theme.btnENOff);
theme.btnENOffs.fromPNG(butenoffs_png);
TexHandle.fromPNG(theme.btnENOffs, butenoffs_png);
theme.btnENOffs = _texture("GENERAL", "button_en_off_selected", theme.btnENOffs);
theme.btnJAOn.fromPNG(butjaon_png);
TexHandle.fromPNG(theme.btnJAOn, butjaon_png);
theme.btnJAOn = _texture("GENERAL", "button_ja_on", theme.btnJAOn);
theme.btnJAOns.fromPNG(butjaons_png);
TexHandle.fromPNG(theme.btnJAOns, butjaons_png);
theme.btnJAOns = _texture("GENERAL", "button_ja_on_selected", theme.btnJAOns);
theme.btnJAOff.fromPNG(butjaoff_png);
TexHandle.fromPNG(theme.btnJAOff, butjaoff_png);
theme.btnJAOff = _texture("GENERAL", "button_ja_off", theme.btnJAOff);
theme.btnJAOffs.fromPNG(butjaoffs_png);
TexHandle.fromPNG(theme.btnJAOffs, butjaoffs_png);
theme.btnJAOffs = _texture("GENERAL", "button_ja_off_selected", theme.btnJAOffs);
theme.btnFROn.fromPNG(butfron_png);
TexHandle.fromPNG(theme.btnFROn, butfron_png);
theme.btnFROn = _texture("GENERAL", "button_fr_on", theme.btnFROn);
theme.btnFROns.fromPNG(butfrons_png);
TexHandle.fromPNG(theme.btnFROns, butfrons_png);
theme.btnFROns = _texture("GENERAL", "button_fr_on_selected", theme.btnFROns);
theme.btnFROff.fromPNG(butfroff_png);
TexHandle.fromPNG(theme.btnFROff, butfroff_png);
theme.btnFROff = _texture("GENERAL", "button_fr_off", theme.btnFROff);
theme.btnFROffs.fromPNG(butfroffs_png);
TexHandle.fromPNG(theme.btnFROffs, butfroffs_png);
theme.btnFROffs = _texture("GENERAL", "button_fr_off_selected", theme.btnFROffs);
theme.btnDEOn.fromPNG(butdeon_png);
TexHandle.fromPNG(theme.btnDEOn, butdeon_png);
theme.btnDEOn = _texture("GENERAL", "button_de_on", theme.btnDEOn);
theme.btnDEOns.fromPNG(butdeons_png);
TexHandle.fromPNG(theme.btnDEOns, butdeons_png);
theme.btnDEOns = _texture("GENERAL", "button_de_on_selected", theme.btnDEOns);
theme.btnDEOff.fromPNG(butdeoff_png);
TexHandle.fromPNG(theme.btnDEOff, butdeoff_png);
theme.btnDEOff = _texture("GENERAL", "button_de_off", theme.btnDEOff);
theme.btnDEOffs.fromPNG(butdeoffs_png);
TexHandle.fromPNG(theme.btnDEOffs, butdeoffs_png);
theme.btnDEOffs = _texture("GENERAL", "button_de_off_selected", theme.btnDEOffs);
theme.btnESOn.fromPNG(buteson_png);
TexHandle.fromPNG(theme.btnESOn, buteson_png);
theme.btnESOn = _texture("GENERAL", "button_es_on", theme.btnESOn);
theme.btnESOns.fromPNG(butesons_png);
TexHandle.fromPNG(theme.btnESOns, butesons_png);
theme.btnESOns = _texture("GENERAL", "button_es_on_selected", theme.btnESOns);
theme.btnESOff.fromPNG(butesoff_png);
TexHandle.fromPNG(theme.btnESOff, butesoff_png);
theme.btnESOff = _texture("GENERAL", "button_es_off", theme.btnESOff);
theme.btnESOffs.fromPNG(butesoffs_png);
TexHandle.fromPNG(theme.btnESOffs, butesoffs_png);
theme.btnESOffs = _texture("GENERAL", "button_es_off_selected", theme.btnESOffs);
theme.btnITOn.fromPNG(butiton_png);
TexHandle.fromPNG(theme.btnITOn, butiton_png);
theme.btnITOn = _texture("GENERAL", "button_it_on", theme.btnITOn);
theme.btnITOns.fromPNG(butitons_png);
TexHandle.fromPNG(theme.btnITOns, butitons_png);
theme.btnITOns = _texture("GENERAL", "button_it_on_selected", theme.btnITOns);
theme.btnITOff.fromPNG(butitoff_png);
TexHandle.fromPNG(theme.btnITOff, butitoff_png);
theme.btnITOff = _texture("GENERAL", "button_it_off", theme.btnITOff);
theme.btnITOffs.fromPNG(butitoffs_png);
TexHandle.fromPNG(theme.btnITOffs, butitoffs_png);
theme.btnITOffs = _texture("GENERAL", "button_it_off_selected", theme.btnITOffs);
theme.btnNLOn.fromPNG(butnlon_png);
TexHandle.fromPNG(theme.btnNLOn, butnlon_png);
theme.btnNLOn = _texture("GENERAL", "button_nl_on", theme.btnNLOn);
theme.btnNLOns.fromPNG(butnlons_png);
TexHandle.fromPNG(theme.btnNLOns, butnlons_png);
theme.btnNLOns = _texture("GENERAL", "button_nl_on_selected", theme.btnNLOns);
theme.btnNLOff.fromPNG(butnloff_png);
TexHandle.fromPNG(theme.btnNLOff, butnloff_png);
theme.btnNLOff = _texture("GENERAL", "button_nl_off", theme.btnNLOff);
theme.btnNLOffs.fromPNG(butnloffs_png);
TexHandle.fromPNG(theme.btnNLOffs, butnloffs_png);
theme.btnNLOffs = _texture("GENERAL", "button_nl_off_selected", theme.btnNLOffs);
theme.btnPTOn.fromPNG(butpton_png);
TexHandle.fromPNG(theme.btnPTOn, butpton_png);
theme.btnPTOn = _texture("GENERAL", "button_pt_on", theme.btnPTOn);
theme.btnPTOns.fromPNG(butptons_png);
TexHandle.fromPNG(theme.btnPTOns, butptons_png);
theme.btnPTOns = _texture("GENERAL", "button_pt_on_selected", theme.btnPTOns);
theme.btnPTOff.fromPNG(butptoff_png);
TexHandle.fromPNG(theme.btnPTOff, butptoff_png);
theme.btnPTOff = _texture("GENERAL", "button_pt_off", theme.btnPTOff);
theme.btnPTOffs.fromPNG(butptoffs_png);
TexHandle.fromPNG(theme.btnPTOffs, butptoffs_png);
theme.btnPTOffs = _texture("GENERAL", "button_pt_off_selected", theme.btnPTOffs);
theme.btnRUOn.fromPNG(butruon_png);
TexHandle.fromPNG(theme.btnRUOn, butruon_png);
theme.btnRUOn = _texture("GENERAL", "button_ru_on", theme.btnRUOn);
theme.btnRUOns.fromPNG(butruons_png);
TexHandle.fromPNG(theme.btnRUOns, butruons_png);
theme.btnRUOns = _texture("GENERAL", "button_ru_on_selected", theme.btnRUOns);
theme.btnRUOff.fromPNG(butruoff_png);
TexHandle.fromPNG(theme.btnRUOff, butruoff_png);
theme.btnRUOff = _texture("GENERAL", "button_ru_off", theme.btnRUOff);
theme.btnRUOffs.fromPNG(butruoffs_png);
TexHandle.fromPNG(theme.btnRUOffs, butruoffs_png);
theme.btnRUOffs = _texture("GENERAL", "button_ru_off_selected", theme.btnRUOffs);
theme.btnKOOn.fromPNG(butkoon_png);
TexHandle.fromPNG(theme.btnKOOn, butkoon_png);
theme.btnKOOn = _texture("GENERAL", "button_ko_on", theme.btnKOOn);
theme.btnKOOns.fromPNG(butkoons_png);
TexHandle.fromPNG(theme.btnKOOns, butkoons_png);
theme.btnKOOns = _texture("GENERAL", "button_ko_on_selected", theme.btnKOOns);
theme.btnKOOff.fromPNG(butkooff_png);
TexHandle.fromPNG(theme.btnKOOff, butkooff_png);
theme.btnKOOff = _texture("GENERAL", "button_ko_off", theme.btnKOOff);
theme.btnKOOffs.fromPNG(butkooffs_png);
TexHandle.fromPNG(theme.btnKOOffs, butkooffs_png);
theme.btnKOOffs = _texture("GENERAL", "button_ko_off_selected", theme.btnKOOffs);
theme.btnZHCNOn.fromPNG(butzhcnon_png);
TexHandle.fromPNG(theme.btnZHCNOn, butzhcnon_png);
theme.btnZHCNOn = _texture("GENERAL", "button_zhcn_on", theme.btnZHCNOn);
theme.btnZHCNOns.fromPNG(butzhcnons_png);
TexHandle.fromPNG(theme.btnZHCNOns, butzhcnons_png);
theme.btnZHCNOns = _texture("GENERAL", "button_zhcn_on_selected", theme.btnZHCNOns);
theme.btnZHCNOff.fromPNG(butzhcnoff_png);
TexHandle.fromPNG(theme.btnZHCNOff, butzhcnoff_png);
theme.btnZHCNOff = _texture("GENERAL", "button_zhcn_off", theme.btnZHCNOff);
theme.btnZHCNOffs.fromPNG(butzhcnoffs_png);
TexHandle.fromPNG(theme.btnZHCNOffs, butzhcnoffs_png);
theme.btnZHCNOffs = _texture("GENERAL", "button_zhcn_off_selected", theme.btnZHCNOffs);
theme.checkboxoff.fromPNG(checkbox_png);
TexHandle.fromPNG(theme.checkboxoff, checkbox_png);
theme.checkboxoff = _texture("GENERAL", "checkbox_off", theme.checkboxoff);
theme.checkboxoffs.fromPNG(checkbox_png);
TexHandle.fromPNG(theme.checkboxoffs, checkbox_png);
theme.checkboxoffs = _texture("GENERAL", "checkbox_off_selected", theme.checkboxoffs);
theme.checkboxon.fromPNG(checkboxs_png);
TexHandle.fromPNG(theme.checkboxon, checkboxs_png);
theme.checkboxon = _texture("GENERAL", "checkbox_on", theme.checkboxon);
theme.checkboxons.fromPNG(checkboxs_png);
TexHandle.fromPNG(theme.checkboxons, checkboxs_png);
theme.checkboxons = _texture("GENERAL", "checkbox_on_selected", theme.checkboxons);
theme.checkboxHid.fromPNG(checkboxhid_png);
TexHandle.fromPNG(theme.checkboxHid, checkboxhid_png);
theme.checkboxHid = _texture("GENERAL", "checkbox_Hid", theme.checkboxHid);
theme.checkboxHids.fromPNG(checkboxhid_png);
TexHandle.fromPNG(theme.checkboxHids, checkboxhid_png);
theme.checkboxHids = _texture("GENERAL", "checkbox_Hid_selected", theme.checkboxHids);
theme.checkboxReq.fromPNG(checkboxreq_png);
TexHandle.fromPNG(theme.checkboxReq, checkboxreq_png);
theme.checkboxReq = _texture("GENERAL", "checkbox_Req", theme.checkboxReq);
theme.checkboxReqs.fromPNG(checkboxreq_png);
TexHandle.fromPNG(theme.checkboxReqs, checkboxreq_png);
theme.checkboxReqs = _texture("GENERAL", "checkbox_Req_selected", theme.checkboxReqs);
theme.pbarTexL.fromPNG(pbarleft_png);
TexHandle.fromPNG(theme.pbarTexL, pbarleft_png);
theme.pbarTexL = _texture("GENERAL", "progressbar_texture_left", theme.pbarTexL);
theme.pbarTexR.fromPNG(pbarright_png);
TexHandle.fromPNG(theme.pbarTexR, pbarright_png);
theme.pbarTexR = _texture("GENERAL", "progressbar_texture_right", theme.pbarTexR);
theme.pbarTexC.fromPNG(pbarcenter_png);
TexHandle.fromPNG(theme.pbarTexC, pbarcenter_png);
theme.pbarTexC = _texture("GENERAL", "progressbar_texture_center", theme.pbarTexC);
theme.pbarTexLS.fromPNG(pbarlefts_png);
TexHandle.fromPNG(theme.pbarTexLS, pbarlefts_png);
theme.pbarTexLS = _texture("GENERAL", "progressbar_texture_left_selected", theme.pbarTexLS);
theme.pbarTexRS.fromPNG(pbarrights_png);
TexHandle.fromPNG(theme.pbarTexRS, pbarrights_png);
theme.pbarTexRS = _texture("GENERAL", "progressbar_texture_right_selected", theme.pbarTexRS);
theme.pbarTexCS.fromPNG(pbarcenters_png);
TexHandle.fromPNG(theme.pbarTexCS, pbarcenters_png);
theme.pbarTexCS = _texture("GENERAL", "progressbar_texture_center_selected", theme.pbarTexCS);
theme.btnTexPlus.fromPNG(btnplus_png);
TexHandle.fromPNG(theme.btnTexPlus, btnplus_png);
theme.btnTexPlus = _texture("GENERAL", "plus_button_texture", theme.btnTexPlus);
theme.btnTexPlusS.fromPNG(btnpluss_png);
TexHandle.fromPNG(theme.btnTexPlusS, btnpluss_png);
theme.btnTexPlusS = _texture("GENERAL", "plus_button_texture_selected", theme.btnTexPlusS);
theme.btnTexMinus.fromPNG(btnminus_png);
TexHandle.fromPNG(theme.btnTexMinus, btnminus_png);
theme.btnTexMinus = _texture("GENERAL", "minus_button_texture", theme.btnTexMinus);
theme.btnTexMinusS.fromPNG(btnminuss_png);
TexHandle.fromPNG(theme.btnTexMinusS, btnminuss_png);
theme.btnTexMinusS = _texture("GENERAL", "minus_button_texture_selected", theme.btnTexMinusS);
// Default background
theme.bg.fromJPG(background_jpg, background_jpg_size);
m_mainBgLQ.fromJPG(background_jpg, background_jpg_size, GX_TF_CMPR, 64, 64);
TexHandle.fromJPG(theme.bg, background_jpg, background_jpg_size);
TexHandle.fromJPG(m_mainBgLQ, background_jpg, background_jpg_size, GX_TF_CMPR, 64, 64);
m_gameBgLQ = m_mainBgLQ;
// Build menus
@ -1257,9 +1256,9 @@ SFont CMenu::_font(CMenu::FontSet &fontSet, const char *domain, const char *key,
return retFont;
}
vector<STexture> CMenu::_textures(const char *domain, const char *key)
vector<TexData> CMenu::_textures(const char *domain, const char *key)
{
vector<STexture> textures;
vector<TexData> textures;
if (m_theme.loaded())
{
@ -1272,8 +1271,8 @@ vector<STexture> CMenu::_textures(const char *domain, const char *key)
TexSet::iterator i = theme.texSet.find(filename);
if (i != theme.texSet.end())
textures.push_back(i->second);
STexture tex;
if(tex.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), filename.c_str())) == TE_OK)
TexData tex;
if(TexHandle.fromImageFile(tex, fmt("%s/%s", m_themeDataDir.c_str(), filename.c_str())) == TE_OK)
{
theme.texSet[filename] = tex;
textures.push_back(tex);
@ -1284,7 +1283,7 @@ vector<STexture> CMenu::_textures(const char *domain, const char *key)
return textures;
}
STexture CMenu::_texture(const char *domain, const char *key, STexture &def, bool freeDef)
TexData CMenu::_texture(const char *domain, const char *key, TexData &def, bool freeDef)
{
string filename;
@ -1298,8 +1297,8 @@ STexture CMenu::_texture(const char *domain, const char *key, STexture &def, boo
if(i != theme.texSet.end())
return i->second;
/* Load from image file */
STexture tex;
if(tex.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), filename.c_str())) == TE_OK)
TexData tex;
if(TexHandle.fromImageFile(tex, fmt("%s/%s", m_themeDataDir.c_str(), filename.c_str())) == TE_OK)
{
if(freeDef && def.data != NULL)
{
@ -1438,14 +1437,14 @@ s16 CMenu::_addSelButton(const char *domain, SFont font, const wstringEx &text,
return m_btnMgr.addButton(font, text, x, y, width, height, c, btnTexSet, clickSound, hoverSound);
}
s16 CMenu::_addPicButton(const char *domain, STexture &texNormal, STexture &texSelected, int x, int y, u32 width, u32 height)
s16 CMenu::_addPicButton(const char *domain, TexData &texNormal, TexData &texSelected, int x, int y, u32 width, u32 height)
{
x = m_theme.getInt(domain, "x", x);
y = m_theme.getInt(domain, "y", y);
width = m_theme.getInt(domain, "width", width);
height = m_theme.getInt(domain, "height", height);
STexture tex1 = _texture(domain, "texture_normal", texNormal, false);
STexture tex2 = _texture(domain, "texture_selected", texSelected, false);
TexData tex1 = _texture(domain, "texture_normal", texNormal, false);
TexData tex2 = _texture(domain, "texture_selected", texSelected, false);
GuiSound *clickSound = _sound(theme.soundSet, domain, "click_sound", theme.clickSound->GetName());
GuiSound *hoverSound = _sound(theme.soundSet, domain, "hover_sound", theme.hoverSound->GetName());
@ -1521,7 +1520,7 @@ s16 CMenu::_addLabel(const char *domain, SFont font, const wstringEx &text, int
return m_btnMgr.addLabel(font, text, x, y, width, height, c, style);
}
s16 CMenu::_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 CMenu::_addLabel(const char *domain, SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color, s16 style, TexData &bg)
{
CColor c(color);
@ -1531,7 +1530,7 @@ s16 CMenu::_addLabel(const char *domain, SFont font, const wstringEx &text, int
width = m_theme.getInt(domain, "width", width);
height = m_theme.getInt(domain, "height", height);
font = _font(theme.fontSet, domain, "font", BUTTONFONT);
STexture texBg = _texture(domain, "background_texture", bg, false);
TexData texBg = _texture(domain, "background_texture", bg, false);
style = _textStyle(domain, "style", style);
u16 btnPos = _textStyle(domain, "elmstyle", FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP);
@ -1606,7 +1605,7 @@ void CMenu::_addUserLabels(s16 *ids, u32 start, u32 size, const char *domain)
string dom(fmt("%s/USER%i", domain, i + 1));
if (m_theme.hasDomain(dom))
{
STexture emptyTex;
TexData emptyTex;
ids[i] = _addLabel(dom.c_str(), theme.lblFont, L"", 40, 200, 64, 64, CColor(0xFFFFFFFF), 0, emptyTex);
_setHideAnim(ids[i], dom.c_str(), -50, 0, 0.f, 0.f);
}
@ -1947,11 +1946,13 @@ void CMenu::_initCF(void)
CoverFlow.setHQcover(m_cfg.getBool("GENERAL", "cover_use_hq", false));
CoverFlow.start();
bool path = (m_current_view == COVERFLOW_PLUGIN || m_current_view == COVERFLOW_HOMEBREW);
if((m_curGameId != NULL && !CoverFlow.findId(m_curGameId, true, path)) ||
!CoverFlow.findId(m_cfg.getString(domain, "current_item").c_str(), true, path))
CoverFlow.defaultLoad();
CoverFlow.startCoverLoader();
if(!CoverFlow.empty())
{
bool path = (m_current_view == COVERFLOW_PLUGIN || m_current_view == COVERFLOW_HOMEBREW);
if(!CoverFlow.findId(m_cfg.getString(domain, "current_item").c_str(), true, path))
CoverFlow.defaultLoad();
CoverFlow.startCoverLoader();
}
}
void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
@ -2077,7 +2078,7 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
#endif
}
void CMenu::_setBg(const STexture &tex, const STexture &lqTex)
void CMenu::_setBg(const TexData &tex, const TexData &lqTex)
{
/* Not setting same bg again */
if(m_nextBg == &tex)

View File

@ -78,7 +78,6 @@ private:
bool m_music_info;
s16 m_showtimer;
string m_curLanguage;
const char *m_curGameId;
u8 m_numCFVersions;
@ -118,29 +117,29 @@ private:
string m_ver;
/* End Updates */
//
STexture m_curBg;
const STexture *m_prevBg;
const STexture *m_nextBg;
const STexture *m_lqBg;
TexData m_curBg;
const TexData *m_prevBg;
const TexData *m_nextBg;
const TexData *m_lqBg;
u8 m_bgCrossFade;
//
STexture m_errorBg;
STexture m_mainBg;
STexture m_configBg;
STexture m_config3Bg;
STexture m_configScreenBg;
STexture m_config4Bg;
STexture m_configAdvBg;
STexture m_configSndBg;
STexture m_downloadBg;
STexture m_gameBg;
STexture m_codeBg;
STexture m_aboutBg;
STexture m_systemBg;
STexture m_wbfsBg;
STexture m_gameSettingsBg;
STexture m_gameBgLQ;
STexture m_mainBgLQ;
TexData m_errorBg;
TexData m_mainBg;
TexData m_configBg;
TexData m_config3Bg;
TexData m_configScreenBg;
TexData m_config4Bg;
TexData m_configAdvBg;
TexData m_configSndBg;
TexData m_downloadBg;
TexData m_gameBg;
TexData m_codeBg;
TexData m_aboutBg;
TexData m_systemBg;
TexData m_wbfsBg;
TexData m_gameSettingsBg;
TexData m_gameBgLQ;
TexData m_mainBgLQ;
//Main Coverflow
s16 m_mainBtnConfig;
s16 m_mainBtnInfo;
@ -534,7 +533,7 @@ private:
s16 m_cheatLblItem[4];
s16 m_cheatBtnItem[4];
s16 m_cheatLblUser[4];
STexture m_cheatBg;
TexData m_cheatBg;
GCTCheats m_cheatfile;
// Gameinfo menu
s16 m_gameinfoLblTitle;
@ -550,11 +549,11 @@ private:
s16 m_gameinfoLblUser[5];
s16 m_gameinfoLblControlsReq[4];
s16 m_gameinfoLblControls[4];
STexture m_gameinfoBg;
STexture m_rating;
STexture m_wifi;
STexture m_controlsreq[4];
STexture m_controls[4];
TexData m_gameinfoBg;
TexData m_rating;
TexData m_wifi;
TexData m_controlsreq[4];
TexData m_controls[4];
// NandEmulation
string m_saveExtGameId;
bool m_forceext;
@ -677,7 +676,7 @@ private:
};
typedef pair<string, u32> FontDesc;
typedef map<FontDesc, SFont> FontSet;
typedef map<string, STexture> TexSet;
typedef map<string, TexData> TexSet;
typedef map<string, GuiSound*> SoundSet;
struct SThemeData
{
@ -694,85 +693,85 @@ private:
CColor titleFontColor;
CColor selubtnFontColor;
CColor selsbtnFontColor;
STexture bg;
STexture btnTexL;
STexture btnTexR;
STexture btnTexC;
STexture btnTexLS;
STexture btnTexRS;
STexture btnTexCS;
STexture btnTexLH;
STexture btnTexRH;
STexture btnTexCH;
STexture btnTexLSH;
STexture btnTexRSH;
STexture btnTexCSH;
STexture btnAUOn;
STexture btnAUOns;
STexture btnAUOff;
STexture btnAUOffs;
STexture btnENOn;
STexture btnENOns;
STexture btnENOff;
STexture btnENOffs;
STexture btnJAOn;
STexture btnJAOns;
STexture btnJAOff;
STexture btnJAOffs;
STexture btnFROn;
STexture btnFROns;
STexture btnFROff;
STexture btnFROffs;
STexture btnDEOn;
STexture btnDEOns;
STexture btnDEOff;
STexture btnDEOffs;
STexture btnESOn;
STexture btnESOns;
STexture btnESOff;
STexture btnESOffs;
STexture btnITOn;
STexture btnITOns;
STexture btnITOff;
STexture btnITOffs;
STexture btnNLOn;
STexture btnNLOns;
STexture btnNLOff;
STexture btnNLOffs;
STexture btnPTOn;
STexture btnPTOns;
STexture btnPTOff;
STexture btnPTOffs;
STexture btnRUOn;
STexture btnRUOns;
STexture btnRUOff;
STexture btnRUOffs;
STexture btnKOOn;
STexture btnKOOns;
STexture btnKOOff;
STexture btnKOOffs;
STexture btnZHCNOn;
STexture btnZHCNOns;
STexture btnZHCNOff;
STexture btnZHCNOffs;
STexture checkboxoff;
STexture checkboxoffs;
STexture checkboxon;
STexture checkboxons;
STexture checkboxHid;
STexture checkboxHids;
STexture checkboxReq;
STexture checkboxReqs;
STexture pbarTexL;
STexture pbarTexR;
STexture pbarTexC;
STexture pbarTexLS;
STexture pbarTexRS;
STexture pbarTexCS;
STexture btnTexPlus;
STexture btnTexPlusS;
STexture btnTexMinus;
STexture btnTexMinusS;
TexData bg;
TexData btnTexL;
TexData btnTexR;
TexData btnTexC;
TexData btnTexLS;
TexData btnTexRS;
TexData btnTexCS;
TexData btnTexLH;
TexData btnTexRH;
TexData btnTexCH;
TexData btnTexLSH;
TexData btnTexRSH;
TexData btnTexCSH;
TexData btnAUOn;
TexData btnAUOns;
TexData btnAUOff;
TexData btnAUOffs;
TexData btnENOn;
TexData btnENOns;
TexData btnENOff;
TexData btnENOffs;
TexData btnJAOn;
TexData btnJAOns;
TexData btnJAOff;
TexData btnJAOffs;
TexData btnFROn;
TexData btnFROns;
TexData btnFROff;
TexData btnFROffs;
TexData btnDEOn;
TexData btnDEOns;
TexData btnDEOff;
TexData btnDEOffs;
TexData btnESOn;
TexData btnESOns;
TexData btnESOff;
TexData btnESOffs;
TexData btnITOn;
TexData btnITOns;
TexData btnITOff;
TexData btnITOffs;
TexData btnNLOn;
TexData btnNLOns;
TexData btnNLOff;
TexData btnNLOffs;
TexData btnPTOn;
TexData btnPTOns;
TexData btnPTOff;
TexData btnPTOffs;
TexData btnRUOn;
TexData btnRUOns;
TexData btnRUOff;
TexData btnRUOffs;
TexData btnKOOn;
TexData btnKOOns;
TexData btnKOOff;
TexData btnKOOffs;
TexData btnZHCNOn;
TexData btnZHCNOns;
TexData btnZHCNOff;
TexData btnZHCNOffs;
TexData checkboxoff;
TexData checkboxoffs;
TexData checkboxon;
TexData checkboxons;
TexData checkboxHid;
TexData checkboxHids;
TexData checkboxReq;
TexData checkboxReqs;
TexData pbarTexL;
TexData pbarTexR;
TexData pbarTexC;
TexData pbarTexLS;
TexData pbarTexRS;
TexData pbarTexCS;
TexData btnTexPlus;
TexData btnTexPlusS;
TexData btnTexMinus;
TexData btnTexMinusS;
GuiSound *clickSound;
GuiSound *hoverSound;
GuiSound *cameraSound;
@ -896,7 +895,7 @@ private:
//
void _showError(void);
void _showMain(void);
void _showConfigCommon(const STexture & bg, int page);
void _showConfigCommon(const TexData & bg, int page);
void _showConfig(void);
void _showConfig3(void);
void _showConfigScreen(void);
@ -929,7 +928,7 @@ private:
void _checkForSinglePlugin(void);
void _getIDCats(void);
void _setIDCats(void);
void _setBg(const STexture &tex, const STexture &lqTex);
void _setBg(const TexData &tex, const TexData &lqTex);
void _updateBg(void);
void _drawBg(void);
void _updateText(void);
@ -1003,8 +1002,8 @@ 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(const char *domain, const char *key, STexture &def, bool freeDef = true);
vector<STexture> _textures(const char *domain, const char *key);
TexData _texture(const char *domain, const char *key, TexData &def, bool freeDef = true);
vector<TexData> _textures(const char *domain, const char *key);
void _showWaitMessage();
public:
void _hideWaitMessage();
@ -1015,11 +1014,11 @@ private:
u16 _textStyle(const char *domain, const char *key, u16 def);
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 _addPicButton(const char *domain, TexData &texNormal, TexData &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 _addLabel(const char *domain, SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color, s16 style, TexData &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(s16 *ids, u32 size, const char *domain);

View File

@ -92,7 +92,6 @@ void CMenu::_showAbout(void)
void CMenu::_initAboutMenu()
{
STexture emptyTex;
_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);

View File

@ -16,7 +16,7 @@ s16 m_categoryBtnCats[11];
s16 m_categoryBtnCatHid[11];
s16 m_categoryBtnCatReq[11];
s16 m_categoryLblUser[4];
STexture m_categoryBg;
TexData m_categoryBg;
vector<char> m_categories;
u8 curPage;

View File

@ -565,7 +565,7 @@ const char *CMenu::_cfDomain(bool selected)
void CMenu::_initCFThemeMenu()
{
STexture emptyTex;
TexData emptyTex;
string domain;
int x;
int y;
@ -592,4 +592,3 @@ void CMenu::_initCFThemeMenu()
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

@ -35,7 +35,7 @@ void CMenu::_hideConfig(bool instant)
m_btnMgr.hide(m_configLblUser[i], instant);
}
void CMenu::_showConfigCommon(const STexture & bg, int page)
void CMenu::_showConfigCommon(const TexData &bg, int page)
{
_setBg(bg, bg);
m_btnMgr.show(m_configLblTitle);
@ -84,7 +84,6 @@ void CMenu::_cfNeedsUpdate(void)
void CMenu::_config(int page)
{
m_curGameId = CoverFlow.getId();
m_cfNeedsUpdate = false;
int change = CONFIG_PAGE_NO_CHANGE;
while(!m_exit)

View File

@ -60,9 +60,8 @@ void CMenu::_showError(void)
void CMenu::_initErrorMenu()
{
STexture texIcon;
texIcon.fromPNG(error_png);
TexData texIcon;
TexHandle.fromPNG(texIcon, error_png);
_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);

View File

@ -334,8 +334,8 @@ void CMenu::_showGame(void)
if(m_fa.load(m_cfg, m_fanartDir.c_str(), CoverFlow.getId()))
{
const STexture *bg = NULL;
const STexture *bglq = NULL;
const TexData *bg = NULL;
const TexData *bglq = NULL;
m_fa.getBackground(bg, bglq);
if(bg != NULL && bglq != NULL)
_setBg(*bg, *bglq);
@ -449,7 +449,7 @@ void CMenu::_game(bool launch)
m_banner.SetShowBanner(false);
_hideGame();
/* Set Background empty */
STexture EmptyBG;
TexData EmptyBG;
_setBg(EmptyBG, EmptyBG);
/* Lets play the movie */
WiiMovie movie(videoPath);
@ -471,7 +471,7 @@ void CMenu::_game(bool launch)
ButtonsPressed();
}
movie.Stop();
m_curBg.Cleanup();
TexHandle.Cleanup(m_curBg);
/* Finished, so lets re-setup the background */
_setBg(m_mainBg, m_mainBgLQ);
_updateBg();
@ -1376,38 +1376,38 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
void CMenu::_initGameMenu()
{
CColor fontColor(0xD0BFDFFF);
STexture texFavOn;
STexture texFavOnSel;
STexture texFavOff;
STexture texFavOffSel;
STexture texAdultOn;
STexture texAdultOnSel;
STexture texAdultOff;
STexture texAdultOffSel;
STexture texDelete;
STexture texDeleteSel;
STexture texSettings;
STexture texSettingsSel;
STexture texToogleBanner;
STexture bgLQ;
TexData texFavOn;
TexData texFavOnSel;
TexData texFavOff;
TexData texFavOffSel;
TexData texAdultOn;
TexData texAdultOnSel;
TexData texAdultOff;
TexData texAdultOffSel;
TexData texDelete;
TexData texDeleteSel;
TexData texSettings;
TexData texSettingsSel;
TexData texToogleBanner;
TexData bgLQ;
texFavOn.fromPNG(favoriteson_png);
texFavOnSel.fromPNG(favoritesons_png);
texFavOff.fromPNG(favoritesoff_png);
texFavOffSel.fromPNG(favoritesoffs_png);
texAdultOn.fromPNG(stopkidon_png);
texAdultOnSel.fromPNG(stopkidons_png);
texAdultOff.fromPNG(stopkidoff_png);
texAdultOffSel.fromPNG(stopkidoffs_png);
texDelete.fromPNG(delete_png);
texDeleteSel.fromPNG(deletes_png);
texSettings.fromPNG(btngamecfg_png);
texSettingsSel.fromPNG(btngamecfgs_png);
texToogleBanner.fromPNG(blank_png);
TexHandle.fromPNG(texFavOn, favoriteson_png);
TexHandle.fromPNG(texFavOnSel, favoritesons_png);
TexHandle.fromPNG(texFavOff, favoritesoff_png);
TexHandle.fromPNG(texFavOffSel, favoritesoffs_png);
TexHandle.fromPNG(texAdultOn, stopkidon_png);
TexHandle.fromPNG(texAdultOnSel, stopkidons_png);
TexHandle.fromPNG(texAdultOff, stopkidoff_png);
TexHandle.fromPNG(texAdultOffSel, stopkidoffs_png);
TexHandle.fromPNG(texDelete, delete_png);
TexHandle.fromPNG(texDeleteSel, deletes_png);
TexHandle.fromPNG(texSettings, btngamecfg_png);
TexHandle.fromPNG(texSettingsSel, btngamecfgs_png);
TexHandle.fromPNG(texToogleBanner, blank_png);
_addUserLabels(m_gameLblUser, ARRAY_SIZE(m_gameLblUser), "GAME");
m_gameBg = _texture("GAME/BG", "texture", theme.bg, false);
if(m_theme.loaded() && bgLQ.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), m_theme.getString("GAME/BG", "texture").c_str()), GX_TF_CMPR, 64, 64) == TE_OK)
if(m_theme.loaded() && TexHandle.fromImageFile(bgLQ, fmt("%s/%s", m_themeDataDir.c_str(), m_theme.getString("GAME/BG", "texture").c_str()), GX_TF_CMPR, 64, 64) == TE_OK)
m_gameBgLQ = bgLQ;
m_gameBtnPlay = _addButton("GAME/PLAY_BTN", theme.btnFont, L"", 420, 344, 200, 56, theme.btnFontColor);

View File

@ -254,7 +254,7 @@ void CMenu::_showGameInfo(void)
void CMenu::_initGameInfoMenu()
{
STexture emptyTex;
TexData emptyTex;
_addUserLabels(m_gameinfoLblUser, 0, 1, "GAMEINFO");
_addUserLabels(m_gameinfoLblUser, 2, 1, "GAMEINFO");
@ -356,7 +356,7 @@ void CMenu::_textGameInfo(void)
break;
}
//Ratings
m_rating.fromJPG(norating_jpg, norating_jpg_size);
TexHandle.fromJPG(m_rating, norating_jpg, norating_jpg_size);
const char *RatingValue = NULL;
if(gametdb.GetRatingValue(GameID, RatingValue))
{
@ -364,51 +364,51 @@ void CMenu::_textGameInfo(void)
{
case GAMETDB_RATING_TYPE_CERO:
if(RatingValue[0] == 'A')
m_rating.fromPNG(cero_a_png);
TexHandle.fromPNG(m_rating, cero_a_png);
else if(RatingValue[0] == 'B')
m_rating.fromPNG(cero_b_png);
TexHandle.fromPNG(m_rating, cero_b_png);
else if(RatingValue[0] == 'D')
m_rating.fromPNG(cero_d_png);
TexHandle.fromPNG(m_rating, cero_d_png);
else if(RatingValue[0] == 'C')
m_rating.fromPNG(cero_c_png);
TexHandle.fromPNG(m_rating, cero_c_png);
else if(RatingValue[0] == 'Z')
m_rating.fromPNG(cero_z_png);
TexHandle.fromPNG(m_rating, cero_z_png);
break;
case GAMETDB_RATING_TYPE_ESRB:
if(RatingValue[0] == 'E')
m_rating.fromJPG(esrb_e_jpg, esrb_e_jpg_size);
TexHandle.fromJPG(m_rating, esrb_e_jpg, esrb_e_jpg_size);
else if(memcmp(RatingValue, "EC", 2) == 0)
m_rating.fromJPG(esrb_ec_jpg, esrb_ec_jpg_size);
TexHandle.fromJPG(m_rating, esrb_ec_jpg, esrb_ec_jpg_size);
else if(memcmp(RatingValue, "E10+", 4) == 0)
m_rating.fromJPG(esrb_eten_jpg, esrb_eten_jpg_size);
TexHandle.fromJPG(m_rating, esrb_eten_jpg, esrb_eten_jpg_size);
else if(RatingValue[0] == 'T')
m_rating.fromJPG(esrb_t_jpg, esrb_t_jpg_size);
TexHandle.fromJPG(m_rating, esrb_t_jpg, esrb_t_jpg_size);
else if(RatingValue[0] == 'M')
m_rating.fromJPG(esrb_m_jpg, esrb_m_jpg_size);
TexHandle.fromJPG(m_rating, esrb_m_jpg, esrb_m_jpg_size);
else if(memcmp(RatingValue, "AO", 2) == 0)
m_rating.fromJPG(esrb_ao_jpg, esrb_ao_jpg_size);
TexHandle.fromJPG(m_rating, esrb_ao_jpg, esrb_ao_jpg_size);
break;
case GAMETDB_RATING_TYPE_PEGI:
if(RatingValue[0] == '3')
m_rating.fromPNG(pegi_3_png);
TexHandle.fromPNG(m_rating, pegi_3_png);
else if(RatingValue[0] == '7')
m_rating.fromPNG(pegi_7_png);
TexHandle.fromPNG(m_rating, pegi_7_png);
else if(memcmp(RatingValue, "12", 2) == 0)
m_rating.fromPNG(pegi_12_png);
TexHandle.fromPNG(m_rating, pegi_12_png);
else if(memcmp(RatingValue, "16", 2) == 0)
m_rating.fromPNG(pegi_16_png);
TexHandle.fromPNG(m_rating, pegi_16_png);
else if(memcmp(RatingValue, "18", 2) == 0)
m_rating.fromPNG(pegi_18_png);
TexHandle.fromPNG(m_rating, pegi_18_png);
break;
case GAMETDB_RATING_TYPE_GRB:
if(RatingValue[0] == 'A')
m_rating.fromPNG(grb_a_png);
TexHandle.fromPNG(m_rating, grb_a_png);
else if(memcmp(RatingValue, "12", 2) == 0)
m_rating.fromPNG(grb_12_png);
TexHandle.fromPNG(m_rating, grb_12_png);
else if(memcmp(RatingValue, "15", 2) == 0)
m_rating.fromPNG(grb_15_png);
TexHandle.fromPNG(m_rating, grb_15_png);
else if(memcmp(RatingValue, "18", 2) == 0)
m_rating.fromPNG(grb_18_png);
TexHandle.fromPNG(m_rating, grb_18_png);
break;
default:
break;
@ -417,25 +417,25 @@ void CMenu::_textGameInfo(void)
m_btnMgr.setTexture(m_gameinfoLblRating, m_rating);
//Wifi players
int WifiPlayers = gametdb.GetWifiPlayers(GameID);
STexture emptyTex;
TexData emptyTex;
if(WifiPlayers == 1)
m_wifi.fromPNG(wifi1_png);
TexHandle.fromPNG(m_wifi, wifi1_png);
else if(WifiPlayers == 2)
m_wifi.fromPNG(wifi2_png);
TexHandle.fromPNG(m_wifi, wifi2_png);
else if(WifiPlayers == 4)
m_wifi.fromPNG(wifi4_png);
TexHandle.fromPNG(m_wifi, wifi4_png);
else if(WifiPlayers == 8)
m_wifi.fromPNG(wifi8_png);
TexHandle.fromPNG(m_wifi, wifi8_png);
else if(WifiPlayers == 10)
m_wifi.fromPNG(wifi10_png);
TexHandle.fromPNG(m_wifi, wifi10_png);
else if(WifiPlayers == 12)
m_wifi.fromPNG(wifi12_png);
TexHandle.fromPNG(m_wifi, wifi12_png);
else if(WifiPlayers == 16)
m_wifi.fromPNG(wifi16_png);
TexHandle.fromPNG(m_wifi, wifi16_png);
else if(WifiPlayers == 18)
m_wifi.fromPNG(wifi18_png);
TexHandle.fromPNG(m_wifi, wifi18_png);
else if(WifiPlayers == 32)
m_wifi.fromPNG(wifi32_png);
TexHandle.fromPNG(m_wifi, wifi32_png);
if(WifiPlayers > 0)
m_btnMgr.setTexture(m_gameinfoLblWifiplayers, m_wifi);
else
@ -490,68 +490,66 @@ void CMenu::_textGameInfo(void)
u8 players = gametdb.GetPlayers(GameID);
if(players >= 10)
players /= 10;
if(players == 1)
m_controlsreq[x].fromPNG(wiimote1_png);
TexHandle.fromPNG(m_controlsreq[x], wiimote1_png);
else if(players == 2)
m_controlsreq[x].fromPNG(wiimote2_png);
TexHandle.fromPNG(m_controlsreq[x], wiimote2_png);
else if(players == 3)
m_controlsreq[x].fromPNG(wiimote3_png);
TexHandle.fromPNG(m_controlsreq[x], wiimote3_png);
else if(players == 4)
m_controlsreq[x].fromPNG(wiimote4_png);
TexHandle.fromPNG(m_controlsreq[x], wiimote4_png);
else if(players == 6)
m_controlsreq[x].fromPNG(wiimote6_png);
TexHandle.fromPNG(m_controlsreq[x], wiimote6_png);
else if(players == 8)
m_controlsreq[x].fromPNG(wiimote8_png);
TexHandle.fromPNG(m_controlsreq[x], wiimote8_png);
m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 20, 60);
x++;
}
if(nunchuk && x < max_controlsReq)
{
m_controlsreq[x].fromPNG(nunchukR_png);
TexHandle.fromPNG(m_controlsreq[x], nunchukR_png);
m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 52, 60);
x++;
}
if(guitar && x < max_controlsReq)
{
m_controlsreq[x].fromPNG(guitarR_png);
TexHandle.fromPNG(m_controlsreq[x], guitarR_png);
m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 52, 60);
x++;
}
if(drums && x < max_controlsReq)
{
m_controlsreq[x].fromPNG(drumsR_png);
TexHandle.fromPNG(m_controlsreq[x], drumsR_png);
m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 52, 60);
x++;
}
if(motionplus && x < max_controlsReq)
{
m_controlsreq[x].fromPNG(motionplusR_png);
TexHandle.fromPNG(m_controlsreq[x], motionplusR_png);
m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 20, 60);
x++;
}
if(dancepad && x < max_controlsReq)
{
m_controlsreq[x].fromPNG(dancepadR_png);
TexHandle.fromPNG(m_controlsreq[x], dancepadR_png);
m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 52, 60);
x++;
}
if(microphone && x < max_controlsReq)
{
m_controlsreq[x].fromPNG(microphoneR_png);
TexHandle.fromPNG(m_controlsreq[x], microphoneR_png);
m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 52, 60);
x++;
}
if(balanceboard && x < max_controlsReq)
{
m_controlsreq[x].fromPNG(balanceboardR_png);
TexHandle.fromPNG(m_controlsreq[x], balanceboardR_png);
m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 52, 60);
x++;
}
if(udraw && x < max_controlsReq)
{
m_controlsreq[x].fromPNG(udrawR_png);
TexHandle.fromPNG(m_controlsreq[x], udrawR_png);
m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 52, 60);
x++;
}
@ -607,79 +605,79 @@ void CMenu::_textGameInfo(void)
u8 max_controls = ARRAY_SIZE(m_gameinfoLblControls);
if(classiccontroller && x < max_controls)
{
m_controls[x].fromPNG(classiccontroller_png);
TexHandle.fromPNG(m_controls[x], classiccontroller_png);
m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
x++;
}
if(nunchuk && x < max_controls)
{
m_controls[x].fromPNG(nunchuk_png);
TexHandle.fromPNG(m_controls[x], nunchuk_png);
m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
x++;
}
if(guitar && x < max_controls)
{
m_controls[x].fromPNG(guitar_png);
TexHandle.fromPNG(m_controls[x], guitar_png);
m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
x++;
}
if(drums && x < max_controls)
{
m_controls[x].fromPNG(drums_png);
TexHandle.fromPNG(m_controls[x], drums_png);
m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
x++;
}
if(dancepad && x < max_controls)
{
m_controls[x].fromPNG(dancepad_png);
TexHandle.fromPNG(m_controls[x], dancepad_png);
m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
x++;
}
if(motionplus && x < max_controls)
{
m_controls[x].fromPNG(motionplus_png);
TexHandle.fromPNG(m_controls[x], motionplus_png);
m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 20, 60);
x++;
}
if(balanceboard && x < max_controls)
{
m_controls[x].fromPNG(balanceboard_png);
TexHandle.fromPNG(m_controls[x], balanceboard_png);
m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
x++;
}
if(microphone && x < max_controls)
{
m_controls[x].fromPNG(microphone_png);
TexHandle.fromPNG(m_controls[x], microphone_png);
m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 48, 60);
x++;
}
if(gamecube && x < max_controls)
{
m_controls[x].fromPNG(gcncontroller_png);
TexHandle.fromPNG(m_controls[x], gcncontroller_png);
m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 48, 60);
x++;
}
if(keyboard && x < max_controls)
{
m_controls[x].fromPNG(keyboard_png);
TexHandle.fromPNG(m_controls[x], keyboard_png);
m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
x++;
}
if(udraw && x < max_controls)
{
m_controls[x].fromPNG(udraw_png);
TexHandle.fromPNG(m_controls[x], udraw_png);
m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
x++;
}
if(zapper && x < max_controls)
{
m_controls[x].fromPNG(zapper_png);
TexHandle.fromPNG(m_controls[x], zapper_png);
m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 70);
x++;
}
if(wheel && x < max_controls)
{
m_controls[x].fromPNG(wheel_png);
TexHandle.fromPNG(m_controls[x], wheel_png);
m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
x++;
}

View File

@ -22,7 +22,7 @@ s16 m_homeBtnExitToNeek;
s16 m_homeLblBattery;
STexture m_homeBg;
TexData m_homeBg;
bool CMenu::_Home(void)
{
@ -222,7 +222,6 @@ void CMenu::_hideExitTo(bool instant)
void CMenu::_initHomeAndExitToMenu()
{
//Home Menu
STexture emptyTex;
m_homeBg = _texture("HOME/BG", "texture", theme.bg, false);
m_homeLblTitle = _addTitle("HOME/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);

View File

@ -176,7 +176,6 @@ void CMenu::_showMain(void)
void CMenu::LoadView(void)
{
m_curGameId = NULL;
_hideMain(true);
CoverFlow.clear();
if(!m_vid.showingWaitMessage())
@ -413,7 +412,6 @@ int CMenu::main(void)
{
m_favorites = !m_favorites;
m_cfg.setBool(_domainFromView(), "favorites", m_favorites);
m_curGameId = CoverFlow.getId();
_initCF();
}
else if(!CoverFlow.empty() && CoverFlow.select())
@ -799,65 +797,65 @@ int CMenu::main(void)
void CMenu::_initMainMenu()
{
STexture texQuit;
STexture texQuitS;
STexture texInfo;
STexture texInfoS;
STexture texConfig;
STexture texConfigS;
STexture texDML;
STexture texDMLs;
STexture texEmu;
STexture texEmus;
STexture texDVD;
STexture texDVDs;
STexture texUsb;
STexture texUsbs;
STexture texChannel;
STexture texChannels;
STexture texHomebrew;
STexture texHomebrews;
STexture texPrev;
STexture texPrevS;
STexture texNext;
STexture texNextS;
STexture texFavOn;
STexture texFavOnS;
STexture texFavOff;
STexture texFavOffS;
STexture bgLQ;
STexture emptyTex;
TexData texQuit;
TexData texQuitS;
TexData texInfo;
TexData texInfoS;
TexData texConfig;
TexData texConfigS;
TexData texDML;
TexData texDMLs;
TexData texEmu;
TexData texEmus;
TexData texDVD;
TexData texDVDs;
TexData texUsb;
TexData texUsbs;
TexData texChannel;
TexData texChannels;
TexData texHomebrew;
TexData texHomebrews;
TexData texPrev;
TexData texPrevS;
TexData texNext;
TexData texNextS;
TexData texFavOn;
TexData texFavOnS;
TexData texFavOff;
TexData texFavOffS;
TexData bgLQ;
TexData emptyTex;
m_mainBg = _texture("MAIN/BG", "texture", theme.bg, false);
if(m_theme.loaded() && bgLQ.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), m_theme.getString("MAIN/BG", "texture").c_str()), GX_TF_CMPR, 64, 64) == TE_OK)
if(m_theme.loaded() && TexHandle.fromImageFile(bgLQ, fmt("%s/%s", m_themeDataDir.c_str(), m_theme.getString("MAIN/BG", "texture").c_str()), GX_TF_CMPR, 64, 64) == TE_OK)
m_mainBgLQ = bgLQ;
texQuit.fromPNG(btnquit_png);
texQuitS.fromPNG(btnquits_png);
texInfo.fromPNG(btninfo_png);
texInfoS.fromPNG(btninfos_png);
texConfig.fromPNG(btnconfig_png);
texConfigS.fromPNG(btnconfigs_png);
texDVD.fromPNG(btndvd_png);
texDVDs.fromPNG(btndvds_png);
texUsb.fromPNG(btnusb_png);
texUsbs.fromPNG(btnusbs_png);
texDML.fromPNG(btndml_png);
texDMLs.fromPNG(btndmls_png);
texEmu.fromPNG(btnemu_png);
texEmus.fromPNG(btnemus_png);
texChannel.fromPNG(btnchannel_png);
texChannels.fromPNG(btnchannels_png);
texHomebrew.fromPNG(btnhomebrew_png);
texHomebrews.fromPNG(btnhomebrews_png);
texPrev.fromPNG(btnprev_png);
texPrevS.fromPNG(btnprevs_png);
texNext.fromPNG(btnnext_png);
texNextS.fromPNG(btnnexts_png);
texFavOn.fromPNG(favoriteson_png);
texFavOnS.fromPNG(favoritesons_png);
texFavOff.fromPNG(favoritesoff_png);
texFavOffS.fromPNG(favoritesoffs_png);
TexHandle.fromPNG(texQuit, btnquit_png);
TexHandle.fromPNG(texQuitS, btnquits_png);
TexHandle.fromPNG(texInfo, btninfo_png);
TexHandle.fromPNG(texInfoS, btninfos_png);
TexHandle.fromPNG(texConfig, btnconfig_png);
TexHandle.fromPNG(texConfigS, btnconfigs_png);
TexHandle.fromPNG(texDVD, btndvd_png);
TexHandle.fromPNG(texDVDs, btndvds_png);
TexHandle.fromPNG(texUsb, btnusb_png);
TexHandle.fromPNG(texUsbs, btnusbs_png);
TexHandle.fromPNG(texDML, btndml_png);
TexHandle.fromPNG(texDMLs, btndmls_png);
TexHandle.fromPNG(texEmu, btnemu_png);
TexHandle.fromPNG(texEmus, btnemus_png);
TexHandle.fromPNG(texChannel, btnchannel_png);
TexHandle.fromPNG(texChannels, btnchannels_png);
TexHandle.fromPNG(texHomebrew, btnhomebrew_png);
TexHandle.fromPNG(texHomebrews, btnhomebrews_png);
TexHandle.fromPNG(texPrev, btnprev_png);
TexHandle.fromPNG(texPrevS, btnprevs_png);
TexHandle.fromPNG(texNext, btnnext_png);
TexHandle.fromPNG(texNextS, btnnexts_png);
TexHandle.fromPNG(texFavOn, favoriteson_png);
TexHandle.fromPNG(texFavOnS, favoritesons_png);
TexHandle.fromPNG(texFavOff, favoritesoff_png);
TexHandle.fromPNG(texFavOffS, favoritesoffs_png);
_addUserLabels(m_mainLblUser, ARRAY_SIZE(m_mainLblUser), "MAIN");

View File

@ -33,7 +33,7 @@ s16 m_nandemuBtnDisable;
s16 m_nandemuBtnPartition;
s16 m_nandemuLblInit;
s16 m_nandemuLblUser[4];
STexture m_nandemuBg;
TexData m_nandemuBg;
bool m_nandext;
bool m_fulldump;

View File

@ -19,7 +19,7 @@ s16 m_pluginBtn[11];
s16 m_pluginBtnCat[11];
s16 m_pluginBtnCats[11];
s16 m_pluginLblUser[4];
STexture m_pluginBg;
TexData m_pluginBg;
void CMenu::_hidePluginSettings(bool instant)
{

View File

@ -32,7 +32,7 @@ s16 m_sourceBtnPageP;
s16 m_sourceLblTitle;
s16 m_sourceBtnSource[12];
s16 m_sourceLblUser[4];
STexture m_sourceBg;
TexData m_sourceBg;
s16 m_sourceBtnDML;
s16 m_sourceBtnEmu;
s16 m_sourceBtnUsb;
@ -101,27 +101,27 @@ void CMenu::_updateSourceBtns(void)
m_btnMgr.show(m_sourceBtnPageP);
}
for (u8 i = 0; i < 12; ++i)
m_btnMgr.hide(m_sourceBtnSource[i], true);
m_btnMgr.hide(m_sourceBtnSource[i], true);
const char *ImgName = NULL;
u8 j = (Source_curPage - 1) * 12;
for(u8 i = 0; i < 12; ++i)
{
STexture texConsoleImg;
STexture texConsoleImgs;
TexData texConsoleImg;
TexData texConsoleImgs;
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image", "").c_str();
if(texConsoleImg.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), ImgName)) != TE_OK)
if(TexHandle.fromImageFile(texConsoleImg, fmt("%s/%s", m_themeDataDir.c_str(), ImgName)) != TE_OK)
{
if(texConsoleImg.fromImageFile(fmt("%s/%s", m_sourceDir.c_str(), ImgName)) != TE_OK)
texConsoleImg.fromPNG(favoriteson_png);
if(TexHandle.fromImageFile(texConsoleImg, fmt("%s/%s", m_sourceDir.c_str(), ImgName)) != TE_OK)
TexHandle.fromPNG(texConsoleImg, favoriteson_png);
}
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image_s", "").c_str();
if(texConsoleImgs.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), ImgName)) != TE_OK)
if(TexHandle.fromImageFile(texConsoleImgs, fmt("%s/%s", m_themeDataDir.c_str(), ImgName)) != TE_OK)
{
if(texConsoleImgs.fromImageFile(fmt("%s/%s", m_sourceDir.c_str(), ImgName)) != TE_OK)
texConsoleImgs.fromPNG(favoritesons_png);
if(TexHandle.fromImageFile(texConsoleImgs, fmt("%s/%s", m_sourceDir.c_str(), ImgName)) != TE_OK)
TexHandle.fromPNG(texConsoleImgs, favoritesons_png);
}
m_btnMgr.setBtnTexture(m_sourceBtnSource[i], texConsoleImg, texConsoleImgs);
@ -385,34 +385,34 @@ bool CMenu::_Source()
void CMenu::_initSourceMenu()
{
STexture texDML;
STexture texDMLs;
STexture texEmu;
STexture texEmus;
STexture texUsb;
STexture texUsbs;
STexture texChannel;
STexture texChannels;
STexture texHomebrew;
STexture texHomebrews;
TexData texDML;
TexData texDMLs;
TexData texEmu;
TexData texEmus;
TexData texUsb;
TexData texUsbs;
TexData texChannel;
TexData texChannels;
TexData texHomebrew;
TexData texHomebrews;
texUsb.fromPNG(btnusb_png);
texUsbs.fromPNG(btnusbs_png);
texDML.fromPNG(btndml_png);
texDMLs.fromPNG(btndmls_png);
texEmu.fromPNG(btnemu_png);
texEmus.fromPNG(btnemus_png);
texChannel.fromPNG(btnchannel_png);
texChannels.fromPNG(btnchannels_png);
texHomebrew.fromPNG(btnhomebrew_png);
texHomebrews.fromPNG(btnhomebrews_png);
TexHandle.fromPNG(texUsb, btnusb_png);
TexHandle.fromPNG(texUsbs, btnusbs_png);
TexHandle.fromPNG(texDML, btndml_png);
TexHandle.fromPNG(texDMLs, btndmls_png);
TexHandle.fromPNG(texEmu, btnemu_png);
TexHandle.fromPNG(texEmus, btnemus_png);
TexHandle.fromPNG(texChannel, btnchannel_png);
TexHandle.fromPNG(texChannels, btnchannels_png);
TexHandle.fromPNG(texHomebrew, btnhomebrew_png);
TexHandle.fromPNG(texHomebrews, btnhomebrews_png);
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(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);
@ -420,7 +420,7 @@ void CMenu::_initSourceMenu()
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", fmt("%s/source_menu", m_dataDir.c_str()));
if(!m_source.loaded())
@ -432,20 +432,20 @@ void CMenu::_initSourceMenu()
for(u8 i = 0; i < 12; ++i)
{
STexture texConsoleImg;
STexture texConsoleImgs;
TexData texConsoleImg;
TexData texConsoleImgs;
ImgName = m_source.getString(fmt("BUTTON_%i", i),"image", "");
if(texConsoleImg.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), ImgName.c_str())) != TE_OK)
if(TexHandle.fromImageFile(texConsoleImg, fmt("%s/%s", m_themeDataDir.c_str(), ImgName.c_str())) != TE_OK)
{
if(texConsoleImg.fromImageFile(fmt("%s/%s", m_sourceDir.c_str(), ImgName.c_str())) != TE_OK)
texConsoleImg.fromPNG(favoriteson_png);
if(TexHandle.fromImageFile(texConsoleImg, fmt("%s/%s", m_sourceDir.c_str(), ImgName.c_str())) != TE_OK)
TexHandle.fromPNG(texConsoleImg, favoriteson_png);
}
ImgName = m_source.getString(fmt("BUTTON_%i", i),"image_s", "");
if(texConsoleImgs.fromImageFile(fmt("%s/%s", m_themeDataDir.c_str(), ImgName.c_str())) != TE_OK)
if(TexHandle.fromImageFile(texConsoleImgs, fmt("%s/%s", m_themeDataDir.c_str(), ImgName.c_str())) != TE_OK)
{
if(texConsoleImgs.fromImageFile(fmt("%s/%s", m_sourceDir.c_str(), ImgName.c_str())) != TE_OK)
texConsoleImgs.fromPNG(favoritesons_png);
if(TexHandle.fromImageFile(texConsoleImgs, fmt("%s/%s", m_sourceDir.c_str(), ImgName.c_str())) != TE_OK)
TexHandle.fromPNG(texConsoleImgs, favoritesons_png);
}
row = i / 4;

View File

@ -242,9 +242,7 @@ void CMenu::_showSystem(void)
void CMenu::_initSystemMenu()
{
STexture emptyTex;
_addUserLabels(m_systemLblUser, ARRAY_SIZE(m_systemLblUser), "SYSTEM");
_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);