12 #include "../stdafx.h" 14 #include "../script/squirrel_class.hpp" 18 #include "../safeguards.h" 21 void GameScannerInfo::Initialize()
23 ScriptScanner::Initialize(
"GSScanner");
38 if (this->
info_list.size() == 0)
return NULL;
39 if (nameParam == NULL)
return NULL;
48 if (versionParam == -1) {
53 char *e = strrchr(game_name,
'.');
54 if (e == NULL)
return NULL;
57 versionParam = atoi(e);
61 if (force_exact_match) {
63 char game_name_tmp[1024];
64 seprintf(game_name_tmp,
lastof(game_name_tmp),
"%s.%d", game_name, versionParam);
71 ScriptInfoList::iterator it = this->
info_list.begin();
72 for (; it != this->
info_list.end(); it++) {
84 void GameScannerLibrary::Initialize()
86 ScriptScanner::Initialize(
"GSScanner");
103 char library_name[1024];
104 seprintf(library_name,
lastof(library_name),
"%s.%d", library, version);
108 ScriptInfoList::iterator iter = this->
info_list.find(library_name);
109 if (iter == this->
info_list.end())
return NULL;
void RegisterAPI(class Squirrel *engine)
Register the API for this ScriptInfo.
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:
void RegisterAPI(class Squirrel *engine)
Register the API for this ScriptInfo.
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.
#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 GetScriptName(ScriptInfo *info, char *name, const char *last)
Get the script name how to store the script in memory.
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.
void GetScriptName(ScriptInfo *info, char *name, const char *last)
Get the script name how to store the script in memory.
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.
const char * GetInstanceName() const
Get the name of the instance of the script to create.
class Squirrel * engine
The engine we're scanning with.