RMG-Core: add a version of CoreInit() for plugins

This commit is contained in:
Rosalie Wanders
2021-12-26 16:51:33 +01:00
parent b5990826df
commit 802fd2ca12
2 changed files with 39 additions and 0 deletions
+24
View File
@@ -139,6 +139,30 @@ bool CoreInit(void)
return true;
}
bool CoreInit(m64p_dynlib_handle handle)
{
std::string error;
bool ret = false;
ret = m64p::Core.Hook(handle);
if (!ret)
{
error = m64p::Core.GetLastError();
CoreSetError(error);
return false;
}
ret = m64p::Config.Hook(handle);
if (!ret)
{
error = m64p::Config.GetLastError();
CoreSetError(error);
return false;
}
return true;
}
void CoreShutdown(void)
{
CorePluginsShutdown();
+15
View File
@@ -22,11 +22,26 @@
#include "Error.hpp"
#include "Video.hpp"
#include "Key.hpp"
#ifdef CORE_PLUGIN
#include "m64p/api/m64p_common.h"
#include "m64p/api/m64p_custom.h"
#include "m64p/api/m64p_types.h"
#include "m64p/api/m64p_config.h"
#include "m64p/api/m64p_plugin.h"
#include "m64p/api/version.h"
#endif // CORE_PLUGIN
// initializes the core library,
// returns false when failed
bool CoreInit(void);
#ifdef CORE_PLUGIN
// initializes the core library for plugins,
// returns false when failed
bool CoreInit(m64p_dynlib_handle handle);
#endif // CORE_PLUGIN
// shuts down the core library
void CoreShutdown(void);