10 #include "../stdafx.h" 12 #include "../script/squirrel_class.hpp" 16 #include "../safeguards.h" 19 void GameScannerInfo::Initialize()
21 ScriptScanner::Initialize(
"GSScanner");
36 if (this->
info_list.size() == 0)
return nullptr;
37 if (nameParam ==
nullptr)
return nullptr;
46 if (versionParam == -1) {
51 char *e = strrchr(game_name,
'.');
52 if (e ==
nullptr)
return nullptr;
55 versionParam = atoi(e);
59 if (force_exact_match) {
61 char game_name_tmp[1024];
62 seprintf(game_name_tmp,
lastof(game_name_tmp),
"%s.%d", game_name, versionParam);
69 ScriptInfoList::iterator it = this->
info_list.begin();
70 for (; it != this->
info_list.end(); it++) {
82 void GameScannerLibrary::Initialize()
84 ScriptScanner::Initialize(
"GSScanner");
101 char library_name[1024];
102 seprintf(library_name,
lastof(library_name),
"%s.%d", library, version);
106 ScriptInfoList::iterator iter = this->
info_list.find(library_name);
107 if (iter == this->
info_list.end())
return nullptr;
int GetVersion() const
Get the version of the script.
class GameLibrary * FindLibrary(const char *library, int version)
Find a library in the pool.
static void RegisterAPI(Squirrel *engine)
Register the functions of this class.
int CDECL seprintf(char *str, const char *last, const char *format,...)
Safer implementation of snprintf; same as snprintf except:
const char * GetName() const
Get the Name of the script.
class GameInfo * FindInfo(const char *nameParam, int versionParam, bool force_exact_match)
Check if we have a game by name and version available in our list.
void RegisterAPI(class Squirrel *engine) override
Register the API for this ScriptInfo.
#define lastof(x)
Get the last element of an fixed size array.
bool strtolower(char *str)
Convert a given ASCII string to lowercase.
All static information from an Game like name, version, etc.
void RegisterAPI(class Squirrel *engine) override
Register the API for this ScriptInfo.
All static information from an Game library like name, version, etc.
All static information from an Script like name, version, etc.
bool CanLoadFromVersion(int version) const
Check if we can start this Game.
ScriptInfoList info_list
The list of all script.
static void RegisterAPI(Squirrel *engine)
Register the functions of this class.
GameInfo keeps track of all information of an Game, like Author, Description, ... ...
declarations of the class for Game scanner
const char * GetCategory() const
Get the category this library is in.
char * strecpy(char *dst, const char *src, const char *last)
Copies characters from one buffer to another.
ScriptInfoList info_single_list
The list of all unique script. The best script (highest version) is shown.
void GetScriptName(ScriptInfo *info, char *name, const char *last) override
Get the script name how to store the script in memory.
const char * GetInstanceName() const
Get the name of the instance of the script to create.
void GetScriptName(ScriptInfo *info, char *name, const char *last) override
Get the script name how to store the script in memory.
class Squirrel * engine
The engine we're scanning with.