From 389fef2e30a854e179f09aabf220e2bef649a6bd Mon Sep 17 00:00:00 2001 From: John Peterson Date: Sat, 17 Jan 2009 14:36:32 +0000 Subject: [PATCH] Last commit: Missing files git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1889 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Plugin_VideoOGL/Src/Debugger/Logging.cpp | 272 ++++++++++++++++++ .../Plugin_VideoOGL/Src/Debugger/Logging.h | 25 ++ 2 files changed, 297 insertions(+) create mode 100644 Source/Plugins/Plugin_VideoOGL/Src/Debugger/Logging.cpp create mode 100644 Source/Plugins/Plugin_VideoOGL/Src/Debugger/Logging.h diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Logging.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Logging.cpp new file mode 100644 index 0000000000..bd4c24f099 --- /dev/null +++ b/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Logging.cpp @@ -0,0 +1,272 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// +// 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/ +// +////////////////////////////////////////////////////////////////////////////////////////// + + +// ======================================================================================= +// Includes +// --------------- +#include "../Globals.h" // This is the precompiled header and must be the first ... + +#include +#include +#include // so that we can test std::string == abc +#include // for the pow() function +#ifdef _WIN32 + #include +#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 +// ======================= + + +// ======================================================================================= +// Declarations and definitions +// --------------- + +// ------------------------- +// 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 + +// ------------------------- +// Counters +// ------------- +int j = 0; +int k = 0; +bool iupdonce = false; +std::vector viupd(15); // the length of the update frequency bar + +// ------------------------- +// Classes +// ------------- +#if defined(HAVE_WX) && HAVE_WX +extern CDebugger* m_frame; +#endif +// ======================= + + +// ======================================================================================= +// Write title +// -------------- +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; + // ======================================================================================= + // PRESETS + // --------------------------------------------------------------------------------------- + /* + 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) +{ + + + // ======================================================================================= + // Update parameter values + // -------------- + // AXPB base + + + // ============== + + + // ======================================================================================= + // 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("%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 diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Logging.h b/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Logging.h new file mode 100644 index 0000000000..b4cb14dce0 --- /dev/null +++ b/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Logging.h @@ -0,0 +1,25 @@ +// 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(); +//////////////////////////////// \ No newline at end of file