-removed alot of unneeded .c_str()

-replaced alot of sfmt with fmt
-replaced a few sprintf with snprintf
This commit is contained in:
fix94.1 2012-05-04 12:30:43 +00:00
parent 9f7ef01f79
commit 4df672d357
24 changed files with 114 additions and 113 deletions

View File

@ -75,7 +75,7 @@ u64 fsop_GetFolderBytes (char *source)
if (strcmp (pent->d_name, ".") == 0 || strcmp (pent->d_name, "..") == 0) if (strcmp (pent->d_name, ".") == 0 || strcmp (pent->d_name, "..") == 0)
continue; continue;
sprintf (newSource, "%s/%s", source, pent->d_name); snprintf(newSource, sizeof(newSource), "%s/%s", source, pent->d_name);
// If it is a folder... recurse... // If it is a folder... recurse...
if (fsop_DirExist (newSource)) if (fsop_DirExist (newSource))
@ -284,8 +284,8 @@ static bool doCopyFolder (char *source, char *target, progress_callback_t spinne
if (strcmp (pent->d_name, ".") == 0 || strcmp (pent->d_name, "..") == 0) if (strcmp (pent->d_name, ".") == 0 || strcmp (pent->d_name, "..") == 0)
continue; continue;
sprintf (newSource, "%s/%s", source, pent->d_name); snprintf(newSource, sizeof(newSource), "%s/%s", source, pent->d_name);
sprintf (newTarget, "%s/%s", target, pent->d_name); snprintf(newTarget, sizeof(newTarget), "%s/%s", target, pent->d_name);
// If it is a folder... recurse... // If it is a folder... recurse...
if (fsop_DirExist(newSource)) if (fsop_DirExist(newSource))
@ -326,7 +326,7 @@ void fsop_deleteFolder(char *source)
if (strcmp (pent->d_name, ".") == 0 || strcmp (pent->d_name, "..") == 0) if (strcmp (pent->d_name, ".") == 0 || strcmp (pent->d_name, "..") == 0)
continue; continue;
sprintf (newSource, "%s/%s", source, pent->d_name); snprintf (newSource, sizeof(newSource), "%s/%s", source, pent->d_name);
// If it is a folder... recurse... // If it is a folder... recurse...
if (fsop_DirExist(newSource)) if (fsop_DirExist(newSource))

View File

@ -2476,7 +2476,7 @@ bool CCoverFlow::preCacheCover(const char *id, const u8 *png, bool full)
SmartBuf zBuffer = m_compressCache ? smartMem2Alloc(zBufferSize) : tex.data; SmartBuf zBuffer = m_compressCache ? smartMem2Alloc(zBufferSize) : tex.data;
if (!!zBuffer && (!m_compressCache || compress(zBuffer.get(), &zBufferSize, tex.data.get(), bufSize) == Z_OK)) if (!!zBuffer && (!m_compressCache || compress(zBuffer.get(), &zBufferSize, tex.data.get(), bufSize) == Z_OK))
{ {
FILE *file = fopen(sfmt("%s/%s.wfc", m_cachePath.c_str(), id).c_str(), "wb"); FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), id), "wb");
if (file != 0) if (file != 0)
{ {
SWFCHeader header(tex, full, m_compressCache); SWFCHeader header(tex, full, m_compressCache);
@ -2493,7 +2493,7 @@ bool CCoverFlow::fullCoverCached(const char *id)
{ {
bool found = false; bool found = false;
FILE *file = fopen(sfmt("%s/%s.wfc", m_cachePath.c_str(), id).c_str(), "rb"); FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), id), "rb");
if (file != 0) if (file != 0)
{ {
SWFCHeader header; SWFCHeader header;
@ -2532,7 +2532,7 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq)
SmartBuf zBuffer = m_compressCache ? smartMem2Alloc(zBufferSize) : tex.data; SmartBuf zBuffer = m_compressCache ? smartMem2Alloc(zBufferSize) : tex.data;
if (!!zBuffer && (!m_compressCache || compress(zBuffer.get(), &zBufferSize, tex.data.get(), bufSize) == Z_OK)) if (!!zBuffer && (!m_compressCache || compress(zBuffer.get(), &zBufferSize, tex.data.get(), bufSize) == Z_OK))
{ {
FILE *file = fopen(sfmt("%s/%s.wfc", m_cachePath.c_str(), (m_items[i].hdr->hdr.gc_magic == 0x4c4f4c4f ? &m_items[i].hdr->path[std::string(m_items[i].hdr->path).find_last_of("/")] : (char*)m_items[i].hdr->hdr.id)).c_str(), "wb"); FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), (m_items[i].hdr->hdr.gc_magic == 0x4c4f4c4f ? &m_items[i].hdr->path[std::string(m_items[i].hdr->path).find_last_of("/")] : (char*)m_items[i].hdr->hdr.id)), "wb");
if (file != 0) if (file != 0)
{ {
SWFCHeader header(tex, box, m_compressCache); SWFCHeader header(tex, box, m_compressCache);
@ -2599,7 +2599,7 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq)
// Try to find the texture in the cache // Try to find the texture in the cache
if (!m_cachePath.empty()) if (!m_cachePath.empty())
{ {
FILE *file = fopen(sfmt("%s/%s.wfc", m_cachePath.c_str(), (m_items[i].hdr->hdr.gc_magic == 0x4c4f4c4f ? &m_items[i].hdr->path[std::string(m_items[i].hdr->path).find_last_of("/")] : (char*)m_items[i].hdr->hdr.id)).c_str(), "rb"); FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), (m_items[i].hdr->hdr.gc_magic == 0x4c4f4c4f ? &m_items[i].hdr->path[std::string(m_items[i].hdr->path).find_last_of("/")] : (char*)m_items[i].hdr->hdr.id)), "rb");
if (file != 0) if (file != 0)
{ {
bool success = false; bool success = false;

View File

@ -38,19 +38,19 @@ bool CFanart::load(Config &m_globalConfig, const char *path, const char *id)
const char *dir = fmt("%s/%s", path, id); const char *dir = fmt("%s/%s", path, id);
STexture fanBg, fanBgLq; STexture fanBg, fanBgLq;
STexture::TexErr texErr = fanBg.fromPNGFile(sfmt("%s/background.png", dir).c_str(), GX_TF_RGBA8); STexture::TexErr texErr = fanBg.fromPNGFile(fmt("%s/background.png", dir), GX_TF_RGBA8);
if (texErr == STexture::TE_ERROR) if (texErr == STexture::TE_ERROR)
{ {
dir = fmt("%s/%.3s", path, id); dir = fmt("%s/%.3s", path, id);
texErr = fanBg.fromPNGFile(sfmt("%s/background.png", dir).c_str(), GX_TF_RGBA8); texErr = fanBg.fromPNGFile(fmt("%s/background.png", dir), GX_TF_RGBA8);
} }
if (texErr == STexture::TE_OK) if (texErr == STexture::TE_OK)
{ {
m_cfg.load(sfmt("%s/%s.ini", dir, id).c_str()); m_cfg.load(fmt("%s/%s.ini", dir, id));
if (!m_cfg.loaded()) m_cfg.load(sfmt("%s/%.3s.ini", dir, id).c_str()); if (!m_cfg.loaded()) m_cfg.load(fmt("%s/%.3s.ini", dir, id));
fanBgLq.fromPNGFile(sfmt("%s/background_lq.png", dir).c_str(), GX_TF_RGBA8); fanBgLq.fromPNGFile(fmt("%s/background_lq.png", dir), GX_TF_RGBA8);
for (int i = 1; i <= 6; i++) for (int i = 1; i <= 6; i++)
{ {
@ -176,7 +176,7 @@ void CFanart::draw(bool front)
CFanartElement::CFanartElement(Config &cfg, const char *dir, int artwork) CFanartElement::CFanartElement(Config &cfg, const char *dir, int artwork)
: m_artwork(artwork), m_isValid(false) : m_artwork(artwork), m_isValid(false)
{ {
m_isValid = m_art.fromPNGFile(sfmt("%s/artwork%d.png", dir, artwork).c_str(), GX_TF_RGBA8) == STexture::TE_OK; m_isValid = m_art.fromPNGFile(fmt("%s/artwork%d.png", dir, artwork), GX_TF_RGBA8) == STexture::TE_OK;
if (!m_isValid) return; if (!m_isValid) return;
const char *section = fmt("artwork%d", artwork); const char *section = fmt("artwork%d", artwork);

View File

@ -7,11 +7,6 @@ static const wchar_t *g_whitespaces = L" \f\n\r\t\v";
// Simplified use of sprintf // Simplified use of sprintf
const char *fmt(const char *format, ...) const char *fmt(const char *format, ...)
{ {
enum {
MAX_MSG_SIZE = 512,
MAX_USES = 8
};
static int currentStr = 0; static int currentStr = 0;
currentStr = (currentStr + 1) % MAX_USES; currentStr = (currentStr + 1) % MAX_USES;

View File

@ -54,6 +54,12 @@ private:
}; };
// Nothing to do with CText. Q&D helpers for string formating. // Nothing to do with CText. Q&D helpers for string formating.
enum {
MAX_MSG_SIZE = 512,
MAX_USES = 8
};
const char *fmt(const char *format, ...); const char *fmt(const char *format, ...);
std::string sfmt(const char *format, ...); std::string sfmt(const char *format, ...);
wstringEx wfmt(const wstringEx &format, ...); wstringEx wfmt(const wstringEx &format, ...);

View File

@ -28,7 +28,7 @@ void CachedList<T>::Load(string path, string containing, string m_lastLanguage,
update_emu = strcasestr(path.c_str(), m_plugin.getString("PLUGIN","romDir","").c_str()) != NULL && force_update[COVERFLOW_EMU]; update_emu = strcasestr(path.c_str(), m_plugin.getString("PLUGIN","romDir","").c_str()) != NULL && force_update[COVERFLOW_EMU];
const char* partition = DeviceName[DeviceHandler::Instance()->PathToDriveType(path.c_str())]; const char* partition = DeviceName[DeviceHandler::Instance()->PathToDriveType(path.c_str())];
update_dml = strcasestr(path.c_str(), sfmt(strncmp(partition, "sd", 2) != 0 ? m_DMLgameDir.c_str() : "%s:/games", partition).c_str()) != NULL && force_update[COVERFLOW_DML]; update_dml = strcasestr(path.c_str(), fmt(strncmp(partition, "sd", 2) != 0 ? m_DMLgameDir.c_str() : "%s:/games", partition)) != NULL && force_update[COVERFLOW_DML];
gprintf("update_games=%d update_homebrew=%d update_dml=%d, update_emu=%d\n", update_games, update_homebrew, update_dml, update_emu); gprintf("update_games=%d update_homebrew=%d update_dml=%d, update_emu=%d\n", update_games, update_homebrew, update_dml, update_emu);
if(update_games || update_homebrew || update_dml || update_emu) if(update_games || update_homebrew || update_dml || update_emu)

View File

@ -131,7 +131,7 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
GameTDB gameTDB; GameTDB gameTDB;
if (settingsDir.size() > 0) if (settingsDir.size() > 0)
{ {
gameTDB.OpenFile(sfmt("%s/wiitdb.xml", settingsDir.c_str()).c_str()); gameTDB.OpenFile(fmt("%s/wiitdb.xml", settingsDir.c_str()));
if(curLanguage.size() == 0) curLanguage = "EN"; if(curLanguage.size() == 0) curLanguage = "EN";
gameTDB.SetLanguageCode(curLanguage.c_str()); gameTDB.SetLanguageCode(curLanguage.c_str());
} }
@ -470,7 +470,7 @@ void CList<dir_discHdr>::GetChannels(safe_vector<dir_discHdr> &headerlist, strin
GameTDB gameTDB; GameTDB gameTDB;
if (settingsDir.size() > 0) if (settingsDir.size() > 0)
{ {
gameTDB.OpenFile(sfmt("%s/wiitdb.xml", settingsDir.c_str()).c_str()); gameTDB.OpenFile(fmt("%s/wiitdb.xml", settingsDir.c_str()));
if(curLanguage.size() == 0) curLanguage = "EN"; if(curLanguage.size() == 0) curLanguage = "EN";
gameTDB.SetLanguageCode(curLanguage.c_str()); gameTDB.SetLanguageCode(curLanguage.c_str());
} }

View File

@ -289,14 +289,14 @@ s32 GCDump::DumpGame()
Asciify2(gcheader.title); Asciify2(gcheader.title);
snprintf(folder, sizeof(folder), sfmt((strncmp(gamepartition, "sd", 2) != 0) ? usb_dml_game_dir : DML_DIR, gamepartition).c_str()); snprintf(folder, sizeof(folder), fmt((strncmp(gamepartition, "sd", 2) != 0) ? usb_dml_game_dir : DML_DIR, gamepartition));
if(!fsop_DirExist(folder)) if(!fsop_DirExist(folder))
{ {
gprintf("Creating directory: %s\n", folder); gprintf("Creating directory: %s\n", folder);
makedir(folder); makedir(folder);
} }
memset(folder, 0, sizeof(folder)); memset(folder, 0, sizeof(folder));
snprintf(folder, sizeof(folder), "%s/%s [%.06s]%s", sfmt((strncmp(gamepartition, "sd", 2) != 0) ? usb_dml_game_dir : DML_DIR, gamepartition).c_str(), gcheader.title, (char *)gcheader.id, Disc ? "2" : ""); snprintf(folder, sizeof(folder), "%s/%s [%.06s]%s", fmt((strncmp(gamepartition, "sd", 2) != 0) ? usb_dml_game_dir : DML_DIR, gamepartition), gcheader.title, (char *)gcheader.id, Disc ? "2" : "");
if(!fsop_DirExist(folder)) if(!fsop_DirExist(folder))
{ {
gprintf("Creating directory: %s\n", folder); gprintf("Creating directory: %s\n", folder);
@ -369,7 +369,7 @@ s32 GCDump::DumpGame()
if(writeexfiles) if(writeexfiles)
{ {
memset(folder, 0, sizeof(folder)); memset(folder, 0, sizeof(folder));
snprintf(folder, sizeof(folder), "%s/%s [%.06s]%s/sys", sfmt((strncmp(gamepartition, "sd", 2) != 0) ? usb_dml_game_dir : DML_DIR, gamepartition).c_str(), gcheader.title, (char *)gcheader.id, Disc ? "2" : ""); snprintf(folder, sizeof(folder), "%s/%s [%.06s]%s/sys", fmt((strncmp(gamepartition, "sd", 2) != 0) ? usb_dml_game_dir : DML_DIR, gamepartition), gcheader.title, (char *)gcheader.id, Disc ? "2" : "");
if(!fsop_DirExist(folder)) if(!fsop_DirExist(folder))
{ {
gprintf("Creating directory: %s\n", folder); gprintf("Creating directory: %s\n", folder);
@ -389,7 +389,7 @@ s32 GCDump::DumpGame()
gc_done += __DiscWrite(gamepath, 0x2440+NextOffset, ApploaderSize, ReadBuffer); gc_done += __DiscWrite(gamepath, 0x2440+NextOffset, ApploaderSize, ReadBuffer);
} }
snprintf(gamepath, sizeof(gamepath), "%s/%s [%.06s]%s/game.iso", sfmt((strncmp(gamepartition, "sd", 2) != 0) ? usb_dml_game_dir : DML_DIR, gamepartition).c_str(), gcheader.title, (char *)gcheader.id, Disc ? "2" : ""); snprintf(gamepath, sizeof(gamepath), "%s/%s [%.06s]%s/game.iso", fmt((strncmp(gamepartition, "sd", 2) != 0) ? usb_dml_game_dir : DML_DIR, gamepartition), gcheader.title, (char *)gcheader.id, Disc ? "2" : "");
gprintf("Writing %s\n", gamepath); gprintf("Writing %s\n", gamepath);
if(compressed) if(compressed)

View File

@ -151,7 +151,7 @@ void CMenu::init(void)
Playlog_Delete(); Playlog_Delete();
for(int i = SD; i <= USB8; i++) //Find the first partition with a wiiflow.ini for(int i = SD; i <= USB8; i++) //Find the first partition with a wiiflow.ini
if (DeviceHandler::Instance()->IsInserted(i) && DeviceHandler::Instance()->GetFSType(i) != PART_FS_WBFS && stat(sfmt("%s:/%s/" CFG_FILENAME, DeviceName[i], APPDATA_DIR2).c_str(), &dummy) == 0) if (DeviceHandler::Instance()->IsInserted(i) && DeviceHandler::Instance()->GetFSType(i) != PART_FS_WBFS && stat(fmt("%s:/%s/" CFG_FILENAME, DeviceName[i], APPDATA_DIR2), &dummy) == 0)
{ {
drive = DeviceName[i]; drive = DeviceName[i];
break; break;
@ -159,7 +159,7 @@ void CMenu::init(void)
if(drive == check) //No wiiflow.ini found if(drive == check) //No wiiflow.ini found
for(int i = SD; i <= USB8; i++) //Find the first partition with a boot.dol for(int i = SD; i <= USB8; i++) //Find the first partition with a boot.dol
if (DeviceHandler::Instance()->IsInserted(i) && DeviceHandler::Instance()->GetFSType(i) != PART_FS_WBFS && stat(sfmt("%s:/%s/boot.dol", DeviceName[i], APPDATA_DIR2).c_str(), &dummy) == 0) if (DeviceHandler::Instance()->IsInserted(i) && DeviceHandler::Instance()->GetFSType(i) != PART_FS_WBFS && stat(fmt("%s:/%s/boot.dol", DeviceName[i], APPDATA_DIR2), &dummy) == 0)
{ {
drive = DeviceName[i]; drive = DeviceName[i];
break; break;
@ -167,7 +167,7 @@ void CMenu::init(void)
if(drive == check) //No boot.dol found if(drive == check) //No boot.dol found
for(int i = SD; i <= USB8; i++) //Find the first partition with apps/wiiflow folder for(int i = SD; i <= USB8; i++) //Find the first partition with apps/wiiflow folder
if (DeviceHandler::Instance()->IsInserted(i) && DeviceHandler::Instance()->GetFSType(i) != PART_FS_WBFS && stat(sfmt("%s:/%s", DeviceName[i], APPDATA_DIR2).c_str(), &dummy) == 0) if (DeviceHandler::Instance()->IsInserted(i) && DeviceHandler::Instance()->GetFSType(i) != PART_FS_WBFS && stat(fmt("%s:/%s", DeviceName[i], APPDATA_DIR2), &dummy) == 0)
{ {
drive = DeviceName[i]; drive = DeviceName[i];
break; break;
@ -178,7 +178,7 @@ void CMenu::init(void)
if (DeviceHandler::Instance()->IsInserted(i) && DeviceHandler::Instance()->GetFSType(i) != PART_FS_WBFS) if (DeviceHandler::Instance()->IsInserted(i) && DeviceHandler::Instance()->GetFSType(i) != PART_FS_WBFS)
{ {
drive = DeviceName[i]; drive = DeviceName[i];
makedir((char *)sfmt("%s:/%s", DeviceName[i], APPDATA_DIR2).c_str()); //Make the apps dir, so saving wiiflow.ini does not fail. makedir((char *)fmt("%s:/%s", DeviceName[i], APPDATA_DIR2)); //Make the apps dir, so saving wiiflow.ini does not fail.
break; break;
} }
@ -195,7 +195,7 @@ void CMenu::init(void)
m_appDir = sfmt("%s:/%s", drive, APPDATA_DIR2); m_appDir = sfmt("%s:/%s", drive, APPDATA_DIR2);
gprintf("Wiiflow boot.dol Location: %s\n", m_appDir.c_str()); gprintf("Wiiflow boot.dol Location: %s\n", m_appDir.c_str());
m_cfg.load(sfmt("%s/" CFG_FILENAME, m_appDir.c_str()).c_str()); m_cfg.load(fmt("%s/" CFG_FILENAME, m_appDir.c_str()));
//Gecko Output to SD //Gecko Output to SD
if(!WriteToSD) if(!WriteToSD)
@ -211,7 +211,7 @@ void CMenu::init(void)
if (onUSB) if (onUSB)
{ {
for(int i = USB1; i <= USB8; i++) //Look for first partition with a wiiflow folder in root for(int i = USB1; i <= USB8; i++) //Look for first partition with a wiiflow folder in root
if (DeviceHandler::Instance()->IsInserted(i) && DeviceHandler::Instance()->GetFSType(i) != PART_FS_WBFS && stat(sfmt("%s:/%s", DeviceName[i], APPDATA_DIR).c_str(), &dummy) == 0) if (DeviceHandler::Instance()->IsInserted(i) && DeviceHandler::Instance()->GetFSType(i) != PART_FS_WBFS && stat(fmt("%s:/%s", DeviceName[i], APPDATA_DIR), &dummy) == 0)
{ {
drive = DeviceName[i]; drive = DeviceName[i];
break; break;
@ -221,7 +221,7 @@ void CMenu::init(void)
if(drive == check && onUSB) //No wiiflow folder found in root of any usb partition, and data_on_usb=yes if(drive == check && onUSB) //No wiiflow folder found in root of any usb partition, and data_on_usb=yes
for(int i = USB1; i <= USB8; i++) // Try first USB partition with wbfs folder. for(int i = USB1; i <= USB8; i++) // Try first USB partition with wbfs folder.
if (DeviceHandler::Instance()->IsInserted(i) && DeviceHandler::Instance()->GetFSType(i) != PART_FS_WBFS && stat(sfmt(GAMES_DIR, DeviceName[i]).c_str(), &dummy) == 0) if (DeviceHandler::Instance()->IsInserted(i) && DeviceHandler::Instance()->GetFSType(i) != PART_FS_WBFS && stat(fmt(GAMES_DIR, DeviceName[i]), &dummy) == 0)
{ {
drive = DeviceName[i]; drive = DeviceName[i];
break; break;
@ -261,7 +261,7 @@ void CMenu::init(void)
m_new_dml = m_cfg.getBool("DML", "dml_r52+", true); m_new_dml = m_cfg.getBool("DML", "dml_r52+", true);
m_DMLgameDir = sfmt("%%s:/%s", m_cfg.getString("DML", "dir_usb_games", "games").c_str()); m_DMLgameDir = sfmt("%%s:/%s", m_cfg.getString("DML", "dir_usb_games", "games").c_str());
m_cfg.getString("NAND", "path", "").c_str(); m_cfg.getString("NAND", "path", "");
m_cfg.getInt("NAND", "partition", 0); m_cfg.getInt("NAND", "partition", 0);
m_cfg.getBool("NAND", "disable", true); m_cfg.getBool("NAND", "disable", true);
@ -311,7 +311,7 @@ void CMenu::init(void)
} }
if (DeviceHandler::Instance()->IsInserted(i) if (DeviceHandler::Instance()->IsInserted(i)
&& ((m_current_view == COVERFLOW_USB && DeviceHandler::Instance()->GetFSType(i) == PART_FS_WBFS) && ((m_current_view == COVERFLOW_USB && DeviceHandler::Instance()->GetFSType(i) == PART_FS_WBFS)
|| stat(sfmt(checkDir, DeviceName[i]).c_str(), &dummy) == 0)) || stat(fmt(checkDir, DeviceName[i]), &dummy) == 0))
{ {
gprintf("Setting Emu NAND to Partition: %i\n",currentPartition); gprintf("Setting Emu NAND to Partition: %i\n",currentPartition);
m_cfg.setInt(domain, "partition", i); m_cfg.setInt(domain, "partition", i);
@ -340,10 +340,10 @@ void CMenu::init(void)
makedir((char *)m_helpDir.c_str()); makedir((char *)m_helpDir.c_str());
// INI files // INI files
m_cat.load(sfmt("%s/" CAT_FILENAME, m_settingsDir.c_str()).c_str()); m_cat.load(fmt("%s/" CAT_FILENAME, m_settingsDir.c_str()));
string themeName = m_cfg.getString("GENERAL", "theme", "DEFAULT"); string themeName = m_cfg.getString("GENERAL", "theme", "DEFAULT");
m_themeDataDir = sfmt("%s/%s", m_themeDir.c_str(), themeName.c_str()); m_themeDataDir = sfmt("%s/%s", m_themeDir.c_str(), themeName.c_str());
m_theme.load(sfmt("%s.ini", m_themeDataDir.c_str()).c_str()); m_theme.load(fmt("%s.ini", m_themeDataDir.c_str()));
m_plugin.init(m_pluginsDir); m_plugin.init(m_pluginsDir);
@ -382,11 +382,11 @@ void CMenu::init(void)
defaultMenuLanguage = 2; //Brazilian defaultMenuLanguage = 2; //Brazilian
m_curLanguage = CMenu::_translations[m_cfg.getInt("GENERAL", "language", defaultMenuLanguage)]; m_curLanguage = CMenu::_translations[m_cfg.getInt("GENERAL", "language", defaultMenuLanguage)];
if (!m_loc.load(sfmt("%s/%s.ini", m_languagesDir.c_str(), m_curLanguage.c_str()).c_str())) if (!m_loc.load(fmt("%s/%s.ini", m_languagesDir.c_str(), m_curLanguage.c_str())))
{ {
m_cfg.setInt("GENERAL", "language", 0); m_cfg.setInt("GENERAL", "language", 0);
m_curLanguage = CMenu::_translations[0]; m_curLanguage = CMenu::_translations[0];
m_loc.load(sfmt("%s/%s.ini", m_languagesDir.c_str(), m_curLanguage.c_str()).c_str()); m_loc.load(fmt("%s/%s.ini", m_languagesDir.c_str(), m_curLanguage.c_str()));
} }
bool extcheck = m_cfg.getBool("GENERAL", "extended_list_check", true); bool extcheck = m_cfg.getBool("GENERAL", "extended_list_check", true);
@ -402,7 +402,7 @@ void CMenu::init(void)
for(int chan = WPAD_MAX_WIIMOTES-2; chan >= 0; chan--) for(int chan = WPAD_MAX_WIIMOTES-2; chan >= 0; chan--)
{ {
m_cursor[chan].init(sfmt("%s/%s", m_themeDataDir.c_str(), m_theme.getString("GENERAL", sfmt("pointer%i", chan+1).c_str()).c_str()).c_str(), m_cursor[chan].init(fmt("%s/%s", m_themeDataDir.c_str(), m_theme.getString("GENERAL", fmt("pointer%i", chan+1)).c_str()),
m_vid.wide(), pShadowColor, pShadowX, pShadowY, pShadowBlur, chan); m_vid.wide(), pShadowColor, pShadowX, pShadowY, pShadowBlur, chan);
WPAD_SetVRes(chan, m_vid.width() + m_cursor[chan].width(), m_vid.height() + m_cursor[chan].height()); WPAD_SetVRes(chan, m_vid.width() + m_cursor[chan].width(), m_vid.height() + m_cursor[chan].height());
} }
@ -419,8 +419,8 @@ void CMenu::init(void)
m_disable_exit = exit_to == EXIT_TO_DISABLE; m_disable_exit = exit_to == EXIT_TO_DISABLE;
if(exit_to == EXIT_TO_BOOTMII && (!DeviceHandler::Instance()->IsInserted(SD) || if(exit_to == EXIT_TO_BOOTMII && (!DeviceHandler::Instance()->IsInserted(SD) ||
stat(sfmt("%s:/bootmii/armboot.bin",DeviceName[SD]).c_str(), &dummy) != 0 || stat(fmt("%s:/bootmii/armboot.bin",DeviceName[SD]), &dummy) != 0 ||
stat(sfmt("%s:/bootmii/ppcboot.elf", DeviceName[SD]).c_str(), &dummy) != 0)) stat(fmt("%s:/bootmii/ppcboot.elf", DeviceName[SD]), &dummy) != 0))
exit_to = EXIT_TO_HBC; exit_to = EXIT_TO_HBC;
Sys_ExitTo(exit_to); Sys_ExitTo(exit_to);
@ -452,8 +452,8 @@ void CMenu::init(void)
{ {
gprintf("Found gamercard provider: %s\n",(*itr).c_str()); gprintf("Found gamercard provider: %s\n",(*itr).c_str());
register_card_provider( register_card_provider(
m_cfg.getString("GAMERCARD", sfmt("%s_url", (*itr).c_str())).c_str(), m_cfg.getString("GAMERCARD", fmt("%s_url", (*itr).c_str())).c_str(),
m_cfg.getString("GAMERCARD", sfmt("%s_key", (*itr).c_str())).c_str() m_cfg.getString("GAMERCARD", fmt("%s_key", (*itr).c_str())).c_str()
); );
} }
} }
@ -595,8 +595,8 @@ void CMenu::_loadCFLayout(int version, bool forceAA, bool otherScrnFmt)
{ {
bool homebrew = m_current_view == COVERFLOW_HOMEBREW; bool homebrew = m_current_view == COVERFLOW_HOMEBREW;
bool smallbox = (homebrew || m_current_view == COVERFLOW_EMU) && m_cfg.getBool(_domainFromView(), "smallbox", true); bool smallbox = (homebrew || m_current_view == COVERFLOW_EMU) && m_cfg.getBool(_domainFromView(), "smallbox", true);
string domain(smallbox ? (homebrew ? sfmt("_BREWFLOW_%i", version).c_str() : sfmt("_EMUFLOW_%i", version).c_str()) : sfmt("_COVERFLOW_%i", version).c_str()); string domain(smallbox ? (homebrew ? fmt("_BREWFLOW_%i", version) : fmt("_EMUFLOW_%i", version)) : fmt("_COVERFLOW_%i", version));
string domainSel(smallbox ? (homebrew ? sfmt("_BREWFLOW_%i_S", version).c_str() : sfmt("_EMUFLOW_%i_S", version).c_str()) : sfmt("_COVERFLOW_%i_S", version).c_str()); string domainSel(smallbox ? (homebrew ? fmt("_BREWFLOW_%i_S", version) : fmt("_EMUFLOW_%i_S", version)) : fmt("_COVERFLOW_%i_S", version));
bool sf = otherScrnFmt; bool sf = otherScrnFmt;
int max_fsaa = m_theme.getInt(domain, "max_fsaa", 3); int max_fsaa = m_theme.getInt(domain, "max_fsaa", 3);
@ -1076,7 +1076,7 @@ SFont CMenu::_font(CMenu::FontSet &fontSet, const char *domain, const char *key,
// TTF not found in memory, load it to create a new font // TTF not found in memory, load it to create a new font
SFont retFont; SFont retFont;
if (!useDefault && retFont.fromFile(sfmt("%s/%s", m_themeDataDir.c_str(), filename.c_str()).c_str(), fonts[0].res, fonts[1].res, fonts[2].res, index)) if (!useDefault && retFont.fromFile(fmt("%s/%s", m_themeDataDir.c_str(), filename.c_str()), fonts[0].res, fonts[1].res, fonts[2].res, index))
{ {
// Theme Font // Theme Font
fontSet[CMenu::FontDesc(upperCase(filename.c_str()), fonts[0].res)] = retFont; fontSet[CMenu::FontDesc(upperCase(filename.c_str()), fonts[0].res)] = retFont;
@ -1111,7 +1111,7 @@ safe_vector<STexture> CMenu::_textures(TexSet &texSet, const char *domain, const
textures.push_back(i->second); textures.push_back(i->second);
} }
STexture tex; STexture tex;
if (STexture::TE_OK == tex.fromPNGFile(sfmt("%s/%s", m_themeDataDir.c_str(), filename.c_str()).c_str(), GX_TF_RGBA8, ALLOC_MEM2)) if (STexture::TE_OK == tex.fromPNGFile(fmt("%s/%s", m_themeDataDir.c_str(), filename.c_str()), GX_TF_RGBA8, ALLOC_MEM2))
{ {
texSet[filename] = tex; texSet[filename] = tex;
textures.push_back(tex); textures.push_back(tex);
@ -1136,7 +1136,7 @@ STexture CMenu::_texture(CMenu::TexSet &texSet, const char *domain, const char *
return i->second; return i->second;
STexture tex; STexture tex;
if (STexture::TE_OK == tex.fromPNGFile(sfmt("%s/%s", m_themeDataDir.c_str(), filename.c_str()).c_str(), GX_TF_RGBA8, ALLOC_MEM2)) if (STexture::TE_OK == tex.fromPNGFile(fmt("%s/%s", m_themeDataDir.c_str(), filename.c_str()), GX_TF_RGBA8, ALLOC_MEM2))
{ {
texSet[filename] = tex; texSet[filename] = tex;
return tex; return tex;
@ -1157,7 +1157,7 @@ SmartGuiSound CMenu::_sound(CMenu::SoundSet &soundSet, const char *domain, const
if (i == soundSet.end()) if (i == soundSet.end())
{ {
if(strncmp(filename.c_str(), name.c_str(), name.size()) != 0) if(strncmp(filename.c_str(), name.c_str(), name.size()) != 0)
soundSet[upperCase(filename.c_str())] = SmartGuiSound(new GuiSound(sfmt("%s/%s", m_themeDataDir.c_str(), filename.c_str()).c_str())); soundSet[upperCase(filename.c_str())] = SmartGuiSound(new GuiSound(fmt("%s/%s", m_themeDataDir.c_str(), filename.c_str())));
else else
soundSet[upperCase(filename.c_str())] = SmartGuiSound(new GuiSound(snd, len, filename, isAllocated)); soundSet[upperCase(filename.c_str())] = SmartGuiSound(new GuiSound(snd, len, filename, isAllocated));
@ -1180,7 +1180,7 @@ SmartGuiSound CMenu::_sound(CMenu::SoundSet &soundSet, const char *domain, const
CMenu::SoundSet::iterator i = soundSet.find(upperCase(filename.c_str())); CMenu::SoundSet::iterator i = soundSet.find(upperCase(filename.c_str()));
if (i == soundSet.end()) if (i == soundSet.end())
{ {
soundSet[upperCase(filename.c_str())] = SmartGuiSound(new GuiSound(sfmt("%s/%s", m_themeDataDir.c_str(), filename.c_str()).c_str())); soundSet[upperCase(filename.c_str())] = SmartGuiSound(new GuiSound(fmt("%s/%s", m_themeDataDir.c_str(), filename.c_str())));
return soundSet[upperCase(filename.c_str())]; return soundSet[upperCase(filename.c_str())];
} }
return i->second; return i->second;
@ -1456,9 +1456,9 @@ void CMenu::_initCF(void)
m_cf.reserve(m_gameList.size()); m_cf.reserve(m_gameList.size());
m_gamelistdump = m_cfg.getBool(domain, "dump_list", true); m_gamelistdump = m_cfg.getBool(domain, "dump_list", true);
if(m_gamelistdump) m_dump.load(sfmt("%s/titlesdump.ini", m_settingsDir.c_str()).c_str()); if(m_gamelistdump) m_dump.load(fmt("%s/titlesdump.ini", m_settingsDir.c_str()));
m_gcfg1.load(sfmt("%s/gameconfig1.ini", m_settingsDir.c_str()).c_str()); m_gcfg1.load(fmt("%s/gameconfig1.ini", m_settingsDir.c_str()));
string id; string id;
for (u32 i = 0; i < m_gameList.size(); ++i) for (u32 i = 0; i < m_gameList.size(); ++i)
{ {
@ -1508,15 +1508,15 @@ void CMenu::_initCF(void)
string coverFolder(m_plugin.GetCoverFolderName(m_gameList[i].hdr.magic)); string coverFolder(m_plugin.GetCoverFolderName(m_gameList[i].hdr.magic));
//if(tempname.find_last_of('.') != string::npos) //if(tempname.find_last_of('.') != string::npos)
// tempname.erase(tempname.find_last_of('.'), tempname.size() - tempname.find_last_of('.')); // tempname.erase(tempname.find_last_of('.'), tempname.size() - tempname.find_last_of('.'));
m_cf.addItem(&m_gameList[i], sfmt("%s/%s/%s.png", m_picDir.c_str(), coverFolder.c_str(), tempname.c_str()).c_str(), sfmt("%s/%s/%s.png", m_boxPicDir.c_str(), coverFolder.c_str(), tempname.c_str()).c_str(), playcount, lastPlayed); m_cf.addItem(&m_gameList[i], fmt("%s/%s/%s.png", m_picDir.c_str(), coverFolder.c_str(), tempname.c_str()), fmt("%s/%s/%s.png", m_boxPicDir.c_str(), coverFolder.c_str(), tempname.c_str()), playcount, lastPlayed);
} }
else if (m_current_view != COVERFLOW_HOMEBREW) else if (m_current_view != COVERFLOW_HOMEBREW)
m_cf.addItem(&m_gameList[i], sfmt("%s/%s.png", m_picDir.c_str(), id.c_str()).c_str(), sfmt("%s/%s.png", m_boxPicDir.c_str(), id.c_str()).c_str(), playcount, lastPlayed); m_cf.addItem(&m_gameList[i], fmt("%s/%s.png", m_picDir.c_str(), id.c_str()), fmt("%s/%s.png", m_boxPicDir.c_str(), id.c_str()), playcount, lastPlayed);
else else
{ {
string s = sfmt("%s", m_gameList[i].path); string s = sfmt("%s", m_gameList[i].path);
string f = s.substr(0, s.find_last_of("/")); string f = s.substr(0, s.find_last_of("/"));
m_cf.addItem(&m_gameList[i], sfmt("%s/icon.png", f.c_str()).c_str(), sfmt("%s/%s.png", m_boxPicDir.c_str(), id.c_str()).c_str(), playcount, lastPlayed); m_cf.addItem(&m_gameList[i], fmt("%s/icon.png", f.c_str()), fmt("%s/%s.png", m_boxPicDir.c_str(), id.c_str()), playcount, lastPlayed);
} }
} }
@ -1629,7 +1629,7 @@ void CMenu::_mainLoopCommon(bool withCF, bool blockReboot, bool adjusting)
timeinfo = localtime(&rawtime); timeinfo = localtime(&rawtime);
strftime(buffer,80,"%b-%d-20%y-%Hh%Mm%Ss.png",timeinfo); strftime(buffer,80,"%b-%d-20%y-%Hh%Mm%Ss.png",timeinfo);
gprintf("Screenshot taken and saved to: %s/%s\n", m_screenshotDir.c_str(), buffer); gprintf("Screenshot taken and saved to: %s/%s\n", m_screenshotDir.c_str(), buffer);
m_vid.TakeScreenshot(sfmt("%s/%s", m_screenshotDir.c_str(), buffer).c_str()); m_vid.TakeScreenshot(fmt("%s/%s", m_screenshotDir.c_str(), buffer));
if (!!m_cameraSound) if (!!m_cameraSound)
m_cameraSound->Play(255); m_cameraSound->Play(255);
} }

View File

@ -127,9 +127,9 @@ void CMenu::_textAbout(void)
m_btnMgr.setText(m_aboutLblTitle, wfmt(_fmt("appname", L"%s (%s-r%s)"), APP_NAME, APP_VERSION, SVN_REV), false); m_btnMgr.setText(m_aboutLblTitle, wfmt(_fmt("appname", L"%s (%s-r%s)"), APP_NAME, APP_VERSION, SVN_REV), false);
char *help = (char*)calloc(4096, sizeof(char)); char *help = (char*)calloc(4096, sizeof(char));
FILE * f = fopen(sfmt("%s/%s.txt", m_helpDir.c_str(), m_curLanguage.c_str()).c_str(), "r"); FILE * f = fopen(fmt("%s/%s.txt", m_helpDir.c_str(), m_curLanguage.c_str()), "r");
if (f == NULL) if (f == NULL)
f = fopen(sfmt("%s/english.txt", m_helpDir.c_str()).c_str(), "r"); f = fopen(fmt("%s/english.txt", m_helpDir.c_str()), "r");
if (f == NULL) if (f == NULL)
strcpy(help, "ERROR: No Help File Found"); strcpy(help, "ERROR: No Help File Found");
else else

View File

@ -185,21 +185,21 @@ void CMenu::_initCategorySettingsMenu(CMenu::SThemeData &theme)
m_categoryBtnCats[0] = _addPicButton(theme, "CATEGORY/CAT_0_BTNS", theme.checkboxon, theme.checkboxons, 30, 390, 44, 48); m_categoryBtnCats[0] = _addPicButton(theme, "CATEGORY/CAT_0_BTNS", theme.checkboxon, theme.checkboxons, 30, 390, 44, 48);
for (int i = 1; i < 6; ++i) for (int i = 1; i < 6; ++i)
{ // Page 1 { // Page 1
m_categoryLblCat[i] = _addLabel(theme, sfmt("CATEGORY/CAT_%i", i).c_str(), theme.lblFont, L"", 85, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); m_categoryLblCat[i] = _addLabel(theme, fmt("CATEGORY/CAT_%i", i), theme.lblFont, L"", 85, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_categoryBtnCat[i] = _addPicButton(theme, sfmt("CATEGORY/CAT_%i_BTN", i).c_str(), theme.checkboxoff, theme.checkboxoffs, 30, (42+i*58), 44, 48); m_categoryBtnCat[i] = _addPicButton(theme, fmt("CATEGORY/CAT_%i_BTN", i), theme.checkboxoff, theme.checkboxoffs, 30, (42+i*58), 44, 48);
m_categoryBtnCats[i] = _addPicButton(theme, sfmt("CATEGORY/CAT_%i_BTNS", i).c_str(), theme.checkboxon, theme.checkboxons, 30, (42+i*58), 44, 48); m_categoryBtnCats[i] = _addPicButton(theme, fmt("CATEGORY/CAT_%i_BTNS", i), theme.checkboxon, theme.checkboxons, 30, (42+i*58), 44, 48);
// right half // right half
m_categoryLblCat[i+5] = _addLabel(theme, sfmt("CATEGORY/CAT_%i", i+5).c_str(), theme.txtFont, L"", 380, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); m_categoryLblCat[i+5] = _addLabel(theme, fmt("CATEGORY/CAT_%i", i+5), theme.txtFont, L"", 380, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_categoryBtnCat[i+5] = _addPicButton(theme, sfmt("CATEGORY/CAT_%i_BTN", i+5).c_str(), theme.checkboxoff, theme.checkboxoffs, 325, (42+i*58), 44, 48); m_categoryBtnCat[i+5] = _addPicButton(theme, fmt("CATEGORY/CAT_%i_BTN", i+5), theme.checkboxoff, theme.checkboxoffs, 325, (42+i*58), 44, 48);
m_categoryBtnCats[i+5] = _addPicButton(theme, sfmt("CATEGORY/CAT_%i_BTNS", i+5).c_str(), theme.checkboxon, theme.checkboxons, 325, (42+i*58), 44, 48); m_categoryBtnCats[i+5] = _addPicButton(theme, fmt("CATEGORY/CAT_%i_BTNS", i+5), theme.checkboxon, theme.checkboxons, 325, (42+i*58), 44, 48);
// Page 2 // Page 2
m_categoryLblCat[i+10] = _addLabel(theme, sfmt("CATEGORY/CAT_%i", i+10).c_str(), theme.lblFont, L"", 85, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); m_categoryLblCat[i+10] = _addLabel(theme, fmt("CATEGORY/CAT_%i", i+10), theme.lblFont, L"", 85, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_categoryBtnCat[i+10] = _addPicButton(theme, sfmt("CATEGORY/CAT_%i_BTN", i+10).c_str(), theme.checkboxoff, theme.checkboxoffs, 30, (42+i*58), 44, 48); m_categoryBtnCat[i+10] = _addPicButton(theme, fmt("CATEGORY/CAT_%i_BTN", i+10), theme.checkboxoff, theme.checkboxoffs, 30, (42+i*58), 44, 48);
m_categoryBtnCats[i+10] = _addPicButton(theme, sfmt("CATEGORY/CAT_%i_BTNS", i+10).c_str(), theme.checkboxon, theme.checkboxons, 30, (42+i*58), 44, 48); m_categoryBtnCats[i+10] = _addPicButton(theme, fmt("CATEGORY/CAT_%i_BTNS", i+10), theme.checkboxon, theme.checkboxons, 30, (42+i*58), 44, 48);
// right half // right half
m_categoryLblCat[i+15] = _addLabel(theme, sfmt("CATEGORY/CAT_%i", i+15).c_str(), theme.txtFont, L"", 380, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); m_categoryLblCat[i+15] = _addLabel(theme, fmt("CATEGORY/CAT_%i", i+15), theme.txtFont, L"", 380, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_categoryBtnCat[i+15] = _addPicButton(theme, sfmt("CATEGORY/CAT_%i_BTN", i+15).c_str(), theme.checkboxoff, theme.checkboxoffs, 325, (42+i*58), 44, 48); m_categoryBtnCat[i+15] = _addPicButton(theme, fmt("CATEGORY/CAT_%i_BTN", i+15), theme.checkboxoff, theme.checkboxoffs, 325, (42+i*58), 44, 48);
m_categoryBtnCats[i+15] = _addPicButton(theme, sfmt("CATEGORY/CAT_%i_BTNS", i+15).c_str(), theme.checkboxon, theme.checkboxons, 325, (42+i*58), 44, 48); m_categoryBtnCats[i+15] = _addPicButton(theme, fmt("CATEGORY/CAT_%i_BTNS", i+15), theme.checkboxon, theme.checkboxons, 325, (42+i*58), 44, 48);
} }
_setHideAnim(m_categoryLblTitle, "CATEGORY/TITLE", 0, -200, 0.f, 1.f); _setHideAnim(m_categoryLblTitle, "CATEGORY/TITLE", 0, -200, 0.f, 1.f);
_setHideAnim(m_categoryLblPage, "CATEGORY/PAGE_BTN", 0, 200, 1.f, 0.f); _setHideAnim(m_categoryLblPage, "CATEGORY/PAGE_BTN", 0, 200, 1.f, 0.f);
@ -207,9 +207,9 @@ void CMenu::_initCategorySettingsMenu(CMenu::SThemeData &theme)
_setHideAnim(m_categoryBtnPageP, "CATEGORY/PAGE_PLUS", 0, 200, 1.f, 0.f); _setHideAnim(m_categoryBtnPageP, "CATEGORY/PAGE_PLUS", 0, 200, 1.f, 0.f);
_setHideAnim(m_categoryBtnBack, "CATEGORY/BACK_BTN", 0, 200, 1.f, 0.f); _setHideAnim(m_categoryBtnBack, "CATEGORY/BACK_BTN", 0, 200, 1.f, 0.f);
for (int i = 0; i < 21; ++i) { for (int i = 0; i < 21; ++i) {
_setHideAnim(m_categoryBtnCat[i], sfmt("CATEGORY/CAT_%i_BTN", i).c_str(), 0, 0, 1.f, 0.f); _setHideAnim(m_categoryBtnCat[i], fmt("CATEGORY/CAT_%i_BTN", i), 0, 0, 1.f, 0.f);
_setHideAnim(m_categoryBtnCats[i], sfmt("CATEGORY/CAT_%i_BTNS", i).c_str(), 0, 0, 1.f, 0.f); _setHideAnim(m_categoryBtnCats[i], fmt("CATEGORY/CAT_%i_BTNS", i), 0, 0, 1.f, 0.f);
_setHideAnim(m_categoryLblCat[i], sfmt("CATEGORY/CAT_%i", i).c_str(), 0, 0, 1.f, 0.f); _setHideAnim(m_categoryLblCat[i], fmt("CATEGORY/CAT_%i", i), 0, 0, 1.f, 0.f);
m_categoryBtn[i] = m_categoryBtnCat[i]; m_categoryBtn[i] = m_categoryBtnCat[i];
} }
_hideCategorySettings(true); _hideCategorySettings(true);

View File

@ -328,7 +328,7 @@ void CMenu::_cfTheme(void)
{ {
m_theme.clear(); m_theme.clear();
m_theme.unload(); m_theme.unload();
m_theme.load(sfmt("%s/%s.ini", m_themeDir.c_str(), m_cfg.getString("GENERAL", "theme", "defaut").c_str()).c_str()); m_theme.load(fmt("%s/%s.ini", m_themeDir.c_str(), m_cfg.getString("GENERAL", "theme", "defaut").c_str()));
break; break;
} }
else if (BTN_UP_PRESSED) else if (BTN_UP_PRESSED)
@ -409,7 +409,7 @@ void CMenu::_cfTheme(void)
{ {
m_theme.clear(); m_theme.clear();
m_theme.unload(); m_theme.unload();
m_theme.load(sfmt("%s/%s.ini", m_themeDir.c_str(), m_cfg.getString("GENERAL", "theme", "defaut").c_str()).c_str()); m_theme.load(fmt("%s/%s.ini", m_themeDir.c_str(), m_cfg.getString("GENERAL", "theme", "defaut").c_str()));
break; break;
} }
else if (m_btnMgr.selected(m_cfThemeBtnAlt) && m_current_view != COVERFLOW_HOMEBREW && m_current_view != COVERFLOW_EMU) else if (m_btnMgr.selected(m_cfThemeBtnAlt) && m_current_view != COVERFLOW_HOMEBREW && m_current_view != COVERFLOW_EMU)
@ -584,12 +584,12 @@ void CMenu::_initCFThemeMenu(CMenu::SThemeData &theme)
domain = sfmt("CFTHEME/VAL%i%c_%%s", i / 3 + 1, (char)(i % 3) + 'A'); domain = sfmt("CFTHEME/VAL%i%c_%%s", i / 3 + 1, (char)(i % 3) + 'A');
x = 20 + (i / 4) * 150; x = 20 + (i / 4) * 150;
y = 340 + (i % 4) * 32; y = 340 + (i % 4) * 32;
m_cfThemeLblVal[i] = _addLabel(theme, sfmt(domain.c_str(), "BTN").c_str(), theme.btnFont, L"", x + 32, y, 86, 32, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC); m_cfThemeLblVal[i] = _addLabel(theme, fmt(domain.c_str(), "BTN"), theme.btnFont, L"", x + 32, y, 86, 32, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_cfThemeBtnValM[i] = _addPicButton(theme, sfmt(domain.c_str(), "MINUS").c_str(), theme.btnTexMinus, theme.btnTexMinusS, x, y, 32, 32); m_cfThemeBtnValM[i] = _addPicButton(theme, fmt(domain.c_str(), "MINUS"), theme.btnTexMinus, theme.btnTexMinusS, x, y, 32, 32);
m_cfThemeBtnValP[i] = _addPicButton(theme, sfmt(domain.c_str(), "PLUS").c_str(), theme.btnTexPlus, theme.btnTexPlusS, x + 118, y, 32, 32); m_cfThemeBtnValP[i] = _addPicButton(theme, fmt(domain.c_str(), "PLUS"), theme.btnTexPlus, theme.btnTexPlusS, x + 118, y, 32, 32);
} }
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)
m_cfThemeLblValTxt[i] = _addLabel(theme, sfmt("CFTHEME/VAL%i_LBL", i + 1).c_str(), theme.lblFont, L"", 20 + i * 150, 100, 150, 240, theme.lblFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_BOTTOM, emptyTex); m_cfThemeLblValTxt[i] = _addLabel(theme, fmt("CFTHEME/VAL%i_LBL", i + 1), theme.lblFont, L"", 20 + i * 150, 100, 150, 240, theme.lblFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_BOTTOM, emptyTex);
_hideCFTheme(true); _hideCFTheme(true);
} }

View File

@ -54,7 +54,7 @@ u32 CMenu::_downloadCheatFileAsync(void *obj)
string id = m->m_cf.getId(); string id = m->m_cf.getId();
char type = id[0] == 'S' ? 'R' : id[0]; char type = id[0] == 'S' ? 'R' : id[0];
block cheatfile = downloadfile(buffer.get(), bufferSize, sfmt(GECKOURL, type, id.c_str()).c_str(),CMenu::_downloadProgress, m); block cheatfile = downloadfile(buffer.get(), bufferSize, fmt(GECKOURL, type, id.c_str()), CMenu::_downloadProgress, m);
if (cheatfile.data != NULL && cheatfile.size > 65 && cheatfile.data[0] != '<') if (cheatfile.data != NULL && cheatfile.size > 65 && cheatfile.data[0] != '<')
{ {
@ -360,8 +360,8 @@ void CMenu::_initCheatSettingsMenu(CMenu::SThemeData &theme)
_setHideAnim(m_cheatBtnPageP, "CHEAT/PAGE_PLUS", 0, 0, 1.f, -1.f); _setHideAnim(m_cheatBtnPageP, "CHEAT/PAGE_PLUS", 0, 0, 1.f, -1.f);
for (int i=0;i<CHEATSPERPAGE;++i) { for (int i=0;i<CHEATSPERPAGE;++i) {
_setHideAnim(m_cheatLblItem[i], sfmt("CHEAT/ITEM_%i", i).c_str(), -200, 0, 1.f, 0.f); _setHideAnim(m_cheatLblItem[i], fmt("CHEAT/ITEM_%i", i), -200, 0, 1.f, 0.f);
_setHideAnim(m_cheatBtnItem[i], sfmt("CHEAT/ITEM_%i_BTN", i).c_str(), 200, 0, 1.f, 0.f); _setHideAnim(m_cheatBtnItem[i], fmt("CHEAT/ITEM_%i_BTN", i), 200, 0, 1.f, 0.f);
} }
_hideCheatSettings(); _hideCheatSettings();

View File

@ -126,7 +126,7 @@ void CMenu::_initCodeMenu(CMenu::SThemeData &theme)
m_codeBtnBack = _addButton(theme, "CODE/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor); m_codeBtnBack = _addButton(theme, "CODE/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
// //
for (int i = 0; i < 10; ++i) for (int i = 0; i < 10; ++i)
_setHideAnim(m_codeBtnKey[i], sfmt("CODE/%i_BTN", i).c_str(), 0, 0, 0.f, 0.f); _setHideAnim(m_codeBtnKey[i], fmt("CODE/%i_BTN", i), 0, 0, 0.f, 0.f);
_setHideAnim(m_codeBtnErase, "CODE/ERASE_BTN", 0, 0, -2.f, 0.f); _setHideAnim(m_codeBtnErase, "CODE/ERASE_BTN", 0, 0, -2.f, 0.f);
_setHideAnim(m_codeBtnBack, "CODE/BACK_BTN", 0, 0, -2.f, 0.f); _setHideAnim(m_codeBtnBack, "CODE/BACK_BTN", 0, 0, -2.f, 0.f);
// //

View File

@ -72,8 +72,8 @@ void CMenu::_showConfig4(void)
m_btnMgr.setText(m_config4BtnCategoryOnBoot, m_cat.getBool("GENERAL", "category_on_start") ? _t("on", L"On") : _t("off", L"Off")); m_btnMgr.setText(m_config4BtnCategoryOnBoot, m_cat.getBool("GENERAL", "category_on_start") ? _t("on", L"On") : _t("off", L"Off"));
Config titles, custom_titles; Config titles, custom_titles;
titles.load(sfmt("%s/" TITLES_FILENAME, m_settingsDir.c_str()).c_str()); titles.load(fmt("%s/" TITLES_FILENAME, m_settingsDir.c_str()));
custom_titles.load(sfmt("%s/" CTITLES_FILENAME, m_settingsDir.c_str()).c_str()); custom_titles.load(fmt("%s/" CTITLES_FILENAME, m_settingsDir.c_str()));
wstringEx channelName = m_loc.getWString(m_curLanguage, "disabled", L"Disabled"); wstringEx channelName = m_loc.getWString(m_curLanguage, "disabled", L"Disabled");

View File

@ -137,7 +137,7 @@ int CMenu::_configAdv(void)
s8 direction = m_btnMgr.selected(m_configAdvBtnCurLanguageP) ? 1 : -1; s8 direction = m_btnMgr.selected(m_configAdvBtnCurLanguageP) ? 1 : -1;
int lang = (int)loopNum((u32)m_cfg.getInt("GENERAL", "language", 0) + direction, ARRAY_SIZE(CMenu::_translations)); int lang = (int)loopNum((u32)m_cfg.getInt("GENERAL", "language", 0) + direction, ARRAY_SIZE(CMenu::_translations));
m_curLanguage = CMenu::_translations[lang]; m_curLanguage = CMenu::_translations[lang];
if (m_loc.load(sfmt("%s/%s.ini", m_languagesDir.c_str(), m_curLanguage.c_str()).c_str())) if (m_loc.load(fmt("%s/%s.ini", m_languagesDir.c_str(), m_curLanguage.c_str())))
{ {
m_cfg.setInt("GENERAL", "language", lang); m_cfg.setInt("GENERAL", "language", lang);
lang_changed = true; lang_changed = true;
@ -149,13 +149,13 @@ int CMenu::_configAdv(void)
lang = (int)loopNum((u32)lang + direction, ARRAY_SIZE(CMenu::_translations)); lang = (int)loopNum((u32)lang + direction, ARRAY_SIZE(CMenu::_translations));
m_curLanguage = CMenu::_translations[lang]; m_curLanguage = CMenu::_translations[lang];
struct stat langs; struct stat langs;
if (stat(sfmt("%s/%s.ini", m_languagesDir.c_str(), m_curLanguage.c_str()).c_str(), &langs) == 0) if (stat(fmt("%s/%s.ini", m_languagesDir.c_str(), m_curLanguage.c_str()), &langs) == 0)
break; break;
} }
m_cfg.setInt("GENERAL", "language", lang); m_cfg.setInt("GENERAL", "language", lang);
lang_changed = true; lang_changed = true;
m_curLanguage = CMenu::_translations[lang]; m_curLanguage = CMenu::_translations[lang];
m_loc.load(sfmt("%s/%s.ini", m_languagesDir.c_str(), m_curLanguage.c_str()).c_str()); m_loc.load(fmt("%s/%s.ini", m_languagesDir.c_str(), m_curLanguage.c_str()));
} }
_updateText(); _updateText();
_showConfigAdv(); _showConfigAdv();

View File

@ -412,7 +412,7 @@ void CMenu::_showGameSettings(void)
void CMenu::_gameSettings(void) void CMenu::_gameSettings(void)
{ {
m_gcfg2.load(sfmt("%s/gameconfig2.ini", m_settingsDir.c_str()).c_str()); m_gcfg2.load(fmt("%s/gameconfig2.ini", m_settingsDir.c_str()));
string id(m_cf.getId()); string id(m_cf.getId());
m_gameSettingsPage = 1; m_gameSettingsPage = 1;

View File

@ -483,7 +483,7 @@ int CMenu::_coverDownloader(bool missingOnly)
GameTDB c_gameTDB; GameTDB c_gameTDB;
if (m_settingsDir.size() > 0) if (m_settingsDir.size() > 0)
{ {
c_gameTDB.OpenFile(sfmt("%s/wiitdb.xml", m_settingsDir.c_str()).c_str()); c_gameTDB.OpenFile(fmt("%s/wiitdb.xml", m_settingsDir.c_str()));
c_gameTDB.SetLanguageCode(m_curLanguage.c_str()); c_gameTDB.SetLanguageCode(m_curLanguage.c_str());
} }
@ -524,7 +524,7 @@ int CMenu::_coverDownloader(bool missingOnly)
m_thrdStepLen = dlWeight / (float)nbSteps; m_thrdStepLen = dlWeight / (float)nbSteps;
Config m_newID; Config m_newID;
m_newID.load(sfmt("%s/newid.ini", m_settingsDir.c_str()).c_str()); m_newID.load(fmt("%s/newid.ini", m_settingsDir.c_str()));
m_newID.setString("CHANNELS", "WFSF", "DWFA"); m_newID.setString("CHANNELS", "WFSF", "DWFA");
u32 CoverType = 0; u32 CoverType = 0;
@ -1973,7 +1973,7 @@ int CMenu::_gametdbDownloaderAsync()
LWP_MutexUnlock(m_mutex); LWP_MutexUnlock(m_mutex);
m_thrdStep = 0.0f; m_thrdStep = 0.0f;
m_thrdStepLen = 1.0f; m_thrdStepLen = 1.0f;
download = downloadfile(buffer.get(), bufferSize, sfmt(GAMETDB_URL, langCode.c_str()).c_str(), CMenu::_downloadProgress, this); download = downloadfile(buffer.get(), bufferSize, fmt(GAMETDB_URL, langCode.c_str()), CMenu::_downloadProgress, this);
if (download.data == 0) if (download.data == 0)
{ {
LWP_MutexLock(m_mutex); LWP_MutexLock(m_mutex);

View File

@ -347,7 +347,7 @@ static void setLanguage(int l)
void CMenu::_game(bool launch) void CMenu::_game(bool launch)
{ {
m_gcfg1.load(sfmt("%s/gameconfig1.ini", m_settingsDir.c_str()).c_str()); m_gcfg1.load(fmt("%s/gameconfig1.ini", m_settingsDir.c_str()));
if (!launch) if (!launch)
{ {
SetupInput(); SetupInput();
@ -482,7 +482,7 @@ void CMenu::_game(bool launch)
if(currentPartition != SD && hdr->hdr.gc_magic == 0xc2339f3d) if(currentPartition != SD && hdr->hdr.gc_magic == 0xc2339f3d)
{ {
char gcfolder[300]; char gcfolder[300];
sprintf(gcfolder, "%s [%s]", m_cf.getTitle().toUTF8().c_str(), (char *)hdr->hdr.id); snprintf(gcfolder, sizeof(gcfolder), "%s [%s]", m_cf.getTitle().toUTF8().c_str(), (char *)hdr->hdr.id);
if (GC_GameIsInstalled((char *)hdr->hdr.id, DeviceName[SD], DML_DIR)) if (GC_GameIsInstalled((char *)hdr->hdr.id, DeviceName[SD], DML_DIR))
{ {
memset(hdr->path, 0, sizeof(hdr->path)); memset(hdr->path, 0, sizeof(hdr->path));
@ -636,7 +636,7 @@ void CMenu::_directlaunch(const string &id)
void CMenu::_launch(dir_discHdr *hdr) void CMenu::_launch(dir_discHdr *hdr)
{ {
m_gcfg2.load(sfmt("%s/gameconfig2.ini", m_settingsDir.c_str()).c_str()); m_gcfg2.load(fmt("%s/gameconfig2.ini", m_settingsDir.c_str()));
if(hdr->hdr.gc_magic == 0x4c4f4c4f) if(hdr->hdr.gc_magic == 0x4c4f4c4f)
{ {
string title(&hdr->path[std::string(hdr->path).find_last_of("/")+1]); string title(&hdr->path[std::string(hdr->path).find_last_of("/")+1]);
@ -1116,13 +1116,13 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
Nand::Instance()->CreatePath("%s:/wiiflow/nandemu", DeviceName[emuPartition]); Nand::Instance()->CreatePath("%s:/wiiflow/nandemu", DeviceName[emuPartition]);
m_cfg.setString("GAMES", "savepath", STDEMU_DIR); m_cfg.setString("GAMES", "savepath", STDEMU_DIR);
emuPath = m_cfg.getString("GAMES", "savepath", STDEMU_DIR); emuPath = m_cfg.getString("GAMES", "savepath", STDEMU_DIR);
snprintf(basepath, 64, "%s:%s", DeviceName[emuPartition], emuPath.c_str()); snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPartition], emuPath.c_str());
if(emuSave == 4) if(emuSave == 4)
createnand = true; createnand = true;
} }
else else
{ {
snprintf(basepath, 64, "%s:%s", DeviceName[emuPartition], emuPath.c_str()); snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPartition], emuPath.c_str());
if(emuSave == 4) if(emuSave == 4)
{ {
DIR *d; DIR *d;
@ -1271,7 +1271,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
if (ret < 0) if (ret < 0)
{ {
gprintf("Set USB failed: %d\n", ret); gprintf("Set USB failed: %d\n", ret);
error(wfmt(L"Set USB failed: %d\n", ret).c_str()); error(wfmt(L"Set USB failed: %d\n", ret));
if (iosLoaded) Sys_LoadMenu(); if (iosLoaded) Sys_LoadMenu();
return; return;
} }
@ -1326,7 +1326,7 @@ void CMenu::_initGameMenu(CMenu::SThemeData &theme)
texSettingsSel.fromPNG(btngamecfgs_png); texSettingsSel.fromPNG(btngamecfgs_png);
_addUserLabels(theme, m_gameLblUser, ARRAY_SIZE(m_gameLblUser), "GAME"); _addUserLabels(theme, m_gameLblUser, ARRAY_SIZE(m_gameLblUser), "GAME");
m_gameBg = _texture(theme.texSet, "GAME/BG", "texture", theme.bg); m_gameBg = _texture(theme.texSet, "GAME/BG", "texture", theme.bg);
if (m_theme.loaded() && STexture::TE_OK == bgLQ.fromPNGFile(sfmt("%s/%s", m_themeDataDir.c_str(), m_theme.getString("GAME/BG", "texture").c_str()).c_str(), GX_TF_CMPR, ALLOC_MEM2, 64, 64)) if (m_theme.loaded() && STexture::TE_OK == bgLQ.fromPNGFile(fmt("%s/%s", m_themeDataDir.c_str(), m_theme.getString("GAME/BG", "texture").c_str()), GX_TF_CMPR, ALLOC_MEM2, 64, 64))
m_gameBgLQ = bgLQ; m_gameBgLQ = bgLQ;
m_gameBtnPlay = _addButton(theme, "GAME/PLAY_BTN", theme.btnFont, L"", 420, 344, 200, 56, theme.btnFontColor); m_gameBtnPlay = _addButton(theme, "GAME/PLAY_BTN", theme.btnFont, L"", 420, 344, 200, 56, theme.btnFontColor);

View File

@ -303,7 +303,7 @@ void CMenu::_textGameInfo(void)
cnt_controls = 0; cnt_controls = 0;
GameTDB m_gametdb; GameTDB m_gametdb;
m_gametdb.OpenFile(sfmt("%s/wiitdb.xml", m_settingsDir.c_str()).c_str()); m_gametdb.OpenFile(fmt("%s/wiitdb.xml", m_settingsDir.c_str()));
m_gametdb.SetLanguageCode(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str()); m_gametdb.SetLanguageCode(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
titlecheck = m_gametdb.IsLoaded() && m_gametdb.GetGameXMLInfo(m_cf.getId().c_str(), &gameinfo); titlecheck = m_gametdb.IsLoaded() && m_gametdb.GetGameXMLInfo(m_cf.getId().c_str(), &gameinfo);

View File

@ -209,7 +209,7 @@ void CMenu::LoadView(void)
m_showtimer=60; m_showtimer=60;
char gui_name[20]; char gui_name[20];
sprintf(gui_name,"%s [%s]",_domainFromView(),mode); snprintf(gui_name, sizeof(gui_name), "%s [%s]", _domainFromView(),mode);
m_btnMgr.setText(m_mainLblNotice, (string)gui_name); m_btnMgr.setText(m_mainLblNotice, (string)gui_name);
m_btnMgr.show(m_mainLblNotice); m_btnMgr.show(m_mainLblNotice);
} }
@ -240,7 +240,7 @@ int CMenu::main(void)
MusicPlayer::Instance()->Play(); MusicPlayer::Instance()->Play();
GameTDB m_gametdb; GameTDB m_gametdb;
m_gametdb.OpenFile(sfmt("%s/wiitdb.xml", m_settingsDir.c_str()).c_str()); m_gametdb.OpenFile(fmt("%s/wiitdb.xml", m_settingsDir.c_str()));
m_GameTDBLoaded=false; m_GameTDBLoaded=false;
if( m_gametdb.IsLoaded() ) if( m_gametdb.IsLoaded() )
{ {
@ -296,8 +296,8 @@ int CMenu::main(void)
{ {
struct stat dummy; struct stat dummy;
if(DeviceHandler::Instance()->IsInserted(SD) && if(DeviceHandler::Instance()->IsInserted(SD) &&
stat(sfmt("%s:/bootmii/armboot.bin", DeviceName[SD]).c_str(), &dummy) == 0 && stat(fmt("%s:/bootmii/armboot.bin", DeviceName[SD]), &dummy) == 0 &&
stat(sfmt("%s:/bootmii/ppcboot.elf", DeviceName[SD]).c_str(), &dummy) == 0) stat(fmt("%s:/bootmii/ppcboot.elf", DeviceName[SD]), &dummy) == 0)
Sys_ExitTo(EXIT_TO_BOOTMII); Sys_ExitTo(EXIT_TO_BOOTMII);
else Sys_ExitTo(EXIT_TO_HBC); else Sys_ExitTo(EXIT_TO_HBC);
} }
@ -472,7 +472,7 @@ int CMenu::main(void)
m_showtimer=60; m_showtimer=60;
char gui_name[20]; char gui_name[20];
sprintf(gui_name,"%s [%s]",_domainFromView(),partition); snprintf(gui_name, sizeof(gui_name), "%s [%s]", _domainFromView(),partition);
m_btnMgr.setText(m_mainLblNotice, (string)gui_name); m_btnMgr.setText(m_mainLblNotice, (string)gui_name);
m_btnMgr.show(m_mainLblNotice); m_btnMgr.show(m_mainLblNotice);
@ -568,8 +568,8 @@ int CMenu::main(void)
else if(BTN_2_HELD) //Check that the files are there, or ios will hang. else if(BTN_2_HELD) //Check that the files are there, or ios will hang.
{ {
if(DeviceHandler::Instance()->IsInserted(SD) && if(DeviceHandler::Instance()->IsInserted(SD) &&
stat(sfmt("%s:/bootmii/armboot.bin", DeviceName[SD]).c_str(), &dummy) == 0 && stat(fmt("%s:/bootmii/armboot.bin", DeviceName[SD]), &dummy) == 0 &&
stat(sfmt("%s:/bootmii/ppcboot.elf", DeviceName[SD]).c_str(), &dummy) == 0) stat(fmt("%s:/bootmii/ppcboot.elf", DeviceName[SD]), &dummy) == 0)
Sys_ExitTo(EXIT_TO_BOOTMII); Sys_ExitTo(EXIT_TO_BOOTMII);
else Sys_ExitTo(EXIT_TO_HBC); else Sys_ExitTo(EXIT_TO_HBC);
} }
@ -830,7 +830,7 @@ void CMenu::_initMainMenu(CMenu::SThemeData &theme)
STexture emptyTex; STexture emptyTex;
m_mainBg = _texture(theme.texSet, "MAIN/BG", "texture", theme.bg); m_mainBg = _texture(theme.texSet, "MAIN/BG", "texture", theme.bg);
if (m_theme.loaded() && STexture::TE_OK == bgLQ.fromPNGFile(sfmt("%s/%s", m_themeDataDir.c_str(), m_theme.getString("MAIN/BG", "texture").c_str()).c_str(), GX_TF_CMPR, ALLOC_MEM2, 64, 64)) if (m_theme.loaded() && STexture::TE_OK == bgLQ.fromPNGFile(fmt("%s/%s", m_themeDataDir.c_str(), m_theme.getString("MAIN/BG", "texture").c_str()), GX_TF_CMPR, ALLOC_MEM2, 64, 64))
m_mainBgLQ = bgLQ; m_mainBgLQ = bgLQ;
texQuit.fromPNG(btnquit_png); texQuit.fromPNG(btnquit_png);

View File

@ -499,7 +499,7 @@ int CMenu::_NandDumper(void *obj)
m.m_cfg.save(); m.m_cfg.save();
char basepath[64]; char basepath[64];
snprintf(basepath, 64, "%s:%s", DeviceName[emuPartition], emuPath.c_str()); snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPartition], emuPath.c_str());
LWP_MutexLock(m.m_mutex); LWP_MutexLock(m.m_mutex);
m._setDumpMsg(L"Calculating space needed for extraction...", 0.f, 0.f); m._setDumpMsg(L"Calculating space needed for extraction...", 0.f, 0.f);

View File

@ -171,7 +171,7 @@ int CMenu::_GCgameInstaller(void *obj)
} }
char partition[6]; char partition[6];
sprintf(partition,"%s:/",DeviceName[currentPartition]); snprintf(partition, sizeof(partition), "%s:/", DeviceName[currentPartition]);
u32 needed = 0; u32 needed = 0;
@ -374,7 +374,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
else else
{ {
char source[300]; char source[300];
snprintf(source, sizeof(source), "%s/%s", sfmt((currentPartition != SD) ? m_DMLgameDir.c_str() : DML_DIR, DeviceName[currentPartition]).c_str(), (char *)m_cf.getHdr()->path); snprintf(source, sizeof(source), "%s/%s", fmt((currentPartition != SD) ? m_DMLgameDir.c_str() : DML_DIR, DeviceName[currentPartition]), (char *)m_cf.getHdr()->path);
fsop_deleteFolder(source); fsop_deleteFolder(source);
upd_dml = true; upd_dml = true;
} }

View File

@ -126,7 +126,7 @@ safe_vector<dir_discHdr> Plugin::ParseScummvmINI(Config &ini, string Device)
safe_vector<dir_discHdr> gameHeader; safe_vector<dir_discHdr> gameHeader;
if(!ini.loaded()) if(!ini.loaded())
return gameHeader; return gameHeader;
string game = ini.firstDomain().c_str(); string game(ini.firstDomain());
dir_discHdr tmp; dir_discHdr tmp;
while(1) while(1)
{ {