2015-01-30 21:01:21 +00:00
|
|
|
/****************************************************************************
|
|
|
|
* *
|
2015-11-10 05:21:49 +00:00
|
|
|
* Project64 - A Nintendo 64 emulator. *
|
2015-01-30 21:01:21 +00:00
|
|
|
* http://www.pj64-emu.com/ *
|
|
|
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
|
|
|
* *
|
|
|
|
* License: *
|
|
|
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
|
|
|
#pragma once
|
|
|
|
|
2015-12-06 09:59:58 +00:00
|
|
|
#include <Project64-core/Settings/DebugSettings.h>
|
2015-12-14 10:51:33 +00:00
|
|
|
#include <Project64-core/TraceModulesProject64.h>
|
2016-01-17 18:48:19 +00:00
|
|
|
#include <Project64-core/Plugins/PluginClass.h>
|
|
|
|
#include <Common/Util.h>
|
2015-12-06 09:59:58 +00:00
|
|
|
|
2016-01-06 02:54:42 +00:00
|
|
|
#if defined(_WIN32)
|
|
|
|
#define CALL __cdecl
|
|
|
|
#else
|
|
|
|
#define CALL
|
2016-01-06 00:39:02 +00:00
|
|
|
#endif
|
|
|
|
|
2015-02-24 21:44:06 +00:00
|
|
|
class CPlugin :
|
2015-11-08 06:08:15 +00:00
|
|
|
private CDebugSettings
|
2015-01-30 21:01:21 +00:00
|
|
|
{
|
|
|
|
public:
|
2015-11-08 06:08:15 +00:00
|
|
|
CPlugin();
|
|
|
|
virtual ~CPlugin();
|
|
|
|
inline const char * PluginName() const { return m_PluginInfo.Name; }
|
|
|
|
inline bool Initialized() { return m_Initialized; }
|
2015-01-30 21:01:21 +00:00
|
|
|
|
2015-11-08 06:08:15 +00:00
|
|
|
virtual int32_t GetDefaultSettingStartRange() const = 0;
|
|
|
|
virtual int32_t GetSettingStartRange() const = 0;
|
2015-01-30 21:01:21 +00:00
|
|
|
|
2015-11-08 06:08:15 +00:00
|
|
|
bool Load(const char * FileName);
|
2015-01-30 21:01:21 +00:00
|
|
|
|
2016-04-18 09:38:20 +00:00
|
|
|
void RomOpened(RenderWindow * Render);
|
|
|
|
void RomClose(RenderWindow * Render);
|
|
|
|
void GameReset(RenderWindow * Render);
|
|
|
|
void Close(RenderWindow * Render);
|
2015-01-30 21:01:21 +00:00
|
|
|
|
2016-01-06 02:54:42 +00:00
|
|
|
void(CALL *DllAbout) (void * hWnd);
|
|
|
|
void(CALL *DllConfig) (void * hParent);
|
2015-01-30 21:01:21 +00:00
|
|
|
|
2015-12-10 18:23:00 +00:00
|
|
|
static bool ValidPluginVersion(PLUGIN_INFO & PluginInfo);
|
2015-01-30 21:01:21 +00:00
|
|
|
|
2015-11-08 06:08:15 +00:00
|
|
|
protected:
|
|
|
|
void UnloadPlugin();
|
|
|
|
const char * PluginType() const;
|
2015-12-14 10:51:33 +00:00
|
|
|
TraceModuleProject64 PluginTraceType() const;
|
2015-11-08 06:08:15 +00:00
|
|
|
virtual void UnloadPluginDetails() = 0;
|
|
|
|
virtual PLUGIN_TYPE type() = 0;
|
|
|
|
virtual bool LoadFunctions(void) = 0;
|
2015-01-30 21:01:21 +00:00
|
|
|
|
2016-01-06 02:54:42 +00:00
|
|
|
void(CALL *CloseDLL) (void);
|
|
|
|
void(CALL *RomOpen) (void);
|
|
|
|
void(CALL *RomClosed) (void);
|
|
|
|
void(CALL *PluginOpened)(void);
|
2016-08-07 08:27:14 +00:00
|
|
|
void(CALL *SetSettingInfo)(PLUGIN_SETTINGS *);
|
|
|
|
void(CALL *SetSettingInfo2)(PLUGIN_SETTINGS2 *);
|
|
|
|
void(CALL *SetSettingInfo3)(PLUGIN_SETTINGS3 *);
|
|
|
|
void(CALL *SetSettingNotificationInfo)(PLUGIN_SETTINGS_NOTIFICATION *);
|
2015-01-30 21:01:21 +00:00
|
|
|
|
2016-01-17 18:48:19 +00:00
|
|
|
pjutil::DynLibHandle m_LibHandle;
|
|
|
|
bool m_Initialized, m_RomOpen;
|
2015-11-08 06:08:15 +00:00
|
|
|
PLUGIN_INFO m_PluginInfo;
|
2015-01-30 21:01:21 +00:00
|
|
|
|
2015-11-08 06:08:15 +00:00
|
|
|
// Loads a function pointer from the currently loaded DLL
|
2016-01-17 18:48:19 +00:00
|
|
|
void _LoadFunctionVoid(const char * szFunctionName, void ** functionPointer)
|
|
|
|
{
|
|
|
|
*functionPointer = pjutil::DynLibGetProc(m_LibHandle, szFunctionName);
|
2015-11-08 06:08:15 +00:00
|
|
|
}
|
2015-01-30 21:01:21 +00:00
|
|
|
|
2015-11-08 06:08:15 +00:00
|
|
|
// Simple wrapper around _LoadFunction() to avoid having to specify the same two arguments
|
|
|
|
// i.e. _LoadFunction("CloseDLL", CloseDLL);
|
2016-01-17 18:48:19 +00:00
|
|
|
#define LoadFunction(functionName) _LoadFunctionVoid(#functionName, (void **)&functionName)
|
|
|
|
#define _LoadFunction(functionName,function) _LoadFunctionVoid(functionName, (void **)&function)
|
2015-01-30 21:01:21 +00:00
|
|
|
};
|