-moved #define APP_WIIFLOW from sys.h to defines.h

-fix for issue #6 - now setting 'return to' to 'disable' will properly disable it.
-fixed a few strncpy's to make sure the last char is '/0'. to prevent any string overflow even though it shouldn't happen.
-other code cleanup
This commit is contained in:
Fledge68 2018-11-12 14:38:37 -06:00
parent e133c49836
commit c8d5b12a12
19 changed files with 53 additions and 116 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

After

Width:  |  Height:  |  Size: 3.3 MiB

View File

@ -1,11 +0,0 @@
#ifndef _CONST_STR_HPP_
#define _CONST_STR_HPP_
#include "wstringEx/wstringEx.hpp"
#include "gui/text.hpp"
#include "defines.h"
static const string &VERSION_STRING = sfmt("%s %s", APP_NAME, APP_VERSION);
static const wstringEx PLAYER_BATTERY_LABEL("P1 %003.f%% | P2 %003.f%% | P3 %003.f%% | P4 %003.f%%");
#endif

View File

@ -1,5 +1,5 @@
#include "loader/sys.h" //#define APP_WIIFLOW
#define APP_NAME "WiiFlow Lite" #define APP_NAME "WiiFlow Lite"
#define APP_VERSION "5.0.0" #define APP_VERSION "5.0.0"

View File

@ -27,7 +27,6 @@
#include <cstring> #include <cstring>
#include "GameTDB.hpp" #include "GameTDB.hpp"
#include "video.hpp" #include "video.hpp"
#include "defines.h"
#include "text.hpp" #include "text.hpp"
#include "config/config.hpp" #include "config/config.hpp"
#include "gecko/gecko.hpp" #include "gecko/gecko.hpp"

View File

@ -266,11 +266,9 @@ CCoverFlow::~CCoverFlow(void)
LWP_MutexDestroy(m_mutex); LWP_MutexDestroy(m_mutex);
} }
void CCoverFlow::setCachePath(const char *path, bool deleteSource, bool compress, bool pluginCacheFolders) void CCoverFlow::setCachePath(const char *path, bool pluginCacheFolders)
{ {
m_cachePath = path; m_cachePath = path;
m_deletePicsAfterCaching = deleteSource;
m_compressCache = compress;
m_pluginCacheFolders = pluginCacheFolders; m_pluginCacheFolders = pluginCacheFolders;
} }
@ -2588,41 +2586,33 @@ public:
} }
}; };
bool CCoverFlow::cacheCover(const char *wfcPath, const char *coverPath, bool full) bool CCoverFlow::cacheCoverFile(const char *wfcPath, const char *coverPath, bool full)
{ {
if(m_cachePath.empty()) if(m_cachePath.empty())
{
return false; return false;
}
TexData tex; TexData tex;
u8 textureFmt = m_compressTextures ? GX_TF_CMPR : GX_TF_RGB565; u8 textureFmt = m_compressTextures ? GX_TF_CMPR : GX_TF_RGB565;
if(TexHandle.fromImageFile(tex, coverPath, textureFmt, 32) != TE_OK) if(TexHandle.fromImageFile(tex, coverPath, textureFmt, 32) != TE_OK)
{
return false; return false;
}
u32 bufSize = fixGX_GetTexBufferSize(tex.width, tex.height, tex.format, tex.maxLOD > 0 ? GX_TRUE : GX_FALSE, tex.maxLOD); 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; if(tex.data != NULL)
u8 *zBuffer = m_compressCache ? (u8*)MEM2_alloc(zBufferSize) : tex.data;
if(zBuffer != NULL && (!m_compressCache || compress(zBuffer, &zBufferSize, tex.data, bufSize) == Z_OK))
{ {
FILE *file = fopen(wfcPath, "wb"); FILE *file = fopen(wfcPath, "wb");
if(file != NULL) if(file != NULL)
{ {
SWFCHeader header(tex, full, m_compressCache); SWFCHeader header(tex, full, false);
fwrite(&header, 1, sizeof(header), file); fwrite(&header, 1, sizeof(header), file);
fwrite(zBuffer, 1, zBufferSize, file); fwrite(tex.data, 1, bufSize, file);
fclose(file); fclose(file);
} }
} }
TexHandle.Cleanup(tex); TexHandle.Cleanup(tex);
if(zBuffer != NULL && m_compressCache)
MEM2_free(zBuffer);
return true; return true;
} }
bool CCoverFlow::preCacheCover(const char *id, const u8 *png, bool full) bool CCoverFlow::cacheCoverBuffer(const char *wfcPath, const u8 *png, bool full)
{ {
if(m_cachePath.empty()) if(m_cachePath.empty())
return false; return false;
@ -2633,22 +2623,18 @@ bool CCoverFlow::preCacheCover(const char *id, const u8 *png, bool full)
return false; return false;
u32 bufSize = fixGX_GetTexBufferSize(tex.width, tex.height, tex.format, tex.maxLOD > 0 ? GX_TRUE : GX_FALSE, tex.maxLOD); 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; if(tex.data != NULL)
u8 *zBuffer = m_compressCache ? (u8*)MEM2_alloc(zBufferSize) : tex.data;
if(zBuffer != NULL && (!m_compressCache || compress(zBuffer, &zBufferSize, tex.data, bufSize) == Z_OK))
{ {
FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), id), "wb"); FILE *file = fopen(wfcPath, "wb");
if(file != NULL) if(file != NULL)
{ {
SWFCHeader header(tex, full, m_compressCache); SWFCHeader header(tex, full, false);
fwrite(&header, 1, sizeof header, file); fwrite(&header, 1, sizeof(header), file);
fwrite(zBuffer, 1, zBufferSize, file); fwrite(tex.data, 1, bufSize, file);
fclose(file); fclose(file);
} }
} }
TexHandle.Cleanup(tex); TexHandle.Cleanup(tex);
if(zBuffer != NULL && m_compressCache)
MEM2_free(zBuffer);
return true; return true;
} }
@ -2712,19 +2698,13 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
if(!m_cachePath.empty()) if(!m_cachePath.empty())
{ {
u32 bufSize = fixGX_GetTexBufferSize(tex.width, tex.height, tex.format, tex.maxLOD > 0 ? GX_TRUE : GX_FALSE, tex.maxLOD); 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; if(tex.data != NULL)
u8 *zBuffer = m_compressCache ? (u8*)MEM2_alloc(zBufferSize) : tex.data;
if(zBuffer != NULL && (!m_compressCache || compress(zBuffer, &zBufferSize, tex.data, bufSize) == Z_OK))
{ {
const char *gameNameOrID = NULL; const char *gameNameOrID = NULL;
const char *coverWfcDir = NULL; const char *coverWfcDir = NULL;
char *full_path = (char*)MEM2_alloc(MAX_FAT_PATH+1); char *full_path = (char*)MEM2_alloc(MAX_FAT_PATH+1);
if(full_path == NULL) if(full_path == NULL)
{
if(zBuffer != NULL && m_compressCache)
MEM2_free(zBuffer);
return false; return false;
}
memset(full_path, 0, MAX_FAT_PATH+1); memset(full_path, 0, MAX_FAT_PATH+1);
if(blankBoxCover) if(blankBoxCover)
@ -2732,6 +2712,8 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
const char *blankCoverPath = mainMenu.getBlankCoverPath(m_items[i].hdr); const char *blankCoverPath = mainMenu.getBlankCoverPath(m_items[i].hdr);
if(blankCoverPath != NULL && strrchr(blankCoverPath, '/') != NULL) if(blankCoverPath != NULL && strrchr(blankCoverPath, '/') != NULL)
gameNameOrID = strrchr(blankCoverPath, '/') + 1; gameNameOrID = strrchr(blankCoverPath, '/') + 1;
else
return false;
} }
else else
gameNameOrID = getFilenameId(m_items[i].hdr); gameNameOrID = getFilenameId(m_items[i].hdr);
@ -2771,15 +2753,11 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
MEM2_free(full_path); MEM2_free(full_path);
if(file != NULL) if(file != NULL)
{ {
SWFCHeader header(tex, box, m_compressCache); SWFCHeader header(tex, box, false);
fwrite(&header, 1, sizeof header, file); fwrite(&header, 1, sizeof(header), file);
fwrite(zBuffer, 1, zBufferSize, file); fwrite(tex.data, 1, bufSize, file);
fclose(file); fclose(file);
if(m_deletePicsAfterCaching)
fsop_deleteFile(path);
} }
if(zBuffer != NULL && m_compressCache)
MEM2_free(zBuffer);
} }
} }
if(!hq) _dropHQLOD(i); if(!hq) _dropHQLOD(i);
@ -2794,8 +2772,8 @@ bool CCoverFlow::_calcTexLQLOD(TexData &tex)
while (tex.width > 512 && tex.height > 512 && tex.maxLOD > 0) while (tex.width > 512 && tex.height > 512 && tex.maxLOD > 0)
{ {
--tex.maxLOD; --tex.maxLOD;
tex.width >>= 1; tex.width >>= 1;// divide by 2
tex.height >>= 1; tex.height >>= 1;// divide by 2
done = true; done = true;
} }
return done; return done;
@ -2927,35 +2905,15 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank
u32 texLen = fixGX_GetTexBufferSize(tex.width, tex.height, tex.format, tex.maxLOD > 0 ? GX_TRUE : GX_FALSE, tex.maxLOD); u32 texLen = fixGX_GetTexBufferSize(tex.width, tex.height, tex.format, tex.maxLOD > 0 ? GX_TRUE : GX_FALSE, tex.maxLOD);
tex.data = (u8*)MEM2_alloc(texLen); tex.data = (u8*)MEM2_alloc(texLen);
if(tex.data == NULL)
if(header.zipped != 0)//if it's compressed ie. zipped allocFailed = true;
{
u8 *ptrTex = (u8*)MEM2_alloc(bufSize);
u8 *zBuffer = (u8*)MEM2_alloc(fileSize - sizeof(header));
if(ptrTex == NULL || zBuffer == NULL)
allocFailed = true;
else
{
fread(zBuffer, 1, fileSize - sizeof(header), fp);
uLongf size = bufSize;
if(uncompress(ptrTex, &size, zBuffer, fileSize - sizeof(header)) == Z_OK && size == bufSize)
memcpy(tex.data, ptrTex + bufSize - texLen, texLen);
}
free(zBuffer);
free(ptrTex);
}
else else
{ {
if(tex.data == NULL) fseek(fp, sizeof(header) + (bufSize - texLen), SEEK_SET);
allocFailed = true; if(fread(tex.data, 1, texLen, fp) != texLen)
else
{ {
fseek(fp, sizeof(header) + bufSize - texLen, SEEK_SET); fclose(fp);
if(fread(tex.data, 1, texLen, fp) != texLen) return _loadCoverTexPNG(i, box, hq, blankBoxCover) ? CL_OK : CL_ERROR;
{
fclose(fp);
return _loadCoverTexPNG(i, box, hq, blankBoxCover) ? CL_OK : CL_ERROR;
}
} }
} }
if(!allocFailed) if(!allocFailed)

View File

@ -123,10 +123,10 @@ public:
void stopSound(void); void stopSound(void);
// //
void applySettings(void); void applySettings(void);
void setCachePath(const char *path, bool deleteSource, bool compress, bool pluginCacheFolders); void setCachePath(const char *path, bool pluginCacheFolders);
bool fullCoverCached(const char *wfcPath); bool fullCoverCached(const char *wfcPath);
bool preCacheCover(const char *id, const u8 *png, bool full); bool cacheCoverBuffer(const char *wfcPath, const u8 *png, bool full);
bool cacheCover(const char *wfcPath, const char *coverPath, bool full); bool cacheCoverFile(const char *wfcPath, const char *coverPath, bool full);
// //
const char *getId(void) const; const char *getId(void) const;
const char *getNextId(void) const; const char *getNextId(void) const;

View File

@ -2,7 +2,6 @@
#define WIIDISC_H #define WIIDISC_H
#include <stdio.h> #include <stdio.h>
#include "libwbfs_os.h" // this file is provided by the project wanting to compile libwbfs and wiidisc #include "libwbfs_os.h" // this file is provided by the project wanting to compile libwbfs and wiidisc
#include "defines.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"

View File

@ -21,6 +21,7 @@
#include <vector> #include <vector>
#include <stdio.h> #include <stdio.h>
#include "defines.h"
#include "types.h" #include "types.h"
#include "config/config.hpp" #include "config/config.hpp"
#include "loader/wbfs.h" #include "loader/wbfs.h"

View File

@ -40,7 +40,7 @@
#include "gui/text.hpp" #include "gui/text.hpp"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"
#include "menu/menu.hpp" #include "menu/menu.hpp"
#include "defines.h"
using namespace std; using namespace std;
static u8 *FSTable ATTRIBUTE_ALIGN(32); static u8 *FSTable ATTRIBUTE_ALIGN(32);

View File

@ -2,8 +2,6 @@
#ifndef _SYS_H_ #ifndef _SYS_H_
#define _SYS_H_ #define _SYS_H_
//#define APP_WIIFLOW
#include "utils.h" #include "utils.h"
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -3,7 +3,6 @@
#define _UTILS_H_ #define _UTILS_H_
#include <gctypes.h> #include <gctypes.h>
#include "defines.h"
#define KB_SIZE 1024.0 #define KB_SIZE 1024.0
#define MB_SIZE 1048576.0 #define MB_SIZE 1048576.0

View File

@ -3,7 +3,7 @@
#include <unistd.h> #include <unistd.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "const_str.hpp" #include "defines.h"
#include "booter/external_booter.hpp" #include "booter/external_booter.hpp"
#include "channel/nand.hpp" #include "channel/nand.hpp"
#include "channel/nand_save.hpp" #include "channel/nand_save.hpp"
@ -85,7 +85,7 @@ int main(int argc, char **argv)
mainIOS = DOL_MAIN_IOS;// 249 mainIOS = DOL_MAIN_IOS;// 249
__exception_setreload(10); __exception_setreload(10);
Gecko_Init(); //USB Gecko and SD/WiFi buffer Gecko_Init(); //USB Gecko and SD/WiFi buffer
gprintf(" \nWelcome to %s!\nThis is the debug output.\n", VERSION_STRING.c_str()); gprintf(" \nWelcome to %s %s!\nThis is the debug output.\n", APP_NAME, APP_VERSION);
bool iosOK = true; bool iosOK = true;
char *gameid = NULL; char *gameid = NULL;
@ -106,7 +106,7 @@ int main(int argc, char **argv)
else if(strcasestr(argv[i], "waitdir=") != NULL) else if(strcasestr(argv[i], "waitdir=") != NULL)
{ {
char *ptr = strcasestr(argv[i], "waitdir="); char *ptr = strcasestr(argv[i], "waitdir=");
strncpy(wait_dir, ptr+strlen("waitdir="), sizeof(wait_dir)); strncpy(wait_dir, ptr+strlen("waitdir="), sizeof(wait_dir) - 1);
} }
else if(strcasestr(argv[i], "Waitloop") != NULL) else if(strcasestr(argv[i], "Waitloop") != NULL)
wait_loop = true; wait_loop = true;

View File

@ -175,7 +175,7 @@ bool CMenu::init()
/* Our Wii games dir */ /* Our Wii games dir */
memset(wii_games_dir, 0, 64); memset(wii_games_dir, 0, 64);
strncpy(wii_games_dir, m_cfg.getString(WII_DOMAIN, "wii_games_dir", GAMES_DIR).c_str(), 64); strncpy(wii_games_dir, m_cfg.getString(WII_DOMAIN, "wii_games_dir", GAMES_DIR).c_str(), 63);
if(strncmp(wii_games_dir, "%s:/", 4) != 0) if(strncmp(wii_games_dir, "%s:/", 4) != 0)
strcpy(wii_games_dir, GAMES_DIR); strcpy(wii_games_dir, GAMES_DIR);
gprintf("Wii Games Directory: %s\n", wii_games_dir); gprintf("Wii Games Directory: %s\n", wii_games_dir);
@ -184,7 +184,7 @@ bool CMenu::init()
m_devo_installed = DEVO_Installed(m_dataDir.c_str()); m_devo_installed = DEVO_Installed(m_dataDir.c_str());
m_nintendont_installed = Nintendont_Installed(); m_nintendont_installed = Nintendont_Installed();
memset(gc_games_dir, 0, 64); memset(gc_games_dir, 0, 64);
strncpy(gc_games_dir, m_cfg.getString(GC_DOMAIN, "gc_games_dir", DF_GC_GAMES_DIR).c_str(), 64); strncpy(gc_games_dir, m_cfg.getString(GC_DOMAIN, "gc_games_dir", DF_GC_GAMES_DIR).c_str(), 63);
if(strncmp(gc_games_dir, "%s:/", 4) != 0) if(strncmp(gc_games_dir, "%s:/", 4) != 0)
strcpy(gc_games_dir, DF_GC_GAMES_DIR); strcpy(gc_games_dir, DF_GC_GAMES_DIR);
gprintf("GameCube Games Directory: %s\n", gc_games_dir); gprintf("GameCube Games Directory: %s\n", gc_games_dir);
@ -380,10 +380,10 @@ bool CMenu::init()
/* Switch the WFLA and DWFA when using official wiiflow */ /* Switch the WFLA and DWFA when using official wiiflow */
#ifdef APP_WIIFLOW #ifdef APP_WIIFLOW
if(m_cfg.getString("GENERAL", "returnto", "DWFA") == "WFLA") if(m_cfg.getString("GENERAL", "returnto") == "WFLA")
m_cfg.setString("GENERAL", "returnto", "DWFA"); m_cfg.setString("GENERAL", "returnto", "DWFA");
#else #else
if(m_cfg.getString("GENERAL", "returnto", "WFLA") == "DWFA") if(m_cfg.getString("GENERAL", "returnto") == "DWFA")
m_cfg.setString("GENERAL", "returnto", "WFLA"); m_cfg.setString("GENERAL", "returnto", "WFLA");
#endif #endif
@ -592,8 +592,7 @@ void CMenu::_loadCFCfg()
const char *domain = "_COVERFLOW"; const char *domain = "_COVERFLOW";
//gprintf("Preparing to load sounds from %s\n", m_themeDataDir.c_str()); //gprintf("Preparing to load sounds from %s\n", m_themeDataDir.c_str());
CoverFlow.setCachePath(m_cacheDir.c_str(), !m_cfg.getBool("GENERAL", "keep_png", true), CoverFlow.setCachePath(m_cacheDir.c_str(), m_cfg.getBool(PLUGIN_DOMAIN, "subfolder_cache", true));
m_cfg.getBool("GENERAL", "compress_cache", false), m_cfg.getBool(PLUGIN_DOMAIN, "subfolder_cache", true));
CoverFlow.setBufferSize(m_cfg.getInt("GENERAL", "cover_buffer", 20)); CoverFlow.setBufferSize(m_cfg.getInt("GENERAL", "cover_buffer", 20));
// Coverflow Sounds // Coverflow Sounds
CoverFlow.setSounds( CoverFlow.setSounds(
@ -2162,7 +2161,6 @@ void CMenu::_initCF(void)
CoverFlow.setBoxMode(m_cfg.getBool("GENERAL", "box_mode", true)); CoverFlow.setBoxMode(m_cfg.getBool("GENERAL", "box_mode", true));
CoverFlow.setSmallBoxMode(false); CoverFlow.setSmallBoxMode(false);
} }
CoverFlow.setCompression(m_cfg.getBool("GENERAL", "allow_texture_compression", true));
CoverFlow.setBufferSize(m_cfg.getInt("GENERAL", "cover_buffer", 20)); CoverFlow.setBufferSize(m_cfg.getInt("GENERAL", "cover_buffer", 20));
CoverFlow.setHQcover(m_cfg.getBool("GENERAL", "cover_use_hq", true)); CoverFlow.setHQcover(m_cfg.getBool("GENERAL", "cover_use_hq", true));
CoverFlow.start(m_imgsDir); CoverFlow.start(m_imgsDir);

View File

@ -1,7 +1,6 @@
#include "menu.hpp" #include "menu.hpp"
#include "loader/cios.h" #include "loader/cios.h"
#include "const_str.hpp"
extern const u8 english_txt[]; extern const u8 english_txt[];
static const wstringEx ENGLISH_TXT_W((const char*)english_txt); static const wstringEx ENGLISH_TXT_W((const char*)english_txt);
@ -146,7 +145,7 @@ void CMenu::_textAbout(void)
return; return;
} }
// show credits and current cIOS // show credits and current cIOS
m_btnMgr.setText(m_aboutLblTitle, VERSION_STRING); m_btnMgr.setText(m_aboutLblTitle, wfmt(L"%s %s", APP_NAME, APP_VERSION));
wstringEx developers(wfmt(_fmt("about6", L"Current Developers:\n%s"), DEVELOPERS)); wstringEx developers(wfmt(_fmt("about6", L"Current Developers:\n%s"), DEVELOPERS));
wstringEx pDevelopers(wfmt(_fmt("about7", L"Past Developers:\n%s"), PAST_DEVELOPERS)); wstringEx pDevelopers(wfmt(_fmt("about7", L"Past Developers:\n%s"), PAST_DEVELOPERS));

View File

@ -878,8 +878,6 @@ int CMenu::_coverDownloader(bool download_all)
c_gameTDB.SetLanguageCode(m_curLanguage.c_str()); c_gameTDB.SetLanguageCode(m_curLanguage.c_str());
} }
//bool savePNG = m_cfg.getBool("GENERAL", "keep_png", true);
vector<string> fmtURLBox = stringToVector(m_cfg.getString("GENERAL", "url_full_covers", FMT_BPIC_URL), '|'); vector<string> fmtURLBox = stringToVector(m_cfg.getString("GENERAL", "url_full_covers", FMT_BPIC_URL), '|');
vector<string> fmtURLFlat = stringToVector(m_cfg.getString("GENERAL", "url_flat_covers", FMT_PIC_URL), '|'); vector<string> fmtURLFlat = stringToVector(m_cfg.getString("GENERAL", "url_flat_covers", FMT_PIC_URL), '|');
vector<string> fmtURLCBox = stringToVector(m_cfg.getString("GENERAL", "url_custom_full_covers", FMT_CBPIC_URL), '|'); vector<string> fmtURLCBox = stringToVector(m_cfg.getString("GENERAL", "url_custom_full_covers", FMT_CBPIC_URL), '|');
@ -1107,7 +1105,7 @@ int CMenu::_coverDownloader(bool download_all)
update_pThread(1); update_pThread(1);
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s.wfc"), coverID.c_str()); m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s.wfc"), coverID.c_str());
m_thrdMessageAdded = true; m_thrdMessageAdded = true;
CoverFlow.preCacheCover(coverID.c_str(), download.data, true);//it may fail CoverFlow.cacheCoverBuffer(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), download.data, true);//it may fail
++count; ++count;
update_pThread(1); update_pThread(1);
@ -1249,7 +1247,7 @@ int CMenu::_coverDownloader(bool download_all)
update_pThread(1); update_pThread(1);
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s.wfc"), coverID.c_str()); m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s.wfc"), coverID.c_str());
m_thrdMessageAdded = true; m_thrdMessageAdded = true;
CoverFlow.preCacheCover(coverID.c_str(), download.data, true);//it may fail CoverFlow.cacheCoverBuffer(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), download.data, true);//it may fail
update_pThread(1); update_pThread(1);
++count; ++count;
@ -1384,7 +1382,7 @@ int CMenu::_coverDownloader(bool download_all)
update_pThread(1); update_pThread(1);
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverID.c_str())); m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverID.c_str()));
m_thrdMessageAdded = true; m_thrdMessageAdded = true;
CoverFlow.preCacheCover(coverID.c_str(), download.data, false);//it may fail CoverFlow.cacheCoverBuffer(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), download.data, false);//it may fail
++countFlat; ++countFlat;
update_pThread(1); update_pThread(1);
@ -1523,7 +1521,7 @@ int CMenu::_coverDownloader(bool download_all)
update_pThread(1); update_pThread(1);
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverID.c_str())); m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverID.c_str()));
m_thrdMessageAdded = true; m_thrdMessageAdded = true;
CoverFlow.preCacheCover(coverID.c_str(), download.data, false);//it may fail CoverFlow.cacheCoverBuffer(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), download.data, false);//it may fail
++countFlat; ++countFlat;
update_pThread(1); update_pThread(1);

View File

@ -19,7 +19,6 @@
#include <algorithm> #include <algorithm>
#include "menu.hpp" #include "menu.hpp"
#include "channel/nand.hpp" #include "channel/nand.hpp"
#include "defines.h"
TexData m_explorerBg; TexData m_explorerBg;
s16 entries[7]; s16 entries[7];
@ -213,7 +212,7 @@ void CMenu::_Explorer(void)
else else
{ {
memset(file, 0, MAX_FAT_PATH); memset(file, 0, MAX_FAT_PATH);
strncpy(file, fmt("%s%s", dir, elements[start_pos+(i-1)].name), MAX_FAT_PATH); strncpy(file, fmt("%s%s", dir, elements[start_pos+(i-1)].name), MAX_FAT_PATH - 1);
if(strcasestr(file, ".mp3") != NULL || strcasestr(file, ".ogg") != NULL) if(strcasestr(file, ".mp3") != NULL || strcasestr(file, ".ogg") != NULL)
MusicPlayer.LoadFile(file, false); MusicPlayer.LoadFile(file, false);
else if(strcasestr(file, ".iso") != NULL || strcasestr(file, ".wbfs") != NULL) else if(strcasestr(file, ".iso") != NULL || strcasestr(file, ".wbfs") != NULL)

View File

@ -18,7 +18,7 @@
#include "channel/nand.hpp" #include "channel/nand.hpp"
#include "loader/cios.h" #include "loader/cios.h"
#include "loader/nk.h" #include "loader/nk.h"
#include "const_str.hpp" #include "wstringEx/wstringEx.hpp"
/* home menu */ /* home menu */
s16 m_homeLblTitle; s16 m_homeLblTitle;
@ -46,6 +46,7 @@ s16 m_homeBtnExitToBootmii;
s16 m_homeBtnExitToNeek; s16 m_homeBtnExitToNeek;
TexData m_homeBg; TexData m_homeBg;
static const wstringEx PLAYER_BATTERY_LABEL("P1 %003.f%% | P2 %003.f%% | P3 %003.f%% | P4 %003.f%%");
bool CMenu::_Home(void) bool CMenu::_Home(void)
{ {
@ -379,7 +380,7 @@ void CMenu::_initHomeAndExitToMenu()
void CMenu::_textHome(void) void CMenu::_textHome(void)
{ {
m_btnMgr.setText(m_homeLblTitle, VERSION_STRING); m_btnMgr.setText(m_homeLblTitle, wfmt(L"%s %s", APP_NAME, APP_VERSION));
m_btnMgr.setText(m_homeBtnSettings, _t("about10", L"Help Guide")); m_btnMgr.setText(m_homeBtnSettings, _t("about10", L"Help Guide"));
m_btnMgr.setText(m_homeBtnReloadCache, _t("home2", L"Reload Cache")); m_btnMgr.setText(m_homeBtnReloadCache, _t("home2", L"Reload Cache"));
m_btnMgr.setText(m_homeBtnUpdate, _t("home11", L"Cache Covers")); m_btnMgr.setText(m_homeBtnUpdate, _t("home11", L"Cache Covers"));
@ -463,7 +464,7 @@ int CMenu::_cacheCovers()
fsop_MakeFolder(cachePath); fsop_MakeFolder(cachePath);
/* create cover texture */ /* create cover texture */
CoverFlow.cacheCover(wfcPath, coverPath, fullCover); CoverFlow.cacheCoverFile(wfcPath, coverPath, fullCover);
} }
// cache wii and channel banners // cache wii and channel banners

View File

@ -3,7 +3,6 @@
#include <algorithm> #include <algorithm>
#include <sys/stat.h> #include <sys/stat.h>
#include "menu.hpp" #include "menu.hpp"
#include "defines.h"
#include "lockMutex.hpp" #include "lockMutex.hpp"
#include "channel/nand.hpp" #include "channel/nand.hpp"
#include "loader/cios.h" #include "loader/cios.h"
@ -244,12 +243,12 @@ int CMenu::_FindEmuPart(bool savesnand, bool skipchecks)
if(savesnand) if(savesnand)
{ {
emuPart = m_cfg.getInt(WII_DOMAIN, "savepartition"); emuPart = m_cfg.getInt(WII_DOMAIN, "savepartition");
strncpy(tmpPath, fmt("/%s/%s", emu_nands_dir, m_cfg.getString(WII_DOMAIN, "current_save_emunand").c_str()), sizeof(tmpPath)); strncpy(tmpPath, fmt("/%s/%s", emu_nands_dir, m_cfg.getString(WII_DOMAIN, "current_save_emunand").c_str()), sizeof(tmpPath) - 1);
} }
else else
{ {
emuPart = m_cfg.getInt(CHANNEL_DOMAIN, "partition"); emuPart = m_cfg.getInt(CHANNEL_DOMAIN, "partition");
strncpy(tmpPath, fmt("/%s/%s", emu_nands_dir, m_cfg.getString(WII_DOMAIN, "current_emunand").c_str()), sizeof(tmpPath)); strncpy(tmpPath, fmt("/%s/%s", emu_nands_dir, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand").c_str()), sizeof(tmpPath) - 1);
} }
if(!DeviceHandle.PartitionUsableForNandEmu(emuPart))//check if device is mounted and partition is FAT if(!DeviceHandle.PartitionUsableForNandEmu(emuPart))//check if device is mounted and partition is FAT
return -1; return -1;

View File

@ -193,7 +193,7 @@ void CMenu::_Paths(void)
strcat(tmpPath, strchr(path, ':')); strcat(tmpPath, strchr(path, ':'));
m_cfg.setString(WII_DOMAIN, "wii_games_dir", tmpPath); m_cfg.setString(WII_DOMAIN, "wii_games_dir", tmpPath);
memset(wii_games_dir, 0, 64); memset(wii_games_dir, 0, 64);
strncpy(wii_games_dir, tmpPath, 64); strncpy(wii_games_dir, tmpPath, 63);
m_cfg.setBool(WII_DOMAIN, "update_cache", true); m_cfg.setBool(WII_DOMAIN, "update_cache", true);
if(m_current_view & COVERFLOW_WII) if(m_current_view & COVERFLOW_WII)
m_refreshGameList = true; m_refreshGameList = true;
@ -221,7 +221,7 @@ void CMenu::_Paths(void)
strcat(tmpPath, strchr(path, ':')); strcat(tmpPath, strchr(path, ':'));
m_cfg.setString(GC_DOMAIN, "gc_games_dir", tmpPath); m_cfg.setString(GC_DOMAIN, "gc_games_dir", tmpPath);
memset(gc_games_dir, 0, 64); memset(gc_games_dir, 0, 64);
strncpy(gc_games_dir, tmpPath, 64); strncpy(gc_games_dir, tmpPath, 63);
m_cfg.setBool(GC_DOMAIN, "update_cache", true); m_cfg.setBool(GC_DOMAIN, "update_cache", true);
if(m_current_view & COVERFLOW_GAMECUBE) if(m_current_view & COVERFLOW_GAMECUBE)
m_refreshGameList = true; m_refreshGameList = true;