Some fixes for the log manager. Small change to breakpoint manager.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@918 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2008-10-20 07:39:40 +00:00
parent d7358df7fe
commit f59ed4a8c9
10 changed files with 228 additions and 199 deletions

View file

@ -426,7 +426,7 @@ void GatherPipeBursted()
while (!(fifo.bFF_BPEnable && fifo.bFF_Breakpoint) && fifo.CPReadWriteDistance > (s32)fifo.CPHiWatermark)
//Common::SleepCurrentThread(1000); // 1s for test. We shouldn't fall here ever
ct++;
if (ct) {LOG(COMMANDPROCESSOR, "(GatherPipeBursted): %lu cycle for nothing :[ ", ct);}
if (ct) {LOG(COMMANDPROCESSOR + 100, "(GatherPipeBursted): %lu cycle for nothing :[ ", ct);}
#ifdef _WIN32

View file

@ -46,7 +46,7 @@ void __Log(int log, const char *format, ...)
}
CDebugger_Log::CDebugger_Log(const char* _szShortName, const char* _szName, int a) :
m_bLogToFile(true),
m_bLogToFile(true), // write to file or not
m_bShowInLog(false),
m_bEnable(false),
m_pFile(NULL)
@ -125,11 +125,12 @@ void LogManager::Init()
m_nextMessages[i] = 0; // initiate to zero
}
// create the files
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
{
for (int j = 0; j <= LogManager::VERBOSITY_LEVELS; j++)
{
m_Log[i]->Init();
m_Log[j*100 + i]->Init();
}
}
m_bInitialized = true;
@ -180,15 +181,16 @@ std::string lastSymbol;
void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...)
{
// declarations
int v = m_LogSettings->m_iVerbosity;
int vv;
int v; // verbosity level
int type; // the log type, CONSOLE etc.
char cvv[20];
std::string svv;
// get the current verbosity level
// get the current verbosity level and type
sprintf(cvv, "%03i", (int)_type);
svv = cvv;
vv = atoi(svv.substr(0, 1).c_str());
v = atoi(svv.substr(0, 1).c_str());
type = atoi(svv.substr(1, 2).c_str());
// security checks
if (m_Log[_type] == NULL || !m_Log[_type]->m_bEnable || PC == 0
@ -219,13 +221,13 @@ void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...)
// question again.
std::string symbol;
if ((vv == 0 || vv == 1) && lastPC != PC)
if ((v == 0 || v == 1) && lastPC != PC && LogManager::m_LogSettings->bResolve)
{
symbol = g_symbolDB.GetDescription(PC);
lastSymbol = symbol;
lastPC = PC;
}
else if(lastPC == PC)
else if(lastPC == PC && LogManager::m_LogSettings->bResolve)
{
symbol = lastSymbol;
}
@ -243,7 +245,7 @@ void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...)
datetime.GetMinute(), datetime.GetSecond(), datetime.GetMillisecond(),
PowerPC::ppcState.DebugCount,
m_Log[_type]->m_szShortName_, // (CONSOLE etc)
symbol.c_str(), PC, // (name, 0xaddress)
symbol.c_str(), PC, // current PC location (name, address)
Msg, eol);
}
@ -251,29 +253,33 @@ void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...)
// Level 0 verbosity logs will be written to all verbosity levels. Given that logging is enabled
// for that level. Level 1 verbosity will only be written to level 1, 2, 3 and so on.
// ---------------
int type = _type;
for (int i = LogManager::VERBOSITY_LEVELS; i >= vv ; i--)
int id;
for (int i = LogManager::VERBOSITY_LEVELS; i >= v ; i--)
{
// prepare the right id
id = i*100 + type;
// write to memory
m_Messages[i][m_nextMessages[i]].Set(_type, Msg2);
m_Messages[i][m_nextMessages[i]].Set((LogTypes::LOG_TYPE)id, Msg2);
// ----------------------------------------------------------------------------------------
// write to file
// ---------------
if (m_Log[_type]->m_pFile && m_Log[_type]->m_bLogToFile)
fprintf(m_Log[_type]->m_pFile, "%s", Msg2);
if (m_Log[LogTypes::MASTER_LOG] && m_Log[LogTypes::MASTER_LOG]->m_pFile && m_Log[_type]->m_bShowInLog)
fprintf(m_Log[LogTypes::MASTER_LOG]->m_pFile, "%s", Msg2);
if (m_Log[id]->m_pFile && m_Log[id]->m_bLogToFile)
fprintf(m_Log[id]->m_pFile, "%s", Msg2);
if (m_Log[i*100 + LogTypes::MASTER_LOG] && m_Log[i*100 + LogTypes::MASTER_LOG]->m_pFile
&& LogManager::m_LogSettings->bWriteMaster)
fprintf(m_Log[i*100 + LogTypes::MASTER_LOG]->m_pFile, "%s", Msg2);
printf("%s", Msg2); // write to console screen
// this limits the memory space used for the memory logs to MAX_MESSAGES rows
m_nextMessages[i]++;
if (m_nextMessages[i] >= MAX_MESSAGES)
m_nextMessages[i] = 0;
m_bDirty = true;
m_nextMessages[i] = 0;
// ---------------
}
m_bDirty = true; // tell LogWindow that the log has been updated
}
bool IsLoggingActivated()

View file

@ -51,6 +51,8 @@ struct CDebugger_Log
struct CDebugger_LogSettings
{
int m_iVerbosity; // verbosity level 0 - 2
bool bResolve;
bool bWriteMaster;
// constructor
CDebugger_LogSettings();
@ -93,7 +95,7 @@ public:
m_szMessage[m_dwMsgLen] = 0;
m_type = _type;
m_bInUse = true;
m_bInUse = true; // turn on this message line
}
//
static void Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...);

View file

@ -123,7 +123,7 @@ void SignatureDB::Apply(SymbolDB *symbol_db)
if (iter->second.size == (unsigned int)function->size)
{
function->name = iter->second.name;
LOG(HLE, "Found %s at %08x (size: %08x)!", iter->second.name.c_str(), function->address, function->size);
LOG(HLE + 100, "Found %s at %08x (size: %08x)!", iter->second.name.c_str(), function->address, function->size);
}
else
{

View file

@ -299,7 +299,7 @@ CBreakPointWindow::OnAddMemoryCheckMany(wxCommandEvent& event)
bool doCommon = false;
// ------------------------------------------------------------------------------------------
// Decide if we have a range or just one address
// Decide if we have a range or just one address, and if we should break or not
// --------------
if (
pieces.size() == 1
@ -311,6 +311,7 @@ CBreakPointWindow::OnAddMemoryCheckMany(wxCommandEvent& event)
MemCheck.StartAddress = sAddress;
MemCheck.EndAddress = sAddress;
doCommon = true;
MemCheck.Break = false;
}
else if(
pieces.size() == 2
@ -322,6 +323,19 @@ CBreakPointWindow::OnAddMemoryCheckMany(wxCommandEvent& event)
MemCheck.StartAddress = sAddress;
MemCheck.EndAddress = eAddress;
doCommon = true;
MemCheck.Break = false;
}
else if(
pieces.size() == 3
&& AsciiToHex(pieces[0].c_str(), sAddress) && AsciiToHex(pieces[1].c_str(), eAddress)
&& pieces[0].size() == 8 && pieces[1].size() == 8 && pieces[2].size() == 1
)
{
// address range
MemCheck.StartAddress = sAddress;
MemCheck.EndAddress = eAddress;
doCommon = true;
MemCheck.Break = true;
}
if(doCommon)
@ -330,7 +344,7 @@ CBreakPointWindow::OnAddMemoryCheckMany(wxCommandEvent& event)
MemCheck.OnRead = true;
MemCheck.OnWrite = true;
MemCheck.Log = true;
MemCheck.Break = false; // this is also what sets Active "on" in the breakpoint window
//MemCheck.Break = false; // this is also what sets Active "on" in the breakpoint window
// so don't think it's off because we are only writing this to the log
CBreakPoints::AddMemoryCheck(MemCheck);
}

View file

@ -24,6 +24,7 @@ enum
IDM_UPDATELOG,
IDM_CLEARLOG,
IDM_LOGCHECKS,
IDM_OPTIONS,
IDM_ENABLEALL,
IDM_RADIO0,
IDM_SUBMITCMD = 300,

View file

@ -36,6 +36,7 @@ BEGIN_EVENT_TABLE(CLogWindow, wxDialog)
EVT_BUTTON(IDM_UPDATELOG, CLogWindow::OnUpdateLog)
EVT_BUTTON(IDM_CLEARLOG, CLogWindow::OnClear)
EVT_BUTTON(IDM_ENABLEALL, CLogWindow::OnEnableAll)
EVT_CHECKLISTBOX(IDM_OPTIONS, CLogWindow::OnOptionsCheck)
EVT_CHECKLISTBOX(IDM_LOGCHECKS, CLogWindow::OnLogCheck)
EVT_RADIOBOX(IDM_RADIO0, CLogWindow::OnRadioChange)
END_EVENT_TABLE()
@ -52,18 +53,37 @@ CLogWindow::CLogWindow(wxWindow* parent)
* sizerLeft = new wxBoxSizer(wxVERTICAL); // LEFT sizer
// left checkboxes and radio boxes -----------------------------------
m_checks = new wxCheckListBox(this, IDM_LOGCHECKS, wxDefaultPosition, wxSize(120, 280));
int m_radioBoxNChoices[1];
wxString m_radioBoxChoices0[] = { wxT("0"), wxT("1"), wxT("2"), wxT("3") };
m_radioBoxNChoices[0] = sizeof( m_radioBoxChoices0 ) / sizeof( wxString );
m_RadioBox[0] = new wxRadioBox( this, IDM_RADIO0, wxT("Verbosity"),
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[0], m_radioBoxChoices0, 1, wxRA_SPECIFY_ROWS);
wxStaticBoxSizer * m_optionsSizer = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Settings"));
m_options = new wxCheckListBox(this, IDM_OPTIONS, wxDefaultPosition, wxDefaultSize,
0, NULL, wxNO_BORDER);
m_options->Append(wxT("Resolve symbols"));
m_options->Append(wxT("Write master"));
m_optionsSizer->Add(m_options, 0, 0, 0);
// I could not find any transparency setting and it would not automatically space correctly
m_options->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
m_options->SetMinSize(wxSize(m_options->GetSize().GetWidth() - 40,
m_options->GetCount() * 15));
for (int i = 0; i < m_options->GetCount(); ++i)
m_options->GetItem(i)->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
m_checks = new wxCheckListBox(this, IDM_LOGCHECKS, wxDefaultPosition, wxSize(120, 280));
// finally add it to the sizer
sizerLeft->Add(m_RadioBox[0], 0, wxGROW);
sizerLeft->Add(m_optionsSizer, 0, wxGROW);
sizerLeft->Add(m_checks, 1, wxGROW);
// right windows -----------------------------------------------------
m_log = new wxTextCtrl(this, IDM_LOG, _T(""), wxDefaultPosition, wxSize(600, 120), wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP);
m_log = new wxTextCtrl(this, IDM_LOG, _T(""), wxDefaultPosition, wxSize(600, 120),
wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP);
m_cmdline = new wxTextCtrl(this, wxID_ANY, _T(""), wxDefaultPosition);
wxButton* btn = new wxButton(this, IDM_SUBMITCMD, _T("Submit"));
@ -118,6 +138,12 @@ void CLogWindow::Load(IniFile& _IniFile)
_IniFile.Get("LogWindow", "Verbosity", &v, m_RadioBox[0]->GetSelection());
m_RadioBox[0]->SetSelection(v);
LogManager::m_LogSettings->m_iVerbosity = v;
// load options
_IniFile.Get("LogWindow", "ResolveSymbols", &LogManager::m_LogSettings->bResolve, false);
_IniFile.Get("LogWindow", "WriteMaster", &LogManager::m_LogSettings->bWriteMaster, false);
m_options->Check(0, LogManager::m_LogSettings->bResolve);
m_options->Check(1, LogManager::m_LogSettings->bWriteMaster);
}
void CLogWindow::OnSubmit(wxCommandEvent& event)
@ -138,6 +164,10 @@ void CLogWindow::OnClear(wxCommandEvent& event)
}
}
// ----------------------------------------------------------------------------------------
// Enable or disable all boxes for the current verbosity level and save the changes.
// -------------
void CLogWindow::OnEnableAll(wxCommandEvent& event)
{
if (!LogManager::m_Log[0])
@ -159,7 +189,73 @@ void CLogWindow::OnEnableAll(wxCommandEvent& event)
// ----------------------------------------------------------------------------------------
// enable or disable logging groups
// Append checkboxes and update checked groups.
// -------------
void CLogWindow::UpdateChecks()
{
if (!LogManager::m_bInitialized)
{
return;
}
// This is only run once to append checkboxes to the wxCheckListBox.
if (m_checks->GetCount() == 0)
{
// [F|RES] hide the window while we fill it... wxwidgets gets trouble if you don't do it
// (at least the win version)
m_checks->Show(false);
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
{
m_checks->Append(wxString::FromAscii(LogManager::m_Log[i]->m_szName));
}
m_checks->Show(true);
}
// ----------------------------------------------------------------------------------------
// Load the correct values and enable/disable the right groups
// -------------
int v = LogManager::m_LogSettings->m_iVerbosity;
IniFile ini;
ini.Load("Debugger.ini");
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
{
for (int j = 0; j <= LogManager::VERBOSITY_LEVELS; j++)
{
bool Enabled = false;
ini.Get("LogManager", LogManager::m_Log[i + j*100]->m_szShortName, &Enabled, false);
m_checks->Check(i, Enabled);
LogManager::m_Log[i + j*100]->m_bEnable = Enabled;
LogManager::m_Log[i + j*100]->m_bShowInLog = Enabled;
}
}
m_bCheckDirty = true;
}
// ----------------------------------------------------------------------------------------
// When an option is changed
// ---------------
void CLogWindow::OnOptionsCheck(wxCommandEvent& event)
{
IniFile ini;
ini.Load("Debugger.ini");
LogManager::m_LogSettings->bResolve = m_options->IsChecked(0);
LogManager::m_LogSettings->bWriteMaster = m_options->IsChecked(1);
ini.Set("LogWindow", "ResolveSymbols", m_options->IsChecked(0));
ini.Set("LogWindow", "WriteMaster", m_options->IsChecked(1));
ini.Save("Debugger.ini");
if (Core::GetState() != Core::CORE_UNINITIALIZED) UpdateLog();
}
// ----------------------------------------------------------------------------------------
// When a checkbox is changed
// ---------------
void CLogWindow::OnLogCheck(wxCommandEvent& event)
{
@ -188,8 +284,9 @@ void CLogWindow::OnLogCheck(wxCommandEvent& event)
if (Core::GetState() != Core::CORE_UNINITIALIZED) UpdateLog();
}
// ----------------------------------------------------------------------------------------
// Change verbosity level
// When the verbosity level is changed
// -------------
void CLogWindow::OnRadioChange(wxCommandEvent& event)
{
@ -203,6 +300,8 @@ void CLogWindow::OnRadioChange(wxCommandEvent& event)
ini.Set("LogWindow", "Verbosity", v);
ini.Save("Debugger.ini");
// This check is because we allow this to be changed before a game has been loaded so
// that the boxes do not exist yet
if (Core::GetState() != Core::CORE_UNINITIALIZED)
{
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
@ -220,56 +319,9 @@ void CLogWindow::OnRadioChange(wxCommandEvent& event)
}
// ----------------------------------------------------------------------------------------
// Update checked groups.
// -------------
void CLogWindow::UpdateChecks()
{
if (!LogManager::m_bInitialized)
{
return;
}
// This is only run once to append checkboxes to the wxCheckListBox.
if (m_checks->GetCount() == 0)
{
// [F|RES] hide the window while we fill it... wxwidgets gets trouble if you don't do it
// (at least the win version)
m_checks->Show(false);
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
{
m_checks->Append(wxString::FromAscii(LogManager::m_Log[i]->m_szName));
}
m_checks->Show(true);
}
// ----------------------------------------------------------------------------------------
// Load the correct values
// -------------
int v = LogManager::m_LogSettings->m_iVerbosity;
IniFile ini;
ini.Load("Debugger.ini");
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
{
bool Enabled = false;
ini.Get("LogManager", LogManager::m_Log[i + v*100]->m_szShortName, &Enabled, false);
m_checks->Check(i, Enabled);
LogManager::m_Log[i]->m_bEnable = Enabled;
LogManager::m_Log[i]->m_bShowInLog = Enabled;
}
m_bCheckDirty = true;
}
void CLogWindow::OnUpdateLog(wxCommandEvent& event)
{
if (Core::GetState() != Core::CORE_UNINITIALIZED) NotifyUpdate();
if (Core::GetState() != Core::CORE_UNINITIALIZED) UpdateLog();
}
@ -286,14 +338,17 @@ void CLogWindow::UpdateLog()
int v = LogManager::m_LogSettings->m_iVerbosity;
int i = LogManager::m_nextMessages[v];
// check if the the log has been updated (ie if it's dirty)
if ((last == i) && !m_bCheckDirty)
{
return;
}
m_bCheckDirty = false;
last = i;
//bash together a log buffer really fast (no slow strcpy here, just memcpys)
// ----------------------------------------------------------------------------------------
// Prepare a selection of the memory log to show to screen
// ---------------
int count = 0;
char* p = m_logBuffer;
@ -303,14 +358,17 @@ void CLogWindow::UpdateLog()
count++;
const LogManager::SMessage& message = LogManager::m_Messages[v][i];
if (message.m_bInUse)
if (message.m_bInUse) // check if the line has a value
{
int len = message.m_dwMsgLen;
// this is what we use, I'm not sure why we have this option
if (LogManager::m_activeLog == LogTypes::MASTER_LOG)
{
// only show checkboxed logs
if (LogManager::m_Log[message.m_type]->m_bShowInLog)
{
// memcpy is faster than strcpy
memcpy(p, message.m_szMessage, len);
p += len;
}
@ -332,10 +390,12 @@ void CLogWindow::UpdateLog()
i = 0;
}
}
// ---------------
*p = 0; //end the string
m_log->SetValue(wxString::FromAscii(m_logBuffer));
m_log->SetInsertionPoint(p - m_logBuffer - 1);
m_log->ShowPosition( m_log->GetLastPosition()); // show last line
}

View file

@ -39,12 +39,14 @@ class CLogWindow
char m_logBuffer[LogBufferSize];
wxTextCtrl* m_log, * m_cmdline;
wxCheckListBox* m_checks;
wxCheckListBox* m_options;
wxRadioBox *m_RadioBox[1]; // radio boxes
bool m_bCheckDirty;
DECLARE_EVENT_TABLE()
void OnSubmit(wxCommandEvent& event);
void OnUpdateLog(wxCommandEvent& event);
void OnOptionsCheck(wxCommandEvent& event);
void OnLogCheck(wxCommandEvent& event);
void OnRadioChange(wxCommandEvent& event); // verbosity buttons
void OnClear(wxCommandEvent& event);

View file

@ -39,21 +39,19 @@ extern bool gOnlyLooping;
// =======================================================================================
// Declare events
BEGIN_EVENT_TABLE(CDebugger,wxDialog)
EVT_CLOSE(CDebugger::OnClose)
EVT_BUTTON(ID_UPD,CDebugger::OnUpdate)
EVT_CHECKBOX(IDC_CHECK0,CDebugger::SaveFile)
EVT_CLOSE(CDebugger::OnClose) // on close event
EVT_BUTTON(ID_UPD,CDebugger::OnUpdate) // buttons
EVT_CHECKBOX(IDC_CHECK0,CDebugger::SaveFile) // options
EVT_CHECKBOX(IDC_CHECK2,CDebugger::ShowHideConsole)
EVT_CHECKBOX(IDC_CHECK3,CDebugger::OnlyLooping)
EVT_CHECKBOX(IDC_CHECK3,CDebugger::SSBM)
EVT_CHECKBOX(IDC_CHECK4,CDebugger::SSBMremedy1)
EVT_CHECKBOX(IDC_CHECK5,CDebugger::SSBMremedy2)
EVT_CHECKBOX(IDC_CHECK8,CDebugger::Sequenced)
EVT_CHECKBOX(IDC_CHECK9,CDebugger::Volume)
EVT_CHECKBOX(IDC_CHECK6,CDebugger::Reset)
EVT_CHECKBOX(IDC_CHECK7,CDebugger::OnlyLooping)
EVT_RADIOBOX(IDC_RADIO1,CDebugger::ChangeFrequency) // update frequency
EVT_RADIOBOX(IDC_RADIO1,CDebugger::ChangeFrequency)
EVT_RADIOBOX(IDC_RADIO2,CDebugger::ChangePreset)
EVT_RADIOBOX(IDC_RADIO2,CDebugger::ChangePreset) // presets
EVT_CHECKLISTBOX(IDC_CHECKLIST1, CDebugger::OnSettingsCheck) // settings
END_EVENT_TABLE()
// =======================================================================================
@ -140,19 +138,17 @@ SetTitle(wxT("Sound Debugging"));
wxStaticBoxSizer* sLeft;
// checkboxes and labels -----------------------------------------------------
m_Label[0] = new wxStaticBox(this, IDG_LABEL1, wxT("Options"),
wxDefaultPosition, wxDefaultSize, 0);
wxStaticBoxSizer * m_checkSizer = new wxStaticBoxSizer (m_Label[0], wxVERTICAL);
wxStaticBoxSizer * m_checkSizer = new wxStaticBoxSizer (wxVERTICAL, this, wxT("Options"));
// checkboxes
m_Check[0] = new wxCheckBox(this, IDC_CHECK0, wxT("Save to file"),
m_Check[0] = new wxCheckBox(this, IDC_CHECK1, wxT("Save to file"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[1] = new wxCheckBox(this, IDC_CHECK1, wxT("Show updated"),
m_Check[1] = new wxCheckBox(this, IDC_CHECK2, wxT("Show updated"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[1]->Enable(false);
m_Check[7] = new wxCheckBox(this, IDC_CHECK7, wxT("Only looping"),
m_Check[7] = new wxCheckBox(this, IDC_CHECK3, wxT("Only looping"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[2] = new wxCheckBox(this, IDC_CHECK2, wxT("Show console"),
m_Check[2] = new wxCheckBox(this, IDC_CHECK4, wxT("Show console"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_checkSizer->Add(m_Check[0], 0, 0, 5);
@ -162,38 +158,34 @@ SetTitle(wxT("Sound Debugging"));
// ------------------------
// settings checkboxes -----------------------------------------------------
m_Label[1] = new wxStaticBox(this, IDG_LABEL2, wxT("Settings"),
wxDefaultPosition, wxDefaultSize, 0);
wxStaticBoxSizer * m_checkSizer2 = new wxStaticBoxSizer (m_Label[1], wxVERTICAL);
// checkboxes
m_Check[3] = new wxCheckBox(this, IDC_CHECK3, wxT("SSBM fix"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[3]->SetValue(gSSBM);
m_Check[4] = new wxCheckBox(this, IDC_CHECK4, wxT("SSBM remedy 1"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[4]->SetValue(gSSBMremedy1);
m_Check[5] = new wxCheckBox(this, IDC_CHECK5, wxT("SSBM remedy 2"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[5]->SetValue(gSSBMremedy2);
m_Check[8] = new wxCheckBox(this, IDC_CHECK8, wxT("Sequenced"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[8]->SetValue(gSequenced);
m_Check[9] = new wxCheckBox(this, IDC_CHECK9, wxT("Volume delta"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[9]->SetValue(gVolume);
m_Check[6] = new wxCheckBox(this, IDC_CHECK6, wxT("Reset all"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[6]->SetValue(gReset);
wxStaticBoxSizer * m_checkSizer2 = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Settings"));
m_settings = new wxCheckListBox(this, IDC_CHECKLIST1, wxDefaultPosition, wxDefaultSize,
0, NULL, wxNO_BORDER);
m_checkSizer2->Add(m_Check[3], 0, 0, 5);
m_checkSizer2->Add(m_Check[4], 0, 0, 5);
m_checkSizer2->Add(m_Check[5], 0, 0, 5);
m_checkSizer2->Add(m_Check[8], 0, 0, 5);
m_checkSizer2->Add(m_Check[9], 0, 0, 5);
m_checkSizer2->Add(m_Check[6], 0, 0, 5);
// ------------------------
m_settings->Append(wxT("SSBM fix"));
m_settings->Append(wxT("SSBM remedy 1"));
m_settings->Append(wxT("SSBM remedy 2"));
m_settings->Append(wxT("Sequenced"));
m_settings->Append(wxT("Volume delta"));
m_settings->Append(wxT("Reset all"));
m_settings->Check(0, gSSBM);
m_settings->Check(1, gSSBMremedy1);
m_settings->Check(2, gSSBMremedy2);
m_settings->Check(3, gSequenced);
m_settings->Check(4, gVolume);
m_settings->Check(5, gReset);
// 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));
for (int i = 0; i < m_settings->GetCount(); ++i)
m_settings->GetItem(i)->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
m_checkSizer2->Add(m_settings, 0, 0, 0);
// ------------------------
// radio boxes -----------------------------------------------------
int m_radioBoxNChoices[2];
@ -232,32 +224,27 @@ SetTitle(wxT("Sound Debugging"));
sButtons2->AddStretchSpacer(1);
sButtons2->Add(m_RadioBox[2], 0, 0, 5);
sButtons2->AddStretchSpacer(1);
sButtons2->Add(m_checkSizer2, 0, 2, 5);
sButtons2->Add(m_checkSizer2, 0, 0, 5);
sButtons2->AddStretchSpacer(1);
// left buttons
wxBoxSizer* sButtons;
sButtons = new wxBoxSizer(wxVERTICAL);
sButtons->AddStretchSpacer(1);
sButtons->AddSpacer(5); // to set a minimum margin
sButtons->Add(m_Upd, 0, 0, 5);
sButtons->Add(m_SelC, 0, 0, 5);
sButtons->Add(m_Presets, 0, 0, 5);
sButtons->AddStretchSpacer(1);
sButtons->Add(m_checkSizer, 0, 2, 5);
sButtons->Add(m_checkSizer, 0, 0, 5);
sButtons->AddStretchSpacer(1);
sButtons->Add(m_RadioBox[0], 0, 0, 5);
sButtons->AddStretchSpacer(1);
sButtons->Add(m_RadioBox[1], 0, 0, 5);
sButtons->AddStretchSpacer(1);
sButtons->AddSpacer(5);
// blocks view
sLeft = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Current Status"));
@ -266,9 +253,9 @@ SetTitle(wxT("Sound Debugging"));
// add all stuff to the main container
sMain = new wxBoxSizer(wxHORIZONTAL);
sMain->Add(sLeft, 1, wxEXPAND|wxALL, 5);
sMain->Add(sButtons, 0, wxEXPAND, 0);
sMain->Add(sButtons2, 0, wxEXPAND, 0);
sMain->Add(sLeft, 1, wxEXPAND | wxALL, 5); // margin = 5
sMain->Add(sButtons, 0, wxALL, 0);
sMain->Add(sButtons2, 0, wxALL, 5); // margin = 5
this->SetSizer(sMain);
sMain->SetSizeHints(this);
@ -300,48 +287,14 @@ void CDebugger::OnUpdate(wxCommandEvent& /*event*/)
// =======================================================================================
// Settings
// --------------
void CDebugger::SSBM(wxCommandEvent& event)
void CDebugger::OnSettingsCheck(wxCommandEvent& event)
{
if(m_Check[3]->IsChecked() == 1)
{gSSBM = true;}
else
{gSSBM = false;}
}
void CDebugger::SSBMremedy1(wxCommandEvent& event)
{
if(m_Check[4]->IsChecked() == 1)
{gSSBMremedy1 = true;}
else
{gSSBMremedy1 = false;}
}
void CDebugger::SSBMremedy2(wxCommandEvent& event)
{
if(m_Check[5]->IsChecked() == 1)
{gSSBMremedy2 = true;}
else
{gSSBMremedy2 = false;}
}
void CDebugger::Sequenced(wxCommandEvent& event)
{
if(m_Check[8]->IsChecked() == 1)
{gSequenced = true;}
else
{gSequenced = false;}
}
void CDebugger::Volume(wxCommandEvent& event)
{
if(m_Check[9]->IsChecked() == 1)
{gVolume = true;}
else
{gVolume = false;}
}
void CDebugger::Reset(wxCommandEvent& event)
{
if(m_Check[6]->IsChecked() == 1)
{gReset = true;}
else
{gReset = false;}
gSSBM = m_settings->IsChecked(0);
gSSBMremedy1 = m_settings->IsChecked(1);
gSSBMremedy2 = m_settings->IsChecked(2);
gSequenced = m_settings->IsChecked(3);
gVolume = m_settings->IsChecked(4);
gReset = m_settings->IsChecked(5);
}
// =======================================================================================

View file

@ -69,25 +69,20 @@ class CDebugger : public wxDialog
void NotifyUpdate();
void OnUpdate(wxCommandEvent& event);
void SaveFile(wxCommandEvent& event);
void SaveFile(wxCommandEvent& event); // options
void ShowHideConsole(wxCommandEvent& event);
void DoShowHideConsole();
void ChangeFrequency(wxCommandEvent& event);
void OnlyLooping(wxCommandEvent& event);
void ChangeFrequency(wxCommandEvent& event); // update frequency
void DoChangeFrequency();
void ChangePreset(wxCommandEvent& event);
void DoChangePreset();
void SSBM(wxCommandEvent& event);
void SSBMremedy1(wxCommandEvent& event);
void SSBMremedy2(wxCommandEvent& event);
void BSDON(wxCommandEvent& event);
void Sequenced(wxCommandEvent& event);
void Volume(wxCommandEvent& event);
void Reset(wxCommandEvent& event);
void OnlyLooping(wxCommandEvent& event);
void OnSettingsCheck(wxCommandEvent& event); // settings
CPBView* m_GPRListView;
CPBView* m_GPRListView;
private:
@ -95,7 +90,7 @@ class CDebugger : public wxDialog
wxCheckBox *m_Check[9];
wxRadioButton *m_Radio[5];
wxRadioBox *m_RadioBox[3];
wxStaticBox *m_Label[1];
wxCheckListBox * m_settings;
wxPanel *m_Controller;
// WARNING: Make sure these are not also elsewhere, for example in resource.h.
@ -106,11 +101,7 @@ class CDebugger : public wxDialog
IDC_CHECK2,
IDC_CHECK3,
IDC_CHECK4,
IDC_CHECK5,
IDC_CHECK6,
IDC_CHECK7,
IDC_CHECK8,
IDC_CHECK9,
IDC_CHECKLIST1,
IDC_RADIO0,
IDC_RADIO1,
IDC_RADIO2,