Go to the documentation of this file.
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;
43 if (versionParam == -1) {
49 if (force_exact_match) {
51 char game_name_tmp[1024];
52 seprintf(game_name_tmp,
lastof(game_name_tmp),
"%s.%d", game_name, versionParam);
54 if (this->
info_list.find(game_name_tmp) != this->info_list.end())
return static_cast<GameInfo *
>(this->
info_list[game_name_tmp]);
63 for (
const auto &item : this->
info_list) {
75 void GameScannerLibrary::Initialize()
77 ScriptScanner::Initialize(
"GSScanner");
94 char library_name[1024];
95 seprintf(library_name,
lastof(library_name),
"%s.%d", library, version);
99 ScriptInfoList::iterator it = this->
info_list.find(library_name);
100 if (it == this->
info_list.end())
return nullptr;
bool strtolower(char *str)
Convert a given ASCII string to lowercase.
class Squirrel * engine
The engine we're scanning with.
void RegisterAPI(class Squirrel *engine) override
Register the API for this ScriptInfo.
bool CanLoadFromVersion(int version) const
Check if we can start this Game.
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.
const char * GetCategory() const
Get the category this library is in.
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.
void GetScriptName(ScriptInfo *info, char *name, const char *last) override
Get the script name how to store the script in memory.
static void RegisterAPI(Squirrel *engine)
Register the functions of this class.
ScriptInfoList info_list
The list of all script.
int GetVersion() const
Get the version of the script.
All static information from an Game like name, version, etc.
int CDECL seprintf(char *str, const char *last, const char *format,...)
Safer implementation of snprintf; same as snprintf except:
void RegisterAPI(class Squirrel *engine) override
Register the API for this ScriptInfo.
All static information from an Game library like name, version, etc.
const char * GetName() const
Get the Name of the script.
char * strecpy(char *dst, const char *src, const char *last)
Copies characters from one buffer to another.
All static information from an Script like name, version, etc.
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.
#define lastof(x)
Get the last element of an fixed size array.
ScriptInfoList info_single_list
The list of all unique script. The best script (highest version) is shown.