remove stuff from ogl debugger that did nothing. (copied from dsp hle a while ago)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2111 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-02-04 17:33:59 +00:00
parent ad88b27c76
commit 7b7cfa940e
18 changed files with 194 additions and 985 deletions

View File

@ -853,26 +853,10 @@
RelativePath=".\Src\Debugger\Debugger.h"
>
</File>
<File
RelativePath=".\Src\Debugger\PBView.cpp"
>
</File>
<File
RelativePath=".\Src\Debugger\PBView.h"
>
</File>
</Filter>
<Filter
Name="Logging"
>
<File
RelativePath=".\Src\Debugger\Logging.cpp"
>
</File>
<File
RelativePath=".\Src\Debugger\Logging.h"
>
</File>
<File
RelativePath=".\Src\rasterfont.cpp"
>

View File

@ -18,12 +18,12 @@
#ifndef _CONFIG_H
#define _CONFIG_H
// Log in two categories, andsave three other options in the same byte
#define CONF_LOG 1
#define CONF_PRIMLOG 2
#define CONF_SAVETEXTURES 4
#define CONF_SAVETARGETS 8
#define CONF_SAVESHADERS 16
// Log in two categories, and save three other options in the same byte
#define CONF_LOG 1
#define CONF_PRIMLOG 2
#define CONF_SAVETEXTURES 4
#define CONF_SAVETARGETS 8
#define CONF_SAVESHADERS 16
struct Config
{

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -15,464 +15,180 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "../Globals.h" // The precompiled header
#include "IniFile.h" // Common
#include "ConsoleWindow.h" // Move console window
#include "../Config.h" // Config settings
#include "PBView.h" // Debugger files
#include "../Globals.h" // The precompiled header
#include "IniFile.h" // Common
#include "ConsoleWindow.h" // Move console window
#include "../Config.h" // Config settings
#include "Debugger.h"
#include "Logging.h" // Open and close console
extern int gPreset;
int A, B;
// Event table and class
BEGIN_EVENT_TABLE(CDebugger,wxDialog)
EVT_SHOW(CDebugger::OnShow)
EVT_CLOSE(CDebugger::OnClose)
EVT_BUTTON(ID_UPD,CDebugger::OnUpdate)
EVT_CHECKBOX(ID_SAVETOFILE,CDebugger::GeneralSettings) // General settings
EVT_CHECKBOX(ID_SAVETOFILE,CDebugger::GeneralSettings)
EVT_CHECKBOX(ID_SHOWCONSOLE,CDebugger::GeneralSettings)
EVT_CHECKLISTBOX(ID_CHECKLIST1, CDebugger::LogSettings) // Check list box
EVT_RADIOBOX(IDC_RADIO1, CDebugger::ChangeFrequency) // Update freq.
EVT_BUTTON(ID_AP,CDebugger::Ap)
EVT_BUTTON(ID_AM,CDebugger::Am)
EVT_BUTTON(ID_BP,CDebugger::Bp)
EVT_BUTTON(ID_BM,CDebugger::Bm)
EVT_CHECKBOX(ID_INFOLOG,CDebugger::GeneralSettings)
EVT_CHECKBOX(ID_PRIMLOG,CDebugger::GeneralSettings)
EVT_CHECKBOX(ID_SAVETEXTURES,CDebugger::GeneralSettings)
EVT_CHECKBOX(ID_SAVETARGETS,CDebugger::GeneralSettings)
EVT_CHECKBOX(ID_SAVESHADERS,CDebugger::GeneralSettings)
END_EVENT_TABLE()
CDebugger::CDebugger(wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style)
, m_GPRListView(NULL)
{
CreateGUIControls();
// load ini...
IniFile file;
file.Load(DEBUGGER_CONFIG_FILE);
this->Load(file);
LoadSettings();
DoShowHideConsole();
}
CDebugger::~CDebugger()
{
// empty
IniFile file;
file.Load(DEBUGGER_CONFIG_FILE);
this->Save(file);
file.Save(DEBUGGER_CONFIG_FILE);
}
// System functions
void CDebugger::OnShow(wxShowEvent& /*event*/)
{
// bring the console back to
if(m_Check[2]->IsChecked())
{
OpenConsole();
#ifdef _WIN32
MoveWindow(Console::GetHwnd(), 0,400, 1280,500, true); // Move window TODO: make this
// adjustable from the debugging window
#endif
}
SaveSettings();
}
void CDebugger::OnClose(wxCloseEvent& /*event*/)
void CDebugger::OnClose(wxCloseEvent& event)
{
// save the window position when we hide the window to
IniFile file;
file.Load(DEBUGGER_CONFIG_FILE);
this->Save(file);
file.Save(DEBUGGER_CONFIG_FILE);
// save the window position when we hide the window
SaveSettings();
EndModal(0); // it seems like this works for Show() to, not just ShowModal();
event.Skip(); // This means wxDialog's Destroy is used
CloseConsole(); // The console goes with the wx window
}
void CDebugger::DoHide()
void CDebugger::DoShowHideConsole()
{
Hide();
CloseConsole(); // The console goes with the wx window
}
void CDebugger::DoShow()
{
Show();
DoShowHideConsole(); // The console goes with the wx window
}
void CDebugger::OnUpdate(wxCommandEvent& /*event*/)
{
this->NotifyUpdate();
}
// Save and load settings
void CDebugger::Save(IniFile& _IniFile) const
{
// TODO1: make this work when we close the entire program to, currently on total close we get
// weird values, perhaps because of some conflict with the rendering window
// TODO2: get the screen resolution and make limits from that
if(GetPosition().x < 1000 && GetPosition().y < 1000
&& GetSize().GetWidth() < 1000 && GetSize().GetHeight() < 1000
if(m_Check[1]->IsChecked()
#ifdef _WIN32
// Check to see if we already have a console
&& Console::GetHwnd() == NULL
#endif
)
{
_IniFile.Set("VideoWindow", "x", GetPosition().x);
_IniFile.Set("VideoWindow", "y", GetPosition().y);
_IniFile.Set("VideoWindow", "w", GetSize().GetWidth());
_IniFile.Set("VideoWindow", "h", GetSize().GetHeight());
}
_IniFile.Set("VideoWindow", "Console", m_Check[2]->IsChecked()); // Save settings
_IniFile.Set("VideoWindow", "WriteToFile", m_Check[0]->IsChecked());
_IniFile.Set("VideoWindow", "UpdateFrequency", m_RadioBox[1]->GetSelection());
_IniFile.Set("VideoWindow", "LogLevel", g_Config.iLog);
OpenConsole();
else
CloseConsole();
}
void CDebugger::Load(IniFile& _IniFile)
void CDebugger::SaveSettings() const
{
IniFile file;
file.Load(DEBUGGER_CONFIG_FILE);
// TODO: make this work when we close the entire program too, currently on total close we get
// weird values, perhaps because of some conflict with the rendering window
// TODO: get the screen resolution and make limits from that
if(GetPosition().x < 1000 && GetPosition().y < 1000
&& GetSize().GetWidth() < 1000 && GetSize().GetHeight() < 1000)
{
file.Set("VideoWindow", "x", GetPosition().x);
file.Set("VideoWindow", "y", GetPosition().y);
file.Set("VideoWindow", "w", GetSize().GetWidth());
file.Set("VideoWindow", "h", GetSize().GetHeight());
}
file.Set("VideoWindow", "WriteToFile", m_Check[0]->IsChecked());
file.Set("VideoWindow", "Console", m_Check[1]->IsChecked());
g_Config.iLog = bInfoLog ? CONF_LOG : 0;
g_Config.iLog |= bPrimLog ? CONF_PRIMLOG : 0;
g_Config.iLog |= bSaveTextures ? CONF_SAVETEXTURES : 0;
g_Config.iLog |= bSaveTargets ? CONF_SAVETARGETS : 0;
g_Config.iLog |= bSaveShaders ? CONF_SAVESHADERS : 0;
file.Set("VideoWindow", "ConfBits", g_Config.iLog);
file.Save(DEBUGGER_CONFIG_FILE);
}
void CDebugger::LoadSettings()
{
IniFile file;
file.Load(DEBUGGER_CONFIG_FILE);
int x,y,w,h;
_IniFile.Get("VideoWindow", "x", &x, GetPosition().x);
_IniFile.Get("VideoWindow", "y", &y, GetPosition().y);
_IniFile.Get("VideoWindow", "w", &w, GetSize().GetWidth());
_IniFile.Get("VideoWindow", "h", &h, GetSize().GetHeight());
file.Get("VideoWindow", "x", &x, GetPosition().x);
file.Get("VideoWindow", "y", &y, GetPosition().y);
file.Get("VideoWindow", "w", &w, GetSize().GetWidth());
file.Get("VideoWindow", "h", &h, GetSize().GetHeight());
SetSize(x, y, w, h);
// Saved settings
file.Get("VideoWindow", "WriteToFile", &LocalLogFile, m_Check[0]->IsChecked());
m_Check[0]->SetValue(LocalLogFile);
bool Console;
_IniFile.Get("VideoWindow", "Console", &Console, m_Check[2]->IsChecked());
m_Check[2]->SetValue(Console);
DoShowHideConsole();
file.Get("VideoWindow", "Console", &Console, m_Check[1]->IsChecked());
m_Check[1]->SetValue(Console);
_IniFile.Get("VideoWindow", "WriteToFile", &LocalLogFile, m_Check[0]->IsChecked());
m_Check[0]->SetValue(LocalLogFile);
_IniFile.Get("VideoWindow", "UpdateFrequency", &gUpdFreq, m_RadioBox[1]->GetSelection());
m_RadioBox[1]->SetSelection(gUpdFreq);
DoChangeFrequency();
_IniFile.Get("VideoWindow", "LogLevel", &g_Config.iLog, 0);
m_settings->Check(g_Config.iLog - 1, true);
file.Get("VideoWindow", "ConfBits", &g_Config.iLog, 0);
bInfoLog = g_Config.iLog & CONF_LOG;
bPrimLog = g_Config.iLog & CONF_PRIMLOG;
bSaveTextures = g_Config.iLog & CONF_SAVETEXTURES;
bSaveTargets = g_Config.iLog & CONF_SAVETARGETS;
bSaveShaders = g_Config.iLog & CONF_SAVESHADERS;
m_Check[2]->SetValue(bInfoLog);
m_Check[3]->SetValue(bPrimLog);
m_Check[4]->SetValue(bSaveTextures);
m_Check[5]->SetValue(bSaveTargets);
m_Check[6]->SetValue(bSaveShaders);
}
void CDebugger::CreateGUIControls()
{
// Basic settings
SetTitle(wxT("OpenGL Debugging"));
SetIcon(wxNullIcon);
SetSize(8, 8, 200, 100); // these will become the minimin sizes allowed by resizing
Center();
CenterOnParent();
// Declarations
wxBoxSizer *sMain, *sGeneral;
wxButton* m_Upd;
wxButton* m_Ap; wxButton* m_Am;
wxButton* m_Bp; wxButton* m_Bm;
// MainPanel
m_MainPanel = new wxPanel(this, ID_MAINPANEL, wxDefaultPosition, wxDefaultSize);
wxStaticBoxSizer* sLeft;
// Options
wxStaticBoxSizer *sOptions = new wxStaticBoxSizer(wxVERTICAL, m_MainPanel, wxT("Options"));
m_Check[0] = new wxCheckBox(m_MainPanel, ID_SAVETOFILE, wxT("Save to file"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[1] = new wxCheckBox(m_MainPanel, ID_SHOWCONSOLE, wxT("Show console"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[2] = new wxCheckBox(m_MainPanel, ID_INFOLOG, wxT("Info log"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[3] = new wxCheckBox(m_MainPanel, ID_PRIMLOG, wxT("Primary log"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[4] = new wxCheckBox(m_MainPanel, ID_SAVETEXTURES, wxT("Save Textures"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[5] = new wxCheckBox(m_MainPanel, ID_SAVETARGETS, wxT("Save Targets"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[6] = new wxCheckBox(m_MainPanel, ID_SAVESHADERS, wxT("Save Shaders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
for (int i = 0; i < NUM_OPTIONS-ID_SAVETOFILE; ++i)
sOptions->Add(m_Check[i], 0, 0, 5);
// Notebook -----------------------------------------------------
m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
m_PageMain = new wxPanel(m_Notebook, ID_PAGEMAIN, wxDefaultPosition, wxDefaultSize);
m_Notebook->AddPage(m_PageMain, wxT("Main"));
// Main Page
// Buttons -----------------------------------------------------
wxStaticBoxSizer * m_updSizer = new wxStaticBoxSizer (wxVERTICAL, m_PageMain, wxT("Update"));
m_Upd = new wxButton(m_PageMain, ID_UPD, wxT("Update"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_updSizer->Add(m_Upd, 0, 0, 5);
// ------------------------
// Variables -----------------------------------------------------
wxStaticBoxSizer * m_buttonSizer = new wxStaticBoxSizer (wxVERTICAL, m_PageMain, wxT("Variables"));
m_Ap = new wxButton(m_PageMain, ID_AP, wxT("A +"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
//m_SelC->Enable(false);
m_Am = new wxButton(m_PageMain, ID_AM, wxT("A -"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
//m_Presets->Enable(false);
m_Bp = new wxButton(m_PageMain, ID_BP, wxT("B +"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Bm = new wxButton(m_PageMain, ID_BM, wxT("B -"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_buttonSizer->Add(m_Ap, 0, 0, 5);
m_buttonSizer->Add(m_Am, 0, 0, 5);
m_buttonSizer->Add(m_Bp, 0, 0, 5);
m_buttonSizer->Add(m_Bm, 0, 0, 5);
// m_PageMain: Options
wxStaticBoxSizer * m_optionsSizer = new wxStaticBoxSizer(wxVERTICAL, m_PageMain, wxT("Options"));
//m_Label[0] = new wxStaticBox(m_PageMain, IDG_LABEL1, wxT("Options"),
// wxDefaultPosition, wxDefaultSize, 0);
//wxStaticBoxSizer * m_checkSizer3 = new wxStaticBoxSizer (m_Label[0], wxVERTICAL);
// checkboxes
m_Check[0] = new wxCheckBox(m_PageMain, ID_SAVETOFILE, wxT("Save to file"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[0]->SetToolTip(wxT("This will write the console output to" FULL_LOGS_DIR "oglgfx.txt"));
m_Check[2] = new wxCheckBox(m_PageMain, ID_SHOWCONSOLE, wxT("Show console"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_optionsSizer->Add(m_Check[0], 0, 0, 5);
m_optionsSizer->Add(m_Check[2], 0, 0, 5);
// m_PageMain: Log settings checkboxes
wxStaticBoxSizer * m_logSizer = new wxStaticBoxSizer(wxVERTICAL, m_PageMain, wxT("Log setting"));
m_settings = new wxCheckListBox(m_PageMain, ID_CHECKLIST1, wxDefaultPosition, wxDefaultSize,
0, NULL, wxNO_BORDER);
m_settings->Append(wxT("Info log"));
m_settings->Append(wxT("Primary log"));
m_settings->Check(0, bInfoLog);
m_settings->Check(1, bPrimLog);
// because the wxCheckListBox is a little underdeveloped we have to help it with this
// to bad there's no windows xp styles for the checkboxes
m_settings->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
m_settings->SetMinSize(wxSize(m_settings->GetSize().GetWidth() - 40,
m_settings->GetCount() * 15));
m_logSizer->Add(m_settings, 0, 0, 0);
// ------------------------
// --------------------------------------------------------------------
// m_PageMain: Radio boxes
// -------------------------
int m_radioBoxNChoices[3];
wxString m_radioBoxChoices0[] = { wxT("Show base 10"), wxT("Show base 16") };
m_radioBoxNChoices[0] = sizeof( m_radioBoxChoices0 ) / sizeof( wxString );
m_RadioBox[0] = new wxRadioBox( m_PageMain, IDC_RADIO0, wxT("Show base"),
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[0], m_radioBoxChoices0, 1, wxRA_SPECIFY_COLS);
m_RadioBox[0]->Enable(false);
wxString m_radioBoxChoices1[] = { wxT("Never"), wxT("5 times/s"), wxT("15 times/s"), wxT("30 times/s") };
m_radioBoxNChoices[1] = sizeof( m_radioBoxChoices1 ) / sizeof( wxString );
m_RadioBox[1] = new wxRadioBox( m_PageMain, IDC_RADIO1, wxT("Update freq."),
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[1], m_radioBoxChoices1, 1, wxRA_SPECIFY_COLS);
wxString m_radioBoxChoices2[] = { wxT("Win stretch") };
m_radioBoxNChoices[2] = sizeof( m_radioBoxChoices2 ) / sizeof( wxString );
m_RadioBox[2] = new wxRadioBox( m_PageMain, IDC_RADIO2, wxT("Presets"),
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[2], m_radioBoxChoices2, 1, wxRA_SPECIFY_COLS);
// ------------------------
// --------------------------------------------------------------------
// Main: Left buttons and checkboxes
// ------------------------
wxBoxSizer* sButtons = new wxBoxSizer(wxVERTICAL);
//sButtons->AddStretchSpacer(1);
sButtons->Add(m_updSizer, 0, 0, 5); // update button
sButtons->Add(m_buttonSizer, 0, 0, 5); // variables buttons
sButtons->Add(m_logSizer, 0, 0, 5); // log settings
sButtons->Add(m_optionsSizer, 0, 2, 5); // Log options, show console etc.
// --------------------------------------------------------------------
// Main: Right buttons and checkboxes
// ------------------------
wxBoxSizer* sButtons2 = new wxBoxSizer(wxVERTICAL);
sButtons2->Add(m_RadioBox[0], 0, 0, 5); // Show base
sButtons2->Add(m_RadioBox[1], 0, 0, 5); // Update frequency
sButtons2->Add(m_RadioBox[2], 0, 0, 5); // Preset views
//sButtons2->AddStretchSpacer(1);
//sButtons2->Add(m_checkSizer2, 0, 2, 5);
// --------------------------------------------------------------------
// Main: Parameter tables view, the big window
sLeft = new wxStaticBoxSizer(wxVERTICAL, m_PageMain, wxT("Current Status"));
m_GPRListView = new CPBView(m_PageMain, ID_GPR, wxDefaultPosition, GetSize(),
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT | wxLC_SINGLE_SEL | wxLC_SORT_ASCENDING);
sLeft->Add(m_GPRListView, 1, wxEXPAND|wxALL, 5);
// --------------------------------------------------------------------
// General container
// -----------------------------
sGeneral = new wxBoxSizer(wxHORIZONTAL);
sGeneral->Add(sLeft, 1, wxEXPAND | wxALL, 5);
sGeneral->Add(sButtons, 0, wxEXPAND | (wxUP | wxDOWN), 5);
sGeneral->Add(sButtons2, 0, wxEXPAND | (wxUP | wxDOWN | wxRIGHT | wxLEFT), 5);
// --------------------------------------------------------------------
// Main container
// -----------------------------
sMain = new wxBoxSizer(wxVERTICAL);
sMain->Add(m_Notebook, 1, wxEXPAND | wxALL, 5);
m_PageMain->SetSizer(sGeneral);
this->SetSizer(sMain);
//sGeneral->SetSizeHints(this);
//NotifyUpdate();
//Freeze(); // unfreeze this if you want to use it
// Layout everything on m_MainPanel
wxBoxSizer *sMain = new wxBoxSizer(wxHORIZONTAL);
sMain->Add(sOptions);
sMain->Add(100, 0); // Add some width so we can see the window title by default
m_MainPanel->SetSizerAndFit(sMain);
Fit();
}
// =======================================================================================
// Change preset
// --------------
void CDebugger::ChangePreset(wxCommandEvent& event)
{
DoChangePreset();
}
void CDebugger::DoChangePreset()
{
if(m_RadioBox[2]->GetSelection() == 0)
gPreset = 0;
else if(m_RadioBox[2]->GetSelection() == 1)
gPreset = 1;
else if(m_RadioBox[2]->GetSelection() == 2)
gPreset = 2;
else if(m_RadioBox[2]->GetSelection() == 3)
gPreset = 3;
}
// ==============
// =======================================================================================
// Control variables
// --------------
void CDebugger::Ap(wxCommandEvent& event)
{
A += 50;
//MessageBox(0, "", "", 0);
DEBUG_LOG("%i", A);
}
void CDebugger::Am(wxCommandEvent& event)
{
A -= 50;
}
void CDebugger::Bp(wxCommandEvent& event)
{
B += 50;
}
void CDebugger::Bm(wxCommandEvent& event)
{
B -= 50;
}
// ==============
// =======================================================================================
// Change update frequency
// --------------
void CDebugger::ChangeFrequency(wxCommandEvent& event)
{
DoChangeFrequency();
}
void CDebugger::DoChangeFrequency()
{
if(m_RadioBox[1]->GetSelection() == 0)
gUpdFreq = 0;
else if(m_RadioBox[1]->GetSelection() == 1)
gUpdFreq = 5;
else if(m_RadioBox[1]->GetSelection() == 2)
gUpdFreq = 15;
else
gUpdFreq = 30;
}
// ==============
// =======================================================================================
//////////////////////////////////////////////////////////////////////////
// General settings
// --------------
void CDebugger::GeneralSettings(wxCommandEvent& event)
{
switch (event.GetId())
{
case ID_SAVETOFILE: // Save to file
LocalLogFile = m_Check[0]->IsChecked();
break;
case ID_SHOWCONSOLE:
DoShowHideConsole();
break;
case ID_SAVETOFILE:
LocalLogFile = event.IsChecked();
break;
case ID_SHOWCONSOLE:
DoShowHideConsole();
break;
case ID_INFOLOG:
bInfoLog = event.IsChecked();
break;
case ID_PRIMLOG:
bPrimLog = event.IsChecked();
break;
case ID_SAVETEXTURES:
bSaveTextures = event.IsChecked();
break;
case ID_SAVETARGETS:
bSaveTargets = event.IsChecked();
break;
case ID_SAVESHADERS:
bSaveShaders = event.IsChecked();
break;
}
SaveSettings();
}
// ==============
// =======================================================================================
// Show or hide console window
// --------------
void CDebugger::DoShowHideConsole()
{
if(m_Check[2]->IsChecked())
{
OpenConsole();
#ifdef _WIN32
MoveWindow(Console::GetHwnd(), 0,400, 1280,500, true); // Move window. TODO: make this
// adjustable from the debugging window
#endif
}
else
{
CloseConsole();
}
}
// ==============
// =======================================================================================
// Enable or disable logs
// --------------
void CDebugger::LogSettings(wxCommandEvent& event)
{
// Only allow one selected log at a time
for (u32 i = 0; i < m_settings->GetCount(); ++i)
if(i != (u32)event.GetInt()) m_settings->Check(i, false);
if(m_settings->IsChecked(0)) g_Config.iLog = CONF_LOG;
else if(m_settings->IsChecked(1)) g_Config.iLog = CONF_PRIMLOG;
else g_Config.iLog = 0;
}
// ==============
// =======================================================================================
// Update the wxListCtrl
// --------------
void CDebugger::NotifyUpdate()
{
if (m_GPRListView != NULL)
{
m_GPRListView->Update();
}
}
// ==============

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -18,121 +18,62 @@
#ifndef __CDebugger_h__
#define __CDebugger_h__
// wx stuff, I'm not sure if we use all these
#ifndef WX_PRECOMP
#include <wx/wx.h>
#include <wx/dialog.h>
#else
#include <wx/wxprec.h>
#endif
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/statbox.h>
#include <wx/statbmp.h>
#include <wx/sizer.h>
#include <wx/filepicker.h>
#include <wx/listctrl.h>
#include <wx/imaglist.h>
#include <wx/notebook.h> // notebook
#include <wx/wx.h>
#include <wx/notebook.h>
#include "../Globals.h"
class CPBView;
class IniFile;
class CDebugger : public wxDialog
{
private:
DECLARE_EVENT_TABLE();
public:
CDebugger(wxWindow *parent, wxWindowID id = 1, const wxString &title = _("Sound Debugger"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE);
public:
CDebugger(wxWindow *parent,
wxWindowID id = 1,
const wxString &title = wxT("OGL Debug"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE);
virtual ~CDebugger();
virtual ~CDebugger();
void Save(IniFile& _IniFile) const;
void Load(IniFile& _IniFile);
void DoHide(); void DoShow();
void SaveSettings() const;
void LoadSettings();
void DoShowHideConsole();
void DoShow();
void NotifyUpdate();
void OnUpdate(wxCommandEvent& event);
void GeneralSettings(wxCommandEvent& event);
void GeneralSettings(wxCommandEvent& event);
void LogSettings(wxCommandEvent& event);
void DoShowHideConsole();
void ChangeFrequency(wxCommandEvent& event);
void DoChangeFrequency();
void ChangePreset(wxCommandEvent& event);
void DoChangePreset();
bool bInfoLog;
bool bPrimLog;
bool bSaveTextures;
bool bSaveTargets;
bool bSaveShaders;
void Ap(wxCommandEvent& event);
void Am(wxCommandEvent& event);
void Bp(wxCommandEvent& event);
void Bm(wxCommandEvent& event);
private:
DECLARE_EVENT_TABLE();
CPBView* m_GPRListView;
wxPanel *m_MainPanel;
int gUpdFreq;
bool bInfoLog;
bool bPrimLog;
wxCheckBox *m_Check[7];
private:
// WARNING: Make sure these are not also elsewhere
enum
{
ID_MAINPANEL = 2000,
// declarations
wxNotebook *m_Notebook; // notebook
wxPanel *m_PageMain;
ID_SAVETOFILE,
ID_SHOWCONSOLE,
ID_INFOLOG,
ID_PRIMLOG,
ID_SAVETEXTURES,
ID_SAVETARGETS,
ID_SAVESHADERS,
NUM_OPTIONS
};
wxCheckBox *m_Check[7];
wxCheckListBox * m_options, * m_settings;
wxRadioButton *m_Radio[5];
wxRadioBox *m_RadioBox[3];
wxStaticBox *m_Label[2];
wxPanel *m_Controller;
// WARNING: Make sure these are not also elsewhere, for example in resource.h.
enum
{
ID_NOTEBOOK = 2000, ID_PAGEMAIN, // notebook
ID_SAVETOFILE, ID_SHOWCONSOLE, // options
IDC_CHECK2,
IDC_CHECK3,
IDC_CHECK4,
IDC_CHECK5,
IDC_CHECK6,
IDC_CHECK7,
IDC_CHECK8,
IDC_CHECK9,
ID_CHECKLIST1,
IDC_RADIO0,
IDC_RADIO1,
IDC_RADIO2,
IDC_RADIO3,
IDG_LABEL1,
IDG_LABEL2,
ID_UPD,
ID_AP,
ID_AM,
ID_BP,
ID_BM,
ID_GPR,
ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values
};
void OnShow(wxShowEvent& event);
void OnClose(wxCloseEvent& event);
void CreateGUIControls();
void OnShow(wxShowEvent& event);
void OnClose(wxCloseEvent& event);
void CreateGUIControls();
};
#endif

View File

@ -1,224 +0,0 @@
//////////////////////////////////////////////////////////////////////////////////////////
//
// Licensetype: GNU General Public License (GPL)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
//
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
//
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
//
#include "../Globals.h" // This is the precompiled header and must be the first ...
#include <iostream>
#include <vector>
#include <string> // so that we can test std::string == abc
#include <math.h> // for the pow() function
#ifdef _WIN32
#include <windows.h>
#endif
#include "../GLUtil.h"
#if defined(HAVE_WX) && HAVE_WX
#include "../Debugger/Debugger.h" // For the CDebugger class
#include "../Debugger/PBView.h"
#include "ConsoleWindow.h" // Open and close console, clear console window
#endif
#include "../Debugger/Logging.h" // For global logging values
// Externals
extern int nFiles;
float ratioFactor; // a global to get the ratio factor from MixAdd
int gPreset = 0;
u32 gLastBlock;
extern bool gSSBM;
extern bool gSSBMremedy1;
extern bool gSSBMremedy2;
extern bool gSequenced;
extern bool gReset;
bool gOnlyLooping = false;
//extern int gleft, gright, gtop, gbottom; // from BPStructs.cpp
int j = 0;
int k = 0;
bool iupdonce = false;
std::vector<u16> viupd(15); // the length of the update frequency bar
#if defined(HAVE_WX) && HAVE_WX
extern CDebugger* m_frame;
#endif
std::string writeTitle(int a)
{
std::string b;
if(a == 0)
{
b = "lef rig top bot | wid hei\n";
}
return b;
}
// Write main message (presets)
std::string writeMessage(int a, int i)
{
char buf [1000] = "";
std::string sbuf;
/*
PRESET 0
"lef rig top bot | xof yof\n";
"000 000 000 000 | 000 00
*/
if(a == 0)
{
sprintf(buf,"%03i %03i %03i %03i | %03i %03i",
0, OpenGL_GetWidth(), OpenGL_GetHeight(), 0,
OpenGL_GetXoff(), OpenGL_GetYoff());
}
sbuf = buf;
return sbuf;
}
// Logging
void Logging(int a)
{
// Control how often the screen is updated, and then update the screen
if(a == 0) j++;
//if(l == pow((double)2,32)) l=0; // reset l
//l++;
if (m_frame->gUpdFreq > 0 && j > (30 / m_frame->gUpdFreq))
{
// Write header
char buffer [1000] = "";
std::string sbuff;
sbuff = writeTitle(gPreset);
// hopefully this is false if we don't have a debugging window and so it doesn't cause a crash
/* // nothing do do here yet
if(m_frame)
{
m_frame->m_GPRListView->m_CachedRegs[1][0] = 0;
}
*/
// add new line
sbuff = sbuff + writeMessage(gPreset, 0); strcpy(buffer, "");
sbuff = sbuff + "\n";
// Write global values
// ---------------
/*
sprintf(buffer, "\nThe parameter blocks span from %08x to %08x | distance %i %i\n", m_addressPBs, gLastBlock, (gLastBlock-m_addressPBs), (gLastBlock-m_addressPBs) / 192);
sbuff = sbuff + buffer; strcpy(buffer, "");
*/
// ===============
// =======================================================================================
// Write settings
// ---------------
/*
sprintf(buffer, "\nSettings: SSBM fix %i | SSBM rem1 %i | SSBM rem2 %i | Sequenced %i | Reset %i | Only looping %i | Save file %i\n",
gSSBM, gSSBMremedy1, gSSBMremedy2, gSequenced, gReset, gOnlyLooping, gSaveFile);
sbuff = sbuff + buffer; strcpy(buffer, "");
*/
// ===============
// =======================================================================================
// Show update frequency
// ---------------
sbuff = sbuff + "\n";
if(!iupdonce)
{
/*
for (int i = 0; i < 10; i++)
{
viupd.at(i) == 0;
}
*/
viupd.at(0) = 1;
viupd.at(1) = 1;
viupd.at(2) = 1;
iupdonce = true;
}
for (u32 i = 0; i < viupd.size(); i++) // 0, 1,..., 9
{
if (i < viupd.size()-1)
{
viupd.at(viupd.size()-i-1) = viupd.at(viupd.size()-i-2); // move all forward
}
else
{
viupd.at(0) = viupd.at(viupd.size()-1);
}
// Correction
if (viupd.at(viupd.size()-3) == 1 && viupd.at(viupd.size()-2) == 1 && viupd.at(viupd.size()-1) == 1)
{
viupd.at(0) = 0;
}
if(viupd.at(0) == 0 && viupd.at(1) == 1 && viupd.at(2) == 1 && viupd.at(3) == 0)
{
viupd.at(0) = 1;
}
}
for (u32 i = 0; i < viupd.size(); i++)
{
if(viupd.at(i) == 0)
sbuff = sbuff + " ";
else
sbuff = sbuff + ".";
}
// ================
// =======================================================================================
// Print
// ----------------
#if defined(HAVE_WX) && HAVE_WX
Console::ClearScreen();
#endif
LOG(VIDEO, "%s", sbuff.c_str());
sbuff.clear(); strcpy(buffer, "");
// ================
// New values are written so update - DISABLED - It flickered a lot, even worse than a
// console window. So for now only the console windows is updated.
/*
if(m_frame)
{
m_frame->NotifyUpdate();
}
*/
k=0;
j=0;
} // end of if (j>20)
} // end of function

View File

@ -1,25 +0,0 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// Declarations and definitions
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
void Logging(int a);
void OpenConsole();
void CloseConsole();
////////////////////////////////

View File

@ -1,124 +0,0 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "../Globals.h"
#include "PBView.h"
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
extern const char* GetGRPName(unsigned int index);
BEGIN_EVENT_TABLE(CPBView, wxListCtrl)
END_EVENT_TABLE()
CPBView::CPBView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
: wxListCtrl(parent, id, pos, size, style)
{
InsertColumn(0, wxT("Block"), wxLIST_FORMAT_CENTER, 40);
SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, wxT("Segoe UI")));
for (int i = 0; i < 1; i++)
{
// Print values from 0 to 63
char buffer [33];
sprintf(buffer, "%02i", i);
int Item = InsertItem(0, wxString::FromAscii(buffer));
wxListItem item;
item.SetId(Item);
item.SetBackgroundColour(0xFFFFFF);
item.SetData(i);
SetItem(item);
}
// This is a wx call that leads to MSWDrawSubItem
Refresh();
}
void CPBView::Update()
{
Refresh();
}
#ifdef _WIN32
bool CPBView::MSWDrawSubItem(wxPaintDC& rPainDC, int item, int subitem)
{
bool Result = false;
// don't change 0, it has the block values
if(subitem > 0)
{
#ifdef __WXMSW__ // what's this? should I use that?
const wxChar* bgColor = _T("#ffffff");
wxBrush bgBrush(bgColor);
wxPen bgPen(bgColor);
wxRect SubItemRect;
this->GetSubItemRect(item, subitem, SubItemRect);
rPainDC.SetBrush(bgBrush);
rPainDC.SetPen(bgPen);
rPainDC.DrawRectangle(SubItemRect);
#endif
// A somewhat primitive attempt to show the playing history for a certain block.
wxString text;
if(subitem == 1)
{
char cbuff [33];
sprintf(cbuff, "%08i", m_CachedRegs[subitem][item]);
std::string c = cbuff;
int n[8];
for (int j = 0; j < 8; j++)
{
n[j] = atoi( c.substr(j, 1).c_str());
// 149 = dot, 160 = space
if (n[j] == 1){
n[j] = 149;} else {n[j] = 160;}
}
// pretty neat huh?
text.Printf(wxT("%c%c%c%c%c%c%c%c"), n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]);
}
else
{
text.Printf(wxT("0x%08x"), m_CachedRegs[subitem][item]);
}
#ifdef __WXMSW__
rPainDC.DrawText(text, SubItemRect.GetLeft() + 10, SubItemRect.GetTop() + 4);
#else
// May not show up pretty in !Win32
rPainDC.DrawText(text, 10, 4);
#endif
return true;
}
else
{
// what does this mean?
return Result;
}
}
#endif

View File

@ -1,42 +0,0 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __PBView_h__
#define __PBView_h__
#include <wx/listctrl.h>
#include <wx/dcclient.h>
#include "Common.h"
class CPBView : public wxListCtrl
{
public:
CPBView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style);
void Update();
u32 m_CachedRegs[10][10];
private:
DECLARE_EVENT_TABLE()
bool m_CachedRegHasChanged[64];
#ifdef _WIN32
virtual bool MSWDrawSubItem(wxPaintDC& rPainDC, int item, int subitem);
#endif
};
#endif

View File

@ -294,11 +294,11 @@ void ConfigDialog::CreateGUIControls()
sbRendering->Add(sRenderBoxRow1);
sAdvanced->Add(sbRendering, 0, wxEXPAND|wxALL, 5);
sUtilities = new wxGridBagSizer(0, 0);
sUtilities->Add(m_DumpTextures, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sUtilities->Add(m_TexturePath, wxGBPosition(0, 1), wxGBSpan(1, 1), wxALL, 5);
sbUtilities->Add(sUtilities);
sAdvanced->Add(sbUtilities, 0, wxEXPAND|wxALL, 5);
sUtilities = new wxBoxSizer(wxHORIZONTAL);
sUtilities->Add(m_DumpTextures, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
sUtilities->Add(m_TexturePath, 1, wxALL|wxEXPAND, 5);
sbUtilities->Add(sUtilities, 1, wxEXPAND);
sAdvanced->Add(sbUtilities, 1, wxEXPAND|wxALL, 5);
sHacks = new wxGridBagSizer(0, 0);
sHacks->Add(m_ProjectionHax1, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 5);

View File

@ -62,7 +62,7 @@ class ConfigDialog : public wxDialog
wxStaticBoxSizer* sbRendering;
wxGridBagSizer* sRendering;
wxStaticBoxSizer* sbUtilities;
wxGridBagSizer* sUtilities;
wxBoxSizer* sUtilities;
wxStaticBoxSizer* sbHacks;
wxGridBagSizer* sHacks;

View File

@ -31,4 +31,7 @@ extern bool LocalLogFile;
// A global plugin specification
extern PLUGIN_GLOBALS* globals;
void OpenConsole();
void CloseConsole();
#endif // _GLOBALS_H

View File

@ -131,7 +131,7 @@ FRAGMENTSHADER* PixelShaderCache::GetShader()
if (g_Config.iLog & CONF_SAVESHADERS && code) {
static int counter = 0;
char szTemp[MAX_PATH];
sprintf(szTemp, "%s/ps_%04i.txt", g_Config.texDumpPath, counter++);
sprintf(szTemp, "%s/ps_%04i.txt", FULL_DUMP_DIR, counter++);
SaveData(szTemp, code);
}

View File

@ -46,7 +46,6 @@
#include "VertexLoader.h"
#include "XFB.h"
#include "Timer.h"
#include "Debugger/Logging.h" // for Logging()
#if defined(HAVE_WX) && HAVE_WX
#include "Debugger/Debugger.h" // for the CDebugger class
@ -923,11 +922,6 @@ void Renderer::SwapBuffers()
fpscount = 0;
}
// Write logging data to debugger
#if defined(HAVE_WX) && HAVE_WX
if (m_frame)
Logging(0);
#endif
if (g_Config.bOverlayStats) {
char st[2048];
char *p = st;

View File

@ -115,7 +115,7 @@ FRAGMENTSHADER& GetOrCreateEncodingShader(u32 format)
if (g_Config.iLog & CONF_SAVESHADERS && shader) {
static int counter = 0;
char szTemp[MAX_PATH];
sprintf(szTemp, "%s/enc_%04i.txt", g_Config.texDumpPath, counter++);
sprintf(szTemp, "%s/enc_%04i.txt", FULL_DUMP_DIR, counter++);
SaveData(szTemp, shader);
}

View File

@ -205,10 +205,10 @@ void Flush()
PixelShaderManager::SetTexDims(i, tentry->w, tentry->h, 0, 0);
TextureMngr::EnableTex2D(i);
}
if (g_Config.iLog & CONF_PRIMLOG) {
if (g_Config.iLog & CONF_SAVETEXTURES) {
// save the textures
char strfile[255];
sprintf(strfile, "frames/tex%.3d_%d.tga", g_Config.iSaveTargetId, i);
sprintf(strfile, "%sframes/tex%.3d_%d.tga", FULL_DUMP_DIR, g_Config.iSaveTargetId, i);
SaveTexture(strfile, tentry->isNonPow2?GL_TEXTURE_RECTANGLE_ARB:GL_TEXTURE_2D, tentry->texture, tentry->w, tentry->h);
}
}
@ -269,20 +269,20 @@ void Flush()
}
#if defined(_DEBUG) || defined(DEBUGFAST)
if (g_Config.iLog & CONF_PRIMLOG) {
if (g_Config.iLog & CONF_SAVESHADERS) {
// save the shaders
char strfile[255];
sprintf(strfile, "frames/ps%.3d.txt", g_Config.iSaveTargetId);
sprintf(strfile, "%sframes/ps%.3d.txt", FULL_DUMP_DIR, g_Config.iSaveTargetId);
std::ofstream fps(strfile);
fps << ps->strprog.c_str();
sprintf(strfile, "frames/vs%.3d.txt", g_Config.iSaveTargetId);
sprintf(strfile, "%sframes/vs%.3d.txt", FULL_DUMP_DIR, g_Config.iSaveTargetId);
std::ofstream fvs(strfile);
fvs << vs->strprog.c_str();
}
if (g_Config.iLog & CONF_SAVETARGETS) {
char str[128];
sprintf(str, "frames/targ%.3d.tga", g_Config.iSaveTargetId);
sprintf(str, "%sframes/targ%.3d.tga", FULL_DUMP_DIR, g_Config.iSaveTargetId);
Renderer::SaveRenderTarget(str, 0);
}
#endif

View File

@ -90,7 +90,7 @@ VERTEXSHADER* VertexShaderCache::GetShader(u32 components)
if (g_Config.iLog & CONF_SAVESHADERS && code) {
static int counter = 0;
char szTemp[MAX_PATH];
sprintf(szTemp, "%s/vs_%04i.txt", g_Config.texDumpPath, counter++);
sprintf(szTemp, "%s/vs_%04i.txt", FULL_DUMP_DIR, counter++);
SaveData(szTemp, code);
}

View File

@ -101,29 +101,22 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
as the one that is rendering the game. However, that could be done. */
#if defined(HAVE_WX) && HAVE_WX
CDebugger* m_frame;
CDebugger *m_frame;
void DllDebugger(HWND _hParent, bool Show)
{
if(m_frame && Show) // if we have created it, let us show it again
if(!m_frame && Show)
{
m_frame->DoShow();
}
else if(!m_frame && Show)
{
m_frame = new CDebugger(NULL);
m_frame->Show();
}
else if(m_frame && !Show)
else if (m_frame && !Show)
{
m_frame->DoHide();
if(m_frame->Close())
m_frame = NULL;
}
}
void DoDllDebugger()
{
//m_frame = new CDebugger(NULL);
//m_frame->Show();
}
void DoDllDebugger(){}
#else
void DllDebugger(HWND _hParent, bool Show) { }
void DoDllDebugger() { }
@ -156,7 +149,6 @@ void DllConfig(HWND _hParent)
#endif
//win->Reparent(wxGetApp().GetTopWindow());
ConfigDialog *frame = new ConfigDialog(win);
g_Config.Load();
OpenGL_AddBackends(frame);
OpenGL_AddResolutions(frame);
frame->ShowModal();

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -18,12 +18,6 @@
#ifndef _CONFIG_H
#define _CONFIG_H
#define CONF_LOG 1
#define CONF_PRIMLOG 2
#define CONF_SAVETEXTURES 4
#define CONF_SAVETARGETS 8
#define CONF_SAVESHADERS 16
struct Config
{
Config();