mirror of https://github.com/PCSX2/pcsx2.git
PADnull reformat
This commit is contained in:
parent
6613862aed
commit
eb18a2ac0f
|
@ -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 :)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue