From dd793a11ef8d916ed41d208a1f61eeadeaf229cb Mon Sep 17 00:00:00 2001 From: Sonicadvance1 Date: Mon, 4 Aug 2008 21:29:56 +0000 Subject: [PATCH] GL plugin now dumps textures in correct format, you can enable texture dumping in the settings but you have to set the directory in the ini file git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@130 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp | 18 +++++++----------- .../Plugin_VideoOGL/Src/GUI/ConfigDlg.h | 7 +++++-- Source/Plugins/Plugin_VideoOGL/Src/Globals.cpp | 2 +- .../Plugin_VideoOGL/Src/TextureMngr.cpp | 2 +- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp index ed9b28afb7..cc5b64a8f4 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp @@ -25,7 +25,6 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog) EVT_BUTTON(ID_CLOSE,ConfigDialog::OKClick) EVT_BUTTON(ID_APPLY,ConfigDialog::OKClick) EVT_BUTTON(ID_OK,ConfigDialog::OKClick) - EVT_BUTTON(ID_BROWSE,ConfigDialog::BrowseClick) END_EVENT_TABLE() @@ -94,7 +93,7 @@ void ConfigDialog::CreateGUIControls() m_Wireframe->Enable(false); m_DumpTextures = new wxCheckBox(m_PageAdvanced, ID_DUMPTEXTURES, wxT("Dump texture to:"), wxPoint(12,88), wxSize(233,25), 0, wxDefaultValidator, wxT("DumpTextures")); - m_DumpTextures->Enable(false); + m_DumpTextures->SetValue(g_Config.bDumpTextures); m_Statistics = new wxCheckBox(m_PageAdvanced, ID_STATISTICS, wxT("Overlay some statistics"), wxPoint(12,40), wxSize(233,25), 0, wxDefaultValidator, wxT("Statistics")); m_Statistics->SetValue(g_Config.bOverlayStats); @@ -102,13 +101,11 @@ void ConfigDialog::CreateGUIControls() m_ShaderErrors = new wxCheckBox(m_PageAdvanced, ID_SHADERERRORS, wxT("Show shader compilation issues"), wxPoint(12,64), wxSize(233,25), 0, wxDefaultValidator, wxT("ShaderErrors")); m_ShaderErrors->Enable(false); - - m_Browse = new wxButton(m_PageAdvanced, ID_BROWSE, wxT("Browse"), wxPoint(156,136), wxSize(65,25), 0, wxDefaultValidator, wxT("Browse")); + + m_Browse = new wxDirPickerCtrl( m_PageAdvanced, wxID_ANY, wxT("path"), wxT("Select a folder"), wxPoint(12,136), wxSize(233,25), wxDIRP_DEFAULT_STYLE ); + //m_Browse->SetPath(wxString::FromAscii(g_Config.texDumpPath)); m_Browse->Enable(false); - m_TexturePath = new wxTextCtrl(m_PageAdvanced, ID_TEXTUREPATH, wxT("TexturePath"), wxPoint(20,136), wxSize(129,25), 0, wxDefaultValidator, wxT("TexturePath")); - m_TexturePath->Enable(false); - SetTitle(wxT("Opengl Plugin Configuration")); SetIcon(wxNullIcon); SetSize(8,8,492,273); @@ -118,6 +115,7 @@ void ConfigDialog::CreateGUIControls() m_Statistics->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( ConfigDialog::OverlayCheck ), NULL, this ); m_FullscreenCB->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( ConfigDialog::FSCB ), NULL, this ); m_WindowResolutionCB->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( ConfigDialog::WMCB ), NULL, this ); + m_Browse->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( ConfigDialog::BrowseChange ), NULL, this ); } void ConfigDialog::OnClose(wxCloseEvent& /*event*/) @@ -131,9 +129,9 @@ void ConfigDialog::ConfigDialogActivate(wxActivateEvent& event) // init dialog elements from config } -void ConfigDialog::BrowseClick(wxCommandEvent& event) +void ConfigDialog::BrowseChange( wxFileDirPickerEvent& event ) { - // browse for folder + // Doesn't trigger an Event...Oh well // } void ConfigDialog::OKClick(wxCommandEvent& event) @@ -141,8 +139,6 @@ void ConfigDialog::OKClick(wxCommandEvent& event) if ((event.GetId() == ID_APPLY) || (event.GetId() == ID_OK)) { - g_Config.renderToMainframe = m_RenderToMainWindow->GetValue(); - g_Config.bFullscreen = m_Fullscreen->GetValue(); g_Config.Save(); } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h index bdb85968c0..03ced16cee 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h @@ -27,6 +27,9 @@ #include #include #include +#include +#include +#include #undef ConfigDialog_STYLE @@ -42,7 +45,7 @@ class ConfigDialog : public wxDialog ConfigDialog(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Opengl Plugin Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = ConfigDialog_STYLE); virtual ~ConfigDialog(); void ConfigDialogActivate(wxActivateEvent& event); - void BrowseClick(wxCommandEvent& event); + void BrowseChange( wxFileDirPickerEvent& event ); void OKClick(wxCommandEvent& event); void AddFSReso(char *reso); void AddWindowReso(char *reso); @@ -58,7 +61,7 @@ class ConfigDialog : public wxDialog wxButton *m_Apply; wxButton *m_OK; wxTextCtrl *m_TexturePath; - wxButton *m_Browse; + wxDirPickerCtrl *m_Browse; wxCheckBox *m_ShaderErrors; wxCheckBox *m_Statistics; wxCheckBox *m_DumpTextures; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Globals.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Globals.cpp index 35b10de80f..7d5873eb47 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Globals.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Globals.cpp @@ -295,7 +295,7 @@ bool SaveTexture(const char* filename, u32 textarget, u32 tex, int width, int he GL_REPORT_ERRORD(); std::vector data(width*height); glBindTexture(textarget, tex); - glGetTexImage(textarget, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data[0]); + glGetTexImage(textarget, 0, GL_BGRA, GL_UNSIGNED_BYTE, &data[0]); GLenum err; GL_REPORT_ERROR(); if (err != GL_NO_ERROR) { diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp b/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp index b369d37070..4bcfe7a93f 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp @@ -276,7 +276,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width if (g_Config.bDumpTextures) { // dump texture to file static int counter = 0; char szTemp[MAX_PATH]; - sprintf(szTemp, "%s\\txt_%04i_%i.png", g_Config.texDumpPath, counter++, format); + sprintf(szTemp, "%s/txt_%04i_%i.tga", g_Config.texDumpPath, counter++, format); SaveTexture(szTemp,target, entry.texture, width, height); }