mirror of https://github.com/PCSX2/pcsx2.git
GSnull: Update the GifTransfer code. Start to add keyboard code.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1234 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
7922f33f4f
commit
b1fd826954
|
@ -27,6 +27,7 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include "GS.h"
|
#include "GS.h"
|
||||||
|
#include "null/GSnull.h"
|
||||||
|
|
||||||
#ifdef __LINUX__
|
#ifdef __LINUX__
|
||||||
Display *display;
|
Display *display;
|
||||||
|
@ -43,6 +44,9 @@ const unsigned char build = 1; // increase that with each version
|
||||||
static char *libraryName = "GSnull Driver";
|
static char *libraryName = "GSnull Driver";
|
||||||
FILE *gsLog;
|
FILE *gsLog;
|
||||||
Config conf;
|
Config conf;
|
||||||
|
u32 GSKeyEvent = 0;
|
||||||
|
bool GSShift = false, GSAlt = false;
|
||||||
|
|
||||||
string s_strIniPath="inis/GSnull.ini";
|
string s_strIniPath="inis/GSnull.ini";
|
||||||
void (*GSirq)();
|
void (*GSirq)();
|
||||||
|
|
||||||
|
@ -168,9 +172,37 @@ EXPORT_C_(s32) GStest()
|
||||||
return 0;
|
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)
|
EXPORT_C_(void) GSvsync(int field)
|
||||||
{
|
{
|
||||||
|
ProcessMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) GSgifTransfer1(u32 *pMem, u32 addr)
|
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
|
// GSkeyEvent gets called when there is a keyEvent from the PAD plugin
|
||||||
EXPORT_C_(void) GSkeyEvent(keyEvent *ev)
|
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)
|
EXPORT_C_(void) GSchangeSaveState(int, const char* filename)
|
||||||
|
|
|
@ -103,14 +103,24 @@ u32 GIFPath::GetReg()
|
||||||
return regs[curreg];
|
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)
|
while(size > 0)
|
||||||
{
|
{
|
||||||
bool eop = false;
|
|
||||||
|
|
||||||
if(path.tag.nloop == 0)
|
if(path.tag.nloop == 0)
|
||||||
{
|
{
|
||||||
path.SetTag( pMem );
|
path.SetTag( pMem );
|
||||||
|
@ -119,14 +129,16 @@ __forceinline u32 _gifTransfer( GIF_PATH pathidx, const u8* pMem, u32 size )
|
||||||
--size;
|
--size;
|
||||||
|
|
||||||
if(pathidx == 2 && path.tag.eop)
|
if(pathidx == 2 && path.tag.eop)
|
||||||
|
{
|
||||||
Path3transfer = FALSE;
|
Path3transfer = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if( pathidx == 0 )
|
if( pathidx == 0 )
|
||||||
{
|
{
|
||||||
// hack: if too much data for VU1, just ignore.
|
// 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.
|
// 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)))
|
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;
|
return ++size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(path.tag.eop)
|
|
||||||
{
|
|
||||||
eop = true;
|
|
||||||
}
|
|
||||||
else if(path.tag.nloop == 0)
|
|
||||||
{
|
|
||||||
if(pathidx == 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
eop = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if(path.tag.nloop > 0)
|
|
||||||
{
|
{
|
||||||
|
// NOTE: size > 0 => do {} while(size > 0); should be faster than while(size > 0) {}
|
||||||
|
|
||||||
switch(path.tag.flg)
|
switch(path.tag.flg)
|
||||||
{
|
{
|
||||||
case GIF_FLG_PACKED:
|
case GIF_FLG_PACKED:
|
||||||
|
|
||||||
while(size > 0)
|
do
|
||||||
{
|
{
|
||||||
if( path.GetReg() == 0xe )
|
if( path.GetReg() == 0xe )
|
||||||
{
|
{
|
||||||
const int handler = pMem[8];
|
const int handler = pMem[8];
|
||||||
if(handler >= 0x60 && handler < 0x63)
|
if(handler >= 0x60 && handler < 0x63)
|
||||||
s_GSHandlers[handler & 0x3]((const u32*)pMem);
|
s_GSHandlers[handler&0x3]((const u32*)pMem);
|
||||||
}
|
}
|
||||||
|
|
||||||
size--;
|
size--;
|
||||||
pMem += 16; // 128 bits! //sizeof(GIFPackedReg);
|
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;
|
break;
|
||||||
|
|
||||||
case GIF_FLG_REGLIST:
|
case GIF_FLG_REGLIST:
|
||||||
|
|
||||||
size *= 2;
|
size *= 2;
|
||||||
|
|
||||||
while(size > 0)
|
do
|
||||||
{
|
{
|
||||||
const int handler = path.GetReg();
|
const int handler = path.GetReg();
|
||||||
if (handler >= 0x60 && handler < 0x63)
|
if(handler >= 0x60 && handler < 0x63)
|
||||||
s_GSHandlers[handler&0x3]((const u32*)pMem);
|
s_GSHandlers[handler&0x3]((const u32*)pMem);
|
||||||
|
|
||||||
size--;
|
size--;
|
||||||
pMem += 8; //sizeof(GIFReg); -- 64 bits!
|
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;
|
size /= 2;
|
||||||
|
|
||||||
break;
|
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(pathidx == 0)
|
||||||
{
|
{
|
||||||
if (!path.tag.eop && path.tag.nloop > 0)
|
if(size == 0 && path.tag.nloop > 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
|
// This means that the giftag data got screwly somewhere
|
||||||
// along the way (often means curreg was in a bad state or something)
|
// along the way (often means curreg was in a bad state or something)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,7 @@ struct GIFPath
|
||||||
__forceinline void PrepRegs();
|
__forceinline void PrepRegs();
|
||||||
void SetTag(const void* mem);
|
void SetTag(const void* mem);
|
||||||
u32 GetReg();
|
u32 GetReg();
|
||||||
|
__forceinline bool StepReg();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern GIFPath m_path[3];
|
extern GIFPath m_path[3];
|
||||||
|
|
|
@ -29,7 +29,5 @@ libGSnull_a_SOURCES += \
|
||||||
Linux/interface.h Linux/support.c \
|
Linux/interface.h Linux/support.c \
|
||||||
Linux/interface.c Linux/support.h \
|
Linux/interface.c Linux/support.h \
|
||||||
Linux/callbacks.h \
|
Linux/callbacks.h \
|
||||||
GifTransfer.cpp GifTransfer.h
|
GifTransfer.cpp GifTransfer.h \
|
||||||
#Linux/callbacks.c
|
null/GSnull.cpp null/GSnull.h
|
||||||
|
|
||||||
#SUBDIRS = Linux
|
|
|
@ -164,6 +164,10 @@
|
||||||
RelativePath="..\GS.cpp"
|
RelativePath="..\GS.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\null\GSnull.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\GifTransfer.cpp"
|
RelativePath="..\GifTransfer.cpp"
|
||||||
>
|
>
|
||||||
|
@ -185,6 +189,10 @@
|
||||||
RelativePath="..\GifTransfer.h"
|
RelativePath="..\GifTransfer.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\null\GSnull.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\resource.h"
|
RelativePath=".\resource.h"
|
||||||
>
|
>
|
||||||
|
|
|
@ -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");
|
||||||
|
}
|
|
@ -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);
|
Loading…
Reference in New Issue