-set up limits of fmt to prevent some missing words

-corrected a few spelling mistakes in menu_nandemu
-removed unneeded std:: from menu and menu_game
This commit is contained in:
fix94.1 2012-05-06 12:59:09 +00:00
parent 6abfa87e0e
commit be5195aa96
4 changed files with 128 additions and 110 deletions

View File

@ -58,8 +58,8 @@ private:
// Nothing to do with CText. Q&D helpers for string formating. // Nothing to do with CText. Q&D helpers for string formating.
enum { enum {
MAX_MSG_SIZE = 512, MAX_MSG_SIZE = 1024,
MAX_USES = 8 MAX_USES = 16,
}; };
const char *fmt(const char *format, ...); const char *fmt(const char *format, ...);

View File

@ -71,7 +71,7 @@ private:
Config m_version; Config m_version;
Plugin m_plugin; Plugin m_plugin;
Channels m_channels; Channels m_channels;
vector<std::string> m_homebrewArgs; vector<string> m_homebrewArgs;
SmartBuf m_base_font; SmartBuf m_base_font;
u32 m_base_font_size; u32 m_base_font_size;
u8 m_aa; u8 m_aa;
@ -80,44 +80,44 @@ private:
bool m_locked; bool m_locked;
bool m_favorites; bool m_favorites;
s16 m_showtimer; s16 m_showtimer;
std::string m_curLanguage; string m_curLanguage;
std::string m_curGameId; string m_curGameId;
std::string m_curChanId; string m_curChanId;
u8 m_numCFVersions; u8 m_numCFVersions;
std::string m_themeDataDir; string m_themeDataDir;
std::string m_appDir; string m_appDir;
std::string m_dataDir; string m_dataDir;
std::string m_pluginsDir; string m_pluginsDir;
std::string m_picDir; string m_picDir;
std::string m_boxPicDir; string m_boxPicDir;
std::string m_cpicDir; string m_cpicDir;
std::string m_boxcPicDir; string m_boxcPicDir;
std::string m_cacheDir; string m_cacheDir;
std::string m_themeDir; string m_themeDir;
std::string m_musicDir; string m_musicDir;
std::string m_txtCheatDir; string m_txtCheatDir;
std::string m_cheatDir; string m_cheatDir;
std::string m_wipDir; string m_wipDir;
std::string m_videoDir; string m_videoDir;
std::string m_fanartDir; string m_fanartDir;
std::string m_screenshotDir; string m_screenshotDir;
std::string m_settingsDir; string m_settingsDir;
std::string m_languagesDir; string m_languagesDir;
std::string m_listCacheDir; string m_listCacheDir;
std::string m_DMLgameDir; string m_DMLgameDir;
std::string m_helpDir; string m_helpDir;
/* Updates */ /* Updates */
char m_app_update_drive[6]; char m_app_update_drive[6];
const char* m_app_update_url; const char* m_app_update_url;
const char* m_data_update_url; const char* m_data_update_url;
std::string m_dol; string m_dol;
std::string m_app_update_zip; string m_app_update_zip;
u32 m_app_update_size; u32 m_app_update_size;
std::string m_data_update_zip; string m_data_update_zip;
u32 m_data_update_size; u32 m_data_update_size;
std::string m_ver; string m_ver;
/* End Updates */ /* End Updates */
// //
STexture m_prevBg; STexture m_prevBg;
@ -373,6 +373,12 @@ private:
s8 _versionDownloader(); s8 _versionDownloader();
s8 _versionTxtDownloader(); s8 _versionTxtDownloader();
//Game menu //Game menu
enum
{
LOAD_IOS_FAILED = 0,
LOAD_IOS_SUCCEEDED,
LOAD_IOS_NOT_NEEDED
};
u32 m_gameLblInfo; u32 m_gameLblInfo;
u32 m_gameBtnFavoriteOn; u32 m_gameBtnFavoriteOn;
u32 m_gameBtnFavoriteOff; u32 m_gameBtnFavoriteOff;
@ -556,7 +562,7 @@ private:
u32 m_categoryLblUser[4]; u32 m_categoryLblUser[4];
u8 m_max_categories; u8 m_max_categories;
// NandEmulation menu // NandEmulation menu
std::string m_saveExtGameId; string m_saveExtGameId;
bool m_nandext; bool m_nandext;
bool m_fulldump; bool m_fulldump;
bool m_sgdump; bool m_sgdump;
@ -681,7 +687,7 @@ private:
volatile bool m_thrdNetwork; volatile bool m_thrdNetwork;
float m_thrdStep; float m_thrdStep;
float m_thrdStepLen; float m_thrdStepLen;
std::string m_coverDLGameId; string m_coverDLGameId;
mutex_t m_mutex; mutex_t m_mutex;
wstringEx m_thrdMessage; wstringEx m_thrdMessage;
volatile float m_thrdProgress; volatile float m_thrdProgress;
@ -698,11 +704,17 @@ private:
bool m_video_playing; bool m_video_playing;
private: private:
enum WBFS_OP { WO_ADD_GAME, WO_REMOVE_GAME, WO_FORMAT, WO_COPY_GAME }; enum WBFS_OP
typedef std::pair<std::string, u32> FontDesc; {
typedef std::map<FontDesc, SFont> FontSet; WO_ADD_GAME,
typedef std::map<std::string, STexture> TexSet; WO_REMOVE_GAME,
typedef std::map<std::string, SmartGuiSound > SoundSet; WO_FORMAT,
WO_COPY_GAME,
};
typedef pair<string, u32> FontDesc;
typedef map<FontDesc, SFont> FontSet;
typedef map<string, STexture> TexSet;
typedef map<string, SmartGuiSound > SoundSet;
struct SThemeData struct SThemeData
{ {
TexSet texSet; TexSet texSet;
@ -799,8 +811,22 @@ private:
}; };
struct SCFParamDesc struct SCFParamDesc
{ {
enum { PDT_EMPTY, PDT_FLOAT, PDT_V3D, PDT_COLOR, PDT_BOOL, PDT_INT, PDT_TXTSTYLE } paramType[4]; enum
enum { PDD_BOTH, PDD_NORMAL, PDD_SELECTED } domain; {
PDT_EMPTY,
PDT_FLOAT,
PDT_V3D,
PDT_COLOR,
PDT_BOOL,
PDT_INT,
PDT_TXTSTYLE,
} paramType[4];
enum
{
PDD_BOTH,
PDD_NORMAL,
PDD_SELECTED,
} domain;
bool scrnFmt; bool scrnFmt;
const char name[32]; const char name[32];
const char valName[4][64]; const char valName[4][64];
@ -939,7 +965,7 @@ private:
}; };
void _cfNeedsUpdate(void); void _cfNeedsUpdate(void);
void _game(bool launch = false); void _game(bool launch = false);
void _download(std::string gameId = std::string()); void _download(string gameId = string());
bool _code(char code[4], bool erase = false); bool _code(char code[4], bool erase = false);
void _about(void); void _about(void);
bool _wbfsOp(WBFS_OP op); bool _wbfsOp(WBFS_OP op);
@ -958,21 +984,21 @@ private:
vector<dir_discHdr> _searchGamesByType(const char type); vector<dir_discHdr> _searchGamesByType(const char type);
vector<dir_discHdr> _searchGamesByRegion(const char region); */ vector<dir_discHdr> _searchGamesByRegion(const char region); */
public: public:
void _directlaunch(const std::string &id); void _directlaunch(const string &id);
private: private:
bool _loadFile(SmartBuf &buffer, u32 &size, const char *path, const char *file); bool _loadFile(SmartBuf &buffer, u32 &size, const char *path, const char *file);
int _loadIOS(u8 ios, string id); int _loadIOS(u8 ios, string id);
void _launch(dir_discHdr *hdr); void _launch(dir_discHdr *hdr);
void _launchGame(dir_discHdr *hdr, bool dvd); void _launchGame(dir_discHdr *hdr, bool dvd);
void _launchChannel(dir_discHdr *hdr); void _launchChannel(dir_discHdr *hdr);
void _launchHomebrew(const char *filepath, vector<std::string> arguments); void _launchHomebrew(const char *filepath, vector<string> arguments);
void _launchGC(dir_discHdr *hdr, bool DML); void _launchGC(dir_discHdr *hdr, bool DML);
void _setAA(int aa); void _setAA(int aa);
void _loadCFCfg(SThemeData &theme); void _loadCFCfg(SThemeData &theme);
void _loadCFLayout(int version, bool forceAA = false, bool otherScrnFmt = false); void _loadCFLayout(int version, bool forceAA = false, bool otherScrnFmt = false);
Vector3D _getCFV3D(const std::string &domain, const std::string &key, const Vector3D &def, bool otherScrnFmt = false); Vector3D _getCFV3D(const string &domain, const string &key, const Vector3D &def, bool otherScrnFmt = false);
int _getCFInt(const std::string &domain, const std::string &key, int def, bool otherScrnFmt = false); int _getCFInt(const string &domain, const string &key, int def, bool otherScrnFmt = false);
float _getCFFloat(const std::string &domain, const std::string &key, float def, bool otherScrnFmt = false); float _getCFFloat(const string &domain, const string &key, float def, bool otherScrnFmt = false);
void _cfParam(bool inc, int i, const SCFParamDesc &p, int cfVersion, bool wide); void _cfParam(bool inc, int i, const SCFParamDesc &p, int cfVersion, bool wide);
void _buildMenus(void); void _buildMenus(void);
void _loadDefaultFont(bool korean); void _loadDefaultFont(bool korean);
@ -1073,8 +1099,8 @@ private:
static const SOption _hooktype[8]; static const SOption _hooktype[8];
static const SOption _exitTo[6]; static const SOption _exitTo[6];
static const SOption _DumpMode[4]; static const SOption _DumpMode[4];
static std::map<u8, u8> _installed_cios; static map<u8, u8> _installed_cios;
typedef std::map<u8, u8>::iterator CIOSItr; typedef map<u8, u8>::iterator CIOSItr;
static int _version[9]; static int _version[9];
static const SCFParamDesc _cfParams[]; static const SCFParamDesc _cfParams[];
static const int _nbCfgPages; static const int _nbCfgPages;

View File

@ -220,7 +220,7 @@ const CMenu::SOption CMenu::_DumpMode[4] = {
{ "DumpLMss", L"List Missing" }, { "DumpLMss", L"List Missing" },
}; };
std::map<u8, u8> CMenu::_installed_cios; map<u8, u8> CMenu::_installed_cios;
u8 banner_title[84]; u8 banner_title[84];
static inline int loopNum(int i, int s) static inline int loopNum(int i, int s)
@ -638,12 +638,12 @@ void CMenu::_launch(dir_discHdr *hdr)
m_gcfg2.load(fmt("%s/gameconfig2.ini", m_settingsDir.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[string(hdr->path).find_last_of("/")+1]);
string wiiflow_dol(m_dol); string wiiflow_dol(m_dol);
if(strstr(wiiflow_dol.c_str(), "sd:/") == NULL) if(strstr(wiiflow_dol.c_str(), "sd:/") == NULL)
wiiflow_dol.erase(3,1); wiiflow_dol.erase(3,1);
string path((char*)hdr->path, size_t(strlen((char*)hdr->path) - title.size())); string path((char*)hdr->path, size_t(strlen((char*)hdr->path) - title.size()));
vector<std::string> arguments; vector<string> arguments;
gprintf("Game title: %s\n", title.c_str()); gprintf("Game title: %s\n", title.c_str());
if(strstr(path.c_str(), ":/") != NULL) if(strstr(path.c_str(), ":/") != NULL)
{ {
@ -655,7 +655,7 @@ void CMenu::_launch(dir_discHdr *hdr)
arguments.push_back(sfmt("%s/WiiFlowLoader.dol",m_pluginsDir.c_str())); arguments.push_back(sfmt("%s/WiiFlowLoader.dol",m_pluginsDir.c_str()));
else else
arguments.push_back(wiiflow_dol); arguments.push_back(wiiflow_dol);
m_cfg.setString("EMULATOR", "current_item", &hdr->path[std::string(hdr->path).find_last_of("/")]); m_cfg.setString("EMULATOR", "current_item", &hdr->path[string(hdr->path).find_last_of("/")]);
} }
else else
{ {
@ -769,7 +769,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
Sys_LoadMenu(); Sys_LoadMenu();
} }
void CMenu::_launchHomebrew(const char *filepath, vector<std::string> arguments) void CMenu::_launchHomebrew(const char *filepath, vector<string> arguments)
{ {
gprintf("Filepath of homebrew: %s\n",filepath); gprintf("Filepath of homebrew: %s\n",filepath);
if(LoadHomebrew(filepath)) if(LoadHomebrew(filepath))
@ -796,8 +796,6 @@ void CMenu::_launchHomebrew(const char *filepath, vector<std::string> arguments)
m_exit = true; m_exit = true;
} }
enum {LOAD_IOS_FAILED = 0, LOAD_IOS_SUCCEEDED, LOAD_IOS_NOT_NEEDED};
int CMenu::_loadIOS(u8 ios, string id) int CMenu::_loadIOS(u8 ios, string id)
{ {
int gameIOS = 0; int gameIOS = 0;

View File

@ -13,7 +13,7 @@ static inline int loopNum(int i, int s)
return i < 0 ? (s - (-i % s)) % s : i % s; return i < 0 ? (s - (-i % s)) % s : i % s;
} }
static bool _saveExcists(const char *path) static bool _saveExists(const char *path)
{ {
DIR *d; DIR *d;
d = opendir(path); d = opendir(path);
@ -28,7 +28,7 @@ static bool _saveExcists(const char *path)
} }
} }
static bool _nandSaveExcists(const char *npath) static bool _nandSaveExists(const char *npath)
{ {
u32 temp = 0; u32 temp = 0;
@ -164,11 +164,11 @@ int CMenu::_NandEmuCfg(void)
lwp_t thread = 0; lwp_t thread = 0;
SetupInput(); SetupInput();
_showNandEmu(); _showNandEmu();
m_thrdStop = false; m_thrdStop = false;
m_thrdMessageAdded = false; m_thrdMessageAdded = false;
m_nandext = false; m_nandext = false;
while(true) while(true)
{ {
_mainLoopCommon(false, m_thrdWorking); _mainLoopCommon(false, m_thrdWorking);
@ -211,7 +211,7 @@ int CMenu::_NandEmuCfg(void)
m_btnMgr.setText(m_nandfileLblMessage, L""); m_btnMgr.setText(m_nandfileLblMessage, L"");
m_btnMgr.setText(m_nandemuLblDialog, _t("cfgne11", L"Overall progress:")); m_btnMgr.setText(m_nandemuLblDialog, _t("cfgne11", L"Overall progress:"));
if(m_fulldump) if(m_fulldump)
m_btnMgr.setText(m_nandemuLblTitle, _t("cfgne12", L"Nand extractor")); m_btnMgr.setText(m_nandemuLblTitle, _t("cfgne12", L"NAND extractor"));
else else
m_btnMgr.setText(m_nandemuLblTitle, _t("cfgne13", L"Game save extractor")); m_btnMgr.setText(m_nandemuLblTitle, _t("cfgne13", L"Game save extractor"));
m_thrdStop = false; m_thrdStop = false;
@ -224,7 +224,7 @@ int CMenu::_NandEmuCfg(void)
m_cfg.save(); m_cfg.save();
break; break;
} }
if (m_thrdMessageAdded) if (m_thrdMessageAdded)
{ {
LockMutex lock(m_mutex); LockMutex lock(m_mutex);
@ -235,20 +235,17 @@ int CMenu::_NandEmuCfg(void)
m_btnMgr.setProgress(m_nandemuPBar, m_thrdProgress); m_btnMgr.setProgress(m_nandemuPBar, m_thrdProgress);
m_btnMgr.setText(m_nandfileLblMessage, wfmt(_fmt("fileprogress", L"%d / %dkb"), m_fileprog/0x400, m_filesize/0x400)); m_btnMgr.setText(m_nandfileLblMessage, wfmt(_fmt("fileprogress", L"%d / %dkb"), m_fileprog/0x400, m_filesize/0x400));
m_btnMgr.setText(m_nandemuLblMessage, wfmt(_fmt("dumpprogress", L"%i%%"), (int)(m_thrdProgress*100.f))); m_btnMgr.setText(m_nandemuLblMessage, wfmt(_fmt("dumpprogress", L"%i%%"), (int)(m_thrdProgress*100.f)));
if (!m_thrdWorking) if (!m_thrdWorking)
{ {
if(m_sgdump) if(m_sgdump)
m_btnMgr.setText(m_nandfinLblDialog, wfmt(_fmt("cfgne14", L"Extracted: %d saves / %d files / %d folders"), m_nandexentry, m_filesdone, m_foldersdone)); m_btnMgr.setText(m_nandfinLblDialog, wfmt(_fmt("cfgne14", L"Extracted: %d saves / %d files / %d folders"), m_nandexentry, m_filesdone, m_foldersdone));
else else
m_btnMgr.setText(m_nandfinLblDialog, wfmt(_fmt("cfgne15", L"Extracted: %d files / %d folders"), m_filesdone, m_foldersdone)); m_btnMgr.setText(m_nandfinLblDialog, wfmt(_fmt("cfgne15", L"Extracted: %d files / %d folders"), m_filesdone, m_foldersdone));
if(m_dumpsize/0x400 > 0x270f) if(m_dumpsize/0x400 > 0x270f)
m_btnMgr.setText(m_nandemuLblDialog, wfmt(_fmt("cfgne16", L"Total size: %uMb (%d blocks)"), (m_dumpsize/0x100000), (m_dumpsize/0x8000)>>2)); m_btnMgr.setText(m_nandemuLblDialog, wfmt(_fmt("cfgne16", L"Total size: %uMB (%d blocks)"), (m_dumpsize/0x100000), (m_dumpsize/0x8000)>>2));
else else
m_btnMgr.setText(m_nandemuLblDialog, wfmt(_fmt("cfgne17", L"Total size: %ukb (%d blocks)"), (m_dumpsize/0x400), (m_dumpsize/0x8000)>>2)); m_btnMgr.setText(m_nandemuLblDialog, wfmt(_fmt("cfgne17", L"Total size: %uKB (%d blocks)"), (m_dumpsize/0x400), (m_dumpsize/0x8000)>>2));
m_btnMgr.show(m_nandemuBtnBack); m_btnMgr.show(m_nandemuBtnBack);
m_btnMgr.show(m_nandfinLblDialog); m_btnMgr.show(m_nandfinLblDialog);
} }
@ -264,28 +261,28 @@ int CMenu::_AutoExtractSave(string gameId)
int savePath = gameId.c_str()[0] << 24 | gameId.c_str()[1] << 16 | gameId.c_str()[2] << 8 | gameId.c_str()[3]; int savePath = gameId.c_str()[0] << 24 | gameId.c_str()[1] << 16 | gameId.c_str()[2] << 8 | gameId.c_str()[3];
string npath = sfmt("/title/00010000/%x", savePath); string npath = sfmt("/title/00010000/%x", savePath);
string path = sfmt("%s:%s/title/00010000/%x", DeviceName[emuPartition], m_cfg.getString("GAMES", "savepath", m_cfg.getString("NAND", "path", "")).c_str(), savePath); string path = sfmt("%s:%s/title/00010000/%x", DeviceName[emuPartition], m_cfg.getString("GAMES", "savepath", m_cfg.getString("NAND", "path", "")).c_str(), savePath);
if(!_nandSaveExcists(npath.c_str()) || (!m_forceext && _saveExcists(path.c_str()))) if(!_nandSaveExists(npath.c_str()) || (!m_forceext && _saveExists(path.c_str())))
return 0; return 0;
lwp_t thread = 0; lwp_t thread = 0;
SetupInput(); SetupInput();
m_thrdStop = false; m_thrdStop = false;
m_thrdMessageAdded = false; m_thrdMessageAdded = false;
m_nandext = false; m_nandext = false;
if(!m_forceext) if(!m_forceext)
{ {
m_btnMgr.setText(m_nandemuBtnExtract, _t("cfgne24", L"Extract save")); m_btnMgr.setText(m_nandemuBtnExtract, _t("cfgne24", L"Extract save"));
m_btnMgr.setText(m_nandemuBtnDisable, _t("cfgne25", L"Create new save")); m_btnMgr.setText(m_nandemuBtnDisable, _t("cfgne25", L"Create new save"));
m_btnMgr.setText(m_nandemuLblInit, _t("cfgne26", L"A save file for this game was created on real nand. Extract existing safe file from real nand or create new file for nand emulation?")); m_btnMgr.setText(m_nandemuLblInit, _t("cfgne26", L"A save file for this game was created on real NAND. Extract existing save file from real nand or create new file for NAND Emulation?"));
m_btnMgr.show(m_nandemuBtnExtract); m_btnMgr.show(m_nandemuBtnExtract);
m_btnMgr.show(m_nandemuBtnDisable); m_btnMgr.show(m_nandemuBtnDisable);
m_btnMgr.show(m_nandemuLblInit); m_btnMgr.show(m_nandemuLblInit);
} }
m_saveExtGameId = gameId; m_saveExtGameId = gameId;
while(true) while(true)
{ {
_mainLoopCommon(false, m_thrdWorking); _mainLoopCommon(false, m_thrdWorking);
@ -317,7 +314,7 @@ int CMenu::_AutoExtractSave(string gameId)
_hideNandEmu(); _hideNandEmu();
return 0; return 0;
} }
if(m_thrdMessageAdded) if(m_thrdMessageAdded)
{ {
LockMutex lock(m_mutex); LockMutex lock(m_mutex);
@ -328,14 +325,14 @@ int CMenu::_AutoExtractSave(string gameId)
m_btnMgr.setProgress(m_nandemuPBar, m_thrdProgress); m_btnMgr.setProgress(m_nandemuPBar, m_thrdProgress);
m_btnMgr.setText(m_nandfileLblMessage, wfmt(_fmt("fileprogress", L"%d / %dkb"), m_fileprog/0x400, m_filesize/0x400)); m_btnMgr.setText(m_nandfileLblMessage, wfmt(_fmt("fileprogress", L"%d / %dkb"), m_fileprog/0x400, m_filesize/0x400));
m_btnMgr.setText(m_nandemuLblMessage, wfmt(_fmt("dumpprogress", L"%i%%"), (int)(m_thrdProgress*100.f))); m_btnMgr.setText(m_nandemuLblMessage, wfmt(_fmt("dumpprogress", L"%i%%"), (int)(m_thrdProgress*100.f)));
if (!m_thrdWorking) if (!m_thrdWorking)
{ {
m_btnMgr.setText(m_nandfinLblDialog, wfmt(_fmt("cfgne14", L"Extracted: %d saves / %d files / %d folders"), m_nandexentry, m_filesdone, m_foldersdone)); m_btnMgr.setText(m_nandfinLblDialog, wfmt(_fmt("cfgne14", L"Extracted: %d saves / %d files / %d folders"), m_nandexentry, m_filesdone, m_foldersdone));
if(m_dumpsize/0x400 > 0x270f) if(m_dumpsize/0x400 > 0x270f)
m_btnMgr.setText(m_nandemuLblDialog, wfmt(_fmt("cfgne16", L"Total size: %uMb (%d blocks)"), (m_dumpsize/0x100000), (m_dumpsize/0x8000)>>2)); m_btnMgr.setText(m_nandemuLblDialog, wfmt(_fmt("cfgne16", L"Total size: %uMB (%d blocks)"), (m_dumpsize/0x100000), (m_dumpsize/0x8000)>>2));
else else
m_btnMgr.setText(m_nandemuLblDialog, wfmt(_fmt("cfgne17", L"Total size: %ukb (%d blocks)"), (m_dumpsize/0x400), (m_dumpsize/0x8000)>>2)); m_btnMgr.setText(m_nandemuLblDialog, wfmt(_fmt("cfgne17", L"Total size: %uKB (%d blocks)"), (m_dumpsize/0x400), (m_dumpsize/0x8000)>>2));
_hideNandEmu(); _hideNandEmu();
return 1; return 1;
@ -353,14 +350,14 @@ int CMenu::_AutoCreateNand(void)
m_thrdStop = false; m_thrdStop = false;
m_thrdMessageAdded = false; m_thrdMessageAdded = false;
m_nandext = false; m_nandext = false;
m_btnMgr.setText(m_nandemuBtnExtract, _t("cfgne5", L"Extract nand")); m_btnMgr.setText(m_nandemuBtnExtract, _t("cfgne5", L"Extract NAND"));
m_btnMgr.setText(m_nandemuBtnDisable, _t("cfgne22", L"Disable nandemulation")); m_btnMgr.setText(m_nandemuBtnDisable, _t("cfgne22", L"Disable NAND Emulation"));
m_btnMgr.setText(m_nandemuLblInit, _t("cfgne23", L"Welcome to WiiFlow. I have not found a valid nand for nand emulation. Click Extract to extract your nand, or click disable to disable nand emulation.")); m_btnMgr.setText(m_nandemuLblInit, _t("cfgne23", L"Welcome to WiiFlow. I have not found a valid nand for NAND Emulation. Click Extract to extract your NAND, or click disable to disable NAND Emulation."));
m_btnMgr.show(m_nandemuBtnExtract); m_btnMgr.show(m_nandemuBtnExtract);
m_btnMgr.show(m_nandemuBtnDisable); m_btnMgr.show(m_nandemuBtnDisable);
m_btnMgr.show(m_nandemuLblInit); m_btnMgr.show(m_nandemuLblInit);
while(true) while(true)
{ {
_mainLoopCommon(false, m_thrdWorking); _mainLoopCommon(false, m_thrdWorking);
@ -380,7 +377,7 @@ int CMenu::_AutoCreateNand(void)
m_btnMgr.setText(m_nandemuLblMessage, L""); m_btnMgr.setText(m_nandemuLblMessage, L"");
m_btnMgr.setText(m_nandfileLblMessage, L""); m_btnMgr.setText(m_nandfileLblMessage, L"");
m_btnMgr.setText(m_nandemuLblDialog, _t("cfgne11", L"Overall progress:")); m_btnMgr.setText(m_nandemuLblDialog, _t("cfgne11", L"Overall progress:"));
m_btnMgr.setText(m_nandemuLblTitle, _t("cfgne12", L"Nand extractor")); m_btnMgr.setText(m_nandemuLblTitle, _t("cfgne12", L"NAND Extractor"));
m_thrdStop = false; m_thrdStop = false;
m_thrdProgress = 0.f; m_thrdProgress = 0.f;
m_thrdWorking = true; m_thrdWorking = true;
@ -391,7 +388,7 @@ int CMenu::_AutoCreateNand(void)
_hideNandEmu(); _hideNandEmu();
return 0; return 0;
} }
if(m_thrdMessageAdded) if(m_thrdMessageAdded)
{ {
LockMutex lock(m_mutex); LockMutex lock(m_mutex);
@ -402,7 +399,7 @@ int CMenu::_AutoCreateNand(void)
m_btnMgr.setProgress(m_nandemuPBar, m_thrdProgress); m_btnMgr.setProgress(m_nandemuPBar, m_thrdProgress);
m_btnMgr.setText(m_nandfileLblMessage, wfmt(_fmt("fileprogress", L"%d / %dkb"), m_fileprog/0x400, m_filesize/0x400)); m_btnMgr.setText(m_nandfileLblMessage, wfmt(_fmt("fileprogress", L"%d / %dkb"), m_fileprog/0x400, m_filesize/0x400));
m_btnMgr.setText(m_nandemuLblMessage, wfmt(_fmt("dumpprogress", L"%i%%"), (int)(m_thrdProgress*100.f))); m_btnMgr.setText(m_nandemuLblMessage, wfmt(_fmt("dumpprogress", L"%i%%"), (int)(m_thrdProgress*100.f)));
if (!m_thrdWorking) if (!m_thrdWorking)
{ {
m_btnMgr.setText(m_nandfinLblDialog, wfmt(_fmt("cfgne15", L"Extracted: %d files / %d folders"), m_filesdone, m_foldersdone)); m_btnMgr.setText(m_nandfinLblDialog, wfmt(_fmt("cfgne15", L"Extracted: %d files / %d folders"), m_filesdone, m_foldersdone));
@ -431,9 +428,9 @@ int CMenu::_NandDumper(void *obj)
m.m_dumpsize = 0; m.m_dumpsize = 0;
m.m_filesdone = 0; m.m_filesdone = 0;
m.m_foldersdone = 0; m.m_foldersdone = 0;
Nand::Instance()->ResetCounters(); Nand::Instance()->ResetCounters();
if(m.m_current_view == COVERFLOW_CHANNEL) if(m.m_current_view == COVERFLOW_CHANNEL)
{ {
emuPartition = m.m_cfg.getInt("NAND", "partition", 0); emuPartition = m.m_cfg.getInt("NAND", "partition", 0);
@ -446,7 +443,7 @@ int CMenu::_NandDumper(void *obj)
emuPartition = m.m_cfg.getInt("NAND", "partition", 0); emuPartition = m.m_cfg.getInt("NAND", "partition", 0);
emuPath = m.m_cfg.getString("GAMES", "savepath", m.m_cfg.getString("NAND", "path", "")); emuPath = m.m_cfg.getString("GAMES", "savepath", m.m_cfg.getString("NAND", "path", ""));
} }
for(u8 i = emuPartition; i <= USB8; ++i) for(u8 i = emuPartition; i <= USB8; ++i)
{ {
if(!DeviceHandler::Instance()->IsInserted(emuPartition) || DeviceHandler::Instance()->GetFSType(emuPartition) != PART_FS_FAT) if(!DeviceHandler::Instance()->IsInserted(emuPartition) || DeviceHandler::Instance()->GetFSType(emuPartition) != PART_FS_FAT)
@ -464,10 +461,10 @@ int CMenu::_NandDumper(void *obj)
break; break;
} }
} }
if(!emuPartIsValid) if(!emuPartIsValid)
{ {
m.error(sfmt("No valid FAT partition found for nandemulation!")); m.error(sfmt("No valid FAT partition found for NAND Emulation!"));
m.m_thrdWorking = false; m.m_thrdWorking = false;
m.m_btnMgr.hide(m.m_nandfilePBar); m.m_btnMgr.hide(m.m_nandfilePBar);
m.m_btnMgr.hide(m.m_nandfileLblMessage); m.m_btnMgr.hide(m.m_nandfileLblMessage);
@ -477,7 +474,7 @@ int CMenu::_NandDumper(void *obj)
m._hideNandEmu(); m._hideNandEmu();
return 0; return 0;
} }
if(emuPath.size() == 0) if(emuPath.size() == 0)
{ {
Nand::Instance()->CreatePath("%s:/wiiflow", DeviceName[emuPartition]); Nand::Instance()->CreatePath("%s:/wiiflow", DeviceName[emuPartition]);
@ -495,14 +492,14 @@ int CMenu::_NandDumper(void *obj)
} }
} }
m.m_cfg.save(); m.m_cfg.save();
char basepath[64]; char basepath[64];
snprintf(basepath, sizeof(basepath), "%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);
LWP_MutexUnlock(m.m_mutex); LWP_MutexUnlock(m.m_mutex);
if(m.m_fulldump) if(m.m_fulldump)
{ {
m.m_dumpsize = Nand::Instance()->CalcDumpSpace("/", true, CMenu::_ShowProgress, obj); m.m_dumpsize = Nand::Instance()->CalcDumpSpace("/", true, CMenu::_ShowProgress, obj);
@ -515,7 +512,7 @@ int CMenu::_NandDumper(void *obj)
string path, npath; string path, npath;
vector<string> saveList; vector<string> saveList;
m.m_sgdump = true; m.m_sgdump = true;
if(m.m_saveExtGameId.empty()) if(m.m_saveExtGameId.empty())
{ {
m.m_nandexentry = 0; m.m_nandexentry = 0;
@ -525,29 +522,27 @@ int CMenu::_NandDumper(void *obj)
LWP_MutexLock(m.m_mutex); LWP_MutexLock(m.m_mutex);
m._setDumpMsg(m._t("cfgne18", L"Listing game saves to extract..."), 0.f, 0.f); m._setDumpMsg(m._t("cfgne18", L"Listing game saves to extract..."), 0.f, 0.f);
LWP_MutexUnlock(m.m_mutex); LWP_MutexUnlock(m.m_mutex);
string id((const char *)m.m_gameList[i].hdr.id, 4); string id((const char *)m.m_gameList[i].hdr.id, 4);
int savePath = id.c_str()[0] << 24 | id.c_str()[1] << 16 | id.c_str()[2] << 8 | id.c_str()[3]; int savePath = id.c_str()[0] << 24 | id.c_str()[1] << 16 | id.c_str()[2] << 8 | id.c_str()[3];
path = sfmt("%s/title/00010000/%x", basepath, savePath); path = sfmt("%s/title/00010000/%x", basepath, savePath);
npath = sfmt("/title/00010000/%x", savePath); npath = sfmt("/title/00010000/%x", savePath);
if(!missingOnly || !_saveExcists(path.c_str())) if(!missingOnly || !_saveExists(path.c_str()))
{ {
if(_nandSaveExcists(npath.c_str())) if(_nandSaveExists(npath.c_str()))
{ {
m.m_nandexentry++; m.m_nandexentry++;
saveList.push_back(id); saveList.push_back(id);
} }
} }
} }
} }
else else
saveList.push_back(m.m_saveExtGameId); saveList.push_back(m.m_saveExtGameId);
for(u32 i = 0; i < saveList.size() && !m.m_thrdStop; ++i) for(u32 i = 0; i < saveList.size() && !m.m_thrdStop; ++i)
{ {
char source[ISFS_MAXPATH]; char source[ISFS_MAXPATH];
@ -564,7 +559,7 @@ int CMenu::_NandDumper(void *obj)
Nand::Instance()->DoNandDump(source, basepath, false, CMenu::_ShowProgress, obj); Nand::Instance()->DoNandDump(source, basepath, false, CMenu::_ShowProgress, obj);
} }
} }
m.m_thrdWorking = false; m.m_thrdWorking = false;
LWP_MutexLock(m.m_mutex); LWP_MutexLock(m.m_mutex);
m.m_btnMgr.hide(m.m_nandfilePBar); m.m_btnMgr.hide(m.m_nandfilePBar);
@ -599,8 +594,7 @@ void CMenu::_initNandEmuMenu(CMenu::SThemeData &theme)
m_nandemuBtnExtract = _addButton(theme, "NANDEMU/EXTRACT", theme.titleFont, L"", 72, 180, 496, 56, theme.titleFontColor); m_nandemuBtnExtract = _addButton(theme, "NANDEMU/EXTRACT", theme.titleFont, L"", 72, 180, 496, 56, theme.titleFontColor);
m_nandemuBtnDisable = _addButton(theme, "NANDEMU/DISABLE", theme.titleFont, L"", 72, 290, 496, 56, theme.titleFontColor); m_nandemuBtnDisable = _addButton(theme, "NANDEMU/DISABLE", theme.titleFont, L"", 72, 290, 496, 56, theme.titleFontColor);
m_nandemuLblInit = _addLabel(theme, "NANDEMU/INIT", theme.lblFont, L"", 40, 40, 560, 140, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); m_nandemuLblInit = _addLabel(theme, "NANDEMU/INIT", theme.lblFont, L"", 40, 40, 560, 140, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
_setHideAnim(m_nandemuLblTitle, "NANDEMU/TITLE", 0, 0, -2.f, 0.f); _setHideAnim(m_nandemuLblTitle, "NANDEMU/TITLE", 0, 0, -2.f, 0.f);
_setHideAnim(m_nandfileLblMessage, "NANDEMU/FMESSAGE", 0, 0, -2.f, 0.f); _setHideAnim(m_nandfileLblMessage, "NANDEMU/FMESSAGE", 0, 0, -2.f, 0.f);
_setHideAnim(m_nandemuLblMessage, "NANDEMU/MESSAGE", 0, 0, -2.f, 0.f); _setHideAnim(m_nandemuLblMessage, "NANDEMU/MESSAGE", 0, 0, -2.f, 0.f);
@ -629,11 +623,11 @@ void CMenu::_initNandEmuMenu(CMenu::SThemeData &theme)
void CMenu::_textNandEmu(void) void CMenu::_textNandEmu(void)
{ {
m_btnMgr.setText(m_nandemuLblEmulation, _t("cfgne1", L"Nand emulation")); m_btnMgr.setText(m_nandemuLblEmulation, _t("cfgne1", L"NAND Emulation"));
m_btnMgr.setText(m_nandemuLblSaveDump, _t("cfgne2", L"Extract game saves")); m_btnMgr.setText(m_nandemuLblSaveDump, _t("cfgne2", L"Extract game saves"));
m_btnMgr.setText(m_nandemuBtnAll, _t("cfgne3", L"All")); m_btnMgr.setText(m_nandemuBtnAll, _t("cfgne3", L"All"));
m_btnMgr.setText(m_nandemuBtnMissing, _t("cfgne4", L"Missing")); m_btnMgr.setText(m_nandemuBtnMissing, _t("cfgne4", L"Missing"));
m_btnMgr.setText(m_nandemuLblNandDump, _t("cfgne5", L"Extract nand")); m_btnMgr.setText(m_nandemuLblNandDump, _t("cfgne5", L"Extract NAND"));
m_btnMgr.setText(m_nandemuBtnNandDump, _t("cfgne6", L"Start")); m_btnMgr.setText(m_nandemuBtnNandDump, _t("cfgne6", L"Start"));
m_btnMgr.setText(m_nandemuBtnBack, _t("cfgne7", L"Back")); m_btnMgr.setText(m_nandemuBtnBack, _t("cfgne7", L"Back"));
} }