Revert "-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."

This reverts commit 8825a7b2e7.
This commit is contained in:
Fledge68 2018-09-26 10:28:01 -05:00
parent 1f138ed768
commit 0c0fb2c3c5
8 changed files with 41 additions and 99 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

After

Width:  |  Height:  |  Size: 3.3 MiB

View File

@ -370,14 +370,14 @@ void GetFiles(const char *Path, const vector<string>& FileTypes,
SubPaths.clear();
}
void ListGenerator::createSFList(u8 btns_cnt, Config &m_sourceMenuCfg, const string& sourceDir, const vector<int>& btns)
void ListGenerator::createSFList(u8 maxBtns, Config &m_sourceMenuCfg, const string& sourceDir)
{
Clear();
char btn_selected[256];
for(u8 i = 0; i < btns_cnt; i++)
for(u8 i = 0; i <= maxBtns; i++)
{
memset(btn_selected, 0, 256);
strncpy(btn_selected, fmt("BUTTON_%i", btns[i]), 255);
strncpy(btn_selected, fmt("BUTTON_%i", i), 255);
const char *source = m_sourceMenuCfg.getString(btn_selected, "source","").c_str();
if(source == NULL)
continue;
@ -389,10 +389,11 @@ void ListGenerator::createSFList(u8 btns_cnt, Config &m_sourceMenuCfg, const str
strncpy(ListElement.path, path, sizeof(ListElement.path) - 1);
ListElement.casecolor = 0xFFFFFF;
ListElement.type = TYPE_SOURCE;
ListElement.settings[0] = btns[i];
ListElement.settings[0] = i;
//const char *title = m_sourceMenuCfg.getString(btn_selected, "title", fmt("title_%i", i)).c_str();
char SourceTitle[64];
memset(SourceTitle, 0, sizeof(SourceTitle));
strncpy(SourceTitle, m_sourceMenuCfg.getString(btn_selected, "title", fmt("title_%i", btns[i])).c_str(), 63);
strncpy(SourceTitle, m_sourceMenuCfg.getString(btn_selected, "title", fmt("title_%i", i)).c_str(), 63);
mbstowcs(ListElement.title, SourceTitle, 63);
Asciify(ListElement.title);
m_cacheList.push_back(ListElement);

View File

@ -32,7 +32,7 @@ using namespace std;
class ListGenerator : public vector<dir_discHdr>
{
public:
void createSFList(u8 btn_cnt, Config &m_sourceMenuCfg, const string& sourceDir, const vector<int>& btns);
void createSFList(u8 maxBtns, Config &m_sourceMenuCfg, const string& sourceDir);
void Init(const char *settingsDir, const char *Language);
void Clear();
void CreateList(u32 Flow, u32 Device, const string& Path, const vector<string>& FileTypes,

View File

@ -2216,7 +2216,7 @@ bool CMenu::_loadList(void)
if(m_sourceflow)
{
_createSFList();
m_cacheList.createSFList(m_max_source_btn, m_source, m_sourceDir);
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();

View File

@ -92,6 +92,7 @@ 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
@ -1074,7 +1075,6 @@ private:
bool _Boot();
void _Paths();
void _sourceFlow();
void _createSFList();
void _mainLoopCommon(bool withCF = false, bool adjusting = false);
void _netInit();
void _loadDefaultFont(void);

View File

@ -1,5 +1,8 @@
//#include <dirent.h>
//#include <unistd.h>
#include "menu.hpp"
//#include "defines.h"
// Source menu
s16 m_sourceLblPage;
@ -22,29 +25,9 @@ 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();
@ -109,11 +92,6 @@ 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;
@ -158,23 +136,6 @@ 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));
@ -182,31 +143,20 @@ 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 < 12; ++i)
for(i = 0; i < ((numPages - 1) * 12 + 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", srcbtns_list[i + j]), 15);
strncpy(current_btn, fmt("BUTTON_%i", i), 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")
@ -257,27 +207,31 @@ 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());
TexData texConsoleImg;
TexData texConsoleImgs;
if(TexHandle.fromImageFile(texConsoleImg, fmt("%s/%s/%s", m_sourceDir.c_str(), themeName, btn_image)) != TE_OK)
if(i >= j && i < (j + 12))
{
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()));
//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(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]);
}
}
@ -287,6 +241,7 @@ bool CMenu::_Source()
bool updateSource = false;
exitSource = false;
curPage = 1;
numPages = (m_max_source_btn / 12) + 1;
SetupInput();
_showSource();
@ -383,12 +338,12 @@ bool CMenu::_Source()
if(m_btnMgr.selected(m_sourceBtnSource[i]))
{
memset(btn_selected, 0, 16);
strncpy(btn_selected, fmt("BUTTON_%i", srcbtns_list[i + j]), 15);
strncpy(btn_selected, fmt("BUTTON_%i", 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;
@ -450,13 +405,6 @@ 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;
@ -510,13 +458,6 @@ 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)
@ -649,7 +590,7 @@ void CMenu::_initSourceMenu()
m_use_source = true;
/* get max source button # */
max_source_btn = 0;
m_max_source_btn = 0;
const char *srcDomain = m_source.firstDomain().c_str();
while(1)
{
@ -658,8 +599,8 @@ void CMenu::_initSourceMenu()
if(strrchr(srcDomain, '_') != NULL)
{
int srcBtnNumber = atoi(strrchr(srcDomain, '_') + 1);
if(srcBtnNumber > max_source_btn)
max_source_btn = srcBtnNumber;
if(srcBtnNumber > m_max_source_btn)
m_max_source_btn = srcBtnNumber;
}
srcDomain = m_source.nextDomain().c_str();
}

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<pd><ViewState><e p="Wiiflow" x="true"></e><e p="Wiiflow\resources" x="false"></e><e p="Wiiflow\data" x="false"></e><e p="Wiiflow\scripts" x="false"></e><e p="Wiiflow\source" x="false"></e><e p="Wiiflow\wii" x="false"></e><e p="Wiiflow\docs" x="false"></e><e p="Wiiflow\portlibs" x="false"></e></ViewState></pd>
<pd><ViewState><e p="Wiiflow\portlibs" x="false"></e><e p="Wiiflow\source\cheats" x="false"></e><e p="Wiiflow\docs" x="false"></e><e p="Wiiflow\source\fileOps" x="false"></e><e p="Wiiflow\source\gecko" x="false"></e><e p="Wiiflow\source\homebrew" x="false"></e><e p="Wiiflow\source\loader" x="false"></e><e p="Wiiflow\source\wstringEx" x="false"></e><e p="Wiiflow\source\gc" x="false"></e><e p="Wiiflow\source\list" x="false"></e><e p="Wiiflow\source\music" x="false"></e><e p="Wiiflow\source\banner" x="false"></e><e p="Wiiflow\source\config" x="false"></e><e p="Wiiflow\source\libwbfs" x="false"></e><e p="Wiiflow\source\memory" x="false"></e><e p="Wiiflow\source\sicksaxis-wrapper" x="false"></e><e p="Wiiflow\source" x="true"></e><e p="Wiiflow\source\channel" x="false"></e><e p="Wiiflow\source\hw" x="false"></e><e p="Wiiflow\source\menu" x="true"></e><e p="Wiiflow\source\network" x="false"></e><e p="Wiiflow\source\plugin" x="false"></e><e p="Wiiflow\source\unzip" x="false"></e><e p="Wiiflow\wii" x="false"></e><e p="Wiiflow\data" x="false"></e><e p="Wiiflow\resources" x="false"></e><e p="Wiiflow\scripts" x="false"></e><e p="Wiiflow\source\booter" x="false"></e><e p="Wiiflow\source\devicemounter" x="false"></e><e p="Wiiflow\source\gui" x="false"></e><e p="Wiiflow" x="true"></e></ViewState></pd>