diff --git a/pcsx2/MTGS.cpp b/pcsx2/MTGS.cpp index 5d0c5d6b19..a1fc1b44a7 100644 --- a/pcsx2/MTGS.cpp +++ b/pcsx2/MTGS.cpp @@ -471,7 +471,7 @@ struct PacketTagType u32 command; u32 data[3]; }; - +extern bool renderswitch; int mtgsThreadObject::Callback() { Console::WriteLn("MTGS > Thread Started, Opening GS Plugin..."); @@ -479,8 +479,11 @@ int mtgsThreadObject::Callback() memcpy_aligned( m_gsMem, PS2MEM_GS, sizeof(m_gsMem) ); GSsetBaseMem( m_gsMem ); GSirqCallback( NULL ); - - m_returncode = GSopen((void *)&pDsp, "PCSX2", 1); + + //tells GSdx to go into dx9 sw if "renderswitch" is set. Abusing the isMultiThread int + //for that so we don't need a new callback + if (!renderswitch) m_returncode = GSopen((void *)&pDsp, "PCSX2", 1); + else if (renderswitch) m_returncode = GSopen((void *)&pDsp, "PCSX2", 2); Console::WriteLn( "MTGS > GSopen Finished, return code: 0x%x", params m_returncode ); diff --git a/pcsx2/windows/WinSysExec.cpp b/pcsx2/windows/WinSysExec.cpp index 7d0ddf5ec3..0c966f237e 100644 --- a/pcsx2/windows/WinSysExec.cpp +++ b/pcsx2/windows/WinSysExec.cpp @@ -27,6 +27,7 @@ static bool sinit = false; bool UseGui = true; bool nDisableSC = false; // screensaver +bool renderswitch = 0; // This instance is not modified by command line overrides so @@ -427,7 +428,7 @@ namespace HostGui 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_F9: case VK_F10: case VK_F11: case VK_F12: + case VK_F9: case VK_F10: case VK_F12: try { ProcessFKeys(ev->key-VK_F1 + 1, shiftkey); @@ -441,7 +442,25 @@ namespace HostGui SysEndExecution(); } break; - + + case VK_F11: //gsdx "on the fly" renderer switching + if (!renderswitch) { + StateRecovery::MakeGsOnly(); + g_EmulationInProgress = false; + ClosePlugins( 1 ); + renderswitch = true; //go to dx9 sw + StateRecovery::Recover(); + HostGui::BeginExecution(); //also sets g_EmulationInProgress to true later + } + else { + StateRecovery::MakeGsOnly(); + g_EmulationInProgress = false; + ClosePlugins( 1 ); + renderswitch = false; //return to default renderer + StateRecovery::Recover(); + HostGui::BeginExecution(); //also sets g_EmulationInProgress to true later + } + break; case VK_TAB: CycleFrameLimit(0); break; diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index 062fbd24c2..996454189a 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -154,9 +154,15 @@ static INT32 GSopen(void* dsp, char* title, int mt, int renderer) EXPORT_C_(INT32) GSopen(void* dsp, char* title, int mt) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); - - int renderer = AfxGetApp()->GetProfileInt(_T("Settings"), _T("renderer"), 0); - + int renderer; + + if (mt == 2){ //pcsx2 sent a switch renderer request + renderer = 1; //DX9 sw + mt = 1; + } + else { //normal init + renderer = AfxGetApp()->GetProfileInt(_T("Settings"), _T("renderer"), 0); + } return GSopen(dsp, title, mt, renderer); }