diff --git a/plugins/GSnull/GS.cpp b/plugins/GSnull/GS.cpp
index 7dfe2bdaf4..92385b393c 100644
--- a/plugins/GSnull/GS.cpp
+++ b/plugins/GSnull/GS.cpp
@@ -27,6 +27,7 @@
using namespace std;
#include "GS.h"
+#include "null/GSnull.h"
#ifdef __LINUX__
Display *display;
@@ -43,6 +44,9 @@ const unsigned char build = 1; // increase that with each version
static char *libraryName = "GSnull Driver";
FILE *gsLog;
Config conf;
+u32 GSKeyEvent = 0;
+bool GSShift = false, GSAlt = false;
+
string s_strIniPath="inis/GSnull.ini";
void (*GSirq)();
@@ -168,9 +172,37 @@ EXPORT_C_(s32) GStest()
return 0;
}
+void ProcessMessages()
+{
+#ifdef __LINUX__
+ if ( GSKeyEvent )
+ {
+ int myKeyEvent = GSKeyEvent;
+ bool myShift = GSShift;
+ GSKeyEvent = 0;
+
+ switch ( myKeyEvent )
+ {
+ case XK_F5:
+ OnKeyboardF5(myShift);
+ break;
+ case XK_F6:
+ OnKeyboardF6(myShift);
+ break;
+ case XK_F7:
+ OnKeyboardF7(myShift);
+ break;
+ case XK_F9:
+ OnKeyboardF9(myShift);
+ break;
+ }
+ }
+#endif
+}
EXPORT_C_(void) GSvsync(int field)
{
+ ProcessMessages();
}
EXPORT_C_(void) GSgifTransfer1(u32 *pMem, u32 addr)
@@ -211,7 +243,41 @@ EXPORT_C_(void) GSreadFIFO2(u64 *mem, int qwc)
// GSkeyEvent gets called when there is a keyEvent from the PAD plugin
EXPORT_C_(void) GSkeyEvent(keyEvent *ev)
{
- //SysPrintf("There is a key event.\n");
+ switch(ev->evt) {
+ case KEYPRESS:
+ switch(ev->key) {
+ case XK_F5:
+ case XK_F6:
+ case XK_F7:
+ case XK_F9:
+ GSKeyEvent = ev->key ;
+ break;
+ case XK_Escape:
+ break;
+ case XK_Shift_L:
+ case XK_Shift_R:
+ //bShift = true;
+ GSShift = true;
+ break;
+ case XK_Alt_L:
+ case XK_Alt_R:
+ GSAlt = true;
+ break;
+ }
+ break;
+ case KEYRELEASE:
+ switch(ev->key) {
+ case XK_Shift_L:
+ case XK_Shift_R:
+ //bShift = false;
+ GSShift = false;
+ break;
+ case XK_Alt_L:
+ case XK_Alt_R:
+ GSAlt = false;
+ break;
+ }
+ }
}
EXPORT_C_(void) GSchangeSaveState(int, const char* filename)
diff --git a/plugins/GSnull/GifTransfer.cpp b/plugins/GSnull/GifTransfer.cpp
index 37a22819bb..34e69fa3bb 100644
--- a/plugins/GSnull/GifTransfer.cpp
+++ b/plugins/GSnull/GifTransfer.cpp
@@ -103,14 +103,24 @@ u32 GIFPath::GetReg()
return regs[curreg];
}
-__forceinline u32 _gifTransfer( GIF_PATH pathidx, const u8* pMem, u32 size )
+__forceinline bool GIFPath::StepReg()
{
- GIFPath& path = m_path[pathidx];
+ if ((++curreg & 0xf) == tag.nreg)
+ {
+ curreg = 0;
+
+ if(--tag.nloop == 0)
+ {
+ return false;
+ }
+ }
+}
+
+__forceinline u32 _gifTransfer( GIF_PATH pathidx, const u8* pMem, u32 size )
+{ GIFPath& path = m_path[pathidx];
while(size > 0)
{
- bool eop = false;
-
if(path.tag.nloop == 0)
{
path.SetTag( pMem );
@@ -119,14 +129,16 @@ __forceinline u32 _gifTransfer( GIF_PATH pathidx, const u8* pMem, u32 size )
--size;
if(pathidx == 2 && path.tag.eop)
+ {
Path3transfer = FALSE;
+ }
if( pathidx == 0 )
{
// hack: if too much data for VU1, just ignore.
// The GIF is evil : if nreg is 0, it's really 16. Otherwise it's the value in nreg.
- const int numregs = ((path.tag.nreg - 1) & 15) + 1;
+ const int numregs = ((path.tag.nreg-1)&15)+1;
if((path.tag.nloop * numregs) > (size * ((path.tag.flg == 1) ? 2 : 1)))
{
@@ -134,74 +146,48 @@ __forceinline u32 _gifTransfer( GIF_PATH pathidx, const u8* pMem, u32 size )
return ++size;
}
}
-
- if(path.tag.eop)
- {
- eop = true;
- }
- else if(path.tag.nloop == 0)
- {
- if(pathidx == 0)
- continue;
-
- eop = true;
- }
}
-
- if(path.tag.nloop > 0)
+ else
{
+ // NOTE: size > 0 => do {} while(size > 0); should be faster than while(size > 0) {}
+
switch(path.tag.flg)
{
case GIF_FLG_PACKED:
- while(size > 0)
+ do
{
if( path.GetReg() == 0xe )
{
const int handler = pMem[8];
if(handler >= 0x60 && handler < 0x63)
- s_GSHandlers[handler & 0x3]((const u32*)pMem);
+ s_GSHandlers[handler&0x3]((const u32*)pMem);
}
+
size--;
pMem += 16; // 128 bits! //sizeof(GIFPackedReg);
-
- if((++path.curreg & 0xf) == path.tag.nreg)
- {
- path.curreg = 0;
- path.tag.nloop--;
-
- if(path.tag.nloop == 0)
- break;
- }
}
+ while(path.StepReg() && size > 0);
+
break;
case GIF_FLG_REGLIST:
size *= 2;
- while(size > 0)
+ do
{
const int handler = path.GetReg();
- if (handler >= 0x60 && handler < 0x63)
+ if(handler >= 0x60 && handler < 0x63)
s_GSHandlers[handler&0x3]((const u32*)pMem);
size--;
pMem += 8; //sizeof(GIFReg); -- 64 bits!
-
- if((++path.curreg & 0xf) == path.tag.nreg)
- {
- path.curreg = 0;
- path.tag.nloop--;
-
- if(path.tag.nloop == 0)
- {
- break;
- }
- }
}
+ while(path.StepReg() && size > 0);
- if (size & 1) pMem += 8; //sizeof(GIFReg);
+ if(size & 1) pMem += 8; //sizeof(GIFReg);
+
size /= 2;
break;
@@ -227,23 +213,27 @@ __forceinline u32 _gifTransfer( GIF_PATH pathidx, const u8* pMem, u32 size )
}
}
- if (eop && ((int)size <= 0 || pathidx == 0))
+ if(pathidx == 0)
{
- break;
+ if(path.tag.eop && path.tag.nloop == 0)
+ {
+ break;
+ }
}
}
if(pathidx == 0)
{
- if (!path.tag.eop && path.tag.nloop > 0)
+ if(size == 0 && path.tag.nloop > 0)
{
path.tag.nloop = 0;
- SysPrintf( "path1 hack! " );
+ SysPrintf( "path1 hack! \n" );
// This means that the giftag data got screwly somewhere
// along the way (often means curreg was in a bad state or something)
}
}
+
return size;
}
diff --git a/plugins/GSnull/GifTransfer.h b/plugins/GSnull/GifTransfer.h
index bf30e19756..0e16a99d62 100644
--- a/plugins/GSnull/GifTransfer.h
+++ b/plugins/GSnull/GifTransfer.h
@@ -85,6 +85,7 @@ struct GIFPath
__forceinline void PrepRegs();
void SetTag(const void* mem);
u32 GetReg();
+ __forceinline bool StepReg();
};
extern GIFPath m_path[3];
diff --git a/plugins/GSnull/Makefile.am b/plugins/GSnull/Makefile.am
index 872aa0e2a0..21f39566fa 100644
--- a/plugins/GSnull/Makefile.am
+++ b/plugins/GSnull/Makefile.am
@@ -29,7 +29,5 @@ libGSnull_a_SOURCES += \
Linux/interface.h Linux/support.c \
Linux/interface.c Linux/support.h \
Linux/callbacks.h \
-GifTransfer.cpp GifTransfer.h
-#Linux/callbacks.c
-
-#SUBDIRS = Linux
\ No newline at end of file
+GifTransfer.cpp GifTransfer.h \
+null/GSnull.cpp null/GSnull.h
\ No newline at end of file
diff --git a/plugins/GSnull/Windows/GSnull_vc2008.vcproj b/plugins/GSnull/Windows/GSnull_vc2008.vcproj
index 65a952655a..5772e553be 100644
--- a/plugins/GSnull/Windows/GSnull_vc2008.vcproj
+++ b/plugins/GSnull/Windows/GSnull_vc2008.vcproj
@@ -164,6 +164,10 @@
RelativePath="..\GS.cpp"
>
+
+
@@ -185,6 +189,10 @@
RelativePath="..\GifTransfer.h"
>
+
+
diff --git a/plugins/GSnull/null/GSnull.cpp b/plugins/GSnull/null/GSnull.cpp
new file mode 100644
index 0000000000..78d848f517
--- /dev/null
+++ b/plugins/GSnull/null/GSnull.cpp
@@ -0,0 +1,39 @@
+ /* GSnull
+ * Copyright (C) 2004-2009 PCSX2 Team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+ #include "GS.h"
+
+void OnKeyboardF5(int myShift)
+{
+ SysPrintf("F5 pressed!\n");
+}
+
+void OnKeyboardF6(int myShift)
+{
+ SysPrintf("F6 pressed!\n");
+}
+
+void OnKeyboardF7(int myShift)
+{
+ SysPrintf("F7 pressed!\n");
+}
+
+void OnKeyboardF9(int myShift)
+{
+ SysPrintf("F9 pressed!\n");
+}
\ No newline at end of file
diff --git a/plugins/GSnull/null/GSnull.h b/plugins/GSnull/null/GSnull.h
new file mode 100644
index 0000000000..53c25d1398
--- /dev/null
+++ b/plugins/GSnull/null/GSnull.h
@@ -0,0 +1,22 @@
+ /* GSnull
+ * Copyright (C) 2004-2009 PCSX2 Team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+extern void OnKeyboardF5(int myShift);
+extern void OnKeyboardF6(int myShift);
+extern void OnKeyboardF7(int myShift);
+extern void OnKeyboardF9(int myShift);
\ No newline at end of file