diff --git a/common/include/PS2Edefs.h b/common/include/PS2Edefs.h index bcde173aec..e958d6be9e 100644 --- a/common/include/PS2Edefs.h +++ b/common/include/PS2Edefs.h @@ -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 diff --git a/pcsx2/FW.cpp b/pcsx2/FW.cpp index 8ef87a9a3e..91a8d1ee68 100644 --- a/pcsx2/FW.cpp +++ b/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; -} diff --git a/pcsx2/FW.h b/pcsx2/FW.h index c64861da49..9f47f02875 100644 --- a/pcsx2/FW.h +++ b/pcsx2/FW.h @@ -18,8 +18,6 @@ #include #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)()); diff --git a/pcsx2/System/SysCoreThread.cpp b/pcsx2/System/SysCoreThread.cpp index 09c922dea4..95243b868c 100644 --- a/pcsx2/System/SysCoreThread.cpp +++ b/pcsx2/System/SysCoreThread.cpp @@ -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(); diff --git a/pcsx2/gui/MainFrame.cpp b/pcsx2/gui/MainFrame.cpp index 85b8202f35..73c54b25e3 100644 --- a/pcsx2/gui/MainFrame.cpp +++ b/pcsx2/gui/MainFrame.cpp @@ -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 ); diff --git a/pcsx2/ps2/Iop/IopHwRead.cpp b/pcsx2/ps2/Iop/IopHwRead.cpp index aa645b6aed..8a4ebe638e 100644 --- a/pcsx2/ps2/Iop/IopHwRead.cpp +++ b/pcsx2/ps2/Iop/IopHwRead.cpp @@ -19,6 +19,7 @@ #include "Sif.h" #include "Sio.h" #include "CDVD/CdRom.h" +#include "FW.h" #include "ps2/pgif.h" #include "Mdec.h" diff --git a/pcsx2/ps2/Iop/IopHwWrite.cpp b/pcsx2/ps2/Iop/IopHwWrite.cpp index 75c9006b22..49a1d1aca9 100644 --- a/pcsx2/ps2/Iop/IopHwWrite.cpp +++ b/pcsx2/ps2/Iop/IopHwWrite.cpp @@ -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"