From 3f9a45c8aa563ebebc88ea1175783a1003688b5c Mon Sep 17 00:00:00 2001 From: gabest11 Date: Mon, 18 May 2009 10:50:43 +0000 Subject: [PATCH] Cleaned up the dummy MTGS gif transfer function a bit, and let the F5-F7 keys to be passed in GSkeyEvent (allows me to remove windows specific keyboard handling from the gs). git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1218 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/GS.h | 15 ++++++++ pcsx2/MTGS.cpp | 74 +++++++++--------------------------- pcsx2/windows/WinSysExec.cpp | 2 +- 3 files changed, 34 insertions(+), 57 deletions(-) diff --git a/pcsx2/GS.h b/pcsx2/GS.h index 983d13a9b1..9f6f8f70f2 100644 --- a/pcsx2/GS.h +++ b/pcsx2/GS.h @@ -99,6 +99,21 @@ struct GIFPath __forceinline void PrepRegs(); void SetTag(const void* mem); u32 GetReg(); + + __forceinline bool StepReg() + { + if((++curreg & 0xf) == tag.nreg) + { + curreg = 0; + + if(--tag.nloop == 0) + { + return false; + } + } + + return true; + } }; diff --git a/pcsx2/MTGS.cpp b/pcsx2/MTGS.cpp index dacea2eeea..253345695f 100644 --- a/pcsx2/MTGS.cpp +++ b/pcsx2/MTGS.cpp @@ -280,8 +280,6 @@ __forceinline u32 mtgsThreadObject::_gifTransferDummy( GIF_PATH pathidx, const u while(size > 0) { - bool eop = false; - if(path.tag.nloop == 0) { path.SetTag( pMem ); @@ -290,7 +288,9 @@ __forceinline u32 mtgsThreadObject::_gifTransferDummy( GIF_PATH pathidx, const u --size; if(pathidx == 2 && path.tag.eop) + { Path3transfer = FALSE; + } if( pathidx == 0 ) { @@ -305,42 +305,16 @@ __forceinline u32 mtgsThreadObject::_gifTransferDummy( GIF_PATH pathidx, const u return ++size; } } - - - /*f(path.tag.pre) - { - assert(path.tag.flg != GIF_FLG_IMAGE); // kingdom hearts, ffxii, tales of abyss - - if((path.tag.flg & 2) == 0) - { - // Primitive handler... Nothing for the Dummy to do here. - - //GIFReg r; - //r.i64 = path.tag.PRIM; - //(this->*m_fpGIFRegHandlers[GIF_A_D_REG_PRIM])(&r); - } - }*/ - - 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 ) { @@ -348,25 +322,19 @@ __forceinline u32 mtgsThreadObject::_gifTransferDummy( GIF_PATH pathidx, const u if(handler >= 0x60 && handler < 0x63) 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) @@ -374,20 +342,11 @@ __forceinline u32 mtgsThreadObject::_gifTransferDummy( GIF_PATH pathidx, const u 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); + size /= 2; break; @@ -413,15 +372,18 @@ __forceinline u32 mtgsThreadObject::_gifTransferDummy( GIF_PATH pathidx, const u } } - 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; DevCon::Write( "path1 hack! " ); diff --git a/pcsx2/windows/WinSysExec.cpp b/pcsx2/windows/WinSysExec.cpp index fb8e48e106..cde8acee50 100644 --- a/pcsx2/windows/WinSysExec.cpp +++ b/pcsx2/windows/WinSysExec.cpp @@ -413,7 +413,7 @@ namespace HostGui case VK_CAPITAL: keymod->capslock = TRUE; break; case VK_F1: case VK_F2: case VK_F3: case VK_F4: - case VK_F5: case VK_F6: case VK_F7: case VK_F8: + case VK_F8: // note: VK_F5-VK_F7 are reserved for GS case VK_F9: case VK_F10: case VK_F11: case VK_F12: try {