From 53a5089d7b6991f34b39fcca51e7c61a93b9da08 Mon Sep 17 00:00:00 2001 From: "gregory.hainaut" Date: Fri, 6 Jan 2012 07:20:37 +0000 Subject: [PATCH] gsdx-ogl: * fix some issue with cmake and new sdl define * Implement shortcut key handling on linux. + some option are not yet implemented (fxaa) + gs dump can be created with git-svn-id: http://pcsx2.googlecode.com/svn/branches/gsdx-ogl@5050 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/GSdx/CMakeLists.txt | 10 +++-- plugins/GSdx/GSRenderer.cpp | 73 ++++++++++++++++++++++++++++++++++--- plugins/GSdx/GSRenderer.h | 4 ++ 3 files changed, 77 insertions(+), 10 deletions(-) diff --git a/plugins/GSdx/CMakeLists.txt b/plugins/GSdx/CMakeLists.txt index 53bb692fa0..ef836d6a98 100644 --- a/plugins/GSdx/CMakeLists.txt +++ b/plugins/GSdx/CMakeLists.txt @@ -28,22 +28,24 @@ set(OptimizationFlags ) if(projectSDL) - add_definitions(-DENABLE_SDL_DEV) + set(SDLFlags -DENABLE_SDL_DEV) +else(projectSDL) + set(SDLFlags "") endif(projectSDL) # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) - add_definitions(${CommonFlags} -DOGL_DEBUG -g -Wall) + add_definitions(${CommonFlags} ${SDLFlags} -DOGL_DEBUG -g -Wall) endif(CMAKE_BUILD_TYPE STREQUAL Debug) # Devel - Build if(CMAKE_BUILD_TYPE STREQUAL Devel) - add_definitions(${CommonFlags} ${OptimizationFlags} -g -W) + add_definitions(${CommonFlags} ${SDLFlags} ${OptimizationFlags} -g -W) endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) - add_definitions(${CommonFlags} ${OptimizationFlags} -W) + add_definitions(${CommonFlags} ${SDLFlags} ${OptimizationFlags} -W) endif(CMAKE_BUILD_TYPE STREQUAL Release) set(GSdxSources diff --git a/plugins/GSdx/GSRenderer.cpp b/plugins/GSdx/GSRenderer.cpp index b5d434dcf8..89f9a4e934 100644 --- a/plugins/GSdx/GSRenderer.cpp +++ b/plugins/GSdx/GSRenderer.cpp @@ -27,6 +27,8 @@ GSRenderer::GSRenderer() , m_vt(this) , m_dev(NULL) , m_shader(0) + , m_shift_key(false) + , m_control_key(false) { m_GStitleInfoBuffer[0] = 0; @@ -407,6 +409,10 @@ void GSRenderer::VSync(int field) shift = !!(::GetAsyncKeyState(VK_SHIFT) & 0x8000); + #else + + shift = m_shift_key; + #endif if(!m_dump && shift) @@ -440,6 +446,10 @@ void GSRenderer::VSync(int field) control = !!(::GetAsyncKeyState(VK_CONTROL) & 0x8000); + #else + + control = m_control_key; + #endif m_dump.VSync(field, !control, m_regs); @@ -500,9 +510,9 @@ void GSRenderer::EndCapture() void GSRenderer::KeyEvent(GSKeyEventData* e) { +#ifdef _WINDOWS if(e->type == KEYPRESS) { - #ifdef _WINDOWS int step = (::GetAsyncKeyState(VK_SHIFT) & 0x8000) ? -1 : 1; @@ -534,12 +544,63 @@ void GSRenderer::KeyEvent(GSKeyEventData* e) return; } - #else - - // TODO: linux - - #endif } +#else + if(e->type == KEYPRESS) + { + int step = m_shift_key ? -1 : 1; + + switch(e->key) + { + case XK_F5: + m_interlace = (m_interlace + 7 + step) % 7; + fprintf(stderr, "GSdx: Set deinterlace mode to %d (%s).\n", (int)m_interlace, theApp.m_gs_interlace.at(m_interlace).name.c_str()); + return; + case XK_F6: + if( m_wnd.IsManaged() ) + m_aspectratio = (m_aspectratio + 3 + step) % 3; + return; + case XK_F7: + m_shader = (m_shader + 3 + step) % 3; + fprintf(stderr,"GSdx: Set shader %d.\n", (int)m_shader); + return; + case XK_Delete: + m_aa1 = !m_aa1; + fprintf(stderr,"GSdx: (Software) aa1 is now %s.\n", m_aa1 ? "enabled" : "disabled"); + return; + case XK_Insert: + m_mipmap = !m_mipmap; + fprintf(stderr,"GSdx: (Software) mipmapping is now %s.\n", m_mipmap ? "enabled" : "disabled"); + return; + case XK_Prior: + m_fxaa = !m_fxaa; + fprintf(stderr,"GSdx: fxaa is now %s.\n", m_fxaa ? "enabled" : "disabled"); + return; + case XK_Shift_L: + case XK_Shift_R: + m_shift_key = true; + return; + case XK_Control_L: + case XK_Control_R: + m_control_key = true; + return; + } + + } else if(e->type == KEYRELEASE) + { + switch(e->key) + { + case XK_Shift_L: + case XK_Shift_R: + m_shift_key = false; + return; + case XK_Control_L: + case XK_Control_R: + m_control_key = false; + return; + } + } +#endif } void GSRenderer::GetTextureMinMax(GSVector4i& r, const GIFRegTEX0& TEX0, const GIFRegCLAMP& CLAMP, bool linear) diff --git a/plugins/GSdx/GSRenderer.h b/plugins/GSdx/GSRenderer.h index 80d088f79a..8cc81a0ae0 100644 --- a/plugins/GSdx/GSRenderer.h +++ b/plugins/GSdx/GSRenderer.h @@ -37,6 +37,10 @@ class GSRenderer : public GSState bool Merge(int field); + // Only used on linux + bool m_shift_key; + bool m_control_key; + protected: int m_interlace; int m_aspectratio;