usbloadergx/source/usbloader/GameList.h
dimok321 6f63f9cf05 *Prepare source code for devkitPPC r23 - replaced removed directory functions
*Added additional sort mode - "Sort by number of players"
*Added support for multiple game partitions.

Note: You can activate multiple game partitions support in the Loader Settings. When it is active, all games from all partitions will be listed in the game list. Partitions can be mixed up as you wish wbfs/fat/ntfs/ext. When the multiple partitions feature is activated than the partition in "Game/Install Partition" setting is taken for new game installation. Also the free space amount will be shown from that game installation partition. This will be clickable in the future listing all partitions with their sizes.
2011-02-02 18:30:15 +00:00

55 lines
2.6 KiB
C++

#ifndef GAME_LIST_H_
#define GAME_LIST_H_
#include <vector>
#include "Controls/DeviceHandler.hpp"
#include "wstring.hpp"
#include "usbloader/disc.h"
class GameList
{
public:
GameList() : selectedGame(0) { };
int ReadGameList();
int size() const { return FilteredList.size(); }
int GameCount() const { return FullGameList.size(); }
int FilterList(const wchar_t * gameFilter = NULL);
int LoadUnfiltered();
struct discHdr * at(int i) const { return operator[](i); }
struct discHdr * operator[](int i) const { if (i < 0 || i >= (int) FilteredList.size()) return NULL; return FilteredList[i]; }
struct discHdr * GetDiscHeader(const char * gameID) const;
const wchar_t * GetCurrentFilter() const { return GameFilter.c_str(); }
const wchar_t * GetAvailableSearchChars() const { return AvailableSearchChars.c_str(); }
void SortList();
void clear();
bool operator!() const { return (FullGameList.size() == 0); }
//! Gamelist scrolling operators
int operator+=(int i) { return (selectedGame = (selectedGame+i) % FilteredList.size()); }
int operator-=(int i) { return (selectedGame = (selectedGame-i+FilteredList.size()) % FilteredList.size()); }
int operator++() { return (selectedGame = (selectedGame+1) % FilteredList.size()); }
int operator--() { return (selectedGame = (selectedGame-1+FilteredList.size()) % FilteredList.size()); }
int operator++(int i) { return operator++(); }
int operator--(int i) { return operator--(); }
struct discHdr * GetCurrentSelected() const { return operator[](selectedGame); }
int GetPartitionNumber(const u8 *gameid) const;
int GetGameFS(const u8 *gameID) const { return DeviceHandler::Instance()->GetUSBFilesystemType(GetPartitionNumber(gameID)); }
void RemovePartition(int part_num);
protected:
int InternalReadList(int part);
static bool NameSortCallback(const struct discHdr *a, const struct discHdr *b);
static bool PlaycountSortCallback(const struct discHdr *a, const struct discHdr *b);
static bool RankingSortCallback(const struct discHdr *a, const struct discHdr *b);
static bool PlayersSortCallback(const struct discHdr *a, const struct discHdr *b);
wString AvailableSearchChars;
wString GameFilter;
int selectedGame;
std::vector<struct discHdr *> FilteredList;
std::vector<struct discHdr> FullGameList;
std::vector<int> GamePartitionList;
};
extern GameList gameList;
#endif