mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-12-24 19:01:56 +01:00
-fixed the missing pointer and right stick movement detections for the screensaver
-made our cover loader much safer (thanks ALOT seam for all the help getting that done) -fixed a cleanup bug in cover png loading which might caused some memory leak
This commit is contained in:
parent
2872779215
commit
88ad579fe9
@ -133,7 +133,8 @@ enum
|
||||
#define RIGHT_STICK_DOWN rStick_Down()
|
||||
#define RIGHT_STICK_LEFT rStick_Left()
|
||||
#define RIGHT_STICK_RIGHT rStick_Right()
|
||||
|
||||
#define RIGHT_STICK_MOVE (RIGHT_STICK_UP || RIGHT_STICK_DOWN \
|
||||
|| RIGHT_STICK_LEFT || RIGHT_STICK_RIGHT)
|
||||
#define WROLL_LEFT wRoll_Left()
|
||||
#define WROLL_RIGHT wRoll_Right()
|
||||
|
||||
|
@ -2622,14 +2622,23 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
|
||||
mainMenu.getBoxPath(m_items[i].hdr)) : mainMenu.getFrontPath(m_items[i].hdr);
|
||||
if(path == NULL)
|
||||
return false;
|
||||
size_t path_len = strlen(path);
|
||||
char *path_place = (char*)MEM2_alloc(path_len+1);
|
||||
if(path_place == NULL)
|
||||
return false;
|
||||
memset(path_place, 0, path_len+1);
|
||||
memcpy(path_place, path, path_len);
|
||||
DCFlushRange(path_place, path_len+1);
|
||||
TexData tex;
|
||||
tex.thread = true;
|
||||
m_renderingTex = &tex;
|
||||
if(TexHandle.fromImageFile(tex, path, textureFmt, 32) != TE_OK)
|
||||
if(TexHandle.fromImageFile(tex, path_place, textureFmt, 32) != TE_OK)
|
||||
{
|
||||
MEM2_free(path_place);
|
||||
m_renderingTex = NULL;
|
||||
return false;
|
||||
}
|
||||
MEM2_free(path_place);
|
||||
m_renderingTex = NULL;
|
||||
if(!m_loadingCovers)
|
||||
return false;
|
||||
@ -2647,7 +2656,7 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
|
||||
u32 bufSize = fixGX_GetTexBufferSize(tex.width, tex.height, tex.format, tex.maxLOD > 0 ? GX_TRUE : GX_FALSE, tex.maxLOD);
|
||||
uLongf zBufferSize = m_compressCache ? bufSize + bufSize / 100 + 12 : bufSize;
|
||||
u8 *zBuffer = m_compressCache ? (u8*)MEM2_alloc(zBufferSize) : tex.data;
|
||||
if(!!zBuffer && (!m_compressCache || compress(zBuffer, &zBufferSize, tex.data, bufSize) == Z_OK))
|
||||
if(zBuffer != NULL && (!m_compressCache || compress(zBuffer, &zBufferSize, tex.data, bufSize) == Z_OK))
|
||||
{
|
||||
const char *gamePath = NULL;
|
||||
const char *coverDir = NULL;
|
||||
@ -2674,8 +2683,16 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
|
||||
FILE *file = NULL;
|
||||
if(gamePath != NULL)
|
||||
{
|
||||
char *full_path = (char*)MEM2_alloc(MAX_FAT_PATH+1);
|
||||
if(full_path == NULL)
|
||||
{
|
||||
if(zBuffer != NULL && m_compressCache)
|
||||
MEM2_free(zBuffer);
|
||||
return false;
|
||||
}
|
||||
memset(full_path, 0, MAX_FAT_PATH+1);
|
||||
if(coverDir == NULL || strlen(coverDir) == 0)
|
||||
file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), gamePath), "wb");
|
||||
strncpy(full_path, fmt("%s/%s.wfc", m_cachePath.c_str(), gamePath), MAX_FAT_PATH);
|
||||
else
|
||||
{
|
||||
if(strchr(coverDir, '/') != NULL)
|
||||
@ -2694,8 +2711,11 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
|
||||
MEM2_free(tmp);
|
||||
}
|
||||
fsop_MakeFolder(fmt("%s/%s", m_cachePath.c_str(), coverDir));
|
||||
file = fopen(fmt("%s/%s/%s.wfc", m_cachePath.c_str(), coverDir, gamePath), "wb");
|
||||
strncpy(full_path, fmt("%s/%s/%s.wfc", m_cachePath.c_str(), coverDir, gamePath), MAX_FAT_PATH);
|
||||
}
|
||||
DCFlushRange(full_path, MAX_FAT_PATH+1);
|
||||
file = fopen(full_path, "wb");
|
||||
MEM2_free(full_path);
|
||||
}
|
||||
if(file != NULL)
|
||||
{
|
||||
@ -2706,6 +2726,8 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
|
||||
if (m_deletePicsAfterCaching)
|
||||
fsop_deleteFile(path);
|
||||
}
|
||||
if(zBuffer != NULL && m_compressCache)
|
||||
MEM2_free(zBuffer);
|
||||
}
|
||||
}
|
||||
if (!hq) _dropHQLOD(i);
|
||||
@ -2791,10 +2813,17 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank
|
||||
FILE *fp = NULL;
|
||||
if(gamePath != NULL)
|
||||
{
|
||||
char *full_path = (char*)MEM2_alloc(MAX_FAT_PATH+1);
|
||||
if(full_path == NULL)
|
||||
return CL_NOMEM;
|
||||
memset(full_path, 0, MAX_FAT_PATH+1);
|
||||
if(coverDir == NULL || strlen(coverDir) == 0)
|
||||
fp = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), gamePath), "rb");
|
||||
strncpy(full_path, fmt("%s/%s.wfc", m_cachePath.c_str(), gamePath), MAX_FAT_PATH);
|
||||
else
|
||||
fp = fopen(fmt("%s/%s/%s.wfc", m_cachePath.c_str(), coverDir, gamePath), "rb");
|
||||
strncpy(full_path, fmt("%s/%s/%s.wfc", m_cachePath.c_str(), coverDir, gamePath), MAX_FAT_PATH);
|
||||
DCFlushRange(full_path, MAX_FAT_PATH+1);
|
||||
fp = fopen(full_path, "rb");
|
||||
MEM2_free(full_path);
|
||||
}
|
||||
if(fp != NULL)
|
||||
{
|
||||
|
@ -2470,20 +2470,24 @@ void CMenu::_cleanupDefaultFont()
|
||||
m_wbf2_font = NULL;
|
||||
}
|
||||
|
||||
char tmp[256];
|
||||
const char *CMenu::_getId()
|
||||
{
|
||||
char tmp[MAX_FAT_PATH];
|
||||
memset(tmp, 0, MAX_FAT_PATH);
|
||||
const char *id = NULL;
|
||||
const dir_discHdr *hdr = CoverFlow.getHdr();
|
||||
if(hdr->type == TYPE_HOMEBREW)
|
||||
id = strrchr(hdr->path, '/') + 1;
|
||||
else if(hdr->type == TYPE_PLUGIN)
|
||||
{
|
||||
tmp[0] = '\0';
|
||||
if(strrchr(hdr->path, ':') != NULL)
|
||||
if(strstr(hdr->path, ":/") != NULL)
|
||||
{
|
||||
strcat(tmp, strchr(hdr->path, '/') + 1);
|
||||
*(strchr(tmp, '/') + 1) = '\0';
|
||||
if(*(strchr(hdr->path, '/') + 1) != '\0')
|
||||
strcat(tmp, strchr(hdr->path, '/') + 1);
|
||||
else
|
||||
strcat(tmp, hdr->path);
|
||||
if(strchr(tmp, '/') != NULL)
|
||||
*(strchr(tmp, '/') + 1) = '\0';
|
||||
}
|
||||
strcat(tmp, fmt("%ls",hdr->title));
|
||||
id = tmp;
|
||||
@ -2493,7 +2497,6 @@ const char *CMenu::_getId()
|
||||
id = hdr->id;
|
||||
if(hdr->type == TYPE_GC_GAME && hdr->settings[0] == 1) /* disc 2 */
|
||||
{
|
||||
tmp[0] = '\0';
|
||||
strcat(tmp, fmt("%.6s_2", hdr->id));
|
||||
id = tmp;
|
||||
}
|
||||
|
@ -588,14 +588,17 @@ void CMenu::ShowGameZone()
|
||||
u32 CMenu::NoInputTime()
|
||||
{
|
||||
bool input_found = false;
|
||||
if(gc_btnsPressed != 0)
|
||||
if(ShowPointer() == true || RIGHT_STICK_MOVE == true || gc_btnsPressed != 0)
|
||||
input_found = true;
|
||||
else
|
||||
{
|
||||
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
|
||||
{
|
||||
if(wii_btnsPressed[chan] != 0 || wii_btnsHeld[chan] != 0 || m_show_pointer[chan] == true)
|
||||
if(wii_btnsPressed[chan] != 0 || wii_btnsHeld[chan] != 0)
|
||||
{
|
||||
input_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(input_found == false)
|
||||
|
Loading…
Reference in New Issue
Block a user