[Project64] Add plugin to get notification of settings change
This commit is contained in:
parent
f19fb532a4
commit
3889ebf37d
|
@ -247,7 +247,7 @@ bool AppInit(CNotification * Notify, const char * BaseDirectory, int argc, char
|
||||||
|
|
||||||
//Create the plugin container
|
//Create the plugin container
|
||||||
WriteTrace(TraceAppInit, TraceInfo, "Create Plugins");
|
WriteTrace(TraceAppInit, TraceInfo, "Create Plugins");
|
||||||
g_Plugins = new CPlugins(Directory_Plugin);
|
g_Plugins = new CPlugins(Directory_Plugin, false);
|
||||||
|
|
||||||
g_Lang = new CLanguage();
|
g_Lang = new CLanguage();
|
||||||
g_Lang->LoadCurrentStrings();
|
g_Lang->LoadCurrentStrings();
|
||||||
|
|
|
@ -87,7 +87,7 @@ CN64System::CN64System(CPlugins * Plugins, bool SavesReadOnly, bool SyncSystem)
|
||||||
}
|
}
|
||||||
g_Notify->DisplayMessage(5, "Copy Plugins");
|
g_Notify->DisplayMessage(5, "Copy Plugins");
|
||||||
g_Plugins->CopyPlugins(g_Settings->LoadStringVal(Directory_PluginSync));
|
g_Plugins->CopyPlugins(g_Settings->LoadStringVal(Directory_PluginSync));
|
||||||
m_SyncPlugins = new CPlugins(Directory_PluginSync);
|
m_SyncPlugins = new CPlugins(Directory_PluginSync, true);
|
||||||
m_SyncPlugins->SetRenderWindows(g_Plugins->SyncWindow(), NULL);
|
m_SyncPlugins->SetRenderWindows(g_Plugins->SyncWindow(), NULL);
|
||||||
m_SyncCPU = new CN64System(m_SyncPlugins, true, true);
|
m_SyncCPU = new CN64System(m_SyncPlugins, true, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,17 +129,20 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
// Send initialization information to the DLL
|
// Send initialization information to the DLL
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
CMipsMemoryVM & MMU = System->m_MMU_VM;
|
||||||
|
CRegisters & Reg = System->m_Reg;
|
||||||
|
|
||||||
Info.HEADER = g_Rom->GetRomAddress();
|
Info.HEADER = g_Rom->GetRomAddress();
|
||||||
Info.RDRAM = g_MMU->Rdram();
|
Info.RDRAM = MMU.Rdram();
|
||||||
Info.DMEM = g_MMU->Dmem();
|
Info.DMEM = MMU.Dmem();
|
||||||
Info.IMEM = g_MMU->Imem();
|
Info.IMEM = MMU.Imem();
|
||||||
Info.MI__INTR_REG = &g_Reg->m_AudioIntrReg;
|
Info.MI__INTR_REG = &Reg.m_AudioIntrReg;
|
||||||
Info.AI__DRAM_ADDR_REG = &g_Reg->AI_DRAM_ADDR_REG;
|
Info.AI__DRAM_ADDR_REG = &Reg.AI_DRAM_ADDR_REG;
|
||||||
Info.AI__LEN_REG = &g_Reg->AI_LEN_REG;
|
Info.AI__LEN_REG = &Reg.AI_LEN_REG;
|
||||||
Info.AI__CONTROL_REG = &g_Reg->AI_CONTROL_REG;
|
Info.AI__CONTROL_REG = &Reg.AI_CONTROL_REG;
|
||||||
Info.AI__STATUS_REG = &g_Reg->AI_STATUS_REG;
|
Info.AI__STATUS_REG = &Reg.AI_STATUS_REG;
|
||||||
Info.AI__DACRATE_REG = &g_Reg->AI_DACRATE_REG;
|
Info.AI__DACRATE_REG = &Reg.AI_DACRATE_REG;
|
||||||
Info.AI__BITRATE_REG = &g_Reg->AI_BITRATE_REG;
|
Info.AI__BITRATE_REG = &Reg.AI_BITRATE_REG;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Initialized = InitiateAudio(Info) != 0;
|
m_Initialized = InitiateAudio(Info) != 0;
|
||||||
|
@ -161,7 +164,7 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
m_hAudioThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)AudioThread, (LPVOID)this, 0, &ThreadID);
|
m_hAudioThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)AudioThread, (LPVOID)this, 0, &ThreadID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_Reg->AI_DACRATE_REG != 0)
|
if (System->m_Reg.AI_DACRATE_REG != 0)
|
||||||
{
|
{
|
||||||
DacrateChanged(System->SystemType());
|
DacrateChanged(System->SystemType());
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include <Project64-core/N64System/N64RomClass.h>
|
#include <Project64-core/N64System/N64RomClass.h>
|
||||||
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
||||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
||||||
|
#include <Project64-core/N64System/N64Class.h>
|
||||||
#include "GFXPlugin.h"
|
#include "GFXPlugin.h"
|
||||||
|
|
||||||
CGfxPlugin::CGfxPlugin() :
|
CGfxPlugin::CGfxPlugin() :
|
||||||
|
@ -218,33 +219,36 @@ bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
// Send initialization information to the DLL
|
// Send initialization information to the DLL
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
CMipsMemoryVM & MMU = System->m_MMU_VM;
|
||||||
|
CRegisters & Reg = System->m_Reg;
|
||||||
|
|
||||||
Info.HEADER = g_Rom->GetRomAddress();
|
Info.HEADER = g_Rom->GetRomAddress();
|
||||||
Info.RDRAM = g_MMU->Rdram();
|
Info.RDRAM = MMU.Rdram();
|
||||||
Info.DMEM = g_MMU->Dmem();
|
Info.DMEM = MMU.Dmem();
|
||||||
Info.IMEM = g_MMU->Imem();
|
Info.IMEM = MMU.Imem();
|
||||||
Info.MI__INTR_REG = &g_Reg->m_GfxIntrReg;
|
Info.MI__INTR_REG = &Reg.m_GfxIntrReg;
|
||||||
Info.DPC__START_REG = &g_Reg->DPC_START_REG;
|
Info.DPC__START_REG = &Reg.DPC_START_REG;
|
||||||
Info.DPC__END_REG = &g_Reg->DPC_END_REG;
|
Info.DPC__END_REG = &Reg.DPC_END_REG;
|
||||||
Info.DPC__CURRENT_REG = &g_Reg->DPC_CURRENT_REG;
|
Info.DPC__CURRENT_REG = &Reg.DPC_CURRENT_REG;
|
||||||
Info.DPC__STATUS_REG = &g_Reg->DPC_STATUS_REG;
|
Info.DPC__STATUS_REG = &Reg.DPC_STATUS_REG;
|
||||||
Info.DPC__CLOCK_REG = &g_Reg->DPC_CLOCK_REG;
|
Info.DPC__CLOCK_REG = &Reg.DPC_CLOCK_REG;
|
||||||
Info.DPC__BUFBUSY_REG = &g_Reg->DPC_BUFBUSY_REG;
|
Info.DPC__BUFBUSY_REG = &Reg.DPC_BUFBUSY_REG;
|
||||||
Info.DPC__PIPEBUSY_REG = &g_Reg->DPC_PIPEBUSY_REG;
|
Info.DPC__PIPEBUSY_REG = &Reg.DPC_PIPEBUSY_REG;
|
||||||
Info.DPC__TMEM_REG = &g_Reg->DPC_TMEM_REG;
|
Info.DPC__TMEM_REG = &Reg.DPC_TMEM_REG;
|
||||||
Info.VI__STATUS_REG = &g_Reg->VI_STATUS_REG;
|
Info.VI__STATUS_REG = &Reg.VI_STATUS_REG;
|
||||||
Info.VI__ORIGIN_REG = &g_Reg->VI_ORIGIN_REG;
|
Info.VI__ORIGIN_REG = &Reg.VI_ORIGIN_REG;
|
||||||
Info.VI__WIDTH_REG = &g_Reg->VI_WIDTH_REG;
|
Info.VI__WIDTH_REG = &Reg.VI_WIDTH_REG;
|
||||||
Info.VI__INTR_REG = &g_Reg->VI_INTR_REG;
|
Info.VI__INTR_REG = &Reg.VI_INTR_REG;
|
||||||
Info.VI__V_CURRENT_LINE_REG = &g_Reg->VI_CURRENT_REG;
|
Info.VI__V_CURRENT_LINE_REG = &Reg.VI_CURRENT_REG;
|
||||||
Info.VI__TIMING_REG = &g_Reg->VI_TIMING_REG;
|
Info.VI__TIMING_REG = &Reg.VI_TIMING_REG;
|
||||||
Info.VI__V_SYNC_REG = &g_Reg->VI_V_SYNC_REG;
|
Info.VI__V_SYNC_REG = &Reg.VI_V_SYNC_REG;
|
||||||
Info.VI__H_SYNC_REG = &g_Reg->VI_H_SYNC_REG;
|
Info.VI__H_SYNC_REG = &Reg.VI_H_SYNC_REG;
|
||||||
Info.VI__LEAP_REG = &g_Reg->VI_LEAP_REG;
|
Info.VI__LEAP_REG = &Reg.VI_LEAP_REG;
|
||||||
Info.VI__H_START_REG = &g_Reg->VI_H_START_REG;
|
Info.VI__H_START_REG = &Reg.VI_H_START_REG;
|
||||||
Info.VI__V_START_REG = &g_Reg->VI_V_START_REG;
|
Info.VI__V_START_REG = &Reg.VI_V_START_REG;
|
||||||
Info.VI__V_BURST_REG = &g_Reg->VI_V_BURST_REG;
|
Info.VI__V_BURST_REG = &Reg.VI_V_BURST_REG;
|
||||||
Info.VI__X_SCALE_REG = &g_Reg->VI_X_SCALE_REG;
|
Info.VI__X_SCALE_REG = &Reg.VI_X_SCALE_REG;
|
||||||
Info.VI__Y_SCALE_REG = &g_Reg->VI_Y_SCALE_REG;
|
Info.VI__Y_SCALE_REG = &Reg.VI_Y_SCALE_REG;
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteTrace(TraceGFXPlugin, TraceDebug, "Calling InitiateGFX");
|
WriteTrace(TraceGFXPlugin, TraceDebug, "Calling InitiateGFX");
|
||||||
|
|
|
@ -49,6 +49,8 @@ bool CPlugin::Load(const char * FileName)
|
||||||
// Try to load the plugin DLL
|
// Try to load the plugin DLL
|
||||||
//Try to load the DLL library
|
//Try to load the DLL library
|
||||||
m_LibHandle = pjutil::DynLibOpen(FileName, bHaveDebugger());
|
m_LibHandle = pjutil::DynLibOpen(FileName, bHaveDebugger());
|
||||||
|
WriteTrace(PluginTraceType(), TraceDebug, "Loaded: %s LibHandle: %X", FileName, m_LibHandle);
|
||||||
|
|
||||||
if (m_LibHandle == NULL)
|
if (m_LibHandle == NULL)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -70,6 +72,16 @@ bool CPlugin::Load(const char * FileName)
|
||||||
LoadFunction(DllConfig);
|
LoadFunction(DllConfig);
|
||||||
LoadFunction(DllAbout);
|
LoadFunction(DllAbout);
|
||||||
|
|
||||||
|
LoadFunction(SetSettingNotificationInfo);
|
||||||
|
if (SetSettingNotificationInfo)
|
||||||
|
{
|
||||||
|
WriteTrace(PluginTraceType(), TraceDebug, "Found SetSettingNotificationInfo");
|
||||||
|
PLUGIN_SETTINGS_NOTIFICATION info;
|
||||||
|
info.RegisterChangeCB = (void(*)(void *, int ID, void * Data, PLUGIN_SETTINGS_NOTIFICATION::SettingChangedFunc Func))CSettings::sRegisterChangeCB;
|
||||||
|
info.UnregisterChangeCB = (void(*)(void *, int ID, void * Data, PLUGIN_SETTINGS_NOTIFICATION::SettingChangedFunc Func))CSettings::sUnregisterChangeCB;
|
||||||
|
SetSettingNotificationInfo(&info);
|
||||||
|
}
|
||||||
|
|
||||||
LoadFunction(SetSettingInfo3);
|
LoadFunction(SetSettingInfo3);
|
||||||
if (SetSettingInfo3)
|
if (SetSettingInfo3)
|
||||||
{
|
{
|
||||||
|
@ -260,7 +272,7 @@ TraceModuleProject64 CPlugin::PluginTraceType() const
|
||||||
case PLUGIN_TYPE_AUDIO: return TraceAudioPlugin;
|
case PLUGIN_TYPE_AUDIO: return TraceAudioPlugin;
|
||||||
case PLUGIN_TYPE_CONTROLLER: return TraceControllerPlugin;
|
case PLUGIN_TYPE_CONTROLLER: return TraceControllerPlugin;
|
||||||
}
|
}
|
||||||
return TraceUnknown;
|
return TracePlugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlugin::ValidPluginVersion(PLUGIN_INFO & PluginInfo)
|
bool CPlugin::ValidPluginVersion(PLUGIN_INFO & PluginInfo)
|
||||||
|
|
|
@ -60,6 +60,7 @@ protected:
|
||||||
void(CALL *SetSettingInfo)(PLUGIN_SETTINGS *);
|
void(CALL *SetSettingInfo)(PLUGIN_SETTINGS *);
|
||||||
void(CALL *SetSettingInfo2)(PLUGIN_SETTINGS2 *);
|
void(CALL *SetSettingInfo2)(PLUGIN_SETTINGS2 *);
|
||||||
void(CALL *SetSettingInfo3)(PLUGIN_SETTINGS3 *);
|
void(CALL *SetSettingInfo3)(PLUGIN_SETTINGS3 *);
|
||||||
|
void(CALL *SetSettingNotificationInfo)(PLUGIN_SETTINGS_NOTIFICATION *);
|
||||||
|
|
||||||
pjutil::DynLibHandle m_LibHandle;
|
pjutil::DynLibHandle m_LibHandle;
|
||||||
bool m_Initialized, m_RomOpen;
|
bool m_Initialized, m_RomOpen;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include <Project64-core/Plugins/PluginClass.h>
|
#include <Project64-core/Plugins/PluginClass.h>
|
||||||
#include <Common/path.h>
|
#include <Common/path.h>
|
||||||
|
|
||||||
CPlugins::CPlugins(SettingID PluginDirSetting) :
|
CPlugins::CPlugins(SettingID PluginDirSetting, bool SyncPlugins) :
|
||||||
m_MainWindow(NULL),
|
m_MainWindow(NULL),
|
||||||
m_SyncWindow(NULL),
|
m_SyncWindow(NULL),
|
||||||
m_PluginDirSetting(PluginDirSetting),
|
m_PluginDirSetting(PluginDirSetting),
|
||||||
|
@ -23,7 +23,8 @@ m_Gfx(NULL),
|
||||||
m_Audio(NULL),
|
m_Audio(NULL),
|
||||||
m_RSP(NULL),
|
m_RSP(NULL),
|
||||||
m_Control(NULL),
|
m_Control(NULL),
|
||||||
m_initilized(false)
|
m_initilized(false),
|
||||||
|
m_SyncPlugins(SyncPlugins)
|
||||||
{
|
{
|
||||||
CreatePlugins();
|
CreatePlugins();
|
||||||
g_Settings->RegisterChangeCB(Plugin_RSP_Current, this, (CSettings::SettingChangedFunc)PluginChanged);
|
g_Settings->RegisterChangeCB(Plugin_RSP_Current, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||||
|
@ -111,7 +112,7 @@ void CPlugins::PluginChanged(CPlugins * _this)
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename plugin_type>
|
template <typename plugin_type>
|
||||||
static void LoadPlugin(SettingID PluginSettingID, SettingID PluginVerSettingID, plugin_type * & plugin, const char * PluginDir, stdstr & FileName, TraceModuleProject64 TraceLevel, const char * type)
|
static void LoadPlugin(SettingID PluginSettingID, SettingID PluginVerSettingID, plugin_type * & plugin, const char * PluginDir, stdstr & FileName, TraceModuleProject64 TraceLevel, const char * type, bool IsCopy)
|
||||||
{
|
{
|
||||||
if (plugin != NULL)
|
if (plugin != NULL)
|
||||||
{
|
{
|
||||||
|
@ -119,6 +120,10 @@ static void LoadPlugin(SettingID PluginSettingID, SettingID PluginVerSettingID,
|
||||||
}
|
}
|
||||||
FileName = g_Settings->LoadStringVal(PluginSettingID);
|
FileName = g_Settings->LoadStringVal(PluginSettingID);
|
||||||
CPath PluginFileName(PluginDir, FileName.c_str());
|
CPath PluginFileName(PluginDir, FileName.c_str());
|
||||||
|
if (IsCopy)
|
||||||
|
{
|
||||||
|
PluginFileName.SetName(stdstr_f("%s-copy", PluginFileName.GetName().c_str()).c_str());
|
||||||
|
}
|
||||||
plugin = new plugin_type();
|
plugin = new plugin_type();
|
||||||
if (plugin)
|
if (plugin)
|
||||||
{
|
{
|
||||||
|
@ -146,10 +151,10 @@ void CPlugins::CreatePlugins(void)
|
||||||
{
|
{
|
||||||
WriteTrace(TracePlugins, TraceInfo, "Start");
|
WriteTrace(TracePlugins, TraceInfo, "Start");
|
||||||
|
|
||||||
LoadPlugin(Game_Plugin_Gfx, Plugin_GFX_CurVer, m_Gfx, m_PluginDir.c_str(), m_GfxFile, TraceGFXPlugin, "GFX");
|
LoadPlugin(Game_Plugin_Gfx, Plugin_GFX_CurVer, m_Gfx, m_PluginDir.c_str(), m_GfxFile, TraceGFXPlugin, "GFX", m_SyncPlugins);
|
||||||
LoadPlugin(Game_Plugin_Audio, Plugin_AUDIO_CurVer, m_Audio, m_PluginDir.c_str(), m_AudioFile, TraceAudioPlugin, "Audio");
|
LoadPlugin(Game_Plugin_Audio, Plugin_AUDIO_CurVer, m_Audio, m_PluginDir.c_str(), m_AudioFile, TraceAudioPlugin, "Audio", m_SyncPlugins);
|
||||||
LoadPlugin(Game_Plugin_RSP, Plugin_RSP_CurVer, m_RSP, m_PluginDir.c_str(), m_RSPFile, TraceRSPPlugin, "RSP");
|
LoadPlugin(Game_Plugin_RSP, Plugin_RSP_CurVer, m_RSP, m_PluginDir.c_str(), m_RSPFile, TraceRSPPlugin, "RSP", m_SyncPlugins);
|
||||||
LoadPlugin(Game_Plugin_Controller, Plugin_CONT_CurVer, m_Control, m_PluginDir.c_str(), m_ControlFile, TraceControllerPlugin, "Control");
|
LoadPlugin(Game_Plugin_Controller, Plugin_CONT_CurVer, m_Control, m_PluginDir.c_str(), m_ControlFile, TraceControllerPlugin, "Control", m_SyncPlugins);
|
||||||
|
|
||||||
//Enable debugger
|
//Enable debugger
|
||||||
if (m_RSP != NULL && m_RSP->EnableDebugging)
|
if (m_RSP != NULL && m_RSP->EnableDebugging)
|
||||||
|
@ -427,6 +432,7 @@ bool CPlugins::CopyPlugins(const stdstr & DstDir) const
|
||||||
//Copy GFX Plugin
|
//Copy GFX Plugin
|
||||||
CPath srcGfxPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str());
|
CPath srcGfxPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str());
|
||||||
CPath dstGfxPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str());
|
CPath dstGfxPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str());
|
||||||
|
dstGfxPlugin.SetName(stdstr_f("%s-copy", dstGfxPlugin.GetName().c_str()).c_str());
|
||||||
|
|
||||||
if (!dstGfxPlugin.DirectoryExists())
|
if (!dstGfxPlugin.DirectoryExists())
|
||||||
{
|
{
|
||||||
|
@ -434,12 +440,14 @@ bool CPlugins::CopyPlugins(const stdstr & DstDir) const
|
||||||
}
|
}
|
||||||
if (!srcGfxPlugin.CopyTo(dstGfxPlugin))
|
if (!srcGfxPlugin.CopyTo(dstGfxPlugin))
|
||||||
{
|
{
|
||||||
|
WriteTrace(TracePlugins, TraceError, "failed to copy %s to %s", (const char *)srcGfxPlugin, (const char *)dstGfxPlugin);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Copy m_Audio Plugin
|
//Copy m_Audio Plugin
|
||||||
CPath srcAudioPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str());
|
CPath srcAudioPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str());
|
||||||
CPath dstAudioPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str());
|
CPath dstAudioPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str());
|
||||||
|
dstAudioPlugin.SetName(stdstr_f("%s-copy", dstAudioPlugin.GetName().c_str()).c_str());
|
||||||
if (!dstAudioPlugin.DirectoryExists())
|
if (!dstAudioPlugin.DirectoryExists())
|
||||||
{
|
{
|
||||||
dstAudioPlugin.DirectoryCreate();
|
dstAudioPlugin.DirectoryCreate();
|
||||||
|
@ -448,10 +456,10 @@ bool CPlugins::CopyPlugins(const stdstr & DstDir) const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Copy RSP Plugin
|
//Copy RSP Plugin
|
||||||
CPath srcRSPPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str());
|
CPath srcRSPPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str());
|
||||||
CPath dstRSPPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str());
|
CPath dstRSPPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str());
|
||||||
|
dstRSPPlugin.SetName(stdstr_f("%s-copy", dstRSPPlugin.GetName().c_str()).c_str());
|
||||||
if (!dstRSPPlugin.DirectoryExists())
|
if (!dstRSPPlugin.DirectoryExists())
|
||||||
{
|
{
|
||||||
dstRSPPlugin.DirectoryCreate();
|
dstRSPPlugin.DirectoryCreate();
|
||||||
|
@ -464,6 +472,7 @@ bool CPlugins::CopyPlugins(const stdstr & DstDir) const
|
||||||
//Copy Controller Plugin
|
//Copy Controller Plugin
|
||||||
CPath srcContPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str());
|
CPath srcContPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str());
|
||||||
CPath dstContPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str());
|
CPath dstContPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str());
|
||||||
|
dstContPlugin.SetName(stdstr_f("%s-copy", dstContPlugin.GetName().c_str()).c_str());
|
||||||
if (!dstContPlugin.DirectoryExists())
|
if (!dstContPlugin.DirectoryExists())
|
||||||
{
|
{
|
||||||
dstContPlugin.DirectoryCreate();
|
dstContPlugin.DirectoryCreate();
|
||||||
|
|
|
@ -72,6 +72,14 @@ typedef struct
|
||||||
void(*FlushSettings) (void * handle);
|
void(*FlushSettings) (void * handle);
|
||||||
} PLUGIN_SETTINGS3;
|
} PLUGIN_SETTINGS3;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
typedef void(*SettingChangedFunc)(void *);
|
||||||
|
|
||||||
|
void(*RegisterChangeCB)(void * handle, int ID, void * Data, SettingChangedFunc Func);
|
||||||
|
void(*UnregisterChangeCB)(void * handle, int ID, void * Data, SettingChangedFunc Func);
|
||||||
|
} PLUGIN_SETTINGS_NOTIFICATION;
|
||||||
|
|
||||||
enum PLUGIN_TYPE
|
enum PLUGIN_TYPE
|
||||||
{
|
{
|
||||||
PLUGIN_TYPE_NONE = 0,
|
PLUGIN_TYPE_NONE = 0,
|
||||||
|
@ -111,7 +119,7 @@ class CPlugins :
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//Functions
|
//Functions
|
||||||
CPlugins(SettingID PluginDirSetting);
|
CPlugins(SettingID PluginDirSetting, bool SyncPlugins);
|
||||||
~CPlugins();
|
~CPlugins();
|
||||||
|
|
||||||
bool Initiate(CN64System * System);
|
bool Initiate(CN64System * System);
|
||||||
|
@ -164,6 +172,7 @@ private:
|
||||||
stdstr m_RSPFile;
|
stdstr m_RSPFile;
|
||||||
stdstr m_ControlFile;
|
stdstr m_ControlFile;
|
||||||
bool m_initilized;
|
bool m_initilized;
|
||||||
|
bool m_SyncPlugins;
|
||||||
};
|
};
|
||||||
|
|
||||||
//Dummy Functions
|
//Dummy Functions
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <Project64-core/N64System/SystemGlobals.h>
|
#include <Project64-core/N64System/SystemGlobals.h>
|
||||||
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
||||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
||||||
|
#include <Project64-core/N64System/N64Class.h>
|
||||||
#include "RSPPlugin.h"
|
#include "RSPPlugin.h"
|
||||||
#include "GFXPlugin.h"
|
#include "GFXPlugin.h"
|
||||||
#include <Project64-core/Plugins/AudioPlugin.h>
|
#include <Project64-core/Plugins/AudioPlugin.h>
|
||||||
|
@ -176,30 +177,33 @@ bool CRSP_Plugin::Initiate(CPlugins * Plugins, CN64System * System)
|
||||||
Info.ShowCFB = Plugins->Gfx()->ShowCFB;
|
Info.ShowCFB = Plugins->Gfx()->ShowCFB;
|
||||||
Info.ProcessAlist = Plugins->Audio()->ProcessAList;
|
Info.ProcessAlist = Plugins->Audio()->ProcessAList;
|
||||||
|
|
||||||
Info.RDRAM = g_MMU->Rdram();
|
CMipsMemoryVM & MMU = System->m_MMU_VM;
|
||||||
Info.DMEM = g_MMU->Dmem();
|
CRegisters & Reg = System->m_Reg;
|
||||||
Info.IMEM = g_MMU->Imem();
|
|
||||||
|
|
||||||
Info.MI__INTR_REG = &g_Reg->m_RspIntrReg;
|
Info.RDRAM = MMU.Rdram();
|
||||||
|
Info.DMEM = MMU.Dmem();
|
||||||
|
Info.IMEM = MMU.Imem();
|
||||||
|
|
||||||
Info.SP__MEM_ADDR_REG = &g_Reg->SP_MEM_ADDR_REG;
|
Info.MI__INTR_REG = &Reg.m_RspIntrReg;
|
||||||
Info.SP__DRAM_ADDR_REG = &g_Reg->SP_DRAM_ADDR_REG;
|
|
||||||
Info.SP__RD_LEN_REG = &g_Reg->SP_RD_LEN_REG;
|
|
||||||
Info.SP__WR_LEN_REG = &g_Reg->SP_WR_LEN_REG;
|
|
||||||
Info.SP__STATUS_REG = &g_Reg->SP_STATUS_REG;
|
|
||||||
Info.SP__DMA_FULL_REG = &g_Reg->SP_DMA_FULL_REG;
|
|
||||||
Info.SP__DMA_BUSY_REG = &g_Reg->SP_DMA_BUSY_REG;
|
|
||||||
Info.SP__PC_REG = &g_Reg->SP_PC_REG;
|
|
||||||
Info.SP__SEMAPHORE_REG = &g_Reg->SP_SEMAPHORE_REG;
|
|
||||||
|
|
||||||
Info.DPC__START_REG = &g_Reg->DPC_START_REG;
|
Info.SP__MEM_ADDR_REG = &Reg.SP_MEM_ADDR_REG;
|
||||||
Info.DPC__END_REG = &g_Reg->DPC_END_REG;
|
Info.SP__DRAM_ADDR_REG = &Reg.SP_DRAM_ADDR_REG;
|
||||||
Info.DPC__CURRENT_REG = &g_Reg->DPC_CURRENT_REG;
|
Info.SP__RD_LEN_REG = &Reg.SP_RD_LEN_REG;
|
||||||
Info.DPC__STATUS_REG = &g_Reg->DPC_STATUS_REG;
|
Info.SP__WR_LEN_REG = &Reg.SP_WR_LEN_REG;
|
||||||
Info.DPC__CLOCK_REG = &g_Reg->DPC_CLOCK_REG;
|
Info.SP__STATUS_REG = &Reg.SP_STATUS_REG;
|
||||||
Info.DPC__BUFBUSY_REG = &g_Reg->DPC_BUFBUSY_REG;
|
Info.SP__DMA_FULL_REG = &Reg.SP_DMA_FULL_REG;
|
||||||
Info.DPC__PIPEBUSY_REG = &g_Reg->DPC_PIPEBUSY_REG;
|
Info.SP__DMA_BUSY_REG = &Reg.SP_DMA_BUSY_REG;
|
||||||
Info.DPC__TMEM_REG = &g_Reg->DPC_TMEM_REG;
|
Info.SP__PC_REG = &Reg.SP_PC_REG;
|
||||||
|
Info.SP__SEMAPHORE_REG = &Reg.SP_SEMAPHORE_REG;
|
||||||
|
|
||||||
|
Info.DPC__START_REG = &Reg.DPC_START_REG;
|
||||||
|
Info.DPC__END_REG = &Reg.DPC_END_REG;
|
||||||
|
Info.DPC__CURRENT_REG = &Reg.DPC_CURRENT_REG;
|
||||||
|
Info.DPC__STATUS_REG = &Reg.DPC_STATUS_REG;
|
||||||
|
Info.DPC__CLOCK_REG = &Reg.DPC_CLOCK_REG;
|
||||||
|
Info.DPC__BUFBUSY_REG = &Reg.DPC_BUFBUSY_REG;
|
||||||
|
Info.DPC__PIPEBUSY_REG = &Reg.DPC_PIPEBUSY_REG;
|
||||||
|
Info.DPC__TMEM_REG = &Reg.DPC_TMEM_REG;
|
||||||
}
|
}
|
||||||
|
|
||||||
InitiateRSP(Info, &m_CycleCount);
|
InitiateRSP(Info, &m_CycleCount);
|
||||||
|
|
|
@ -433,6 +433,16 @@ void CSettings::FlushSettings(CSettings * /*_this*/)
|
||||||
CSettingTypeApplication::Flush();
|
CSettingTypeApplication::Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSettings::sRegisterChangeCB(CSettings * _this, SettingID Type, void * Data, SettingChangedFunc Func)
|
||||||
|
{
|
||||||
|
_this->RegisterChangeCB(Type, Data, Func);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSettings::sUnregisterChangeCB(CSettings * _this, SettingID Type, void * Data, SettingChangedFunc Func)
|
||||||
|
{
|
||||||
|
_this->UnregisterChangeCB(Type, Data, Func);
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t CSettings::GetSetting(CSettings * _this, SettingID Type)
|
uint32_t CSettings::GetSetting(CSettings * _this, SettingID Type)
|
||||||
{
|
{
|
||||||
return _this->LoadDword(Type);
|
return _this->LoadDword(Type);
|
||||||
|
@ -462,6 +472,9 @@ void CSettings::RegisterSetting(CSettings * _this, SettingID ID, SettingID Defau
|
||||||
SettingType Type, const char * Category, const char * DefaultStr,
|
SettingType Type, const char * Category, const char * DefaultStr,
|
||||||
uint32_t Value)
|
uint32_t Value)
|
||||||
{
|
{
|
||||||
|
SettingID RdbSetting;
|
||||||
|
stdstr Name;
|
||||||
|
|
||||||
switch (Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
case SettingType_ConstValue:
|
case SettingType_ConstValue:
|
||||||
|
@ -509,13 +522,11 @@ void CSettings::RegisterSetting(CSettings * _this, SettingID ID, SettingID Defau
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SettingType_GameSetting:
|
case SettingType_GameSetting:
|
||||||
{
|
Name.Format("%s-%s", Category, DefaultStr);
|
||||||
stdstr_f Name("%s-%s", Category, DefaultStr);
|
|
||||||
switch (DataType)
|
switch (DataType)
|
||||||
{
|
{
|
||||||
case Data_DWORD:
|
case Data_DWORD:
|
||||||
{
|
RdbSetting = (SettingID)_this->m_NextAutoSettingId;
|
||||||
SettingID RdbSetting = (SettingID)_this->m_NextAutoSettingId;
|
|
||||||
_this->m_NextAutoSettingId += 1;
|
_this->m_NextAutoSettingId += 1;
|
||||||
if (DefaultID == Default_None)
|
if (DefaultID == Default_None)
|
||||||
{
|
{
|
||||||
|
@ -527,11 +538,9 @@ void CSettings::RegisterSetting(CSettings * _this, SettingID ID, SettingID Defau
|
||||||
_this->AddHandler(RdbSetting, new CSettingTypeRomDatabase(Name.c_str(), DefaultID));
|
_this->AddHandler(RdbSetting, new CSettingTypeRomDatabase(Name.c_str(), DefaultID));
|
||||||
_this->AddHandler(ID, new CSettingTypeGame(Name.c_str(), RdbSetting));
|
_this->AddHandler(ID, new CSettingTypeGame(Name.c_str(), RdbSetting));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case Data_String:
|
case Data_String:
|
||||||
{
|
RdbSetting = (SettingID)_this->m_NextAutoSettingId;
|
||||||
SettingID RdbSetting = (SettingID)_this->m_NextAutoSettingId;
|
|
||||||
_this->m_NextAutoSettingId += 1;
|
_this->m_NextAutoSettingId += 1;
|
||||||
if (DefaultID == Default_None)
|
if (DefaultID == Default_None)
|
||||||
{
|
{
|
||||||
|
@ -543,12 +552,10 @@ void CSettings::RegisterSetting(CSettings * _this, SettingID ID, SettingID Defau
|
||||||
_this->AddHandler(RdbSetting, new CSettingTypeRomDatabase(Name.c_str(), DefaultID));
|
_this->AddHandler(RdbSetting, new CSettingTypeRomDatabase(Name.c_str(), DefaultID));
|
||||||
_this->AddHandler(ID, new CSettingTypeGame(Name.c_str(), RdbSetting));
|
_this->AddHandler(ID, new CSettingTypeGame(Name.c_str(), RdbSetting));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case SettingType_RomDatabase:
|
case SettingType_RomDatabase:
|
||||||
switch (DataType)
|
switch (DataType)
|
||||||
|
|
|
@ -101,6 +101,8 @@ public:
|
||||||
uint32_t Value);
|
uint32_t Value);
|
||||||
static uint32_t FindSetting(CSettings * _this, const char * Name);
|
static uint32_t FindSetting(CSettings * _this, const char * Name);
|
||||||
static void FlushSettings(CSettings * _this);
|
static void FlushSettings(CSettings * _this);
|
||||||
|
static void sRegisterChangeCB(CSettings * _this, SettingID Type, void * Data, SettingChangedFunc Func);
|
||||||
|
static void sUnregisterChangeCB(CSettings * _this, SettingID Type, void * Data, SettingChangedFunc Func);
|
||||||
|
|
||||||
//Notification
|
//Notification
|
||||||
void NotifyCallBacks(SettingID Type);
|
void NotifyCallBacks(SettingID Type);
|
||||||
|
|
|
@ -64,9 +64,18 @@ typedef struct
|
||||||
void(*FlushSettings) (void * handle);
|
void(*FlushSettings) (void * handle);
|
||||||
} PLUGIN_SETTINGS3;
|
} PLUGIN_SETTINGS3;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
typedef void(*SettingChangedFunc)(void *);
|
||||||
|
|
||||||
|
void(*RegisterChangeCB)(void * handle, int ID, void * Data, SettingChangedFunc Func);
|
||||||
|
void(*UnregisterChangeCB)(void * handle, int ID, void * Data, SettingChangedFunc Func);
|
||||||
|
} PLUGIN_SETTINGS_NOTIFICATION;
|
||||||
|
|
||||||
static PLUGIN_SETTINGS g_PluginSettings;
|
static PLUGIN_SETTINGS g_PluginSettings;
|
||||||
static PLUGIN_SETTINGS2 g_PluginSettings2;
|
static PLUGIN_SETTINGS2 g_PluginSettings2;
|
||||||
static PLUGIN_SETTINGS3 g_PluginSettings3;
|
static PLUGIN_SETTINGS3 g_PluginSettings3;
|
||||||
|
static PLUGIN_SETTINGS_NOTIFICATION g_PluginSettingsNotification;
|
||||||
static bool g_PluginInitilized = false;
|
static bool g_PluginInitilized = false;
|
||||||
static char g_PluginSettingName[300];
|
static char g_PluginSettingName[300];
|
||||||
|
|
||||||
|
@ -91,6 +100,11 @@ EXPORT void SetSettingInfo3(PLUGIN_SETTINGS3 * info)
|
||||||
g_PluginSettings3 = *info;
|
g_PluginSettings3 = *info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EXPORT void SetSettingNotificationInfo(PLUGIN_SETTINGS_NOTIFICATION * info)
|
||||||
|
{
|
||||||
|
g_PluginSettingsNotification = *info;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t SettingsInitilized(void)
|
int32_t SettingsInitilized(void)
|
||||||
{
|
{
|
||||||
return g_PluginInitilized;
|
return g_PluginInitilized;
|
||||||
|
@ -276,3 +290,19 @@ void SetSettingSz(short SettingID, const char * Value)
|
||||||
{
|
{
|
||||||
g_PluginSettings.SetSettingSz(g_PluginSettings.handle, SettingID + g_PluginSettings.SettingStartRange, Value);
|
g_PluginSettings.SetSettingSz(g_PluginSettings.handle, SettingID + g_PluginSettings.SettingStartRange, Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsRegisterChange(bool SystemSetting, int SettingID, void * Data, SettingChangedFunc Func)
|
||||||
|
{
|
||||||
|
if (g_PluginSettingsNotification.RegisterChangeCB && g_PluginSettings.handle)
|
||||||
|
{
|
||||||
|
g_PluginSettingsNotification.RegisterChangeCB(g_PluginSettings.handle, SettingID + (SystemSetting ? 0 : g_PluginSettings.SettingStartRange), Data, Func);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsUnregisterChange(bool SystemSetting, int SettingID, void * Data, SettingChangedFunc Func)
|
||||||
|
{
|
||||||
|
if (g_PluginSettingsNotification.UnregisterChangeCB && g_PluginSettings.handle)
|
||||||
|
{
|
||||||
|
g_PluginSettingsNotification.UnregisterChangeCB(g_PluginSettings.handle, SettingID + (SystemSetting ? 0 : g_PluginSettings.SettingStartRange), Data, Func);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -41,6 +41,10 @@ extern "C" {
|
||||||
// this must be implemented to be notified when a setting is used but has not been set up
|
// this must be implemented to be notified when a setting is used but has not been set up
|
||||||
void UseUnregisteredSetting(int SettingID);
|
void UseUnregisteredSetting(int SettingID);
|
||||||
|
|
||||||
|
typedef void(*SettingChangedFunc)(void *);
|
||||||
|
void SettingsRegisterChange(bool SystemSetting, int Type, void * Data, SettingChangedFunc Func);
|
||||||
|
void SettingsUnregisterChange(bool SystemSetting, int Type, void * Data, SettingChangedFunc Func);
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue