Add initial game list class implementation

This commit is contained in:
Connor McLaughlin
2019-11-29 23:46:04 +10:00
parent 3b11d936df
commit 04c70b3118
5 changed files with 227 additions and 0 deletions

36
src/core/game_list.h Normal file
View File

@@ -0,0 +1,36 @@
#pragma once
#include "types.h"
#include <optional>
#include <string>
#include <string_view>
#include <unordered_map>
class CDImage;
class GameList
{
public:
GameList();
~GameList();
static std::string GetGameCodeForImage(CDImage* cdi);
static std::string GetGameCodeForPath(const char* image_path);
static std::optional<ConsoleRegion> GetRegionForCode(std::string_view code);
void AddDirectory(const char* path, bool recursive);
private:
struct GameListEntry
{
std::string path;
std::string code;
std::string title;
ConsoleRegion region;
};
bool GetGameListEntry(const char* path, GameListEntry* entry);
void ScanDirectory(const char* path, bool recursive);
std::vector<GameListEntry> m_entries;
};