mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-01 00:55:06 +01:00
-added the option to use virtual subfolders (or tiers) to the source menu. works in sourceflow and regular source menu. if you wish to do this you need to edit your source_menu.ini and do the following.
add src_folder=x to each button. x is the number of the virtual folder this button belongs in. 0 is obviously the base folder. add source=folder when you want a button to open a new virtual folder and folder=x to specify which new folder to open. in folders 1 and above you will need to make a back or up button to go back to the previous folder.
This commit is contained in:
parent
6830cbd765
commit
8825a7b2e7
BIN
out/boot.dol
BIN
out/boot.dol
Binary file not shown.
Before Width: | Height: | Size: 3.3 MiB After Width: | Height: | Size: 3.3 MiB |
@ -370,14 +370,14 @@ void GetFiles(const char *Path, const vector<string>& FileTypes,
|
||||
SubPaths.clear();
|
||||
}
|
||||
|
||||
void ListGenerator::createSFList(u8 maxBtns, Config &m_sourceMenuCfg, const string& sourceDir)
|
||||
void ListGenerator::createSFList(u8 btns_cnt, Config &m_sourceMenuCfg, const string& sourceDir, const vector<int>& btns)
|
||||
{
|
||||
Clear();
|
||||
char btn_selected[256];
|
||||
for(u8 i = 0; i <= maxBtns; i++)
|
||||
for(u8 i = 0; i < btns_cnt; i++)
|
||||
{
|
||||
memset(btn_selected, 0, 256);
|
||||
strncpy(btn_selected, fmt("BUTTON_%i", i), 255);
|
||||
strncpy(btn_selected, fmt("BUTTON_%i", btns[i]), 255);
|
||||
const char *source = m_sourceMenuCfg.getString(btn_selected, "source","").c_str();
|
||||
if(source == NULL)
|
||||
continue;
|
||||
@ -389,11 +389,10 @@ void ListGenerator::createSFList(u8 maxBtns, Config &m_sourceMenuCfg, const stri
|
||||
strncpy(ListElement.path, path, sizeof(ListElement.path) - 1);
|
||||
ListElement.casecolor = 0xFFFFFF;
|
||||
ListElement.type = TYPE_SOURCE;
|
||||
ListElement.settings[0] = i;
|
||||
//const char *title = m_sourceMenuCfg.getString(btn_selected, "title", fmt("title_%i", i)).c_str();
|
||||
ListElement.settings[0] = btns[i];
|
||||
char SourceTitle[64];
|
||||
memset(SourceTitle, 0, sizeof(SourceTitle));
|
||||
strncpy(SourceTitle, m_sourceMenuCfg.getString(btn_selected, "title", fmt("title_%i", i)).c_str(), 63);
|
||||
strncpy(SourceTitle, m_sourceMenuCfg.getString(btn_selected, "title", fmt("title_%i", btns[i])).c_str(), 63);
|
||||
mbstowcs(ListElement.title, SourceTitle, 63);
|
||||
Asciify(ListElement.title);
|
||||
m_cacheList.push_back(ListElement);
|
||||
|
@ -32,7 +32,7 @@ using namespace std;
|
||||
class ListGenerator : public vector<dir_discHdr>
|
||||
{
|
||||
public:
|
||||
void createSFList(u8 maxBtns, Config &m_sourceMenuCfg, const string& sourceDir);
|
||||
void createSFList(u8 btn_cnt, Config &m_sourceMenuCfg, const string& sourceDir, const vector<int>& btns);
|
||||
void Init(const char *settingsDir, const char *Language);
|
||||
void Clear();
|
||||
void CreateList(u32 Flow, u32 Device, const string& Path, const vector<string>& FileTypes,
|
||||
|
@ -2216,7 +2216,7 @@ bool CMenu::_loadList(void)
|
||||
|
||||
if(m_sourceflow)
|
||||
{
|
||||
m_cacheList.createSFList(m_max_source_btn, m_source, m_sourceDir);
|
||||
_createSFList();
|
||||
for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++)
|
||||
m_gameList.push_back(*tmp_itr);
|
||||
m_cacheList.Clear();
|
||||
|
@ -92,7 +92,6 @@ private:
|
||||
u8 m_aa;
|
||||
u8 m_numCFVersions;
|
||||
u8 m_numPlugins;
|
||||
u8 m_max_source_btn;
|
||||
const char *cf_domain;
|
||||
bool m_use_source;// source_menu.ini found & ok to use source menu/flow
|
||||
bool m_multisource;// multi select source menu
|
||||
@ -1075,6 +1074,7 @@ private:
|
||||
bool _Boot();
|
||||
void _Paths();
|
||||
void _sourceFlow();
|
||||
void _createSFList();
|
||||
void _mainLoopCommon(bool withCF = false, bool adjusting = false);
|
||||
void _netInit();
|
||||
void _loadDefaultFont(void);
|
||||
|
@ -1,8 +1,5 @@
|
||||
|
||||
//#include <dirent.h>
|
||||
//#include <unistd.h>
|
||||
#include "menu.hpp"
|
||||
//#include "defines.h"
|
||||
|
||||
// Source menu
|
||||
s16 m_sourceLblPage;
|
||||
@ -25,9 +22,29 @@ static u8 i, j, k;
|
||||
int curPage;
|
||||
int numPages;
|
||||
vector<string> magicNums;
|
||||
vector<int> srcbtns_list;
|
||||
u8 srcbtns_cnt;
|
||||
u8 max_source_btn;
|
||||
int cur_folder = 0;
|
||||
char btn_selected[16];
|
||||
char current_btn[16];
|
||||
|
||||
void CMenu::_createSFList()
|
||||
{
|
||||
/* create filtered source btns list */
|
||||
srcbtns_list.clear();
|
||||
for(i = 0; i <= max_source_btn; ++i)
|
||||
{
|
||||
memset(current_btn, 0, 16);
|
||||
strncpy(current_btn, fmt("BUTTON_%i", i), 15);
|
||||
int src_folder = m_source.getInt(current_btn, "src_folder", 0);
|
||||
if(src_folder == cur_folder)
|
||||
srcbtns_list.push_back(i);
|
||||
}
|
||||
srcbtns_cnt = srcbtns_list.size();
|
||||
m_cacheList.createSFList(srcbtns_cnt, m_source, m_sourceDir, srcbtns_list);
|
||||
}
|
||||
|
||||
void CMenu::_sourceFlow()
|
||||
{
|
||||
const dir_discHdr *hdr = CoverFlow.getHdr();
|
||||
@ -92,6 +109,11 @@ void CMenu::_sourceFlow()
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(source == "folder")
|
||||
{
|
||||
cur_folder = m_source.getInt(btn_selected, "folder", 0);
|
||||
return;
|
||||
}
|
||||
else //(source == "wii")
|
||||
m_current_view = COVERFLOW_WII;
|
||||
m_sourceflow = false;
|
||||
@ -136,6 +158,23 @@ void CMenu::_showSource(void)
|
||||
|
||||
void CMenu::_updateSourceBtns(void)
|
||||
{
|
||||
/* create filtered source btns list */
|
||||
srcbtns_list.clear();
|
||||
for(i = 0; i <= max_source_btn; ++i)
|
||||
{
|
||||
memset(current_btn, 0, 16);
|
||||
strncpy(current_btn, fmt("BUTTON_%i", i), 15);
|
||||
int src_folder = m_source.getInt(current_btn, "src_folder", 0);
|
||||
if(src_folder == cur_folder)
|
||||
srcbtns_list.push_back(i);
|
||||
}
|
||||
/* get number of pages based on list size */
|
||||
numPages = 0;
|
||||
srcbtns_cnt = srcbtns_list.size();
|
||||
if(srcbtns_cnt > 0)
|
||||
numPages = (srcbtns_cnt - 1)/12 + 1;
|
||||
|
||||
/* show page button only if more than 12 buttons */
|
||||
if(numPages > 1)
|
||||
{
|
||||
m_btnMgr.setText(m_sourceLblPage, wfmt(L"%i / %i", curPage, numPages));
|
||||
@ -143,20 +182,31 @@ void CMenu::_updateSourceBtns(void)
|
||||
m_btnMgr.show(m_sourceBtnPageM);
|
||||
m_btnMgr.show(m_sourceBtnPageP);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_btnMgr.hide(m_sourceLblPage);
|
||||
m_btnMgr.hide(m_sourceBtnPageM);
|
||||
m_btnMgr.hide(m_sourceBtnPageP);
|
||||
}
|
||||
|
||||
/* set image texture for each button and show it */
|
||||
j = (curPage - 1) * 12;
|
||||
sourceBtn = 0;
|
||||
selectedBtns = 0;
|
||||
for(i = 0; i < ((numPages - 1) * 12 + 12); ++i)
|
||||
for(i = 0; i < 12; ++i)
|
||||
{
|
||||
if((i+j) >= srcbtns_cnt)
|
||||
{
|
||||
m_btnMgr.hide(m_sourceBtnSource[i]);
|
||||
continue;
|
||||
}
|
||||
memset(current_btn, 0, 16);
|
||||
strncpy(current_btn, fmt("BUTTON_%i", i), 15);
|
||||
strncpy(current_btn, fmt("BUTTON_%i", srcbtns_list[i + j]), 15);
|
||||
string btnSource = m_source.getString(current_btn, "source", "");
|
||||
bool src_selected = false;
|
||||
//const char *btn_image = m_source.getString(current_btn,"image", "").c_str();
|
||||
//const char *btn_imageSel = m_source.getString(current_btn,"image_s", "").c_str();
|
||||
if(btnSource == "")
|
||||
continue;
|
||||
/* if multisource we get selected image texture if button source is selected */
|
||||
if(m_multisource)
|
||||
{
|
||||
if(btnSource == "allplugins")
|
||||
@ -207,31 +257,27 @@ void CMenu::_updateSourceBtns(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
/* set button image textures and show it*/
|
||||
char btn_image[255];
|
||||
if(src_selected)
|
||||
snprintf(btn_image, sizeof(btn_image), "%s", m_source.getString(current_btn,"image_s", "").c_str());
|
||||
else
|
||||
snprintf(btn_image, sizeof(btn_image), "%s", m_source.getString(current_btn,"image", "").c_str());
|
||||
|
||||
if(i >= j && i < (j + 12))
|
||||
TexData texConsoleImg;
|
||||
TexData texConsoleImgs;
|
||||
if(TexHandle.fromImageFile(texConsoleImg, fmt("%s/%s/%s", m_sourceDir.c_str(), themeName, btn_image)) != TE_OK)
|
||||
{
|
||||
//m_btnMgr.hide(m_sourceBtnSource[i - j], true);
|
||||
//m_btnMgr.tick();
|
||||
TexData texConsoleImg;
|
||||
TexData texConsoleImgs;
|
||||
if(TexHandle.fromImageFile(texConsoleImg, fmt("%s/%s/%s", m_sourceDir.c_str(), themeName, btn_image)) != TE_OK)
|
||||
{
|
||||
if(TexHandle.fromImageFile(texConsoleImg, fmt("%s/%s", m_sourceDir.c_str(), btn_image)) != TE_OK)
|
||||
TexHandle.fromImageFile(texConsoleImg, fmt("%s/favoriteson.png", m_imgsDir.c_str()));
|
||||
}
|
||||
if(TexHandle.fromImageFile(texConsoleImgs, fmt("%s/%s/%s", m_sourceDir.c_str(), themeName, btn_image)) != TE_OK)
|
||||
{
|
||||
if(TexHandle.fromImageFile(texConsoleImgs, fmt("%s/%s", m_sourceDir.c_str(), btn_image)) != TE_OK)
|
||||
TexHandle.fromImageFile(texConsoleImgs, fmt("%s/favoritesons.png", m_imgsDir.c_str()));
|
||||
}
|
||||
m_btnMgr.setBtnTexture(m_sourceBtnSource[i - j], texConsoleImg, texConsoleImgs);
|
||||
m_btnMgr.show(m_sourceBtnSource[i - j]);
|
||||
if(TexHandle.fromImageFile(texConsoleImg, fmt("%s/%s", m_sourceDir.c_str(), btn_image)) != TE_OK)
|
||||
TexHandle.fromImageFile(texConsoleImg, fmt("%s/favoriteson.png", m_imgsDir.c_str()));
|
||||
}
|
||||
if(TexHandle.fromImageFile(texConsoleImgs, fmt("%s/%s/%s", m_sourceDir.c_str(), themeName, btn_image)) != TE_OK)
|
||||
{
|
||||
if(TexHandle.fromImageFile(texConsoleImgs, fmt("%s/%s", m_sourceDir.c_str(), btn_image)) != TE_OK)
|
||||
TexHandle.fromImageFile(texConsoleImgs, fmt("%s/favoritesons.png", m_imgsDir.c_str()));
|
||||
}
|
||||
m_btnMgr.setBtnTexture(m_sourceBtnSource[i], texConsoleImg, texConsoleImgs);
|
||||
m_btnMgr.show(m_sourceBtnSource[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -241,7 +287,6 @@ bool CMenu::_Source()
|
||||
bool updateSource = false;
|
||||
exitSource = false;
|
||||
curPage = 1;
|
||||
numPages = (m_max_source_btn / 12) + 1;
|
||||
|
||||
SetupInput();
|
||||
_showSource();
|
||||
@ -338,12 +383,12 @@ bool CMenu::_Source()
|
||||
if(m_btnMgr.selected(m_sourceBtnSource[i]))
|
||||
{
|
||||
memset(btn_selected, 0, 16);
|
||||
strncpy(btn_selected, fmt("BUTTON_%i", i + j), 15);
|
||||
strncpy(btn_selected, fmt("BUTTON_%i", srcbtns_list[i + j]), 15);
|
||||
source = m_source.getString(btn_selected, "source", "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!m_multisource && i <12)
|
||||
if(!m_multisource && i < 12)
|
||||
{
|
||||
memset(single_sourcebtn, 0, 16);
|
||||
exitSource = true;
|
||||
@ -405,6 +450,13 @@ bool CMenu::_Source()
|
||||
if(enabledPluginsCount == 0) // no magic #'s or invalid ones so default to first plugin in list
|
||||
m_plugin.SetEnablePlugin(m_cfg, 0, 2);
|
||||
}
|
||||
else if(source == "folder")
|
||||
{
|
||||
cur_folder = m_source.getInt(btn_selected, "folder", 0);
|
||||
exitSource = false;
|
||||
updateSource = true;
|
||||
curPage = 1;
|
||||
}
|
||||
else //if(source == "wii") or source is invalid or empty default to wii
|
||||
{
|
||||
m_current_view = COVERFLOW_WII;
|
||||
@ -458,6 +510,13 @@ bool CMenu::_Source()
|
||||
m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
|
||||
m_current_view = enabledPluginsCount > 0 ? (m_current_view | COVERFLOW_PLUGIN) : (m_current_view & ~COVERFLOW_PLUGIN);
|
||||
}
|
||||
else if(source == "folder")
|
||||
{
|
||||
cur_folder = m_source.getInt(btn_selected, "folder", 0);
|
||||
exitSource = false;
|
||||
updateSource = true;
|
||||
curPage = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(exitSource)
|
||||
@ -590,7 +649,7 @@ void CMenu::_initSourceMenu()
|
||||
|
||||
m_use_source = true;
|
||||
/* get max source button # */
|
||||
m_max_source_btn = 0;
|
||||
max_source_btn = 0;
|
||||
const char *srcDomain = m_source.firstDomain().c_str();
|
||||
while(1)
|
||||
{
|
||||
@ -599,8 +658,8 @@ void CMenu::_initSourceMenu()
|
||||
if(strrchr(srcDomain, '_') != NULL)
|
||||
{
|
||||
int srcBtnNumber = atoi(strrchr(srcDomain, '_') + 1);
|
||||
if(srcBtnNumber > m_max_source_btn)
|
||||
m_max_source_btn = srcBtnNumber;
|
||||
if(srcBtnNumber > max_source_btn)
|
||||
max_source_btn = srcBtnNumber;
|
||||
}
|
||||
srcDomain = m_source.nextDomain().c_str();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user