mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2025-02-02 22:02:34 +01:00
-added beta custom banner download, you need to set "custom_banner_url"
in the GENERAL section in your wiiflow.ini, do it like custom_banner_url=http://www.example.com/{gameid}.bnr {gameid} gets replaced automatically by the game id6/id3
This commit is contained in:
parent
f17962e609
commit
e066537d9b
@ -2700,7 +2700,7 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
|
||||
fwrite(zBuffer, 1, zBufferSize, file);
|
||||
fclose(file);
|
||||
if (m_deletePicsAfterCaching)
|
||||
remove(path);
|
||||
fsop_deleteFile(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1167,6 +1167,7 @@ void CMenu::_buildMenus(void)
|
||||
_initGameInfoMenu();
|
||||
_initNandEmuMenu();
|
||||
_initHomeAndExitToMenu();
|
||||
_initCoverBanner();
|
||||
_initBoot();
|
||||
|
||||
_loadCFCfg();
|
||||
|
@ -488,8 +488,8 @@ private:
|
||||
s16 m_gameSettingsBtnVipatch;
|
||||
s16 m_gameSettingsLblCountryPatch;
|
||||
s16 m_gameSettingsBtnCountryPatch;
|
||||
s16 m_gameSettingsLblCover;
|
||||
s16 m_gameSettingsBtnCover;
|
||||
s16 m_gameSettingsLblManage;
|
||||
s16 m_gameSettingsBtnManage;
|
||||
s16 m_gameSettingsLblPatchVidModes;
|
||||
s16 m_gameSettingsLblPatchVidModesVal;
|
||||
s16 m_gameSettingsBtnPatchVidModesM;
|
||||
@ -850,6 +850,7 @@ private:
|
||||
void _initGameInfoMenu();
|
||||
void _initNandEmuMenu();
|
||||
void _initHomeAndExitToMenu();
|
||||
void _initCoverBanner();
|
||||
//
|
||||
void _textSource(void);
|
||||
void _textPluginSettings(void);
|
||||
@ -876,6 +877,7 @@ private:
|
||||
void _textHome(void);
|
||||
void _textExitTo(void);
|
||||
void _textBoot(void);
|
||||
void _textCoverBanner(void);
|
||||
//
|
||||
void _refreshBoot();
|
||||
//
|
||||
@ -906,6 +908,7 @@ private:
|
||||
void _hideNandEmu(bool instant = false);
|
||||
void _hideHome(bool instant = false);
|
||||
void _hideExitTo(bool instant = false);
|
||||
void _hideCoverBanner(bool instant = false);
|
||||
//
|
||||
void _showError(void);
|
||||
void _showMain(void);
|
||||
@ -935,6 +938,7 @@ private:
|
||||
void _showCheatDownload(void);
|
||||
void _showHome(void);
|
||||
void _showExitTo(void);
|
||||
void _showCoverBanner(void);
|
||||
void _updateSourceBtns(void);
|
||||
void _updatePluginText(void);
|
||||
void _updatePluginCheckboxes(void);
|
||||
@ -970,6 +974,7 @@ private:
|
||||
void _cfNeedsUpdate(void);
|
||||
void _game(bool launch = false);
|
||||
void _download(string gameId = string());
|
||||
void _downloadBnr(const char *gameID);
|
||||
void _code(void);
|
||||
void _about(bool help = false);
|
||||
bool _wbfsOp(WBFS_OP op);
|
||||
@ -977,6 +982,7 @@ private:
|
||||
void _system(void);
|
||||
void _gameinfo(void);
|
||||
void _gameSettings(void);
|
||||
void _CoverBanner(void);
|
||||
void _CheatSettings();
|
||||
bool _Source();
|
||||
void _PluginSettings();
|
||||
@ -1082,6 +1088,7 @@ private:
|
||||
bool _TestEmuNand(int epart, const char *path, bool indept);
|
||||
|
||||
static u32 _downloadCheatFileAsync(void *obj);
|
||||
static u32 _downloadBannerAsync(void *obj);
|
||||
|
||||
void _playGameSound(void);
|
||||
void CheckGameSoundThread(void);
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "lockMutex.hpp"
|
||||
#include "gui/text.hpp"
|
||||
#include "network/http.h"
|
||||
#include "fileOps/fileOps.h"
|
||||
|
||||
#define GECKOURL "http://geckocodes.org/codes/%c/%s.txt"
|
||||
#define CHEATSPERPAGE 4
|
||||
@ -124,8 +125,8 @@ void CMenu::_CheatSettings()
|
||||
}
|
||||
else if ((WBTN_2_HELD && WBTN_1_PRESSED) || (WBTN_1_HELD && WBTN_2_PRESSED))
|
||||
{
|
||||
remove(fmt("%s/%s.gct", m_cheatDir.c_str(), id));
|
||||
remove(fmt("%s/%s.txt", m_txtCheatDir.c_str(), id));
|
||||
fsop_deleteFile(fmt("%s/%s.gct", m_cheatDir.c_str(), id));
|
||||
fsop_deleteFile(fmt("%s/%s.txt", m_txtCheatDir.c_str(), id));
|
||||
m_gcfg2.remove(id, "cheat");
|
||||
m_gcfg2.remove(id, "hooktype");
|
||||
break;
|
||||
@ -163,7 +164,7 @@ void CMenu::_CheatSettings()
|
||||
}
|
||||
else
|
||||
{
|
||||
remove(fmt("%s/%s.gct", m_cheatDir.c_str(), id));
|
||||
fsop_deleteFile(fmt("%s/%s.gct", m_cheatDir.c_str(), id));
|
||||
m_gcfg2.remove(id, "cheat");
|
||||
m_gcfg2.remove(id, "hooktype");
|
||||
}
|
||||
|
123
source/menu/menu_config_coverbnr.cpp
Normal file
123
source/menu/menu_config_coverbnr.cpp
Normal file
@ -0,0 +1,123 @@
|
||||
|
||||
#include "menu.hpp"
|
||||
#include "defines.h"
|
||||
#include "fileOps/fileOps.h"
|
||||
|
||||
s16 m_coverbnrLblDlCover;
|
||||
s16 m_coverbnrLblDeleteCover;
|
||||
s16 m_coverbnrLblDlBanner;
|
||||
s16 m_coverbnrLblDeleteBanner;
|
||||
|
||||
s16 m_coverbnrBtnDlCover;
|
||||
s16 m_coverbnrBtnDeleteCover;
|
||||
s16 m_coverbnrBtnDlBanner;
|
||||
s16 m_coverbnrBtnDeleteBanner;
|
||||
TexData m_coverbnrBg;
|
||||
|
||||
void CMenu::_hideCoverBanner(bool instant)
|
||||
{
|
||||
m_btnMgr.hide(m_coverbnrLblDlCover, instant);
|
||||
m_btnMgr.hide(m_coverbnrLblDeleteCover, instant);
|
||||
m_btnMgr.hide(m_coverbnrLblDlBanner, instant);
|
||||
m_btnMgr.hide(m_coverbnrLblDeleteBanner, instant);
|
||||
|
||||
m_btnMgr.hide(m_coverbnrBtnDlCover, instant);
|
||||
m_btnMgr.hide(m_coverbnrBtnDeleteCover, instant);
|
||||
m_btnMgr.hide(m_coverbnrBtnDlBanner, instant);
|
||||
m_btnMgr.hide(m_coverbnrBtnDeleteBanner, instant);
|
||||
}
|
||||
|
||||
void CMenu::_showCoverBanner(void)
|
||||
{
|
||||
_setBg(m_coverbnrBg, m_coverbnrBg);
|
||||
|
||||
m_btnMgr.show(m_coverbnrLblDlCover);
|
||||
m_btnMgr.show(m_coverbnrLblDeleteCover);
|
||||
m_btnMgr.show(m_coverbnrLblDlBanner);
|
||||
m_btnMgr.show(m_coverbnrLblDeleteBanner);
|
||||
|
||||
m_btnMgr.show(m_coverbnrBtnDlCover);
|
||||
m_btnMgr.show(m_coverbnrBtnDeleteCover);
|
||||
m_btnMgr.show(m_coverbnrBtnDlBanner);
|
||||
m_btnMgr.show(m_coverbnrBtnDeleteBanner);
|
||||
}
|
||||
|
||||
void CMenu::_CoverBanner(void)
|
||||
{
|
||||
const char *id = CoverFlow.getId();
|
||||
_showCoverBanner();
|
||||
while(!m_exit)
|
||||
{
|
||||
_mainLoopCommon();
|
||||
if(BTN_HOME_PRESSED || BTN_B_PRESSED)
|
||||
break;
|
||||
else if(BTN_A_PRESSED)
|
||||
{
|
||||
if(m_btnMgr.selected(m_coverbnrBtnDlCover))
|
||||
{
|
||||
_hideCoverBanner();
|
||||
_download(id);
|
||||
_showCoverBanner();
|
||||
}
|
||||
else if(m_btnMgr.selected(m_coverbnrBtnDeleteCover))
|
||||
{
|
||||
_hideCoverBanner();
|
||||
RemoveCover(id);
|
||||
_showCoverBanner();
|
||||
}
|
||||
else if(m_btnMgr.selected(m_coverbnrBtnDlBanner))
|
||||
{
|
||||
_hideCoverBanner();
|
||||
fsop_deleteFile(fmt("%s/%s.bnr", m_bnrCacheDir.c_str(), id));
|
||||
fsop_deleteFile(fmt("%s/%s.bnr", m_customBnrDir.c_str(), id));
|
||||
_downloadBnr(id);
|
||||
_showCoverBanner();
|
||||
}
|
||||
else if(m_btnMgr.selected(m_coverbnrBtnDeleteBanner))
|
||||
{
|
||||
_hideCoverBanner();
|
||||
fsop_deleteFile(fmt("%s/%s.bnr", m_bnrCacheDir.c_str(), id));
|
||||
fsop_deleteFile(fmt("%s/%s.bnr", m_customBnrDir.c_str(), id));
|
||||
_showCoverBanner();
|
||||
}
|
||||
}
|
||||
}
|
||||
_hideCoverBanner();
|
||||
}
|
||||
|
||||
void CMenu::_initCoverBanner()
|
||||
{
|
||||
m_coverbnrBg = _texture("COVERBNR/BG", "texture", theme.bg, false);
|
||||
m_coverbnrLblDlCover = _addLabel("COVERBNR/DLCOVER", theme.lblFont, L"", 40, 130, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_coverbnrBtnDlCover = _addButton("COVERBNR/DLCOVER_BTN", theme.btnFont, L"", 370, 130, 230, 56, theme.btnFontColor);
|
||||
m_coverbnrLblDeleteCover = _addLabel("COVERBNR/DELCOVER", theme.lblFont, L"", 40, 190, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_coverbnrBtnDeleteCover = _addButton("COVERBNR/DELCOVER_BTN", theme.btnFont, L"", 370, 190, 230, 56, theme.btnFontColor);
|
||||
m_coverbnrLblDlBanner = _addLabel("COVERBNR/DLBNR", theme.lblFont, L"", 40, 250, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_coverbnrBtnDlBanner = _addButton("COVERBNR/DLBNR_BTN", theme.btnFont, L"", 370, 250, 230, 56, theme.btnFontColor);
|
||||
m_coverbnrLblDeleteBanner = _addLabel("COVERBNR/DELBNR", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_coverbnrBtnDeleteBanner = _addButton("COVERBNR/DELBNR_BTN", theme.btnFont, L"", 370, 310, 230, 56, theme.btnFontColor);
|
||||
|
||||
_setHideAnim(m_coverbnrLblDlCover, "COVERBNR/DLCOVER", 100, 0, -2.f, 0.f);
|
||||
_setHideAnim(m_coverbnrBtnDlCover, "COVERBNR/DLCOVER_BTN", 0, 0, 1.f, -1.f);
|
||||
_setHideAnim(m_coverbnrLblDeleteCover, "COVERBNR/DELCOVER", 100, 0, -2.f, 0.f);
|
||||
_setHideAnim(m_coverbnrBtnDeleteCover, "COVERBNR/DELCOVER_BTN", 0, 0, 1.f, -1.f);
|
||||
_setHideAnim(m_coverbnrLblDlBanner, "COVERBNR/DLBNR", 100, 0, -2.f, 0.f);
|
||||
_setHideAnim(m_coverbnrBtnDlBanner, "COVERBNR/DLBNR_BTN", 0, 0, 1.f, -1.f);
|
||||
_setHideAnim(m_coverbnrLblDeleteBanner, "COVERBNR/DELBNR", 100, 0, -2.f, 0.f);
|
||||
_setHideAnim(m_coverbnrBtnDeleteBanner, "COVERBNR/DELBNR_BTN", 0, 0, 1.f, -1.f);
|
||||
_hideCoverBanner(true);
|
||||
_textCoverBanner();
|
||||
}
|
||||
|
||||
void CMenu::_textCoverBanner(void)
|
||||
{
|
||||
m_btnMgr.setText(m_coverbnrLblDlCover, _t("cfgbnr1", L"Download Cover"));
|
||||
m_btnMgr.setText(m_coverbnrLblDeleteCover, _t("cfgbnr2", L"Delete Cover"));
|
||||
m_btnMgr.setText(m_coverbnrLblDlBanner, _t("cfgbnr3", L"Download Custom Banner"));
|
||||
m_btnMgr.setText(m_coverbnrLblDeleteBanner, _t("cfgbnr4", L"Delete Banner"));
|
||||
|
||||
m_btnMgr.setText(m_coverbnrBtnDlCover, _t("cfgbnr5", L"Download"));
|
||||
m_btnMgr.setText(m_coverbnrBtnDeleteCover, _t("cfgbnr6", L"Delete"));
|
||||
m_btnMgr.setText(m_coverbnrBtnDlBanner, _t("cfgbnr5", L"Download"));
|
||||
m_btnMgr.setText(m_coverbnrBtnDeleteBanner, _t("cfgbnr6", L"Delete"));
|
||||
}
|
@ -78,8 +78,8 @@ void CMenu::_hideGameSettings(bool instant)
|
||||
m_btnMgr.hide(m_gameSettingsBtnVipatch, instant);
|
||||
m_btnMgr.hide(m_gameSettingsLblCountryPatch, instant);
|
||||
m_btnMgr.hide(m_gameSettingsBtnCountryPatch, instant);
|
||||
m_btnMgr.hide(m_gameSettingsLblCover, instant);
|
||||
m_btnMgr.hide(m_gameSettingsBtnCover, instant);
|
||||
m_btnMgr.hide(m_gameSettingsLblManage, instant);
|
||||
m_btnMgr.hide(m_gameSettingsBtnManage, instant);
|
||||
m_btnMgr.hide(m_gameSettingsLblPatchVidModes, instant);
|
||||
m_btnMgr.hide(m_gameSettingsLblPatchVidModesVal, instant);
|
||||
m_btnMgr.hide(m_gameSettingsBtnPatchVidModesM, instant);
|
||||
@ -150,8 +150,8 @@ void CMenu::_showGameSettings(void)
|
||||
|
||||
if (m_gameSettingsPage == 1)
|
||||
{
|
||||
m_btnMgr.show(m_gameSettingsLblCover);
|
||||
m_btnMgr.show(m_gameSettingsBtnCover);
|
||||
m_btnMgr.show(m_gameSettingsLblManage);
|
||||
m_btnMgr.show(m_gameSettingsBtnManage);
|
||||
if(CoverFlow.getHdr()->type == TYPE_GC_GAME)
|
||||
{
|
||||
m_btnMgr.show(m_gameSettingsLblDMLGameVideo);
|
||||
@ -187,8 +187,8 @@ void CMenu::_showGameSettings(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_btnMgr.hide(m_gameSettingsLblCover);
|
||||
m_btnMgr.hide(m_gameSettingsBtnCover);
|
||||
m_btnMgr.hide(m_gameSettingsLblManage);
|
||||
m_btnMgr.hide(m_gameSettingsBtnManage);
|
||||
if(CoverFlow.getHdr()->type == TYPE_GC_GAME)
|
||||
{
|
||||
m_btnMgr.hide(m_gameSettingsLblGClanguage);
|
||||
@ -668,11 +668,11 @@ void CMenu::_gameSettings(void)
|
||||
m_gcfg2.setInt(id, "patch_video_modes", (int)loopNum((u32)m_gcfg2.getInt(id, "patch_video_modes", 0) + direction, ARRAY_SIZE(CMenu::_vidModePatch)));
|
||||
_showGameSettings();
|
||||
}
|
||||
else if(m_btnMgr.selected(m_gameSettingsBtnCover))
|
||||
else if(m_btnMgr.selected(m_gameSettingsBtnManage))
|
||||
{
|
||||
CoverFlow.stopCoverLoader(true);
|
||||
_hideGameSettings();
|
||||
_download(id);
|
||||
_CoverBanner();
|
||||
_showGameSettings();
|
||||
CoverFlow.startCoverLoader();
|
||||
}
|
||||
@ -736,17 +736,6 @@ void CMenu::_gameSettings(void)
|
||||
_showGameSettings();
|
||||
}
|
||||
}
|
||||
else if((WBTN_2_HELD && WBTN_1_PRESSED) || (WBTN_1_HELD && WBTN_2_PRESSED))
|
||||
{
|
||||
if(m_btnMgr.selected(m_gameSettingsBtnCover))
|
||||
{
|
||||
CoverFlow.stopCoverLoader(true); // Empty cover cache
|
||||
remove(fmt("%s/%s.png", m_picDir.c_str(), id));
|
||||
remove(fmt("%s/%s.png", m_boxPicDir.c_str(), id));
|
||||
remove(fmt("%s/%s.wfc", m_cacheDir.c_str(), id));
|
||||
CoverFlow.startCoverLoader();
|
||||
}
|
||||
}
|
||||
}
|
||||
m_gcfg2.save(true);
|
||||
_hideGameSettings();
|
||||
@ -759,8 +748,8 @@ void CMenu::_initGameSettingsMenu()
|
||||
m_gameSettingsLblTitle = _addTitle("GAME_SETTINGS/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
|
||||
|
||||
// Page 1
|
||||
m_gameSettingsLblCover = _addLabel("GAME_SETTINGS/COVER", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_gameSettingsBtnCover = _addButton("GAME_SETTINGS/COVER_BTN", theme.btnFont, L"", 330, 130, 270, 56, theme.btnFontColor);
|
||||
m_gameSettingsLblManage = _addLabel("GAME_SETTINGS/MANAGE", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_gameSettingsBtnManage = _addButton("GAME_SETTINGS/MANAGE_BTN", theme.btnFont, L"", 330, 130, 270, 56, theme.btnFontColor);
|
||||
|
||||
m_gameSettingsLblCategoryMain = _addLabel("GAME_SETTINGS/CAT_MAIN", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_gameSettingsBtnCategoryMain = _addButton("GAME_SETTINGS/CAT_MAIN_BTN", theme.btnFont, L"", 330, 190, 270, 56, theme.btnFontColor);
|
||||
@ -927,8 +916,8 @@ void CMenu::_initGameSettingsMenu()
|
||||
_setHideAnim(m_gameSettingsBtnIOSM, "GAME_SETTINGS/IOS_MINUS", 200, 0, 1.f, 0.f);
|
||||
_setHideAnim(m_gameSettingsBtnIOSP, "GAME_SETTINGS/IOS_PLUS", 200, 0, 1.f, 0.f);
|
||||
|
||||
_setHideAnim(m_gameSettingsLblCover, "GAME_SETTINGS/COVER", -200, 0, 1.f, 0.f);
|
||||
_setHideAnim(m_gameSettingsBtnCover, "GAME_SETTINGS/COVER_BTN", 200, 0, 1.f, 0.f);
|
||||
_setHideAnim(m_gameSettingsLblManage, "GAME_SETTINGS/MANAGE", -200, 0, 1.f, 0.f);
|
||||
_setHideAnim(m_gameSettingsBtnManage, "GAME_SETTINGS/MANAGE_BTN", 200, 0, 1.f, 0.f);
|
||||
|
||||
_setHideAnim(m_gameSettingsLblPatchVidModes, "GAME_SETTINGS/PATCH_VIDEO_MODE", -200, 0, 1.f, 0.f);
|
||||
_setHideAnim(m_gameSettingsLblPatchVidModesVal, "GAME_SETTINGS/PATCH_VIDEO_MODE_BTN", 200, 0, 1.f, 0.f);
|
||||
@ -1016,8 +1005,6 @@ void CMenu::_textGameSettings(void)
|
||||
m_btnMgr.setText(m_gameSettingsLblVipatch, _t("cfgg7", L"Vipatch"));
|
||||
m_btnMgr.setText(m_gameSettingsBtnBack, _t("cfgg8", L"Back"));
|
||||
m_btnMgr.setText(m_gameSettingsLblGameIOS, _t("cfgg10", L"IOS"));
|
||||
m_btnMgr.setText(m_gameSettingsLblCover, _t("cfgg12", L"Download cover"));
|
||||
m_btnMgr.setText(m_gameSettingsBtnCover, _t("cfgg13", L"Download"));
|
||||
m_btnMgr.setText(m_gameSettingsLblPatchVidModes, _t("cfgg14", L"Patch video modes"));
|
||||
m_btnMgr.setText(m_gameSettingsLblCheat, _t("cfgg15", L"Cheat Codes"));
|
||||
m_btnMgr.setText(m_gameSettingsBtnCheat, _t("cfgg16", L"Select"));
|
||||
@ -1041,4 +1028,6 @@ void CMenu::_textGameSettings(void)
|
||||
m_btnMgr.setText(m_gameSettingsLblApploader, _t("cfgg37", L"Boot Apploader"));
|
||||
m_btnMgr.setText(m_gameSettingsLblLED, _t("cfgg38", L"Activity LED"));
|
||||
m_btnMgr.setText(m_gameSettingsLblScreenshot, _t("cfgg39", L"DM Screenshot Feature"));
|
||||
m_btnMgr.setText(m_gameSettingsLblManage, _t("cfgg40", L"Manage covers and banners"));
|
||||
m_btnMgr.setText(m_gameSettingsBtnManage, _t("cfgg41", L"Manage"));
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "lockMutex.hpp"
|
||||
#include "channel/nand.hpp"
|
||||
#include "devicemounter/usbstorage.h"
|
||||
#include "fileOps/fileOps.h"
|
||||
#include "gui/GameTDB.hpp"
|
||||
#include "gui/pngu.h"
|
||||
#include "loader/fs.h"
|
||||
@ -1857,10 +1858,10 @@ s8 CMenu::_versionDownloader() // code to download new version
|
||||
_setThrdMsg(_t("dlmsg13", L"Saving..."), 0.8f);
|
||||
LWP_MutexUnlock(m_mutex);
|
||||
|
||||
remove(dol_backup);
|
||||
fsop_deleteFile(dol_backup);
|
||||
rename(m_dol.c_str(), dol_backup);
|
||||
|
||||
remove(m_app_update_zip.c_str());
|
||||
fsop_deleteFile(m_app_update_zip.c_str());
|
||||
|
||||
FILE *file = fopen(m_app_update_zip.c_str(), "wb");
|
||||
if (file != NULL)
|
||||
@ -1874,7 +1875,7 @@ s8 CMenu::_versionDownloader() // code to download new version
|
||||
|
||||
ZipFile zFile(m_app_update_zip.c_str());
|
||||
bool result = zFile.ExtractAll(m_app_update_drive);
|
||||
remove(m_app_update_zip.c_str());
|
||||
fsop_deleteFile(m_app_update_zip.c_str());
|
||||
|
||||
if (!result)
|
||||
goto fail;
|
||||
@ -1903,7 +1904,7 @@ s8 CMenu::_versionDownloader() // code to download new version
|
||||
_setThrdMsg(_t("dlmsg13", L"Saving..."), 0.9f);
|
||||
LWP_MutexUnlock(m_mutex);
|
||||
|
||||
remove(m_data_update_zip.c_str());
|
||||
fsop_deleteFile(m_data_update_zip.c_str());
|
||||
|
||||
file = fopen(m_data_update_zip.c_str(), "wb");
|
||||
if (file != NULL)
|
||||
@ -1917,7 +1918,7 @@ s8 CMenu::_versionDownloader() // code to download new version
|
||||
|
||||
ZipFile zDataFile(m_data_update_zip.c_str());
|
||||
result = zDataFile.ExtractAll(m_dataDir.c_str());
|
||||
remove(m_data_update_zip.c_str());
|
||||
fsop_deleteFile(m_data_update_zip.c_str());
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@ -1944,7 +1945,7 @@ success:
|
||||
rename(dol_backup, m_dol.c_str());
|
||||
}
|
||||
else
|
||||
remove(dol_backup);
|
||||
fsop_deleteFile(dol_backup);
|
||||
filestr.close();
|
||||
|
||||
m_exit = true;
|
||||
@ -2011,7 +2012,7 @@ int CMenu::_gametdbDownloaderAsync()
|
||||
|
||||
gprintf("Downloading file to '%s'\n", zippath.c_str());
|
||||
|
||||
remove(zippath.c_str());
|
||||
fsop_deleteFile(zippath.c_str());
|
||||
|
||||
_setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), "wiitdb.zip"), 1.f);
|
||||
FILE *file = fopen(zippath.c_str(), "wb");
|
||||
@ -2036,11 +2037,11 @@ int CMenu::_gametdbDownloaderAsync()
|
||||
gprintf(zres ? "success\n" : "failed\n");
|
||||
|
||||
// We don't need the zipfile anymore
|
||||
remove(zippath.c_str());
|
||||
fsop_deleteFile(zippath.c_str());
|
||||
|
||||
// We should always remove the offsets file to make sure it's reloaded
|
||||
string offsetspath = fmt("%s/gametdb_offsets.bin", m_settingsDir.c_str());
|
||||
remove(offsetspath.c_str());
|
||||
fsop_deleteFile(offsetspath.c_str());
|
||||
|
||||
// Update cache
|
||||
//m_gameList.SetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
|
||||
@ -2061,3 +2062,132 @@ int CMenu::_gametdbDownloaderAsync()
|
||||
m_thrdWorking = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *banner_url = NULL;
|
||||
const char *banner_url_id3 = NULL;
|
||||
const char *banner_location = NULL;
|
||||
u32 CMenu::_downloadBannerAsync(void *obj)
|
||||
{
|
||||
CMenu *m = (CMenu *)obj;
|
||||
if (!m->m_thrdWorking)
|
||||
return 0;
|
||||
|
||||
m->m_thrdStop = false;
|
||||
|
||||
LWP_MutexLock(m->m_mutex);
|
||||
m->_setThrdMsg(m->_t("cfgbnr7", L"Downloading banner..."), 0);
|
||||
LWP_MutexUnlock(m->m_mutex);
|
||||
|
||||
if (m->_initNetwork() < 0)
|
||||
{
|
||||
m->m_thrdWorking = false;
|
||||
return -1;
|
||||
}
|
||||
|
||||
u32 bufferSize = 0x400000; /* 4mb max */
|
||||
u8 *buffer = (u8*)MEM2_alloc(bufferSize);
|
||||
if(buffer == NULL)
|
||||
{
|
||||
m->m_thrdWorking = false;
|
||||
return -2;
|
||||
}
|
||||
block banner = downloadfile(buffer, bufferSize, banner_url, CMenu::_downloadProgress, m);
|
||||
if(banner.data == NULL || banner.size < 0x5000)
|
||||
banner = downloadfile(buffer, bufferSize, banner_url_id3, CMenu::_downloadProgress, m);
|
||||
|
||||
/* minimum 50kb */
|
||||
if (banner.data != NULL && banner.size > 51200 && banner.data[0] != '<')
|
||||
{
|
||||
FILE *file = fopen(banner_location, "wb");
|
||||
if(file != NULL)
|
||||
{
|
||||
fwrite(banner.data, 1, banner.size, file);
|
||||
fclose(file);
|
||||
free(buffer);
|
||||
m->m_thrdWorking = false;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
m->m_thrdWorking = false;
|
||||
return -3;
|
||||
}
|
||||
|
||||
static const char *GAME_BNR_ID = "{gameid}";
|
||||
void CMenu::_downloadBnr(const char *gameID)
|
||||
{
|
||||
if(gameID == NULL || strlen(gameID) > 6)
|
||||
return;
|
||||
string base_url = m_cfg.getString("GENERAL", "custom_banner_url", " ");
|
||||
if(base_url.size() < 3 || base_url.find(GAME_BNR_ID) == string::npos)
|
||||
return;
|
||||
base_url.replace(base_url.find(GAME_BNR_ID), strlen(GAME_BNR_ID), gameID);
|
||||
banner_url = base_url.c_str();
|
||||
|
||||
string base_url_id3 = m_cfg.getString("GENERAL", "custom_banner_url", " ");
|
||||
base_url_id3.replace(base_url_id3.find(GAME_BNR_ID), strlen(GAME_BNR_ID), gameID, 3);
|
||||
banner_url_id3 = base_url_id3.c_str();
|
||||
|
||||
banner_location = fmt("%s/%s.bnr", m_customBnrDir.c_str(), gameID);
|
||||
|
||||
m_btnMgr.show(m_downloadPBar);
|
||||
m_btnMgr.setProgress(m_downloadPBar, 0.f);
|
||||
m_btnMgr.show(m_downloadBtnCancel);
|
||||
m_btnMgr.setText(m_downloadBtnCancel, _t("dl1", L"Cancel"));
|
||||
m_thrdStop = false;
|
||||
m_thrdMessageAdded = false;
|
||||
|
||||
m_thrdWorking = true;
|
||||
lwp_t thread = LWP_THREAD_NULL;
|
||||
LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_downloadBannerAsync, (void *)this, 0, 8192, 40);
|
||||
|
||||
wstringEx prevMsg;
|
||||
while(m_thrdWorking)
|
||||
{
|
||||
_mainLoopCommon();
|
||||
if ((BTN_HOME_PRESSED || BTN_B_PRESSED) && !m_thrdWorking)
|
||||
break;
|
||||
if (BTN_A_PRESSED && !(m_thrdWorking && m_thrdStop))
|
||||
{
|
||||
if (m_btnMgr.selected(m_downloadBtnCancel))
|
||||
{
|
||||
LockMutex lock(m_mutex);
|
||||
m_thrdStop = true;
|
||||
m_thrdMessageAdded = true;
|
||||
m_thrdMessage = _t("dlmsg6", L"Canceling...");
|
||||
}
|
||||
}
|
||||
if (Sys_Exiting())
|
||||
{
|
||||
LockMutex lock(m_mutex);
|
||||
m_thrdStop = true;
|
||||
m_thrdMessageAdded = true;
|
||||
m_thrdMessage = _t("dlmsg6", L"Canceling...");
|
||||
m_thrdWorking = false;
|
||||
}
|
||||
if (m_thrdMessageAdded)
|
||||
{
|
||||
LockMutex lock(m_mutex);
|
||||
m_thrdMessageAdded = false;
|
||||
m_btnMgr.setProgress(m_downloadPBar, m_thrdProgress);
|
||||
if (prevMsg != m_thrdMessage)
|
||||
{
|
||||
prevMsg = m_thrdMessage;
|
||||
m_btnMgr.setText(m_downloadLblMessage[0], m_thrdMessage, false);
|
||||
m_btnMgr.hide(m_downloadLblMessage[0], 0, 0, -1.f, -1.f, true);
|
||||
m_btnMgr.show(m_downloadLblMessage[0]);
|
||||
}
|
||||
}
|
||||
if (m_thrdStop && !m_thrdWorking)
|
||||
break;
|
||||
}
|
||||
if (thread != LWP_THREAD_NULL)
|
||||
{
|
||||
LWP_JoinThread(thread, NULL);
|
||||
thread = LWP_THREAD_NULL;
|
||||
}
|
||||
m_btnMgr.hide(m_downloadLblMessage[0]);
|
||||
m_btnMgr.hide(m_downloadPBar);
|
||||
m_btnMgr.hide(m_downloadBtnCancel);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user