mirror of https://github.com/PCSX2/pcsx2.git
dev9null|fwnull|usbnull: Switch to new null config code
This commit is contained in:
parent
9d4f8a322c
commit
fb7c2c1837
|
@ -12,12 +12,10 @@ set(FWnullFinalFlags "")
|
|||
|
||||
# FWnull sources
|
||||
set(FWnullSources
|
||||
Config.cpp
|
||||
FW.cpp)
|
||||
|
||||
# FWnull headers
|
||||
set(FWnullHeaders
|
||||
Config.h
|
||||
FW.h)
|
||||
|
||||
# FWnull Linux sources
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
/* FWnull
|
||||
* Copyright (C) 2004-2009 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
#include "FW.h"
|
||||
#include "Config.h"
|
||||
|
||||
extern string s_strIniPath;
|
||||
extern PluginLog FWLog;
|
||||
PluginConf Ini;
|
||||
|
||||
void setLoggingState()
|
||||
{
|
||||
if (conf.Log) {
|
||||
FWLog.WriteToConsole = true;
|
||||
FWLog.WriteToFile = true;
|
||||
} else {
|
||||
FWLog.WriteToConsole = false;
|
||||
FWLog.WriteToFile = false;
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
FWconfigure()
|
||||
{
|
||||
LoadConfig();
|
||||
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
void LoadConfig()
|
||||
{
|
||||
string IniPath = s_strIniPath + "/FWnull.ini";
|
||||
if (!Ini.Open(IniPath, READ_FILE)) {
|
||||
FWLog.WriteLn("Failed to open %s", IniPath.c_str());
|
||||
SaveConfig();
|
||||
return;
|
||||
}
|
||||
|
||||
conf.Log = Ini.ReadInt("logging", 0);
|
||||
setLoggingState();
|
||||
Ini.Close();
|
||||
}
|
||||
|
||||
void SaveConfig()
|
||||
{
|
||||
string IniPath = s_strIniPath + "/FWnull.ini";
|
||||
if (!Ini.Open(IniPath, WRITE_FILE)) {
|
||||
FWLog.WriteLn("Failed to open %s\n", IniPath.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
Ini.WriteInt("logging", conf.Log);
|
||||
Ini.Close();
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
/* FWnull
|
||||
* Copyright (C) 2004-2010 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
void SaveConf();
|
||||
void LoadConf();
|
||||
void SysMessage(const char *fmt, ...);
|
||||
|
||||
#define is_checked(main_widget, widget_name) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name))))
|
||||
#define set_checked(main_widget, widget_name, state) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)), state)
|
|
@ -22,6 +22,7 @@ using namespace std;
|
|||
|
||||
#include "FW.h"
|
||||
#include "svnrev.h"
|
||||
#include "null/config.inl"
|
||||
|
||||
const u8 version = PS2E_FW_VERSION;
|
||||
const u8 revision = 0;
|
||||
|
@ -34,16 +35,22 @@ string s_strLogPath = "logs";
|
|||
|
||||
u8 phyregs[16];
|
||||
s8 *fwregs;
|
||||
Config conf;
|
||||
PluginLog FWLog;
|
||||
|
||||
void (*FWirq)();
|
||||
|
||||
EXPORT_C_(void)
|
||||
FWconfigure()
|
||||
{
|
||||
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");
|
||||
setLoggingState();
|
||||
FWLog.Open(LogFile);
|
||||
g_plugin_log.Open(LogFile);
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
|
@ -53,7 +60,7 @@ FWsetLogDir(const char *dir)
|
|||
s_strLogPath = (dir == NULL) ? "logs" : dir;
|
||||
|
||||
// Reload the log file after updated the path
|
||||
FWLog.Close();
|
||||
g_plugin_log.Close();
|
||||
LogInit();
|
||||
}
|
||||
|
||||
|
@ -79,16 +86,16 @@ PS2EgetLibVersion2(u32 type)
|
|||
EXPORT_C_(s32)
|
||||
FWinit()
|
||||
{
|
||||
LoadConfig();
|
||||
LoadConfig(s_strIniPath + "/FWnull.ini");
|
||||
LogInit();
|
||||
FWLog.WriteLn("FWnull plugin version %d,%d", revision, build);
|
||||
FWLog.WriteLn("Initializing FWnull");
|
||||
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) {
|
||||
FWLog.Message("Error allocating Memory");
|
||||
g_plugin_log.Message("Error allocating Memory");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -101,13 +108,13 @@ FWshutdown()
|
|||
free(fwregs);
|
||||
fwregs = NULL;
|
||||
|
||||
FWLog.Close();
|
||||
g_plugin_log.Close();
|
||||
}
|
||||
|
||||
EXPORT_C_(s32)
|
||||
FWopen(void *pDsp)
|
||||
{
|
||||
FWLog.WriteLn("Opening FWnull.");
|
||||
g_plugin_log.WriteLn("Opening FWnull.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -116,7 +123,7 @@ EXPORT_C_(void)
|
|||
FWclose()
|
||||
{
|
||||
// Close the plugin.
|
||||
FWLog.WriteLn("Closing FWnull.");
|
||||
g_plugin_log.WriteLn("Closing FWnull.");
|
||||
}
|
||||
|
||||
void PHYWrite()
|
||||
|
@ -175,7 +182,7 @@ FWread32(u32 addr)
|
|||
break;
|
||||
}
|
||||
|
||||
FWLog.WriteLn("FW read mem 0x%x: 0x%x", addr, ret);
|
||||
g_plugin_log.WriteLn("FW read mem 0x%x: 0x%x", addr, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -264,7 +271,7 @@ FWwrite32(u32 addr, u32 value)
|
|||
fwRu32(addr) = value;
|
||||
break;
|
||||
}
|
||||
FWLog.WriteLn("FW write mem 0x%x: 0x%x", addr, value);
|
||||
g_plugin_log.WriteLn("FW write mem 0x%x: 0x%x", addr, value);
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
|
|
|
@ -30,17 +30,6 @@ extern s8 *fwregs;
|
|||
//PHY Access Address for ease of use :P
|
||||
#define PHYACC fwRu32(0x8414)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
s32 Log;
|
||||
} Config;
|
||||
|
||||
extern Config conf;
|
||||
|
||||
extern void (*FWirq)();
|
||||
|
||||
extern void SaveConfig();
|
||||
extern void LoadConfig();
|
||||
extern void setLoggingState();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -52,16 +52,17 @@
|
|||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Config.cpp" />
|
||||
<ClCompile Include="..\FW.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\FW.h" />
|
||||
<ClInclude Include="..\Config.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="FireWireNull.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\..\common\include\null\null.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets" />
|
||||
</Project>
|
||||
|
|
|
@ -15,9 +15,6 @@
|
|||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Config.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\FW.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -26,13 +23,15 @@
|
|||
<ClInclude Include="..\FW.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="FireWireNull.def">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\..\common\include\null\null.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -12,12 +12,10 @@ set(USBnullFinalFlags "")
|
|||
|
||||
# USBnull sources
|
||||
set(USBnullSources
|
||||
Config.cpp
|
||||
USB.cpp)
|
||||
|
||||
# USBnull headers
|
||||
set(USBnullHeaders
|
||||
Config.h
|
||||
USB.h)
|
||||
|
||||
# USBnull Linux sources
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
/* USBnull
|
||||
* Copyright (C) 2002-2010 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
#include "USB.h"
|
||||
#include "Config.h"
|
||||
|
||||
extern string s_strIniPath;
|
||||
extern PluginLog USBLog;
|
||||
PluginConf Ini;
|
||||
|
||||
void setLoggingState()
|
||||
{
|
||||
if (conf.Log) {
|
||||
USBLog.WriteToConsole = true;
|
||||
USBLog.WriteToFile = true;
|
||||
} else {
|
||||
USBLog.WriteToConsole = false;
|
||||
USBLog.WriteToFile = false;
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
USBconfigure()
|
||||
{
|
||||
LoadConfig();
|
||||
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
void LoadConfig()
|
||||
{
|
||||
string IniPath = s_strIniPath + "/USBnull.ini";
|
||||
if (!Ini.Open(IniPath, READ_FILE)) {
|
||||
USBLog.WriteLn("Failed to open %s", IniPath.c_str());
|
||||
SaveConfig();
|
||||
return;
|
||||
}
|
||||
|
||||
conf.Log = Ini.ReadInt("logging", 0);
|
||||
setLoggingState();
|
||||
Ini.Close();
|
||||
}
|
||||
|
||||
void SaveConfig()
|
||||
{
|
||||
string IniPath = s_strIniPath + "/USBnull.ini";
|
||||
if (!Ini.Open(IniPath, WRITE_FILE)) {
|
||||
USBLog.WriteLn("Failed to open %s", IniPath.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
Ini.WriteInt("logging", conf.Log);
|
||||
Ini.Close();
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
/* USBnull
|
||||
* Copyright (C) 2002-2010 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
extern void SaveConfig();
|
||||
extern void LoadConfig();
|
|
@ -18,6 +18,8 @@
|
|||
using namespace std;
|
||||
#include "svnrev.h"
|
||||
#include "USB.h"
|
||||
#include "null/config.inl"
|
||||
|
||||
string s_strIniPath = "inis";
|
||||
string s_strLogPath = "logs";
|
||||
|
||||
|
@ -28,16 +30,22 @@ const unsigned char build = 7; // increase that with each version
|
|||
static char libraryName[256];
|
||||
|
||||
USBcallback USBirq;
|
||||
Config conf;
|
||||
PluginLog USBLog;
|
||||
|
||||
s8 *usbregs, *ram;
|
||||
|
||||
EXPORT_C_(void)
|
||||
USBconfigure()
|
||||
{
|
||||
const std::string ini_path = s_strIniPath + "/USBnull.ini";
|
||||
LoadConfig(ini_path);
|
||||
ConfigureLogging();
|
||||
SaveConfig(ini_path);
|
||||
}
|
||||
|
||||
void LogInit()
|
||||
{
|
||||
const std::string LogFile(s_strLogPath + "/USBnull.log");
|
||||
setLoggingState();
|
||||
USBLog.Open(LogFile);
|
||||
g_plugin_log.Open(LogFile);
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
|
@ -47,7 +55,7 @@ USBsetLogDir(const char *dir)
|
|||
s_strLogPath = (dir == NULL) ? "logs" : dir;
|
||||
|
||||
// Reload the log file after updated the path
|
||||
USBLog.Close();
|
||||
g_plugin_log.Close();
|
||||
LogInit();
|
||||
}
|
||||
|
||||
|
@ -73,16 +81,16 @@ PS2EgetLibVersion2(u32 type)
|
|||
EXPORT_C_(s32)
|
||||
USBinit()
|
||||
{
|
||||
LoadConfig();
|
||||
LoadConfig(s_strIniPath + "/USBnull.ini");
|
||||
LogInit();
|
||||
USBLog.WriteLn("USBnull plugin version %d,%d", revision, build);
|
||||
USBLog.WriteLn("Initializing USBnull");
|
||||
g_plugin_log.WriteLn("USBnull plugin version %d,%d", revision, build);
|
||||
g_plugin_log.WriteLn("Initializing USBnull");
|
||||
|
||||
// Initialize memory structures here.
|
||||
usbregs = (s8 *)calloc(0x10000, 1);
|
||||
|
||||
if (usbregs == NULL) {
|
||||
USBLog.Message("Error allocating memory");
|
||||
g_plugin_log.Message("Error allocating memory");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -94,7 +102,7 @@ USBshutdown()
|
|||
{
|
||||
// Yes, we close things in the Shutdown routine, and
|
||||
// don't do anything in the close routine.
|
||||
USBLog.Close();
|
||||
g_plugin_log.Close();
|
||||
|
||||
free(usbregs);
|
||||
usbregs = NULL;
|
||||
|
@ -103,7 +111,7 @@ USBshutdown()
|
|||
EXPORT_C_(s32)
|
||||
USBopen(void *pDsp)
|
||||
{
|
||||
USBLog.WriteLn("Opening USBnull.");
|
||||
g_plugin_log.WriteLn("Opening USBnull.");
|
||||
|
||||
// Take care of anything else we need on opening, other then initialization.
|
||||
return 0;
|
||||
|
@ -112,7 +120,7 @@ USBopen(void *pDsp)
|
|||
EXPORT_C_(void)
|
||||
USBclose()
|
||||
{
|
||||
USBLog.WriteLn("Closing USBnull.");
|
||||
g_plugin_log.WriteLn("Closing USBnull.");
|
||||
}
|
||||
|
||||
// Note: actually uncommenting the read/write functions I provided here
|
||||
|
@ -125,12 +133,12 @@ USBread8(u32 addr)
|
|||
switch (addr) {
|
||||
// Handle any appropriate addresses here.
|
||||
case 0x1f801600:
|
||||
USBLog.WriteLn("(USBnull) 8 bit read at address %lx", addr);
|
||||
g_plugin_log.WriteLn("(USBnull) 8 bit read at address %lx", addr);
|
||||
break;
|
||||
|
||||
default:
|
||||
//value = usbRu8(addr);
|
||||
USBLog.WriteLn("*(USBnull) 8 bit read at address %lx", addr);
|
||||
g_plugin_log.WriteLn("*(USBnull) 8 bit read at address %lx", addr);
|
||||
break;
|
||||
}
|
||||
return value;
|
||||
|
@ -144,12 +152,12 @@ USBread16(u32 addr)
|
|||
switch (addr) {
|
||||
// Handle any appropriate addresses here.
|
||||
case 0x1f801600:
|
||||
USBLog.WriteLn("(USBnull) 16 bit read at address %lx", addr);
|
||||
g_plugin_log.WriteLn("(USBnull) 16 bit read at address %lx", addr);
|
||||
break;
|
||||
|
||||
default:
|
||||
//value = usbRu16(addr);
|
||||
USBLog.WriteLn("(USBnull) 16 bit read at address %lx", addr);
|
||||
g_plugin_log.WriteLn("(USBnull) 16 bit read at address %lx", addr);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -162,12 +170,12 @@ USBread32(u32 addr)
|
|||
switch (addr) {
|
||||
// Handle any appropriate addresses here.
|
||||
case 0x1f801600:
|
||||
USBLog.WriteLn("(USBnull) 32 bit read at address %lx", addr);
|
||||
g_plugin_log.WriteLn("(USBnull) 32 bit read at address %lx", addr);
|
||||
break;
|
||||
|
||||
default:
|
||||
//value = usbRu32(addr);
|
||||
USBLog.WriteLn("(USBnull) 32 bit read at address %lx", addr);
|
||||
g_plugin_log.WriteLn("(USBnull) 32 bit read at address %lx", addr);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -178,12 +186,12 @@ USBwrite8(u32 addr, u8 value)
|
|||
switch (addr) {
|
||||
// Handle any appropriate addresses here.
|
||||
case 0x1f801600:
|
||||
USBLog.WriteLn("(USBnull) 8 bit write at address %lx value %x", addr, value);
|
||||
g_plugin_log.WriteLn("(USBnull) 8 bit write at address %lx value %x", addr, value);
|
||||
break;
|
||||
|
||||
default:
|
||||
//usbRu8(addr) = value;
|
||||
USBLog.WriteLn("(USBnull) 8 bit write at address %lx value %x", addr, value);
|
||||
g_plugin_log.WriteLn("(USBnull) 8 bit write at address %lx value %x", addr, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,12 +201,12 @@ USBwrite16(u32 addr, u16 value)
|
|||
switch (addr) {
|
||||
// Handle any appropriate addresses here.
|
||||
case 0x1f801600:
|
||||
USBLog.WriteLn("(USBnull) 16 bit write at address %lx value %x", addr, value);
|
||||
g_plugin_log.WriteLn("(USBnull) 16 bit write at address %lx value %x", addr, value);
|
||||
break;
|
||||
|
||||
default:
|
||||
//usbRu16(addr) = value;
|
||||
USBLog.WriteLn("(USBnull) 16 bit write at address %lx value %x", addr, value);
|
||||
g_plugin_log.WriteLn("(USBnull) 16 bit write at address %lx value %x", addr, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,12 +216,12 @@ USBwrite32(u32 addr, u32 value)
|
|||
switch (addr) {
|
||||
// Handle any appropriate addresses here.
|
||||
case 0x1f801600:
|
||||
USBLog.WriteLn("(USBnull) 16 bit write at address %lx value %x", addr, value);
|
||||
g_plugin_log.WriteLn("(USBnull) 16 bit write at address %lx value %x", addr, value);
|
||||
break;
|
||||
|
||||
default:
|
||||
//usbRu32(addr) = value;
|
||||
USBLog.WriteLn("(USBnull) 32 bit write at address %lx value %x", addr, value);
|
||||
g_plugin_log.WriteLn("(USBnull) 32 bit write at address %lx value %x", addr, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -245,7 +253,7 @@ EXPORT_C_(void)
|
|||
USBsetRAM(void *mem)
|
||||
{
|
||||
ram = (s8 *)mem;
|
||||
USBLog.WriteLn("*Setting ram.");
|
||||
g_plugin_log.WriteLn("*Setting ram.");
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
|
@ -287,6 +295,3 @@ USBtest()
|
|||
// 0 if the plugin works, non-0 if it doesn't.
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* For operating systems that need an entry point for a dll/library, here it is. Defined in PS2Eext.h. */
|
||||
ENTRY_POINT;
|
||||
|
|
|
@ -22,13 +22,7 @@
|
|||
#include "PS2Edefs.h"
|
||||
#include "PS2Eext.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int Log;
|
||||
} Config;
|
||||
|
||||
extern USBcallback USBirq;
|
||||
extern Config conf;
|
||||
|
||||
// Previous USB plugins have needed this in ohci.
|
||||
static const s64 PSXCLK = 36864000; /* 36.864 Mhz */
|
||||
|
@ -42,8 +36,4 @@ extern s8 *usbregs, *ram;
|
|||
#define usbRu16(mem) (*(u16 *)&usbregs[(mem)&0xffff])
|
||||
#define usbRu32(mem) (*(u32 *)&usbregs[(mem)&0xffff])
|
||||
|
||||
extern void SaveConfig();
|
||||
extern void LoadConfig();
|
||||
extern void setLoggingState();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -52,16 +52,17 @@
|
|||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Config.cpp" />
|
||||
<ClCompile Include="..\USB.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Config.h" />
|
||||
<ClInclude Include="..\USB.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="USBnull.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\..\common\include\null\null.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets" />
|
||||
</Project>
|
||||
|
|
|
@ -15,17 +15,11 @@
|
|||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Config.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\USB.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\USB.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -35,4 +29,9 @@
|
|||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\..\common\include\null\null.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -12,12 +12,10 @@ set(dev9nullFinalFlags "")
|
|||
|
||||
# dev9null sources
|
||||
set(dev9nullSources
|
||||
Config.cpp
|
||||
DEV9.cpp)
|
||||
|
||||
# dev9null headers
|
||||
set(dev9nullHeaders
|
||||
Config.h
|
||||
DEV9.h)
|
||||
|
||||
# dev9null Linux sources
|
||||
|
|
|
@ -1,71 +0,0 @@
|
|||
/* DEV9null
|
||||
* Copyright (C) 2002-2010 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
#include "Config.h"
|
||||
#include "DEV9.h"
|
||||
|
||||
extern string s_strIniPath;
|
||||
extern PluginLog Dev9Log;
|
||||
PluginConf Ini;
|
||||
|
||||
void setLoggingState()
|
||||
{
|
||||
if (conf.Log) {
|
||||
Dev9Log.WriteToConsole = true;
|
||||
Dev9Log.WriteToFile = true;
|
||||
} else {
|
||||
Dev9Log.WriteToConsole = false;
|
||||
Dev9Log.WriteToFile = false;
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
DEV9configure()
|
||||
{
|
||||
LoadConfig();
|
||||
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
void LoadConfig()
|
||||
{
|
||||
string IniPath = s_strIniPath + "/Dev9null.ini";
|
||||
if (!Ini.Open(IniPath, READ_FILE)) {
|
||||
Dev9Log.WriteLn("Failed to open %s", IniPath.c_str());
|
||||
SaveConfig();
|
||||
return;
|
||||
}
|
||||
|
||||
conf.Log = Ini.ReadInt("logging", 0);
|
||||
Ini.Close();
|
||||
}
|
||||
|
||||
void SaveConfig()
|
||||
{
|
||||
string IniPath = s_strIniPath + "/Dev9null.ini";
|
||||
if (!Ini.Open(IniPath, WRITE_FILE)) {
|
||||
Dev9Log.WriteLn("Failed to open %s", IniPath.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
Ini.WriteInt("logging", conf.Log);
|
||||
Ini.Close();
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
/* dev9null
|
||||
* Copyright (C) 2002-2010 PCSX2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
void SaveConfig();
|
||||
void LoadConfig();
|
||||
void SysMessage(char *fmt, ...);
|
||||
|
||||
//#define is_checked(main_widget, widget_name) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name))))
|
||||
//#define set_checked(main_widget,widget_name, state) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)), state)
|
|
@ -32,6 +32,7 @@ using namespace std;
|
|||
|
||||
#include "DEV9.h"
|
||||
#include "svnrev.h"
|
||||
#include "null/config.inl"
|
||||
|
||||
const unsigned char version = PS2E_DEV9_VERSION;
|
||||
const unsigned char revision = 0;
|
||||
|
@ -47,14 +48,19 @@ __aligned16 s8 dev9regs[0x10000];
|
|||
string s_strIniPath = "inis";
|
||||
string s_strLogPath = "logs";
|
||||
|
||||
PluginLog Dev9Log;
|
||||
Config conf;
|
||||
EXPORT_C_(void)
|
||||
DEV9configure()
|
||||
{
|
||||
const std::string ini_path = s_strIniPath + "/Dev9null.ini";
|
||||
LoadConfig(ini_path);
|
||||
ConfigureLogging();
|
||||
SaveConfig(ini_path);
|
||||
}
|
||||
|
||||
void LogInit()
|
||||
{
|
||||
const std::string LogFile(s_strLogPath + "/dev9null.log");
|
||||
setLoggingState();
|
||||
Dev9Log.Open(LogFile);
|
||||
g_plugin_log.Open(LogFile);
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
|
@ -64,7 +70,7 @@ DEV9setLogDir(const char *dir)
|
|||
s_strLogPath = (dir == NULL) ? "logs" : dir;
|
||||
|
||||
// Reload the log file after updated the path
|
||||
Dev9Log.Close();
|
||||
g_plugin_log.Close();
|
||||
LogInit();
|
||||
}
|
||||
|
||||
|
@ -90,11 +96,10 @@ PS2EgetLibVersion2(u32 type)
|
|||
EXPORT_C_(s32)
|
||||
DEV9init()
|
||||
{
|
||||
LoadConfig();
|
||||
setLoggingState();
|
||||
LoadConfig(s_strIniPath + "/Dev9null.ini");
|
||||
LogInit();
|
||||
Dev9Log.WriteLn("dev9null plugin version %d,%d", revision, build);
|
||||
Dev9Log.WriteLn("Initializing dev9null");
|
||||
g_plugin_log.WriteLn("dev9null plugin version %d,%d", revision, build);
|
||||
g_plugin_log.WriteLn("Initializing dev9null");
|
||||
// Initialize anything that needs to be initialized.
|
||||
memset(dev9regs, 0, sizeof(dev9regs));
|
||||
return 0;
|
||||
|
@ -103,14 +108,14 @@ DEV9init()
|
|||
EXPORT_C_(void)
|
||||
DEV9shutdown()
|
||||
{
|
||||
Dev9Log.WriteLn("Shutting down Dev9null.");
|
||||
Dev9Log.Close();
|
||||
g_plugin_log.WriteLn("Shutting down Dev9null.");
|
||||
g_plugin_log.Close();
|
||||
}
|
||||
|
||||
EXPORT_C_(s32)
|
||||
DEV9open(void *pDsp)
|
||||
{
|
||||
Dev9Log.WriteLn("Opening Dev9null.");
|
||||
g_plugin_log.WriteLn("Opening Dev9null.");
|
||||
// Get anything ready we need to. Opening and creating hard
|
||||
// drive files, for example.
|
||||
return 0;
|
||||
|
@ -119,7 +124,7 @@ DEV9open(void *pDsp)
|
|||
EXPORT_C_(void)
|
||||
DEV9close()
|
||||
{
|
||||
Dev9Log.WriteLn("Closing Dev9null.");
|
||||
g_plugin_log.WriteLn("Closing Dev9null.");
|
||||
// Close files opened.
|
||||
}
|
||||
|
||||
|
@ -134,7 +139,7 @@ DEV9read8(u32 addr)
|
|||
break; // We need to have at least one case to avoid warnings.
|
||||
default:
|
||||
//value = dev9Ru8(addr);
|
||||
Dev9Log.WriteLn("*Unknown 8 bit read at address %lx", addr);
|
||||
g_plugin_log.WriteLn("*Unknown 8 bit read at address %lx", addr);
|
||||
break;
|
||||
}
|
||||
return value;
|
||||
|
@ -167,7 +172,7 @@ DEV9read16(u32 addr)
|
|||
break;
|
||||
default:
|
||||
//value = dev9Ru16(addr);
|
||||
Dev9Log.WriteLn("*Unknown 16 bit read at address %lx", addr);
|
||||
g_plugin_log.WriteLn("*Unknown 16 bit read at address %lx", addr);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -184,7 +189,7 @@ DEV9read32(u32 addr)
|
|||
break;
|
||||
default:
|
||||
//value = dev9Ru32(addr);
|
||||
Dev9Log.WriteLn("*Unknown 32 bit read at address %lx", addr);
|
||||
g_plugin_log.WriteLn("*Unknown 32 bit read at address %lx", addr);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -198,7 +203,7 @@ DEV9write8(u32 addr, u8 value)
|
|||
case 0x10000038: /*dev9Ru8(addr) = value;*/
|
||||
break;
|
||||
default:
|
||||
Dev9Log.WriteLn("*Unknown 8 bit write; address %lx = %x", addr, value);
|
||||
g_plugin_log.WriteLn("*Unknown 8 bit write; address %lx = %x", addr, value);
|
||||
//dev9Ru8(addr) = value;
|
||||
break;
|
||||
}
|
||||
|
@ -213,7 +218,7 @@ DEV9write16(u32 addr, u16 value)
|
|||
case 0x10000038: /*dev9Ru16(addr) = value;*/
|
||||
break;
|
||||
default:
|
||||
Dev9Log.WriteLn("*Unknown 16 bit write; address %lx = %x", addr, value);
|
||||
g_plugin_log.WriteLn("*Unknown 16 bit write; address %lx = %x", addr, value);
|
||||
//dev9Ru16(addr) = value;
|
||||
break;
|
||||
}
|
||||
|
@ -226,7 +231,7 @@ DEV9write32(u32 addr, u32 value)
|
|||
case 0x10000038: /*dev9Ru32(addr) = value;*/
|
||||
break;
|
||||
default:
|
||||
Dev9Log.WriteLn("*Unknown 32 bit write; address %lx = %x", addr, value);
|
||||
g_plugin_log.WriteLn("*Unknown 32 bit write; address %lx = %x", addr, value);
|
||||
//dev9Ru32(addr) = value;
|
||||
break;
|
||||
}
|
||||
|
@ -238,7 +243,7 @@ DEV9dmaRead(s32 channel, u32 *data, u32 bytesLeft, u32 *bytesProcessed)
|
|||
{
|
||||
// You'll want to put your own DMA8 reading code here.
|
||||
// Time to interact with your fake (or real) hardware.
|
||||
Dev9Log.WriteLn("Reading DMA8 Mem.");
|
||||
g_plugin_log.WriteLn("Reading DMA8 Mem.");
|
||||
*bytesProcessed = bytesLeft;
|
||||
return 0;
|
||||
}
|
||||
|
@ -247,7 +252,7 @@ EXPORT_C_(s32)
|
|||
DEV9dmaWrite(s32 channel, u32 *data, u32 bytesLeft, u32 *bytesProcessed)
|
||||
{
|
||||
// See above.
|
||||
Dev9Log.WriteLn("Writing DMA8 Mem.");
|
||||
g_plugin_log.WriteLn("Writing DMA8 Mem.");
|
||||
*bytesProcessed = bytesLeft;
|
||||
return 0;
|
||||
}
|
||||
|
@ -263,14 +268,14 @@ DEV9readDMA8Mem(u32 *pMem, int size)
|
|||
{
|
||||
// You'll want to put your own DMA8 reading code here.
|
||||
// Time to interact with your fake (or real) hardware.
|
||||
Dev9Log.WriteLn("Reading DMA8 Mem.");
|
||||
g_plugin_log.WriteLn("Reading DMA8 Mem.");
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
DEV9writeDMA8Mem(u32 *pMem, int size)
|
||||
{
|
||||
// See above.
|
||||
Dev9Log.WriteLn("Writing DMA8 Mem.");
|
||||
g_plugin_log.WriteLn("Writing DMA8 Mem.");
|
||||
}
|
||||
//#endif
|
||||
|
||||
|
@ -328,6 +333,3 @@ DEV9freeze(int mode, freezeData *data)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* For operating systems that need an entry point for a dll/library, here it is. Defined in PS2Eext.h. */
|
||||
ENTRY_POINT;
|
||||
|
|
|
@ -25,21 +25,11 @@
|
|||
#include "PS2Edefs.h"
|
||||
#include "PS2Eext.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
s32 Log;
|
||||
} Config;
|
||||
|
||||
extern Config conf;
|
||||
|
||||
extern const unsigned char version;
|
||||
extern const unsigned char revision;
|
||||
extern const unsigned char build;
|
||||
extern const unsigned int minor;
|
||||
|
||||
void SaveConfig();
|
||||
void LoadConfig();
|
||||
|
||||
extern void (*DEV9irq)(int);
|
||||
|
||||
extern __aligned16 s8 dev9regs[0x10000];
|
||||
|
@ -50,6 +40,4 @@ extern __aligned16 s8 dev9regs[0x10000];
|
|||
#define dev9Ru16(mem) (*(u16 *)&dev9regs[(mem)&0xffff])
|
||||
#define dev9Ru32(mem) (*(u32 *)&dev9regs[(mem)&0xffff])
|
||||
|
||||
extern void setLoggingState();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -53,14 +53,15 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\DEV9.cpp" />
|
||||
<ClCompile Include="..\Config.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="dev9null.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\DEV9.h" />
|
||||
<ClInclude Include="..\Config.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\..\common\include\null\null.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets" />
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
<ClCompile Include="..\DEV9.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Config.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="dev9null.def">
|
||||
|
@ -21,6 +18,8 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\DEV9.h" />
|
||||
<ClInclude Include="..\Config.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\..\common\include\null\null.rc" />
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue