2012-12-19 09:30:18 +00:00
|
|
|
/****************************************************************************
|
|
|
|
* *
|
2015-11-10 05:21:49 +00:00
|
|
|
* Project64 - A Nintendo 64 emulator. *
|
2012-12-19 09:30:18 +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 *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
2010-06-14 21:14:58 +00:00
|
|
|
#pragma once
|
2008-09-18 03:15:49 +00:00
|
|
|
#include <list>
|
2015-12-04 06:49:31 +00:00
|
|
|
#include <Project64/Settings/DebugSettings.h>
|
2008-09-18 03:15:49 +00:00
|
|
|
|
|
|
|
#ifndef PLUGIN_INFO_STRUCT
|
|
|
|
#define PLUGIN_INFO_STRUCT
|
|
|
|
|
2015-11-08 06:08:15 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
uint16_t Version; /* Should be set to 1 */
|
|
|
|
uint16_t Type; /* Set to PLUGIN_TYPE_GFX */
|
|
|
|
char Name[100]; /* Name of the DLL */
|
|
|
|
|
|
|
|
/* If DLL supports memory these memory options then set them to TRUE or FALSE
|
|
|
|
if it does not support it */
|
|
|
|
int32_t NormalMemory; /* a normal BYTE array */
|
|
|
|
int32_t MemoryBswaped; /* a normal BYTE array where the memory has been pre
|
|
|
|
bswap on a dword (32 bits) boundry */
|
2008-09-18 03:15:49 +00:00
|
|
|
} PLUGIN_INFO;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// enum's
|
2015-11-08 06:08:15 +00:00
|
|
|
enum SETTING_DATA_TYPE
|
|
|
|
{
|
|
|
|
Data_DWORD_General = 0, // A uint32_t setting used anywhere
|
|
|
|
Data_String_General = 1, // A string setting used anywhere
|
|
|
|
Data_DWORD_Game = 2, // A uint32_t associated with the current game
|
|
|
|
Data_String_Game = 3, // A string associated with the current game
|
|
|
|
Data_DWORD_RDB = 4, // A uint32_t associated with the current game in the rom database
|
|
|
|
Data_String_RDB = 5, // A string associated with the current game in the rom database
|
|
|
|
Data_DWORD_RDB_Setting = 6, // A uint32_t read from the rom database, with config file
|
|
|
|
Data_String_RDB_Setting = 7, // A string read from the rom database, with config file
|
2008-09-18 03:15:49 +00:00
|
|
|
};
|
|
|
|
|
2015-11-08 06:08:15 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
uint32_t dwSize;
|
|
|
|
int32_t DefaultStartRange;
|
|
|
|
int32_t SettingStartRange;
|
|
|
|
int32_t MaximumSettings;
|
|
|
|
int32_t NoDefault;
|
|
|
|
int32_t DefaultLocation;
|
|
|
|
void * handle;
|
|
|
|
uint32_t(*GetSetting) (void * handle, int32_t ID);
|
|
|
|
const char * (*GetSettingSz) (void * handle, int32_t ID, char * Buffer, int32_t BufferLen);
|
|
|
|
void(*SetSetting) (void * handle, int32_t ID, uint32_t Value);
|
|
|
|
void(*SetSettingSz) (void * handle, int32_t ID, const char * Value);
|
|
|
|
void(*RegisterSetting) (void * handle, int32_t ID, int32_t DefaultID, SettingDataType Type,
|
|
|
|
SettingType Location, const char * Category, const char * DefaultStr, uint32_t Value);
|
|
|
|
void(*UseUnregisteredSetting) (int32_t ID);
|
2008-09-18 03:15:49 +00:00
|
|
|
} PLUGIN_SETTINGS;
|
|
|
|
|
2015-11-08 06:08:15 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
uint32_t(*FindSystemSettingId) (void * handle, const char * Name);
|
2008-12-04 10:41:51 +00:00
|
|
|
} PLUGIN_SETTINGS2;
|
|
|
|
|
2015-11-08 06:08:15 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
void(*FlushSettings) (void * handle);
|
2013-04-24 05:03:21 +00:00
|
|
|
} PLUGIN_SETTINGS3;
|
|
|
|
|
2015-11-08 06:08:15 +00:00
|
|
|
enum PLUGIN_TYPE
|
|
|
|
{
|
|
|
|
PLUGIN_TYPE_NONE = 0,
|
|
|
|
PLUGIN_TYPE_RSP = 1,
|
|
|
|
PLUGIN_TYPE_GFX = 2,
|
|
|
|
PLUGIN_TYPE_AUDIO = 3,
|
|
|
|
PLUGIN_TYPE_CONTROLLER = 4,
|
2008-09-18 03:15:49 +00:00
|
|
|
};
|
|
|
|
|
2015-11-08 06:08:15 +00:00
|
|
|
class CSettings;
|
2008-09-18 03:15:49 +00:00
|
|
|
class CGfxPlugin; class CAudioPlugin; class CRSP_Plugin; class CControl_Plugin;
|
2015-11-12 10:08:47 +00:00
|
|
|
class CN64System;
|
|
|
|
class CPlugins;
|
|
|
|
|
|
|
|
__interface RenderWindow
|
|
|
|
{
|
|
|
|
bool ResetPluginsInUiThread(CPlugins * plugins, CN64System * System) = 0;
|
|
|
|
void * GetWindowHandle(void) const = 0;
|
|
|
|
void * GetStatusBar(void) const = 0;
|
|
|
|
};
|
2008-09-18 03:15:49 +00:00
|
|
|
|
2012-09-28 20:07:45 +00:00
|
|
|
class CPlugins :
|
2015-11-08 06:08:15 +00:00
|
|
|
private CDebugSettings
|
2012-09-28 20:07:45 +00:00
|
|
|
{
|
2008-09-18 03:15:49 +00:00
|
|
|
public:
|
2015-11-08 06:08:15 +00:00
|
|
|
//Functions
|
|
|
|
CPlugins(const stdstr & PluginDir);
|
|
|
|
~CPlugins();
|
2008-09-18 03:15:49 +00:00
|
|
|
|
2015-11-08 06:08:15 +00:00
|
|
|
bool Initiate(CN64System * System);
|
|
|
|
void RomOpened(void);
|
|
|
|
void RomClosed(void);
|
2015-11-12 10:08:47 +00:00
|
|
|
void SetRenderWindows(RenderWindow * MainWindow, RenderWindow * SyncWindow);
|
2015-11-13 02:52:34 +00:00
|
|
|
void ConfigPlugin(void* hParent, PLUGIN_TYPE Type);
|
2015-11-08 06:08:15 +00:00
|
|
|
bool CopyPlugins(const stdstr & DstDir) const;
|
|
|
|
void CreatePlugins(void);
|
|
|
|
bool Reset(CN64System * System);
|
|
|
|
bool ResetInUiThread(CN64System * System);
|
|
|
|
void GameReset(void);
|
2012-11-02 23:28:09 +00:00
|
|
|
|
2015-11-08 06:08:15 +00:00
|
|
|
inline CGfxPlugin * Gfx(void) const { return m_Gfx; }
|
|
|
|
inline CAudioPlugin * Audio(void) const { return m_Audio; }
|
|
|
|
inline CRSP_Plugin * RSP(void) const { return m_RSP; }
|
|
|
|
inline CControl_Plugin * Control(void) const { return m_Control; }
|
2012-11-02 23:28:09 +00:00
|
|
|
|
2015-11-12 10:08:47 +00:00
|
|
|
inline RenderWindow * MainWindow(void) const { return m_MainWindow; }
|
|
|
|
inline RenderWindow * SyncWindow(void) const { return m_SyncWindow; }
|
2013-01-03 08:51:00 +00:00
|
|
|
|
2015-11-08 06:08:15 +00:00
|
|
|
private:
|
|
|
|
CPlugins(void); // Disable default constructor
|
|
|
|
CPlugins(const CPlugins&); // Disable copy constructor
|
|
|
|
CPlugins& operator=(const CPlugins&); // Disable assignment
|
2012-11-02 23:28:09 +00:00
|
|
|
|
2015-11-08 06:08:15 +00:00
|
|
|
void DestroyGfxPlugin(void);
|
|
|
|
void DestroyAudioPlugin(void);
|
|
|
|
void DestroyRspPlugin(void);
|
|
|
|
void DestroyControlPlugin(void);
|
2013-01-03 08:51:00 +00:00
|
|
|
|
2015-11-08 06:08:15 +00:00
|
|
|
static void PluginChanged(CPlugins * _this);
|
2012-11-02 23:28:09 +00:00
|
|
|
|
2015-11-12 10:08:47 +00:00
|
|
|
RenderWindow * m_MainWindow;
|
|
|
|
RenderWindow * m_SyncWindow;
|
2012-11-02 23:28:09 +00:00
|
|
|
|
2015-11-08 06:08:15 +00:00
|
|
|
stdstr const m_PluginDir;
|
2012-11-02 23:28:09 +00:00
|
|
|
|
2015-11-08 06:08:15 +00:00
|
|
|
//Plugins
|
|
|
|
CGfxPlugin * m_Gfx;
|
|
|
|
CAudioPlugin * m_Audio;
|
|
|
|
CRSP_Plugin * m_RSP;
|
|
|
|
CControl_Plugin * m_Control;
|
2012-11-02 23:28:09 +00:00
|
|
|
|
2015-11-08 06:08:15 +00:00
|
|
|
stdstr m_GfxFile;
|
|
|
|
stdstr m_AudioFile;
|
|
|
|
stdstr m_RSPFile;
|
|
|
|
stdstr m_ControlFile;
|
2008-09-18 03:15:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//Dummy Functions
|
2015-11-08 06:08:15 +00:00
|
|
|
void DummyCheckInterrupts(void);
|
|
|
|
void DummyFunction(void);
|