From c30ed92e758b7c1f1bc846220be2281a3969349a Mon Sep 17 00:00:00 2001 From: rice1964 Date: Sun, 6 Sep 2009 02:55:14 +0000 Subject: [PATCH] Add some command line options to directly specify plugins. You can use "dolphin /V Plugins/Plugin_Video???.dll" in the command line to start Dolphin with the ??? plugin. This can be done also for other plugins. There are a couple of reasons to do so. For example, Dolphin compiled in DEBUG would often crash if loaded with non-DEBUG plugins. Therefore, you may want use to DEBUG plugins when running the DEBUG dolphin by giving all the command switches. Also add some code to show the version of the plugin in the plugin configuration window title, so we can see clearly which version of the plugin we are using. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4208 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DolphinWX/Src/Main.cpp | 51 ++++++++++++++++++- .../Core/VideoCommon/Src/PixelShaderGen.cpp | 46 ++++++++--------- .../Plugin_VideoDX9/Src/DlgSettings.cpp | 12 ++++- .../Plugin_VideoOGL/Src/GUI/ConfigDlg.h | 8 +++ 4 files changed, 92 insertions(+), 25 deletions(-) diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index 92cf4d5552..4fe7b26732 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -93,7 +93,17 @@ bool DolphinApp::OnInit() bool UseDebugger = false; bool UseLogger = false; bool LoadElf = false; + bool selectVideoPlugin = false; + bool selectAudioPlugin = false; + bool selectPadPlugin = false; + bool selectWiimotePlugin = false; + wxString ElfFile; + wxString videoPluginFilename; + wxString audioPluginFilename; + wxString padPluginFilename; + wxString wiimotePluginFilename; + // Detect CPU info and write it to the cpu_info struct cpu_info.Detect(); @@ -207,6 +217,22 @@ bool DolphinApp::OnInit() wxCMD_LINE_OPTION, _T("e"), _T("elf"), _T("Loads an elf file"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, + { + wxCMD_LINE_OPTION, _T("V"), _T("video_plugin"),_T("Specify a video plugin"), + wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL + }, + { + wxCMD_LINE_OPTION, _T("A"), _T("audio_plugin"),_T("Specify an audio plugin"), + wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL + }, + { + wxCMD_LINE_OPTION, _T("P"), _T("pad_plugin"),_T("Specify a pad plugin"), + wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL + }, + { + wxCMD_LINE_OPTION, _T("W"), _T("wiimote_plugin"),_T("Specify a wiimote plugin"), + wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL + }, { wxCMD_LINE_NONE } @@ -270,12 +296,35 @@ bool DolphinApp::OnInit() if( LoadElf && ElfFile == wxEmptyString ) PanicAlert("You did not specify a file name"); + selectVideoPlugin = parser.Found(_T("video_plugin"), &videoPluginFilename); + selectAudioPlugin = parser.Found(_T("audio_plugin"), &audioPluginFilename); + selectPadPlugin = parser.Found(_T("pad_plugin"), &padPluginFilename); + selectWiimotePlugin = parser.Found(_T("wiimote_plugin"), &wiimotePluginFilename); + // ============ #endif // Load CONFIG_FILE settings SConfig::GetInstance().LoadSettings(); - + + if (selectVideoPlugin && videoPluginFilename != wxEmptyString) + { + SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin = std::string(videoPluginFilename.mb_str()); + } + if (selectAudioPlugin && audioPluginFilename != wxEmptyString) + { + SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin = std::string(audioPluginFilename.mb_str()); + } + if (selectPadPlugin && padPluginFilename != wxEmptyString) + { + SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[0] = std::string(padPluginFilename.mb_str()); + } + if (selectWiimotePlugin && wiimotePluginFilename != wxEmptyString) + { + SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[0] = std::string(wiimotePluginFilename.mb_str()); + } + + // Enable the PNG image handler wxInitAllImageHandlers(); diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index 285c18a772..25685dc9ca 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -529,7 +529,8 @@ const char *GeneratePixelShader(u32 texture_mask, bool dstAlphaEnable, bool HLSL { // alpha test will always fail, so restart the shader and just make it an empty function p = pmainstart; - WRITE(p, "discard;\n"); + WRITE(p, HLSL ? "clip(-1);" : "discard;\n"); + //WRITE(p, "discard;\n"); WRITE(p, "ocol0 = 0;\n"); } else @@ -959,32 +960,31 @@ static void WriteFog(char *&p) //WRITE (p, " float fog = clamp(ze - "I_FOG"[1].z, 0.0f, 1.0f);\n"); WRITE (p, " float fog = saturate(ze - "I_FOG"[1].z);\n"); - } - switch (bpmem.fog.c_proj_fsel.fsel) - { + switch (bpmem.fog.c_proj_fsel.fsel) + { case 0: // TODO - No fog? break; - case 2: // linear - // empty - break; - case 4: // exp - WRITE(p, " fog = 1.0f - pow(2, -8.0f * fog);\n"); - break; - case 5: // exp2 - WRITE(p, " fog = 1.0f - pow(2, -8.0f * fog * fog);\n"); - break; - case 6: // backward exp - WRITE(p, " fog = 1.0f - fog;\n"); - WRITE(p, " fog = pow(2, -8.0f * fog);\n"); - break; - case 7: // backward exp2 - WRITE(p, " fog = 1.0f - fog;\n"); - WRITE(p, " fog = pow(2, -8.0f * fog * fog);\n"); - break; + case 2: // linear + // empty + break; + case 4: // exp + WRITE(p, " fog = 1.0f - pow(2, -8.0f * fog);\n"); + break; + case 5: // exp2 + WRITE(p, " fog = 1.0f - pow(2, -8.0f * fog * fog);\n"); + break; + case 6: // backward exp + WRITE(p, " fog = 1.0f - fog;\n"); + WRITE(p, " fog = pow(2, -8.0f * fog);\n"); + break; + case 7: // backward exp2 + WRITE(p, " fog = 1.0f - fog;\n"); + WRITE(p, " fog = pow(2, -8.0f * fog * fog);\n"); + break; default: WARN_LOG(VIDEO, "Unknown Fog Type! %08x", bpmem.fog.c_proj_fsel.fsel); - } + } - if (enabled) WRITE(p, " prev.rgb = (1.0f - fog) * prev.rgb + (fog * "I_FOG"[0].rgb);\n"); + } } diff --git a/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.cpp b/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.cpp index b296af535a..9f5cb106fa 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.cpp @@ -229,7 +229,17 @@ void DlgSettings_Show(HINSTANCE hInstance, HWND _hParent) sheet.Add(new TabDirect3D,(LPCTSTR)IDD_SETTINGS,_T("Direct3D")); sheet.Add(new TabEnhancements,(LPCTSTR)IDD_ENHANCEMENTS,_T("Enhancements")); sheet.Add(new TabAdvanced,(LPCTSTR)IDD_ADVANCED,_T("Advanced")); - sheet.Show(hInstance,_hParent,_T("Graphics Plugin")); + +#ifdef DEBUGFAST + sheet.Show(hInstance,_hParent,_T("DX9 Graphics Plugin (DEBUGFAST)")); +#else +#ifndef _DEBUG + sheet.Show(hInstance,_hParent,_T("DX9 Graphics Plugin")); +#else + sheet.Show(hInstance,_hParent,_T("DX9 Graphics Plugin (DEBUG)")); +#endif +#endif + g_Config.Save(); if(( tfoe != g_Config.bTexFmtOverlayEnable) || diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h index f8f5b7ea06..c90135eea6 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h @@ -49,7 +49,15 @@ class GFXConfigDialogOGL : public wxDialog { public: GFXConfigDialogOGL(wxWindow *parent, wxWindowID id = 1, +#ifdef DEBUGFAST + const wxString &title = wxT("OpenGL (DEBUGFAST) Plugin Configuration"), +#else +#ifndef _DEBUG const wxString &title = wxT("OpenGL Plugin Configuration"), +#else + const wxString &title = wxT("OpenGL (DEBUG) Plugin Configuration"), +#endif +#endif const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE);