project64/Source/Project64-core/Plugins/PluginBase.h

71 lines
2.6 KiB
C
Raw Normal View History

/****************************************************************************
* *
2015-11-10 05:21:49 +00:00
* Project64 - A Nintendo 64 emulator. *
* 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>
#include <Project64-core/TraceModulesProject64.h>
2015-12-06 09:59:58 +00:00
#include "PluginClass.h"
class CPlugin :
2015-11-08 06:08:15 +00:00
private CDebugSettings
{
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-11-08 06:08:15 +00:00
virtual int32_t GetDefaultSettingStartRange() const = 0;
virtual int32_t GetSettingStartRange() const = 0;
2015-11-08 06:08:15 +00:00
bool Load(const char * FileName);
2015-11-08 06:08:15 +00:00
void RomOpened();
void RomClose();
void GameReset();
void Close();
2015-11-08 06:08:15 +00:00
void(__cdecl *DllAbout) (void * hWnd);
void(__cdecl *DllConfig) (void * hParent);
2015-12-10 18:23:00 +00:00
static bool ValidPluginVersion(PLUGIN_INFO & PluginInfo);
2015-11-08 06:08:15 +00:00
protected:
void UnloadPlugin();
const char * PluginType() const;
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-11-08 06:08:15 +00:00
void(__cdecl *CloseDLL) (void);
void(__cdecl *RomOpen) (void);
void(__cdecl *RomClosed) (void);
void(__cdecl *PluginOpened)(void);
void(__cdecl *SetSettingInfo) (PLUGIN_SETTINGS *);
void(__cdecl *SetSettingInfo2) (PLUGIN_SETTINGS2 *);
void(__cdecl *SetSettingInfo3) (PLUGIN_SETTINGS3 *);
2015-11-08 06:08:15 +00:00
void * m_hDll;
bool m_Initialized, m_RomOpen;
PLUGIN_INFO m_PluginInfo;
2015-11-08 06:08:15 +00:00
// Loads a function pointer from the currently loaded DLL
template <typename T>
void _LoadFunction(const char * szFunctionName, T & functionPointer) {
functionPointer = (T)GetProcAddress((HMODULE)m_hDll, szFunctionName);
}
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);
#define LoadFunction(functionName) _LoadFunction(#functionName, functionName)
};