AGS: Inline some library functions + minor changes

This is the only relevant part of upstream commit
a46b97fc3bf7fdff82b84a863a3c0cacc37e7a2b
"Engine: explicitly search for plugins in a game's data dir too"

(ScummVM does not support external plugins)
This commit is contained in:
Walter Agazzi 2023-06-06 21:58:08 +02:00 committed by Filippos Karapetis
parent f0216eafc0
commit 2b2fa06142
3 changed files with 17 additions and 4 deletions

View File

@ -37,16 +37,27 @@ public:
virtual ~BaseLibrary() {}
String GetName() const { return _name; }
String GetFilePath() const { return _path; }
// Get library name; returns empty string if not loaded
inline String GetName() const { return _name; }
// Get actual filename; returns empty string if not loaded
inline String GetFileName() const { return _filename; }
// Get path used to load the library; or empty string is not loaded.
// NOTE: this is NOT a fully qualified path, but a lookup path.
inline String GetPath() const { return _path; }
// Returns expected filename form for the dynamic library of a given name
virtual String GetFilenameForLib(const String &libname) = 0;
// Try load a library of a given name
virtual bool Load(const String &libname) = 0;
// Unload a library; does nothing if was not loaded
virtual void Unload() = 0;
// Tells if library is loaded
virtual bool IsLoaded() const = 0;
protected:
String _name;
String _filename;
String _path;
};

View File

@ -58,7 +58,8 @@ public:
if (_library == nullptr)
return false;
_name = libraryName;
_path = GetFilenameForLib(libraryName);;
_filename = GetFilenameForLib(libraryName);
_path = "./";
return true;
}
@ -67,6 +68,7 @@ public:
Plugins::pluginClose(_library);
_library = nullptr;
_name = "";
_filename = "";
_path = "";
}
}

View File

@ -843,7 +843,7 @@ void pl_run_plugin_init_gfx_hooks(const char *driverName, void *data) {
}
}
Engine::GameInitError pl_register_plugins(const std::vector<Shared::PluginInfo> &infos) {
Engine::GameInitError pl_register_plugins(const std::vector<PluginInfo> &infos) {
_GP(plugins).clear();
_GP(plugins).reserve(MAXPLUGINS);