diff --git a/out/boot.dol b/out/boot.dol index bb2a3157..8f880df3 100644 Binary files a/out/boot.dol and b/out/boot.dol differ diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index d91f7b0e..9c62c700 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -37,8 +37,8 @@ extern const u32 camera_wav_size; CMenu mainMenu; -u8 CMenu::downloadStack[8192] ATTRIBUTE_ALIGN(32); -const u32 CMenu::downloadStackSize = 8192; +//u8 CMenu::downloadStack[8192] ATTRIBUTE_ALIGN(32); +//const u32 CMenu::downloadStackSize = 8192; CMenu::CMenu() { @@ -46,8 +46,6 @@ CMenu::CMenu() m_thrdWorking = false; m_thrdStop = false; m_thrdProgress = 0.f; - m_thrdStep = 0.f; - m_thrdStepLen = 0.f; m_locked = false; m_favorites = false; m_thrdNetwork = false; @@ -2612,20 +2610,6 @@ void CMenu::_stopSounds(void) m_gameSound.Stop(); } -bool CMenu::_loadFile(u8 * &buffer, u32 &size, const char *path, const char *file) -{ - u32 fileSize = 0; - u8 *fileBuf = fsop_ReadFile(file == NULL ? path : fmt("%s/%s", path, file), &fileSize); - if(fileBuf == NULL) - return false; - - if(buffer != NULL) - MEM2_free(buffer); - buffer = fileBuf; - size = fileSize; - return true; -} - /* wiiflow creates a map _installed_cios list for slots 200 to 253 and slot 0 the first u8 is the slot and the second u8 is the base if its a d2x cios otherwise the slot number again. slot 0 is set to 1 - first = 0 and second = 1 diff --git a/source/menu/menu.hpp b/source/menu/menu.hpp index ab6d0908..66f8e381 100644 --- a/source/menu/menu.hpp +++ b/source/menu/menu.hpp @@ -38,19 +38,27 @@ using std::min; class CMenu { -public: +public: // functions called from outside CMenu CMenu(); bool init(bool usb_mounted); - void error(const wstringEx &msg); - void terror(const char *key, const wchar_t *msg) { error(_fmt(key, msg)); } int main(void); - void cleanup(void); void directlaunch(const char *GameID); - void TempLoadIOS(int IOS = 0); - + const char *getBoxPath(const dir_discHdr *element); const char *getFrontPath(const dir_discHdr *element); const char *getBlankCoverPath(const dir_discHdr *element); + + // gc_disc_dump + u64 m_thrdTotal; + void update_pThread(u64 amount, bool add = true); + void GC_Messenger(int message, int info, char *cinfo); + + // proxy settings + bool proxyUseSystem; + char proxyAddress[256]; + u16 proxyPort; + char proxyUsername[33]; + char proxyPassword[33]; private: u8 m_prev_view; @@ -75,15 +83,6 @@ private: string sm_numbers_backup; string sm_tiers_backup; - struct SZone - { - int x; - int y; - int w; - int h; - bool hide; - }; - CCursor m_cursor[WPAD_MAX_WIIMOTES]; CFanart m_fa; Config m_cfg; Config m_loc; @@ -95,7 +94,6 @@ private: Config m_coverflow; Config m_platform; - //vector m_homebrewArgs; u8 *m_base_font; u32 m_base_font_size; u8 *m_wbf1_font; @@ -107,6 +105,7 @@ private: u8 m_max_source_btn; u8 curCustBg; char cf_domain[16]; + volatile bool m_exit; bool m_use_source;// source_menu.ini found & ok to use source menu/flow bool m_sourceflow;// in sourceflow view bool m_refreshGameList; @@ -128,7 +127,7 @@ private: string m_curLanguage; string m_themeName; - /* Dir strings */ +// Dir strings string m_appDir; string m_imgsDir; string m_binsDir; @@ -165,18 +164,17 @@ private: string m_snapDir; - /* NandEmulation */ +// Nand Emulation char emu_nands_dir[32]; string m_saveExtGameId; bool m_forceext; bool m_emuSaveNand; - s32 m_partRequest; - /* GC sound stuff */ +// GC sound stuff bool m_gc_play_banner_sound; bool m_gc_play_default_sound; - /* Explorer stuff */ +// Explorer stuff bool m_txt_view; const char *m_txt_path; @@ -186,7 +184,7 @@ private: const TexData *m_nextBg; const TexData *m_lqBg; u8 m_bgCrossFade; - // +// Background textures TexData m_errorBg; TexData m_configBg; TexData m_cheatBg; @@ -204,7 +202,7 @@ private: TexData m_mainBgLQ; TexData m_mainCustomBg[2]; -//Main Coverflow +// Main Coverflow s16 m_mainBtnCategories; s16 m_mainBtnConfig; s16 m_mainBtnHome; @@ -232,7 +230,7 @@ private: unsigned int mem2; #endif -//Main Config menus +// Main Config menus s16 m_configLblPage; s16 m_configBtnPageM; s16 m_configBtnPageP; @@ -266,7 +264,7 @@ private: s16 m_configBtn4M; s16 m_configBtn4P; -//Download menu +// Download menu s16 m_downloadLblTitle; s16 m_downloadBtnBack; s16 m_downloadLblGameTDB; @@ -347,7 +345,7 @@ private: s16 m_downloadBtnKOs; s16 m_downloadBtnZHCNs; s16 m_downloadBtnAUs; -//Game menu +// Game menu enum { LOAD_IOS_FAILED = 0, @@ -373,14 +371,21 @@ private: s16 m_codeBtnBack; s16 m_codeBtnErase; s16 m_codeLblUser[4]; -//menu_wbfs +// wbfs menu s16 m_wbfsLblTitle; s16 m_wbfsPBar; s16 m_wbfsBtnGo; s16 m_wbfsLblDialog; s16 m_wbfsLblMessage; s16 m_wbfsLblUser[4]; -//Theme Adjust menus + enum WBFS_OP + { + WO_ADD_GAME, + WO_REMOVE_GAME, + WO_FORMAT, + WO_COPY_GAME, + }; +//coverflow adjust menu s16 m_cfThemeBtnAlt; s16 m_cfThemeBtnSelect; s16 m_cfThemeBtnWide; @@ -395,6 +400,32 @@ private: s16 m_cfThemeBtnValM[4 * 4]; s16 m_cfThemeBtnValP[4 * 4]; s16 m_cfThemeLblValTxt[4]; + struct SCFParamDesc + { + enum + { + 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; + const char name[32]; + const char valName[4][64]; + const char key[4][48]; + float step[4]; + float minMaxVal[4][2]; + }; + static const SCFParamDesc _cfParams[]; //Game Settings menus s16 m_gameSettingsLblPage; s16 m_gameSettingsBtnPageM; @@ -554,20 +585,6 @@ private: s16 m_gameSettingsLblFlashSave; s16 m_gameSettingsBtnFlashSave; -// System Menu - s16 m_systemBtnBack; - s16 m_systemLblTitle; - s16 m_systemLblVersionTxt; - s16 m_systemLblNINverTxt; - s16 m_systemLblVersion; - s16 m_systemLblNINver; - s16 m_systemLblVersionRev; - s16 m_systemLblUser[4]; - s16 m_systemBtnDownload; - s16 m_systemLblInfo; - s16 m_systemLblVerSelectVal; - s16 m_systemBtnVerSelectM; - s16 m_systemBtnVerSelectP; //Cheat menu s16 m_cheatBtnBack; s16 m_cheatBtnApply; @@ -607,14 +624,8 @@ private: TexData m_wifi; TexData m_controlsreq[4]; TexData m_controls[4]; -// Zones - SZone m_mainPrevZone; - SZone m_mainNextZone; - SZone m_mainButtonsZone; - SZone m_mainButtonsZone2; - SZone m_mainButtonsZone3; - SZone m_gameButtonsZone; +// controller stuff WPADData *wd[WPAD_MAX_WIIMOTES]; u32 wii_btnsPressed[WPAD_MAX_WIIMOTES]; @@ -680,12 +691,30 @@ private: bool WPadIR_Valid(int chan); bool WPadIR_ANY(void); + CCursor m_cursor[WPAD_MAX_WIIMOTES]; u8 pointerhidedelay[WPAD_MAX_WIIMOTES]; u16 stickPointer_x[WPAD_MAX_WIIMOTES]; u16 stickPointer_y[WPAD_MAX_WIIMOTES]; bool m_show_pointer[WPAD_MAX_WIIMOTES]; bool ShowPointer(void); + time_t no_input_time; + u32 NoInputTime(void); +// Zones + struct SZone + { + int x; + int y; + int w; + int h; + bool hide; + }; + SZone m_mainPrevZone; + SZone m_mainNextZone; + SZone m_mainButtonsZone; + SZone m_mainButtonsZone2; + SZone m_mainButtonsZone3; + SZone m_gameButtonsZone; void ShowZone(SZone zone, bool &showZone); void ShowMainZone(void); void ShowMainZone2(void); @@ -700,36 +729,7 @@ private: bool m_show_zone_next; bool m_show_zone_game; - time_t no_input_time; - u32 NoInputTime(void); - - volatile bool m_exit; - volatile bool m_thrdStop; - volatile bool m_thrdWorking; - volatile bool m_thrdNetwork; - float m_thrdStep; - float m_thrdStepLen; - mutex_t m_mutex; - wstringEx m_thrdMessage; - volatile float m_thrdProgress; - volatile float m_fileProgress; - volatile bool m_thrdMessageAdded; - volatile bool m_gameSelected; - GuiSound m_gameSound; - volatile bool m_soundThrdBusy; - lwp_t m_gameSoundThread; - bool m_gamesound_changed; - u8 m_bnrSndVol; - bool m_video_playing; - -private: - enum WBFS_OP - { - WO_ADD_GAME, - WO_REMOVE_GAME, - WO_FORMAT, - WO_COPY_GAME, - }; +// GUI Theme stuff typedef std::map TexSet; typedef std::map SoundSet; struct SThemeData @@ -823,285 +823,12 @@ private: GuiSound *cameraSound; }; SThemeData theme; - struct SCFParamDesc - { - enum - { - 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; - const char name[32]; - const char valName[4][64]; - const char key[4][48]; - float step[4]; - float minMaxVal[4][2]; - }; - // - bool _loadList(void); - bool _loadWiiList(void); - bool _loadGamecubeList(void); - bool _loadChannelList(void); - bool _loadPluginList(void); - bool _loadHomebrewList(const char *HB_Dir); - void _initCF(void); - // - void _initBoot(void); - void _initMainMenu(); - void _initErrorMenu(); - void _initConfigMenu(); - void _initConfigGCMenu(); - void _initPartitionsCfgMenu(); - void _initGameMenu(); - void _initDownloadMenu(); - void _initCodeMenu(); - void _initAboutMenu(); - void _initWBFSMenu(); - void _initCFThemeMenu(); - void _initGameSettingsMenu(); - void _initCheatSettingsMenu(); - void _initSourceMenu(); - void _initConfigSrc(); - void _initConfigHB(); - void _initPluginSettingsMenu(); - void _initCategorySettingsMenu(); - void _initGameInfoMenu(); - void _initNandEmuMenu(); - void _initHomeAndExitToMenu(); - void _initCoverBanner(); - void _initExplorer(); - void _initWad(); - void _initPathsMenu(); - void _initCheckboxesMenu(); - // - void _textSource(void); - void _textConfigSrc(void); - void _textConfigHB(void); - void _textPluginSettings(void); - void _textCategorySettings(void); - void _textCheatSettings(void); - void _textError(void); - void _textConfig(void); - void _textConfigGC(void); - void _textPartitionsCfg(void); - void _textGame(void); - void _textDownload(void); - void _textCode(void); - void _textAbout(void); - void _textWBFS(void); - void _textGameSettings(void); - void _textGameInfo(void); - void _textNandEmu(void); - void _textHome(void); - void _textExitTo(void); - void _textShutdown(void); - void _textBoot(void); - void _textCoverBanner(void); - void _textExplorer(void); - void _textWad(void); - void _textPaths(void); - void _textCheckboxesMenu(void); - // - void _hideCheatSettings(bool instant = false); - void _hideError(bool instant = false); - void _hideMain(bool instant = false); - void _hideConfigMain(bool instant = true); - void _hideConfigButtons(bool instant = true); - void _hideConfigGC(bool instant = true); - void _hideConfigHB(bool instant = true); - void _hideConfigSrc(bool instant = true); - void _hideBoot(bool instant = true); - void _hideCoverBanner(bool instant = true); - void _hidePartitionsCfg(bool instant = true); - void _hidePaths(bool instant = true); - void _hideNandEmu(bool instant = true); - void _hideDownload(bool instant = true); - void _hideCode(bool instant = false); - void _hideAbout(bool instant = false); - void _hideWBFS(bool instant = false); - void _hideCFTheme(bool instant = false); - void _hideGameSettings(bool instant = false); - void _hideGameSettingsPg(bool instant = false); - void _hideCheckboxesMenu(bool instant = false); - void _hideSM_Editor(bool instant = false); - void _hidePluginSettings(bool instant = false); - void _hideCategorySettings(bool instant = false); - void _hideSource(bool instant = false); - void _hideGame(bool instant = false); - void _hideGameInfo(bool instant = false); - void _hideHome(bool instant = false); - void _hideExitTo(bool instant = false); - void _hideShutdown(bool instant = false); - void _hideExplorer(bool instant = false); - void _hideWad(bool instant = false); - // - void _showError(void); - void _showMain(void); - void _showConfigMain(int curPage); - void _showConfigGC(int curPage); - void _showConfigHB(void); - void _showConfigSrc(bool m_sourceflow = false); - void _showPartitionsCfg(void); - void _showNandEmu(void); - void _showGame(void); - void _showDownload(void); - void _showCode(void); - void _showAbout(void); - void _showBoot(void); - void _showSource(void); - void _showPluginSettings(void); - void _showCategorySettings(void); - void _showCheatSettings(void); - void _showGameInfo(void); - void _showWBFS(WBFS_OP op); - void _showCFTheme(u32 curParam, int version, bool wide); - void _showGameSettings(void); - void _showHome(void); - void _showExitTo(void); - void _showShutdown(void); - void _showCoverBanner(void); - void _showExplorer(void); - void _showWad(void); - void _showPaths(void); - void _showCheckboxesMenu(void); - void _showSM_Editor(void); - - void _showCF(bool refreshList = false); - void _refreshExplorer(s8 direction = 0); - void _setSrcOptions(void); - void _updateSourceBtns(void); - void _updatePluginText(void); - void _updatePluginCheckboxes(void); - void _updateCheckboxesText(void); - void _updateCheckboxes(void); - void _updateCatCheckboxes(void); - void _getGameCategories(void); - void _setGameCategories(void); - void _setCatGenDomain(void); - void _getCustomBgTex(void); - void _setMainBg(void); - void _setBg(const TexData &bgTex, const TexData &bglqTex); - void _updateBg(void); - void _drawBg(void); - void _updateText(void); - void _setPartition(s8 direction = 0); - void _setCFVersion(int version); - int _getCFVersion(void); - // - void _configMain(void); - void _configGC(void); - void _ConfigSrc(); - void _ConfigHB(); - void _partitionsCfg(void); - int _NandEmuCfg(void); - int _ExtractGameSave(string gameId); - int _FlashGameSave(string gameId); - void _game(bool launch = false); - //void _downloadUrl(const char *url, u8 **dl_file, u32 *dl_size); - void _download(string gameId = string(), int dl_type = 0); - bool _code(char code[4], bool erase = false); - void _about(bool help = false); - bool _wbfsOp(WBFS_OP op); - void _cfTheme(void); - bool _gameinfo(void); - void _gameSettings(const dir_discHdr *GameHdr, bool disc = false); - void _CoverBanner(void); - int _sfCacheCoversNeeded(); - int _cacheCovers(void); - void _Explorer(void); - const char *_FolderExplorer(const char *startPath); - void _wadExplorer(void); - void _Wad(const char *wad_path = NULL); - void _CheatSettings(); - bool _Source(); - void _PluginSettings(); - void _checkboxesMenu(u8 md); - void _SM_Editor(); - void _CategorySettings(bool fromGameSet = false); - bool _Home(); - bool _ExitTo(); - void _Shutdown(); - void _Boot(); - void _Paths(); - void _sourceFlow(); - int _getSrcFlow(); - void _setSrcFlow(int version); - bool _srcTierBack(bool home); - void _srcTierLoad(string fn); - void _restoreSrcTiers(); - void _getSFlowBgTex(); - void _mainLoopCommon(bool withCF = false, bool adjusting = false); - void _loadDefaultFont(void); - bool _loadFile(u8 * &buffer, u32 &size, const char *path, const char *file); - int _loadGameIOS(u8 ios, int userIOS, string id, bool RealNAND_Channels = false); - void _launch(const dir_discHdr *hdr); - void _launchWii(dir_discHdr *hdr, bool dvd, bool disc_cfg = false); - void _launchChannel(dir_discHdr *hdr); - void _launchHomebrew(const char *filepath, vector arguments); - void _launchGC(dir_discHdr *hdr, bool disc); - void _launchPlugin(dir_discHdr *hdr); - void _launchShutdown(); - vector _getMetaXML(const char *bootpath); - void _extractBnr(const dir_discHdr *hdr); - void _setCurrentItem(const dir_discHdr *hdr); - void exitHandler(int ExitTo); - void _setAA(int aa); - void _loadCFCfg(); - void _loadCFLayout(int version, bool forceAA = false, bool otherScrnFmt = false); - Vector3D _getCFV3D(const string &domain, const string &key, const Vector3D &def, bool otherScrnFmt = false); - int _getCFInt(const string &domain, const string &key, int 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 _buildMenus(void); - void _cleanupDefaultFont(); - void _Theme_Cleanup(); - const char *_domainFromView(void); - const char *_cfDomain(bool selected = false); - //void UpdateCache(u32 view = COVERFLOW_MAX); - void RemoveCover(const char *id); SFont _dfltFont(u32 fontSize, u32 lineSpacing, u32 weight, u32 index, const char *genKey); SFont _font(const char *domain, const char *key, SFont def_font); TexData _texture(const char *domain, const char *key, TexData &def, bool freeDef = true); vector _textures(const char *domain, const char *key); - void _showWaitMessage(); -public: - void _hideWaitMessage(); - void GC_Messenger(int message, int info, char *cinfo); - - /* proxy settings */ - bool proxyUseSystem; - char proxyAddress[256]; - u16 proxyPort; - char proxyUsername[33]; - char proxyPassword[33]; - - /* general thread updating stuff */ - u64 m_thrdTotal; - void update_pThread(u64 amount, bool add = true); -private: - void _cleanupBanner(bool gamechange = false); - void _cleanupVideo(); - bool _startVideo(); - static void * _pThread(void *obj); - void _start_pThread(void); - void _stop_pThread(void); - lwp_t m_thrdPtr; - volatile bool m_thrdInstalling; - volatile bool m_thrdUpdated; - volatile bool m_thrdDone; - vu64 m_thrdWritten; - GuiSound *_sound(CMenu::SoundSet &soundSet, const char *filename, const u8 * snd, u32 len, const char *name, bool isAllocated); GuiSound *_sound(CMenu::SoundSet &soundSet, const char *domain, const char *key, const char *name); u16 _textStyle(const char *domain, const char *key, u16 def, bool coverflow = false); @@ -1113,30 +840,180 @@ private: void _setHideAnim(s16 id, const char *domain, int dx, int dy, float scaleX, float scaleY); void _addUserLabels(s16 *ids, u32 size, const char *domain); void _addUserLabels(s16 *ids, u32 start, u32 size, const char *domain); - // - const wstringEx _t(const char *key, const wchar_t *def = L"") { return m_loc.getWString(m_curLanguage, key, def); } - const wstringEx _fmt(const char *key, const wchar_t *def); - wstringEx _getNoticeTranslation(int sorting, wstringEx curLetter); - // - void _setThrdMsg(const wstringEx &msg, float progress); - void _setDumpMsg(const wstringEx &msg, float progress, float fileprog); - void _downloadProgress(void *obj, int size, int position); - int _coverDownloader(); - int _gametdbDownloaderAsync(); - int _bannerDownloader(); - //void _netInit(); - void _initAsyncNetwork(); - static s32 _networkComplete(s32 result, void *usrData); - bool _isNetworkAvailable(); - s32 _initNetwork(); - void LoadView(void); - static void _addDiscProgress(int status, int total, void *user_data); - static void _ShowProgress(int dumpstat, int dumpprog, int filestat, int fileprog, int files, int folders, const char *tmess, void *user_data); - static void * _gameInstaller(void *obj); - static void * _GCcopyGame(void *obj); - bool _searchGamesByID(const char *gameId); - int _GCgameInstaller(); +//main coverflow functions + void _loadCFCfg(); + void _loadCFLayout(int version, bool forceAA = false, bool otherScrnFmt = false); + Vector3D _getCFV3D(const string &domain, const string &key, const Vector3D &def, bool otherScrnFmt = false); + int _getCFInt(const string &domain, const string &key, int def, bool otherScrnFmt = false); + float _getCFFloat(const string &domain, const string &key, float def, bool otherScrnFmt = false); + void _setAA(int aa); + void _setCFVersion(int version); + int _getCFVersion(void); + +// Menu Inits + void _initMainMenu(); + void _initErrorMenu(); + void _initConfigMenu(); + void _initConfigGCMenu(); + void _initConfigSrc(); + void _initConfigHB(); + void _initBoot(void); + void _initNandEmuMenu(); + void _initPartitionsCfgMenu(); + void _initPathsMenu(); + void _initDownloadMenu(); + void _initCodeMenu(); + void _initCFThemeMenu(); + void _initGameMenu(); + void _initGameInfoMenu(); + void _initGameSettingsMenu(); + void _initCheatSettingsMenu(); + void _initCoverBanner(); + void _initWBFSMenu(); + void _initCategorySettingsMenu(); + void _initHomeAndExitToMenu(); + void _initAboutMenu(); + void _initExplorer(); + void _initWad(); + void _initSourceMenu(); + void _initPluginSettingsMenu(); + void _initCheckboxesMenu(); +// menu texts + void _textError(void); + void _textConfig(void); + void _textConfigGC(void); + void _textConfigSrc(void); + void _textConfigHB(void); + void _textBoot(void); + void _textNandEmu(void); + void _textPartitionsCfg(void); + void _textPaths(void); + void _textDownload(void); + void _textCode(void); + void _textGame(void); + void _textGameInfo(void); + void _textGameSettings(void); + void _textCheatSettings(void); + void _textCoverBanner(void); + void _textWBFS(void); + void _textCategorySettings(void); + void _textHome(void); + void _textExitTo(void); + void _textShutdown(void); + void _textAbout(void); + void _textExplorer(void); + void _textWad(void); + void _textSource(void); + void _textPluginSettings(void); + void _textCheckboxesMenu(void); +// menu hides + void _hideMain(bool instant = false); + void _hideError(bool instant = false); + void _hideConfigMain(bool instant = true); + void _hideConfigButtons(bool instant = true); + void _hideConfigGC(bool instant = true); + void _hideConfigSrc(bool instant = true); + void _hideConfigHB(bool instant = true); + void _hideBoot(bool instant = true); + void _hideNandEmu(bool instant = true); + void _hidePartitionsCfg(bool instant = true); + void _hidePaths(bool instant = true); + void _hideDownload(bool instant = true); + void _hideCode(bool instant = false); + void _hideCFTheme(bool instant = false); + void _hideGame(bool instant = false); + void _hideGameInfo(bool instant = false); + void _hideGameSettings(bool instant = false); + void _hideGameSettingsPg(bool instant = false); + void _hideCheatSettings(bool instant = false); + void _hideCoverBanner(bool instant = true); + void _hideWBFS(bool instant = false); + void _hideCategorySettings(bool instant = false); + void _hideHome(bool instant = false); + void _hideExitTo(bool instant = false); + void _hideShutdown(bool instant = false); + void _hideAbout(bool instant = false); + void _hideExplorer(bool instant = false); + void _hideWad(bool instant = false); + void _hideSource(bool instant = false); + void _hidePluginSettings(bool instant = false); + void _hideCheckboxesMenu(bool instant = false); + void _hideSM_Editor(bool instant = false); +// menu shows + void _showMain(void); + void _showCF(bool refreshList = false); + void _showError(void); + void _showConfigMain(void); + void _showConfigGC(void); + void _showConfigSrc(bool m_sourceflow = false); + void _showConfigHB(void); + void _showBoot(void); + void _showNandEmu(void); + void _showPartitionsCfg(void); + void _showPaths(void); + void _showDownload(void); + void _showCode(void); + void _showCFTheme(u32 curParam, int version, bool wide); + void _showGame(void); + void _showGameSettings(void); + void _showGameInfo(void); + void _showCheatSettings(void); + void _showCoverBanner(void); + void _showWBFS(WBFS_OP op); + void _showCategorySettings(void); + void _showHome(void); + void _showExitTo(void); + void _showShutdown(void); + void _showAbout(void); + void _showExplorer(void); + void _showWad(void); + void _showSource(void); + void _showPluginSettings(void); + void _showCheckboxesMenu(void); + void _showSM_Editor(void); +// menu main functions + void _error(const wstringEx &msg); + void _configMain(void); + void _configGC(void); + void _ConfigSrc(); + void _ConfigHB(); + void _Boot(); + int _NandEmuCfg(void); + void _partitionsCfg(void); + void _Paths(); + void _download(string gameId = string(), int dl_type = 0); + bool _code(char code[4], bool erase = false); + void _cfTheme(void); + void _game(bool launch = false); + bool _gameinfo(void); + void _gameSettings(const dir_discHdr *GameHdr, bool disc = false); + void _CheatSettings(); + void _CoverBanner(void); + bool _wbfsOp(WBFS_OP op); + void _CategorySettings(bool fromGameSet = false); + bool _Home(); + bool _ExitTo(); + void _Shutdown(); + void _about(bool help = false); + void _Explorer(void); + void _Wad(const char *wad_path = NULL); + bool _Source(); + void _PluginSettings(); + void _checkboxesMenu(u8 md); + void _SM_Editor(); + +//nand emu functions + int _FindEmuPart(bool savesnand, bool searchvalid); + bool _checkSave(string id, int nand_type); + bool _TestEmuNand(int epart, const char *path, bool indept); + void _getEmuNands(void); + void _FullNandCheck(void); + void _listEmuNands(const char *path, vector &nands); + int _ExtractGameSave(string gameId); + int _FlashGameSave(string gameId); + static void * _NandDumper(void *obj); + static void * _NandFlasher(void *obj); float m_progress; float m_fprogress; int m_fileprog; @@ -1145,62 +1022,175 @@ private: int m_filesdone; int m_foldersdone; int m_nandexentry; - wstringEx _optBoolToString(int b); - void _stopSounds(void); - static void * _NandDumper(void *obj); - static void * _NandFlasher(void *obj); - int _FindEmuPart(bool savesnand, bool searchvalid); - bool _checkSave(string id, int nand_type); - bool _TestEmuNand(int epart, const char *path, bool indept); - void _getEmuNands(void); - void _FullNandCheck(void); - void _listEmuNands(const char *path, vector &nands); - +//explorer menu + const char *_FolderExplorer(const char *startPath); + void _wadExplorer(void); + void _refreshExplorer(s8 direction = 0); +//source menu + void _setSrcOptions(void); + void _updateSourceBtns(void); +//select plugins menu + void _updatePluginText(void); + void _updatePluginCheckboxes(void); + void _updateCheckboxesText(void); + void _updateCheckboxes(void); +//categories menu + void _updateCatCheckboxes(void); + void _getGameCategories(void); + void _setGameCategories(void); + void _setCatGenDomain(void); +//adjust coverflow menu + void _cfParam(bool inc, int i, const SCFParamDesc &p, int cfVersion, bool wide); + const char *_cfDomain(bool selected = false); +//download menu functions + void _setThrdMsg(const wstringEx &msg, float progress); + void _setDumpMsg(const wstringEx &msg, float progress, float fileprog); + void _downloadProgress(void *obj, int size, int position); + int _coverDownloader(); + int _gametdbDownloaderAsync(); + int _bannerDownloader(); int _downloadCheatFileAsync(); + //void _downloadUrl(const char *url, u8 **dl_file, u32 *dl_size); //static void * _downloadUrlAsync(void *obj); - + //static u8 downloadStack[8192]; + //static const u32 downloadStackSize; + //void _netInit(); + void _initAsyncNetwork(); + static s32 _networkComplete(s32 result, void *usrData); + bool _isNetworkAvailable(); + s32 _initNetwork(); + static void * _pThread(void *obj); + void _start_pThread(void); + void _stop_pThread(void); + lwp_t m_thrdPtr; + volatile bool m_thrdInstalling; + volatile bool m_thrdUpdated; + volatile bool m_thrdDone; + vu64 m_thrdWritten; +// wbfs menu functions + static void _addDiscProgress(int status, int total, void *user_data); + static void _ShowProgress(int dumpstat, int dumpprog, int filestat, int fileprog, int files, int folders, const char *tmess, void *user_data); + static void * _gameInstaller(void *obj); + static void * _GCcopyGame(void *obj); + bool _searchGamesByID(const char *gameId); + int _GCgameInstaller(); +// game selected menu functions + void _extractBnr(const dir_discHdr *hdr); + void _setCurrentItem(const dir_discHdr *hdr); + void _cleanupBanner(bool gamechange = false); + void _cleanupVideo(); + bool _startVideo(); void _playGameSound(void); void _stopGameSoundThread(void); static void * _gameSoundThread(void *obj); + GuiSound m_gameSound; + volatile bool m_gameSelected; + volatile bool m_soundThrdBusy; + lwp_t m_gameSoundThread; + bool m_gamesound_changed; + u8 m_bnrSndVol; + bool m_video_playing; + +// gamelist functions + bool _loadList(void); + bool _loadWiiList(void); + bool _loadGamecubeList(void); + bool _loadChannelList(void); + bool _loadPluginList(void); + bool _loadHomebrewList(const char *HB_Dir); + void _initCF(void); + +//background handling functions + void _getCustomBgTex(void); + void _setMainBg(void); + void _setBg(const TexData &bgTex, const TexData &bglqTex); + void _updateBg(void); + void _drawBg(void); +//sourceflow functions + void _sourceFlow(); + int _getSrcFlow(); + void _setSrcFlow(int version); + bool _srcTierBack(bool home); + void _srcTierLoad(string fn); + void _restoreSrcTiers(); + void _getSFlowBgTex(); + +// misc functions + void RemoveCover(const char *id); + void _setPartition(s8 direction = 0); + int _sfCacheCoversNeeded(); + int _cacheCovers(void); + void _mainLoopCommon(bool withCF = false, bool adjusting = false); + void _loadDefaultFont(void); + void _cleanupDefaultFont(); + void cleanup(void); + void _Theme_Cleanup(); + void _stopSounds(void); + void TempLoadIOS(int IOS = 0); + void exitHandler(int ExitTo); + const char *_domainFromView(void); + void _showWaitMessage(); + void _hideWaitMessage(); + void _updateText(void); + const wstringEx _t(const char *key, const wchar_t *def = L"") { return m_loc.getWString(m_curLanguage, key, def); } + const wstringEx _fmt(const char *key, const wchar_t *def); + wstringEx _getNoticeTranslation(int sorting, wstringEx curLetter); + wstringEx _optBoolToString(int b); void _load_installed_cioses(); std::map _installed_cios; typedef std::map::iterator CIOSItr; +//game boot functions + void _launch(const dir_discHdr *hdr); + void _launchWii(dir_discHdr *hdr, bool dvd, bool disc_cfg = false); + void _launchChannel(dir_discHdr *hdr); + void _launchHomebrew(const char *filepath, vector arguments); + void _launchGC(dir_discHdr *hdr, bool disc); + void _launchPlugin(dir_discHdr *hdr); + void _launchShutdown(); + vector _getMetaXML(const char *bootpath); + int _loadGameIOS(u8 ios, int userIOS, string id, bool RealNAND_Channels = false); + bool _loadFile(u8 * &buffer, u32 &size, const char *path, const char *file);// gameconfig.txt and cheats.gct + +// struct SOption { const char id[11]; const wchar_t text[16]; }; static const SOption _GlobalVideoModes[6]; static const SOption _VideoModes[7]; static const SOption _languages[11]; - static const SOption _GlobalDeflickerOptions[6]; static const SOption _DeflickerOptions[7]; - static const SOption _GlobalGCvideoModes[6]; - static const SOption _GlobalGClanguages[7]; - static const SOption _GCvideoModes[7]; - static const SOption _GClanguages[8]; - static const SOption _GlobalGCLoaders[2]; - static const SOption _GCLoader[3]; - - static const SOption _ChannelsType[3]; - static const SOption _NandEmu[2]; - static const SOption _SaveEmu[4]; - static const SOption _GlobalSaveEmu[3]; static const SOption _AspectRatio[3]; static const SOption _WidescreenWiiu[3]; - static const SOption _NinEmuCard[5]; static const SOption _vidModePatch[4]; static const SOption _debugger[3]; static const SOption _hooktype[8]; static const SOption _exitTo[3]; static const SOption _privateServer[3]; - static int _version[9]; - static const SCFParamDesc _cfParams[]; - static const int _nbCfgPages; - //thread stack - static u8 downloadStack[8192]; - static const u32 downloadStackSize; + static const SOption _GlobalGCvideoModes[6]; + static const SOption _GCvideoModes[7]; + static const SOption _GlobalGClanguages[7]; + static const SOption _GClanguages[8]; + static const SOption _GlobalGCLoaders[2]; + static const SOption _GCLoader[3]; + static const SOption _NinEmuCard[5]; + + static const SOption _ChannelsType[3]; + static const SOption _NandEmu[2]; + static const SOption _SaveEmu[4]; + static const SOption _GlobalSaveEmu[3]; + +// thread stuff + mutex_t m_mutex; + wstringEx m_thrdMessage; + volatile float m_thrdProgress; + volatile float m_fileProgress; + volatile bool m_thrdMessageAdded; + volatile bool m_thrdStop; + volatile bool m_thrdWorking; + volatile bool m_thrdNetwork; }; extern CMenu mainMenu; diff --git a/source/menu/menu_config_boot.cpp b/source/menu/menu_config_boot.cpp index 6db13b47..fa4a14aa 100644 --- a/source/menu/menu_config_boot.cpp +++ b/source/menu/menu_config_boot.cpp @@ -62,7 +62,7 @@ void CMenu::_Boot(void) { if(isWiiVC) { - error(_t("errboot7", L"Access denied in Wii VC mode.")); + _error(_t("errboot7", L"Access denied in Wii VC mode.")); return; } set_port = currentPort; @@ -138,7 +138,7 @@ void CMenu::_Boot(void) if(prev_load != cur_load || prev_ios != cur_ios || set_port != currentPort || prev_sd != cur_sd) { - error(_t("errboot8", L"Press 'A' to reload WiiFlow")); + _error(_t("errboot8", L"Press 'A' to reload WiiFlow")); vector arguments = _getMetaXML(fmt("%s/boot.dol", m_appDir.c_str())); _launchHomebrew(fmt("%s/boot.dol", m_appDir.c_str()), arguments); } diff --git a/source/menu/menu_config_coverbnr.cpp b/source/menu/menu_config_coverbnr.cpp index fb555700..094c715c 100644 --- a/source/menu/menu_config_coverbnr.cpp +++ b/source/menu/menu_config_coverbnr.cpp @@ -74,7 +74,7 @@ void CMenu::_CoverBanner(void) { _hideCoverBanner(); RemoveCover(id); - error(_t("deltcover", L"Cover is deleted.")); + _error(_t("deltcover", L"Cover is deleted.")); _showCoverBanner(); } else if(m_btnMgr.selected(m_configBtn3)) @@ -95,7 +95,7 @@ void CMenu::_CoverBanner(void) fsop_deleteFile(fmt("%s/%s.bnr", m_customBnrDir.c_str(), id)); fsop_deleteFile(fmt("%s/%.3s.bnr", m_bnrCacheDir.c_str(), id)); fsop_deleteFile(fmt("%s/%.3s.bnr", m_customBnrDir.c_str(), id)); - error(_t("deltbanner", L"Banner is deleted.")); + _error(_t("deltbanner", L"Banner is deleted.")); m_newGame = true; _showCoverBanner(); } diff --git a/source/menu/menu_config_game.cpp b/source/menu/menu_config_game.cpp index b6a07d23..a07f0c59 100644 --- a/source/menu/menu_config_game.cpp +++ b/source/menu/menu_config_game.cpp @@ -971,7 +971,7 @@ void CMenu::_gameSettings(const dir_discHdr *hdr, bool disc) else if(m_btnMgr.selected(m_gameSettingsBtnManage)) { if(disc) - error(_t("cfgg57", L"Not allowed for disc!")); + _error(_t("cfgg57", L"Not allowed for disc!")); else { CoverFlow.stopCoverLoader(true); @@ -1079,7 +1079,7 @@ void CMenu::_gameSettings(const dir_discHdr *hdr, bool disc) else if(m_btnMgr.selected(m_gameSettingsBtnAdultOnly)) { if(disc) - error(_t("cfgg57", L"Not allowed for disc!")); + _error(_t("cfgg57", L"Not allowed for disc!")); else { if(GameHdr->type == TYPE_PLUGIN) @@ -1094,7 +1094,7 @@ void CMenu::_gameSettings(const dir_discHdr *hdr, bool disc) _hideGameSettings(); m_forceext = true; if(!_ExtractGameSave(id)) - error(_t("cfgg50", L"No save to extract!")); + _error(_t("cfgg50", L"No save to extract!")); _showGameSettings(); } else if(m_btnMgr.selected(m_gameSettingsBtnFlashSave)) @@ -1102,7 +1102,7 @@ void CMenu::_gameSettings(const dir_discHdr *hdr, bool disc) _hideGameSettings(); m_forceext = true; if(!_FlashGameSave(id)) - error(_t("cfgg51", L"No save to flash to real NAND!")); + _error(_t("cfgg51", L"No save to flash to real NAND!")); _showGameSettings(); } } diff --git a/source/menu/menu_config_gc.cpp b/source/menu/menu_config_gc.cpp index 79c8c567..ddc0c869 100644 --- a/source/menu/menu_config_gc.cpp +++ b/source/menu/menu_config_gc.cpp @@ -11,6 +11,8 @@ s16 m_configGCLblPage; s16 m_configGCBtnPageM; s16 m_configGCBtnPageP; +u8 configGC_curPage = 1; + template static inline T loopNum(T i, T s) { return (i + s) % s; @@ -29,7 +31,7 @@ void CMenu::_hideConfigGC(bool instant) _hideConfigButtons(instant); } -void CMenu::_showConfigGC(int curPage) +void CMenu::_showConfigGC(void) { _setBg(m_configGCBg, m_configGCBg); m_btnMgr.show(m_configGCLblTitle); @@ -41,12 +43,12 @@ void CMenu::_showConfigGC(int curPage) m_btnMgr.show(m_configGCLblPage); m_btnMgr.show(m_configGCBtnPageM); m_btnMgr.show(m_configGCBtnPageP); - m_btnMgr.setText(m_configGCLblPage, wfmt(L"%i / %i", curPage, 2)); + m_btnMgr.setText(m_configGCLblPage, wfmt(L"%i / %i", configGC_curPage, 2)); _hideConfigButtons(true); int i; - if(curPage == 1) + if(configGC_curPage == 1) { m_btnMgr.setText(m_configLbl1, _t("cfgb5", L"Video mode")); m_btnMgr.setText(m_configLbl2, _t("cfgb6", L"Game language")); @@ -103,9 +105,9 @@ void CMenu::_configGC(void) { int i; bool j; - int curPage = 1; + configGC_curPage = 1; SetupInput(); - _showConfigGC(curPage); + _showConfigGC(); while(!m_exit) { _mainLoopCommon(); @@ -117,27 +119,27 @@ void CMenu::_configGC(void) m_btnMgr.down(); else if(BTN_LEFT_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_configGCBtnPageM))) { - curPage--; - if(curPage < 1) - curPage = 2; + configGC_curPage--; + if(configGC_curPage < 1) + configGC_curPage = 2; if(!BTN_A_PRESSED) m_btnMgr.click(m_configGCBtnPageM); - _showConfigGC(curPage); + _showConfigGC(); } else if(BTN_RIGHT_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_configGCBtnPageP))) { - curPage++; - if(curPage > 2) - curPage = 1; + configGC_curPage++; + if(configGC_curPage > 2) + configGC_curPage = 1; if(!BTN_A_PRESSED) m_btnMgr.click(m_configGCBtnPageP); - _showConfigGC(curPage); + _showConfigGC(); } else if(BTN_A_PRESSED) { if(m_btnMgr.selected(m_configGCBtnBack)) break; - if(curPage == 1) + if(configGC_curPage == 1) { if(m_btnMgr.selected(m_configBtn2P) || m_btnMgr.selected(m_configBtn2M)) { diff --git a/source/menu/menu_config_main.cpp b/source/menu/menu_config_main.cpp index 3a2692a2..d1cdb0d6 100644 --- a/source/menu/menu_config_main.cpp +++ b/source/menu/menu_config_main.cpp @@ -2,7 +2,8 @@ #include #include "menu.hpp" -const int CMenu::_nbCfgPages = 14; +u8 mainCfg_Pages = 14; +u8 mainCfg_curPage = 1; template static inline T loopNum(T i, T s) { @@ -100,7 +101,7 @@ void CMenu::_hideConfigMain(bool instant) _hideConfigButtons(instant); } -void CMenu::_showConfigMain(int curPage) +void CMenu::_showConfigMain() { _setBg(m_configBg, m_configBg); m_btnMgr.show(m_configLblTitle); @@ -112,7 +113,7 @@ void CMenu::_showConfigMain(int curPage) m_btnMgr.show(m_configLblPage); m_btnMgr.show(m_configBtnPageM); m_btnMgr.show(m_configBtnPageP); - m_btnMgr.setText(m_configLblPage, wfmt(L"%i / %i", curPage, m_locked ? curPage : _nbCfgPages)); + m_btnMgr.setText(m_configLblPage, wfmt(L"%i / %i", mainCfg_curPage, m_locked ? mainCfg_curPage : mainCfg_Pages)); _hideConfigButtons(true); @@ -121,11 +122,11 @@ void CMenu::_showConfigMain(int curPage) { m_btnMgr.show(m_configLbl1); m_btnMgr.show(m_configLbl3); - if(curPage != 14) + if(mainCfg_curPage != 14) m_btnMgr.show(m_configLbl4); } - if(curPage == 1) + if(mainCfg_curPage == 1) { m_btnMgr.show(m_configBtn2); if(!m_locked) @@ -147,7 +148,7 @@ void CMenu::_showConfigMain(int curPage) m_btnMgr.setText(m_configBtn3, _t("cfg14", L"Set")); m_btnMgr.setText(m_configBtn4, _t("cfg14", L"Set")); } - else if(curPage == 2) + else if(mainCfg_curPage == 2) { m_btnMgr.show(m_configLbl1Val); m_btnMgr.show(m_configBtn1M); @@ -168,7 +169,7 @@ void CMenu::_showConfigMain(int curPage) m_btnMgr.setText(m_configBtn3, _t("cfgc5", L"Go")); m_btnMgr.setText(m_configBtn4, _t("cfgc5", L"Go")); } - else if(curPage == 3) + else if(mainCfg_curPage == 3) { m_btnMgr.show(m_configLbl1Val); m_btnMgr.show(m_configBtn1M); @@ -197,7 +198,7 @@ void CMenu::_showConfigMain(int curPage) i = min(max(1, m_cfg.getInt(CHANNEL_DOMAIN, "channels_type", CHANNELS_REAL)), (int)ARRAY_SIZE(CMenu::_ChannelsType)) - 1; m_btnMgr.setText(m_configLbl4Val, _t(CMenu::_ChannelsType[i].id, CMenu::_ChannelsType[i].text)); } - else if(curPage == 4) + else if(mainCfg_curPage == 4) { m_btnMgr.show(m_configBtn1); m_btnMgr.show(m_configBtn2); @@ -241,7 +242,7 @@ void CMenu::_showConfigMain(int curPage) } m_btnMgr.setText(m_configLbl4Val, channelName); } - else if(curPage == 5) + else if(mainCfg_curPage == 5) { m_btnMgr.show(m_configLbl1Val); m_btnMgr.show(m_configBtn1M); @@ -264,7 +265,7 @@ void CMenu::_showConfigMain(int curPage) m_btnMgr.setText(m_configLbl4, _t("cfgs4", L"Game sound volume")); m_btnMgr.setText(m_configLbl4Val, wfmt(L"%i", m_cfg.getInt("GENERAL", "sound_volume_bnr", 255))); } - else if(curPage == 6) + else if(mainCfg_curPage == 6) { m_btnMgr.show(m_configLbl1Val); m_btnMgr.show(m_configBtn1M); @@ -287,7 +288,7 @@ void CMenu::_showConfigMain(int curPage) m_btnMgr.setText(m_configLbl4, _t("cfgc7", L"Vertical offset")); m_btnMgr.setText(m_configLbl4Val, wfmt(L"%i", m_cfg.getInt("GENERAL", "tv_y", 0))); } - else if(curPage == 7) + else if(mainCfg_curPage == 7) { m_btnMgr.show(m_configBtn1); m_btnMgr.show(m_configBtn2); @@ -302,7 +303,7 @@ void CMenu::_showConfigMain(int curPage) m_btnMgr.setText(m_configLbl4, _t("cfg704", L"Hide plugins button")); m_btnMgr.setText(m_configBtn4, m_cfg.getBool(PLUGIN_DOMAIN, "disable") ? _t("yes", L"Yes") : _t("no", L"No")); } - else if(curPage == 8) + else if(mainCfg_curPage == 8) { m_btnMgr.show(m_configBtn1); m_btnMgr.show(m_configBtn2); @@ -319,7 +320,7 @@ void CMenu::_showConfigMain(int curPage) m_btnMgr.setText(m_configLbl4, _t("cfg708", L"Fanart default ending delay")); m_btnMgr.setText(m_configLbl4Val, wfmt(L"%i", m_cfg.getInt("FANART", "delay_after_animation", 200))); } - else if(curPage == 9) + else if(mainCfg_curPage == 9) { m_btnMgr.show(m_configBtn1); m_btnMgr.show(m_configBtn2); @@ -336,7 +337,7 @@ void CMenu::_showConfigMain(int curPage) m_btnMgr.setText(m_configLbl4, _t("cfg712", L"Screensaver idle seconds")); m_btnMgr.setText(m_configLbl4Val, wfmt(L"%i", m_cfg.getInt("GENERAL", "screensaver_idle_seconds", 60)));// inc by 30 } - else if(curPage == 10) + else if(mainCfg_curPage == 10) { m_btnMgr.show(m_configBtn1); m_btnMgr.show(m_configBtn2); @@ -353,7 +354,7 @@ void CMenu::_showConfigMain(int curPage) m_btnMgr.setText(m_configLbl4, _t("cfg716", L"Music fade rate")); m_btnMgr.setText(m_configLbl4Val, wfmt(L"%i", m_cfg.getInt("GENERAL", "music_fade_rate", 8))); } - else if(curPage == 11) + else if(mainCfg_curPage == 11) { m_btnMgr.show(m_configBtn1); m_btnMgr.show(m_configBtn2); @@ -368,7 +369,7 @@ void CMenu::_showConfigMain(int curPage) m_btnMgr.setText(m_configLbl4, _t("cfg721", L"Play GC default sound")); m_btnMgr.setText(m_configBtn4, m_cfg.getBool(GC_DOMAIN, "play_default_sound") ? _t("yes", L"Yes") : _t("no", L"No")); } - else if(curPage == 12) + else if(mainCfg_curPage == 12) { m_btnMgr.show(m_configBtn1); m_btnMgr.show(m_configBtn2); @@ -383,7 +384,7 @@ void CMenu::_showConfigMain(int curPage) m_btnMgr.setText(m_configLbl4, _t("cfg727", L"Use Plugin Database Titles")); m_btnMgr.setText(m_configBtn4, m_cfg.getBool(PLUGIN_DOMAIN, "database_titles", true) ? _t("yes", L"Yes") : _t("no", L"No")); } - else if(curPage == 13) + else if(mainCfg_curPage == 13) { m_btnMgr.show(m_configBtn1); m_btnMgr.show(m_configBtn2); @@ -417,7 +418,7 @@ void CMenu::_showConfigMain(int curPage) void CMenu::_configMain(void) { - int curPage = 1; + mainCfg_curPage = 1; int val; bool rand_music = m_cfg.getBool("GENERAL", "randomize_music"); bool hq_covers = m_cfg.getBool("GENERAL", "cover_use_hq"); @@ -453,7 +454,7 @@ void CMenu::_configMain(void) } } prevLanguage = languages_available[curLanguage]; - _showConfigMain(curPage); + _showConfigMain(); while(!m_exit) { @@ -468,29 +469,29 @@ void CMenu::_configMain(void) { if(BTN_LEFT_PRESSED || BTN_MINUS_PRESSED) m_btnMgr.click(m_configBtnPageM); - curPage -= 1; - if(curPage < 1) - curPage = _nbCfgPages; - _showConfigMain(curPage); + mainCfg_curPage -= 1; + if(mainCfg_curPage < 1) + mainCfg_curPage = mainCfg_Pages; + _showConfigMain(); } else if(!m_locked && (BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_configBtnPageP)))) { if(BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED) m_btnMgr.click(m_configBtnPageP); - curPage += 1; - if(curPage > _nbCfgPages) - curPage = 1; - _showConfigMain(curPage); + mainCfg_curPage += 1; + if(mainCfg_curPage > mainCfg_Pages) + mainCfg_curPage = 1; + _showConfigMain(); } else if(BTN_A_PRESSED) { - if(curPage == 1) + if(mainCfg_curPage == 1) { if(m_btnMgr.selected(m_configBtn1)) { _hideConfigMain(); _download(); - _showConfigMain(1); + _showConfigMain(); } else if(m_btnMgr.selected(m_configBtn2)) { @@ -504,8 +505,8 @@ void CMenu::_configMain(void) m_locked = false; } else - error(_t("cfgg25",L"Password incorrect.")); - _showConfigMain(1); + _error(_t("cfgg25",L"Password incorrect.")); + _showConfigMain(); } else //set code { @@ -517,23 +518,23 @@ void CMenu::_configMain(void) m_cfg.setString("GENERAL", "parent_code", string(code, 4).c_str()); m_locked = true; } - _showConfigMain(1); + _showConfigMain(); } } else if(m_btnMgr.selected(m_configBtn3)) { _hideConfigMain(); _partitionsCfg(); - _showConfigMain(1); + _showConfigMain(); } else if(m_btnMgr.selected(m_configBtn4)) { _hideConfigMain(); _NandEmuCfg(); - _showConfigMain(1); + _showConfigMain(); } } - if(curPage == 2) + if(mainCfg_curPage == 2) { if(m_btnMgr.selected(m_configBtn1P) || m_btnMgr.selected(m_configBtn1M)) { @@ -557,23 +558,23 @@ void CMenu::_configMain(void) else m_cfg.setString("GENERAL", "language", m_curLanguage.c_str()); _updateText(); - _showConfigMain(2); + _showConfigMain(); } else if(m_btnMgr.selected(m_configBtn3)) { m_refreshGameList = true; _hideConfigMain(); _cfTheme(); - _showConfigMain(2); + _showConfigMain(); } else if(m_btnMgr.selected(m_configBtn4)) { _hideConfigMain(); _Boot(); - _showConfigMain(2); + _showConfigMain(); } } - if(curPage == 3) + if(mainCfg_curPage == 3) { if(m_btnMgr.selected(m_configBtn1P) || m_btnMgr.selected(m_configBtn1M)) { @@ -593,7 +594,7 @@ void CMenu::_configMain(void) { _hideConfigMain(); _configGC(); - _showConfigMain(3); + _showConfigMain(); } else if(m_btnMgr.selected(m_configBtn4P) || m_btnMgr.selected(m_configBtn4M)) { @@ -605,7 +606,7 @@ void CMenu::_configMain(void) m_refreshGameList = true; } } - if(curPage == 4) + if(mainCfg_curPage == 4) { if(m_btnMgr.selected(m_configBtn1)) { @@ -623,7 +624,7 @@ void CMenu::_configMain(void) { _hideConfigMain(); _Paths(); - _showConfigMain(curPage); + _showConfigMain(); } else if(m_btnMgr.selected(m_configBtn4P)) { @@ -659,7 +660,7 @@ void CMenu::_configMain(void) m_btnMgr.setText(m_configLbl4Val, channelName); } } - if(curPage == 5) + if(mainCfg_curPage == 5) { if(m_btnMgr.selected(m_configBtn1P) || m_btnMgr.selected(m_configBtn1M)) { @@ -697,7 +698,7 @@ void CMenu::_configMain(void) m_bnrSndVol = m_cfg.getInt("GENERAL", "sound_volume_bnr"); } } - if(curPage == 6) + if(mainCfg_curPage == 6) { if(m_btnMgr.selected(m_configBtn1P) || m_btnMgr.selected(m_configBtn1M)) { @@ -736,7 +737,7 @@ void CMenu::_configMain(void) m_vid.set2DViewport(m_cfg.getInt("GENERAL", "tv_width", 640), m_cfg.getInt("GENERAL", "tv_height", 480), m_cfg.getInt("GENERAL", "tv_x", 0), m_cfg.getInt("GENERAL", "tv_y", 0)); } } - if(curPage == 7) + if(mainCfg_curPage == 7) { if(m_btnMgr.selected(m_configBtn1)) { @@ -759,7 +760,7 @@ void CMenu::_configMain(void) m_btnMgr.setText(m_configBtn4, m_cfg.getBool(PLUGIN_DOMAIN, "disable") ? _t("yes", L"Yes") : _t("no", L"No")); } } - if(curPage == 8) + if(mainCfg_curPage == 8) { if(m_btnMgr.selected(m_configBtn1)) { @@ -786,7 +787,7 @@ void CMenu::_configMain(void) m_btnMgr.setText(m_configLbl4Val, wfmt(L"%i", m_cfg.getInt("FANART", "delay_after_animation"))); } } - if(curPage == 9) + if(mainCfg_curPage == 9) { if(m_btnMgr.selected(m_configBtn1)) { @@ -814,7 +815,7 @@ void CMenu::_configMain(void) m_btnMgr.setText(m_configLbl4Val, wfmt(L"%i", m_cfg.getInt("GENERAL", "screensaver_idle_seconds"))); } } - if(curPage == 10) + if(mainCfg_curPage == 10) { if(m_btnMgr.selected(m_configBtn1)) { @@ -845,7 +846,7 @@ void CMenu::_configMain(void) MusicPlayer.SetFadeRate(m_cfg.getInt("GENERAL", "music_fade_rate")); } } - if(curPage == 11) + if(mainCfg_curPage == 11) { if(m_btnMgr.selected(m_configBtn1)) { @@ -871,19 +872,19 @@ void CMenu::_configMain(void) m_gc_play_default_sound = m_cfg.getBool(GC_DOMAIN, "play_default_sound", true); } } - if(curPage == 12) + if(mainCfg_curPage == 12) { if(m_btnMgr.selected(m_configBtn1)) { _hideConfigMain(); _ConfigHB(); - _showConfigMain(12); + _showConfigMain(); } else if(m_btnMgr.selected(m_configBtn2)) { _hideConfigMain(); _ConfigSrc(); - _showConfigMain(12); + _showConfigMain(); } else if(m_btnMgr.selected(m_configBtn3)) { @@ -897,7 +898,7 @@ void CMenu::_configMain(void) m_btnMgr.setText(m_configBtn4, val ? _t("yes", L"Yes") : _t("no", L"No")); } } - if(curPage == 13) + if(mainCfg_curPage == 13) { if(m_btnMgr.selected(m_configBtn1)) { @@ -924,7 +925,7 @@ void CMenu::_configMain(void) CFLocked = val; } } - if(curPage == 14) + if(mainCfg_curPage == 14) { if(m_btnMgr.selected(m_configBtn1)) { @@ -950,7 +951,7 @@ void CMenu::_configMain(void) } } } - if(curPage == 2 && m_curLanguage != prevLanguage) + if(mainCfg_curPage == 2 && m_curLanguage != prevLanguage) { m_cacheList.Init(m_settingsDir.c_str(), m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str(), m_pluginDataDir.c_str(), m_cfg.getString(CONFIG_FILENAME_SKIP_DOMAIN,CONFIG_FILENAME_SKIP_KEY,CONFIG_FILENAME_SKIP_DEFAULT)); diff --git a/source/menu/menu_config_source.cpp b/source/menu/menu_config_source.cpp index 5f04a4fa..c4a90e30 100644 --- a/source/menu/menu_config_source.cpp +++ b/source/menu/menu_config_source.cpp @@ -68,7 +68,7 @@ void CMenu::_ConfigSrc(void) { if(!m_use_source) { - error(_t("cfgsmerr", L"No source menu found!")); + _error(_t("cfgsmerr", L"No source menu found!")); return; } SetupInput(); diff --git a/source/menu/menu_error.cpp b/source/menu/menu_error.cpp index a4c6ad5c..327d93b5 100644 --- a/source/menu/menu_error.cpp +++ b/source/menu/menu_error.cpp @@ -5,7 +5,7 @@ s16 m_errorLblMessage; s16 m_errorLblIcon; s16 m_errorLblUser[4]; -void CMenu::error(const wstringEx &msg) +void CMenu::_error(const wstringEx &msg) { SetupInput(); _hideAbout(); diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 884c96be..c0e57fe8 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -376,9 +376,9 @@ void CMenu::_game(bool launch) _hideGame(); m_banner.SetShowBanner(false); if(m_locked) - error(_t("errgame15", L"WiiFlow locked! Unlock WiiFlow to use this feature.")); + _error(_t("errgame15", L"WiiFlow locked! Unlock WiiFlow to use this feature.")); else if(hdr->type == TYPE_CHANNEL) - error(_t("errgame17", L"Can not delete real NAND Channels!")); + _error(_t("errgame17", L"Can not delete real NAND Channels!")); else if(hdr->type == TYPE_HOMEBREW) { bool smallBox = m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox", false); @@ -414,7 +414,7 @@ void CMenu::_game(bool launch) if(m_locked) { m_banner.SetShowBanner(false); - error(_t("errgame15", L"WiiFlow locked! Unlock WiiFlow to use this feature.")); + _error(_t("errgame15", L"WiiFlow locked! Unlock WiiFlow to use this feature.")); m_banner.SetShowBanner(true); } else @@ -442,7 +442,7 @@ void CMenu::_game(bool launch) if(m_locked) { m_banner.SetShowBanner(false); - error(_t("errgame15", L"WiiFlow locked! Unlock WiiFlow to use this feature.")); + _error(_t("errgame15", L"WiiFlow locked! Unlock WiiFlow to use this feature.")); m_banner.SetShowBanner(true); } else @@ -479,7 +479,7 @@ void CMenu::_game(bool launch) _hideGame(); if(isWiiVC && (hdr->type == TYPE_WII_GAME || hdr->type == TYPE_EMUCHANNEL)) { - error(_t("errgame19", L"Can't launch in Wii virtual console mode!")); + _error(_t("errgame19", L"Can't launch in Wii virtual console mode!")); launch = false; _showGame(); } diff --git a/source/menu/menu_game_boot.cpp b/source/menu/menu_game_boot.cpp index d6d9d7c4..a43dce9c 100644 --- a/source/menu/menu_game_boot.cpp +++ b/source/menu/menu_game_boot.cpp @@ -92,7 +92,7 @@ void CMenu::directlaunch(const char *GameID)// from boot arg for wii game only } } } - error(wfmt(_fmt("errgame1", L"Cannot find the game with ID: %s"), GameID)); + _error(wfmt(_fmt("errgame1", L"Cannot find the game with ID: %s"), GameID)); } void CMenu::_launchShutdown() @@ -279,7 +279,7 @@ void CMenu::_launchHomebrew(const char *filepath, vector arguments) bool ret = (LoadHomebrew(filepath) && LoadAppBooter(fmt("%s/app_booter.bin", m_binsDir.c_str()))); if(ret == false) { - error(_t("errgame14", L"app_booter.bin not found!")); + _error(_t("errgame14", L"app_booter.bin not found!")); return; } /* no more error msgs - remove btns and sounds */ @@ -399,7 +399,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) /* Check if loader installed */ if((loader == NINTENDONT && !m_nintendont_installed) || (loader == DEVOLUTION && !m_devo_installed)) { - error(_t("errgame11", L"GameCube Loader not found! Can't launch game.")); + _error(_t("errgame11", L"GameCube Loader not found! Can't launch game.")); return; } @@ -524,7 +524,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) bool ret = (Nintendont_GetLoader(use_slippi) && LoadAppBooter(fmt("%s/app_booter.bin", m_binsDir.c_str()))); if(ret == false) { - error(_t("errgame14", L"app_booter.bin not found!")); + _error(_t("errgame14", L"app_booter.bin not found!")); return; } @@ -701,6 +701,21 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) Sys_Exit(); } +/* used to load gameconfig.txt and cheats .gct */ +bool CMenu::_loadFile(u8 * &buffer, u32 &size, const char *path, const char *file) +{ + u32 fileSize = 0; + u8 *fileBuf = fsop_ReadFile(file == NULL ? path : fmt("%s/%s", path, file), &fileSize); + if(fileBuf == NULL) + return false; + + if(buffer != NULL) + MEM2_free(buffer); + buffer = fileBuf; + size = fileSize; + return true; +} + /* used by wii and channel games to load the cIOS to use for the game */ /* plugins, apps, and gamecube games don't use cIOS */ int CMenu::_loadGameIOS(u8 gameIOS, int userIOS, string id, bool RealNAND_Channels) @@ -717,7 +732,7 @@ int CMenu::_loadGameIOS(u8 gameIOS, int userIOS, string id, bool RealNAND_Channe _initAsyncNetwork();// needed after IOS change if(ret == false) { - error(wfmt(_fmt("errgame4", L"Couldn't load IOS %i"), gameIOS)); + _error(wfmt(_fmt("errgame4", L"Couldn't load IOS %i"), gameIOS)); return LOAD_IOS_FAILED; } return LOAD_IOS_SUCCEEDED; @@ -752,7 +767,7 @@ int CMenu::_loadGameIOS(u8 gameIOS, int userIOS, string id, bool RealNAND_Channe _initAsyncNetwork();// always seem to do netinit after changing IOS if(ret == false) { - error(wfmt(_fmt("errgame4", L"Couldn't load IOS %i"), gameIOS)); + _error(wfmt(_fmt("errgame4", L"Couldn't load IOS %i"), gameIOS)); return LOAD_IOS_FAILED; } return LOAD_IOS_SUCCEEDED; @@ -882,7 +897,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr) { if(!Load_Neek2o_Kernel()) { - error(_t("errneek1", L"Cannot launch neek2o. Verify your neek2o setup"));//kernal.bin not found + _error(_t("errneek1", L"Cannot launch neek2o. Verify your neek2o setup"));//kernal.bin not found return; } else @@ -907,7 +922,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr) /* load external booter bins */ if(ExternalBooter_LoadBins(m_binsDir.c_str()) == false) { - error(_t("errgame16", L"Missing ext_loader.bin or ext_booter.bin!")); + _error(_t("errgame16", L"Missing ext_loader.bin or ext_booter.bin!")); return; } @@ -941,7 +956,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr) if(NandHandle.Enable_Emu() < 0) { NandHandle.Disable_Emu(); - error(_t("errgame5", L"Enabling emu failed!")); + _error(_t("errgame5", L"Enabling emu failed!")); return; } DeviceHandle.MountAll(); @@ -978,7 +993,7 @@ void CMenu::_launchWii(dir_discHdr *hdr, bool dvd, bool disc_cfg) /* Open Disc */ if(Disc_Open(true) < 0) { - error(_t("wbfsoperr2", L"Disc_Open failed")); + _error(_t("wbfsoperr2", L"Disc_Open failed")); Sys_Exit(); } /* Check disc */ @@ -986,14 +1001,14 @@ void CMenu::_launchWii(dir_discHdr *hdr, bool dvd, bool disc_cfg) { if(Disc_IsGC() < 0) { - error(_t("errgame9", L"This is not a Wii or GC disc")); + _error(_t("errgame9", L"This is not a Wii or GC disc")); Sys_Exit(); } else // GC disc { if(!m_nintendont_installed) { - error(_t("errgame12", L"Nintendont not found! Can't launch GC Disc.")); + _error(_t("errgame12", L"Nintendont not found! Can't launch GC Disc.")); return; } /* Read GC disc header to get id*/ @@ -1132,7 +1147,7 @@ void CMenu::_launchWii(dir_discHdr *hdr, bool dvd, bool disc_cfg) if(emuPart < 0)//if savepartition is unusable { _hideWaitMessage(); - error(_t("errgame13", L"EmuNAND for gamesave not found! Using real NAND.")); + _error(_t("errgame13", L"EmuNAND for gamesave not found! Using real NAND.")); emulate_mode = 0; _showWaitMessage(); } @@ -1207,7 +1222,7 @@ void CMenu::_launchWii(dir_discHdr *hdr, bool dvd, bool disc_cfg) /* load external booter bin files */ if(ExternalBooter_LoadBins(m_binsDir.c_str()) == false) { - error(_t("errgame16", L"Missing ext_loader.bin or ext_booter.bin!")); + _error(_t("errgame16", L"Missing ext_loader.bin or ext_booter.bin!")); return; } @@ -1240,7 +1255,7 @@ void CMenu::_launchWii(dir_discHdr *hdr, bool dvd, bool disc_cfg) if(NandHandle.Enable_Emu() < 0) { NandHandle.Disable_Emu(); - error(_t("errgame6", L"Enabling emu after reload failed!")); + _error(_t("errgame6", L"Enabling emu after reload failed!")); Sys_Exit(); } DeviceHandle.MountAll(); diff --git a/source/menu/menu_home.cpp b/source/menu/menu_home.cpp index 21d16c09..5b5369c3 100644 --- a/source/menu/menu_home.cpp +++ b/source/menu/menu_home.cpp @@ -79,7 +79,7 @@ bool CMenu::_Home(void) //m_theme.load(fmt("%s.ini", m_themeDataDir.c_str())); m_theme.save(); _hideHome(); - error(_t("savedtheme", L"Theme config saved!")); + _error(_t("savedtheme", L"Theme config saved!")); _showHome(); } else if(BTN_A_PRESSED) @@ -221,7 +221,7 @@ bool CMenu::_ExitTo(void) } else { - error(_fmt("errneek1", L"Cannot launch neek2o. Verify your neek2o setup")); + _error(_fmt("errneek1", L"Cannot launch neek2o. Verify your neek2o setup")); _showExitTo(); } } diff --git a/source/menu/menu_main.cpp b/source/menu/menu_main.cpp index 7fa00b92..7f4c48f2 100644 --- a/source/menu/menu_main.cpp +++ b/source/menu/menu_main.cpp @@ -600,7 +600,7 @@ int CMenu::main(void) } else { - error(_t("main8", L"No disc in drive!")); + _error(_t("main8", L"No disc in drive!")); if(BTN_B_HELD) { bheld = true; diff --git a/source/menu/menu_nandemu.cpp b/source/menu/menu_nandemu.cpp index 8c9f9bbf..584c9b64 100644 --- a/source/menu/menu_nandemu.cpp +++ b/source/menu/menu_nandemu.cpp @@ -159,7 +159,7 @@ int CMenu::_NandEmuCfg(void) { if(isWiiVC) { - error(_t("errboot7", L"Access denied in Wii VC mode.")); + _error(_t("errboot7", L"Access denied in Wii VC mode.")); return 0; } s8 direction; @@ -251,7 +251,7 @@ int CMenu::_NandEmuCfg(void) int emuPart = _FindEmuPart(!m_nanddump, true); if(emuPart < 0) { - error(_t("cfgne8", L"No valid FAT partition found for NAND Emulation!")); + _error(_t("cfgne8", L"No valid FAT partition found for NAND Emulation!")); _showNandEmu(); } else diff --git a/source/menu/menu_sm_editor.cpp b/source/menu/menu_sm_editor.cpp index f3d9a038..ced6641d 100644 --- a/source/menu/menu_sm_editor.cpp +++ b/source/menu/menu_sm_editor.cpp @@ -234,7 +234,7 @@ void CMenu::_checkboxesMenu(u8 md) if(source != "plugin") { _hideCheckboxesMenu(); - error(_t("smediterr", L"Not allowed!")); + _error(_t("smediterr", L"Not allowed!")); _showCheckboxesMenu(); } else @@ -316,7 +316,7 @@ void CMenu::_checkboxesMenu(u8 md) if(!plugin_ok) { - error(_t("smediterr", L"Not allowed!")); + _error(_t("smediterr", L"Not allowed!")); } else { diff --git a/source/menu/menu_wbfs.cpp b/source/menu/menu_wbfs.cpp index 492c5ac7..1c78741e 100644 --- a/source/menu/menu_wbfs.cpp +++ b/source/menu/menu_wbfs.cpp @@ -263,7 +263,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op) { if(op == WO_ADD_GAME) { - error(_t("wbfsoperr6", L"Install game is broken,\nplease use cleanrip.")); + _error(_t("wbfsoperr6", L"Install game is broken,\nplease use cleanrip.")); return false; } lwp_t thread = 0; @@ -326,19 +326,19 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op) m_btnMgr.setText(m_wbfsLblMessage, L""); if (Disc_Wait() < 0) { - error(_t("wbfsoperr1", L"Disc_Wait failed")); + _error(_t("wbfsoperr1", L"Disc_Wait failed")); out = true; break; } if (Disc_Open(false) < 0) { - error(_t("wbfsoperr2", L"Disc_Open failed")); + _error(_t("wbfsoperr2", L"Disc_Open failed")); out = true; break; } if (Disc_IsWii() == 0) { - //error(_t("wbfsoperr6", L"Install game is broken, please use cleanrip.")); + //_error(_t("wbfsoperr6", L"Install game is broken, please use cleanrip.")); //out = true; //break; @@ -346,7 +346,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op) memcpy(GameID, wii_hdr.id, 6); if(_searchGamesByID(GameID)) { - error(_t("wbfsoperr4", L"Game already installed")); + _error(_t("wbfsoperr4", L"Game already installed")); out = true; break; } @@ -364,7 +364,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op) } else if(Disc_IsGC() == 0) { - //error(_t("wbfsoperr6", L"Install game is broken, please use cleanrip.")); + //_error(_t("wbfsoperr6", L"Install game is broken, please use cleanrip.")); //out = true; //break; @@ -372,7 +372,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op) memcpy(GameID, gc_hdr.id, 6); if(_searchGamesByID(GameID)) { - error(_t("wbfsoperr4", L"Game already installed")); + _error(_t("wbfsoperr4", L"Game already installed")); out = true; break; } @@ -398,7 +398,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op) } else { - error(_t("wbfsoperr3", L"This is not a Wii or GC disc!")); + _error(_t("wbfsoperr3", L"This is not a Wii or GC disc!")); out = true; } break; @@ -447,7 +447,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op) { if(CF_Hdr->settings[0] != 0x00010001) { - error(_t("wbfsoperr5", L"Deleting this Channel is not allowed!")); + _error(_t("wbfsoperr5", L"Deleting this Channel is not allowed!")); done = true; out = true; break;