added overlay that displays texture formats (thanks to gigaherz!)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@139 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2008-08-06 01:08:02 +00:00
parent 94a5ab087a
commit a44e94a594
13 changed files with 2303 additions and 53 deletions

File diff suppressed because it is too large Load Diff

View File

@ -76,4 +76,6 @@ enum PC_TexFormat
PC_TexFormat TexDecoder_Decode(u8 *dst, u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt);
void TexDecoder_SetTexFmtOverlayOptions(bool enable, bool center);
#endif

View File

@ -9,6 +9,8 @@
#include "Globals.h"
#include "TextureCache.h"
#define NUMWNDRES 6
int g_Res[NUMWNDRES][2] =
{
@ -105,6 +107,9 @@ struct TabAdvanced : public W32Util::Tab
Button_SetCheck(GetDlgItem(hDlg,IDC_TEXDUMP), g_Config.bDumpTextures);
Button_SetCheck(GetDlgItem(hDlg,IDC_SHOWSHADERERRORS), g_Config.bShowShaderErrors);
Button_SetCheck(GetDlgItem(hDlg,IDC_TEXFMT_OVERLAY), g_Config.bTexFmtOverlayEnable);
Button_SetCheck(GetDlgItem(hDlg,IDC_TEXFMT_CENTER), g_Config.bTexFmtOverlayCenter);
SetWindowText(GetDlgItem(hDlg,IDC_TEXDUMPPATH),g_Config.texDumpPath.c_str());
Edit_LimitText(GetDlgItem(hDlg,IDC_TEXDUMPPATH),255);
}
@ -124,6 +129,9 @@ struct TabAdvanced : public W32Util::Tab
}
void Apply(HWND hDlg)
{
g_Config.bTexFmtOverlayEnable = Button_GetCheck(GetDlgItem(hDlg,IDC_TEXFMT_OVERLAY)) ? true : false;
g_Config.bTexFmtOverlayCenter = Button_GetCheck(GetDlgItem(hDlg,IDC_TEXFMT_CENTER)) ? true : false;
g_Config.bOverlayStats = Button_GetCheck(GetDlgItem(hDlg,IDC_OVERLAYSTATS)) ? true : false;
g_Config.bWireFrame = Button_GetCheck(GetDlgItem(hDlg,IDC_WIREFRAME)) ? true : false;
g_Config.bDumpTextures = Button_GetCheck(GetDlgItem(hDlg,IDC_TEXDUMP)) ? true : false;
@ -195,6 +203,9 @@ struct TabEnhancements : public W32Util::Tab
void DlgSettings_Show(HINSTANCE hInstance, HWND _hParent)
{
bool tfoe = g_Config.bTexFmtOverlayEnable;
bool tfoc = g_Config.bTexFmtOverlayCenter;
g_Config.Load();
W32Util::PropSheet sheet;
sheet.Add(new TabDirect3D,(LPCTSTR)IDD_SETTINGS,"Direct3D");
@ -203,4 +214,10 @@ void DlgSettings_Show(HINSTANCE hInstance, HWND _hParent)
//sheet.Add(new TabDebug,(LPCTSTR)IDD_DEBUGGER,"Debugger");
sheet.Show(hInstance,_hParent,"Graphics Plugin");
g_Config.Save();
if(( tfoe != g_Config.bTexFmtOverlayEnable) ||
((g_Config.bTexFmtOverlayEnable) && ( tfoc != g_Config.bTexFmtOverlayCenter)))
{
TextureCache::Invalidate();
}
}

View File

@ -28,8 +28,12 @@ void Config::Load()
iniFile.Get("Settings", "Multisample", &iMultisampleMode, 0);
iniFile.Get("Settings", "TexDumpPath", &texDumpPath, 0);
iniFile.Get("Settings", "TexFmtOverlayEnable", &bTexFmtOverlayEnable, 0);
iniFile.Get("Settings", "TexFmtOverlayCenter", &bTexFmtOverlayCenter, 0);
iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, 0);
iniFile.Get("Enhancements", "ForceMaxAniso", &bForceMaxAniso, 0);
}
void Config::Save()
@ -52,6 +56,9 @@ void Config::Save()
iniFile.Set("Settings", "Multisample", iMultisampleMode);
iniFile.Set("Settings", "TexDumpPath", texDumpPath);
iniFile.Set("Settings", "TexFmtOverlayEnable", bTexFmtOverlayEnable);
iniFile.Set("Settings", "TexFmtOverlayCenter", bTexFmtOverlayCenter);
iniFile.Set("Enhancements", "ForceFiltering", bForceFiltering);
iniFile.Set("Enhancements", "ForceMaxAniso", bForceMaxAniso);
iniFile.Save("gfx_dx9.ini");

View File

@ -39,6 +39,9 @@ struct Config
char psProfile[16];
char vsProfile[16];
bool bTexFmtOverlayEnable;
bool bTexFmtOverlayCenter;
std::string texDumpPath;
};

View File

@ -29,6 +29,7 @@ void TextureCache::TCacheEntry::Destroy()
void TextureCache::Init()
{
temp = (u8*)VirtualAlloc(0,TEMP_SIZE,MEM_COMMIT,PAGE_READWRITE);
TexDecoder_SetTexFmtOverlayOptions(g_Config.bTexFmtOverlayEnable,g_Config.bTexFmtOverlayCenter);
}
void TextureCache::Invalidate()
@ -37,6 +38,7 @@ void TextureCache::Invalidate()
for (;iter!=textures.end();iter++)
iter->second.Destroy();
textures.clear();
TexDecoder_SetTexFmtOverlayOptions(g_Config.bTexFmtOverlayEnable,g_Config.bTexFmtOverlayCenter);
}
void TextureCache::Shutdown()

View File

@ -51,6 +51,9 @@
#define IDC_FORCEFILTERING 1030
#define IDC_BROWSETEXDUMPPATH 1031
#define IDC_SHOWSHADERERRORS 1033
#define IDC_CHECK3 1034
#define IDC_TEXFMT_CENTER 1034
#define IDC_TEXFMT_OVERLAY 1035
// Next default values for new objects
//
@ -58,7 +61,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 106
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1034
#define _APS_NEXT_CONTROL_VALUE 1036
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -107,7 +107,7 @@ BEGIN
CONTROL "",IDC_REGISTERSELECT,"SysTabControl32",TCS_BUTTONS,80,52,145,13
END
IDD_ADVANCED DIALOGEX 0, 0, 206, 144
IDD_ADVANCED DIALOGEX 0, 0, 206, 175
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
@ -122,6 +122,9 @@ BEGIN
PUSHBUTTON "...",IDC_BROWSETEXDUMPPATH,176,116,14,13
CONTROL "Show s&hader compilation errors",IDC_SHOWSHADERERRORS,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,43,127,9
GROUPBOX "TexFmt Overlay",IDC_STATIC,7,138,192,30
CONTROL "Enable Overlay",IDC_TEXFMT_OVERLAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,150,74,10
CONTROL "Centered",IDC_TEXFMT_CENTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,150,82,10
END
IDD_ENHANCEMENTS DIALOGEX 0, 0, 207, 175
@ -185,8 +188,10 @@ BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 199
VERTGUIDE, 14
VERTGUIDE, 110
TOPMARGIN, 7
BOTTOMMARGIN, 137
BOTTOMMARGIN, 168
HORZGUIDE, 150
END
IDD_ENHANCEMENTS, DIALOG
@ -215,4 +220,3 @@ END
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -19,10 +19,11 @@
#include "ConfigDlg.h"
#include "../Globals.h"
#include "TextureMngr.h"
BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
EVT_CLOSE(ConfigDialog::OnClose)
EVT_BUTTON(ID_CLOSE,ConfigDialog::OKClick)
EVT_BUTTON(ID_APPLY,ConfigDialog::OKClick)
EVT_BUTTON(ID_CANCEL,ConfigDialog::OKClick)
EVT_BUTTON(ID_OK,ConfigDialog::OKClick)
EVT_CHECKBOX(ID_FULLSCREEN,ConfigDialog::FullScreenCheck)
EVT_CHECKBOX(ID_RENDERTOMAINWINDOW,ConfigDialog::RenderMainCheck)
@ -33,6 +34,8 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
EVT_CHECKBOX(ID_WIREFRAME,ConfigDialog::WireframeCheck)
EVT_CHECKBOX(ID_STATISTICS,ConfigDialog::OverlayCheck)
EVT_CHECKBOX(ID_SHADERERRORS,ConfigDialog::ShowShaderErrorsCheck)
EVT_CHECKBOX(ID_TEXFMTOVERLAY,ConfigDialog::TexFmtOverlayChange)
EVT_CHECKBOX(ID_TEXFMTCENTER,ConfigDialog::TexFmtOverlayChange)
EVT_CHECKBOX(ID_DUMPTEXTURES,ConfigDialog::DumpTexturesChange)
EVT_DIRPICKER_CHANGED(ID_TEXTUREPATH,ConfigDialog::TexturePathChange)
END_EVENT_TABLE()
@ -41,7 +44,6 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl
: wxDialog(parent, id, title, position, size, style)
{
g_Config.Load();
CreateGUIControls();
}
@ -63,17 +65,15 @@ void ConfigDialog::CreateGUIControls()
m_Notebook->AddPage(m_PageAdvanced, wxT("Advanced"));
//buttons
m_Close = new wxButton(this, ID_CLOSE, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Apply = new wxButton(this, ID_APPLY, wxT("Apply"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_OK = new wxButton(this, ID_OK, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Cancel = new wxButton(this, ID_CANCEL, wxT("Cancel"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
//put notebook and buttons in sizers
wxBoxSizer* sButtons;
sButtons = new wxBoxSizer(wxHORIZONTAL);
sButtons->Add(0, 0, 1, wxEXPAND, 5);
sButtons->Add(m_Close, 0, wxALL, 5);
sButtons->Add(m_Apply, 0, wxALL, 5);
sButtons->Add(m_OK, 0, wxALL, 5);
sButtons->Add(m_Cancel, 0, wxALL, 5);
wxBoxSizer* sMain;
sMain = new wxBoxSizer(wxVERTICAL);
@ -106,6 +106,12 @@ void ConfigDialog::CreateGUIControls()
m_Statistics = new wxCheckBox(m_PageAdvanced, ID_STATISTICS, wxT("Overlay some statistics"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Statistics->SetValue(g_Config.bOverlayStats);
m_TexFmtOverlay = new wxCheckBox(m_PageAdvanced, ID_TEXFMTOVERLAY, wxT("Overlay texture format"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_TexFmtOverlay->SetValue(g_Config.bTexFmtOverlayEnable);
m_TexFmtCenter = new wxCheckBox(m_PageAdvanced, ID_TEXFMTCENTER, wxT("centered"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_TexFmtCenter->SetValue(g_Config.bTexFmtOverlayCenter);
m_TexFmtCenter->Enable(m_TexFmtOverlay->IsChecked());
m_DumpTextures = new wxCheckBox(m_PageAdvanced, ID_DUMPTEXTURES, wxT("Dump textures to:"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_DumpTextures->SetValue(g_Config.bDumpTextures);
m_TexturePath = new wxDirPickerCtrl(m_PageAdvanced, ID_TEXTUREPATH, wxEmptyString, wxT("Choose a directory to store texture dumps:"), wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL);
@ -130,7 +136,7 @@ void ConfigDialog::CreateGUIControls()
//m_ShaderErrors->SetValue(g_Config.bShowShaderErrors);
m_ShaderErrors->Enable(false);
//Put options in sizers in the notebook
//Put options in sizers within the notebook
wxGridBagSizer* sPage1;
sPage1 = new wxGridBagSizer(0, 0);
sPage1->SetFlexibleDirection(wxBOTH);
@ -153,13 +159,17 @@ void ConfigDialog::CreateGUIControls()
m_PageEnhancements->SetSizer(sPage2);
sPage2->Layout();
wxBoxSizer* sPage3;
sPage3 = new wxBoxSizer(wxVERTICAL);
sPage3->Add(m_Wireframe, 0, wxALL, 5);
sPage3->Add(m_Statistics, 0, wxALL, 5);
sPage3->Add(m_ShaderErrors, 0, wxALL, 5);
sPage3->Add(m_DumpTextures, 0, wxALL, 5);
sPage3->Add(m_TexturePath, 0, wxALL, 5);
wxGridBagSizer* sPage3;
sPage3 = new wxGridBagSizer(0, 0);
sPage3->SetFlexibleDirection(wxBOTH);
sPage3->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
sPage3->Add(m_Wireframe, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 5);
sPage3->Add(m_ShaderErrors, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALL, 5);
sPage3->Add(m_Statistics, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALL, 5);
sPage3->Add(m_TexFmtOverlay, wxGBPosition(3, 0), wxGBSpan(1, 1), wxALL, 5);
sPage3->Add(m_TexFmtCenter, wxGBPosition(3, 1), wxGBSpan(1, 1), wxALL, 5);
sPage3->Add(m_DumpTextures, wxGBPosition(4, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sPage3->Add(m_TexturePath, wxGBPosition(4, 1), wxGBSpan(2, 1), wxALL, 5);
m_PageAdvanced->SetSizer(sPage3);
sPage3->Layout();
@ -169,23 +179,20 @@ void ConfigDialog::CreateGUIControls()
void ConfigDialog::OnClose(wxCloseEvent& event)
{
g_Config.Save();
EndModal(0);
}
void ConfigDialog::OKClick(wxCommandEvent& event)
{
if ((event.GetId() == ID_APPLY) ||
(event.GetId() == ID_OK))
{
g_Config.Save();
}
if ((event.GetId() == ID_CLOSE) ||
(event.GetId() == ID_OK))
switch(event.GetId())
{
case ID_CANCEL:
Close();
break;
case ID_OK:
g_Config.Save();
Close();
break;
}
}
@ -232,14 +239,36 @@ void ConfigDialog::WireframeCheck(wxCommandEvent& event)
{
g_Config.bWireFrame = m_Wireframe->IsChecked();
}
void ConfigDialog::ShowShaderErrorsCheck(wxCommandEvent& event)
{
g_Config.bShowShaderErrors = m_ShaderErrors->IsChecked();
}
void ConfigDialog::OverlayCheck(wxCommandEvent& event)
{
g_Config.bOverlayStats = m_Statistics->IsChecked();
}
void ConfigDialog::ShowShaderErrorsCheck(wxCommandEvent& event)
void ConfigDialog::TexFmtOverlayChange(wxCommandEvent& event)
{
g_Config.bShowShaderErrors = m_ShaderErrors->IsChecked();
switch(event.GetId())
{
case ID_TEXFMTOVERLAY:
g_Config.bTexFmtOverlayEnable = m_TexFmtOverlay->IsChecked();
m_TexFmtCenter->Enable(m_TexFmtOverlay->IsChecked());
TextureMngr::Invalidate();
if(!g_Config.bTexFmtOverlayEnable)
m_TexFmtCenter->SetValue(false);
else
return;
break;
case ID_TEXFMTCENTER:
g_Config.bTexFmtOverlayCenter = m_TexFmtCenter->IsChecked();
TextureMngr::Invalidate();
break;
}
}
void ConfigDialog::DumpTexturesChange(wxCommandEvent& event)

View File

@ -56,18 +56,20 @@ class ConfigDialog : public wxDialog
void WireframeCheck(wxCommandEvent& event);
void OverlayCheck(wxCommandEvent& event);
void ShowShaderErrorsCheck(wxCommandEvent& event);
void TexFmtOverlayChange(wxCommandEvent& event);
void DumpTexturesChange(wxCommandEvent& event);
void TexturePathChange(wxFileDirPickerEvent& event);
private:
wxButton *m_Close;
wxButton *m_Apply;
wxButton *m_Cancel;
wxButton *m_OK;
wxDirPickerCtrl *m_TexturePath;
wxCheckBox *m_ShaderErrors;
wxCheckBox *m_Statistics;
wxCheckBox *m_DumpTextures;
wxCheckBox *m_TexFmtCenter;
wxCheckBox *m_TexFmtOverlay;
wxCheckBox *m_Statistics;
wxCheckBox *m_ShaderErrors;
wxCheckBox *m_Wireframe;
wxCheckBox *m_ForceAnisotropy;
wxCheckBox *m_ForceFiltering;
@ -86,12 +88,12 @@ class ConfigDialog : public wxDialog
enum
{
////GUI Enum Control ID Start
ID_CLOSE = 1030,
ID_APPLY = 1029,
ID_CANCEL = 1030,
ID_OK = 1028,
ID_TEXTUREPATH = 1026,
ID_BROWSE = 1025,
ID_SHADERERRORS = 1024,
ID_TEXTUREPATH = 1027,
ID_SHADERERRORS = 1026,
ID_TEXFMTCENTER = 1025,
ID_TEXFMTOVERLAY = 1024,
ID_STATISTICS = 1023,
ID_DUMPTEXTURES = 1022,
ID_WIREFRAME = 1021,

View File

@ -68,6 +68,9 @@ void Config::Load()
texDumpPath[sizeof(texDumpPath)-1] = 0;
}
iniFile.Get("Settings", "TexFmtOverlayEnable", &bTexFmtOverlayEnable, 0);
iniFile.Get("Settings", "TexFmtOverlayCenter", &bTexFmtOverlayCenter, 0);
iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, 0);
iniFile.Get("Enhancements", "ForceMaxAniso", &bForceMaxAniso, 0);
}
@ -90,6 +93,9 @@ void Config::Save()
iniFile.Set("Settings", "Multisample", iMultisampleMode);
iniFile.Set("Settings", "TexDumpPath", texDumpPath);
iniFile.Set("Settings", "TexFmtOverlayEnable", bTexFmtOverlayEnable);
iniFile.Set("Settings", "TexFmtOverlayCenter", bTexFmtOverlayCenter);
iniFile.Set("Enhancements", "ForceFiltering", bForceFiltering);
iniFile.Set("Enhancements", "ForceMaxAniso", bForceMaxAniso);
iniFile.Save("gfx_opengl.ini");

View File

@ -176,6 +176,9 @@ struct Config
char psProfile[16];
char vsProfile[16];
bool bTexFmtOverlayEnable;
bool bTexFmtOverlayCenter;
int iSaveTargetId;
char texDumpPath[280];

View File

@ -87,6 +87,7 @@ void TextureMngr::Init()
{
temp = (u8*)AllocateMemoryPages(TEMP_SIZE);
nTex2DEnabled = nTexRECTEnabled = 0;
TexDecoder_SetTexFmtOverlayOptions(g_Config.bTexFmtOverlayEnable,g_Config.bTexFmtOverlayCenter);
}
void TextureMngr::Invalidate()
@ -95,6 +96,7 @@ void TextureMngr::Invalidate()
for (;iter!=textures.end();iter++)
iter->second.Destroy();
textures.clear();
TexDecoder_SetTexFmtOverlayOptions(g_Config.bTexFmtOverlayEnable,g_Config.bTexFmtOverlayCenter);
}
void TextureMngr::Shutdown()