mirror of https://github.com/PCSX2/pcsx2.git
Merge pull request #1530 from PCSX2/clang-format-plugin-v1
Clang format plugin v1
This commit is contained in:
commit
601c828562
|
@ -27,102 +27,122 @@ const unsigned char version = PS2E_CDVD_VERSION;
|
||||||
const unsigned char revision = 0;
|
const unsigned char revision = 0;
|
||||||
const unsigned char build = 6;
|
const unsigned char build = 6;
|
||||||
|
|
||||||
EXPORT_C_(char*) PS2EgetLibName()
|
EXPORT_C_(char*)
|
||||||
|
PS2EgetLibName()
|
||||||
{
|
{
|
||||||
snprintf( libraryName, 255, "CDVDnull Driver %lld%s",SVN_REV, SVN_MODS ? "m" : "");
|
snprintf(libraryName, 255, "CDVDnull Driver %lld%s", SVN_REV, SVN_MODS ? "m" : "");
|
||||||
return libraryName;
|
return libraryName;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(u32) PS2EgetLibType()
|
EXPORT_C_(u32)
|
||||||
|
PS2EgetLibType()
|
||||||
{
|
{
|
||||||
return PS2E_LT_CDVD;
|
return PS2E_LT_CDVD;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(u32) CALLBACK PS2EgetLibVersion2(u32 type)
|
EXPORT_C_(u32)
|
||||||
|
CALLBACK PS2EgetLibVersion2(u32 type)
|
||||||
{
|
{
|
||||||
return (version << 16) | (revision << 8) | build;
|
return (version << 16) | (revision << 8) | build;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) CDVDinit()
|
EXPORT_C_(s32)
|
||||||
|
CDVDinit()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) CDVDopen(const char* pTitle)
|
EXPORT_C_(s32)
|
||||||
|
CDVDopen(const char* pTitle)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) CDVDclose()
|
EXPORT_C_(void)
|
||||||
|
CDVDclose()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) CDVDshutdown()
|
EXPORT_C_(void)
|
||||||
|
CDVDshutdown()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) CDVDreadTrack(u32 lsn, int mode)
|
EXPORT_C_(s32)
|
||||||
|
CDVDreadTrack(u32 lsn, int mode)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return can be NULL (for async modes)
|
// return can be NULL (for async modes)
|
||||||
EXPORT_C_(u8*) CDVDgetBuffer()
|
EXPORT_C_(u8*)
|
||||||
|
CDVDgetBuffer()
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) CDVDreadSubQ(u32 lsn, cdvdSubQ* subq)
|
EXPORT_C_(s32)
|
||||||
|
CDVDreadSubQ(u32 lsn, cdvdSubQ* subq)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) CDVDgetTN(cdvdTN *Buffer)
|
EXPORT_C_(s32)
|
||||||
|
CDVDgetTN(cdvdTN* Buffer)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) CDVDgetTD(u8 Track, cdvdTD *Buffer)
|
EXPORT_C_(s32)
|
||||||
|
CDVDgetTD(u8 Track, cdvdTD* Buffer)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) CDVDgetTOC(void* toc)
|
EXPORT_C_(s32)
|
||||||
|
CDVDgetTOC(void* toc)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) CDVDgetDiskType()
|
EXPORT_C_(s32)
|
||||||
|
CDVDgetDiskType()
|
||||||
{
|
{
|
||||||
return CDVD_TYPE_NODISC;
|
return CDVD_TYPE_NODISC;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) CDVDgetTrayStatus()
|
EXPORT_C_(s32)
|
||||||
|
CDVDgetTrayStatus()
|
||||||
{
|
{
|
||||||
return CDVD_TRAY_CLOSE;
|
return CDVD_TRAY_CLOSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) CDVDctrlTrayOpen()
|
EXPORT_C_(s32)
|
||||||
|
CDVDctrlTrayOpen()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) CDVDctrlTrayClose()
|
EXPORT_C_(s32)
|
||||||
|
CDVDctrlTrayClose()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) CDVDconfigure()
|
EXPORT_C_(void)
|
||||||
|
CDVDconfigure()
|
||||||
{
|
{
|
||||||
SysMessage("Nothing to Configure");
|
SysMessage("Nothing to Configure");
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) CDVDabout()
|
EXPORT_C_(void)
|
||||||
|
CDVDabout()
|
||||||
{
|
{
|
||||||
SysMessage("%s %d.%d", "CDVDnull Driver", revision, build);
|
SysMessage("%s %d.%d", "CDVDnull Driver", revision, build);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) CDVDtest()
|
EXPORT_C_(s32)
|
||||||
|
CDVDtest()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __CDVD_H__
|
#ifndef __CDVD_H__
|
||||||
#define __CDVD_H__
|
#define __CDVD_H__
|
||||||
|
|
||||||
#define CDVDdefs
|
#define CDVDdefs
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define EXPORT_C_(type) extern "C" type CALLBACK
|
#define EXPORT_C_(type) extern "C" type CALLBACK
|
||||||
#else
|
#else
|
||||||
#define EXPORT_C_(type) extern "C" __attribute__((stdcall,externally_visible,visibility("default"))) type
|
#define EXPORT_C_(type) extern "C" __attribute__((stdcall, externally_visible, visibility("default"))) type
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const unsigned char version;
|
extern const unsigned char version;
|
||||||
|
@ -38,5 +38,5 @@ extern const unsigned char revision;
|
||||||
extern const unsigned char build;
|
extern const unsigned char build;
|
||||||
extern const unsigned int minor;
|
extern const unsigned int minor;
|
||||||
|
|
||||||
extern void SysMessage(const char *fmt, ...);
|
extern void SysMessage(const char* fmt, ...);
|
||||||
#endif /* __CDVD_H__ */
|
#endif /* __CDVD_H__ */
|
||||||
|
|
|
@ -25,55 +25,51 @@ PluginConf Ini;
|
||||||
|
|
||||||
void setLoggingState()
|
void setLoggingState()
|
||||||
{
|
{
|
||||||
if (conf.Log)
|
if (conf.Log) {
|
||||||
{
|
FWLog.WriteToConsole = true;
|
||||||
FWLog.WriteToConsole = true;
|
FWLog.WriteToFile = true;
|
||||||
FWLog.WriteToFile = true;
|
} else {
|
||||||
}
|
FWLog.WriteToConsole = false;
|
||||||
else
|
FWLog.WriteToFile = false;
|
||||||
{
|
}
|
||||||
FWLog.WriteToConsole = false;
|
|
||||||
FWLog.WriteToFile = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) FWabout()
|
EXPORT_C_(void)
|
||||||
|
FWabout()
|
||||||
{
|
{
|
||||||
SysMessage("FWnull: A simple null plugin.");
|
SysMessage("FWnull: A simple null plugin.");
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) FWconfigure()
|
EXPORT_C_(void)
|
||||||
|
FWconfigure()
|
||||||
{
|
{
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadConfig()
|
void LoadConfig()
|
||||||
{
|
{
|
||||||
string IniPath = s_strIniPath + "/FWnull.ini";
|
string IniPath = s_strIniPath + "/FWnull.ini";
|
||||||
if (!Ini.Open(IniPath, READ_FILE))
|
if (!Ini.Open(IniPath, READ_FILE)) {
|
||||||
{
|
FWLog.WriteLn("Failed to open %s", IniPath.c_str());
|
||||||
FWLog.WriteLn("Failed to open %s", IniPath.c_str());
|
SaveConfig();
|
||||||
SaveConfig();
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
conf.Log = Ini.ReadInt("logging", 0);
|
conf.Log = Ini.ReadInt("logging", 0);
|
||||||
setLoggingState();
|
setLoggingState();
|
||||||
Ini.Close();
|
Ini.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveConfig()
|
void SaveConfig()
|
||||||
{
|
{
|
||||||
string IniPath = s_strIniPath + "/FWnull.ini";
|
string IniPath = s_strIniPath + "/FWnull.ini";
|
||||||
if (!Ini.Open(IniPath, WRITE_FILE))
|
if (!Ini.Open(IniPath, WRITE_FILE)) {
|
||||||
{
|
FWLog.WriteLn("Failed to open %s\n", IniPath.c_str());
|
||||||
FWLog.WriteLn("Failed to open %s\n", IniPath.c_str());
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Ini.WriteInt("logging", conf.Log);
|
Ini.WriteInt("logging", conf.Log);
|
||||||
Ini.Close();
|
Ini.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
void SaveConf();
|
void SaveConf();
|
||||||
void LoadConf();
|
void LoadConf();
|
||||||
void SysMessage(const char *fmt, ...);
|
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 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)
|
#define set_checked(main_widget, widget_name, state) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)), state)
|
||||||
|
|
|
@ -23,20 +23,20 @@ using namespace std;
|
||||||
#include "FW.h"
|
#include "FW.h"
|
||||||
#include "svnrev.h"
|
#include "svnrev.h"
|
||||||
|
|
||||||
const u8 version = PS2E_FW_VERSION;
|
const u8 version = PS2E_FW_VERSION;
|
||||||
const u8 revision = 0;
|
const u8 revision = 0;
|
||||||
const u8 build = 7; // increase that with each version
|
const u8 build = 7; // increase that with each version
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define snprintf sprintf_s
|
#define snprintf sprintf_s
|
||||||
#endif
|
#endif
|
||||||
static char libraryName[256];
|
static char libraryName[256];
|
||||||
|
|
||||||
string s_strIniPath="inis";
|
string s_strIniPath = "inis";
|
||||||
string s_strLogPath = "logs";
|
string s_strLogPath = "logs";
|
||||||
|
|
||||||
u8 phyregs[16];
|
u8 phyregs[16];
|
||||||
s8 *fwregs;
|
s8* fwregs;
|
||||||
Config conf;
|
Config conf;
|
||||||
PluginLog FWLog;
|
PluginLog FWLog;
|
||||||
|
|
||||||
|
@ -44,259 +44,268 @@ void (*FWirq)();
|
||||||
|
|
||||||
void LogInit()
|
void LogInit()
|
||||||
{
|
{
|
||||||
const std::string LogFile(s_strLogPath + "/FWnull.log");
|
const std::string LogFile(s_strLogPath + "/FWnull.log");
|
||||||
setLoggingState();
|
setLoggingState();
|
||||||
FWLog.Open(LogFile);
|
FWLog.Open(LogFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) FWsetLogDir(const char* dir)
|
EXPORT_C_(void)
|
||||||
|
FWsetLogDir(const char* dir)
|
||||||
{
|
{
|
||||||
// Get the path to the log directory.
|
// Get the path to the log directory.
|
||||||
s_strLogPath = (dir==NULL) ? "logs" : dir;
|
s_strLogPath = (dir == NULL) ? "logs" : dir;
|
||||||
|
|
||||||
// Reload the log file after updated the path
|
// Reload the log file after updated the path
|
||||||
FWLog.Close();
|
FWLog.Close();
|
||||||
LogInit();
|
LogInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(u32) PS2EgetLibType()
|
EXPORT_C_(u32)
|
||||||
|
PS2EgetLibType()
|
||||||
{
|
{
|
||||||
return PS2E_LT_FW;
|
return PS2E_LT_FW;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(char*) PS2EgetLibName()
|
EXPORT_C_(char*)
|
||||||
|
PS2EgetLibName()
|
||||||
{
|
{
|
||||||
snprintf( libraryName, 255, "FWnull Driver %lld%s",SVN_REV, SVN_MODS ? "m" : "");
|
snprintf(libraryName, 255, "FWnull Driver %lld%s", SVN_REV, SVN_MODS ? "m" : "");
|
||||||
return libraryName;
|
return libraryName;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(u32) PS2EgetLibVersion2(u32 type)
|
EXPORT_C_(u32)
|
||||||
|
PS2EgetLibVersion2(u32 type)
|
||||||
{
|
{
|
||||||
return (version<<16) | (revision<<8) | build;
|
return (version << 16) | (revision << 8) | build;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) FWinit()
|
EXPORT_C_(s32)
|
||||||
|
FWinit()
|
||||||
{
|
{
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
LogInit();
|
LogInit();
|
||||||
FWLog.WriteLn("FWnull plugin version %d,%d", revision, build);
|
FWLog.WriteLn("FWnull plugin version %d,%d", revision, build);
|
||||||
FWLog.WriteLn("Initializing FWnull");
|
FWLog.WriteLn("Initializing FWnull");
|
||||||
|
|
||||||
memset(phyregs, 0, sizeof(phyregs));
|
memset(phyregs, 0, sizeof(phyregs));
|
||||||
// Initializing our registers.
|
// Initializing our registers.
|
||||||
fwregs = (s8*)calloc(0x10000,1);
|
fwregs = (s8*)calloc(0x10000, 1);
|
||||||
if (fwregs == NULL)
|
if (fwregs == NULL) {
|
||||||
{
|
FWLog.Message("Error allocating Memory");
|
||||||
FWLog.Message("Error allocating Memory");
|
return -1;
|
||||||
return -1;
|
}
|
||||||
}
|
return 0;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) FWshutdown()
|
EXPORT_C_(void)
|
||||||
|
FWshutdown()
|
||||||
{
|
{
|
||||||
// Freeing the registers.
|
// Freeing the registers.
|
||||||
free(fwregs);
|
free(fwregs);
|
||||||
fwregs = NULL;
|
fwregs = NULL;
|
||||||
|
|
||||||
FWLog.Close();
|
FWLog.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) FWopen(void *pDsp)
|
EXPORT_C_(s32)
|
||||||
|
FWopen(void* pDsp)
|
||||||
{
|
{
|
||||||
FWLog.WriteLn("Opening FWnull.");
|
FWLog.WriteLn("Opening FWnull.");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) FWclose()
|
EXPORT_C_(void)
|
||||||
|
FWclose()
|
||||||
{
|
{
|
||||||
// Close the plugin.
|
// Close the plugin.
|
||||||
FWLog.WriteLn("Closing FWnull.");
|
FWLog.WriteLn("Closing FWnull.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void PHYWrite()
|
void PHYWrite()
|
||||||
{
|
{
|
||||||
u8 reg = (PHYACC >> 8) & 0xf;
|
u8 reg = (PHYACC >> 8) & 0xf;
|
||||||
u8 data = PHYACC & 0xff;
|
u8 data = PHYACC & 0xff;
|
||||||
|
|
||||||
phyregs[reg] = data;
|
phyregs[reg] = data;
|
||||||
|
|
||||||
PHYACC &= ~0x4000ffff;
|
PHYACC &= ~0x4000ffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PHYRead()
|
void PHYRead()
|
||||||
{
|
{
|
||||||
u8 reg = (PHYACC >> 24) & 0xf;
|
u8 reg = (PHYACC >> 24) & 0xf;
|
||||||
|
|
||||||
PHYACC &= ~0x80000000;
|
PHYACC &= ~0x80000000;
|
||||||
|
|
||||||
PHYACC |= phyregs[reg] | (reg << 8);
|
PHYACC |= phyregs[reg] | (reg << 8);
|
||||||
|
|
||||||
if(fwRu32(0x8424) & 0x40000000) //RRx interrupt mask
|
if (fwRu32(0x8424) & 0x40000000) //RRx interrupt mask
|
||||||
{
|
{
|
||||||
fwRu32(0x8420) |= 0x40000000;
|
fwRu32(0x8420) |= 0x40000000;
|
||||||
FWirq();
|
FWirq();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EXPORT_C_(u32) FWread32(u32 addr)
|
EXPORT_C_(u32)
|
||||||
|
FWread32(u32 addr)
|
||||||
{
|
{
|
||||||
u32 ret = 0;
|
u32 ret = 0;
|
||||||
|
|
||||||
switch (addr)
|
switch (addr) {
|
||||||
{
|
//Node ID Register the top part is default, bottom part i got from my ps2
|
||||||
//Node ID Register the top part is default, bottom part i got from my ps2
|
case 0x1f808400:
|
||||||
case 0x1f808400:
|
ret = /*(0x3ff << 22) | 1;*/ 0xffc00001;
|
||||||
ret = /*(0x3ff << 22) | 1;*/ 0xffc00001;
|
break;
|
||||||
break;
|
// Control Register 2
|
||||||
// Control Register 2
|
case 0x1f808410:
|
||||||
case 0x1f808410:
|
ret = fwRu32(addr); //SCLK OK (Needs to be set when FW is "Ready"
|
||||||
ret = fwRu32(addr); //SCLK OK (Needs to be set when FW is "Ready"
|
break;
|
||||||
break;
|
//Interrupt 0 Register
|
||||||
//Interrupt 0 Register
|
case 0x1f808420:
|
||||||
case 0x1f808420:
|
ret = fwRu32(addr);
|
||||||
ret = fwRu32(addr);
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
//Dunno what this is, but my home console always returns this value 0x10000001
|
//Dunno what this is, but my home console always returns this value 0x10000001
|
||||||
//Seems to be related to the Node ID however (does some sort of compare/check)
|
//Seems to be related to the Node ID however (does some sort of compare/check)
|
||||||
case 0x1f80847c:
|
case 0x1f80847c:
|
||||||
ret = 0x10000001;
|
ret = 0x10000001;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Include other relevant 32 bit addresses we need to catch here.
|
// Include other relevant 32 bit addresses we need to catch here.
|
||||||
default:
|
default:
|
||||||
// By default, read fwregs.
|
// By default, read fwregs.
|
||||||
ret = fwRu32(addr);
|
ret = fwRu32(addr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
FWLog.WriteLn("FW read mem 0x%x: 0x%x", addr, ret);
|
FWLog.WriteLn("FW read mem 0x%x: 0x%x", addr, ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) FWwrite32(u32 addr, u32 value)
|
EXPORT_C_(void)
|
||||||
|
FWwrite32(u32 addr, u32 value)
|
||||||
{
|
{
|
||||||
switch (addr)
|
switch (addr) {
|
||||||
{
|
// Include other memory locations we want to catch here.
|
||||||
// Include other memory locations we want to catch here.
|
// For example:
|
||||||
// For example:
|
//
|
||||||
//
|
// case 0x1f808400:
|
||||||
// case 0x1f808400:
|
// case 0x1f808414:
|
||||||
// case 0x1f808414:
|
// case 0x1f808420:
|
||||||
// case 0x1f808420:
|
// case 0x1f808428:
|
||||||
// case 0x1f808428:
|
// case 0x1f808430:
|
||||||
// case 0x1f808430:
|
//
|
||||||
//
|
|
||||||
|
|
||||||
//PHY access
|
//PHY access
|
||||||
case 0x1f808414:
|
case 0x1f808414:
|
||||||
//If in read mode (top bit set) we read the PHY register requested then set the RRx interrupt if it's enabled
|
//If in read mode (top bit set) we read the PHY register requested then set the RRx interrupt if it's enabled
|
||||||
//Im presuming we send that back to pcsx2 then. This register stores the result, plus whatever was written (minus the read/write flag
|
//Im presuming we send that back to pcsx2 then. This register stores the result, plus whatever was written (minus the read/write flag
|
||||||
fwRu32(addr) = value; //R/W Bit cleaned in underneath function
|
fwRu32(addr) = value; //R/W Bit cleaned in underneath function
|
||||||
if(value & 0x40000000) //Writing to PHY
|
if (value & 0x40000000) //Writing to PHY
|
||||||
{
|
{
|
||||||
PHYWrite();
|
PHYWrite();
|
||||||
}
|
} else if (value & 0x80000000) //Reading from PHY
|
||||||
else if(value & 0x80000000) //Reading from PHY
|
{
|
||||||
{
|
PHYRead();
|
||||||
PHYRead();
|
}
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
//Control Register 0
|
//Control Register 0
|
||||||
case 0x1f808408:
|
case 0x1f808408:
|
||||||
//This enables different functions of the link interface
|
//This enables different functions of the link interface
|
||||||
//Just straight writes, should brobably struct these later.
|
//Just straight writes, should brobably struct these later.
|
||||||
//Default written settings (on unreal tournament) are
|
//Default written settings (on unreal tournament) are
|
||||||
//Urcv M = 1
|
//Urcv M = 1
|
||||||
//RSP 0 = 1
|
//RSP 0 = 1
|
||||||
//Retlim = 0xF
|
//Retlim = 0xF
|
||||||
//Cyc Tmr En = 1
|
//Cyc Tmr En = 1
|
||||||
//Bus ID Rst = 1
|
//Bus ID Rst = 1
|
||||||
//Rcv Self ID = 1
|
//Rcv Self ID = 1
|
||||||
fwRu32(addr) = value;
|
fwRu32(addr) = value;
|
||||||
// if((value & 0x800000) && (fwRu32(0x842C) & 0x2))
|
// if((value & 0x800000) && (fwRu32(0x842C) & 0x2))
|
||||||
// {
|
// {
|
||||||
// fwRu32(0x8428) |= 0x2;
|
// fwRu32(0x8428) |= 0x2;
|
||||||
// FWirq();
|
// FWirq();
|
||||||
// }
|
// }
|
||||||
fwRu32(addr) &= ~0x800000;
|
fwRu32(addr) &= ~0x800000;
|
||||||
break;
|
break;
|
||||||
//Control Register 2
|
//Control Register 2
|
||||||
case 0x1f808410:// fwRu32(addr) = value; break;
|
case 0x1f808410: // fwRu32(addr) = value; break;
|
||||||
//Ignore writes to this for now, apart from 0x2 which is Link Power Enable
|
//Ignore writes to this for now, apart from 0x2 which is Link Power Enable
|
||||||
//0x8 is SCLK OK (Ready) which should be set for emulation
|
//0x8 is SCLK OK (Ready) which should be set for emulation
|
||||||
fwRu32(addr) = 0x8 /*| value & 0x2*/;
|
fwRu32(addr) = 0x8 /*| value & 0x2*/;
|
||||||
break;
|
break;
|
||||||
//Interrupt 0 Register
|
//Interrupt 0 Register
|
||||||
case 0x1f808420:
|
case 0x1f808420:
|
||||||
//Interrupt 1 Register
|
//Interrupt 1 Register
|
||||||
case 0x1f808428:
|
case 0x1f808428:
|
||||||
//Interrupt 2 Register
|
//Interrupt 2 Register
|
||||||
case 0x1f808430:
|
case 0x1f808430:
|
||||||
//Writes of 1 clear the corresponding bits
|
//Writes of 1 clear the corresponding bits
|
||||||
fwRu32(addr) &= ~value;
|
fwRu32(addr) &= ~value;
|
||||||
break;
|
break;
|
||||||
//Interrupt 0 Register Mask
|
//Interrupt 0 Register Mask
|
||||||
case 0x1f808424:
|
case 0x1f808424:
|
||||||
//Interrupt 1 Register Mask
|
//Interrupt 1 Register Mask
|
||||||
case 0x1f80842C:
|
case 0x1f80842C:
|
||||||
//Interrupt 2 Register Mask
|
//Interrupt 2 Register Mask
|
||||||
case 0x1f808434:
|
case 0x1f808434:
|
||||||
//These are direct writes (as it's a mask!)
|
//These are direct writes (as it's a mask!)
|
||||||
fwRu32(addr) = value;
|
fwRu32(addr) = value;
|
||||||
break;
|
break;
|
||||||
//DMA Control and Status Register 0
|
//DMA Control and Status Register 0
|
||||||
case 0x1f8084B8:
|
case 0x1f8084B8:
|
||||||
fwRu32(addr) = value;
|
fwRu32(addr) = value;
|
||||||
break;
|
break;
|
||||||
//DMA Control and Status Register 1
|
//DMA Control and Status Register 1
|
||||||
case 0x1f808538:
|
case 0x1f808538:
|
||||||
fwRu32(addr) = value;
|
fwRu32(addr) = value;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// By default, just write it to fwregs.
|
// By default, just write it to fwregs.
|
||||||
fwRu32(addr) = value;
|
fwRu32(addr) = value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
FWLog.WriteLn("FW write mem 0x%x: 0x%x", addr, value);
|
FWLog.WriteLn("FW write mem 0x%x: 0x%x", addr, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) FWirqCallback(void (*callback)())
|
EXPORT_C_(void)
|
||||||
|
FWirqCallback(void (*callback)())
|
||||||
{
|
{
|
||||||
// Register FWirq, so we can trigger an interrupt with it later.
|
// Register FWirq, so we can trigger an interrupt with it later.
|
||||||
FWirq = callback;
|
FWirq = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) FWsetSettingsDir(const char* dir)
|
EXPORT_C_(void)
|
||||||
|
FWsetSettingsDir(const char* dir)
|
||||||
{
|
{
|
||||||
// Find out from pcsx2 where we are supposed to put our ini file.
|
// Find out from pcsx2 where we are supposed to put our ini file.
|
||||||
s_strIniPath = (dir == NULL) ? "inis" : dir;
|
s_strIniPath = (dir == NULL) ? "inis" : dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) FWfreeze(int mode, freezeData *data)
|
EXPORT_C_(s32)
|
||||||
|
FWfreeze(int mode, freezeData* data)
|
||||||
{
|
{
|
||||||
// This should store or retrieve any information, for if emulation
|
// This should store or retrieve any information, for if emulation
|
||||||
// gets suspended, or for savestates.
|
// gets suspended, or for savestates.
|
||||||
switch(mode)
|
switch (mode) {
|
||||||
{
|
case FREEZE_LOAD:
|
||||||
case FREEZE_LOAD:
|
// Load previously saved data.
|
||||||
// Load previously saved data.
|
break;
|
||||||
break;
|
case FREEZE_SAVE:
|
||||||
case FREEZE_SAVE:
|
// Save data.
|
||||||
// Save data.
|
break;
|
||||||
break;
|
case FREEZE_SIZE:
|
||||||
case FREEZE_SIZE:
|
// return the size of the data.
|
||||||
// return the size of the data.
|
break;
|
||||||
break;
|
}
|
||||||
}
|
return 0;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) FWtest()
|
EXPORT_C_(s32)
|
||||||
|
FWtest()
|
||||||
{
|
{
|
||||||
// 0 if the plugin works, non-0 if it doesn't.
|
// 0 if the plugin works, non-0 if it doesn't.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,16 +23,16 @@
|
||||||
#include "PS2Eext.h"
|
#include "PS2Eext.h"
|
||||||
|
|
||||||
// Our main memory storage, and defines for accessing it.
|
// Our main memory storage, and defines for accessing it.
|
||||||
extern s8 *fwregs;
|
extern s8* fwregs;
|
||||||
#define fwRs32(mem) (*(s32*)&fwregs[(mem) & 0xffff])
|
#define fwRs32(mem) (*(s32*)&fwregs[(mem)&0xffff])
|
||||||
#define fwRu32(mem) (*(u32*)&fwregs[(mem) & 0xffff])
|
#define fwRu32(mem) (*(u32*)&fwregs[(mem)&0xffff])
|
||||||
|
|
||||||
//PHY Access Address for ease of use :P
|
//PHY Access Address for ease of use :P
|
||||||
#define PHYACC fwRu32(0x8414)
|
#define PHYACC fwRu32(0x8414)
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
s32 Log;
|
s32 Log;
|
||||||
} Config;
|
} Config;
|
||||||
|
|
||||||
extern Config conf;
|
extern Config conf;
|
||||||
|
|
|
@ -21,46 +21,45 @@ extern HINSTANCE hInst;
|
||||||
void SaveConfig()
|
void SaveConfig()
|
||||||
{
|
{
|
||||||
|
|
||||||
Config *Conf1 = &conf;
|
Config* Conf1 = &conf;
|
||||||
char *szTemp;
|
char* szTemp;
|
||||||
char szIniFile[256], szValue[256];
|
char szIniFile[256], szValue[256];
|
||||||
|
|
||||||
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
||||||
szTemp = strrchr(szIniFile, '\\');
|
szTemp = strrchr(szIniFile, '\\');
|
||||||
|
|
||||||
if(!szTemp) return;
|
|
||||||
strcpy(szTemp, "\\inis\\fwnull.ini");
|
|
||||||
sprintf(szValue,"%u",Conf1->Log);
|
|
||||||
WritePrivateProfileString("Interface", "Logging",szValue,szIniFile);
|
|
||||||
|
|
||||||
|
if (!szTemp)
|
||||||
|
return;
|
||||||
|
strcpy(szTemp, "\\inis\\fwnull.ini");
|
||||||
|
sprintf(szValue, "%u", Conf1->Log);
|
||||||
|
WritePrivateProfileString("Interface", "Logging", szValue, szIniFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadConfig() {
|
void LoadConfig()
|
||||||
FILE *fp;
|
{
|
||||||
|
FILE* fp;
|
||||||
|
|
||||||
|
|
||||||
Config *Conf1 = &conf;
|
Config* Conf1 = &conf;
|
||||||
char *szTemp;
|
char* szTemp;
|
||||||
char szIniFile[256], szValue[256];
|
char szIniFile[256], szValue[256];
|
||||||
|
|
||||||
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
||||||
szTemp = strrchr(szIniFile, '\\');
|
szTemp = strrchr(szIniFile, '\\');
|
||||||
|
|
||||||
if(!szTemp) return ;
|
if (!szTemp)
|
||||||
strcpy(szTemp, "\\inis\\fwnull.ini");
|
return;
|
||||||
fp=fopen("inis\\fwnull.ini","rt");//check if firewirenull.ini really exists
|
strcpy(szTemp, "\\inis\\fwnull.ini");
|
||||||
if (!fp)
|
fp = fopen("inis\\fwnull.ini", "rt"); //check if firewirenull.ini really exists
|
||||||
{
|
if (!fp) {
|
||||||
CreateDirectory("inis",NULL);
|
CreateDirectory("inis", NULL);
|
||||||
memset(&conf, 0, sizeof(conf));
|
memset(&conf, 0, sizeof(conf));
|
||||||
conf.Log = 0;//default value
|
conf.Log = 0; //default value
|
||||||
SaveConfig();//save and return
|
SaveConfig(); //save and return
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
GetPrivateProfileString("Interface", "Logging", NULL, szValue, 20, szIniFile);
|
GetPrivateProfileString("Interface", "Logging", NULL, szValue, 20, szIniFile);
|
||||||
Conf1->Log = strtoul(szValue, NULL, 10);
|
Conf1->Log = strtoul(szValue, NULL, 10);
|
||||||
return ;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,74 +23,81 @@
|
||||||
|
|
||||||
HINSTANCE hInst;
|
HINSTANCE hInst;
|
||||||
|
|
||||||
void SysMessage(char *fmt, ...) {
|
void SysMessage(char* fmt, ...)
|
||||||
va_list list;
|
{
|
||||||
char tmp[512];
|
va_list list;
|
||||||
|
char tmp[512];
|
||||||
|
|
||||||
va_start(list,fmt);
|
va_start(list, fmt);
|
||||||
vsprintf(tmp,fmt,list);
|
vsprintf(tmp, fmt, list);
|
||||||
va_end(list);
|
va_end(list);
|
||||||
MessageBox(GetActiveWindow(), tmp, "FW Plugin Msg", MB_SETFOREGROUND | MB_OK);
|
MessageBox(GetActiveWindow(), tmp, "FW Plugin Msg", MB_SETFOREGROUND | MB_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
|
||||||
switch(uMsg) {
|
switch (uMsg) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
if (conf.Log) CheckDlgButton(hW, IDC_LOGGING, TRUE);
|
if (conf.Log)
|
||||||
return TRUE;
|
CheckDlgButton(hW, IDC_LOGGING, TRUE);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch(LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
EndDialog(hW, TRUE);
|
EndDialog(hW, TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case IDOK:
|
case IDOK:
|
||||||
if (IsDlgButtonChecked(hW, IDC_LOGGING))
|
if (IsDlgButtonChecked(hW, IDC_LOGGING))
|
||||||
conf.Log = 1;
|
conf.Log = 1;
|
||||||
else conf.Log = 0;
|
else
|
||||||
SaveConfig();
|
conf.Log = 0;
|
||||||
EndDialog(hW, FALSE);
|
SaveConfig();
|
||||||
return TRUE;
|
EndDialog(hW, FALSE);
|
||||||
}
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
}
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
switch(uMsg) {
|
{
|
||||||
case WM_INITDIALOG:
|
switch (uMsg) {
|
||||||
return TRUE;
|
case WM_INITDIALOG:
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch(LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
case IDOK:
|
case IDOK:
|
||||||
EndDialog(hW, FALSE);
|
EndDialog(hW, FALSE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CALLBACK FWconfigure() {
|
void CALLBACK FWconfigure()
|
||||||
|
{
|
||||||
DialogBox(hInst,
|
DialogBox(hInst,
|
||||||
MAKEINTRESOURCE(IDD_CONFIG),
|
MAKEINTRESOURCE(IDD_CONFIG),
|
||||||
GetActiveWindow(),
|
GetActiveWindow(),
|
||||||
(DLGPROC)ConfigureDlgProc);
|
(DLGPROC)ConfigureDlgProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CALLBACK FWabout() {
|
void CALLBACK FWabout()
|
||||||
|
{
|
||||||
DialogBox(hInst,
|
DialogBox(hInst,
|
||||||
MAKEINTRESOURCE(IDD_ABOUT),
|
MAKEINTRESOURCE(IDD_ABOUT),
|
||||||
GetActiveWindow(),
|
GetActiveWindow(),
|
||||||
(DLGPROC)AboutDlgProc);
|
(DLGPROC)AboutDlgProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
||||||
DWORD dwReason,
|
DWORD dwReason,
|
||||||
LPVOID lpReserved) {
|
LPVOID lpReserved)
|
||||||
hInst = (HINSTANCE)hModule;
|
{
|
||||||
return TRUE; // very quick :)
|
hInst = (HINSTANCE)hModule;
|
||||||
|
return TRUE; // very quick :)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,19 +28,19 @@ using namespace std;
|
||||||
#include "GifTransfer.h"
|
#include "GifTransfer.h"
|
||||||
#include "null/GSnull.h"
|
#include "null/GSnull.h"
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# include "svnrev.h"
|
#include "svnrev.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const unsigned char version = PS2E_GS_VERSION;
|
const unsigned char version = PS2E_GS_VERSION;
|
||||||
const unsigned char revision = 0;
|
const unsigned char revision = 0;
|
||||||
const unsigned char build = 1; // increase that with each version
|
const unsigned char build = 1; // increase that with each version
|
||||||
|
|
||||||
static char libraryName[256];
|
static char libraryName[256];
|
||||||
Config conf;
|
Config conf;
|
||||||
u32 GSKeyEvent = 0;
|
u32 GSKeyEvent = 0;
|
||||||
bool GSShift = false, GSAlt = false;
|
bool GSShift = false, GSAlt = false;
|
||||||
|
|
||||||
string s_strIniPath="inis";
|
string s_strIniPath = "inis";
|
||||||
extern std::string s_strLogPath;
|
extern std::string s_strLogPath;
|
||||||
const char* s_iniFilename = "GSnull.ini";
|
const char* s_iniFilename = "GSnull.ini";
|
||||||
GSVars gs;
|
GSVars gs;
|
||||||
|
@ -56,215 +56,245 @@ extern void SetMultithreaded();
|
||||||
extern void SetFrameSkip(bool skip);
|
extern void SetFrameSkip(bool skip);
|
||||||
extern void InitPath();
|
extern void InitPath();
|
||||||
|
|
||||||
EXPORT_C_(u32) PS2EgetLibType()
|
EXPORT_C_(u32)
|
||||||
|
PS2EgetLibType()
|
||||||
{
|
{
|
||||||
return PS2E_LT_GS;
|
return PS2E_LT_GS;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(char*) PS2EgetLibName()
|
EXPORT_C_(char*)
|
||||||
|
PS2EgetLibName()
|
||||||
{
|
{
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
sprintf_s( libraryName, "GSnull Driver %lld%s",SVN_REV, SVN_MODS ? "m" : "");
|
sprintf_s(libraryName, "GSnull Driver %lld%s", SVN_REV, SVN_MODS ? "m" : "");
|
||||||
return libraryName;
|
return libraryName;
|
||||||
#else
|
#else
|
||||||
return "GSnull Driver";
|
return "GSnull Driver";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(u32) PS2EgetLibVersion2(u32 type)
|
EXPORT_C_(u32)
|
||||||
|
PS2EgetLibVersion2(u32 type)
|
||||||
{
|
{
|
||||||
return (version<<16) | (revision<<8) | build;
|
return (version << 16) | (revision << 8) | build;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSprintf(int timeout, char *fmt, ...)
|
EXPORT_C_(void)
|
||||||
|
GSprintf(int timeout, char* fmt, ...)
|
||||||
{
|
{
|
||||||
va_list list;
|
va_list list;
|
||||||
char msg[512];
|
char msg[512];
|
||||||
|
|
||||||
va_start(list, fmt);
|
va_start(list, fmt);
|
||||||
vsprintf(msg, fmt, list);
|
vsprintf(msg, fmt, list);
|
||||||
va_end(list);
|
va_end(list);
|
||||||
|
|
||||||
GSLog::Print("GSprintf:%s", msg);
|
GSLog::Print("GSprintf:%s", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// basic funcs
|
// basic funcs
|
||||||
EXPORT_C_(void) GSsetSettingsDir(const char* dir)
|
EXPORT_C_(void)
|
||||||
|
GSsetSettingsDir(const char* dir)
|
||||||
{
|
{
|
||||||
s_strIniPath = (dir == NULL) ? "inis" : dir;
|
s_strIniPath = (dir == NULL) ? "inis" : dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSsetLogDir(const char* dir)
|
EXPORT_C_(void)
|
||||||
|
GSsetLogDir(const char* dir)
|
||||||
{
|
{
|
||||||
// Get the path to the log directory.
|
// Get the path to the log directory.
|
||||||
s_strLogPath = (dir==NULL) ? "logs" : dir;
|
s_strLogPath = (dir == NULL) ? "logs" : dir;
|
||||||
|
|
||||||
// Reload the log file after updated the path
|
// Reload the log file after updated the path
|
||||||
GSLog::Close();
|
GSLog::Close();
|
||||||
GSLog::Open();
|
GSLog::Open();
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) GSinit()
|
EXPORT_C_(s32)
|
||||||
|
GSinit()
|
||||||
{
|
{
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
|
|
||||||
GSLog::Open();
|
GSLog::Open();
|
||||||
|
|
||||||
GSLog::WriteLn("Initializing GSnull.");
|
GSLog::WriteLn("Initializing GSnull.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSshutdown()
|
EXPORT_C_(void)
|
||||||
|
GSshutdown()
|
||||||
{
|
{
|
||||||
GSLog::WriteLn("Shutting down GSnull.");
|
GSLog::WriteLn("Shutting down GSnull.");
|
||||||
GSCloseWindow();
|
GSCloseWindow();
|
||||||
GSLog::Close();
|
GSLog::Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) GSopen(void *pDsp, const char *Title, int multithread)
|
EXPORT_C_(s32)
|
||||||
|
GSopen(void* pDsp, const char* Title, int multithread)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
GSLog::WriteLn("GS open.");
|
GSLog::WriteLn("GS open.");
|
||||||
//assert( GSirq != NULL );
|
//assert( GSirq != NULL );
|
||||||
|
|
||||||
err = GSOpenWindow(pDsp, Title);
|
err = GSOpenWindow(pDsp, Title);
|
||||||
gs.MultiThreaded = multithread;
|
gs.MultiThreaded = multithread;
|
||||||
|
|
||||||
ResetRegs();
|
ResetRegs();
|
||||||
SetMultithreaded();
|
SetMultithreaded();
|
||||||
InitPath();
|
InitPath();
|
||||||
GSLog::WriteLn("Opening GSnull.");
|
GSLog::WriteLn("Opening GSnull.");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_GSOPEN2
|
#ifdef USE_GSOPEN2
|
||||||
EXPORT_C_(s32) GSopen2( void *pDsp, u32 flags )
|
EXPORT_C_(s32)
|
||||||
|
GSopen2(void* pDsp, u32 flags)
|
||||||
{
|
{
|
||||||
GSLog::WriteLn("GS open2.");
|
GSLog::WriteLn("GS open2.");
|
||||||
|
|
||||||
GSOpenWindow2(pDsp, flags);
|
GSOpenWindow2(pDsp, flags);
|
||||||
|
|
||||||
gs.MultiThreaded = true;
|
gs.MultiThreaded = true;
|
||||||
|
|
||||||
ResetRegs();
|
ResetRegs();
|
||||||
SetMultithreaded();
|
SetMultithreaded();
|
||||||
InitPath();
|
InitPath();
|
||||||
GSLog::WriteLn("Opening GSnull (2).");
|
GSLog::WriteLn("Opening GSnull (2).");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EXPORT_C_(void) GSclose()
|
EXPORT_C_(void)
|
||||||
|
GSclose()
|
||||||
{
|
{
|
||||||
GSLog::WriteLn("Closing GSnull.");
|
GSLog::WriteLn("Closing GSnull.");
|
||||||
|
|
||||||
// Better to only close the window on Shutdown. All the other plugins
|
// Better to only close the window on Shutdown. All the other plugins
|
||||||
// pretty much worked that way, and all old PCSX2 versions expect it as well.
|
// pretty much worked that way, and all old PCSX2 versions expect it as well.
|
||||||
//GSCloseWindow();
|
//GSCloseWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSirqCallback(void (*callback)())
|
EXPORT_C_(void)
|
||||||
|
GSirqCallback(void (*callback)())
|
||||||
{
|
{
|
||||||
GSirq = callback;
|
GSirq = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) GSfreeze(int mode, freezeData *data)
|
EXPORT_C_(s32)
|
||||||
|
GSfreeze(int mode, freezeData* data)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) GStest()
|
EXPORT_C_(s32)
|
||||||
|
GStest()
|
||||||
{
|
{
|
||||||
GSLog::WriteLn("Testing GSnull.");
|
GSLog::WriteLn("Testing GSnull.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSvsync(int field)
|
EXPORT_C_(void)
|
||||||
|
GSvsync(int field)
|
||||||
{
|
{
|
||||||
GSProcessMessages();
|
GSProcessMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns the last tag processed (64 bits)
|
// returns the last tag processed (64 bits)
|
||||||
EXPORT_C_(void) GSgetLastTag(u64* ptag)
|
EXPORT_C_(void)
|
||||||
|
GSgetLastTag(u64* ptag)
|
||||||
{
|
{
|
||||||
*(u32*)ptag = gs.nPath3Hack;
|
*(u32*)ptag = gs.nPath3Hack;
|
||||||
gs.nPath3Hack = 0;
|
gs.nPath3Hack = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSgifSoftReset(u32 mask)
|
EXPORT_C_(void)
|
||||||
|
GSgifSoftReset(u32 mask)
|
||||||
{
|
{
|
||||||
GSLog::WriteLn("Doing a soft reset of the GS plugin.");
|
GSLog::WriteLn("Doing a soft reset of the GS plugin.");
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSreadFIFO(u64 *mem)
|
EXPORT_C_(void)
|
||||||
|
GSreadFIFO(u64* mem)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSreadFIFO2(u64 *mem, int qwc)
|
EXPORT_C_(void)
|
||||||
|
GSreadFIFO2(u64* mem, int qwc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// extended funcs
|
// extended funcs
|
||||||
|
|
||||||
// GSkeyEvent gets called when there is a keyEvent from the PAD plugin
|
// GSkeyEvent gets called when there is a keyEvent from the PAD plugin
|
||||||
EXPORT_C_(void) GSkeyEvent(keyEvent *ev)
|
EXPORT_C_(void)
|
||||||
|
GSkeyEvent(keyEvent* ev)
|
||||||
{
|
{
|
||||||
HandleKeyEvent(ev);
|
HandleKeyEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSchangeSaveState(int, const char* filename)
|
EXPORT_C_(void)
|
||||||
|
GSchangeSaveState(int, const char* filename)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSmakeSnapshot(char *path)
|
EXPORT_C_(void)
|
||||||
|
GSmakeSnapshot(char* path)
|
||||||
{
|
{
|
||||||
|
|
||||||
GSLog::WriteLn("Taking a snapshot.");
|
GSLog::WriteLn("Taking a snapshot.");
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSmakeSnapshot2(char *pathname, int* snapdone, int savejpg)
|
EXPORT_C_(void)
|
||||||
|
GSmakeSnapshot2(char* pathname, int* snapdone, int savejpg)
|
||||||
{
|
{
|
||||||
GSLog::WriteLn("Taking a snapshot to %s.", pathname);
|
GSLog::WriteLn("Taking a snapshot to %s.", pathname);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSsetBaseMem(void*)
|
EXPORT_C_(void)
|
||||||
|
GSsetBaseMem(void*)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSsetGameCRC(int crc, int gameoptions)
|
EXPORT_C_(void)
|
||||||
|
GSsetGameCRC(int crc, int gameoptions)
|
||||||
{
|
{
|
||||||
GSLog::WriteLn("Setting the crc to '%x' with 0x%x for options.", crc, gameoptions);
|
GSLog::WriteLn("Setting the crc to '%x' with 0x%x for options.", crc, gameoptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
// controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done
|
// controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done
|
||||||
EXPORT_C_(void) GSsetFrameSkip(int frameskip)
|
EXPORT_C_(void)
|
||||||
|
GSsetFrameSkip(int frameskip)
|
||||||
{
|
{
|
||||||
SetFrameSkip(frameskip != 0);
|
SetFrameSkip(frameskip != 0);
|
||||||
GSLog::WriteLn("Frameskip set to %d.", frameskip);
|
GSLog::WriteLn("Frameskip set to %d.", frameskip);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if start is 1, starts recording spu2 data, else stops
|
// if start is 1, starts recording spu2 data, else stops
|
||||||
// returns a non zero value if successful
|
// returns a non zero value if successful
|
||||||
// for now, pData is not used
|
// for now, pData is not used
|
||||||
EXPORT_C_(int) GSsetupRecording(int start, void* pData)
|
EXPORT_C_(int)
|
||||||
|
GSsetupRecording(int start, void* pData)
|
||||||
{
|
{
|
||||||
if (start)
|
if (start)
|
||||||
GSLog::WriteLn("Pretending to record.");
|
GSLog::WriteLn("Pretending to record.");
|
||||||
else
|
else
|
||||||
GSLog::WriteLn("Pretending to stop recording.");
|
GSLog::WriteLn("Pretending to stop recording.");
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSreset()
|
EXPORT_C_(void)
|
||||||
|
GSreset()
|
||||||
{
|
{
|
||||||
GSLog::WriteLn("Doing a reset of the GS plugin.");
|
GSLog::WriteLn("Doing a reset of the GS plugin.");
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSwriteCSR(u32 value)
|
EXPORT_C_(void)
|
||||||
|
GSwriteCSR(u32 value)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSgetDriverInfo(GSdriverInfo *info)
|
EXPORT_C_(void)
|
||||||
|
GSgetDriverInfo(GSdriverInfo* info)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,11 +23,11 @@ typedef struct _keyEvent keyEvent;
|
||||||
#include "Pcsx2Defs.h"
|
#include "Pcsx2Defs.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# include "Windows/GSwin.h"
|
#include "Windows/GSwin.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
# include "Linux/GSLinux.h"
|
#include "Linux/GSLinux.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GSdefs
|
#define GSdefs
|
||||||
|
@ -40,7 +40,7 @@ typedef struct _keyEvent keyEvent;
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define EXPORT_C_(type) extern "C" type CALLBACK
|
#define EXPORT_C_(type) extern "C" type CALLBACK
|
||||||
#else
|
#else
|
||||||
#define EXPORT_C_(type) extern "C" __attribute__((stdcall,externally_visible,visibility("default"))) type
|
#define EXPORT_C_(type) extern "C" __attribute__((stdcall, externally_visible, visibility("default"))) type
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#define GS_LOG GSLog::Log
|
//#define GS_LOG GSLog::Log
|
||||||
|
@ -51,22 +51,22 @@ extern const unsigned char build;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int Log;
|
int Log;
|
||||||
bool path3;
|
bool path3;
|
||||||
} Config;
|
} Config;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
u32 CSRw;
|
u32 CSRw;
|
||||||
pathInfo path[4];
|
pathInfo path[4];
|
||||||
bool Path3transfer;
|
bool Path3transfer;
|
||||||
float q;
|
float q;
|
||||||
u32 imageTransfer;
|
u32 imageTransfer;
|
||||||
int MultiThreaded;
|
int MultiThreaded;
|
||||||
int nPath3Hack;
|
int nPath3Hack;
|
||||||
|
|
||||||
GIFReg regs;
|
GIFReg regs;
|
||||||
GIFCTXTReg ctxt_regs[2];
|
GIFCTXTReg ctxt_regs[2];
|
||||||
} GSVars;
|
} GSVars;
|
||||||
|
|
||||||
extern GSVars gs;
|
extern GSVars gs;
|
||||||
|
@ -79,12 +79,12 @@ extern void (*GSirq)();
|
||||||
|
|
||||||
namespace GSLog
|
namespace GSLog
|
||||||
{
|
{
|
||||||
extern bool Open();
|
extern bool Open();
|
||||||
extern void Close();
|
extern void Close();
|
||||||
extern void Log(char *fmt, ...);
|
extern void Log(char* fmt, ...);
|
||||||
extern void Message(char *fmt, ...);
|
extern void Message(char* fmt, ...);
|
||||||
extern void Print(const char *fmt, ...);
|
extern void Print(const char* fmt, ...);
|
||||||
extern void WriteLn(const char *fmt, ...);
|
extern void WriteLn(const char* fmt, ...);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void SaveConfig();
|
extern void SaveConfig();
|
||||||
|
|
|
@ -32,88 +32,85 @@ std::string s_strLogPath("logs");
|
||||||
|
|
||||||
namespace GSLog
|
namespace GSLog
|
||||||
{
|
{
|
||||||
FILE *gsLog;
|
FILE* gsLog;
|
||||||
|
|
||||||
bool Open()
|
|
||||||
{
|
|
||||||
bool result = true;
|
|
||||||
|
|
||||||
const std::string LogFile(s_strLogPath + "/GSnull.log");
|
|
||||||
|
|
||||||
gsLog = fopen(LogFile.c_str(), "w");
|
bool Open()
|
||||||
|
{
|
||||||
if (gsLog != NULL)
|
bool result = true;
|
||||||
{
|
|
||||||
setvbuf(gsLog, NULL, _IONBF, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Message("Can't create log file %s.", LogFile.c_str());
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteLn("GSnull plugin version %d,%d",revision,build);
|
|
||||||
WriteLn("GS init.");
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Close()
|
|
||||||
{
|
|
||||||
if (gsLog)
|
|
||||||
{
|
|
||||||
fclose(gsLog);
|
|
||||||
gsLog = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Log(char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list list;
|
|
||||||
|
|
||||||
if (!conf.Log || gsLog == NULL) return;
|
const std::string LogFile(s_strLogPath + "/GSnull.log");
|
||||||
|
|
||||||
va_start(list, fmt);
|
gsLog = fopen(LogFile.c_str(), "w");
|
||||||
vfprintf(gsLog, fmt, list);
|
|
||||||
va_end(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Message(char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list list;
|
|
||||||
char msg[512];
|
|
||||||
|
|
||||||
va_start(list, fmt);
|
if (gsLog != NULL) {
|
||||||
vsprintf(msg, fmt, list);
|
setvbuf(gsLog, NULL, _IONBF, 0);
|
||||||
va_end(list);
|
} else {
|
||||||
|
Message("Can't create log file %s.", LogFile.c_str());
|
||||||
SysMessage("%s\n",msg);
|
result = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Print(const char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list list;
|
|
||||||
char msg[512];
|
|
||||||
|
|
||||||
va_start(list, fmt);
|
WriteLn("GSnull plugin version %d,%d", revision, build);
|
||||||
vsprintf(msg, fmt, list);
|
WriteLn("GS init.");
|
||||||
va_end(list);
|
|
||||||
|
|
||||||
Log(msg);
|
return result;
|
||||||
fprintf(stderr, "GSnull:%s", msg);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void WriteLn(const char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list list;
|
|
||||||
char msg[512];
|
|
||||||
|
|
||||||
va_start(list, fmt);
|
void Close()
|
||||||
vsprintf(msg, fmt, list);
|
{
|
||||||
va_end(list);
|
if (gsLog) {
|
||||||
|
fclose(gsLog);
|
||||||
|
gsLog = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Log("%s\n", msg);
|
void Log(char* fmt, ...)
|
||||||
fprintf(stderr, "GSnull:%s\n", msg);
|
{
|
||||||
}
|
va_list list;
|
||||||
|
|
||||||
|
if (!conf.Log || gsLog == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
va_start(list, fmt);
|
||||||
|
vfprintf(gsLog, fmt, list);
|
||||||
|
va_end(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Message(char* fmt, ...)
|
||||||
|
{
|
||||||
|
va_list list;
|
||||||
|
char msg[512];
|
||||||
|
|
||||||
|
va_start(list, fmt);
|
||||||
|
vsprintf(msg, fmt, list);
|
||||||
|
va_end(list);
|
||||||
|
|
||||||
|
SysMessage("%s\n", msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Print(const char* fmt, ...)
|
||||||
|
{
|
||||||
|
va_list list;
|
||||||
|
char msg[512];
|
||||||
|
|
||||||
|
va_start(list, fmt);
|
||||||
|
vsprintf(msg, fmt, list);
|
||||||
|
va_end(list);
|
||||||
|
|
||||||
|
Log(msg);
|
||||||
|
fprintf(stderr, "GSnull:%s", msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WriteLn(const char* fmt, ...)
|
||||||
|
{
|
||||||
|
va_list list;
|
||||||
|
char msg[512];
|
||||||
|
|
||||||
|
va_start(list, fmt);
|
||||||
|
vsprintf(msg, fmt, list);
|
||||||
|
va_end(list);
|
||||||
|
|
||||||
|
Log("%s\n", msg);
|
||||||
|
fprintf(stderr, "GSnull:%s\n", msg);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// Processes a GIFtag & packet, and throws out some gsIRQs as needed.
|
// Processes a GIFtag & packet, and throws out some gsIRQs as needed.
|
||||||
// Used to keep interrupts in sync with the EE, while the GS itself
|
// Used to keep interrupts in sync with the EE, while the GS itself
|
||||||
// runs potentially several frames behind.
|
// runs potentially several frames behind.
|
||||||
// size - size of the packet in simd128's
|
// size - size of the packet in simd128's
|
||||||
|
@ -26,174 +26,162 @@ using namespace std;
|
||||||
|
|
||||||
extern GSVars gs;
|
extern GSVars gs;
|
||||||
|
|
||||||
PCSX2_ALIGNED16( u8 g_RealGSMem[0x2000] );
|
PCSX2_ALIGNED16(u8 g_RealGSMem[0x2000]);
|
||||||
|
|
||||||
template<int index> void _GSgifTransfer(const u32 *pMem, u32 size)
|
template <int index>
|
||||||
|
void _GSgifTransfer(const u32* pMem, u32 size)
|
||||||
{
|
{
|
||||||
// FUNCLOG
|
// FUNCLOG
|
||||||
|
|
||||||
pathInfo *path = &gs.path[index];
|
pathInfo* path = &gs.path[index];
|
||||||
|
|
||||||
while (size > 0)
|
|
||||||
{
|
|
||||||
//GSLog::Writeln(_T("Transfer(%08x, %d) START\n"), pMem, size);
|
|
||||||
if (path->nloop == 0)
|
|
||||||
{
|
|
||||||
path->setTag(pMem);
|
|
||||||
pMem += 4;
|
|
||||||
size--;
|
|
||||||
|
|
||||||
// eeuser 7.2.2. GIFtag: "... when NLOOP is 0, the GIF does not output anything, and
|
while (size > 0) {
|
||||||
// values other than the EOP field are disregarded."
|
//GSLog::Writeln(_T("Transfer(%08x, %d) START\n"), pMem, size);
|
||||||
if (path->nloop > 0)
|
if (path->nloop == 0) {
|
||||||
{
|
path->setTag(pMem);
|
||||||
gs.q = 1.0f;
|
pMem += 4;
|
||||||
|
size--;
|
||||||
|
|
||||||
if (path->tag.PRE && (path->tag.FLG == GIF_FLG_PACKED))
|
// eeuser 7.2.2. GIFtag: "... when NLOOP is 0, the GIF does not output anything, and
|
||||||
{
|
// values other than the EOP field are disregarded."
|
||||||
u32 tagprim = path->tag.PRIM;
|
if (path->nloop > 0) {
|
||||||
GIFRegHandlerPRIM((u32*)&tagprim);
|
gs.q = 1.0f;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (path->mode)
|
|
||||||
{
|
|
||||||
case GIF_FLG_PACKED:
|
|
||||||
{
|
|
||||||
// first try a shortcut for a very common case
|
|
||||||
|
|
||||||
if (path->adonly && size >= path->nloop)
|
if (path->tag.PRE && (path->tag.FLG == GIF_FLG_PACKED)) {
|
||||||
{
|
u32 tagprim = path->tag.PRIM;
|
||||||
size -= path->nloop;
|
GIFRegHandlerPRIM((u32*)&tagprim);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch (path->mode) {
|
||||||
|
case GIF_FLG_PACKED: {
|
||||||
|
// first try a shortcut for a very common case
|
||||||
|
|
||||||
do
|
if (path->adonly && size >= path->nloop) {
|
||||||
{
|
size -= path->nloop;
|
||||||
GIFPackedRegHandlerA_D(pMem);
|
|
||||||
|
|
||||||
pMem += 4; //sizeof(GIFPackedReg)/4;
|
do {
|
||||||
}
|
GIFPackedRegHandlerA_D(pMem);
|
||||||
while(--path->nloop > 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
do
|
pMem += 4; //sizeof(GIFPackedReg)/4;
|
||||||
{
|
} while (--path->nloop > 0);
|
||||||
u32 reg = path->GetReg();
|
break;
|
||||||
GIFPackedRegHandlers[reg](pMem);
|
}
|
||||||
|
|
||||||
pMem += 4; //sizeof(GIFPackedReg)/4;
|
|
||||||
size--;
|
|
||||||
}
|
|
||||||
while (path->StepReg() && (size > 0));
|
|
||||||
|
|
||||||
break;
|
do {
|
||||||
}
|
u32 reg = path->GetReg();
|
||||||
|
GIFPackedRegHandlers[reg](pMem);
|
||||||
|
|
||||||
case GIF_FLG_REGLIST:
|
pMem += 4; //sizeof(GIFPackedReg)/4;
|
||||||
{
|
size--;
|
||||||
//GSLog::Writeln("%8.8x%8.8x %d L", ((u32*)&gs.regs)[1], *(u32*)&gs.regs, path->tag.nreg/4);
|
} while (path->StepReg() && (size > 0));
|
||||||
|
|
||||||
size *= 2;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
do
|
case GIF_FLG_REGLIST: {
|
||||||
{
|
//GSLog::Writeln("%8.8x%8.8x %d L", ((u32*)&gs.regs)[1], *(u32*)&gs.regs, path->tag.nreg/4);
|
||||||
GIFRegHandlers[path->GetReg()](pMem);
|
|
||||||
|
|
||||||
pMem += 2;
|
size *= 2;
|
||||||
size--;
|
|
||||||
}
|
|
||||||
while (path->StepReg() && (size > 0));
|
|
||||||
|
|
||||||
if (size & 1) pMem += 2;
|
do {
|
||||||
size /= 2;
|
GIFRegHandlers[path->GetReg()](pMem);
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case GIF_FLG_IMAGE: // FROM_VFRAM
|
pMem += 2;
|
||||||
case GIF_FLG_IMAGE2: // Used in the DirectX version, so we'll use it here too.
|
size--;
|
||||||
{
|
} while (path->StepReg() && (size > 0));
|
||||||
int len = min(size, path->nloop);
|
|
||||||
//GSLog::Writeln("GIF_FLG_IMAGE(%d)=%d", gs.imageTransfer, len);
|
|
||||||
|
|
||||||
switch (gs.imageTransfer)
|
if (size & 1)
|
||||||
{
|
pMem += 2;
|
||||||
case 0:
|
size /= 2;
|
||||||
//TransferHostLocal(pMem, len * 4);
|
break;
|
||||||
break;
|
}
|
||||||
|
|
||||||
case 1:
|
case GIF_FLG_IMAGE: // FROM_VFRAM
|
||||||
// This can't happen; downloads can not be started or performed as part of
|
case GIF_FLG_IMAGE2: // Used in the DirectX version, so we'll use it here too.
|
||||||
// a GIFtag operation. They're an entirely separate process that can only be
|
{
|
||||||
// done through the ReverseFIFO transfer (aka ReadFIFO). --air
|
int len = min(size, path->nloop);
|
||||||
assert(0);
|
//GSLog::Writeln("GIF_FLG_IMAGE(%d)=%d", gs.imageTransfer, len);
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
switch (gs.imageTransfer) {
|
||||||
// //TransferLocalLocal();
|
case 0:
|
||||||
break;
|
//TransferHostLocal(pMem, len * 4);
|
||||||
|
break;
|
||||||
|
|
||||||
case 3:
|
case 1:
|
||||||
//assert(0);
|
// This can't happen; downloads can not be started or performed as part of
|
||||||
break;
|
// a GIFtag operation. They're an entirely separate process that can only be
|
||||||
|
// done through the ReverseFIFO transfer (aka ReadFIFO). --air
|
||||||
|
assert(0);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
case 2:
|
||||||
//assert(0);
|
// //TransferLocalLocal();
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
pMem += len * 4;
|
case 3:
|
||||||
|
//assert(0);
|
||||||
|
break;
|
||||||
|
|
||||||
path->nloop -= len;
|
default:
|
||||||
size -= len;
|
//assert(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
pMem += len * 4;
|
||||||
}
|
|
||||||
|
|
||||||
default: // GIF_IMAGE
|
path->nloop -= len;
|
||||||
GSLog::WriteLn("*** WARNING **** Unexpected GIFTag flag.");
|
size -= len;
|
||||||
assert(0);
|
|
||||||
path->nloop = 0;
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
}
|
default: // GIF_IMAGE
|
||||||
}
|
GSLog::WriteLn("*** WARNING **** Unexpected GIFTag flag.");
|
||||||
|
assert(0);
|
||||||
|
path->nloop = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DO_GIF_TRANSFERS
|
#define DO_GIF_TRANSFERS
|
||||||
|
|
||||||
// Obsolete. Included because it's still in GSdef.
|
// Obsolete. Included because it's still in GSdef.
|
||||||
EXPORT_C_(void) GSgifTransfer1(u32 *pMem, u32 addr)
|
EXPORT_C_(void)
|
||||||
|
GSgifTransfer1(u32* pMem, u32 addr)
|
||||||
{
|
{
|
||||||
#ifdef DO_GIF_TRANSFERS
|
#ifdef DO_GIF_TRANSFERS
|
||||||
_GSgifTransfer<0>((u32*)((u8*)pMem + addr), (0x4000 - addr) / 16);
|
_GSgifTransfer<0>((u32*)((u8*)pMem + addr), (0x4000 - addr) / 16);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSgifTransfer(const u32 *pMem, u32 size)
|
EXPORT_C_(void)
|
||||||
|
GSgifTransfer(const u32* pMem, u32 size)
|
||||||
{
|
{
|
||||||
#ifdef DO_GIF_TRANSFERS
|
#ifdef DO_GIF_TRANSFERS
|
||||||
_GSgifTransfer<3>(const_cast<u32*>(pMem), size);
|
_GSgifTransfer<3>(const_cast<u32*>(pMem), size);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSgifTransfer2(u32 *pMem, u32 size)
|
EXPORT_C_(void)
|
||||||
|
GSgifTransfer2(u32* pMem, u32 size)
|
||||||
{
|
{
|
||||||
#ifdef DO_GIF_TRANSFERS
|
#ifdef DO_GIF_TRANSFERS
|
||||||
_GSgifTransfer<1>(const_cast<u32*>(pMem), size);
|
_GSgifTransfer<1>(const_cast<u32*>(pMem), size);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSgifTransfer3(u32 *pMem, u32 size)
|
EXPORT_C_(void)
|
||||||
|
GSgifTransfer3(u32* pMem, u32 size)
|
||||||
{
|
{
|
||||||
#ifdef DO_GIF_TRANSFERS
|
#ifdef DO_GIF_TRANSFERS
|
||||||
_GSgifTransfer<2>(const_cast<u32*>(pMem), size);
|
_GSgifTransfer<2>(const_cast<u32*>(pMem), size);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitPath()
|
void InitPath()
|
||||||
{
|
{
|
||||||
gs.path[0].mode = gs.path[1].mode = gs.path[2].mode = gs.path[3].mode = 0;
|
gs.path[0].mode = gs.path[1].mode = gs.path[2].mode = gs.path[3].mode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,110 +20,113 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "Registers.h"
|
#include "Registers.h"
|
||||||
|
|
||||||
enum GIF_FLG
|
enum GIF_FLG {
|
||||||
{
|
GIF_FLG_PACKED = 0,
|
||||||
GIF_FLG_PACKED = 0,
|
GIF_FLG_REGLIST = 1,
|
||||||
GIF_FLG_REGLIST = 1,
|
GIF_FLG_IMAGE = 2,
|
||||||
GIF_FLG_IMAGE = 2,
|
GIF_FLG_IMAGE2 = 3
|
||||||
GIF_FLG_IMAGE2 = 3
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// GIFTag
|
// GIFTag
|
||||||
union GIFTag
|
union GIFTag
|
||||||
{
|
{
|
||||||
u64 ai64[2];
|
u64 ai64[2];
|
||||||
u32 ai32[4];
|
u32 ai32[4];
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
u32 NLOOP : 15;
|
u32 NLOOP : 15;
|
||||||
u32 EOP : 1;
|
u32 EOP : 1;
|
||||||
u32 _PAD1 : 16;
|
u32 _PAD1 : 16;
|
||||||
u32 _PAD2 : 14;
|
u32 _PAD2 : 14;
|
||||||
u32 PRE : 1;
|
u32 PRE : 1;
|
||||||
u32 PRIM : 11;
|
u32 PRIM : 11;
|
||||||
u32 FLG : 2; // enum GIF_FLG
|
u32 FLG : 2; // enum GIF_FLG
|
||||||
u32 NREG : 4;
|
u32 NREG : 4;
|
||||||
u64 REGS : 64;
|
u64 REGS : 64;
|
||||||
};
|
};
|
||||||
|
|
||||||
void set(const u32 *data)
|
void set(const u32* data)
|
||||||
{
|
{
|
||||||
for (int i = 0; i <= 3; i++)
|
for (int i = 0; i <= 3; i++) {
|
||||||
{
|
ai32[i] = data[i];
|
||||||
ai32[i] = data[i];
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
GIFTag(u32 *data)
|
GIFTag(u32* data)
|
||||||
{
|
{
|
||||||
set(data);
|
set(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
GIFTag(){ ai64[0] = 0; ai64[1] = 0; }
|
GIFTag()
|
||||||
|
{
|
||||||
|
ai64[0] = 0;
|
||||||
|
ai64[1] = 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// EE part. Data transfer packet description
|
// EE part. Data transfer packet description
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
u32 mode;
|
u32 mode;
|
||||||
int reg;
|
int reg;
|
||||||
u64 regs;
|
u64 regs;
|
||||||
u32 nloop;
|
u32 nloop;
|
||||||
int eop;
|
int eop;
|
||||||
int nreg;
|
int nreg;
|
||||||
u32 adonly;
|
u32 adonly;
|
||||||
GIFTag tag;
|
GIFTag tag;
|
||||||
|
|
||||||
void setTag(const u32 *data)
|
void setTag(const u32* data)
|
||||||
{
|
{
|
||||||
tag.set(data);
|
tag.set(data);
|
||||||
|
|
||||||
nloop = tag.NLOOP;
|
nloop = tag.NLOOP;
|
||||||
eop = tag.EOP;
|
eop = tag.EOP;
|
||||||
mode = tag.FLG;
|
mode = tag.FLG;
|
||||||
//adonly = false;
|
//adonly = false;
|
||||||
|
|
||||||
// Hmm....
|
// Hmm....
|
||||||
nreg = tag.NREG << 2;
|
nreg = tag.NREG << 2;
|
||||||
if (nreg == 0) nreg = 64;
|
if (nreg == 0)
|
||||||
regs = tag.REGS;
|
nreg = 64;
|
||||||
reg = 0;
|
regs = tag.REGS;
|
||||||
//if ((nreg == 4) && (regs == GIF_REG_A_D)) adonly = true;
|
reg = 0;
|
||||||
|
//if ((nreg == 4) && (regs == GIF_REG_A_D)) adonly = true;
|
||||||
|
|
||||||
// GSLog::Writeln"GIFtag: %8.8lx_%8.8lx_%8.8lx_%8.8lx: EOP=%d, NLOOP=%x, FLG=%x, NREG=%d, PRE=%d",
|
// GSLog::Writeln"GIFtag: %8.8lx_%8.8lx_%8.8lx_%8.8lx: EOP=%d, NLOOP=%x, FLG=%x, NREG=%d, PRE=%d",
|
||||||
// data[3], data[2], data[1], data[0],
|
// data[3], data[2], data[1], data[0],
|
||||||
// path->eop, path->nloop, mode, path->nreg, tag.PRE);
|
// path->eop, path->nloop, mode, path->nreg, tag.PRE);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GetReg()
|
u32 GetReg()
|
||||||
{
|
{
|
||||||
return (regs >> reg) & 0xf;
|
return (regs >> reg) & 0xf;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StepReg()
|
bool StepReg()
|
||||||
{
|
{
|
||||||
reg += 4;
|
reg += 4;
|
||||||
|
|
||||||
if (reg == nreg)
|
if (reg == nreg) {
|
||||||
{
|
reg = 0;
|
||||||
reg = 0;
|
nloop--;
|
||||||
nloop--;
|
|
||||||
|
|
||||||
if (nloop == 0) return false;
|
if (nloop == 0)
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} pathInfo;
|
} pathInfo;
|
||||||
|
|
||||||
extern void _GSgifPacket(pathInfo *path, const u32 *pMem);
|
extern void _GSgifPacket(pathInfo* path, const u32* pMem);
|
||||||
extern void _GSgifRegList(pathInfo *path, const u32 *pMem);
|
extern void _GSgifRegList(pathInfo* path, const u32* pMem);
|
||||||
template<int index>
|
template <int index>
|
||||||
extern void _GSgifTransfer(const u32 *pMem, u32 size);
|
extern void _GSgifTransfer(const u32* pMem, u32 size);
|
||||||
extern GIFRegHandler GIFPackedRegHandlers[];
|
extern GIFRegHandler GIFPackedRegHandlers[];
|
||||||
extern GIFRegHandler GIFRegHandlers[];
|
extern GIFRegHandler GIFRegHandlers[];
|
||||||
#endif // GIFTRANSFER_H_INCLUDED
|
#endif // GIFTRANSFER_H_INCLUDED
|
||||||
|
|
|
@ -27,41 +27,39 @@ PluginConf Ini;
|
||||||
|
|
||||||
void CFGabout()
|
void CFGabout()
|
||||||
{
|
{
|
||||||
SysMessage("GSnull: A simple null plugin.");
|
SysMessage("GSnull: A simple null plugin.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFGconfigure()
|
void CFGconfigure()
|
||||||
{
|
{
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadConfig()
|
void LoadConfig()
|
||||||
{
|
{
|
||||||
const std::string iniFile(s_strIniPath + "/GSNull.ini");
|
const std::string iniFile(s_strIniPath + "/GSNull.ini");
|
||||||
|
|
||||||
if (!Ini.Open(iniFile, READ_FILE))
|
if (!Ini.Open(iniFile, READ_FILE)) {
|
||||||
{
|
printf("failed to open %s\n", iniFile.c_str());
|
||||||
printf("failed to open %s\n", iniFile.c_str());
|
SaveConfig(); //save and return
|
||||||
SaveConfig();//save and return
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
conf.Log = Ini.ReadInt("logging", 0);
|
conf.Log = Ini.ReadInt("logging", 0);
|
||||||
Ini.Close();
|
Ini.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveConfig()
|
void SaveConfig()
|
||||||
{
|
{
|
||||||
const std::string iniFile(s_strIniPath + "/GSNull.ini");
|
const std::string iniFile(s_strIniPath + "/GSNull.ini");
|
||||||
|
|
||||||
if (!Ini.Open(iniFile, WRITE_FILE))
|
if (!Ini.Open(iniFile, WRITE_FILE)) {
|
||||||
{
|
printf("failed to open %s\n", iniFile.c_str());
|
||||||
printf("failed to open %s\n", iniFile.c_str());
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Ini.WriteInt("logging", conf.Log);
|
Ini.WriteInt("logging", conf.Log);
|
||||||
Ini.Close();
|
Ini.Close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,6 @@
|
||||||
void SaveConf();
|
void SaveConf();
|
||||||
void LoadConf();
|
void LoadConf();
|
||||||
|
|
||||||
extern long CFGmessage(char *msg);
|
extern long CFGmessage(char* msg);
|
||||||
extern void CFGconfigure();
|
extern void CFGconfigure();
|
||||||
extern void CFGabout();
|
extern void CFGabout();
|
||||||
|
|
|
@ -16,32 +16,32 @@
|
||||||
#include "GS.h"
|
#include "GS.h"
|
||||||
#include "GSLinux.h"
|
#include "GSLinux.h"
|
||||||
|
|
||||||
Display *display;
|
Display* display;
|
||||||
int screen;
|
int screen;
|
||||||
GtkScrolledWindow *win;
|
GtkScrolledWindow* win;
|
||||||
|
|
||||||
int GSOpenWindow(void *pDsp, const char *Title)
|
int GSOpenWindow(void* pDsp, const char* Title)
|
||||||
{
|
{
|
||||||
display = XOpenDisplay(0);
|
display = XOpenDisplay(0);
|
||||||
screen = DefaultScreen(display);
|
screen = DefaultScreen(display);
|
||||||
|
|
||||||
if (pDsp != NULL)
|
if (pDsp != NULL)
|
||||||
*(Display**)pDsp = display;
|
*(Display**)pDsp = display;
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GSOpenWindow2(void *pDsp, u32 flags)
|
int GSOpenWindow2(void* pDsp, u32 flags)
|
||||||
{
|
{
|
||||||
GtkWidget *widget;
|
GtkWidget* widget;
|
||||||
if (pDsp != NULL)
|
if (pDsp != NULL)
|
||||||
win = *(GtkScrolledWindow**)pDsp;
|
win = *(GtkScrolledWindow**)pDsp;
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSCloseWindow()
|
void GSCloseWindow()
|
||||||
|
@ -52,67 +52,62 @@ void GSCloseWindow()
|
||||||
|
|
||||||
void GSProcessMessages()
|
void GSProcessMessages()
|
||||||
{
|
{
|
||||||
if ( GSKeyEvent )
|
if (GSKeyEvent) {
|
||||||
{
|
int myKeyEvent = GSKeyEvent;
|
||||||
int myKeyEvent = GSKeyEvent;
|
bool myShift = GSShift;
|
||||||
bool myShift = GSShift;
|
GSKeyEvent = 0;
|
||||||
GSKeyEvent = 0;
|
|
||||||
|
|
||||||
switch ( myKeyEvent )
|
switch (myKeyEvent) {
|
||||||
{
|
case XK_F5:
|
||||||
case XK_F5:
|
OnKeyboardF5(myShift);
|
||||||
OnKeyboardF5(myShift);
|
break;
|
||||||
break;
|
case XK_F6:
|
||||||
case XK_F6:
|
OnKeyboardF6(myShift);
|
||||||
OnKeyboardF6(myShift);
|
break;
|
||||||
break;
|
case XK_F7:
|
||||||
case XK_F7:
|
OnKeyboardF7(myShift);
|
||||||
OnKeyboardF7(myShift);
|
break;
|
||||||
break;
|
case XK_F9:
|
||||||
case XK_F9:
|
OnKeyboardF9(myShift);
|
||||||
OnKeyboardF9(myShift);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void HandleKeyEvent(keyEvent *ev)
|
void HandleKeyEvent(keyEvent* ev)
|
||||||
{
|
{
|
||||||
switch(ev->evt)
|
switch (ev->evt) {
|
||||||
{
|
case KEYPRESS:
|
||||||
case KEYPRESS:
|
switch (ev->key) {
|
||||||
switch(ev->key)
|
case XK_F5:
|
||||||
{
|
case XK_F6:
|
||||||
case XK_F5:
|
case XK_F7:
|
||||||
case XK_F6:
|
case XK_F9:
|
||||||
case XK_F7:
|
GSKeyEvent = ev->key;
|
||||||
case XK_F9:
|
break;
|
||||||
GSKeyEvent = ev->key ;
|
case XK_Escape:
|
||||||
break;
|
break;
|
||||||
case XK_Escape:
|
case XK_Shift_L:
|
||||||
break;
|
case XK_Shift_R:
|
||||||
case XK_Shift_L:
|
GSShift = true;
|
||||||
case XK_Shift_R:
|
break;
|
||||||
GSShift = true;
|
case XK_Alt_L:
|
||||||
break;
|
case XK_Alt_R:
|
||||||
case XK_Alt_L:
|
GSAlt = true;
|
||||||
case XK_Alt_R:
|
break;
|
||||||
GSAlt = true;
|
}
|
||||||
break;
|
break;
|
||||||
}
|
case KEYRELEASE:
|
||||||
break;
|
switch (ev->key) {
|
||||||
case KEYRELEASE:
|
case XK_Shift_L:
|
||||||
switch(ev->key)
|
case XK_Shift_R:
|
||||||
{
|
GSShift = false;
|
||||||
case XK_Shift_L:
|
break;
|
||||||
case XK_Shift_R:
|
case XK_Alt_L:
|
||||||
GSShift = false;
|
case XK_Alt_R:
|
||||||
break;
|
GSAlt = false;
|
||||||
case XK_Alt_L:
|
break;
|
||||||
case XK_Alt_R:
|
}
|
||||||
GSAlt = false;
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
|
|
||||||
extern int GSOpenWindow(void *pDsp, const char *Title);
|
extern int GSOpenWindow(void* pDsp, const char* Title);
|
||||||
extern int GSOpenWindow2(void *pDsp, u32 flags);
|
extern int GSOpenWindow2(void* pDsp, u32 flags);
|
||||||
extern void GSCloseWindow();
|
extern void GSCloseWindow();
|
||||||
extern void GSProcessMessages();
|
extern void GSProcessMessages();
|
||||||
extern void HandleKeyEvent(keyEvent *ev);
|
extern void HandleKeyEvent(keyEvent* ev);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,13 +19,14 @@
|
||||||
#include "GS.h"
|
#include "GS.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
|
||||||
EXPORT_C_(void) GSconfigure()
|
EXPORT_C_(void)
|
||||||
|
GSconfigure()
|
||||||
{
|
{
|
||||||
CFGconfigure();
|
CFGconfigure();
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSabout()
|
EXPORT_C_(void)
|
||||||
|
GSabout()
|
||||||
{
|
{
|
||||||
CFGabout();
|
CFGabout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,14 +15,14 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "GS.h"
|
#include "GS.h"
|
||||||
#include "Registers.h"
|
#include "Registers.h"
|
||||||
|
|
||||||
GIFRegHandler GIFPackedRegHandlers[16];
|
GIFRegHandler GIFPackedRegHandlers[16];
|
||||||
GIFRegHandler GIFRegHandlers[256];
|
GIFRegHandler GIFRegHandlers[256];
|
||||||
|
|
||||||
// For now, I'm just rigging this up to store all the register information coming in, without doing
|
// For now, I'm just rigging this up to store all the register information coming in, without doing
|
||||||
// any of the normal processing.
|
// any of the normal processing.
|
||||||
|
|
||||||
void __gifCall GIFPackedRegHandlerNull(const u32* data)
|
void __gifCall GIFPackedRegHandlerNull(const u32* data)
|
||||||
|
@ -33,15 +33,15 @@ void __gifCall GIFPackedRegHandlerNull(const u32* data)
|
||||||
void __gifCall GIFPackedRegHandlerPRIM(const u32* data) { GIFRegHandlerPRIM(data); }
|
void __gifCall GIFPackedRegHandlerPRIM(const u32* data) { GIFRegHandlerPRIM(data); }
|
||||||
|
|
||||||
template <u32 i>
|
template <u32 i>
|
||||||
void __gifCall GIFPackedRegHandlerTEX0(const u32* data)
|
void __gifCall GIFPackedRegHandlerTEX0(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegHandlerTEX0<i>(data);
|
GIFRegHandlerTEX0<i>(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <u32 i>
|
template <u32 i>
|
||||||
void __gifCall GIFPackedRegHandlerCLAMP(const u32* data)
|
void __gifCall GIFPackedRegHandlerCLAMP(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegHandlerCLAMP<i>(data);
|
GIFRegHandlerCLAMP<i>(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFPackedRegHandlerTEX0_1(const u32* data) { GIFRegHandlerTEX0<0>(data); }
|
void __gifCall GIFPackedRegHandlerTEX0_1(const u32* data) { GIFRegHandlerTEX0<0>(data); }
|
||||||
|
@ -53,27 +53,27 @@ void __gifCall GIFPackedRegHandlerXYZ3(const u32* data) { GIFRegHandlerXYZ3(data
|
||||||
|
|
||||||
void __gifCall GIFPackedRegHandlerRGBA(const u32* data)
|
void __gifCall GIFPackedRegHandlerRGBA(const u32* data)
|
||||||
{
|
{
|
||||||
GIFPackedRGBA* r = (GIFPackedRGBA*)(data);
|
GIFPackedRGBA* r = (GIFPackedRGBA*)(data);
|
||||||
gs.regs.RGBAQ.R = r->R;
|
gs.regs.RGBAQ.R = r->R;
|
||||||
gs.regs.RGBAQ.G = r->G;
|
gs.regs.RGBAQ.G = r->G;
|
||||||
gs.regs.RGBAQ.B = r->B;
|
gs.regs.RGBAQ.B = r->B;
|
||||||
gs.regs.RGBAQ.A = r->A;
|
gs.regs.RGBAQ.A = r->A;
|
||||||
gs.regs.RGBAQ.Q = gs.q;
|
gs.regs.RGBAQ.Q = gs.q;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFPackedRegHandlerSTQ(const u32* data)
|
void __gifCall GIFPackedRegHandlerSTQ(const u32* data)
|
||||||
{
|
{
|
||||||
GIFPackedSTQ* r = (GIFPackedSTQ*)(data);
|
GIFPackedSTQ* r = (GIFPackedSTQ*)(data);
|
||||||
gs.regs.ST.S = r->S;
|
gs.regs.ST.S = r->S;
|
||||||
gs.regs.ST.T = r->T;
|
gs.regs.ST.T = r->T;
|
||||||
gs.q = r->Q;
|
gs.q = r->Q;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFPackedRegHandlerUV(const u32* data)
|
void __gifCall GIFPackedRegHandlerUV(const u32* data)
|
||||||
{
|
{
|
||||||
GIFPackedUV* r = (GIFPackedUV*)(data);
|
GIFPackedUV* r = (GIFPackedUV*)(data);
|
||||||
gs.regs.UV.U = r->U;
|
gs.regs.UV.U = r->U;
|
||||||
gs.regs.UV.V = r->V;
|
gs.regs.UV.V = r->V;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall KickVertex(bool adc)
|
void __gifCall KickVertex(bool adc)
|
||||||
|
@ -82,32 +82,32 @@ void __gifCall KickVertex(bool adc)
|
||||||
|
|
||||||
void __gifCall GIFPackedRegHandlerXYZF2(const u32* data)
|
void __gifCall GIFPackedRegHandlerXYZF2(const u32* data)
|
||||||
{
|
{
|
||||||
GIFPackedXYZF2* r = (GIFPackedXYZF2*)(data);
|
GIFPackedXYZF2* r = (GIFPackedXYZF2*)(data);
|
||||||
gs.regs.XYZ.X = r->X;
|
gs.regs.XYZ.X = r->X;
|
||||||
gs.regs.XYZ.Y = r->Y;
|
gs.regs.XYZ.Y = r->Y;
|
||||||
gs.regs.XYZ.Z = r->Z;
|
gs.regs.XYZ.Z = r->Z;
|
||||||
gs.regs.FOG.F = r->F;
|
gs.regs.FOG.F = r->F;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFPackedRegHandlerXYZ2(const u32* data)
|
void __gifCall GIFPackedRegHandlerXYZ2(const u32* data)
|
||||||
{
|
{
|
||||||
GIFPackedXYZ2* r = (GIFPackedXYZ2*)(data);
|
GIFPackedXYZ2* r = (GIFPackedXYZ2*)(data);
|
||||||
gs.regs.XYZ.X = r->X;
|
gs.regs.XYZ.X = r->X;
|
||||||
gs.regs.XYZ.Y = r->Y;
|
gs.regs.XYZ.Y = r->Y;
|
||||||
gs.regs.XYZ.Z = r->Z;
|
gs.regs.XYZ.Z = r->Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFPackedRegHandlerFOG(const u32* data)
|
void __gifCall GIFPackedRegHandlerFOG(const u32* data)
|
||||||
{
|
{
|
||||||
GIFPackedFOG* r = (GIFPackedFOG*)(data);
|
GIFPackedFOG* r = (GIFPackedFOG*)(data);
|
||||||
gs.regs.FOG.F = r->F;
|
gs.regs.FOG.F = r->F;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFPackedRegHandlerA_D(const u32* data)
|
void __gifCall GIFPackedRegHandlerA_D(const u32* data)
|
||||||
{
|
{
|
||||||
GIFPackedA_D* r = (GIFPackedA_D*)(data);
|
GIFPackedA_D* r = (GIFPackedA_D*)(data);
|
||||||
|
|
||||||
GIFRegHandlers[r->ADDR](data);
|
GIFRegHandlers[r->ADDR](data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFPackedRegHandlerNOP(const u32* data)
|
void __gifCall GIFPackedRegHandlerNOP(const u32* data)
|
||||||
|
@ -120,64 +120,64 @@ void __gifCall GIFRegHandlerNull(const u32* data)
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerRGBAQ(const u32* data)
|
void __gifCall GIFRegHandlerRGBAQ(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegRGBAQ* r = (GIFRegRGBAQ*)(data);
|
GIFRegRGBAQ* r = (GIFRegRGBAQ*)(data);
|
||||||
gs.regs.RGBAQ._u64 = r->_u64;
|
gs.regs.RGBAQ._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerST(const u32* data)
|
void __gifCall GIFRegHandlerST(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegST* r = (GIFRegST*)(data);
|
GIFRegST* r = (GIFRegST*)(data);
|
||||||
gs.regs.ST._u64 = r->_u64;
|
gs.regs.ST._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerUV(const u32* data)
|
void __gifCall GIFRegHandlerUV(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegUV* r = (GIFRegUV*)(data);
|
GIFRegUV* r = (GIFRegUV*)(data);
|
||||||
gs.regs.UV._u64 = r->_u64;
|
gs.regs.UV._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerXYZF2(const u32* data)
|
void __gifCall GIFRegHandlerXYZF2(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegXYZF* r = (GIFRegXYZF*)(data);
|
GIFRegXYZF* r = (GIFRegXYZF*)(data);
|
||||||
gs.regs.XYZF._u64 = r->_u64;
|
gs.regs.XYZF._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerXYZ2(const u32* data)
|
void __gifCall GIFRegHandlerXYZ2(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegXYZ* r = (GIFRegXYZ*)(data);
|
GIFRegXYZ* r = (GIFRegXYZ*)(data);
|
||||||
gs.regs.XYZ._u64 = r->_u64;
|
gs.regs.XYZ._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <u32 i>
|
template <u32 i>
|
||||||
void __gifCall GIFRegHandlerTEX0(const u32* data)
|
void __gifCall GIFRegHandlerTEX0(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegTEX0* r = (GIFRegTEX0*)(data);
|
GIFRegTEX0* r = (GIFRegTEX0*)(data);
|
||||||
gs.ctxt_regs[i].TEX0._u64 = r->_u64;
|
gs.ctxt_regs[i].TEX0._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <u32 i>
|
template <u32 i>
|
||||||
void __gifCall GIFRegHandlerCLAMP(const u32* data)
|
void __gifCall GIFRegHandlerCLAMP(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegCLAMP* r = (GIFRegCLAMP*)(data);
|
GIFRegCLAMP* r = (GIFRegCLAMP*)(data);
|
||||||
gs.ctxt_regs[i].CLAMP._u64 = r->_u64;
|
gs.ctxt_regs[i].CLAMP._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerFOG(const u32* data)
|
void __gifCall GIFRegHandlerFOG(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegFOG* r = (GIFRegFOG*)(data);
|
GIFRegFOG* r = (GIFRegFOG*)(data);
|
||||||
gs.regs.FOG.F = r->F;
|
gs.regs.FOG.F = r->F;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerXYZF3(const u32* data)
|
void __gifCall GIFRegHandlerXYZF3(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegXYZF* r = (GIFRegXYZF*)(data);
|
GIFRegXYZF* r = (GIFRegXYZF*)(data);
|
||||||
gs.regs.XYZF._u64 = r->_u64;
|
gs.regs.XYZF._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerXYZ3(const u32* data)
|
void __gifCall GIFRegHandlerXYZ3(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegXYZ* r = (GIFRegXYZ*)(data);
|
GIFRegXYZ* r = (GIFRegXYZ*)(data);
|
||||||
gs.regs.XYZ._u64 = r->_u64;
|
gs.regs.XYZ._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerNOP(const u32* data)
|
void __gifCall GIFRegHandlerNOP(const u32* data)
|
||||||
|
@ -187,360 +187,352 @@ void __gifCall GIFRegHandlerNOP(const u32* data)
|
||||||
template <u32 i>
|
template <u32 i>
|
||||||
void __fastcall GIFRegHandlerTEX1(const u32* data)
|
void __fastcall GIFRegHandlerTEX1(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegTEX1* r = (GIFRegTEX1*)(data);
|
GIFRegTEX1* r = (GIFRegTEX1*)(data);
|
||||||
gs.ctxt_regs[i].TEX1._u64 = r->_u64;
|
gs.ctxt_regs[i].TEX1._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <u32 i>
|
template <u32 i>
|
||||||
void __gifCall GIFRegHandlerTEX2(const u32* data)
|
void __gifCall GIFRegHandlerTEX2(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegTEX2* r = (GIFRegTEX2*)(data);
|
GIFRegTEX2* r = (GIFRegTEX2*)(data);
|
||||||
gs.ctxt_regs[i].TEX2._u64 = r->_u64;
|
gs.ctxt_regs[i].TEX2._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <u32 i>
|
template <u32 i>
|
||||||
void __gifCall GIFRegHandlerXYOFFSET(const u32* data)
|
void __gifCall GIFRegHandlerXYOFFSET(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegXYOFFSET* r = (GIFRegXYOFFSET*)(data);
|
GIFRegXYOFFSET* r = (GIFRegXYOFFSET*)(data);
|
||||||
gs.ctxt_regs[i].XYOFFSET.OFX = r->OFX;
|
gs.ctxt_regs[i].XYOFFSET.OFX = r->OFX;
|
||||||
gs.ctxt_regs[i].XYOFFSET.OFY = r->OFY;
|
gs.ctxt_regs[i].XYOFFSET.OFY = r->OFY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill out the vertex queue(prim) and the attributes.
|
// Fill out the vertex queue(prim) and the attributes.
|
||||||
void __gifCall GIFRegHandlerPRIM(const u32 *data)
|
void __gifCall GIFRegHandlerPRIM(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegPRIM* r = (GIFRegPRIM*)(data);
|
GIFRegPRIM* r = (GIFRegPRIM*)(data);
|
||||||
gs.regs.PRIM._u64 = r->_u64;
|
gs.regs.PRIM._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill out an alternate set of attributes.
|
// Fill out an alternate set of attributes.
|
||||||
void __gifCall GIFRegHandlerPRMODE(const u32* data)
|
void __gifCall GIFRegHandlerPRMODE(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegPRMODE* r = (GIFRegPRMODE*)(data);
|
GIFRegPRMODE* r = (GIFRegPRMODE*)(data);
|
||||||
gs.regs.PRMODE._u64 = r->_u64;
|
gs.regs.PRMODE._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch between the primary set of attributes and the secondary.
|
// Switch between the primary set of attributes and the secondary.
|
||||||
void __gifCall GIFRegHandlerPRMODECONT(const u32* data)
|
void __gifCall GIFRegHandlerPRMODECONT(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegPRMODECONT* r = (GIFRegPRMODECONT*)(data);
|
GIFRegPRMODECONT* r = (GIFRegPRMODECONT*)(data);
|
||||||
gs.regs.PRMODECONT._u64 = r->_u64;
|
gs.regs.PRMODECONT._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerTEXCLUT(const u32* data)
|
void __gifCall GIFRegHandlerTEXCLUT(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegTEXCLUT* r = (GIFRegTEXCLUT*)(data);
|
GIFRegTEXCLUT* r = (GIFRegTEXCLUT*)(data);
|
||||||
gs.regs.TEXCLUT._u64 = r->_u64;
|
gs.regs.TEXCLUT._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerSCANMSK(const u32* data)
|
void __gifCall GIFRegHandlerSCANMSK(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegSCANMSK* r = (GIFRegSCANMSK*)(data);
|
GIFRegSCANMSK* r = (GIFRegSCANMSK*)(data);
|
||||||
gs.regs.SCANMSK._u64 = r->_u64;
|
gs.regs.SCANMSK._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <u32 i>
|
template <u32 i>
|
||||||
void __gifCall GIFRegHandlerMIPTBP1(const u32* data)
|
void __gifCall GIFRegHandlerMIPTBP1(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegMIPTBP1* r = (GIFRegMIPTBP1*)(data);
|
GIFRegMIPTBP1* r = (GIFRegMIPTBP1*)(data);
|
||||||
gs.ctxt_regs[i].MIPTBP1._u64 = r->_u64;
|
gs.ctxt_regs[i].MIPTBP1._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <u32 i>
|
template <u32 i>
|
||||||
void __gifCall GIFRegHandlerMIPTBP2(const u32* data)
|
void __gifCall GIFRegHandlerMIPTBP2(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegMIPTBP2* r = (GIFRegMIPTBP2*)(data);
|
GIFRegMIPTBP2* r = (GIFRegMIPTBP2*)(data);
|
||||||
gs.ctxt_regs[i].MIPTBP2._u64 = r->_u64;
|
gs.ctxt_regs[i].MIPTBP2._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerTEXA(const u32* data)
|
void __gifCall GIFRegHandlerTEXA(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegTEXA* r = (GIFRegTEXA*)(data);
|
GIFRegTEXA* r = (GIFRegTEXA*)(data);
|
||||||
gs.regs.TEXA._u64 = r->_u64;
|
gs.regs.TEXA._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerFOGCOL(const u32* data)
|
void __gifCall GIFRegHandlerFOGCOL(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegFOGCOL* r = (GIFRegFOGCOL*)(data);
|
GIFRegFOGCOL* r = (GIFRegFOGCOL*)(data);
|
||||||
gs.regs.FOGCOL._u64 = r->_u64;
|
gs.regs.FOGCOL._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerTEXFLUSH(const u32* data)
|
void __gifCall GIFRegHandlerTEXFLUSH(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegTEXFLUSH* r = (GIFRegTEXFLUSH*)(data);
|
GIFRegTEXFLUSH* r = (GIFRegTEXFLUSH*)(data);
|
||||||
gs.regs.TEXFLUSH._u64 = r->_u64;
|
gs.regs.TEXFLUSH._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <u32 i>
|
template <u32 i>
|
||||||
void __gifCall GIFRegHandlerSCISSOR(const u32* data)
|
void __gifCall GIFRegHandlerSCISSOR(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegSCISSOR* r = (GIFRegSCISSOR*)(data);
|
GIFRegSCISSOR* r = (GIFRegSCISSOR*)(data);
|
||||||
gs.ctxt_regs[i].SCISSOR._u64 = r->_u64;
|
gs.ctxt_regs[i].SCISSOR._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <u32 i>
|
template <u32 i>
|
||||||
void __gifCall GIFRegHandlerALPHA(const u32* data)
|
void __gifCall GIFRegHandlerALPHA(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegALPHA* r = (GIFRegALPHA*)(data);
|
GIFRegALPHA* r = (GIFRegALPHA*)(data);
|
||||||
gs.ctxt_regs[i].ALPHA._u64 = r->_u64;
|
gs.ctxt_regs[i].ALPHA._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerDIMX(const u32* data)
|
void __gifCall GIFRegHandlerDIMX(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegDIMX* r = (GIFRegDIMX*)(data);
|
GIFRegDIMX* r = (GIFRegDIMX*)(data);
|
||||||
gs.regs.DIMX._u64 = r->_u64;
|
gs.regs.DIMX._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerDTHE(const u32* data)
|
void __gifCall GIFRegHandlerDTHE(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegDTHE* r = (GIFRegDTHE*)(data);
|
GIFRegDTHE* r = (GIFRegDTHE*)(data);
|
||||||
gs.regs.DTHE._u64 = r->_u64;
|
gs.regs.DTHE._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerCOLCLAMP(const u32* data)
|
void __gifCall GIFRegHandlerCOLCLAMP(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegCOLCLAMP* r = (GIFRegCOLCLAMP*)(data);
|
GIFRegCOLCLAMP* r = (GIFRegCOLCLAMP*)(data);
|
||||||
gs.regs.COLCLAMP._u64 = r->_u64;
|
gs.regs.COLCLAMP._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <u32 i>
|
template <u32 i>
|
||||||
void __gifCall GIFRegHandlerTEST(const u32* data)
|
void __gifCall GIFRegHandlerTEST(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegTEST* r = (GIFRegTEST*)(data);
|
GIFRegTEST* r = (GIFRegTEST*)(data);
|
||||||
gs.ctxt_regs[i].TEST._u64 = r->_u64;
|
gs.ctxt_regs[i].TEST._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerPABE(const u32* data)
|
void __gifCall GIFRegHandlerPABE(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegPABE* r = (GIFRegPABE*)(data);
|
GIFRegPABE* r = (GIFRegPABE*)(data);
|
||||||
gs.regs.PABE._u64 = r->_u64;
|
gs.regs.PABE._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <u32 i>
|
template <u32 i>
|
||||||
void __gifCall GIFRegHandlerFBA(const u32* data)
|
void __gifCall GIFRegHandlerFBA(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegFBA* r = (GIFRegFBA*)(data);
|
GIFRegFBA* r = (GIFRegFBA*)(data);
|
||||||
gs.ctxt_regs[i].FBA._u64 = r->_u64;
|
gs.ctxt_regs[i].FBA._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<u32 i>
|
template <u32 i>
|
||||||
void __gifCall GIFRegHandlerFRAME(const u32* data)
|
void __gifCall GIFRegHandlerFRAME(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegFRAME* r = (GIFRegFRAME*)(data);
|
GIFRegFRAME* r = (GIFRegFRAME*)(data);
|
||||||
gs.ctxt_regs[i].FRAME._u64 = r->_u64;
|
gs.ctxt_regs[i].FRAME._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <u32 i>
|
template <u32 i>
|
||||||
void __gifCall GIFRegHandlerZBUF(const u32* data)
|
void __gifCall GIFRegHandlerZBUF(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegZBUF* r = (GIFRegZBUF*)(data);
|
GIFRegZBUF* r = (GIFRegZBUF*)(data);
|
||||||
gs.ctxt_regs[i].ZBUF._u64 = r->_u64;
|
gs.ctxt_regs[i].ZBUF._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerBITBLTBUF(const u32* data)
|
void __gifCall GIFRegHandlerBITBLTBUF(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegBITBLTBUF* r = (GIFRegBITBLTBUF*)(data);
|
GIFRegBITBLTBUF* r = (GIFRegBITBLTBUF*)(data);
|
||||||
gs.regs.BITBLTBUF._u64 = r->_u64;
|
gs.regs.BITBLTBUF._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerTRXPOS(const u32* data)
|
void __gifCall GIFRegHandlerTRXPOS(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegTRXPOS* r = (GIFRegTRXPOS*)(data);
|
GIFRegTRXPOS* r = (GIFRegTRXPOS*)(data);
|
||||||
gs.regs.TRXPOS._u64 = r->_u64;
|
gs.regs.TRXPOS._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerTRXREG(const u32* data)
|
void __gifCall GIFRegHandlerTRXREG(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegTRXREG* r = (GIFRegTRXREG*)(data);
|
GIFRegTRXREG* r = (GIFRegTRXREG*)(data);
|
||||||
gs.regs.TRXREG._u64 = r->_u64;
|
gs.regs.TRXREG._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerTRXDIR(const u32* data)
|
void __gifCall GIFRegHandlerTRXDIR(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegTRXDIR* r = (GIFRegTRXDIR*)(data);
|
GIFRegTRXDIR* r = (GIFRegTRXDIR*)(data);
|
||||||
gs.regs.TRXDIR._u64 = r->_u64;
|
gs.regs.TRXDIR._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerHWREG(const u32* data)
|
void __gifCall GIFRegHandlerHWREG(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegHWREG* r = (GIFRegHWREG*)(data);
|
GIFRegHWREG* r = (GIFRegHWREG*)(data);
|
||||||
gs.regs.HWREG._u64 = r->_u64;
|
gs.regs.HWREG._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerSIGNAL(const u32* data)
|
void __gifCall GIFRegHandlerSIGNAL(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegSIGNAL* r = (GIFRegSIGNAL*)(data);
|
GIFRegSIGNAL* r = (GIFRegSIGNAL*)(data);
|
||||||
gs.regs.SIGNAL._u64 = r->_u64;
|
gs.regs.SIGNAL._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerFINISH(const u32* data)
|
void __gifCall GIFRegHandlerFINISH(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegFINISH* r = (GIFRegFINISH*)(data);
|
GIFRegFINISH* r = (GIFRegFINISH*)(data);
|
||||||
gs.regs.FINISH._u64 = r->_u64;
|
gs.regs.FINISH._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __gifCall GIFRegHandlerLABEL(const u32* data)
|
void __gifCall GIFRegHandlerLABEL(const u32* data)
|
||||||
{
|
{
|
||||||
GIFRegLABEL* r = (GIFRegLABEL*)(data);
|
GIFRegLABEL* r = (GIFRegLABEL*)(data);
|
||||||
gs.regs.LABEL._u64 = r->_u64;
|
gs.regs.LABEL._u64 = r->_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SetMultithreaded()
|
void SetMultithreaded()
|
||||||
{
|
{
|
||||||
// Some older versions of PCSX2 didn't properly set the irq callback to NULL
|
// Some older versions of PCSX2 didn't properly set the irq callback to NULL
|
||||||
// in multithreaded mode (possibly because ZeroGS itself would assert in such
|
// in multithreaded mode (possibly because ZeroGS itself would assert in such
|
||||||
// cases), and didn't bind them to a dummy callback either. PCSX2 handles all
|
// cases), and didn't bind them to a dummy callback either. PCSX2 handles all
|
||||||
// IRQs internally when multithreaded anyway -- so let's ignore them here:
|
// IRQs internally when multithreaded anyway -- so let's ignore them here:
|
||||||
|
|
||||||
if (gs.MultiThreaded)
|
if (gs.MultiThreaded) {
|
||||||
{
|
GIFRegHandlers[GIF_A_D_REG_SIGNAL] = &GIFRegHandlerNull;
|
||||||
GIFRegHandlers[GIF_A_D_REG_SIGNAL] = &GIFRegHandlerNull;
|
GIFRegHandlers[GIF_A_D_REG_FINISH] = &GIFRegHandlerNull;
|
||||||
GIFRegHandlers[GIF_A_D_REG_FINISH] = &GIFRegHandlerNull;
|
GIFRegHandlers[GIF_A_D_REG_LABEL] = &GIFRegHandlerNull;
|
||||||
GIFRegHandlers[GIF_A_D_REG_LABEL] = &GIFRegHandlerNull;
|
} else {
|
||||||
}
|
GIFRegHandlers[GIF_A_D_REG_SIGNAL] = &GIFRegHandlerSIGNAL;
|
||||||
else
|
GIFRegHandlers[GIF_A_D_REG_FINISH] = &GIFRegHandlerFINISH;
|
||||||
{
|
GIFRegHandlers[GIF_A_D_REG_LABEL] = &GIFRegHandlerLABEL;
|
||||||
GIFRegHandlers[GIF_A_D_REG_SIGNAL] = &GIFRegHandlerSIGNAL;
|
}
|
||||||
GIFRegHandlers[GIF_A_D_REG_FINISH] = &GIFRegHandlerFINISH;
|
|
||||||
GIFRegHandlers[GIF_A_D_REG_LABEL] = &GIFRegHandlerLABEL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResetRegs()
|
void ResetRegs()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++) {
|
||||||
{
|
GIFPackedRegHandlers[i] = &GIFPackedRegHandlerNull;
|
||||||
GIFPackedRegHandlers[i] = &GIFPackedRegHandlerNull;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
GIFPackedRegHandlers[GIF_REG_PRIM] = &GIFPackedRegHandlerPRIM;
|
GIFPackedRegHandlers[GIF_REG_PRIM] = &GIFPackedRegHandlerPRIM;
|
||||||
GIFPackedRegHandlers[GIF_REG_RGBA] = &GIFPackedRegHandlerRGBA;
|
GIFPackedRegHandlers[GIF_REG_RGBA] = &GIFPackedRegHandlerRGBA;
|
||||||
GIFPackedRegHandlers[GIF_REG_STQ] = &GIFPackedRegHandlerSTQ;
|
GIFPackedRegHandlers[GIF_REG_STQ] = &GIFPackedRegHandlerSTQ;
|
||||||
GIFPackedRegHandlers[GIF_REG_UV] = &GIFPackedRegHandlerUV;
|
GIFPackedRegHandlers[GIF_REG_UV] = &GIFPackedRegHandlerUV;
|
||||||
GIFPackedRegHandlers[GIF_REG_XYZF2] = &GIFPackedRegHandlerXYZF2;
|
GIFPackedRegHandlers[GIF_REG_XYZF2] = &GIFPackedRegHandlerXYZF2;
|
||||||
GIFPackedRegHandlers[GIF_REG_XYZ2] = &GIFPackedRegHandlerXYZ2;
|
GIFPackedRegHandlers[GIF_REG_XYZ2] = &GIFPackedRegHandlerXYZ2;
|
||||||
GIFPackedRegHandlers[GIF_REG_TEX0_1] = &GIFPackedRegHandlerTEX0<0>;
|
GIFPackedRegHandlers[GIF_REG_TEX0_1] = &GIFPackedRegHandlerTEX0<0>;
|
||||||
GIFPackedRegHandlers[GIF_REG_TEX0_2] = &GIFPackedRegHandlerTEX0<1>;
|
GIFPackedRegHandlers[GIF_REG_TEX0_2] = &GIFPackedRegHandlerTEX0<1>;
|
||||||
GIFPackedRegHandlers[GIF_REG_CLAMP_1] = &GIFPackedRegHandlerCLAMP<0>;
|
GIFPackedRegHandlers[GIF_REG_CLAMP_1] = &GIFPackedRegHandlerCLAMP<0>;
|
||||||
GIFPackedRegHandlers[GIF_REG_CLAMP_2] = &GIFPackedRegHandlerCLAMP<1>;
|
GIFPackedRegHandlers[GIF_REG_CLAMP_2] = &GIFPackedRegHandlerCLAMP<1>;
|
||||||
GIFPackedRegHandlers[GIF_REG_FOG] = &GIFPackedRegHandlerFOG;
|
GIFPackedRegHandlers[GIF_REG_FOG] = &GIFPackedRegHandlerFOG;
|
||||||
GIFPackedRegHandlers[GIF_REG_XYZF3] = &GIFPackedRegHandlerXYZF3;
|
GIFPackedRegHandlers[GIF_REG_XYZF3] = &GIFPackedRegHandlerXYZF3;
|
||||||
GIFPackedRegHandlers[GIF_REG_XYZ3] = &GIFPackedRegHandlerXYZ3;
|
GIFPackedRegHandlers[GIF_REG_XYZ3] = &GIFPackedRegHandlerXYZ3;
|
||||||
GIFPackedRegHandlers[GIF_REG_A_D] = &GIFPackedRegHandlerA_D;
|
GIFPackedRegHandlers[GIF_REG_A_D] = &GIFPackedRegHandlerA_D;
|
||||||
GIFPackedRegHandlers[GIF_REG_NOP] = &GIFPackedRegHandlerNOP;
|
GIFPackedRegHandlers[GIF_REG_NOP] = &GIFPackedRegHandlerNOP;
|
||||||
|
|
||||||
for (int i = 0; i < 256; i++)
|
for (int i = 0; i < 256; i++) {
|
||||||
{
|
GIFRegHandlers[i] = &GIFRegHandlerNull;
|
||||||
GIFRegHandlers[i] = &GIFRegHandlerNull;
|
}
|
||||||
}
|
|
||||||
|
GIFRegHandlers[GIF_A_D_REG_PRIM] = &GIFRegHandlerPRIM;
|
||||||
GIFRegHandlers[GIF_A_D_REG_PRIM] = &GIFRegHandlerPRIM;
|
GIFRegHandlers[GIF_A_D_REG_RGBAQ] = &GIFRegHandlerRGBAQ;
|
||||||
GIFRegHandlers[GIF_A_D_REG_RGBAQ] = &GIFRegHandlerRGBAQ;
|
GIFRegHandlers[GIF_A_D_REG_ST] = &GIFRegHandlerST;
|
||||||
GIFRegHandlers[GIF_A_D_REG_ST] = &GIFRegHandlerST;
|
GIFRegHandlers[GIF_A_D_REG_UV] = &GIFRegHandlerUV;
|
||||||
GIFRegHandlers[GIF_A_D_REG_UV] = &GIFRegHandlerUV;
|
GIFRegHandlers[GIF_A_D_REG_XYZF2] = &GIFRegHandlerXYZF2;
|
||||||
GIFRegHandlers[GIF_A_D_REG_XYZF2] = &GIFRegHandlerXYZF2;
|
GIFRegHandlers[GIF_A_D_REG_XYZ2] = &GIFRegHandlerXYZ2;
|
||||||
GIFRegHandlers[GIF_A_D_REG_XYZ2] = &GIFRegHandlerXYZ2;
|
GIFRegHandlers[GIF_A_D_REG_TEX0_1] = &GIFRegHandlerTEX0<0>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_TEX0_1] = &GIFRegHandlerTEX0<0>;
|
GIFRegHandlers[GIF_A_D_REG_TEX0_2] = &GIFRegHandlerTEX0<1>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_TEX0_2] = &GIFRegHandlerTEX0<1>;
|
GIFRegHandlers[GIF_A_D_REG_CLAMP_1] = &GIFRegHandlerCLAMP<0>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_CLAMP_1] = &GIFRegHandlerCLAMP<0>;
|
GIFRegHandlers[GIF_A_D_REG_CLAMP_2] = &GIFRegHandlerCLAMP<1>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_CLAMP_2] = &GIFRegHandlerCLAMP<1>;
|
GIFRegHandlers[GIF_A_D_REG_FOG] = &GIFRegHandlerFOG;
|
||||||
GIFRegHandlers[GIF_A_D_REG_FOG] = &GIFRegHandlerFOG;
|
GIFRegHandlers[GIF_A_D_REG_XYZF3] = &GIFRegHandlerXYZF3;
|
||||||
GIFRegHandlers[GIF_A_D_REG_XYZF3] = &GIFRegHandlerXYZF3;
|
GIFRegHandlers[GIF_A_D_REG_XYZ3] = &GIFRegHandlerXYZ3;
|
||||||
GIFRegHandlers[GIF_A_D_REG_XYZ3] = &GIFRegHandlerXYZ3;
|
GIFRegHandlers[GIF_A_D_REG_NOP] = &GIFRegHandlerNOP;
|
||||||
GIFRegHandlers[GIF_A_D_REG_NOP] = &GIFRegHandlerNOP;
|
GIFRegHandlers[GIF_A_D_REG_TEX1_1] = &GIFRegHandlerTEX1<0>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_TEX1_1] = &GIFRegHandlerTEX1<0>;
|
GIFRegHandlers[GIF_A_D_REG_TEX1_2] = &GIFRegHandlerTEX1<1>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_TEX1_2] = &GIFRegHandlerTEX1<1>;
|
GIFRegHandlers[GIF_A_D_REG_TEX2_1] = &GIFRegHandlerTEX2<0>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_TEX2_1] = &GIFRegHandlerTEX2<0>;
|
GIFRegHandlers[GIF_A_D_REG_TEX2_2] = &GIFRegHandlerTEX2<1>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_TEX2_2] = &GIFRegHandlerTEX2<1>;
|
GIFRegHandlers[GIF_A_D_REG_XYOFFSET_1] = &GIFRegHandlerXYOFFSET<0>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_XYOFFSET_1] = &GIFRegHandlerXYOFFSET<0>;
|
GIFRegHandlers[GIF_A_D_REG_XYOFFSET_2] = &GIFRegHandlerXYOFFSET<1>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_XYOFFSET_2] = &GIFRegHandlerXYOFFSET<1>;
|
GIFRegHandlers[GIF_A_D_REG_PRMODECONT] = &GIFRegHandlerPRMODECONT;
|
||||||
GIFRegHandlers[GIF_A_D_REG_PRMODECONT] = &GIFRegHandlerPRMODECONT;
|
GIFRegHandlers[GIF_A_D_REG_PRMODE] = &GIFRegHandlerPRMODE;
|
||||||
GIFRegHandlers[GIF_A_D_REG_PRMODE] = &GIFRegHandlerPRMODE;
|
GIFRegHandlers[GIF_A_D_REG_TEXCLUT] = &GIFRegHandlerTEXCLUT;
|
||||||
GIFRegHandlers[GIF_A_D_REG_TEXCLUT] = &GIFRegHandlerTEXCLUT;
|
GIFRegHandlers[GIF_A_D_REG_SCANMSK] = &GIFRegHandlerSCANMSK;
|
||||||
GIFRegHandlers[GIF_A_D_REG_SCANMSK] = &GIFRegHandlerSCANMSK;
|
GIFRegHandlers[GIF_A_D_REG_MIPTBP1_1] = &GIFRegHandlerMIPTBP1<0>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_MIPTBP1_1] = &GIFRegHandlerMIPTBP1<0>;
|
GIFRegHandlers[GIF_A_D_REG_MIPTBP1_2] = &GIFRegHandlerMIPTBP1<1>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_MIPTBP1_2] = &GIFRegHandlerMIPTBP1<1>;
|
GIFRegHandlers[GIF_A_D_REG_MIPTBP2_1] = &GIFRegHandlerMIPTBP2<0>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_MIPTBP2_1] = &GIFRegHandlerMIPTBP2<0>;
|
GIFRegHandlers[GIF_A_D_REG_MIPTBP2_2] = &GIFRegHandlerMIPTBP2<1>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_MIPTBP2_2] = &GIFRegHandlerMIPTBP2<1>;
|
GIFRegHandlers[GIF_A_D_REG_TEXA] = &GIFRegHandlerTEXA;
|
||||||
GIFRegHandlers[GIF_A_D_REG_TEXA] = &GIFRegHandlerTEXA;
|
GIFRegHandlers[GIF_A_D_REG_FOGCOL] = &GIFRegHandlerFOGCOL;
|
||||||
GIFRegHandlers[GIF_A_D_REG_FOGCOL] = &GIFRegHandlerFOGCOL;
|
GIFRegHandlers[GIF_A_D_REG_TEXFLUSH] = &GIFRegHandlerTEXFLUSH;
|
||||||
GIFRegHandlers[GIF_A_D_REG_TEXFLUSH] = &GIFRegHandlerTEXFLUSH;
|
GIFRegHandlers[GIF_A_D_REG_SCISSOR_1] = &GIFRegHandlerSCISSOR<0>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_SCISSOR_1] = &GIFRegHandlerSCISSOR<0>;
|
GIFRegHandlers[GIF_A_D_REG_SCISSOR_2] = &GIFRegHandlerSCISSOR<1>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_SCISSOR_2] = &GIFRegHandlerSCISSOR<1>;
|
GIFRegHandlers[GIF_A_D_REG_ALPHA_1] = &GIFRegHandlerALPHA<0>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_ALPHA_1] = &GIFRegHandlerALPHA<0>;
|
GIFRegHandlers[GIF_A_D_REG_ALPHA_2] = &GIFRegHandlerALPHA<1>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_ALPHA_2] = &GIFRegHandlerALPHA<1>;
|
GIFRegHandlers[GIF_A_D_REG_DIMX] = &GIFRegHandlerDIMX;
|
||||||
GIFRegHandlers[GIF_A_D_REG_DIMX] = &GIFRegHandlerDIMX;
|
GIFRegHandlers[GIF_A_D_REG_DTHE] = &GIFRegHandlerDTHE;
|
||||||
GIFRegHandlers[GIF_A_D_REG_DTHE] = &GIFRegHandlerDTHE;
|
GIFRegHandlers[GIF_A_D_REG_COLCLAMP] = &GIFRegHandlerCOLCLAMP;
|
||||||
GIFRegHandlers[GIF_A_D_REG_COLCLAMP] = &GIFRegHandlerCOLCLAMP;
|
GIFRegHandlers[GIF_A_D_REG_TEST_1] = &GIFRegHandlerTEST<0>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_TEST_1] = &GIFRegHandlerTEST<0>;
|
GIFRegHandlers[GIF_A_D_REG_TEST_2] = &GIFRegHandlerTEST<1>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_TEST_2] = &GIFRegHandlerTEST<1>;
|
GIFRegHandlers[GIF_A_D_REG_PABE] = &GIFRegHandlerPABE;
|
||||||
GIFRegHandlers[GIF_A_D_REG_PABE] = &GIFRegHandlerPABE;
|
GIFRegHandlers[GIF_A_D_REG_FBA_1] = &GIFRegHandlerFBA<0>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_FBA_1] = &GIFRegHandlerFBA<0>;
|
GIFRegHandlers[GIF_A_D_REG_FBA_2] = &GIFRegHandlerFBA<1>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_FBA_2] = &GIFRegHandlerFBA<1>;
|
GIFRegHandlers[GIF_A_D_REG_FRAME_1] = &GIFRegHandlerFRAME<0>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_FRAME_1] = &GIFRegHandlerFRAME<0>;
|
GIFRegHandlers[GIF_A_D_REG_FRAME_2] = &GIFRegHandlerFRAME<1>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_FRAME_2] = &GIFRegHandlerFRAME<1>;
|
GIFRegHandlers[GIF_A_D_REG_ZBUF_1] = &GIFRegHandlerZBUF<0>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_ZBUF_1] = &GIFRegHandlerZBUF<0>;
|
GIFRegHandlers[GIF_A_D_REG_ZBUF_2] = &GIFRegHandlerZBUF<1>;
|
||||||
GIFRegHandlers[GIF_A_D_REG_ZBUF_2] = &GIFRegHandlerZBUF<1>;
|
GIFRegHandlers[GIF_A_D_REG_BITBLTBUF] = &GIFRegHandlerBITBLTBUF;
|
||||||
GIFRegHandlers[GIF_A_D_REG_BITBLTBUF] = &GIFRegHandlerBITBLTBUF;
|
GIFRegHandlers[GIF_A_D_REG_TRXPOS] = &GIFRegHandlerTRXPOS;
|
||||||
GIFRegHandlers[GIF_A_D_REG_TRXPOS] = &GIFRegHandlerTRXPOS;
|
GIFRegHandlers[GIF_A_D_REG_TRXREG] = &GIFRegHandlerTRXREG;
|
||||||
GIFRegHandlers[GIF_A_D_REG_TRXREG] = &GIFRegHandlerTRXREG;
|
GIFRegHandlers[GIF_A_D_REG_TRXDIR] = &GIFRegHandlerTRXDIR;
|
||||||
GIFRegHandlers[GIF_A_D_REG_TRXDIR] = &GIFRegHandlerTRXDIR;
|
GIFRegHandlers[GIF_A_D_REG_HWREG] = &GIFRegHandlerHWREG;
|
||||||
GIFRegHandlers[GIF_A_D_REG_HWREG] = &GIFRegHandlerHWREG;
|
SetMultithreaded();
|
||||||
SetMultithreaded();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetFrameSkip(bool skip)
|
void SetFrameSkip(bool skip)
|
||||||
{
|
{
|
||||||
if (skip)
|
if (skip) {
|
||||||
{
|
GIFPackedRegHandlers[GIF_REG_PRIM] = &GIFPackedRegHandlerNOP;
|
||||||
GIFPackedRegHandlers[GIF_REG_PRIM] = &GIFPackedRegHandlerNOP;
|
GIFPackedRegHandlers[GIF_REG_RGBA] = &GIFPackedRegHandlerNOP;
|
||||||
GIFPackedRegHandlers[GIF_REG_RGBA] = &GIFPackedRegHandlerNOP;
|
GIFPackedRegHandlers[GIF_REG_STQ] = &GIFPackedRegHandlerNOP;
|
||||||
GIFPackedRegHandlers[GIF_REG_STQ] = &GIFPackedRegHandlerNOP;
|
GIFPackedRegHandlers[GIF_REG_UV] = &GIFPackedRegHandlerNOP;
|
||||||
GIFPackedRegHandlers[GIF_REG_UV] = &GIFPackedRegHandlerNOP;
|
GIFPackedRegHandlers[GIF_REG_XYZF2] = &GIFPackedRegHandlerNOP;
|
||||||
GIFPackedRegHandlers[GIF_REG_XYZF2] = &GIFPackedRegHandlerNOP;
|
GIFPackedRegHandlers[GIF_REG_XYZ2] = &GIFPackedRegHandlerNOP;
|
||||||
GIFPackedRegHandlers[GIF_REG_XYZ2] = &GIFPackedRegHandlerNOP;
|
GIFPackedRegHandlers[GIF_REG_CLAMP_1] = &GIFPackedRegHandlerNOP;
|
||||||
GIFPackedRegHandlers[GIF_REG_CLAMP_1] = &GIFPackedRegHandlerNOP;
|
GIFPackedRegHandlers[GIF_REG_CLAMP_2] = &GIFPackedRegHandlerNOP;
|
||||||
GIFPackedRegHandlers[GIF_REG_CLAMP_2] = &GIFPackedRegHandlerNOP;
|
GIFPackedRegHandlers[GIF_REG_FOG] = &GIFPackedRegHandlerNOP;
|
||||||
GIFPackedRegHandlers[GIF_REG_FOG] = &GIFPackedRegHandlerNOP;
|
GIFPackedRegHandlers[GIF_REG_XYZF3] = &GIFPackedRegHandlerNOP;
|
||||||
GIFPackedRegHandlers[GIF_REG_XYZF3] = &GIFPackedRegHandlerNOP;
|
GIFPackedRegHandlers[GIF_REG_XYZ3] = &GIFPackedRegHandlerNOP;
|
||||||
GIFPackedRegHandlers[GIF_REG_XYZ3] = &GIFPackedRegHandlerNOP;
|
|
||||||
|
|
||||||
GIFRegHandlers[GIF_A_D_REG_PRIM] = &GIFRegHandlerNOP;
|
GIFRegHandlers[GIF_A_D_REG_PRIM] = &GIFRegHandlerNOP;
|
||||||
GIFRegHandlers[GIF_A_D_REG_RGBAQ] = &GIFRegHandlerNOP;
|
GIFRegHandlers[GIF_A_D_REG_RGBAQ] = &GIFRegHandlerNOP;
|
||||||
GIFRegHandlers[GIF_A_D_REG_ST] = &GIFRegHandlerNOP;
|
GIFRegHandlers[GIF_A_D_REG_ST] = &GIFRegHandlerNOP;
|
||||||
GIFRegHandlers[GIF_A_D_REG_UV] = &GIFRegHandlerNOP;
|
GIFRegHandlers[GIF_A_D_REG_UV] = &GIFRegHandlerNOP;
|
||||||
GIFRegHandlers[GIF_A_D_REG_XYZF2] = &GIFRegHandlerNOP;
|
GIFRegHandlers[GIF_A_D_REG_XYZF2] = &GIFRegHandlerNOP;
|
||||||
GIFRegHandlers[GIF_A_D_REG_XYZ2] = &GIFRegHandlerNOP;
|
GIFRegHandlers[GIF_A_D_REG_XYZ2] = &GIFRegHandlerNOP;
|
||||||
GIFRegHandlers[GIF_A_D_REG_XYZF3] = &GIFRegHandlerNOP;
|
GIFRegHandlers[GIF_A_D_REG_XYZF3] = &GIFRegHandlerNOP;
|
||||||
GIFRegHandlers[GIF_A_D_REG_XYZ3] = &GIFRegHandlerNOP;
|
GIFRegHandlers[GIF_A_D_REG_XYZ3] = &GIFRegHandlerNOP;
|
||||||
GIFRegHandlers[GIF_A_D_REG_PRMODECONT] = &GIFRegHandlerNOP;
|
GIFRegHandlers[GIF_A_D_REG_PRMODECONT] = &GIFRegHandlerNOP;
|
||||||
GIFRegHandlers[GIF_A_D_REG_PRMODE] = &GIFRegHandlerNOP;
|
GIFRegHandlers[GIF_A_D_REG_PRMODE] = &GIFRegHandlerNOP;
|
||||||
}
|
} else {
|
||||||
else
|
GIFPackedRegHandlers[GIF_REG_PRIM] = &GIFPackedRegHandlerPRIM;
|
||||||
{
|
GIFPackedRegHandlers[GIF_REG_RGBA] = &GIFPackedRegHandlerRGBA;
|
||||||
GIFPackedRegHandlers[GIF_REG_PRIM] = &GIFPackedRegHandlerPRIM;
|
GIFPackedRegHandlers[GIF_REG_STQ] = &GIFPackedRegHandlerSTQ;
|
||||||
GIFPackedRegHandlers[GIF_REG_RGBA] = &GIFPackedRegHandlerRGBA;
|
GIFPackedRegHandlers[GIF_REG_UV] = &GIFPackedRegHandlerUV;
|
||||||
GIFPackedRegHandlers[GIF_REG_STQ] = &GIFPackedRegHandlerSTQ;
|
GIFPackedRegHandlers[GIF_REG_XYZF2] = &GIFPackedRegHandlerXYZF2;
|
||||||
GIFPackedRegHandlers[GIF_REG_UV] = &GIFPackedRegHandlerUV;
|
GIFPackedRegHandlers[GIF_REG_XYZ2] = &GIFPackedRegHandlerXYZ2;
|
||||||
GIFPackedRegHandlers[GIF_REG_XYZF2] = &GIFPackedRegHandlerXYZF2;
|
GIFPackedRegHandlers[GIF_REG_CLAMP_1] = &GIFPackedRegHandlerCLAMP<0>;
|
||||||
GIFPackedRegHandlers[GIF_REG_XYZ2] = &GIFPackedRegHandlerXYZ2;
|
GIFPackedRegHandlers[GIF_REG_CLAMP_2] = &GIFPackedRegHandlerCLAMP<1>;
|
||||||
GIFPackedRegHandlers[GIF_REG_CLAMP_1] = &GIFPackedRegHandlerCLAMP<0>;
|
GIFPackedRegHandlers[GIF_REG_FOG] = &GIFPackedRegHandlerFOG;
|
||||||
GIFPackedRegHandlers[GIF_REG_CLAMP_2] = &GIFPackedRegHandlerCLAMP<1>;
|
GIFPackedRegHandlers[GIF_REG_XYZF3] = &GIFPackedRegHandlerXYZF3;
|
||||||
GIFPackedRegHandlers[GIF_REG_FOG] = &GIFPackedRegHandlerFOG;
|
GIFPackedRegHandlers[GIF_REG_XYZ3] = &GIFPackedRegHandlerXYZ3;
|
||||||
GIFPackedRegHandlers[GIF_REG_XYZF3] = &GIFPackedRegHandlerXYZF3;
|
|
||||||
GIFPackedRegHandlers[GIF_REG_XYZ3] = &GIFPackedRegHandlerXYZ3;
|
|
||||||
|
|
||||||
GIFRegHandlers[GIF_A_D_REG_PRIM] = &GIFRegHandlerPRIM;
|
GIFRegHandlers[GIF_A_D_REG_PRIM] = &GIFRegHandlerPRIM;
|
||||||
GIFRegHandlers[GIF_A_D_REG_RGBAQ] = &GIFRegHandlerRGBAQ;
|
GIFRegHandlers[GIF_A_D_REG_RGBAQ] = &GIFRegHandlerRGBAQ;
|
||||||
GIFRegHandlers[GIF_A_D_REG_ST] = &GIFRegHandlerST;
|
GIFRegHandlers[GIF_A_D_REG_ST] = &GIFRegHandlerST;
|
||||||
GIFRegHandlers[GIF_A_D_REG_UV] = &GIFRegHandlerUV;
|
GIFRegHandlers[GIF_A_D_REG_UV] = &GIFRegHandlerUV;
|
||||||
GIFRegHandlers[GIF_A_D_REG_XYZF2] = &GIFRegHandlerXYZF2;
|
GIFRegHandlers[GIF_A_D_REG_XYZF2] = &GIFRegHandlerXYZF2;
|
||||||
GIFRegHandlers[GIF_A_D_REG_XYZ2] = &GIFRegHandlerXYZ2;
|
GIFRegHandlers[GIF_A_D_REG_XYZ2] = &GIFRegHandlerXYZ2;
|
||||||
GIFRegHandlers[GIF_A_D_REG_XYZF3] = &GIFRegHandlerXYZF3;
|
GIFRegHandlers[GIF_A_D_REG_XYZF3] = &GIFRegHandlerXYZF3;
|
||||||
GIFRegHandlers[GIF_A_D_REG_XYZ3] = &GIFRegHandlerXYZ3;
|
GIFRegHandlers[GIF_A_D_REG_XYZ3] = &GIFRegHandlerXYZ3;
|
||||||
GIFRegHandlers[GIF_A_D_REG_PRMODECONT] = &GIFRegHandlerPRMODECONT;
|
GIFRegHandlers[GIF_A_D_REG_PRMODECONT] = &GIFRegHandlerPRMODECONT;
|
||||||
GIFRegHandlers[GIF_A_D_REG_PRMODE] = &GIFRegHandlerPRMODE;
|
GIFRegHandlers[GIF_A_D_REG_PRMODE] = &GIFRegHandlerPRMODE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -21,49 +21,47 @@ extern HINSTANCE hInst;
|
||||||
void SaveConfig()
|
void SaveConfig()
|
||||||
{
|
{
|
||||||
|
|
||||||
Config *Conf1 = &conf;
|
Config* Conf1 = &conf;
|
||||||
char *szTemp;
|
char* szTemp;
|
||||||
char szIniFile[256], szValue[256];
|
char szIniFile[256], szValue[256];
|
||||||
|
|
||||||
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
||||||
szTemp = strrchr(szIniFile, '\\');
|
szTemp = strrchr(szIniFile, '\\');
|
||||||
|
|
||||||
if(!szTemp) return;
|
|
||||||
strcpy(szTemp, "\\inis\\gsnull.ini");
|
|
||||||
sprintf(szValue,"%u",Conf1->Log);
|
|
||||||
WritePrivateProfileString("Interface", "Logging",szValue,szIniFile);
|
|
||||||
|
|
||||||
|
if (!szTemp)
|
||||||
|
return;
|
||||||
|
strcpy(szTemp, "\\inis\\gsnull.ini");
|
||||||
|
sprintf(szValue, "%u", Conf1->Log);
|
||||||
|
WritePrivateProfileString("Interface", "Logging", szValue, szIniFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadConfig()
|
void LoadConfig()
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE* fp;
|
||||||
|
|
||||||
|
|
||||||
Config *Conf1 = &conf;
|
Config* Conf1 = &conf;
|
||||||
char *szTemp;
|
char* szTemp;
|
||||||
char szIniFile[256], szValue[256];
|
char szIniFile[256], szValue[256];
|
||||||
|
|
||||||
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
||||||
szTemp = strrchr(szIniFile, '\\');
|
szTemp = strrchr(szIniFile, '\\');
|
||||||
|
|
||||||
if(!szTemp) return ;
|
if (!szTemp)
|
||||||
strcpy(szTemp, "\\inis\\gsnull.ini");
|
return;
|
||||||
fp=fopen("inis\\gsnull.ini","rt");//check if gsnull.ini really exists
|
strcpy(szTemp, "\\inis\\gsnull.ini");
|
||||||
|
fp = fopen("inis\\gsnull.ini", "rt"); //check if gsnull.ini really exists
|
||||||
if (!fp)
|
|
||||||
{
|
if (!fp) {
|
||||||
CreateDirectory("inis",NULL);
|
CreateDirectory("inis", NULL);
|
||||||
memset(&conf, 0, sizeof(conf));
|
memset(&conf, 0, sizeof(conf));
|
||||||
conf.Log = 0;//default value
|
conf.Log = 0; //default value
|
||||||
SaveConfig();//save and return
|
SaveConfig(); //save and return
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
|
||||||
GetPrivateProfileString("Interface", "Logging", NULL, szValue, 20, szIniFile);
|
|
||||||
Conf1->Log = strtoul(szValue, NULL, 10);
|
|
||||||
return ;
|
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
|
GetPrivateProfileString("Interface", "Logging", NULL, szValue, 20, szIniFile);
|
||||||
|
Conf1->Log = strtoul(szValue, NULL, 10);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,44 +20,43 @@ HWND GShwnd = NULL;
|
||||||
|
|
||||||
LRESULT CALLBACK MsgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK MsgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch(msg)
|
switch (msg) {
|
||||||
{
|
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
DestroyWindow(hwnd);
|
DestroyWindow(hwnd);
|
||||||
break;
|
break;
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GSOpenWindow(void *pDsp, const char *Title)
|
int GSOpenWindow(void* pDsp, const char* Title)
|
||||||
{
|
{
|
||||||
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L,
|
WNDCLASSEX wc = {sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L,
|
||||||
GetModuleHandle(NULL), NULL, NULL, NULL, NULL,
|
GetModuleHandle(NULL), NULL, NULL, NULL, NULL,
|
||||||
"PS2EMU_GSNULL", NULL };
|
"PS2EMU_GSNULL", NULL};
|
||||||
RegisterClassEx( &wc );
|
RegisterClassEx(&wc);
|
||||||
|
|
||||||
GShwnd = CreateWindowEx( WS_EX_CLIENTEDGE, "PS2EMU_GSNULL", Title,
|
GShwnd = CreateWindowEx(WS_EX_CLIENTEDGE, "PS2EMU_GSNULL", Title,
|
||||||
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 240, 120, NULL, NULL, wc.hInstance, NULL);
|
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 240, 120, NULL, NULL, wc.hInstance, NULL);
|
||||||
|
|
||||||
if(GShwnd == NULL)
|
if (GShwnd == NULL) {
|
||||||
{
|
GSLog::WriteLn("Failed to create window. Exiting...");
|
||||||
GSLog::WriteLn("Failed to create window. Exiting...");
|
return -1;
|
||||||
return -1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if( pDsp != NULL ) *(uptr*)pDsp = (uptr)GShwnd;
|
if (pDsp != NULL)
|
||||||
|
*(uptr*)pDsp = (uptr)GShwnd;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSCloseWindow()
|
void GSCloseWindow()
|
||||||
{
|
{
|
||||||
DestroyWindow( GShwnd );
|
DestroyWindow(GShwnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSProcessMessages()
|
void GSProcessMessages()
|
||||||
|
@ -65,6 +64,6 @@ void GSProcessMessages()
|
||||||
}
|
}
|
||||||
|
|
||||||
// GSkeyEvent gets called when there is a keyEvent from the PAD plugin
|
// GSkeyEvent gets called when there is a keyEvent from the PAD plugin
|
||||||
void HandleKeyEvent(keyEvent *ev)
|
void HandleKeyEvent(keyEvent* ev)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
|
|
||||||
extern int GSOpenWindow(void *pDsp, const char *Title);
|
extern int GSOpenWindow(void* pDsp, const char* Title);
|
||||||
extern void GSCloseWindow();
|
extern void GSCloseWindow();
|
||||||
extern void GSProcessMessages();
|
extern void GSProcessMessages();
|
||||||
extern void HandleKeyEvent(keyEvent *ev);
|
extern void HandleKeyEvent(keyEvent* ev);
|
||||||
|
|
||||||
|
|
|
@ -24,74 +24,83 @@
|
||||||
HINSTANCE hInst;
|
HINSTANCE hInst;
|
||||||
extern HWND GShwnd;
|
extern HWND GShwnd;
|
||||||
|
|
||||||
void SysMessage(char *fmt, ...) {
|
void SysMessage(char* fmt, ...)
|
||||||
va_list list;
|
{
|
||||||
char tmp[512];
|
va_list list;
|
||||||
|
char tmp[512];
|
||||||
|
|
||||||
va_start(list,fmt);
|
va_start(list, fmt);
|
||||||
vsprintf(tmp,fmt,list);
|
vsprintf(tmp, fmt, list);
|
||||||
va_end(list);
|
va_end(list);
|
||||||
MessageBox((GShwnd!=NULL) ? GShwnd : GetActiveWindow(), tmp, "GS Plugin Msg", 0);
|
MessageBox((GShwnd != NULL) ? GShwnd : GetActiveWindow(), tmp, "GS Plugin Msg", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
|
||||||
switch(uMsg) {
|
switch (uMsg) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
if (conf.Log) CheckDlgButton(hW, IDC_LOGGING, TRUE);
|
if (conf.Log)
|
||||||
return TRUE;
|
CheckDlgButton(hW, IDC_LOGGING, TRUE);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch(LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
EndDialog(hW, TRUE);
|
EndDialog(hW, TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case IDOK:
|
case IDOK:
|
||||||
if (IsDlgButtonChecked(hW, IDC_LOGGING))
|
if (IsDlgButtonChecked(hW, IDC_LOGGING))
|
||||||
conf.Log = 1;
|
conf.Log = 1;
|
||||||
else conf.Log = 0;
|
else
|
||||||
SaveConfig();
|
conf.Log = 0;
|
||||||
EndDialog(hW, FALSE);
|
SaveConfig();
|
||||||
return TRUE;
|
EndDialog(hW, FALSE);
|
||||||
}
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
}
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
switch(uMsg) {
|
{
|
||||||
case WM_INITDIALOG:
|
switch (uMsg) {
|
||||||
return TRUE;
|
case WM_INITDIALOG:
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch(LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
case IDOK:
|
case IDOK:
|
||||||
EndDialog(hW, FALSE);
|
EndDialog(hW, FALSE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSconfigure() {
|
EXPORT_C_(void)
|
||||||
|
GSconfigure()
|
||||||
|
{
|
||||||
DialogBox(hInst,
|
DialogBox(hInst,
|
||||||
MAKEINTRESOURCE(IDD_CONFIG),
|
MAKEINTRESOURCE(IDD_CONFIG),
|
||||||
GetActiveWindow(),
|
GetActiveWindow(),
|
||||||
(DLGPROC)ConfigureDlgProc);
|
(DLGPROC)ConfigureDlgProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSabout() {
|
EXPORT_C_(void)
|
||||||
|
GSabout()
|
||||||
|
{
|
||||||
DialogBox(hInst,
|
DialogBox(hInst,
|
||||||
MAKEINTRESOURCE(IDD_ABOUT),
|
MAKEINTRESOURCE(IDD_ABOUT),
|
||||||
GetActiveWindow(),
|
GetActiveWindow(),
|
||||||
(DLGPROC)AboutDlgProc);
|
(DLGPROC)AboutDlgProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
||||||
DWORD dwReason,
|
DWORD dwReason,
|
||||||
LPVOID lpReserved) {
|
LPVOID lpReserved)
|
||||||
hInst = (HINSTANCE)hModule;
|
{
|
||||||
return TRUE; // very quick :)
|
hInst = (HINSTANCE)hModule;
|
||||||
|
return TRUE; // very quick :)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,20 +17,20 @@
|
||||||
|
|
||||||
void OnKeyboardF5(int myShift)
|
void OnKeyboardF5(int myShift)
|
||||||
{
|
{
|
||||||
GSLog::WriteLn("F5 pressed!");
|
GSLog::WriteLn("F5 pressed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnKeyboardF6(int myShift)
|
void OnKeyboardF6(int myShift)
|
||||||
{
|
{
|
||||||
GSLog::WriteLn("F6 pressed!");
|
GSLog::WriteLn("F6 pressed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnKeyboardF7(int myShift)
|
void OnKeyboardF7(int myShift)
|
||||||
{
|
{
|
||||||
GSLog::WriteLn("F7 pressed!");
|
GSLog::WriteLn("F7 pressed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnKeyboardF9(int myShift)
|
void OnKeyboardF9(int myShift)
|
||||||
{
|
{
|
||||||
GSLog::WriteLn("F9 pressed!");
|
GSLog::WriteLn("F9 pressed!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,43 +23,43 @@
|
||||||
extern std::string s_strIniPath;
|
extern std::string s_strIniPath;
|
||||||
PluginConf Ini;
|
PluginConf Ini;
|
||||||
|
|
||||||
EXPORT_C_(void) PADabout()
|
EXPORT_C_(void)
|
||||||
|
PADabout()
|
||||||
{
|
{
|
||||||
SysMessage("PADnull: A simple null plugin.");
|
SysMessage("PADnull: A simple null plugin.");
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) PADconfigure()
|
EXPORT_C_(void)
|
||||||
|
PADconfigure()
|
||||||
{
|
{
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadConfig()
|
void LoadConfig()
|
||||||
{
|
{
|
||||||
const std::string iniFile(s_strIniPath + "/Padnull.ini");
|
const std::string iniFile(s_strIniPath + "/Padnull.ini");
|
||||||
|
|
||||||
if (!Ini.Open(iniFile, READ_FILE))
|
if (!Ini.Open(iniFile, READ_FILE)) {
|
||||||
{
|
printf("failed to open %s\n", iniFile.c_str());
|
||||||
printf("failed to open %s\n", iniFile.c_str());
|
SaveConfig(); //save and return
|
||||||
SaveConfig();//save and return
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
conf.Log = Ini.ReadInt("logging", 0);
|
conf.Log = Ini.ReadInt("logging", 0);
|
||||||
Ini.Close();
|
Ini.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveConfig()
|
void SaveConfig()
|
||||||
{
|
{
|
||||||
const std::string iniFile(s_strIniPath + "/Padnull.ini");
|
const std::string iniFile(s_strIniPath + "/Padnull.ini");
|
||||||
|
|
||||||
if (!Ini.Open(iniFile, WRITE_FILE))
|
if (!Ini.Open(iniFile, WRITE_FILE)) {
|
||||||
{
|
printf("failed to open %s\n", iniFile.c_str());
|
||||||
printf("failed to open %s\n", iniFile.c_str());
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Ini.WriteInt("logging", conf.Log);
|
Ini.WriteInt("logging", conf.Log);
|
||||||
Ini.Close();
|
Ini.Close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,75 +18,70 @@
|
||||||
#include <gdk/gdkx.h>
|
#include <gdk/gdkx.h>
|
||||||
#include "PadLinux.h"
|
#include "PadLinux.h"
|
||||||
|
|
||||||
Display *GSdsp;
|
Display* GSdsp;
|
||||||
int autoRepeatMode;
|
int autoRepeatMode;
|
||||||
|
|
||||||
void _PadUpdate(int pad)
|
void _PadUpdate(int pad)
|
||||||
{
|
{
|
||||||
XEvent evt;
|
XEvent evt;
|
||||||
KeySym key;
|
KeySym key;
|
||||||
|
|
||||||
// keyboard input
|
// keyboard input
|
||||||
while (XPending(GSdsp) > 0)
|
while (XPending(GSdsp) > 0) {
|
||||||
{
|
XNextEvent(GSdsp, &evt);
|
||||||
XNextEvent(GSdsp, &evt);
|
switch (evt.type) {
|
||||||
switch (evt.type)
|
case KeyPress:
|
||||||
{
|
key = XLookupKeysym((XKeyEvent*)&evt, 0);
|
||||||
case KeyPress:
|
|
||||||
key = XLookupKeysym((XKeyEvent *) &evt, 0);
|
|
||||||
|
|
||||||
// Add code to check if it's one of the keys we configured here on a real pda plugin..
|
// Add code to check if it's one of the keys we configured here on a real pda plugin..
|
||||||
|
|
||||||
event.evt = KEYPRESS;
|
event.evt = KEYPRESS;
|
||||||
event.key = key;
|
event.key = key;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KeyRelease:
|
case KeyRelease:
|
||||||
key = XLookupKeysym((XKeyEvent *) &evt, 0);
|
key = XLookupKeysym((XKeyEvent*)&evt, 0);
|
||||||
|
|
||||||
// Add code to check if it's one of the keys we configured here on a real pda plugin..
|
// Add code to check if it's one of the keys we configured here on a real pda plugin..
|
||||||
|
|
||||||
event.evt = KEYRELEASE;
|
event.evt = KEYRELEASE;
|
||||||
event.key = key;
|
event.key = key;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FocusIn:
|
case FocusIn:
|
||||||
XAutoRepeatOff(GSdsp);
|
XAutoRepeatOff(GSdsp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FocusOut:
|
case FocusOut:
|
||||||
XAutoRepeatOn(GSdsp);
|
XAutoRepeatOn(GSdsp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 _PADOpen(void *pDsp)
|
s32 _PADOpen(void* pDsp)
|
||||||
{
|
{
|
||||||
|
|
||||||
GtkScrolledWindow *win;
|
|
||||||
|
|
||||||
win = *(GtkScrolledWindow**) pDsp;
|
GtkScrolledWindow* win;
|
||||||
|
|
||||||
if (GTK_IS_WIDGET(win))
|
win = *(GtkScrolledWindow**)pDsp;
|
||||||
{
|
|
||||||
// Since we have a GtkScrolledWindow, for now we'll grab whatever display
|
if (GTK_IS_WIDGET(win)) {
|
||||||
// comes along instead. Later, we can fiddle with this, but I'm not sure the
|
// Since we have a GtkScrolledWindow, for now we'll grab whatever display
|
||||||
// best way to get a Display* out of a GtkScrolledWindow. A GtkWindow I might
|
// comes along instead. Later, we can fiddle with this, but I'm not sure the
|
||||||
// be able to manage... --arcum42
|
// best way to get a Display* out of a GtkScrolledWindow. A GtkWindow I might
|
||||||
|
// be able to manage... --arcum42
|
||||||
GSdsp = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
|
GSdsp = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
GSdsp = *(Display**)pDsp;
|
GSdsp = *(Display**)pDsp;
|
||||||
}
|
}
|
||||||
|
|
||||||
XAutoRepeatOff(GSdsp);
|
|
||||||
|
|
||||||
return 0;
|
XAutoRepeatOff(GSdsp);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _PADClose()
|
void _PADClose()
|
||||||
{
|
{
|
||||||
XAutoRepeatOn(GSdsp);
|
XAutoRepeatOn(GSdsp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
void _PadUpdate(int pad);
|
void _PadUpdate(int pad);
|
||||||
s32 _PADOpen(void *pDsp);
|
s32 _PADOpen(void* pDsp);
|
||||||
void _PADClose();
|
void _PADClose();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -21,149 +21,164 @@ using namespace std;
|
||||||
#include "svnrev.h"
|
#include "svnrev.h"
|
||||||
#include "Pad.h"
|
#include "Pad.h"
|
||||||
|
|
||||||
const u8 version = PS2E_PAD_VERSION;
|
const u8 version = PS2E_PAD_VERSION;
|
||||||
const u8 revision = 0;
|
const u8 revision = 0;
|
||||||
const u8 build = 1; // increase that with each version
|
const u8 build = 1; // increase that with each version
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define snprintf sprintf_s
|
#define snprintf sprintf_s
|
||||||
#endif
|
#endif
|
||||||
static char libraryName[256];
|
static char libraryName[256];
|
||||||
string s_strIniPath="inis";
|
string s_strIniPath = "inis";
|
||||||
string s_strLogPath="logs";
|
string s_strLogPath = "logs";
|
||||||
|
|
||||||
FILE *padLog;
|
FILE* padLog;
|
||||||
Config conf;
|
Config conf;
|
||||||
keyEvent event;
|
keyEvent event;
|
||||||
static keyEvent s_event;
|
static keyEvent s_event;
|
||||||
|
|
||||||
EXPORT_C_(u32) PS2EgetLibType()
|
EXPORT_C_(u32)
|
||||||
|
PS2EgetLibType()
|
||||||
{
|
{
|
||||||
return PS2E_LT_PAD;
|
return PS2E_LT_PAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(char*) PS2EgetLibName()
|
EXPORT_C_(char*)
|
||||||
|
PS2EgetLibName()
|
||||||
{
|
{
|
||||||
snprintf( libraryName, 255, "Padnull Driver %lld%s",SVN_REV, SVN_MODS ? "m" : "");
|
snprintf(libraryName, 255, "Padnull Driver %lld%s", SVN_REV, SVN_MODS ? "m" : "");
|
||||||
return libraryName;
|
return libraryName;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(u32) PS2EgetLibVersion2(u32 type)
|
EXPORT_C_(u32)
|
||||||
|
PS2EgetLibVersion2(u32 type)
|
||||||
{
|
{
|
||||||
return (version<<16) | (revision<<8) | build;
|
return (version << 16) | (revision << 8) | build;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __Log(const char *fmt, ...)
|
void __Log(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
va_list list;
|
va_list list;
|
||||||
|
|
||||||
if (padLog == NULL) return;
|
if (padLog == NULL)
|
||||||
va_start(list, fmt);
|
return;
|
||||||
vfprintf(padLog, fmt, list);
|
va_start(list, fmt);
|
||||||
va_end(list);
|
vfprintf(padLog, fmt, list);
|
||||||
|
va_end(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __LogToConsole(const char *fmt, ...)
|
void __LogToConsole(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
va_list list;
|
va_list list;
|
||||||
|
|
||||||
va_start(list, fmt);
|
va_start(list, fmt);
|
||||||
|
|
||||||
if (padLog != NULL) vfprintf(padLog, fmt, list);
|
if (padLog != NULL)
|
||||||
|
vfprintf(padLog, fmt, list);
|
||||||
|
|
||||||
printf("PadNull: ");
|
printf("PadNull: ");
|
||||||
vprintf(fmt, list);
|
vprintf(fmt, list);
|
||||||
va_end(list);
|
va_end(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) PADsetSettingsDir(const char* dir)
|
EXPORT_C_(void)
|
||||||
|
PADsetSettingsDir(const char* dir)
|
||||||
{
|
{
|
||||||
s_strIniPath = (dir == NULL) ? "inis" : dir;
|
s_strIniPath = (dir == NULL) ? "inis" : dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenLog() {
|
bool OpenLog()
|
||||||
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
#ifdef PAD_LOG
|
#ifdef PAD_LOG
|
||||||
if(padLog) return result;
|
if (padLog)
|
||||||
|
return result;
|
||||||
|
|
||||||
const std::string LogFile(s_strLogPath + "/padnull.log");
|
const std::string LogFile(s_strLogPath + "/padnull.log");
|
||||||
|
|
||||||
padLog = fopen(LogFile.c_str(), "w");
|
padLog = fopen(LogFile.c_str(), "w");
|
||||||
if (padLog != NULL)
|
if (padLog != NULL)
|
||||||
setvbuf(padLog, NULL, _IONBF, 0);
|
setvbuf(padLog, NULL, _IONBF, 0);
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "Can't create log file %s\n", LogFile.c_str());
|
fprintf(stderr, "Can't create log file %s\n", LogFile.c_str());
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
PAD_LOG("PADinit\n");
|
PAD_LOG("PADinit\n");
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) PADsetLogDir(const char* dir)
|
EXPORT_C_(void)
|
||||||
|
PADsetLogDir(const char* dir)
|
||||||
{
|
{
|
||||||
// Get the path to the log directory.
|
// Get the path to the log directory.
|
||||||
s_strLogPath = (dir==NULL) ? "logs" : dir;
|
s_strLogPath = (dir == NULL) ? "logs" : dir;
|
||||||
|
|
||||||
// Reload the log file after updated the path
|
// Reload the log file after updated the path
|
||||||
if (padLog) {
|
if (padLog) {
|
||||||
fclose(padLog);
|
fclose(padLog);
|
||||||
padLog = NULL;
|
padLog = NULL;
|
||||||
}
|
}
|
||||||
OpenLog();
|
OpenLog();
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) PADinit(u32 flags)
|
EXPORT_C_(s32)
|
||||||
|
PADinit(u32 flags)
|
||||||
{
|
{
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
|
|
||||||
OpenLog();
|
OpenLog();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) PADshutdown()
|
EXPORT_C_(void)
|
||||||
|
PADshutdown()
|
||||||
{
|
{
|
||||||
#ifdef PAD_LOG
|
#ifdef PAD_LOG
|
||||||
if (padLog)
|
if (padLog) {
|
||||||
{
|
fclose(padLog);
|
||||||
fclose(padLog);
|
padLog = NULL;
|
||||||
padLog = NULL;
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) PADopen(void *pDsp)
|
EXPORT_C_(s32)
|
||||||
|
PADopen(void* pDsp)
|
||||||
{
|
{
|
||||||
memset(&event, 0, sizeof(event));
|
memset(&event, 0, sizeof(event));
|
||||||
|
|
||||||
return _PADOpen(pDsp);
|
return _PADOpen(pDsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) PADclose()
|
EXPORT_C_(void)
|
||||||
|
PADclose()
|
||||||
{
|
{
|
||||||
_PADClose();
|
_PADClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// PADkeyEvent is called every vsync (return NULL if no event)
|
// PADkeyEvent is called every vsync (return NULL if no event)
|
||||||
EXPORT_C_(keyEvent*) PADkeyEvent()
|
EXPORT_C_(keyEvent*)
|
||||||
|
PADkeyEvent()
|
||||||
{
|
{
|
||||||
|
|
||||||
s_event = event;
|
s_event = event;
|
||||||
event.evt = 0;
|
event.evt = 0;
|
||||||
event.key = 0;
|
event.key = 0;
|
||||||
|
|
||||||
return &s_event;
|
return &s_event;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(u8) PADstartPoll(int pad)
|
EXPORT_C_(u8)
|
||||||
|
PADstartPoll(int pad)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(u8) PADpoll(u8 value)
|
EXPORT_C_(u8)
|
||||||
|
PADpoll(u8 value)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// call to give a hint to the PAD plugin to query for the keyboard state. A
|
// call to give a hint to the PAD plugin to query for the keyboard state. A
|
||||||
|
@ -173,29 +188,34 @@ EXPORT_C_(u8) PADpoll(u8 value)
|
||||||
// the window (and input). Note that PADupdate can be called from a different
|
// the window (and input). Note that PADupdate can be called from a different
|
||||||
// thread than the other functions, so mutex or other multithreading primitives
|
// thread than the other functions, so mutex or other multithreading primitives
|
||||||
// have to be added to maintain data integrity.
|
// have to be added to maintain data integrity.
|
||||||
EXPORT_C_(u32) PADquery()
|
EXPORT_C_(u32)
|
||||||
|
PADquery()
|
||||||
// returns: 1 if supported pad1
|
// returns: 1 if supported pad1
|
||||||
// 2 if supported pad2
|
// 2 if supported pad2
|
||||||
// 3 if both are supported
|
// 3 if both are supported
|
||||||
{
|
{
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) PADupdate(int pad)
|
EXPORT_C_(void)
|
||||||
|
PADupdate(int pad)
|
||||||
{
|
{
|
||||||
_PadUpdate(pad);
|
_PadUpdate(pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) PADgsDriverInfo(GSdriverInfo *info)
|
EXPORT_C_(void)
|
||||||
|
PADgsDriverInfo(GSdriverInfo* info)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) PADfreeze(int mode, freezeData *data)
|
EXPORT_C_(s32)
|
||||||
|
PADfreeze(int mode, freezeData* data)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) PADtest()
|
EXPORT_C_(s32)
|
||||||
|
PADtest()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,21 +31,21 @@
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define EXPORT_C_(type) extern "C" type CALLBACK
|
#define EXPORT_C_(type) extern "C" type CALLBACK
|
||||||
#else
|
#else
|
||||||
#define EXPORT_C_(type) extern "C" __attribute__((stdcall,externally_visible,visibility("default"))) type
|
#define EXPORT_C_(type) extern "C" __attribute__((stdcall, externally_visible, visibility("default"))) type
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PAD_LOG __Log
|
#define PAD_LOG __Log
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
s32 Log;
|
s32 Log;
|
||||||
} Config;
|
} Config;
|
||||||
|
|
||||||
extern Config conf;
|
extern Config conf;
|
||||||
extern FILE *padLog;
|
extern FILE* padLog;
|
||||||
extern keyEvent event;
|
extern keyEvent event;
|
||||||
|
|
||||||
extern void __Log(char *fmt, ...);
|
extern void __Log(char* fmt, ...);
|
||||||
extern void SaveConfig();
|
extern void SaveConfig();
|
||||||
extern void LoadConfig();
|
extern void LoadConfig();
|
||||||
|
|
||||||
|
|
|
@ -19,29 +19,27 @@ extern std::string s_strIniPath;
|
||||||
|
|
||||||
void SaveConfig()
|
void SaveConfig()
|
||||||
{
|
{
|
||||||
const std::string iniFile = s_strIniPath + "/Padnull.ini";
|
const std::string iniFile = s_strIniPath + "/Padnull.ini";
|
||||||
|
|
||||||
PluginConf ini;
|
PluginConf ini;
|
||||||
if (!ini.Open(iniFile, READ_FILE))
|
if (!ini.Open(iniFile, READ_FILE)) {
|
||||||
{
|
printf("failed to open %s\n", iniFile.c_str());
|
||||||
printf("failed to open %s\n", iniFile.c_str());
|
SaveConfig(); //save and return
|
||||||
SaveConfig();//save and return
|
return;
|
||||||
return;
|
}
|
||||||
}
|
conf.Log = ini.ReadInt("logging", 0);
|
||||||
conf.Log = ini.ReadInt("logging", 0);
|
ini.Close();
|
||||||
ini.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadConfig()
|
void LoadConfig()
|
||||||
{
|
{
|
||||||
const std::string iniFile(s_strIniPath + "/Padnull.ini");
|
const std::string iniFile(s_strIniPath + "/Padnull.ini");
|
||||||
|
|
||||||
PluginConf ini;
|
PluginConf ini;
|
||||||
if (!ini.Open(iniFile, WRITE_FILE))
|
if (!ini.Open(iniFile, WRITE_FILE)) {
|
||||||
{
|
printf("failed to open %s\n", iniFile.c_str());
|
||||||
printf("failed to open %s\n", iniFile.c_str());
|
return;
|
||||||
return;
|
}
|
||||||
}
|
ini.WriteInt("logging", conf.Log);
|
||||||
ini.WriteInt("logging", conf.Log);
|
ini.Close();
|
||||||
ini.Close();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,56 +21,54 @@ HWND GShwnd = NULL;
|
||||||
|
|
||||||
LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (msg)
|
switch (msg) {
|
||||||
{
|
case WM_KEYDOWN:
|
||||||
case WM_KEYDOWN:
|
if (lParam & 0x40000000)
|
||||||
if (lParam & 0x40000000)return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
event.evt = KEYPRESS;
|
event.evt = KEYPRESS;
|
||||||
event.key = wParam;
|
event.key = wParam;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_KEYUP:
|
case WM_KEYUP:
|
||||||
event.evt = KEYRELEASE;
|
event.evt = KEYRELEASE;
|
||||||
event.key = wParam;
|
event.key = wParam;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
case WM_QUIT:
|
case WM_QUIT:
|
||||||
event.evt = KEYPRESS;
|
event.evt = KEYPRESS;
|
||||||
event.key = VK_ESCAPE;
|
event.key = VK_ESCAPE;
|
||||||
return GSwndProc(hWnd, msg, wParam, lParam);
|
return GSwndProc(hWnd, msg, wParam, lParam);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return GSwndProc(hWnd, msg, wParam, lParam);
|
return GSwndProc(hWnd, msg, wParam, lParam);
|
||||||
};
|
};
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _PadUpdate(int pad)
|
void _PadUpdate(int pad)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 _PADOpen(void *pDsp)
|
s32 _PADOpen(void* pDsp)
|
||||||
{
|
{
|
||||||
GShwnd = (HWND)*(long*)pDsp;
|
GShwnd = (HWND) * (long*)pDsp;
|
||||||
|
|
||||||
if (GShwnd != NULL && GSwndProc != NULL)
|
if (GShwnd != NULL && GSwndProc != NULL) {
|
||||||
{
|
// revert
|
||||||
// revert
|
SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(GSwndProc));
|
||||||
SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(GSwndProc));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
GSwndProc = (WNDPROC)GetWindowLongPtr(GShwnd, GWLP_WNDPROC);
|
GSwndProc = (WNDPROC)GetWindowLongPtr(GShwnd, GWLP_WNDPROC);
|
||||||
GSwndProc = ((WNDPROC)SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(PADwndProc)));
|
GSwndProc = ((WNDPROC)SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(PADwndProc)));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _PADClose()
|
void _PADClose()
|
||||||
{
|
{
|
||||||
if (GShwnd != NULL && GSwndProc != NULL)
|
if (GShwnd != NULL && GSwndProc != NULL) {
|
||||||
{
|
|
||||||
SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(GSwndProc));
|
SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(GSwndProc));
|
||||||
GSwndProc = NULL;
|
GSwndProc = NULL;
|
||||||
GShwnd = NULL;
|
GShwnd = NULL;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
void _PadUpdate(int pad);
|
void _PadUpdate(int pad);
|
||||||
s32 _PADOpen(void *pDsp);
|
s32 _PADOpen(void* pDsp);
|
||||||
void _PADClose();
|
void _PADClose();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,65 +20,72 @@
|
||||||
|
|
||||||
HINSTANCE hInst;
|
HINSTANCE hInst;
|
||||||
|
|
||||||
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
|
||||||
switch(uMsg) {
|
switch (uMsg) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
if (conf.Log) CheckDlgButton(hW, IDC_LOGGING, TRUE);
|
if (conf.Log)
|
||||||
return TRUE;
|
CheckDlgButton(hW, IDC_LOGGING, TRUE);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch(LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
EndDialog(hW, TRUE);
|
EndDialog(hW, TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case IDOK:
|
case IDOK:
|
||||||
if (IsDlgButtonChecked(hW, IDC_LOGGING))
|
if (IsDlgButtonChecked(hW, IDC_LOGGING))
|
||||||
conf.Log = 1;
|
conf.Log = 1;
|
||||||
else
|
else
|
||||||
conf.Log = 0;
|
conf.Log = 0;
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
EndDialog(hW, FALSE);
|
EndDialog(hW, FALSE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
switch(uMsg) {
|
{
|
||||||
case WM_INITDIALOG:
|
switch (uMsg) {
|
||||||
return TRUE;
|
case WM_INITDIALOG:
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch(LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
case IDOK:
|
case IDOK:
|
||||||
EndDialog(hW, FALSE);
|
EndDialog(hW, FALSE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) PADconfigure() {
|
EXPORT_C_(void)
|
||||||
|
PADconfigure()
|
||||||
|
{
|
||||||
DialogBox(hInst,
|
DialogBox(hInst,
|
||||||
MAKEINTRESOURCE(IDD_CONFIG),
|
MAKEINTRESOURCE(IDD_CONFIG),
|
||||||
GetActiveWindow(),
|
GetActiveWindow(),
|
||||||
(DLGPROC)ConfigureDlgProc);
|
(DLGPROC)ConfigureDlgProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) PADabout() {
|
EXPORT_C_(void)
|
||||||
|
PADabout()
|
||||||
|
{
|
||||||
DialogBox(hInst,
|
DialogBox(hInst,
|
||||||
MAKEINTRESOURCE(IDD_ABOUT),
|
MAKEINTRESOURCE(IDD_ABOUT),
|
||||||
GetActiveWindow(),
|
GetActiveWindow(),
|
||||||
(DLGPROC)AboutDlgProc);
|
(DLGPROC)AboutDlgProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
||||||
DWORD dwReason,
|
DWORD dwReason,
|
||||||
LPVOID lpReserved) {
|
LPVOID lpReserved)
|
||||||
hInst = (HINSTANCE)hModule;
|
{
|
||||||
return TRUE; // very quick :)
|
hInst = (HINSTANCE)hModule;
|
||||||
|
return TRUE; // very quick :)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,44 +23,44 @@ using namespace std;
|
||||||
extern string s_strIniPath;
|
extern string s_strIniPath;
|
||||||
PluginConf Ini;
|
PluginConf Ini;
|
||||||
|
|
||||||
EXPORT_C_(void) SPU2configure()
|
EXPORT_C_(void)
|
||||||
|
SPU2configure()
|
||||||
{
|
{
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) SPU2about()
|
EXPORT_C_(void)
|
||||||
|
SPU2about()
|
||||||
{
|
{
|
||||||
//SysMessage("%s %d.%d", libraryName, version, build);
|
//SysMessage("%s %d.%d", libraryName, version, build);
|
||||||
SysMessage("SPU2null: A simple null plugin.");
|
SysMessage("SPU2null: A simple null plugin.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadConfig()
|
void LoadConfig()
|
||||||
{
|
{
|
||||||
const std::string iniFile(s_strIniPath + "/Spu2null.ini");
|
const std::string iniFile(s_strIniPath + "/Spu2null.ini");
|
||||||
|
|
||||||
if (!Ini.Open(iniFile, READ_FILE))
|
if (!Ini.Open(iniFile, READ_FILE)) {
|
||||||
{
|
printf("failed to open %s\n", iniFile.c_str());
|
||||||
printf("failed to open %s\n", iniFile.c_str());
|
SaveConfig(); //save and return
|
||||||
SaveConfig();//save and return
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
conf.Log = Ini.ReadInt("logging", 0);
|
conf.Log = Ini.ReadInt("logging", 0);
|
||||||
Ini.Close();
|
Ini.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveConfig()
|
void SaveConfig()
|
||||||
{
|
{
|
||||||
const std::string iniFile(s_strIniPath + "/Spu2null.ini");
|
const std::string iniFile(s_strIniPath + "/Spu2null.ini");
|
||||||
|
|
||||||
if (!Ini.Open(iniFile, WRITE_FILE))
|
if (!Ini.Open(iniFile, WRITE_FILE)) {
|
||||||
{
|
printf("failed to open %s\n", iniFile.c_str());
|
||||||
printf("failed to open %s\n", iniFile.c_str());
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Ini.WriteInt("logging", conf.Log);
|
Ini.WriteInt("logging", conf.Log);
|
||||||
Ini.Close();
|
Ini.Close();
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -24,8 +24,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#define SPU2defs
|
#define SPU2defs
|
||||||
#include "PS2Edefs.h"
|
#include "PS2Edefs.h"
|
||||||
}
|
}
|
||||||
|
@ -39,114 +38,115 @@ extern "C"
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define EXPORT_C_(type) extern "C" __declspec(dllexport) type CALLBACK
|
#define EXPORT_C_(type) extern "C" __declspec(dllexport) type CALLBACK
|
||||||
#else
|
#else
|
||||||
#define EXPORT_C_(type) extern "C" __attribute__((stdcall,externally_visible,visibility("default"))) type
|
#define EXPORT_C_(type) extern "C" __attribute__((stdcall, externally_visible, visibility("default"))) type
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern FILE *spu2Log;
|
extern FILE* spu2Log;
|
||||||
#define SPU2_LOG __Log //debug mode
|
#define SPU2_LOG __Log //debug mode
|
||||||
|
|
||||||
extern const u8 version;
|
extern const u8 version;
|
||||||
extern const u8 revision;
|
extern const u8 revision;
|
||||||
extern const u8 build;
|
extern const u8 build;
|
||||||
extern const u32 minor;
|
extern const u32 minor;
|
||||||
extern char *libraryName;
|
extern char* libraryName;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
s32 Log;
|
s32 Log;
|
||||||
} Config;
|
} Config;
|
||||||
|
|
||||||
extern Config conf;
|
extern Config conf;
|
||||||
|
|
||||||
void __Log(char *fmt, ...);
|
void __Log(char* fmt, ...);
|
||||||
void SaveConfig();
|
void SaveConfig();
|
||||||
void LoadConfig();
|
void LoadConfig();
|
||||||
void SysMessage(char *fmt, ...);
|
void SysMessage(char* fmt, ...);
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
// SPU2 Registers //
|
// SPU2 Registers //
|
||||||
////////////////////
|
////////////////////
|
||||||
#define REG_VP_VOLL 0x0000
|
#define REG_VP_VOLL 0x0000
|
||||||
#define REG_VP_VOLR 0x0002
|
#define REG_VP_VOLR 0x0002
|
||||||
#define REG_VP_PITCH 0x0004
|
#define REG_VP_PITCH 0x0004
|
||||||
#define REG_VP_ADSR1 0x0006
|
#define REG_VP_ADSR1 0x0006
|
||||||
#define REG_VP_ADSR2 0x0008
|
#define REG_VP_ADSR2 0x0008
|
||||||
#define REG_VP_ENVX 0x000A
|
#define REG_VP_ENVX 0x000A
|
||||||
#define REG_VP_VOLXL 0x000C
|
#define REG_VP_VOLXL 0x000C
|
||||||
#define REG_VP_VOLXR 0x000E
|
#define REG_VP_VOLXR 0x000E
|
||||||
#define REG_C0_FMOD1 0x0180
|
#define REG_C0_FMOD1 0x0180
|
||||||
#define REG_C0_FMOD2 0x0182
|
#define REG_C0_FMOD2 0x0182
|
||||||
#define REG_C1_FMOD1 0x0580
|
#define REG_C1_FMOD1 0x0580
|
||||||
#define REG_C1_FMOD2 0x0582
|
#define REG_C1_FMOD2 0x0582
|
||||||
#define REG_S_NON 0x0184
|
#define REG_S_NON 0x0184
|
||||||
#define REG_S_VMIXL 0x0188
|
#define REG_S_VMIXL 0x0188
|
||||||
#define REG_S_VMIXEL 0x018C
|
#define REG_S_VMIXEL 0x018C
|
||||||
#define REG_S_VMIXR 0x0190
|
#define REG_S_VMIXR 0x0190
|
||||||
#define REG_S_VMIXER 0x0194
|
#define REG_S_VMIXER 0x0194
|
||||||
#define REG_C0_MMIX 0x0198
|
#define REG_C0_MMIX 0x0198
|
||||||
#define REG_C1_MMIX 0x0598
|
#define REG_C1_MMIX 0x0598
|
||||||
#define REG_C0_CTRL 0x019A
|
#define REG_C0_CTRL 0x019A
|
||||||
#define REG_C0_IRQA_HI 0x019C
|
#define REG_C0_IRQA_HI 0x019C
|
||||||
#define REG_C0_IRQA_LO 0x019D
|
#define REG_C0_IRQA_LO 0x019D
|
||||||
#define REG_C1_IRQA_HI 0x059C
|
#define REG_C1_IRQA_HI 0x059C
|
||||||
#define REG_C1_IRQA_LO 0x059D
|
#define REG_C1_IRQA_LO 0x059D
|
||||||
#define REG_C0_SPUON1 0x1A0
|
#define REG_C0_SPUON1 0x1A0
|
||||||
#define REG_C0_SPUON2 0x1A2
|
#define REG_C0_SPUON2 0x1A2
|
||||||
#define REG_C1_SPUON1 0x5A0
|
#define REG_C1_SPUON1 0x5A0
|
||||||
#define REG_C1_SPUON2 0x5A2
|
#define REG_C1_SPUON2 0x5A2
|
||||||
#define REG_C0_SPUOFF1 0x1A4
|
#define REG_C0_SPUOFF1 0x1A4
|
||||||
#define REG_C0_SPUOFF2 0x1A6
|
#define REG_C0_SPUOFF2 0x1A6
|
||||||
#define REG_C1_SPUOFF1 0x5A4
|
#define REG_C1_SPUOFF1 0x5A4
|
||||||
#define REG_C1_SPUOFF2 0x5A6
|
#define REG_C1_SPUOFF2 0x5A6
|
||||||
#define REG_C0_SPUADDR_HI 0x01A8
|
#define REG_C0_SPUADDR_HI 0x01A8
|
||||||
#define REG_C0_SPUADDR_LO 0x01AA
|
#define REG_C0_SPUADDR_LO 0x01AA
|
||||||
#define REG_C1_SPUADDR_HI 0x05A8
|
#define REG_C1_SPUADDR_HI 0x05A8
|
||||||
#define REG_C1_SPUADDR_LO 0x05AA
|
#define REG_C1_SPUADDR_LO 0x05AA
|
||||||
#define REG_C0_SPUDATA 0x01AC
|
#define REG_C0_SPUDATA 0x01AC
|
||||||
#define REG_C1_SPUDATA 0x05AC
|
#define REG_C1_SPUDATA 0x05AC
|
||||||
#define REG_C0_DMACTRL 0x01AE
|
#define REG_C0_DMACTRL 0x01AE
|
||||||
#define REG_C1_DMACTRL 0x05AE
|
#define REG_C1_DMACTRL 0x05AE
|
||||||
#define REG_C0_ADMAS 0x01B0
|
#define REG_C0_ADMAS 0x01B0
|
||||||
#define REG_VA_SSA 0x01C0
|
#define REG_VA_SSA 0x01C0
|
||||||
#define REG_VA_LSAX 0x01C4
|
#define REG_VA_LSAX 0x01C4
|
||||||
#define REG_VA_NAX 0x01C8
|
#define REG_VA_NAX 0x01C8
|
||||||
#define REG_A_ESA 0x02E0
|
#define REG_A_ESA 0x02E0
|
||||||
#define REG_A_EEA 0x033C
|
#define REG_A_EEA 0x033C
|
||||||
#define REG_C0_END1 0x0340
|
#define REG_C0_END1 0x0340
|
||||||
#define REG_C0_END2 0x0342
|
#define REG_C0_END2 0x0342
|
||||||
#define REG_C1_END1 0x0740
|
#define REG_C1_END1 0x0740
|
||||||
#define REG_C1_END2 0x0742
|
#define REG_C1_END2 0x0742
|
||||||
#define REG_C0_SPUSTAT 0x0344 //not sure!
|
#define REG_C0_SPUSTAT 0x0344 //not sure!
|
||||||
#define REG_C1_CTRL 0x059A
|
#define REG_C1_CTRL 0x059A
|
||||||
#define REG_C1_ADMAS 0x05B0
|
#define REG_C1_ADMAS 0x05B0
|
||||||
#define REG_C1_SPUSTAT 0x0744 //not sure!
|
#define REG_C1_SPUSTAT 0x0744 //not sure!
|
||||||
#define REG_P_MVOLL 0x0760
|
#define REG_P_MVOLL 0x0760
|
||||||
#define REG_P_MVOLR 0x0762
|
#define REG_P_MVOLR 0x0762
|
||||||
#define REG_P_EVOLL 0x0764
|
#define REG_P_EVOLL 0x0764
|
||||||
#define REG_P_EVOLR 0x0766
|
#define REG_P_EVOLR 0x0766
|
||||||
#define REG_P_AVOLL 0x0768
|
#define REG_P_AVOLL 0x0768
|
||||||
#define REG_P_AVOLR 0x076A
|
#define REG_P_AVOLR 0x076A
|
||||||
#define REG_P_BVOLL 0x076C
|
#define REG_P_BVOLL 0x076C
|
||||||
#define REG_P_BVOLR 0x076E
|
#define REG_P_BVOLR 0x076E
|
||||||
#define REG_P_MVOLXL 0x0770
|
#define REG_P_MVOLXL 0x0770
|
||||||
#define REG_P_MVOLXR 0x0772
|
#define REG_P_MVOLXR 0x0772
|
||||||
#define SPDIF_OUT 0x07C0
|
#define SPDIF_OUT 0x07C0
|
||||||
#define REG_IRQINFO 0x07C2
|
#define REG_IRQINFO 0x07C2
|
||||||
#define SPDIF_MODE 0x07C6
|
#define SPDIF_MODE 0x07C6
|
||||||
#define SPDIF_MEDIA 0x07C8
|
#define SPDIF_MEDIA 0x07C8
|
||||||
|
|
||||||
#define spu2Rs16(mem) (*(s16*)&spu2regs[(mem) & 0xffff])
|
#define spu2Rs16(mem) (*(s16*)&spu2regs[(mem)&0xffff])
|
||||||
#define spu2Ru16(mem) (*(u16*)&spu2regs[(mem) & 0xffff])
|
#define spu2Ru16(mem) (*(u16*)&spu2regs[(mem)&0xffff])
|
||||||
//#define spu2Rs32(mem) (*(s32*)&spu2regs[(mem) & 0xffff])
|
//#define spu2Rs32(mem) (*(s32*)&spu2regs[(mem) & 0xffff])
|
||||||
//#define spu2Ru32(mem) (*(u32*)&spu2regs[(mem) & 0xffff])
|
//#define spu2Ru32(mem) (*(u32*)&spu2regs[(mem) & 0xffff])
|
||||||
|
|
||||||
#define IRQINFO spu2Ru16(REG_IRQINFO)
|
#define IRQINFO spu2Ru16(REG_IRQINFO)
|
||||||
|
|
||||||
#define SPU2_GET32BIT(lo,hi) (((u32)(spu2Ru16(hi)&0x3f)<<16)|(u32)spu2Ru16(lo))
|
#define SPU2_GET32BIT(lo, hi) (((u32)(spu2Ru16(hi) & 0x3f) << 16) | (u32)spu2Ru16(lo))
|
||||||
#define SPU2_SET32BIT(value, lo, hi) { \
|
#define SPU2_SET32BIT(value, lo, hi) \
|
||||||
spu2Ru16(hi) = ((value)>>16)&0x3f; \
|
{ \
|
||||||
spu2Ru16(lo) = (value)&0xffff; \
|
spu2Ru16(hi) = ((value) >> 16) & 0x3f; \
|
||||||
} \
|
spu2Ru16(lo) = (value)&0xffff; \
|
||||||
|
}
|
||||||
|
|
||||||
#define C0_IRQA SPU2_GET32BIT(REG_C0_IRQA_LO, REG_C0_IRQA_HI)
|
#define C0_IRQA SPU2_GET32BIT(REG_C0_IRQA_LO, REG_C0_IRQA_HI)
|
||||||
#define C1_IRQA SPU2_GET32BIT(REG_C1_IRQA_LO, REG_C1_IRQA_HI)
|
#define C1_IRQA SPU2_GET32BIT(REG_C1_IRQA_LO, REG_C1_IRQA_HI)
|
||||||
|
@ -157,20 +157,20 @@ void SysMessage(char *fmt, ...);
|
||||||
#define C0_SPUADDR_SET(value) SPU2_SET32BIT(value, REG_C0_IRQA_LO, REG_C0_IRQA_HI)
|
#define C0_SPUADDR_SET(value) SPU2_SET32BIT(value, REG_C0_IRQA_LO, REG_C0_IRQA_HI)
|
||||||
#define C1_SPUADDR_SET(value) SPU2_SET32BIT(value, REG_C1_IRQA_LO, REG_C1_IRQA_HI)
|
#define C1_SPUADDR_SET(value) SPU2_SET32BIT(value, REG_C1_IRQA_LO, REG_C1_IRQA_HI)
|
||||||
|
|
||||||
#define SPU_NUMBER_VOICES 48
|
#define SPU_NUMBER_VOICES 48
|
||||||
|
|
||||||
struct SPU_CONTROL_
|
struct SPU_CONTROL_
|
||||||
{
|
{
|
||||||
u16 spuon : 1;
|
u16 spuon : 1;
|
||||||
u16 spuUnmute : 1;
|
u16 spuUnmute : 1;
|
||||||
u16 noiseFreq : 6;
|
u16 noiseFreq : 6;
|
||||||
u16 reverb : 1;
|
u16 reverb : 1;
|
||||||
u16 irq : 1;
|
u16 irq : 1;
|
||||||
u16 dma : 2; // 1 - no dma, 2 - write, 3 - read
|
u16 dma : 2; // 1 - no dma, 2 - write, 3 - read
|
||||||
u16 extr : 1; // external reverb
|
u16 extr : 1; // external reverb
|
||||||
u16 cdreverb : 1;
|
u16 cdreverb : 1;
|
||||||
u16 extAudio : 1;
|
u16 extAudio : 1;
|
||||||
u16 extCd : 1;
|
u16 extCd : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
// the layout of each voice in wSpuRegs
|
// the layout of each voice in wSpuRegs
|
||||||
|
@ -178,115 +178,117 @@ struct _SPU_VOICE
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct {
|
struct
|
||||||
u16 Vol : 14;
|
{
|
||||||
u16 Inverted : 1;
|
u16 Vol : 14;
|
||||||
u16 Sweep0 : 1;
|
u16 Inverted : 1;
|
||||||
|
u16 Sweep0 : 1;
|
||||||
} vol;
|
} vol;
|
||||||
struct {
|
struct
|
||||||
u16 Vol : 7;
|
{
|
||||||
u16 res1 : 5;
|
u16 Vol : 7;
|
||||||
u16 Inverted : 1;
|
u16 res1 : 5;
|
||||||
u16 Decrease : 1; // if 0, increase
|
u16 Inverted : 1;
|
||||||
u16 ExpSlope : 1; // if 0, linear slope
|
u16 Decrease : 1; // if 0, increase
|
||||||
u16 Sweep1 : 1; // always one
|
u16 ExpSlope : 1; // if 0, linear slope
|
||||||
} sweep;
|
u16 Sweep1 : 1; // always one
|
||||||
u16 word;
|
} sweep;
|
||||||
} left, right;
|
u16 word;
|
||||||
|
} left, right;
|
||||||
|
|
||||||
u16 pitch : 14; // 1000 - no pitch, 2000 - pitch + 1, etc
|
u16 pitch : 14; // 1000 - no pitch, 2000 - pitch + 1, etc
|
||||||
u16 res0 : 2;
|
u16 res0 : 2;
|
||||||
|
|
||||||
u16 SustainLvl : 4;
|
u16 SustainLvl : 4;
|
||||||
u16 DecayRate : 4;
|
u16 DecayRate : 4;
|
||||||
u16 AttackRate : 7;
|
u16 AttackRate : 7;
|
||||||
u16 AttackExp : 1; // if 0, linear
|
u16 AttackExp : 1; // if 0, linear
|
||||||
|
|
||||||
u16 ReleaseRate : 5;
|
u16 ReleaseRate : 5;
|
||||||
u16 ReleaseExp : 1; // if 0, linear
|
u16 ReleaseExp : 1; // if 0, linear
|
||||||
u16 SustainRate : 7;
|
u16 SustainRate : 7;
|
||||||
u16 res1 : 1;
|
u16 res1 : 1;
|
||||||
u16 SustainDec : 1; // if 0, inc
|
u16 SustainDec : 1; // if 0, inc
|
||||||
u16 SustainExp : 1; // if 0, linear
|
u16 SustainExp : 1; // if 0, linear
|
||||||
|
|
||||||
u16 AdsrVol;
|
u16 AdsrVol;
|
||||||
u16 Address; // add / 8
|
u16 Address; // add / 8
|
||||||
u16 RepeatAddr; // gets reset when sample starts
|
u16 RepeatAddr; // gets reset when sample starts
|
||||||
};
|
};
|
||||||
|
|
||||||
// ADSR INFOS PER CHANNEL
|
// ADSR INFOS PER CHANNEL
|
||||||
struct ADSRInfoEx
|
struct ADSRInfoEx
|
||||||
{
|
{
|
||||||
s32 State;
|
s32 State;
|
||||||
s32 AttackModeExp;
|
s32 AttackModeExp;
|
||||||
s32 AttackRate;
|
s32 AttackRate;
|
||||||
s32 DecayRate;
|
s32 DecayRate;
|
||||||
s32 SustainLevel;
|
s32 SustainLevel;
|
||||||
s32 SustainModeExp;
|
s32 SustainModeExp;
|
||||||
s32 SustainIncrease;
|
s32 SustainIncrease;
|
||||||
s32 SustainRate;
|
s32 SustainRate;
|
||||||
s32 ReleaseModeExp;
|
s32 ReleaseModeExp;
|
||||||
s32 ReleaseRate;
|
s32 ReleaseRate;
|
||||||
s32 EnvelopeVol;
|
s32 EnvelopeVol;
|
||||||
s32 lVolume;
|
s32 lVolume;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NSSIZE 48 // ~ 1 ms of data
|
#define NSSIZE 48 // ~ 1 ms of data
|
||||||
#define NSFRAMES 16 // gather at least NSFRAMES of NSSIZE before submitting
|
#define NSFRAMES 16 // gather at least NSFRAMES of NSSIZE before submitting
|
||||||
#define NSPACKETS 4
|
#define NSPACKETS 4
|
||||||
#define SPU_VOICE_STATE_SIZE (sizeof(VOICE_PROCESSED)-4*sizeof(void*))
|
#define SPU_VOICE_STATE_SIZE (sizeof(VOICE_PROCESSED) - 4 * sizeof(void*))
|
||||||
|
|
||||||
struct VOICE_PROCESSED
|
struct VOICE_PROCESSED
|
||||||
{
|
{
|
||||||
VOICE_PROCESSED()
|
VOICE_PROCESSED()
|
||||||
{
|
{
|
||||||
memset(this, 0, sizeof(VOICE_PROCESSED));
|
memset(this, 0, sizeof(VOICE_PROCESSED));
|
||||||
}
|
}
|
||||||
~VOICE_PROCESSED()
|
~VOICE_PROCESSED()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetVolume(int right);
|
void SetVolume(int right);
|
||||||
void StartSound();
|
void StartSound();
|
||||||
void VoiceChangeFrequency();
|
void VoiceChangeFrequency();
|
||||||
void FModChangeFrequency(int ns);
|
void FModChangeFrequency(int ns);
|
||||||
void Stop();
|
void Stop();
|
||||||
|
|
||||||
SPU_CONTROL_* GetCtrl();
|
SPU_CONTROL_* GetCtrl();
|
||||||
|
|
||||||
// start save state
|
// start save state
|
||||||
|
|
||||||
s32 iSBPos; // mixing stuff
|
s32 iSBPos; // mixing stuff
|
||||||
s32 spos;
|
s32 spos;
|
||||||
s32 sinc;
|
s32 sinc;
|
||||||
|
|
||||||
s32 iActFreq; // current psx pitch
|
s32 iActFreq; // current psx pitch
|
||||||
s32 iUsedFreq; // current pc pitch
|
s32 iUsedFreq; // current pc pitch
|
||||||
|
|
||||||
s32 iStartAddr, iLoopAddr, iNextAddr;
|
s32 iStartAddr, iLoopAddr, iNextAddr;
|
||||||
|
|
||||||
ADSRInfoEx ADSRX; // next ADSR settings (will be moved to active on sample start)
|
ADSRInfoEx ADSRX; // next ADSR settings (will be moved to active on sample start)
|
||||||
bool bIgnoreLoop, bNew, bNoise, bReverb, bOn, bStop, bVolChanged;
|
bool bIgnoreLoop, bNew, bNoise, bReverb, bOn, bStop, bVolChanged;
|
||||||
s32 memoffset; // if first core, 0, if second, 0x400
|
s32 memoffset; // if first core, 0, if second, 0x400
|
||||||
|
|
||||||
// end save state
|
// end save state
|
||||||
|
|
||||||
///////////////////
|
///////////////////
|
||||||
// Sound Buffers //
|
// Sound Buffers //
|
||||||
///////////////////
|
///////////////////
|
||||||
u8* pStart; // start and end addresses
|
u8* pStart; // start and end addresses
|
||||||
u8* pLoop, *pCurr;
|
u8 *pLoop, *pCurr;
|
||||||
|
|
||||||
_SPU_VOICE* pvoice;
|
_SPU_VOICE* pvoice;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ADMA
|
struct ADMA
|
||||||
{
|
{
|
||||||
u16 * MemAddr;
|
u16* MemAddr;
|
||||||
s32 IntPointer;
|
s32 IntPointer;
|
||||||
s32 Index;
|
s32 Index;
|
||||||
s32 AmountLeft;
|
s32 AmountLeft;
|
||||||
s32 Enabled;
|
s32 Enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __SPU2_H__ */
|
#endif /* __SPU2_H__ */
|
||||||
|
|
|
@ -21,46 +21,45 @@ extern HINSTANCE hInst;
|
||||||
void SaveConfig()
|
void SaveConfig()
|
||||||
{
|
{
|
||||||
|
|
||||||
Config *Conf1 = &conf;
|
Config* Conf1 = &conf;
|
||||||
char *szTemp;
|
char* szTemp;
|
||||||
char szIniFile[256], szValue[256];
|
char szIniFile[256], szValue[256];
|
||||||
|
|
||||||
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
||||||
szTemp = strrchr(szIniFile, '\\');
|
szTemp = strrchr(szIniFile, '\\');
|
||||||
|
|
||||||
if(!szTemp) return;
|
|
||||||
strcpy(szTemp, "\\inis\\spu2null.ini");
|
|
||||||
sprintf(szValue,"%u",Conf1->Log);
|
|
||||||
WritePrivateProfileString("Interface", "Logging",szValue,szIniFile);
|
|
||||||
|
|
||||||
|
if (!szTemp)
|
||||||
|
return;
|
||||||
|
strcpy(szTemp, "\\inis\\spu2null.ini");
|
||||||
|
sprintf(szValue, "%u", Conf1->Log);
|
||||||
|
WritePrivateProfileString("Interface", "Logging", szValue, szIniFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadConfig() {
|
void LoadConfig()
|
||||||
FILE *fp;
|
{
|
||||||
|
FILE* fp;
|
||||||
|
|
||||||
|
|
||||||
Config *Conf1 = &conf;
|
Config* Conf1 = &conf;
|
||||||
char *szTemp;
|
char* szTemp;
|
||||||
char szIniFile[256], szValue[256];
|
char szIniFile[256], szValue[256];
|
||||||
|
|
||||||
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
||||||
szTemp = strrchr(szIniFile, '\\');
|
szTemp = strrchr(szIniFile, '\\');
|
||||||
|
|
||||||
if(!szTemp) return ;
|
if (!szTemp)
|
||||||
strcpy(szTemp, "\\inis\\spu2null.ini");
|
return;
|
||||||
fp=fopen("inis\\usbnull.ini","rt");//check if usbnull.ini really exists
|
strcpy(szTemp, "\\inis\\spu2null.ini");
|
||||||
if (!fp)
|
fp = fopen("inis\\usbnull.ini", "rt"); //check if usbnull.ini really exists
|
||||||
{
|
if (!fp) {
|
||||||
CreateDirectory("inis",NULL);
|
CreateDirectory("inis", NULL);
|
||||||
memset(&conf, 0, sizeof(conf));
|
memset(&conf, 0, sizeof(conf));
|
||||||
conf.Log = 0;//default value
|
conf.Log = 0; //default value
|
||||||
SaveConfig();//save and return
|
SaveConfig(); //save and return
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
GetPrivateProfileString("Interface", "Logging", NULL, szValue, 20, szIniFile);
|
GetPrivateProfileString("Interface", "Logging", NULL, szValue, 20, szIniFile);
|
||||||
Conf1->Log = strtoul(szValue, NULL, 10);
|
Conf1->Log = strtoul(szValue, NULL, 10);
|
||||||
return ;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,75 +22,81 @@
|
||||||
|
|
||||||
HINSTANCE hInst;
|
HINSTANCE hInst;
|
||||||
|
|
||||||
void SysMessage(char *fmt, ...) {
|
void SysMessage(char* fmt, ...)
|
||||||
va_list list;
|
{
|
||||||
char tmp[512];
|
va_list list;
|
||||||
|
char tmp[512];
|
||||||
|
|
||||||
va_start(list,fmt);
|
va_start(list, fmt);
|
||||||
vsprintf(tmp,fmt,list);
|
vsprintf(tmp, fmt, list);
|
||||||
va_end(list);
|
va_end(list);
|
||||||
MessageBox(0, tmp, "SPU2NULL Msg", 0);
|
MessageBox(0, tmp, "SPU2NULL Msg", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
|
||||||
switch(uMsg) {
|
switch (uMsg) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
if (conf.Log) CheckDlgButton(hW, IDC_LOGGING, TRUE);
|
if (conf.Log)
|
||||||
return TRUE;
|
CheckDlgButton(hW, IDC_LOGGING, TRUE);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch(LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
EndDialog(hW, TRUE);
|
EndDialog(hW, TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case IDOK:
|
case IDOK:
|
||||||
if (IsDlgButtonChecked(hW, IDC_LOGGING))
|
if (IsDlgButtonChecked(hW, IDC_LOGGING))
|
||||||
conf.Log = 1;
|
conf.Log = 1;
|
||||||
else conf.Log = 0;
|
else
|
||||||
SaveConfig();
|
conf.Log = 0;
|
||||||
EndDialog(hW, FALSE);
|
SaveConfig();
|
||||||
return TRUE;
|
EndDialog(hW, FALSE);
|
||||||
}
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
}
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
switch(uMsg) {
|
{
|
||||||
case WM_INITDIALOG:
|
switch (uMsg) {
|
||||||
return TRUE;
|
case WM_INITDIALOG:
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch(LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
case IDOK:
|
case IDOK:
|
||||||
EndDialog(hW, FALSE);
|
EndDialog(hW, FALSE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CALLBACK SPU2configure() {
|
void CALLBACK SPU2configure()
|
||||||
|
{
|
||||||
DialogBox(hInst,
|
DialogBox(hInst,
|
||||||
MAKEINTRESOURCE(IDD_CONFIG),
|
MAKEINTRESOURCE(IDD_CONFIG),
|
||||||
GetActiveWindow(),
|
GetActiveWindow(),
|
||||||
(DLGPROC)ConfigureDlgProc);
|
(DLGPROC)ConfigureDlgProc);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CALLBACK SPU2about() {
|
void CALLBACK SPU2about()
|
||||||
|
{
|
||||||
DialogBox(hInst,
|
DialogBox(hInst,
|
||||||
MAKEINTRESOURCE(IDD_ABOUT),
|
MAKEINTRESOURCE(IDD_ABOUT),
|
||||||
GetActiveWindow(),
|
GetActiveWindow(),
|
||||||
(DLGPROC)AboutDlgProc);
|
(DLGPROC)AboutDlgProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
||||||
DWORD dwReason,
|
DWORD dwReason,
|
||||||
LPVOID lpReserved) {
|
LPVOID lpReserved)
|
||||||
hInst = (HINSTANCE)hModule;
|
{
|
||||||
return TRUE; // very quick :)
|
hInst = (HINSTANCE)hModule;
|
||||||
|
return TRUE; // very quick :)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,55 +25,51 @@ PluginConf Ini;
|
||||||
|
|
||||||
void setLoggingState()
|
void setLoggingState()
|
||||||
{
|
{
|
||||||
if (conf.Log)
|
if (conf.Log) {
|
||||||
{
|
USBLog.WriteToConsole = true;
|
||||||
USBLog.WriteToConsole = true;
|
USBLog.WriteToFile = true;
|
||||||
USBLog.WriteToFile = true;
|
} else {
|
||||||
}
|
USBLog.WriteToConsole = false;
|
||||||
else
|
USBLog.WriteToFile = false;
|
||||||
{
|
}
|
||||||
USBLog.WriteToConsole = false;
|
|
||||||
USBLog.WriteToFile = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) USBabout()
|
EXPORT_C_(void)
|
||||||
|
USBabout()
|
||||||
{
|
{
|
||||||
SysMessage("USBnull: A simple null plugin.");
|
SysMessage("USBnull: A simple null plugin.");
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) USBconfigure()
|
EXPORT_C_(void)
|
||||||
|
USBconfigure()
|
||||||
{
|
{
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadConfig()
|
void LoadConfig()
|
||||||
{
|
{
|
||||||
string IniPath = s_strIniPath + "/USBnull.ini";
|
string IniPath = s_strIniPath + "/USBnull.ini";
|
||||||
if (!Ini.Open(IniPath, READ_FILE))
|
if (!Ini.Open(IniPath, READ_FILE)) {
|
||||||
{
|
USBLog.WriteLn("Failed to open %s", IniPath.c_str());
|
||||||
USBLog.WriteLn("Failed to open %s", IniPath.c_str());
|
SaveConfig();
|
||||||
SaveConfig();
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
conf.Log = Ini.ReadInt("logging", 0);
|
conf.Log = Ini.ReadInt("logging", 0);
|
||||||
setLoggingState();
|
setLoggingState();
|
||||||
Ini.Close();
|
Ini.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveConfig()
|
void SaveConfig()
|
||||||
{
|
{
|
||||||
string IniPath = s_strIniPath + "/USBnull.ini";
|
string IniPath = s_strIniPath + "/USBnull.ini";
|
||||||
if (!Ini.Open(IniPath, WRITE_FILE))
|
if (!Ini.Open(IniPath, WRITE_FILE)) {
|
||||||
{
|
USBLog.WriteLn("Failed to open %s", IniPath.c_str());
|
||||||
USBLog.WriteLn("Failed to open %s", IniPath.c_str());
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Ini.WriteInt("logging", conf.Log);
|
Ini.WriteInt("logging", conf.Log);
|
||||||
Ini.Close();
|
Ini.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,12 +18,12 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#include "svnrev.h"
|
#include "svnrev.h"
|
||||||
#include "USB.h"
|
#include "USB.h"
|
||||||
string s_strIniPath="inis";
|
string s_strIniPath = "inis";
|
||||||
string s_strLogPath="logs";
|
string s_strLogPath = "logs";
|
||||||
|
|
||||||
const unsigned char version = PS2E_USB_VERSION;
|
const unsigned char version = PS2E_USB_VERSION;
|
||||||
const unsigned char revision = 0;
|
const unsigned char revision = 0;
|
||||||
const unsigned char build = 7; // increase that with each version
|
const unsigned char build = 7; // increase that with each version
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define snprintf sprintf_s
|
#define snprintf sprintf_s
|
||||||
|
@ -38,233 +38,245 @@ s8 *usbregs, *ram;
|
||||||
|
|
||||||
void LogInit()
|
void LogInit()
|
||||||
{
|
{
|
||||||
const std::string LogFile(s_strLogPath + "/USBnull.log");
|
const std::string LogFile(s_strLogPath + "/USBnull.log");
|
||||||
setLoggingState();
|
setLoggingState();
|
||||||
USBLog.Open(LogFile);
|
USBLog.Open(LogFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) USBsetLogDir(const char* dir)
|
EXPORT_C_(void)
|
||||||
|
USBsetLogDir(const char* dir)
|
||||||
{
|
{
|
||||||
// Get the path to the log directory.
|
// Get the path to the log directory.
|
||||||
s_strLogPath = (dir==NULL) ? "logs" : dir;
|
s_strLogPath = (dir == NULL) ? "logs" : dir;
|
||||||
|
|
||||||
// Reload the log file after updated the path
|
// Reload the log file after updated the path
|
||||||
USBLog.Close();
|
USBLog.Close();
|
||||||
LogInit();
|
LogInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(u32) PS2EgetLibType()
|
EXPORT_C_(u32)
|
||||||
|
PS2EgetLibType()
|
||||||
{
|
{
|
||||||
return PS2E_LT_USB;
|
return PS2E_LT_USB;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(char*) PS2EgetLibName()
|
EXPORT_C_(char*)
|
||||||
|
PS2EgetLibName()
|
||||||
{
|
{
|
||||||
snprintf( libraryName, 255, "USBnull Driver %lld%s",SVN_REV, SVN_MODS ? "m" : "");
|
snprintf(libraryName, 255, "USBnull Driver %lld%s", SVN_REV, SVN_MODS ? "m" : "");
|
||||||
return libraryName;
|
return libraryName;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(u32) PS2EgetLibVersion2(u32 type)
|
EXPORT_C_(u32)
|
||||||
|
PS2EgetLibVersion2(u32 type)
|
||||||
{
|
{
|
||||||
return (version << 16) | (revision << 8) | build;
|
return (version << 16) | (revision << 8) | build;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) USBinit()
|
EXPORT_C_(s32)
|
||||||
|
USBinit()
|
||||||
{
|
{
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
LogInit();
|
LogInit();
|
||||||
USBLog.WriteLn("USBnull plugin version %d,%d", revision, build);
|
USBLog.WriteLn("USBnull plugin version %d,%d", revision, build);
|
||||||
USBLog.WriteLn("Initializing USBnull");
|
USBLog.WriteLn("Initializing USBnull");
|
||||||
|
|
||||||
// Initialize memory structures here.
|
// Initialize memory structures here.
|
||||||
usbregs = (s8*)calloc(0x10000, 1);
|
usbregs = (s8*)calloc(0x10000, 1);
|
||||||
|
|
||||||
if (usbregs == NULL)
|
if (usbregs == NULL) {
|
||||||
{
|
USBLog.Message("Error allocating memory");
|
||||||
USBLog.Message("Error allocating memory");
|
return -1;
|
||||||
return -1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) USBshutdown()
|
EXPORT_C_(void)
|
||||||
|
USBshutdown()
|
||||||
{
|
{
|
||||||
// Yes, we close things in the Shutdown routine, and
|
// Yes, we close things in the Shutdown routine, and
|
||||||
// don't do anything in the close routine.
|
// don't do anything in the close routine.
|
||||||
USBLog.Close();
|
USBLog.Close();
|
||||||
|
|
||||||
free(usbregs);
|
free(usbregs);
|
||||||
usbregs = NULL;
|
usbregs = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) USBopen(void *pDsp)
|
EXPORT_C_(s32)
|
||||||
|
USBopen(void* pDsp)
|
||||||
{
|
{
|
||||||
USBLog.WriteLn("Opening USBnull.");
|
USBLog.WriteLn("Opening USBnull.");
|
||||||
|
|
||||||
// Take care of anything else we need on opening, other then initialization.
|
// Take care of anything else we need on opening, other then initialization.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) USBclose()
|
EXPORT_C_(void)
|
||||||
|
USBclose()
|
||||||
{
|
{
|
||||||
USBLog.WriteLn("Closing USBnull.");
|
USBLog.WriteLn("Closing USBnull.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: actually uncommenting the read/write functions I provided here
|
// Note: actually uncommenting the read/write functions I provided here
|
||||||
// caused uLauncher.elf to hang on startup, so careful when experimenting.
|
// caused uLauncher.elf to hang on startup, so careful when experimenting.
|
||||||
EXPORT_C_(u8) USBread8(u32 addr)
|
EXPORT_C_(u8)
|
||||||
|
USBread8(u32 addr)
|
||||||
{
|
{
|
||||||
u8 value = 0;
|
u8 value = 0;
|
||||||
|
|
||||||
switch(addr)
|
switch (addr) {
|
||||||
{
|
// Handle any appropriate addresses here.
|
||||||
// Handle any appropriate addresses here.
|
case 0x1f801600:
|
||||||
case 0x1f801600:
|
USBLog.WriteLn("(USBnull) 8 bit read at address %lx", addr);
|
||||||
USBLog.WriteLn("(USBnull) 8 bit read at address %lx", addr);
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
//value = usbRu8(addr);
|
//value = usbRu8(addr);
|
||||||
USBLog.WriteLn("*(USBnull) 8 bit read at address %lx", addr);
|
USBLog.WriteLn("*(USBnull) 8 bit read at address %lx", addr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(u16) USBread16(u32 addr)
|
EXPORT_C_(u16)
|
||||||
|
USBread16(u32 addr)
|
||||||
{
|
{
|
||||||
u16 value = 0;
|
u16 value = 0;
|
||||||
|
|
||||||
switch(addr)
|
switch (addr) {
|
||||||
{
|
// Handle any appropriate addresses here.
|
||||||
// Handle any appropriate addresses here.
|
case 0x1f801600:
|
||||||
case 0x1f801600:
|
USBLog.WriteLn("(USBnull) 16 bit read at address %lx", addr);
|
||||||
USBLog.WriteLn("(USBnull) 16 bit read at address %lx", addr);
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
//value = usbRu16(addr);
|
//value = usbRu16(addr);
|
||||||
USBLog.WriteLn("(USBnull) 16 bit read at address %lx", addr);
|
USBLog.WriteLn("(USBnull) 16 bit read at address %lx", addr);
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(u32) USBread32(u32 addr)
|
EXPORT_C_(u32)
|
||||||
|
USBread32(u32 addr)
|
||||||
{
|
{
|
||||||
u32 value = 0;
|
u32 value = 0;
|
||||||
|
|
||||||
switch(addr)
|
switch (addr) {
|
||||||
{
|
// Handle any appropriate addresses here.
|
||||||
// Handle any appropriate addresses here.
|
case 0x1f801600:
|
||||||
case 0x1f801600:
|
USBLog.WriteLn("(USBnull) 32 bit read at address %lx", addr);
|
||||||
USBLog.WriteLn("(USBnull) 32 bit read at address %lx", addr);
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
//value = usbRu32(addr);
|
//value = usbRu32(addr);
|
||||||
USBLog.WriteLn("(USBnull) 32 bit read at address %lx", addr);
|
USBLog.WriteLn("(USBnull) 32 bit read at address %lx", addr);
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) USBwrite8(u32 addr, u8 value)
|
EXPORT_C_(void)
|
||||||
|
USBwrite8(u32 addr, u8 value)
|
||||||
{
|
{
|
||||||
switch(addr)
|
switch (addr) {
|
||||||
{
|
// Handle any appropriate addresses here.
|
||||||
// Handle any appropriate addresses here.
|
case 0x1f801600:
|
||||||
case 0x1f801600:
|
USBLog.WriteLn("(USBnull) 8 bit write at address %lx value %x", addr, value);
|
||||||
USBLog.WriteLn("(USBnull) 8 bit write at address %lx value %x", addr, value);
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
//usbRu8(addr) = value;
|
//usbRu8(addr) = value;
|
||||||
USBLog.WriteLn("(USBnull) 8 bit write at address %lx value %x", addr, value);
|
USBLog.WriteLn("(USBnull) 8 bit write at address %lx value %x", addr, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) USBwrite16(u32 addr, u16 value)
|
EXPORT_C_(void)
|
||||||
|
USBwrite16(u32 addr, u16 value)
|
||||||
{
|
{
|
||||||
switch(addr)
|
switch (addr) {
|
||||||
{
|
// Handle any appropriate addresses here.
|
||||||
// Handle any appropriate addresses here.
|
case 0x1f801600:
|
||||||
case 0x1f801600:
|
USBLog.WriteLn("(USBnull) 16 bit write at address %lx value %x", addr, value);
|
||||||
USBLog.WriteLn("(USBnull) 16 bit write at address %lx value %x", addr, value);
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
//usbRu16(addr) = value;
|
//usbRu16(addr) = value;
|
||||||
USBLog.WriteLn("(USBnull) 16 bit write at address %lx value %x", addr, value);
|
USBLog.WriteLn("(USBnull) 16 bit write at address %lx value %x", addr, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) USBwrite32(u32 addr, u32 value)
|
EXPORT_C_(void)
|
||||||
|
USBwrite32(u32 addr, u32 value)
|
||||||
{
|
{
|
||||||
switch(addr)
|
switch (addr) {
|
||||||
{
|
// Handle any appropriate addresses here.
|
||||||
// Handle any appropriate addresses here.
|
case 0x1f801600:
|
||||||
case 0x1f801600:
|
USBLog.WriteLn("(USBnull) 16 bit write at address %lx value %x", addr, value);
|
||||||
USBLog.WriteLn("(USBnull) 16 bit write at address %lx value %x", addr, value);
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
//usbRu32(addr) = value;
|
//usbRu32(addr) = value;
|
||||||
USBLog.WriteLn("(USBnull) 32 bit write at address %lx value %x", addr, value);
|
USBLog.WriteLn("(USBnull) 32 bit write at address %lx value %x", addr, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) USBirqCallback(USBcallback callback)
|
EXPORT_C_(void)
|
||||||
|
USBirqCallback(USBcallback callback)
|
||||||
{
|
{
|
||||||
// Register USBirq, so we can trigger an interrupt with it later.
|
// Register USBirq, so we can trigger an interrupt with it later.
|
||||||
// It will be called as USBirq(cycles); where cycles is the number
|
// It will be called as USBirq(cycles); where cycles is the number
|
||||||
// of cycles before the irq is triggered.
|
// of cycles before the irq is triggered.
|
||||||
USBirq = callback;
|
USBirq = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(int) _USBirqHandler(void)
|
EXPORT_C_(int)
|
||||||
|
_USBirqHandler(void)
|
||||||
{
|
{
|
||||||
// This is our USB irq handler, so if an interrupt gets triggered,
|
// This is our USB irq handler, so if an interrupt gets triggered,
|
||||||
// deal with it here.
|
// deal with it here.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(USBhandler) USBirqHandler(void)
|
EXPORT_C_(USBhandler)
|
||||||
|
USBirqHandler(void)
|
||||||
{
|
{
|
||||||
// Pass our handler to pcsx2.
|
// Pass our handler to pcsx2.
|
||||||
return (USBhandler)_USBirqHandler;
|
return (USBhandler)_USBirqHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) USBsetRAM(void *mem)
|
EXPORT_C_(void)
|
||||||
|
USBsetRAM(void* mem)
|
||||||
{
|
{
|
||||||
ram = (s8*)mem;
|
ram = (s8*)mem;
|
||||||
USBLog.WriteLn("*Setting ram.");
|
USBLog.WriteLn("*Setting ram.");
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) USBsetSettingsDir(const char* dir)
|
EXPORT_C_(void)
|
||||||
|
USBsetSettingsDir(const char* dir)
|
||||||
{
|
{
|
||||||
// Get the path to the ini directory.
|
// Get the path to the ini directory.
|
||||||
s_strIniPath = (dir==NULL) ? "inis" : dir;
|
s_strIniPath = (dir == NULL) ? "inis" : dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
// extended funcs
|
// extended funcs
|
||||||
|
|
||||||
EXPORT_C_(s32) USBfreeze(int mode, freezeData *data)
|
EXPORT_C_(s32)
|
||||||
|
USBfreeze(int mode, freezeData* data)
|
||||||
{
|
{
|
||||||
// This should store or retrieve any information, for if emulation
|
// This should store or retrieve any information, for if emulation
|
||||||
// gets suspended, or for savestates.
|
// gets suspended, or for savestates.
|
||||||
switch(mode)
|
switch (mode) {
|
||||||
{
|
case FREEZE_LOAD:
|
||||||
case FREEZE_LOAD:
|
// Load previously saved data.
|
||||||
// Load previously saved data.
|
break;
|
||||||
break;
|
case FREEZE_SAVE:
|
||||||
case FREEZE_SAVE:
|
// Save data.
|
||||||
// Save data.
|
break;
|
||||||
break;
|
case FREEZE_SIZE:
|
||||||
case FREEZE_SIZE:
|
// return the size of the data.
|
||||||
// return the size of the data.
|
break;
|
||||||
break;
|
}
|
||||||
}
|
return 0;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*EXPORT_C_(void) USBasync(u32 cycles)
|
/*EXPORT_C_(void) USBasync(u32 cycles)
|
||||||
|
@ -272,10 +284,11 @@ EXPORT_C_(s32) USBfreeze(int mode, freezeData *data)
|
||||||
// Optional function: Called in IopCounter.cpp.
|
// Optional function: Called in IopCounter.cpp.
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
EXPORT_C_(s32) USBtest()
|
EXPORT_C_(s32)
|
||||||
|
USBtest()
|
||||||
{
|
{
|
||||||
// 0 if the plugin works, non-0 if it doesn't.
|
// 0 if the plugin works, non-0 if it doesn't.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For operating systems that need an entry point for a dll/library, here it is. Defined in PS2Eext.h. */
|
/* For operating systems that need an entry point for a dll/library, here it is. Defined in PS2Eext.h. */
|
||||||
|
|
|
@ -22,24 +22,25 @@
|
||||||
#include "PS2Edefs.h"
|
#include "PS2Edefs.h"
|
||||||
#include "PS2Eext.h"
|
#include "PS2Eext.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
int Log;
|
{
|
||||||
|
int Log;
|
||||||
} Config;
|
} Config;
|
||||||
|
|
||||||
extern USBcallback USBirq;
|
extern USBcallback USBirq;
|
||||||
extern Config conf;
|
extern Config conf;
|
||||||
|
|
||||||
// Previous USB plugins have needed this in ohci.
|
// Previous USB plugins have needed this in ohci.
|
||||||
static const s64 PSXCLK = 36864000; /* 36.864 Mhz */
|
static const s64 PSXCLK = 36864000; /* 36.864 Mhz */
|
||||||
|
|
||||||
extern s8 *usbregs, *ram;
|
extern s8 *usbregs, *ram;
|
||||||
|
|
||||||
#define usbRs8(mem) usbregs[(mem) & 0xffff]
|
#define usbRs8(mem) usbregs[(mem)&0xffff]
|
||||||
#define usbRs16(mem) (*(s16*)&usbregs[(mem) & 0xffff])
|
#define usbRs16(mem) (*(s16*)&usbregs[(mem)&0xffff])
|
||||||
#define usbRs32(mem) (*(s32*)&usbregs[(mem) & 0xffff])
|
#define usbRs32(mem) (*(s32*)&usbregs[(mem)&0xffff])
|
||||||
#define usbRu8(mem) (*(u8*) &usbregs[(mem) & 0xffff])
|
#define usbRu8(mem) (*(u8*)&usbregs[(mem)&0xffff])
|
||||||
#define usbRu16(mem) (*(u16*)&usbregs[(mem) & 0xffff])
|
#define usbRu16(mem) (*(u16*)&usbregs[(mem)&0xffff])
|
||||||
#define usbRu32(mem) (*(u32*)&usbregs[(mem) & 0xffff])
|
#define usbRu32(mem) (*(u32*)&usbregs[(mem)&0xffff])
|
||||||
|
|
||||||
extern void SaveConfig();
|
extern void SaveConfig();
|
||||||
extern void LoadConfig();
|
extern void LoadConfig();
|
||||||
|
|
|
@ -21,46 +21,45 @@ extern HINSTANCE hInst;
|
||||||
void SaveConfig()
|
void SaveConfig()
|
||||||
{
|
{
|
||||||
|
|
||||||
Config *Conf1 = &conf;
|
Config* Conf1 = &conf;
|
||||||
char *szTemp;
|
char* szTemp;
|
||||||
char szIniFile[256], szValue[256];
|
char szIniFile[256], szValue[256];
|
||||||
|
|
||||||
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
||||||
szTemp = strrchr(szIniFile, '\\');
|
szTemp = strrchr(szIniFile, '\\');
|
||||||
|
|
||||||
if(!szTemp) return;
|
|
||||||
strcpy(szTemp, "\\inis\\usbnull.ini");
|
|
||||||
sprintf(szValue,"%u",Conf1->Log);
|
|
||||||
WritePrivateProfileString("Interface", "Logging",szValue,szIniFile);
|
|
||||||
|
|
||||||
|
if (!szTemp)
|
||||||
|
return;
|
||||||
|
strcpy(szTemp, "\\inis\\usbnull.ini");
|
||||||
|
sprintf(szValue, "%u", Conf1->Log);
|
||||||
|
WritePrivateProfileString("Interface", "Logging", szValue, szIniFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadConfig() {
|
void LoadConfig()
|
||||||
FILE *fp;
|
{
|
||||||
|
FILE* fp;
|
||||||
|
|
||||||
|
|
||||||
Config *Conf1 = &conf;
|
Config* Conf1 = &conf;
|
||||||
char *szTemp;
|
char* szTemp;
|
||||||
char szIniFile[256], szValue[256];
|
char szIniFile[256], szValue[256];
|
||||||
|
|
||||||
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
||||||
szTemp = strrchr(szIniFile, '\\');
|
szTemp = strrchr(szIniFile, '\\');
|
||||||
|
|
||||||
if(!szTemp) return ;
|
if (!szTemp)
|
||||||
strcpy(szTemp, "\\inis\\usbnull.ini");
|
return;
|
||||||
fp=fopen("inis\\usbnull.ini","rt");//check if usbnull.ini really exists
|
strcpy(szTemp, "\\inis\\usbnull.ini");
|
||||||
if (!fp)
|
fp = fopen("inis\\usbnull.ini", "rt"); //check if usbnull.ini really exists
|
||||||
{
|
if (!fp) {
|
||||||
CreateDirectory("inis",NULL);
|
CreateDirectory("inis", NULL);
|
||||||
memset(&conf, 0, sizeof(conf));
|
memset(&conf, 0, sizeof(conf));
|
||||||
conf.Log = 0;//default value
|
conf.Log = 0; //default value
|
||||||
SaveConfig();//save and return
|
SaveConfig(); //save and return
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
GetPrivateProfileString("Interface", "Logging", NULL, szValue, 20, szIniFile);
|
GetPrivateProfileString("Interface", "Logging", NULL, szValue, 20, szIniFile);
|
||||||
Conf1->Log = strtoul(szValue, NULL, 10);
|
Conf1->Log = strtoul(szValue, NULL, 10);
|
||||||
return ;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,75 +22,81 @@
|
||||||
|
|
||||||
HINSTANCE hInst;
|
HINSTANCE hInst;
|
||||||
|
|
||||||
void SysMessage(char *fmt, ...) {
|
void SysMessage(char* fmt, ...)
|
||||||
va_list list;
|
{
|
||||||
char tmp[512];
|
va_list list;
|
||||||
|
char tmp[512];
|
||||||
|
|
||||||
va_start(list,fmt);
|
va_start(list, fmt);
|
||||||
vsprintf(tmp,fmt,list);
|
vsprintf(tmp, fmt, list);
|
||||||
va_end(list);
|
va_end(list);
|
||||||
MessageBox(GetActiveWindow(), tmp, "USBnull Msg", MB_SETFOREGROUND | MB_OK);
|
MessageBox(GetActiveWindow(), tmp, "USBnull Msg", MB_SETFOREGROUND | MB_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
|
||||||
switch(uMsg) {
|
switch (uMsg) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
if (conf.Log) CheckDlgButton(hW, IDC_LOGGING, TRUE);
|
if (conf.Log)
|
||||||
return TRUE;
|
CheckDlgButton(hW, IDC_LOGGING, TRUE);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch(LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
EndDialog(hW, TRUE);
|
EndDialog(hW, TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case IDOK:
|
case IDOK:
|
||||||
if (IsDlgButtonChecked(hW, IDC_LOGGING))
|
if (IsDlgButtonChecked(hW, IDC_LOGGING))
|
||||||
conf.Log = 1;
|
conf.Log = 1;
|
||||||
else conf.Log = 0;
|
else
|
||||||
SaveConfig();
|
conf.Log = 0;
|
||||||
EndDialog(hW, FALSE);
|
SaveConfig();
|
||||||
return TRUE;
|
EndDialog(hW, FALSE);
|
||||||
}
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
}
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
switch(uMsg) {
|
{
|
||||||
case WM_INITDIALOG:
|
switch (uMsg) {
|
||||||
return TRUE;
|
case WM_INITDIALOG:
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch(LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
case IDOK:
|
case IDOK:
|
||||||
EndDialog(hW, FALSE);
|
EndDialog(hW, FALSE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CALLBACK USBconfigure() {
|
void CALLBACK USBconfigure()
|
||||||
|
{
|
||||||
DialogBox(hInst,
|
DialogBox(hInst,
|
||||||
MAKEINTRESOURCE(IDD_CONFIG),
|
MAKEINTRESOURCE(IDD_CONFIG),
|
||||||
GetActiveWindow(),
|
GetActiveWindow(),
|
||||||
(DLGPROC)ConfigureDlgProc);
|
(DLGPROC)ConfigureDlgProc);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CALLBACK USBabout() {
|
void CALLBACK USBabout()
|
||||||
|
{
|
||||||
DialogBox(hInst,
|
DialogBox(hInst,
|
||||||
MAKEINTRESOURCE(IDD_ABOUT),
|
MAKEINTRESOURCE(IDD_ABOUT),
|
||||||
GetActiveWindow(),
|
GetActiveWindow(),
|
||||||
(DLGPROC)AboutDlgProc);
|
(DLGPROC)AboutDlgProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
||||||
DWORD dwReason,
|
DWORD dwReason,
|
||||||
LPVOID lpReserved) {
|
LPVOID lpReserved)
|
||||||
hInst = (HINSTANCE)hModule;
|
{
|
||||||
return TRUE; // very quick :)
|
hInst = (HINSTANCE)hModule;
|
||||||
|
return TRUE; // very quick :)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,54 +28,50 @@ PluginConf Ini;
|
||||||
|
|
||||||
void setLoggingState()
|
void setLoggingState()
|
||||||
{
|
{
|
||||||
if (conf.Log)
|
if (conf.Log) {
|
||||||
{
|
Dev9Log.WriteToConsole = true;
|
||||||
Dev9Log.WriteToConsole = true;
|
Dev9Log.WriteToFile = true;
|
||||||
Dev9Log.WriteToFile = true;
|
} else {
|
||||||
}
|
Dev9Log.WriteToConsole = false;
|
||||||
else
|
Dev9Log.WriteToFile = false;
|
||||||
{
|
}
|
||||||
Dev9Log.WriteToConsole = false;
|
|
||||||
Dev9Log.WriteToFile = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) DEV9about()
|
EXPORT_C_(void)
|
||||||
|
DEV9about()
|
||||||
{
|
{
|
||||||
SysMessage("Dev9null: A simple null plugin.");
|
SysMessage("Dev9null: A simple null plugin.");
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) DEV9configure()
|
EXPORT_C_(void)
|
||||||
|
DEV9configure()
|
||||||
{
|
{
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadConfig()
|
void LoadConfig()
|
||||||
{
|
{
|
||||||
string IniPath = s_strIniPath + "/Dev9null.ini";
|
string IniPath = s_strIniPath + "/Dev9null.ini";
|
||||||
if (!Ini.Open(IniPath, READ_FILE))
|
if (!Ini.Open(IniPath, READ_FILE)) {
|
||||||
{
|
Dev9Log.WriteLn("Failed to open %s", IniPath.c_str());
|
||||||
Dev9Log.WriteLn("Failed to open %s", IniPath.c_str());
|
SaveConfig();
|
||||||
SaveConfig();
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
conf.Log = Ini.ReadInt("logging",0);
|
conf.Log = Ini.ReadInt("logging", 0);
|
||||||
Ini.Close();
|
Ini.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveConfig()
|
void SaveConfig()
|
||||||
{
|
{
|
||||||
string IniPath = s_strIniPath + "/Dev9null.ini";
|
string IniPath = s_strIniPath + "/Dev9null.ini";
|
||||||
if (!Ini.Open(IniPath, WRITE_FILE))
|
if (!Ini.Open(IniPath, WRITE_FILE)) {
|
||||||
{
|
Dev9Log.WriteLn("Failed to open %s", IniPath.c_str());
|
||||||
Dev9Log.WriteLn("Failed to open %s", IniPath.c_str());
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Ini.WriteInt("logging", conf.Log);
|
Ini.WriteInt("logging", conf.Log);
|
||||||
Ini.Close();
|
Ini.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
void SaveConfig();
|
void SaveConfig();
|
||||||
void LoadConfig();
|
void LoadConfig();
|
||||||
void SysMessage(char *fmt, ...);
|
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 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)
|
//#define set_checked(main_widget,widget_name, state) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)), state)
|
||||||
|
|
|
@ -33,9 +33,9 @@ using namespace std;
|
||||||
#include "DEV9.h"
|
#include "DEV9.h"
|
||||||
#include "svnrev.h"
|
#include "svnrev.h"
|
||||||
|
|
||||||
const unsigned char version = PS2E_DEV9_VERSION;
|
const unsigned char version = PS2E_DEV9_VERSION;
|
||||||
const unsigned char revision = 0;
|
const unsigned char revision = 0;
|
||||||
const unsigned char build = 5; // increase that with each version
|
const unsigned char build = 5; // increase that with each version
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define snprintf sprintf_s
|
#define snprintf sprintf_s
|
||||||
|
@ -48,265 +48,288 @@ void (*DEV9irq)(int);
|
||||||
__aligned16 s8 dev9regs[0x10000];
|
__aligned16 s8 dev9regs[0x10000];
|
||||||
|
|
||||||
string s_strIniPath = "inis";
|
string s_strIniPath = "inis";
|
||||||
string s_strLogPath="logs";
|
string s_strLogPath = "logs";
|
||||||
|
|
||||||
PluginLog Dev9Log;
|
PluginLog Dev9Log;
|
||||||
Config conf;
|
Config conf;
|
||||||
|
|
||||||
void LogInit()
|
void LogInit()
|
||||||
{
|
{
|
||||||
const std::string LogFile(s_strLogPath + "/dev9null.log");
|
const std::string LogFile(s_strLogPath + "/dev9null.log");
|
||||||
setLoggingState();
|
setLoggingState();
|
||||||
Dev9Log.Open(LogFile);
|
Dev9Log.Open(LogFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) DEV9setLogDir(const char* dir)
|
EXPORT_C_(void)
|
||||||
|
DEV9setLogDir(const char* dir)
|
||||||
{
|
{
|
||||||
// Get the path to the log directory.
|
// Get the path to the log directory.
|
||||||
s_strLogPath = (dir==NULL) ? "logs" : dir;
|
s_strLogPath = (dir == NULL) ? "logs" : dir;
|
||||||
|
|
||||||
// Reload the log file after updated the path
|
// Reload the log file after updated the path
|
||||||
Dev9Log.Close();
|
Dev9Log.Close();
|
||||||
LogInit();
|
LogInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(u32) PS2EgetLibType()
|
EXPORT_C_(u32)
|
||||||
|
PS2EgetLibType()
|
||||||
{
|
{
|
||||||
return PS2E_LT_DEV9;
|
return PS2E_LT_DEV9;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(char*) PS2EgetLibName()
|
EXPORT_C_(char*)
|
||||||
|
PS2EgetLibName()
|
||||||
{
|
{
|
||||||
snprintf( libraryName, 255, "DEV9null Driver %lld%s",SVN_REV, SVN_MODS ? "m" : "");
|
snprintf(libraryName, 255, "DEV9null Driver %lld%s", SVN_REV, SVN_MODS ? "m" : "");
|
||||||
return libraryName;
|
return libraryName;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(u32) PS2EgetLibVersion2(u32 type)
|
EXPORT_C_(u32)
|
||||||
|
PS2EgetLibVersion2(u32 type)
|
||||||
{
|
{
|
||||||
return (version<<16) | (revision<<8) | build;
|
return (version << 16) | (revision << 8) | build;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) DEV9init()
|
EXPORT_C_(s32)
|
||||||
|
DEV9init()
|
||||||
{
|
{
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
setLoggingState();
|
setLoggingState();
|
||||||
LogInit();
|
LogInit();
|
||||||
Dev9Log.WriteLn("dev9null plugin version %d,%d", revision, build);
|
Dev9Log.WriteLn("dev9null plugin version %d,%d", revision, build);
|
||||||
Dev9Log.WriteLn("Initializing dev9null");
|
Dev9Log.WriteLn("Initializing dev9null");
|
||||||
// Initialize anything that needs to be initialized.
|
// Initialize anything that needs to be initialized.
|
||||||
memset(dev9regs, 0, sizeof(dev9regs));
|
memset(dev9regs, 0, sizeof(dev9regs));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) DEV9shutdown()
|
EXPORT_C_(void)
|
||||||
|
DEV9shutdown()
|
||||||
{
|
{
|
||||||
Dev9Log.WriteLn("Shutting down Dev9null.");
|
Dev9Log.WriteLn("Shutting down Dev9null.");
|
||||||
Dev9Log.Close();
|
Dev9Log.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) DEV9open(void *pDsp)
|
EXPORT_C_(s32)
|
||||||
|
DEV9open(void* pDsp)
|
||||||
{
|
{
|
||||||
Dev9Log.WriteLn("Opening Dev9null.");
|
Dev9Log.WriteLn("Opening Dev9null.");
|
||||||
// Get anything ready we need to. Opening and creating hard
|
// Get anything ready we need to. Opening and creating hard
|
||||||
// drive files, for example.
|
// drive files, for example.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) DEV9close()
|
EXPORT_C_(void)
|
||||||
|
DEV9close()
|
||||||
{
|
{
|
||||||
Dev9Log.WriteLn("Closing Dev9null.");
|
Dev9Log.WriteLn("Closing Dev9null.");
|
||||||
// Close files opened.
|
// Close files opened.
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(u8) DEV9read8(u32 addr)
|
EXPORT_C_(u8)
|
||||||
|
DEV9read8(u32 addr)
|
||||||
{
|
{
|
||||||
u8 value = 0;
|
u8 value = 0;
|
||||||
|
|
||||||
switch(addr)
|
switch (addr) {
|
||||||
{
|
// case 0x1F80146E: // DEV9 hardware type (0x32 for an expansion bay)
|
||||||
// case 0x1F80146E: // DEV9 hardware type (0x32 for an expansion bay)
|
case 0x10000038: /*value = dev9Ru8(addr);*/
|
||||||
case 0x10000038: /*value = dev9Ru8(addr);*/ break; // We need to have at least one case to avoid warnings.
|
break; // We need to have at least one case to avoid warnings.
|
||||||
default:
|
default:
|
||||||
//value = dev9Ru8(addr);
|
//value = dev9Ru8(addr);
|
||||||
Dev9Log.WriteLn("*Unknown 8 bit read at address %lx", addr);
|
Dev9Log.WriteLn("*Unknown 8 bit read at address %lx", addr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(u16) DEV9read16(u32 addr)
|
EXPORT_C_(u16)
|
||||||
|
DEV9read16(u32 addr)
|
||||||
{
|
{
|
||||||
u16 value = 0;
|
u16 value = 0;
|
||||||
|
|
||||||
switch(addr)
|
switch (addr) {
|
||||||
{
|
// Addresses you may want to catch here include:
|
||||||
// Addresses you may want to catch here include:
|
// case 0x1F80146E: // DEV9 hardware type (0x32 for an expansion bay)
|
||||||
// case 0x1F80146E: // DEV9 hardware type (0x32 for an expansion bay)
|
// case 0x10000002: // The Smart Chip revision. Should be 0x11
|
||||||
// case 0x10000002: // The Smart Chip revision. Should be 0x11
|
// case 0x10000004: // More type info: bit 0 - smap; bit 1 - hd; bit 5 - flash
|
||||||
// case 0x10000004: // More type info: bit 0 - smap; bit 1 - hd; bit 5 - flash
|
// case 0x1000000E: // Similar to the last; bit 1 should be set if a hd is hooked up.
|
||||||
// case 0x1000000E: // Similar to the last; bit 1 should be set if a hd is hooked up.
|
// case 0x10000028: // intr_stat
|
||||||
// case 0x10000028: // intr_stat
|
// case 0x10000038: // hard drives seem to like reading and writing the max dma size per transfer here.
|
||||||
// case 0x10000038: // hard drives seem to like reading and writing the max dma size per transfer here.
|
// case 0x1000002A: // intr_mask
|
||||||
// case 0x1000002A: // intr_mask
|
// case 0x10000040: // pio_data
|
||||||
// case 0x10000040: // pio_data
|
// case 0x10000044: // nsector
|
||||||
// case 0x10000044: // nsector
|
// case 0x10000046: // sector
|
||||||
// case 0x10000046: // sector
|
// case 0x10000048: // lcyl
|
||||||
// case 0x10000048: // lcyl
|
// case 0x1000004A: // hcyl
|
||||||
// case 0x1000004A: // hcyl
|
// case 0x1000004C: // select
|
||||||
// case 0x1000004C: // select
|
// case 0x1000004E: // status
|
||||||
// case 0x1000004E: // status
|
// case 0x1000005C: // status
|
||||||
// case 0x1000005C: // status
|
// case 0x10000064: // if_ctrl
|
||||||
// case 0x10000064: // if_ctrl
|
case 0x10000038: /*value = dev9Ru16(addr);*/
|
||||||
case 0x10000038: /*value = dev9Ru16(addr);*/ break;
|
break;
|
||||||
default:
|
default:
|
||||||
//value = dev9Ru16(addr);
|
//value = dev9Ru16(addr);
|
||||||
Dev9Log.WriteLn("*Unknown 16 bit read at address %lx", addr);
|
Dev9Log.WriteLn("*Unknown 16 bit read at address %lx", addr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(u32 ) DEV9read32(u32 addr)
|
EXPORT_C_(u32)
|
||||||
|
DEV9read32(u32 addr)
|
||||||
{
|
{
|
||||||
u32 value = 0;
|
u32 value = 0;
|
||||||
|
|
||||||
switch(addr)
|
switch (addr) {
|
||||||
{
|
case 0x10000038: /*value = dev9Ru32(addr);*/
|
||||||
case 0x10000038: /*value = dev9Ru32(addr);*/ break;
|
break;
|
||||||
default:
|
default:
|
||||||
//value = dev9Ru32(addr);
|
//value = dev9Ru32(addr);
|
||||||
Dev9Log.WriteLn("*Unknown 32 bit read at address %lx", addr);
|
Dev9Log.WriteLn("*Unknown 32 bit read at address %lx", addr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) DEV9write8(u32 addr, u8 value)
|
EXPORT_C_(void)
|
||||||
|
DEV9write8(u32 addr, u8 value)
|
||||||
{
|
{
|
||||||
switch(addr)
|
switch (addr) {
|
||||||
{
|
case 0x10000038: /*dev9Ru8(addr) = value;*/
|
||||||
case 0x10000038: /*dev9Ru8(addr) = value;*/ break;
|
break;
|
||||||
default:
|
default:
|
||||||
Dev9Log.WriteLn("*Unknown 8 bit write; address %lx = %x", addr, value);
|
Dev9Log.WriteLn("*Unknown 8 bit write; address %lx = %x", addr, value);
|
||||||
//dev9Ru8(addr) = value;
|
//dev9Ru8(addr) = value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) DEV9write16(u32 addr, u16 value)
|
EXPORT_C_(void)
|
||||||
|
DEV9write16(u32 addr, u16 value)
|
||||||
{
|
{
|
||||||
switch(addr)
|
switch (addr) {
|
||||||
{
|
// Remember that list on DEV9read16? You'll want to write to a
|
||||||
// Remember that list on DEV9read16? You'll want to write to a
|
// lot of them, too.
|
||||||
// lot of them, too.
|
case 0x10000038: /*dev9Ru16(addr) = value;*/
|
||||||
case 0x10000038: /*dev9Ru16(addr) = value;*/ break;
|
break;
|
||||||
default:
|
default:
|
||||||
Dev9Log.WriteLn("*Unknown 16 bit write; address %lx = %x", addr, value);
|
Dev9Log.WriteLn("*Unknown 16 bit write; address %lx = %x", addr, value);
|
||||||
//dev9Ru16(addr) = value;
|
//dev9Ru16(addr) = value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) DEV9write32(u32 addr, u32 value)
|
EXPORT_C_(void)
|
||||||
|
DEV9write32(u32 addr, u32 value)
|
||||||
{
|
{
|
||||||
switch(addr)
|
switch (addr) {
|
||||||
{
|
case 0x10000038: /*dev9Ru32(addr) = value;*/
|
||||||
case 0x10000038: /*dev9Ru32(addr) = value;*/ break;
|
break;
|
||||||
default:
|
default:
|
||||||
Dev9Log.WriteLn("*Unknown 32 bit write; address %lx = %x", addr, value);
|
Dev9Log.WriteLn("*Unknown 32 bit write; address %lx = %x", addr, value);
|
||||||
//dev9Ru32(addr) = value;
|
//dev9Ru32(addr) = value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//#ifdef ENABLE_NEW_IOPDMA_DEV9
|
//#ifdef ENABLE_NEW_IOPDMA_DEV9
|
||||||
EXPORT_C_(s32) DEV9dmaRead(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed)
|
EXPORT_C_(s32)
|
||||||
|
DEV9dmaRead(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed)
|
||||||
{
|
{
|
||||||
// You'll want to put your own DMA8 reading code here.
|
// You'll want to put your own DMA8 reading code here.
|
||||||
// Time to interact with your fake (or real) hardware.
|
// Time to interact with your fake (or real) hardware.
|
||||||
Dev9Log.WriteLn("Reading DMA8 Mem.");
|
Dev9Log.WriteLn("Reading DMA8 Mem.");
|
||||||
*bytesProcessed = bytesLeft;
|
*bytesProcessed = bytesLeft;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) DEV9dmaWrite(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed)
|
EXPORT_C_(s32)
|
||||||
|
DEV9dmaWrite(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed)
|
||||||
{
|
{
|
||||||
// See above.
|
// See above.
|
||||||
Dev9Log.WriteLn("Writing DMA8 Mem.");
|
Dev9Log.WriteLn("Writing DMA8 Mem.");
|
||||||
*bytesProcessed = bytesLeft;
|
*bytesProcessed = bytesLeft;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) DEV9dmaInterrupt(s32 channel)
|
EXPORT_C_(void)
|
||||||
|
DEV9dmaInterrupt(s32 channel)
|
||||||
{
|
{
|
||||||
// See above.
|
// See above.
|
||||||
}
|
}
|
||||||
//#else
|
//#else
|
||||||
EXPORT_C_(void) DEV9readDMA8Mem(u32 *pMem, int size)
|
EXPORT_C_(void)
|
||||||
|
DEV9readDMA8Mem(u32* pMem, int size)
|
||||||
{
|
{
|
||||||
// You'll want to put your own DMA8 reading code here.
|
// You'll want to put your own DMA8 reading code here.
|
||||||
// Time to interact with your fake (or real) hardware.
|
// Time to interact with your fake (or real) hardware.
|
||||||
Dev9Log.WriteLn("Reading DMA8 Mem.");
|
Dev9Log.WriteLn("Reading DMA8 Mem.");
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) DEV9writeDMA8Mem(u32* pMem, int size)
|
EXPORT_C_(void)
|
||||||
|
DEV9writeDMA8Mem(u32* pMem, int size)
|
||||||
{
|
{
|
||||||
// See above.
|
// See above.
|
||||||
Dev9Log.WriteLn("Writing DMA8 Mem.");
|
Dev9Log.WriteLn("Writing DMA8 Mem.");
|
||||||
}
|
}
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
EXPORT_C_(void) DEV9irqCallback(DEV9callback callback)
|
EXPORT_C_(void)
|
||||||
|
DEV9irqCallback(DEV9callback callback)
|
||||||
{
|
{
|
||||||
// Setting our callback. You will call it with DEV9irq(cycles),
|
// Setting our callback. You will call it with DEV9irq(cycles),
|
||||||
// Where cycles is the number of cycles till the irq is triggered.
|
// Where cycles is the number of cycles till the irq is triggered.
|
||||||
DEV9irq = callback;
|
DEV9irq = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _DEV9irqHandler(void)
|
int _DEV9irqHandler(void)
|
||||||
{
|
{
|
||||||
// And this gets called when the irq is triggered.
|
// And this gets called when the irq is triggered.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(DEV9handler) DEV9irqHandler(void)
|
EXPORT_C_(DEV9handler)
|
||||||
|
DEV9irqHandler(void)
|
||||||
{
|
{
|
||||||
// Pass it to pcsx2.
|
// Pass it to pcsx2.
|
||||||
return (DEV9handler)_DEV9irqHandler;
|
return (DEV9handler)_DEV9irqHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) DEV9setSettingsDir(const char* dir)
|
EXPORT_C_(void)
|
||||||
|
DEV9setSettingsDir(const char* dir)
|
||||||
{
|
{
|
||||||
// Grab the ini directory.
|
// Grab the ini directory.
|
||||||
s_strIniPath = (dir == NULL) ? "inis" : dir;
|
s_strIniPath = (dir == NULL) ? "inis" : dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
// extended funcs
|
// extended funcs
|
||||||
|
|
||||||
EXPORT_C_(s32) DEV9test()
|
EXPORT_C_(s32)
|
||||||
|
DEV9test()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) DEV9freeze(int mode, freezeData *data)
|
EXPORT_C_(s32)
|
||||||
|
DEV9freeze(int mode, freezeData* data)
|
||||||
{
|
{
|
||||||
// This should store or retrieve any information, for if emulation
|
// This should store or retrieve any information, for if emulation
|
||||||
// gets suspended, or for savestates.
|
// gets suspended, or for savestates.
|
||||||
switch(mode)
|
switch (mode) {
|
||||||
{
|
case FREEZE_LOAD:
|
||||||
case FREEZE_LOAD:
|
// Load previously saved data.
|
||||||
// Load previously saved data.
|
break;
|
||||||
break;
|
case FREEZE_SAVE:
|
||||||
case FREEZE_SAVE:
|
// Save data.
|
||||||
// Save data.
|
break;
|
||||||
break;
|
case FREEZE_SIZE:
|
||||||
case FREEZE_SIZE:
|
// return the size of the data.
|
||||||
// return the size of the data.
|
break;
|
||||||
break;
|
}
|
||||||
}
|
return 0;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For operating systems that need an entry point for a dll/library, here it is. Defined in PS2Eext.h. */
|
/* For operating systems that need an entry point for a dll/library, here it is. Defined in PS2Eext.h. */
|
||||||
|
|
|
@ -25,8 +25,9 @@
|
||||||
#include "PS2Edefs.h"
|
#include "PS2Edefs.h"
|
||||||
#include "PS2Eext.h"
|
#include "PS2Eext.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
s32 Log;
|
{
|
||||||
|
s32 Log;
|
||||||
} Config;
|
} Config;
|
||||||
|
|
||||||
extern Config conf;
|
extern Config conf;
|
||||||
|
@ -42,12 +43,12 @@ void LoadConfig();
|
||||||
extern void (*DEV9irq)(int);
|
extern void (*DEV9irq)(int);
|
||||||
|
|
||||||
extern __aligned16 s8 dev9regs[0x10000];
|
extern __aligned16 s8 dev9regs[0x10000];
|
||||||
#define dev9Rs8(mem) dev9regs[(mem) & 0xffff]
|
#define dev9Rs8(mem) dev9regs[(mem)&0xffff]
|
||||||
#define dev9Rs16(mem) (*(s16*)&dev9regs[(mem) & 0xffff])
|
#define dev9Rs16(mem) (*(s16*)&dev9regs[(mem)&0xffff])
|
||||||
#define dev9Rs32(mem) (*(s32*)&dev9regs[(mem) & 0xffff])
|
#define dev9Rs32(mem) (*(s32*)&dev9regs[(mem)&0xffff])
|
||||||
#define dev9Ru8(mem) (*(u8*) &dev9regs[(mem) & 0xffff])
|
#define dev9Ru8(mem) (*(u8*)&dev9regs[(mem)&0xffff])
|
||||||
#define dev9Ru16(mem) (*(u16*)&dev9regs[(mem) & 0xffff])
|
#define dev9Ru16(mem) (*(u16*)&dev9regs[(mem)&0xffff])
|
||||||
#define dev9Ru32(mem) (*(u32*)&dev9regs[(mem) & 0xffff])
|
#define dev9Ru32(mem) (*(u32*)&dev9regs[(mem)&0xffff])
|
||||||
|
|
||||||
extern void setLoggingState();
|
extern void setLoggingState();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue