summaryrefslogtreecommitdiff
path: root/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp
diff options
context:
space:
mode:
authorJohn Peterson <jpeterson57@gmail.com>2008-11-21 01:28:00 +0000
committerJohn Peterson <jpeterson57@gmail.com>2008-11-21 01:28:00 +0000
commit8a77ca81897e52bdbe05afb5dc527063d80199f9 (patch)
tree215a1d986aa5ea575bc7d4e482a0c04642e862a4 /Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp
parentf5a92e2e9eca7338cf905ebd9f1a23e88cd8b15b (diff)
Made the OpenGL iLog setting changeable from the debugging window
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1232 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp')
-rw-r--r--Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp319
1 files changed, 16 insertions, 303 deletions
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp
index de5b9b161b..c176325b9d 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp
@@ -44,7 +44,6 @@ bool gSSBMremedy2 = true;
bool gSequenced = true;
bool gVolume = true;
bool gReset = false;
-extern std::vector<std::string> sMailLog, sMailTime;
// =======================================================================================
@@ -527,6 +526,9 @@ SetTitle(wxT("Sound Debugging"));
// --------------------------------------------------------------------
}
+// ========================================================================
+// System functions
+// --------------
void CDebugger::OnClose(wxCloseEvent& /*event*/)
{
// save the window position when we hide the window to
@@ -536,16 +538,26 @@ void CDebugger::OnClose(wxCloseEvent& /*event*/)
file.Save(DEBUGGER_CONFIG_FILE);
EndModal(0);
+ CloseConsole(); // Take the console window with it
+}
+
+void CDebugger::DoHide()
+{
+ Hide();
+ CloseConsole(); // The console goes with the wx window
+}
- // I turned this off for now because of the ShowModal() problem and because I wanted
- // to look at the logs at the same time as the console window.
- //CloseConsole();
+void CDebugger::DoShow()
+{
+ Show();
+ DoShowHideConsole(); // The console goes with the wx window
}
void CDebugger::OnUpdate(wxCommandEvent& /*event*/)
{
this->NotifyUpdate();
}
+// ===============
// =======================================================================================
@@ -661,13 +673,9 @@ void CDebugger::ShowHideConsole(wxCommandEvent& event)
void CDebugger::DoShowHideConsole()
{
if(m_options->IsChecked(3))
- {
OpenConsole();
- }
else
- {
CloseConsole();
- }
}
// ==============
@@ -680,298 +688,3 @@ void CDebugger::NotifyUpdate()
}
}
-
-// =======================================================================================
-// Update mail window
-// --------------
-void CDebugger::DoUpdateMail()
-{
- //wprintf("i %i %i\n", sFullMail.size(), sMailLog.size());
-
- if(sFullMail.size() > 0 && sMailLog.size() > 0)
- {
- m_log->SetValue(wxString::FromAscii(sFullMail.at(m_RadioBox[3]->GetSelection()).c_str()));
- m_log->SetDefaultStyle(wxTextAttr(*wxBLUE)); // doesn't work because of the current wx
-
- m_log1->SetValue(wxString::FromAscii(sMailLog.at(m_RadioBox[3]->GetSelection()).c_str()));
- m_log1->AppendText(wxT("\n\n"));
- }
-}
-
-
-void CDebugger::UpdateMail(wxNotebookEvent& event)
-{
- DoUpdateMail();
- if(StoreMails) ReadDir();
-}
-
-// Change mail from radio button change
-void CDebugger::ChangeMail(wxCommandEvent& event)
-{
- //wprintf("abc");
- DoUpdateMail();
- //if(StoreMails) ReadDir();
-}
-// ==============
-
-
-
-// =======================================================================================
-// Read out mails from dir
-// --------------
-void CDebugger::ReadDir()
-{
- CFileSearch::XStringVector Directories;
- //Directories.push_back("Logs/Mail");
- Directories.push_back(FULL_MAIL_LOGS_DIR);
-
- CFileSearch::XStringVector Extensions;
- Extensions.push_back("*.log");
-
- CFileSearch FileSearch(Extensions, Directories);
- const CFileSearch::XStringVector& rFilenames = FileSearch.GetFileNames();
-
- //m_gc->Show(false);
- //m_gc->Append(wxT("SSBM ffffix"));
- //m_gc->Show(true);
-
- // Clear in case we already did this earlier
- all_all_files.clear();
-
- if (rFilenames.size() > 0 && m_gc && m_wii)
- {
- for (u32 i = 0; i < rFilenames.size(); i++)
- {
- std::string FileName;
- SplitPath(rFilenames[i], NULL, &FileName, NULL); // place the filename in FileName
-
- //std::string FileName = StripSpaces(*FileName);
- std::vector<std::string> pieces;
- SplitString(FileName, "_sep", pieces); // split string
-
- // Save all filenames heres
- if(pieces[2] == "0") all_all_files.push_back(pieces[0]);
-
- // Cut to size
- std::string cut;
- if(pieces[0].length() > 18)
- cut = pieces[0].substr(0, 18) + "...";
- else
- cut = pieces[0];
-
- //wprintf("%s %s %s\n", pieces[0].c_str(), pieces[1].c_str(),
- // pieces[2].c_str(), pieces[3].c_str());
-
- if (NoDuplicate(pieces[0]) && pieces.size() >= 3)
- {
- all_files.push_back(pieces[0]);
- if (pieces[3] == "GC")
- {
- gc_files.push_back(pieces[0]);
- m_gc->Append(wxString::FromAscii(cut.c_str()));
- }
- else
- {
- wii_files.push_back(pieces[0]);
- m_wii->Append(wxString::FromAscii(cut.c_str()));
- }
- }
- }
- }
-}
-
-
-
-// =======================================================================================
-// Check for duplicates and count files from all_all_files
-// --------------
-bool CDebugger::NoDuplicate(std::string FileName)
-{
- for (int i = 0; i < all_files.size(); i++)
- {
- if(all_files.at(i) == FileName)
- return false;
- }
- return true;
-}
-
-// Count the number of files for each game
-int CDebugger::CountFiles(std::string FileName)
-{
- int match = 0;
-
- for (u32 i = 0; i < all_all_files.size(); i++)
- {
- //wprintf("CountFiles %i %s\n", i, all_all_files[i].c_str());
- if(all_all_files[i] == FileName)
- match++;
- }
- //wprintf("We found %i files for this game\n", match);
- return match;
-}
-// ==============
-
-
-// =======================================================================================
-// Read file from harddrive
-// --------------
-std::string CDebugger::Readfile_(std::string FileName)
-{
- char c; // declare a char variable
- FILE *file; // declare a FILE pointer
- std::string sz = "";
- char ch[1] = "";
-
- if(File::Exists(FileName.c_str()))
- file = fopen(FileName.c_str(), "r"); // open a text file for reading
- else
- return "";
-
- if(file == NULL)
- {
- // file could not be opened
- }
- else
- {
- while(1) // looping through file
- {
- c = fgetc(file);
-
- if(c != EOF)
- sz += c; // print the file one character at a time
- else
- break; // break when EOF is reached
- }
-
- fclose(file);
- return sz;
- }
-}
-
-// Read file
-void CDebugger::Readfile(std::string FileName, bool GC)
-{
- int n = CountFiles(FileName); // count how many mails we have
- int curr_n = 0;
- std::ifstream file;
- for (int i = 0; i < m_RadioBox[3]->GetCount(); i++)
- {
- if(m_RadioBox[3]->IsItemEnabled(i)) curr_n++;
- m_RadioBox[3]->Enable(i, false); // disable all
- }
- //wprintf("Disabled all: n %i\n", n);
-
-
- for (int i = 0; i < n; i++)
- {
- m_RadioBox[3]->Enable(i, true); // then anble the right ones
- //wprintf("m_RadioBox[3] enabled: %i\n", i);
-
- std::string sz = "";
- std::ostringstream ci;
- ci << i;
- std::string f0 = FULL_MAIL_LOGS_DIR + FileName + "_sep" + ci.str() + "_sep" + "0_sep" + (GC ? "GC" : "Wii") + "_sep.log";
- std::string f1 = FULL_MAIL_LOGS_DIR + FileName + "_sep" + ci.str() + "_sep" + "1_sep" + (GC ? "GC" : "Wii") + "_sep.log";
-
- //wprintf("ifstream %s %s\n", f0.c_str(), f1.c_str());
-
- if(sFullMail.size() <= i) sFullMail.resize(sFullMail.size() + 1);
- if(sMailLog.size() <= i) sMailLog.resize(sMailLog.size() + 1);
-
- if(Readfile_(f0).length() > 0) sFullMail.at(i) = Readfile_(f0);
- else sFullMail.at(i) = "";
- if(Readfile_(f1).length() > 0) sMailLog.at(i) = Readfile_(f1);
- else sMailLog.at(i) = "";
- }
- if(n < curr_n) m_RadioBox[3]->Select(n - 1);
- //wprintf("Select: %i | n %i curr_n %i\n", n - 1, n, curr_n);
- DoUpdateMail();
-}
-// ==============
-
-
-// =======================================================================================
-// Read the file to the text window
-// ---------------
-void CDebugger::OnGameChange(wxCommandEvent& event)
-{
- if(event.GetId() == 2006)
- {
- // Only allow one selected game at a time
- for (int i = 0; i < m_gc->GetCount(); ++i)
- if(i != event.GetInt()) m_gc->Check(i, false);
- for (int i = 0; i < m_wii->GetCount(); ++i)
- m_wii->Check(i, false);
- Readfile(gc_files[event.GetInt()], true);
- }
- else
- {
- for (int i = 0; i < m_gc->GetCount(); ++i)
- m_gc->Check(i, false);
- for (int i = 0; i < m_wii->GetCount(); ++i)
- if(i != event.GetInt()) m_wii->Check(i, false);
- Readfile(wii_files[event.GetInt()], false);
- }
-
-
-}
-
-// Settings
-void CDebugger::MailSettings(wxCommandEvent& event)
-{
- //for (int i = 0; i < all_all_files.size(); ++i)
- //wprintf("s: %s \n", all_all_files.at(i).c_str());
-
- ScanMails = m_gcwiiset->IsChecked(0);
- StoreMails = m_gcwiiset->IsChecked(1);
-}
-
-
-
-
-//double A;
-void CDebugger::DoScrollBlocks()
-{
- // ShowPosition = in letters
- // GetScrollPos = number of lines from the top
- // GetLineLength = letters in one line
- // SetScrollPos = only set the scrollbar, doesn't update the text,
- // Update() or Refresh() doesn't help
-
- double pos = m_bl95->GetScrollPos(wxVERTICAL)*(m_bl95->GetLineLength(0)+12.95); // annoying :(
- m_bl0->ShowPosition((int)pos);
-
- /*
- if(GetAsyncKeyState(VK_NUMPAD1))
- A -= 0.1;
- else if(GetAsyncKeyState(VK_NUMPAD2))
- A += 0.11;
-
- wprintf("GetScrollPos:%i GetScrollRange:%i GetPosition:%i GetLastPosition:%i GetMaxWidth:%i \
- GetLineLength:%i XYToPosition:%i\n \
- GetScrollPos * GetLineLength + GetScrollRange:%i A:%f\n",
- m_bl95->GetScrollPos(wxVERTICAL), m_bl95->GetScrollRange(wxVERTICAL),
- m_bl95->GetPosition().y, m_bl95->GetLastPosition(), m_bl95->GetMaxWidth(),
- m_bl95->GetLineLength(0), m_bl95->XYToPosition(0,25),
- pos, A
- );
-
- for (int i = 0; i < 127; ++i)
- {
- m_bl0->AppendText(wxString::Format("%02i|68 : 01a70144\n", i));
- m_bl95->AppendText(wxString::Format("%i Mouse\n", i));
- }*/
-}
-
-void CDebugger::ScrollBlocksMouse(wxMouseEvent& event)
-{
- DoScrollBlocks();
- event.Skip(); // otherwise we remove the regular behavior, for example scrolling
-}
-
-void CDebugger::ScrollBlocksCursor(wxScrollWinEvent& event)
-{
- DoScrollBlocks();
- event.Skip(); // otherwise we remove the regular behavior, for example scrolling
-}
-// ==============