mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-12-28 12:51:52 +01:00
-fixed the strange background size problems
-fixed deleting some gamecube games properly -fixed random codedumps on switching views, entering settings etc
This commit is contained in:
parent
2356afb1c8
commit
cdf717916a
@ -213,21 +213,23 @@ void STexture::Cleanup(void)
|
||||
maxLOD = 0;
|
||||
}
|
||||
|
||||
bool STexture::CopyTexture(const STexture &tex)
|
||||
bool STexture::CopyTexture(const STexture *tex)
|
||||
{
|
||||
Cleanup();
|
||||
if(tex.data == NULL || tex.dataSize == 0)
|
||||
if(tex == this || tex == NULL || tex->data == NULL || tex->dataSize == 0)
|
||||
return false;
|
||||
data = (u8*)MEM2_alloc(tex.dataSize);
|
||||
if(dataSize != tex->dataSize)
|
||||
Cleanup();
|
||||
if(data == NULL)
|
||||
data = (u8*)MEM2_alloc(tex->dataSize);
|
||||
if(data == NULL)
|
||||
return false;
|
||||
dataSize = tex.dataSize;
|
||||
memcpy(data, tex.data, dataSize);
|
||||
dataSize = tex->dataSize;
|
||||
memcpy(data, tex->data, dataSize);
|
||||
DCFlushRange(data, dataSize);
|
||||
width = tex.width;
|
||||
height = tex.height;
|
||||
format = tex.format;
|
||||
maxLOD = tex.maxLOD;
|
||||
width = tex->width;
|
||||
height = tex->height;
|
||||
format = tex->format;
|
||||
maxLOD = tex->maxLOD;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ class STexture
|
||||
public:
|
||||
STexture(void) : data(NULL), dataSize(0), width(0), height(0), format(-1), maxLOD(0), thread(false) { }
|
||||
void Cleanup();
|
||||
bool CopyTexture(const STexture &tex);
|
||||
bool CopyTexture(const STexture *tex);
|
||||
u8 *data;
|
||||
u32 dataSize;
|
||||
u32 width;
|
||||
|
@ -144,6 +144,7 @@ CMenu::CMenu()
|
||||
m_current_view = COVERFLOW_USB;
|
||||
m_Emulator_boot = false;
|
||||
m_music_info = true;
|
||||
m_nextBg = NULL;
|
||||
}
|
||||
|
||||
void CMenu::init()
|
||||
@ -526,7 +527,7 @@ void CMenu::_Theme_Cleanup(void)
|
||||
/* Backgrounds */
|
||||
theme.bg.Cleanup();
|
||||
m_prevBg.Cleanup();
|
||||
m_nextBg.Cleanup();
|
||||
m_nextBg = NULL;
|
||||
m_curBg.Cleanup();
|
||||
m_lqBg.Cleanup();
|
||||
/* Buttons */
|
||||
@ -1938,7 +1939,7 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
|
||||
CoverFlow.setFanartTextColor(m_fa.getTextColor(m_theme.getColor("_COVERFLOW", "font_color", CColor(0xFFFFFFFF))));
|
||||
|
||||
m_vid.prepare();
|
||||
m_vid.setup2DProjection();
|
||||
m_vid.setup2DProjection(false, true);
|
||||
_updateBg();
|
||||
if(CoverFlow.getRenderTex())
|
||||
CoverFlow.RenderTex();
|
||||
@ -1965,6 +1966,7 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_vid.setup2DProjection();
|
||||
_drawBg();
|
||||
m_fa.draw(false);
|
||||
if(withCF)
|
||||
@ -2052,11 +2054,11 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
|
||||
void CMenu::_setBg(const STexture &tex, const STexture &lqTex)
|
||||
{
|
||||
m_lqBg = lqTex;
|
||||
if(tex.data == m_nextBg.data)
|
||||
if(m_nextBg == &tex)
|
||||
return;
|
||||
m_prevBg.CopyTexture(m_curBg);
|
||||
m_prevBg.CopyTexture(&m_curBg);
|
||||
m_curBg.Cleanup();
|
||||
m_nextBg.CopyTexture(tex);
|
||||
m_nextBg = &tex;
|
||||
m_bgCrossFade = 0xFF;
|
||||
}
|
||||
|
||||
@ -2068,10 +2070,9 @@ void CMenu::_updateBg(void)
|
||||
|
||||
if (m_bgCrossFade == 0) return;
|
||||
m_bgCrossFade = max(0, (int)m_bgCrossFade - 14);
|
||||
if (m_bgCrossFade == 0)
|
||||
if(m_bgCrossFade == 0)
|
||||
{
|
||||
m_curBg.Cleanup();
|
||||
m_curBg = m_nextBg;
|
||||
m_curBg.CopyTexture(m_nextBg);
|
||||
return;
|
||||
}
|
||||
GX_ClearVtxDesc();
|
||||
@ -2103,8 +2104,11 @@ void CMenu::_updateBg(void)
|
||||
GX_SetZMode(GX_DISABLE, GX_ALWAYS, GX_FALSE);
|
||||
guMtxIdentity(modelViewMtx);
|
||||
GX_LoadPosMtxImm(modelViewMtx, GX_PNMTX0);
|
||||
GX_InitTexObj(&texObj, m_nextBg.data, m_nextBg.width, m_nextBg.height, m_nextBg.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
GX_LoadTexObj(&texObj, GX_TEXMAP0);
|
||||
if(m_nextBg != NULL && m_nextBg->data != NULL)
|
||||
{
|
||||
GX_InitTexObj(&texObj, m_nextBg->data, m_nextBg->width, m_nextBg->height, m_nextBg->format, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
GX_LoadTexObj(&texObj, GX_TEXMAP0);
|
||||
}
|
||||
if(m_prevBg.data != NULL)
|
||||
{
|
||||
GX_InitTexObj(&texObj2, m_prevBg.data, m_prevBg.width, m_prevBg.height, m_prevBg.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
@ -2128,8 +2132,7 @@ void CMenu::_updateBg(void)
|
||||
m_vid.renderToTexture(m_curBg, true);
|
||||
if(m_curBg.data == NULL)
|
||||
{
|
||||
m_curBg.Cleanup();
|
||||
m_curBg = m_nextBg;
|
||||
m_curBg.CopyTexture(m_nextBg);
|
||||
m_bgCrossFade = 0;
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ private:
|
||||
/* End Updates */
|
||||
//
|
||||
STexture m_prevBg;
|
||||
STexture m_nextBg;
|
||||
const STexture *m_nextBg;
|
||||
STexture m_curBg;
|
||||
STexture m_lqBg;
|
||||
u8 m_bgCrossFade;
|
||||
|
@ -446,9 +446,6 @@ void CMenu::_game(bool launch)
|
||||
m_gameSound.Stop();
|
||||
m_banner.SetShowBanner(false);
|
||||
_hideGame();
|
||||
/* Backup Background */
|
||||
STexture Current_LQ_BG = m_lqBg;
|
||||
STexture Current_HQ_BG = m_curBg;
|
||||
/* Set Background empty */
|
||||
STexture EmptyBG;
|
||||
_setBg(EmptyBG, EmptyBG);
|
||||
@ -474,7 +471,7 @@ void CMenu::_game(bool launch)
|
||||
movie.Stop();
|
||||
m_curBg.Cleanup();
|
||||
/* Finished, so lets re-setup the background */
|
||||
_setBg(Current_HQ_BG, Current_LQ_BG);
|
||||
_setBg(m_mainBg, m_mainBgLQ);
|
||||
_updateBg();
|
||||
/* Get back into our coverflow */
|
||||
_showGame();
|
||||
|
@ -380,14 +380,25 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
|
||||
case CMenu::WO_REMOVE_GAME:
|
||||
if(CF_Hdr->type == TYPE_GC_GAME)
|
||||
{
|
||||
char GC_Path[1024];
|
||||
GC_Path[1023] = '\0';
|
||||
if(strcasestr(CF_Hdr->path, "boot.bin") != NULL)
|
||||
{
|
||||
string GC_Path(CF_Hdr->path);
|
||||
GC_Path.erase(GC_Path.end() - 13, GC_Path.end());
|
||||
fsop_deleteFolder(GC_Path.c_str());
|
||||
strncpy(GC_Path, CF_Hdr->path, 1023);
|
||||
*strrchr(GC_Path, '/') = '\0'; //boot.bin
|
||||
*strrchr(GC_Path, '/') = '\0'; //sys
|
||||
fsop_deleteFolder(GC_Path);
|
||||
}
|
||||
else
|
||||
fsop_deleteFile(CF_Hdr->path);
|
||||
{
|
||||
strncpy(GC_Path, CF_Hdr->path, 1023);
|
||||
*strrchr(GC_Path, '/') = '\0'; //iso path
|
||||
const char *cmp = fmt(currentPartition == SD ? DML_DIR : m_DMLgameDir.c_str(), DeviceName[currentPartition]);
|
||||
if(strcasecmp(GC_Path, cmp) == 0)
|
||||
fsop_deleteFile(CF_Hdr->path);
|
||||
else
|
||||
fsop_deleteFolder(GC_Path);
|
||||
}
|
||||
upd_dml = true;
|
||||
}
|
||||
else if(CF_Hdr->type == TYPE_PLUGIN)
|
||||
|
Loading…
Reference in New Issue
Block a user