GSNull uses GSOpen2. Hacked Openpad to work whether GSOpen or GSOpen2 is used.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2401 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-12-26 00:01:30 +00:00
parent b1fc08409b
commit e5546267b9
7 changed files with 66 additions and 18 deletions

View File

@ -40,6 +40,11 @@ bool GSShift = false, GSAlt = false;
string s_strIniPath="inis"; string s_strIniPath="inis";
const char* s_iniFilename = "GSnull.ini"; const char* s_iniFilename = "GSnull.ini";
// Because I haven't bothered to get GSOpen2 working in Windows yet in GSNull.
#ifdef __LINUX__
#define USE_GSOPEN2
#endif
void (*GSirq)(); void (*GSirq)();
EXPORT_C_(u32) PS2EgetLibType() EXPORT_C_(u32) PS2EgetLibType()
@ -124,9 +129,7 @@ EXPORT_C_(void) GSshutdown()
EXPORT_C_(s32) GSopen(void *pDsp, char *Title, int multithread) EXPORT_C_(s32) GSopen(void *pDsp, char *Title, int multithread)
{ {
int err = 0; int err = 0;
#ifdef GS_LOG
GS_LOG("GS open\n"); GS_LOG("GS open\n");
#endif
//assert( GSirq != NULL ); //assert( GSirq != NULL );
err = GSOpenWindow(pDsp, Title); err = GSOpenWindow(pDsp, Title);
@ -135,6 +138,18 @@ EXPORT_C_(s32) GSopen(void *pDsp, char *Title, int multithread)
return err; return err;
} }
#ifdef USE_GSOPEN2
EXPORT_C_(s32) GSopen2( void *pDsp, u32 flags )
{
GS_LOG("GS open2\n");
GSOpenWindow2(pDsp, flags);
SysPrintf("Opening GSnull (2)\n");
return 0;
}
#endif
EXPORT_C_(void) GSclose() EXPORT_C_(void) GSclose()
{ {
SysPrintf("Closing GSnull\n"); SysPrintf("Closing GSnull\n");

View File

@ -17,20 +17,32 @@
#include "GSLinux.h" #include "GSLinux.h"
Display *display; Display *display;
int screen; int screen;
GtkScrolledWindow *win;
int GSOpenWindow(void *pDsp, char *Title) int GSOpenWindow(void *pDsp, 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)
{
GtkWidget *widget;
if (pDsp != NULL)
win = *(GtkScrolledWindow**)pDsp;
else
return -1;
return 0;
}
void GSCloseWindow() void GSCloseWindow()
{ {

View File

@ -21,6 +21,7 @@
#include <X11/keysym.h> #include <X11/keysym.h>
extern int GSOpenWindow(void *pDsp, char *Title); extern int GSOpenWindow(void *pDsp, char *Title);
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);

View File

@ -20,6 +20,7 @@
*/ */
#include "linux.h" #include "linux.h"
#include <gdk/gdkx.h>
Display *GSdsp; Display *GSdsp;
@ -38,9 +39,25 @@ extern string KeyName(int pad, int key);
s32 _PADopen(void *pDsp) s32 _PADopen(void *pDsp)
{ {
GSdsp = *(Display**)pDsp; GtkScrolledWindow *win;
SetAutoRepeat(false);
win = *(GtkScrolledWindow**) pDsp;
PAD_LOG("It is a '%s'", GTK_OBJECT_TYPE_NAME(&win));
if (GTK_IS_WIDGET(win))
{
// Since we have a GtkScrolledWindow, for now we'll grab whatever display
// comes along instead. Later, we can fiddle with this, but I'm not sure the
// best way to get a Display* out of a GtkScrolledWindow. A GtkWindow I might
// be able to manage... --arcum42
GSdsp = GDK_DISPLAY();
}
else
{
GSdsp = *(Display**)pDsp;
}
SetAutoRepeat(false);
return 0; return 0;
} }

View File

@ -50,21 +50,24 @@ char* KeysymToChar(int keysym)
void PollForKeyboardInput(int pad) void PollForKeyboardInput(int pad)
{ {
#ifdef __LINUX__ #ifdef __LINUX__
PollForX11KeyboardInput(pad); PollForX11KeyboardInput(pad);
#endif #endif
} }
void SetAutoRepeat(bool autorep) void SetAutoRepeat(bool autorep)
{ {
#ifdef __LINUX__ #ifdef __LINUX__
if (autorep) if (toggleAutoRepeat)
XAutoRepeatOn(GSdsp); {
else if (autorep)
XAutoRepeatOff(GSdsp); XAutoRepeatOn(GSdsp);
else
XAutoRepeatOff(GSdsp);
}
#endif #endif
} }
#ifdef __LINUX__ #ifdef __LINUX__
void PollForX11KeyboardInput(int pad) void PollForX11KeyboardInput(int pad)
{ {
XEvent E; XEvent E;

View File

@ -44,6 +44,7 @@ u16 status[2];
int pressure; int pressure;
static keyEvent s_event; static keyEvent s_event;
string s_strIniPath = "inis/OnePAD.ini"; string s_strIniPath = "inis/OnePAD.ini";
bool toggleAutoRepeat = true;
const u32 version = PS2E_PAD_VERSION; const u32 version = PS2E_PAD_VERSION;
const u32 revision = 0; const u32 revision = 0;
@ -118,10 +119,7 @@ u8 stdmodel[2][8] = {
u8 *buf; u8 *buf;
int padID[2]; int padID[2];
int padMode[2]; int padMode[2];
int curPad; int curPad, curByte, curCmd, cmdLen;
int curByte;
int curCmd;
int cmdLen;
int ds2mode = 0; // DS Mode at start int ds2mode = 0; // DS Mode at start
FILE *padLog = NULL; FILE *padLog = NULL;
@ -246,10 +244,10 @@ EXPORT_C_(s32) PADinit(u32 flags)
status[1] = 0xffff; status[1] = 0xffff;
#ifdef __LINUX__ #ifdef __LINUX__
char strcurdir[256]; /*char strcurdir[256];
getcwd(strcurdir, 256); getcwd(strcurdir, 256);
s_strIniPath = strcurdir; s_strIniPath = strcurdir;
s_strIniPath += "/inis/OnePAD.ini"; s_strIniPath += "/inis/OnePAD.ini";*/
#endif #endif
LoadConfig(); LoadConfig();

View File

@ -66,6 +66,8 @@ enum PadOptions
extern FILE *padLog; extern FILE *padLog;
extern void initLogging(); extern void initLogging();
extern bool toggleAutoRepeat;
#define PAD_LOG __Log #define PAD_LOG __Log
//#define PAD_LOG __LogToConsole //#define PAD_LOG __LogToConsole