mirror of https://github.com/PCSX2/pcsx2.git
FW: merge into core, simplify setup and config
This commit is contained in:
parent
4a3e67d143
commit
385c698212
|
@ -593,14 +593,6 @@ extern _USBirqHandler USBirqHandler;
|
|||
extern _USBsetRAM USBsetRAM;
|
||||
#endif
|
||||
|
||||
// FW
|
||||
#ifndef BUILTIN_FW_PLUGIN
|
||||
extern _FWopen FWopen;
|
||||
extern _FWread32 FWread32;
|
||||
extern _FWwrite32 FWwrite32;
|
||||
extern _FWirqCallback FWirqCallback;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
132
pcsx2/FW.cpp
132
pcsx2/FW.cpp
|
@ -18,109 +18,30 @@
|
|||
using namespace std;
|
||||
|
||||
#include "FW.h"
|
||||
#include "svnrev.h"
|
||||
#include "null/config.inl"
|
||||
|
||||
const u8 version = PS2E_FW_VERSION;
|
||||
const u8 revision = 0;
|
||||
const u8 build = 7; // increase that with each version
|
||||
|
||||
static char libraryName[256];
|
||||
|
||||
string s_strIniPath = "inis";
|
||||
string s_strLogPath = "logs";
|
||||
|
||||
u8 phyregs[16];
|
||||
s8 *fwregs;
|
||||
|
||||
void (*FWirq)();
|
||||
|
||||
EXPORT_C_(void)
|
||||
FWconfigure()
|
||||
s32 FWopen()
|
||||
{
|
||||
const std::string ini_path = s_strIniPath + "/FWnull.ini";
|
||||
LoadConfig(ini_path);
|
||||
ConfigureLogging();
|
||||
SaveConfig(ini_path);
|
||||
}
|
||||
|
||||
void LogInit()
|
||||
{
|
||||
const std::string LogFile(s_strLogPath + "/FWnull.log");
|
||||
g_plugin_log.Open(LogFile);
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
FWsetLogDir(const char *dir)
|
||||
{
|
||||
// Get the path to the log directory.
|
||||
s_strLogPath = (dir == NULL) ? "logs" : dir;
|
||||
|
||||
// Reload the log file after updated the path
|
||||
g_plugin_log.Close();
|
||||
LogInit();
|
||||
}
|
||||
|
||||
EXPORT_C_(u32)
|
||||
PS2EgetLibType()
|
||||
{
|
||||
return PS2E_LT_FW;
|
||||
}
|
||||
|
||||
EXPORT_C_(const char *)
|
||||
PS2EgetLibName()
|
||||
{
|
||||
snprintf(libraryName, 255, "FWnull Driver %lld%s", SVN_REV, SVN_MODS ? "m" : "");
|
||||
return libraryName;
|
||||
}
|
||||
|
||||
EXPORT_C_(u32)
|
||||
PS2EgetLibVersion2(u32 type)
|
||||
{
|
||||
return (version << 16) | (revision << 8) | build;
|
||||
}
|
||||
|
||||
EXPORT_C_(s32)
|
||||
FWinit()
|
||||
{
|
||||
LoadConfig(s_strIniPath + "/FWnull.ini");
|
||||
LogInit();
|
||||
g_plugin_log.WriteLn("FWnull plugin version %d,%d", revision, build);
|
||||
g_plugin_log.WriteLn("Initializing FWnull");
|
||||
|
||||
memset(phyregs, 0, sizeof(phyregs));
|
||||
// Initializing our registers.
|
||||
fwregs = (s8 *)calloc(0x10000, 1);
|
||||
if (fwregs == NULL) {
|
||||
g_plugin_log.Message("Error allocating Memory");
|
||||
DevCon.WriteLn("FW: Error allocating Memory");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
FWshutdown()
|
||||
void FWclose()
|
||||
{
|
||||
// Freeing the registers.
|
||||
free(fwregs);
|
||||
fwregs = NULL;
|
||||
|
||||
g_plugin_log.Close();
|
||||
}
|
||||
|
||||
EXPORT_C_(s32)
|
||||
FWopen(void *pDsp)
|
||||
{
|
||||
g_plugin_log.WriteLn("Opening FWnull.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
FWclose()
|
||||
{
|
||||
// Close the plugin.
|
||||
g_plugin_log.WriteLn("Closing FWnull.");
|
||||
}
|
||||
|
||||
void PHYWrite()
|
||||
|
@ -147,8 +68,8 @@ void PHYRead()
|
|||
FWirq();
|
||||
}
|
||||
}
|
||||
EXPORT_C_(u32)
|
||||
FWread32(u32 addr)
|
||||
|
||||
u32 FWread32(u32 addr)
|
||||
{
|
||||
u32 ret = 0;
|
||||
|
||||
|
@ -179,13 +100,12 @@ FWread32(u32 addr)
|
|||
break;
|
||||
}
|
||||
|
||||
g_plugin_log.WriteLn("FW read mem 0x%x: 0x%x", addr, ret);
|
||||
DevCon.WriteLn("FW: read mem 0x%x: 0x%x", addr, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
FWwrite32(u32 addr, u32 value)
|
||||
void FWwrite32(u32 addr, u32 value)
|
||||
{
|
||||
switch (addr) {
|
||||
// Include other memory locations we want to catch here.
|
||||
|
@ -268,45 +188,11 @@ FWwrite32(u32 addr, u32 value)
|
|||
fwRu32(addr) = value;
|
||||
break;
|
||||
}
|
||||
g_plugin_log.WriteLn("FW write mem 0x%x: 0x%x", addr, value);
|
||||
DevCon.WriteLn("FW: write mem 0x%x: 0x%x", addr, value);
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
FWirqCallback(void (*callback)())
|
||||
void FWirqCallback(void (*callback)())
|
||||
{
|
||||
// Register FWirq, so we can trigger an interrupt with it later.
|
||||
FWirq = callback;
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
FWsetSettingsDir(const char *dir)
|
||||
{
|
||||
// Find out from pcsx2 where we are supposed to put our ini file.
|
||||
s_strIniPath = (dir == NULL) ? "inis" : dir;
|
||||
}
|
||||
|
||||
EXPORT_C_(s32)
|
||||
FWfreeze(int mode, freezeData *data)
|
||||
{
|
||||
// This should store or retrieve any information, for if emulation
|
||||
// gets suspended, or for savestates.
|
||||
switch (mode) {
|
||||
case FREEZE_LOAD:
|
||||
// Load previously saved data.
|
||||
break;
|
||||
case FREEZE_SAVE:
|
||||
// Save data.
|
||||
break;
|
||||
case FREEZE_SIZE:
|
||||
// return the size of the data.
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_C_(s32)
|
||||
FWtest()
|
||||
{
|
||||
// 0 if the plugin works, non-0 if it doesn't.
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#define FWdefs
|
||||
#include "PS2Edefs.h"
|
||||
#include "PS2Eext.h"
|
||||
|
||||
// Our main memory storage, and defines for accessing it.
|
||||
extern s8 *fwregs;
|
||||
|
@ -31,3 +29,10 @@ extern s8 *fwregs;
|
|||
|
||||
extern void (*FWirq)();
|
||||
|
||||
s32 FWopen();
|
||||
void FWclose();
|
||||
void PHYWrite();
|
||||
void PHYRead();
|
||||
u32 FWread32(u32 addr);
|
||||
void FWwrite32(u32 addr, u32 value);
|
||||
void FWirqCallback(void (*callback)());
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "SysThreads.h"
|
||||
#include "MTVU.h"
|
||||
#include "IPC.h"
|
||||
#include "FW.h"
|
||||
|
||||
#include "../DebugTools/MIPSAnalyst.h"
|
||||
#include "../DebugTools/SymbolMap.h"
|
||||
|
@ -288,14 +289,14 @@ void SysCoreThread::OnSuspendInThread()
|
|||
{
|
||||
GetCorePlugins().Close();
|
||||
DoCDVDclose();
|
||||
DoFWclose();
|
||||
FWclose();
|
||||
}
|
||||
|
||||
void SysCoreThread::OnResumeInThread( bool isSuspended )
|
||||
{
|
||||
GetCorePlugins().Open();
|
||||
DoCDVDopen();
|
||||
DoFWopen();
|
||||
FWopen();
|
||||
}
|
||||
|
||||
|
||||
|
@ -311,7 +312,7 @@ void SysCoreThread::OnCleanupInThread()
|
|||
// FIXME: temporary workaround for deadlock on exit, which actually should be a crash
|
||||
vu1Thread.WaitVU();
|
||||
DoCDVDclose();
|
||||
DoFWclose();
|
||||
FWclose();
|
||||
GetCorePlugins().Close();
|
||||
GetCorePlugins().Shutdown();
|
||||
|
||||
|
|
|
@ -432,7 +432,6 @@ void MainEmuFrame::CreateConfigMenu()
|
|||
m_menuConfig.Append(MenuId_Config_PAD, _("&Controllers (PAD)"),m_PluginMenuPacks[PluginId_PAD]);
|
||||
m_menuConfig.Append(MenuId_Config_DEV9, _("&Dev9"), m_PluginMenuPacks[PluginId_DEV9]);
|
||||
m_menuConfig.Append(MenuId_Config_USB, _("&USB"), m_PluginMenuPacks[PluginId_USB]);
|
||||
m_menuConfig.Append(MenuId_Config_FireWire, _("&Firewire"), m_PluginMenuPacks[PluginId_FW]);
|
||||
|
||||
m_menuConfig.AppendSeparator();
|
||||
m_menuConfig.Append(MenuId_Config_Multitap0Toggle, _("Multitap &1"), wxEmptyString, wxITEM_CHECK );
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "Sif.h"
|
||||
#include "Sio.h"
|
||||
#include "CDVD/CdRom.h"
|
||||
#include "FW.h"
|
||||
|
||||
#include "ps2/pgif.h"
|
||||
#include "Mdec.h"
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "IopHw_Internal.h"
|
||||
#include "Sif.h"
|
||||
#include "Sio.h"
|
||||
#include "FW.h"
|
||||
#include "CDVD/CdRom.h"
|
||||
|
||||
#include "ps2/pgif.h"
|
||||
|
|
Loading…
Reference in New Issue