12#include "../script/squirrel_class.hpp"
16#include "../3rdparty/fmt/format.h"
18#include "../safeguards.h"
21void GameScannerInfo::Initialize()
23 ScriptScanner::Initialize(
"GSScanner");
38 if (this->
info_list.empty())
return nullptr;
39 if (name.empty())
return nullptr;
48 if (force_exact_match) {
50 std::string name_with_version = fmt::format(
"{}.{}", name, version);
51 auto it = this->
info_list.find(name_with_version);
57 int highest_version = -1;
61 for (
const auto &item : this->
info_list) {
73void GameScannerLibrary::Initialize()
75 ScriptScanner::Initialize(
"GSScanner");
92 std::string library_name = fmt::format(
"{}.{}", library, version);
95 auto it = this->
info_list.find(library_name);
96 if (it == this->
info_list.end())
return nullptr;
All static information from an Game like name, version, etc.
bool CanLoadFromVersion(int version) const
Check if we can start this Game.
static void RegisterAPI(Squirrel &engine)
Register the functions of this class.
All static information from an Game library like name, version, etc.
static void RegisterAPI(Squirrel &engine)
Register the functions of this class.
const std::string & GetCategory() const
Get the category this library is in.
std::string GetScriptName(ScriptInfo &info) override
Get the script name how to store the script in memory.
void RegisterAPI(class Squirrel &engine) override
Register the API for this ScriptInfo.
class GameInfo * FindInfo(const std::string &name, int version, bool force_exact_match)
Check if we have a game by name and version available in our list.
std::string GetScriptName(ScriptInfo &info) override
Get the script name how to store the script in memory.
class GameLibrary * FindLibrary(const std::string &library, int version)
Find a library in the pool.
void RegisterAPI(class Squirrel &engine) override
Register the API for this ScriptInfo.
All static information from an Script like name, version, etc.
const std::string & GetInstanceName() const
Get the name of the instance of the script to create.
const std::string & GetName() const
Get the Name of the script.
int GetVersion() const
Get the version of the script.
ScriptInfoList info_list
The list of all script.
ScriptInfoList info_single_list
The list of all unique script. The best script (highest version) is shown.
std::unique_ptr< class Squirrel > engine
The engine we're scanning with.
GameInfo keeps track of all information of an Game, like Author, Description, ...
declarations of the class for Game scanner
bool StrEqualsIgnoreCase(std::string_view str1, std::string_view str2)
Compares two string( view)s for equality, while ignoring the case of the characters.