ScummVM API documentation
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
library_scummvm.h
1
/* ScummVM - Graphic Adventure Engine
2
*
3
* ScummVM is the legal property of its developers, whose names
4
* are too numerous to list here. Please refer to the COPYRIGHT
5
* file distributed with this source distribution.
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*
20
*/
21
22
#ifndef AGS_ENGINE_UTIL_LIBRARY_SCUMMVM_H
23
#define AGS_ENGINE_UTIL_LIBRARY_SCUMMVM_H
24
25
#include "ags/shared/core/platform.h"
26
#include "ags/shared/util/string.h"
27
#include "ags/shared/debugging/out.h"
28
#include "ags/plugins/plugin_base.h"
29
#include "ags/engine/util/library.h"
30
31
namespace
AGS3
{
32
namespace
AGS
{
33
namespace
Engine
{
34
35
class
ScummVMLibrary
:
public
BaseLibrary
{
36
private
:
37
Plugins::PluginBase
*_library =
nullptr
;
38
39
public
:
40
ScummVMLibrary
() :
BaseLibrary
() {}
41
42
~
ScummVMLibrary
()
override
{
43
Unload();
44
};
45
46
AGS::Shared::String
GetFilenameForLib(
const
AGS::Shared::String
&libraryName)
override
{
47
return
AGS::Shared::String::FromFormat(
"%s.dll"
, libraryName.GetCStr());
48
}
49
50
bool
Load(
const
AGS::Shared::String
&libraryName)
override
{
51
Unload();
52
53
_library = Plugins::pluginOpen(libraryName.GetCStr());
54
const
char
*
error
= Plugins::pluginError();
55
if
(error)
56
AGS::Shared::Debug::Printf(
"pluginOpen returned: %s"
, error);
57
58
if
(_library ==
nullptr
)
59
return
false
;
60
_name = libraryName;
61
_filename = GetFilenameForLib(libraryName);
62
_path =
"./"
;
63
return
true
;
64
}
65
66
void
Unload()
override
{
67
if
(_library) {
68
Plugins::pluginClose(_library);
69
_library =
nullptr
;
70
_name =
""
;
71
_filename =
""
;
72
_path =
""
;
73
}
74
}
75
76
bool
IsLoaded()
const override
{
77
return
_library !=
nullptr
;
78
}
79
80
Plugins::PluginBase
*getPlugin()
const
{
81
return
_library;
82
}
83
};
84
85
86
typedef
ScummVMLibrary
Library
;
87
88
}
// namespace Engine
89
}
// namespace AGS
90
}
// namespace AGS3
91
92
#endif
AGS
Definition:
achievements_tables.h:27
AGS3::AGS::Engine::ScummVMLibrary
Definition:
library_scummvm.h:35
AGS3::Plugins::PluginBase
Definition:
plugin_base.h:171
AGS3::AGS::Engine::BaseLibrary
Definition:
library.h:34
error
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
AGS3::AGS::Shared::String
Definition:
string.h:62
Engine
Definition:
engine.h:144
AGS3
Definition:
ags.h:40
engines
ags
engine
util
library_scummvm.h
Generated on Wed Apr 9 2025 09:10:16 for ScummVM API documentation by
1.8.13