From a838206f7be2299826f3b722b93add9df3f1095f Mon Sep 17 00:00:00 2001 From: nakeee Date: Tue, 1 Sep 2009 08:44:32 +0000 Subject: [PATCH] Linux Compile fix and Code clean up commented some logging lines that gave: warning: cannot pass objects of non-POD type 'const class wxCharBuffer' through '...'; call will abort at runtime This actually aborts on run time so please fix it if you wish to uncomment it git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4135 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/ConsoleListener.cpp | 2 +- Source/Core/Common/Src/Log.h | 10 +- Source/Core/Common/Src/LogManager.h | 2 + Source/Core/DolphinWX/Src/Frame.cpp | 126 ++++++--------------- 4 files changed, 44 insertions(+), 96 deletions(-) diff --git a/Source/Core/Common/Src/ConsoleListener.cpp b/Source/Core/Common/Src/ConsoleListener.cpp index 71530ca78a..7419c86b40 100644 --- a/Source/Core/Common/Src/ConsoleListener.cpp +++ b/Source/Core/Common/Src/ConsoleListener.cpp @@ -271,7 +271,7 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text) Color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break; } - if (Level != CUSTOM_LEVEL && strlen(Text) > 10) + if (strlen(Text) > 10) { // First 10 chars white SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY); diff --git a/Source/Core/Common/Src/Log.h b/Source/Core/Common/Src/Log.h index 2060e6b301..a24f7e65f0 100644 --- a/Source/Core/Common/Src/Log.h +++ b/Source/Core/Common/Src/Log.h @@ -23,7 +23,6 @@ #define WARNING_LEVEL 3 // Something is suspicious. #define INFO_LEVEL 4 // General information. #define DEBUG_LEVEL 5 // Detailed debugging - might make things slow. -#define CUSTOM_LEVEL 6 // Custom level namespace LogTypes { @@ -82,7 +81,6 @@ enum LOG_LEVELS { LWARNING = WARNING_LEVEL, LINFO = INFO_LEVEL, LDEBUG = DEBUG_LEVEL, - LCUSTOM = CUSTOM_LEVEL }; } // namespace @@ -93,11 +91,11 @@ enum LOG_LEVELS { - Debug_run() - run only in debug time */ #if defined LOGGING || defined _DEBUG || defined DEBUGFAST - #define MAX_LOGLEVEL DEBUG_LEVEL +#define MAX_LOGLEVEL DEBUG_LEVEL #else - #ifndef MAX_LOGLEVEL - #define MAX_LOGLEVEL WARNING_LEVEL - #endif // loglevel +#ifndef MAX_LOGLEVEL +#define MAX_LOGLEVEL WARNING_LEVEL +#endif // loglevel #endif // logging #define ERROR_LOG(...) {} diff --git a/Source/Core/Common/Src/LogManager.h b/Source/Core/Common/Src/LogManager.h index 76692c60fe..6a4c9ca46d 100644 --- a/Source/Core/Common/Src/LogManager.h +++ b/Source/Core/Common/Src/LogManager.h @@ -21,7 +21,9 @@ #include "Log.h" #include "Thread.h" #include "StringUtil.h" +#ifdef _WIN32 #include +#endif #include #include #include diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index c41a5a088d..0333d3f40f 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -17,22 +17,16 @@ -////////////////////////////////////////////////////////////////////////////////////////// -// Windows -/* ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ +/* -CFrame is the main parent window. Inside CFrame there is an m_Panel that is the parent for -the rendering window (when we render to the main window). In Windows the rendering window is -created by giving CreateWindow() m_Panel->GetHandle() as parent window and creating a new -child window to m_Panel. The new child window handle that is returned by CreateWindow() can -be accessed from Core::GetWindowHandle(). +CFrame is the main parent window. Inside CFrame there is an m_Panel that is the +parent for the rendering window (when we render to the main window). In Windows +the rendering window is created by giving CreateWindow() m_Panel->GetHandle() +as parent window and creating a new child window to m_Panel. The new child +window handle that is returned by CreateWindow() can be accessed from +Core::GetWindowHandle(). +*/ -///////////////////////////////////////////////*/ - - -// ---------------------------------------------------------------------------- -// includes -// ---------------------------------------------------------------------------- #include "Common.h" // Common #include "FileUtil.h" @@ -57,10 +51,6 @@ be accessed from Core::GetWindowHandle(). #include // wxWidgets -// ---------------------------------------------------------------------------- -// resources -// ---------------------------------------------------------------------------- - extern "C" { #include "../resources/Dolphin.c" // Dolphin icon #include "../resources/toolbar_browse.c" @@ -82,10 +72,10 @@ extern "C" { }; -///////////////////////////////////////////////////////////////////////////////////////////////////////// -/* Windows functions. Setting the cursor with wxSetCursor() did not work in this instance. - Probably because it's somehow reset from the WndProc() in the child window */ -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ +/* Windows functions. Setting the cursor with wxSetCursor() did not work in + this instance. Probably because it's somehow reset from the WndProc() in + the child window */ + #ifdef _WIN32 // Declare a blank icon and one that will be the normal cursor HCURSOR hCursor = NULL, hCursorBlank = NULL; @@ -113,13 +103,7 @@ HWND MSWGetParent_(HWND Parent) return GetParent(Parent); } #endif -///////////////////////////////////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////////////////////////////////// -/* The CPanel class to receive MSWWindowProc messages from the video plugin. */ -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ extern CFrame* main_frame; class CPanel : public wxPanel @@ -193,9 +177,8 @@ int abc = 0; Core::ReconnectWiimote(); return 0; - // ----------------------------------------- #ifdef RERECORDING - // ----------------- + case INPUT_FRAME_COUNTER: // Wind back the frame counter after a save state has been loaded Core::WindBack((int)lParam); @@ -213,12 +196,6 @@ int abc = 0; return wxPanel::MSWWindowProc(nMsg, wParam, lParam); } #endif -///////////////////////////////////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////////////////////////////////// -// event tables -// ---------------------------- // Notice that wxID_HELP will be processed for the 'About' menu and the toolbar // help button. @@ -311,12 +288,8 @@ EVT_AUINOTEBOOK_ALLOW_DND(wxID_ANY, CFrame::OnAllowNotebookDnD) EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY, CFrame::OnNotebookPageChanged) END_EVENT_TABLE() -///////////////////////////////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////////////////////// -// Creation and close, quit functions -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ CFrame::CFrame(bool showLogWindow, wxFrame* parent, wxWindowID id, @@ -372,9 +345,6 @@ CFrame::CFrame(bool showLogWindow, // Give it a menu bar CreateMenu(); - // ------------------------------------------------------------------------- - // Main panel - // ŻŻŻŻŻŻŻŻŻŻŻŻŻ // This panel is the parent for rendering and it holds the gamelistctrl m_Panel = new CPanel(this, IDM_MPANEL); @@ -385,7 +355,6 @@ CFrame::CFrame(bool showLogWindow, sizerPanel = new wxBoxSizer(wxHORIZONTAL); sizerPanel->Add(m_GameListCtrl, 1, wxEXPAND | wxALL); m_Panel->SetSizer(sizerPanel); - // ------------------------------------------------------------------------- m_Mgr = new wxAuiManager(); m_Mgr->SetManagedWindow(this); @@ -456,9 +425,6 @@ CFrame::CFrame(bool showLogWindow, CreateCursor(); #endif - // ------------------------- - // Connect event handlers - // ---------- wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN, // Keyboard wxKeyEventHandler(CFrame::OnKeyDown), (wxObject*)0, this); @@ -476,20 +442,14 @@ CFrame::CFrame(bool showLogWindow, wxTheApp->Connect(wxID_ANY, wxEVT_MOTION, wxMouseEventHandler(CFrame::OnMotion), (wxObject*)0, this); - // ---------- - // Update controls UpdateGUI(); - //if we are ever going back to optional iso caching: - //m_GameListCtrl->Update(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableIsoCache); m_GameListCtrl->Update(); // If we are rerecording create the status bar now instead of later when a game starts #ifdef RERECORDING ModifyStatusBar(); - // It's to early for the OnHostMessage(), we will update the status when Ctrl or Space is pressed - //Core::WriteStatus(); #endif } // Destructor @@ -622,36 +582,40 @@ void CFrame::ListChildren() for (int i = 0; i < this->GetChildren().size(); i++) { wxWindow * Win = this->GetChildren().Item(i)->GetData(); - Console->Log(LogTypes::LCUSTOM, StringFromFormat( - "%i: %s (%s) :: %s", i, - Win->GetName().mb_str(), Win->GetLabel().mb_str(), Win->GetParent()->GetName().mb_str()).c_str()); + // FIXME: fix POD passing error from uncommenting + // Console->Log(LogTypes::LNOTICE, StringFromFormat( + // "%i: %s (%s) :: %s", i, + // Win->GetName().mb_str(), Win->GetLabel().mb_str(), Win->GetParent()->GetName().mb_str()).c_str()); //if (Win->GetName().IsSameAs(wxT("control"))) if (Win->IsKindOf(CLASSINFO(wxAuiNotebook))) { NB = (wxAuiNotebook*)Win; - Console->Log(LogTypes::LCUSTOM, StringFromFormat("%s", NB->GetName().mb_str()).c_str()); + Console->Log(LogTypes::LNOTICE, StringFromFormat("%s", NB->GetName().mb_str()).c_str()); } else { NB = NULL; } - Console->Log(LogTypes::LCUSTOM, StringFromFormat("\n").c_str()); + Console->Log(LogTypes::LNOTICE, StringFromFormat("\n").c_str()); Win = this->GetChildren().Item(i)->GetData(); for (int j = 0; j < Win->GetChildren().size(); j++) { - Console->Log(LogTypes::LCUSTOM, StringFromFormat( - " %i.%i: %s (%s) :: %s", i, j, - Win->GetName().mb_str(), Win->GetLabel().mb_str(), Win->GetParent()->GetName().mb_str()).c_str()); - if (NB) Console->Log(LogTypes::LCUSTOM, StringFromFormat("%s", NB->GetPage(j)->GetName().mb_str()).c_str()); - Console->Log(LogTypes::LCUSTOM, StringFromFormat("\n").c_str()); + // FIXME: fix POD passing error from uncommenting + // Console->Log(LogTypes::LNOTICE, StringFromFormat( + // " %i.%i: %s (%s) :: %s", i, j, + // Win->GetName().mb_str(), Win->GetLabel().mb_str(), Win->GetParent()->GetName().mb_str()).c_str()); + // if (NB) + // Console->Log(LogTypes::LNOTICE, StringFromFormat("%s", NB->GetPage(j)->GetName().mb_str()).c_str()); + // Console->Log(LogTypes::LNOTICE, StringFromFormat("\n").c_str()); Win = this->GetChildren().Item(j)->GetData(); for (int k = 0; k < Win->GetChildren().size(); k++) { - Console->Log(LogTypes::LCUSTOM, StringFromFormat( - " %i.%i.%i: %s (%s) :: %s\n", i, j, k, - Win->GetName().mb_str(), Win->GetLabel().mb_str(), Win->GetParent()->GetName().mb_str()).c_str()); + // FIXME: fix POD passing error from uncommenting + // Console->Log(LogTypes::LNOTICE, StringFromFormat( + // " %i.%i.%i: %s (%s) :: %s\n", i, j, k, + // Win->GetName().mb_str(), Win->GetLabel().mb_str(), Win->GetParent()->GetName().mb_str()).c_str()); } } } @@ -678,14 +642,14 @@ void CFrame::ReloadPanes() ClosePages(); /* - Console->Log(LogTypes::LCUSTOM, StringFromFormat( + Console->Log(LogTypes::LNOTICE, StringFromFormat( "Will detached panes, have %i panes (%i NBs)\n", m_Mgr->GetAllPanes().GetCount(), GetNotebookCount()).c_str()); */ CloseAllNotebooks(); m_Mgr->Update(); /* - Console->Log(LogTypes::LCUSTOM, StringFromFormat( + Console->Log(LogTypes::LNOTICE, StringFromFormat( "Detached panes, have %i panes (%i NBs)\n", m_Mgr->GetAllPanes().GetCount(), GetNotebookCount()).c_str()); */ @@ -695,7 +659,7 @@ void CFrame::ReloadPanes() m_Mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo().Show()); } /* - Console->Log(LogTypes::LCUSTOM, StringFromFormat( + Console->Log(LogTypes::LNOTICE, StringFromFormat( "Created %i panes, have %i panes (%i NBs)\n", Perspectives.at(ActivePerspective).Width.size() - 1, m_Mgr->GetAllPanes().GetCount(), GetNotebookCount()).c_str()); */ @@ -731,7 +695,7 @@ void CFrame::DoLoadPerspective() /* ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener(); - Console->Log(LogTypes::LCUSTOM, StringFromFormat( + Console->Log(LogTypes::LNOTICE, StringFromFormat( "Loaded: %s, NBs: %i, Non-NBs: %i, \n\n", Perspectives.at(ActivePerspective).Name.c_str(), GetNotebookCount(), m_Mgr->GetAllPanes().GetCount() - GetNotebookCount()).c_str()); */ @@ -835,7 +799,7 @@ void CFrame::Save() /**/ ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener(); - Console->Log(LogTypes::LCUSTOM, StringFromFormat( + Console->Log(LogTypes::LNOTICE, StringFromFormat( "Saved: %s, NBs: %i, Non-NBs: %i, \n\n", Perspectives.at(ActivePerspective).Name.c_str(), GetNotebookCount(), m_Mgr->GetAllPanes().GetCount() - GetNotebookCount()).c_str()); @@ -888,24 +852,18 @@ void CFrame::OnPaneClose(wxAuiManagerEvent& event) { /* ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener(); - Console->Log(LogTypes::LCUSTOM, StringFromFormat("GetNotebookCount before: %i\n", GetNotebookCount()).c_str()); + Console->Log(LogTypes::LNOTICE, StringFromFormat("GetNotebookCount before: %i\n", GetNotebookCount()).c_str()); */ // Detach and delete the empty notebook event.pane->DestroyOnClose(true); m_Mgr->ClosePane(*event.pane); - //Console->Log(LogTypes::LCUSTOM, StringFromFormat("GetNotebookCount after: %i\n", GetNotebookCount()).c_str()); + //Console->Log(LogTypes::LNOTICE, StringFromFormat("GetNotebookCount after: %i\n", GetNotebookCount()).c_str()); } m_Mgr->Update(); } -///////////////////////////////////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////////////////////////////////// -// Host messages -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ #ifdef _WIN32 WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { @@ -963,12 +921,8 @@ void CFrame::PostUpdateUIEvent(wxUpdateUIEvent& event) { if (g_pCodeWindow) wxPostEvent(g_pCodeWindow, event); } -///////////////////////////////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////////////////////// -// Input -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event)) { // Show all platforms and regions if... @@ -1058,12 +1012,7 @@ void CFrame::OnKeyUp(wxKeyEvent& event) CPluginManager::GetInstance().GetPad(0)->PAD_Input(event.GetKeyCode(), 0); // 0 = Up event.Skip(); } -///////////////////////////////////////////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////////////////////////////////////////////////////// -// Detect double click. Kind of, for some reason we have to manually create the double click for now. -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ void CFrame::OnDoubleClick(wxMouseEvent& event) { // Don't block the mouse click @@ -1187,4 +1136,3 @@ void CFrame::Update() } } #endif -/////////////////////////////////////////////////////////////////////////////////////////////////////////