Re: Re: Going up a directory takes long
Home › Forums › Development › Going up a directory takes long › Re: Re: Going up a directory takes long
After reading through some of the code I want to make a suggestion. The browserList and browser global variables are used in quite a few places in more or less the same way. I want to encapsulate this in a class. The interface that I thought of so far could be something like this:
class Browser
{
public:
static BROWSERENTRY& getBrowserEntryAtIndex(int index);
static BROWSERENTRY& getSelectedBrowserEntry();
static void addBrowserEntry(const BROWSERENTRY& entry);
static std::string getLastDirectory();
static std::string getCurrentDirectory();
static void setSelectedIndex(int index);
static int getNumberOfEntries();
/* TODO more things here */
};
This of course does not include all the members of the BROWSERINFO browser struct yet. My idea is that this class will completely take over the way the browserList and browser structs are currently used.
Eventually this class could also contain a list of directory entry lists, so that we can hold more than one level of directory entries at a time. (I thought that WiiMC could only re-parse a folder once it enters it, instead of on every directory change.)
I want to hear what you guys have to say about this suggestion before I submit a patch.
Tantric: you said that “WiiMC sets aside 2000 directory entries for one directory path”. That’s true, but only for directories with 2000 entries. Directories with less entries will luckily use less memory. (See AddBrowserEntry() in filebrowser.cpp )
jhb50: I haven’t taken a good look at the picture mode code, but I guess to solve your problem, would be to filter the directories earlier, for different modes. Does WiiMC know what extensions it supports for a given mode?
