mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
nakee's new logmanager. added a console window for windows builds (prints to parent console on non-win32). also fix some random wxw bugs: main window's position is saved when using debugger, disabling windows from the tools menu are saved settings, some other small fixes
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2675 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -17,7 +17,6 @@
|
||||
|
||||
#include "../Globals.h" // The precompiled header
|
||||
#include "IniFile.h" // Common
|
||||
#include "ConsoleWindow.h" // Move console window
|
||||
#include "../Config.h" // Config settings
|
||||
#include "Debugger.h"
|
||||
|
||||
@ -57,20 +56,21 @@ void CDebugger::OnClose(wxCloseEvent& event)
|
||||
SaveSettings();
|
||||
|
||||
event.Skip(); // This means wxDialog's Destroy is used
|
||||
CloseConsole(); // The console goes with the wx window
|
||||
// CloseConsole(); // The console goes with the wx window
|
||||
}
|
||||
|
||||
void CDebugger::DoShowHideConsole()
|
||||
{
|
||||
if(m_Check[1]->IsChecked()
|
||||
/* if(m_Check[1]->IsChecked()
|
||||
#ifdef _WIN32
|
||||
// Check to see if we already have a console
|
||||
&& Console::GetHwnd() == NULL
|
||||
// && Console::GetHwnd() == NULL
|
||||
#endif
|
||||
)
|
||||
OpenConsole();
|
||||
else
|
||||
CloseConsole();
|
||||
*/
|
||||
}
|
||||
|
||||
void CDebugger::SaveSettings() const
|
||||
@ -113,9 +113,6 @@ void CDebugger::LoadSettings()
|
||||
file.Get("VideoWindow", "h", &h, GetSize().GetHeight());
|
||||
SetSize(x, y, w, h);
|
||||
|
||||
file.Get("VideoWindow", "WriteToFile", &LocalLogFile, m_Check[0]->IsChecked());
|
||||
m_Check[0]->SetValue(LocalLogFile);
|
||||
|
||||
bool Console;
|
||||
file.Get("VideoWindow", "Console", &Console, m_Check[1]->IsChecked());
|
||||
m_Check[1]->SetValue(Console);
|
||||
@ -168,9 +165,6 @@ void CDebugger::GeneralSettings(wxCommandEvent& event)
|
||||
{
|
||||
switch (event.GetId())
|
||||
{
|
||||
case ID_SAVETOFILE:
|
||||
LocalLogFile = event.IsChecked();
|
||||
break;
|
||||
case ID_SHOWCONSOLE:
|
||||
DoShowHideConsole();
|
||||
break;
|
||||
|
@ -76,13 +76,13 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl
|
||||
// ---------------
|
||||
ConfigDialog::~ConfigDialog()
|
||||
{
|
||||
Console::Print("ConfigDialog Closed\n");
|
||||
INFO_LOG(CONSOLE, "ConfigDialog Closed\n");
|
||||
}
|
||||
void ConfigDialog::OnClose(wxCloseEvent& event)
|
||||
{
|
||||
g_Config.Save();
|
||||
|
||||
Console::Print("OnClose\n");
|
||||
INFO_LOG(CONSOLE, "OnClose\n");
|
||||
|
||||
// notice that we don't run wxEntryCleanup(); here so the dll will still be loaded
|
||||
/* JP: Yes, it seems like Close() does not do that. It only runs EndModal() or something
|
||||
@ -98,7 +98,7 @@ void ConfigDialog::OnClose(wxCloseEvent& event)
|
||||
|
||||
void ConfigDialog::CloseClick(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
Console::Print("CloseClick\n");
|
||||
INFO_LOG(CONSOLE, "CloseClick\n");
|
||||
|
||||
// If we run wxEntryCleanup() the class will be entirely deleted, and the destructor will be run
|
||||
//g_Config.Save();
|
||||
|
@ -30,16 +30,17 @@
|
||||
#include "main.h"
|
||||
|
||||
#include "IniFile.h"
|
||||
#include "ConsoleWindow.h"
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
/* FIXME should be done from logmanager
|
||||
// Open and close the Windows console window
|
||||
|
||||
void OpenConsole()
|
||||
{
|
||||
Console::Open(100, 300, "OpenGL Plugin Output"); // give room for 300 rows
|
||||
Console::Print("OpenGL console opened\n");
|
||||
#ifdef _WIN32
|
||||
// Console::Open(100, 300, "OpenGL Plugin Output"); // give room for 300 rows
|
||||
INFO_LOG(CONSOLE, "OpenGL console opened\n");
|
||||
// #ifdef _WIN32
|
||||
MoveWindow(Console::GetHwnd(), 0,400, 1280,550, true); // Move window. Todo: make this
|
||||
// adjustable from the debugging window
|
||||
#endif
|
||||
@ -47,59 +48,7 @@ void OpenConsole()
|
||||
|
||||
void CloseConsole()
|
||||
{
|
||||
Console::Close();
|
||||
// Console::Close();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Write logs
|
||||
|
||||
// The log file handle
|
||||
static FILE* pfLog = NULL;
|
||||
|
||||
// This is on by default, but can be controlled from the debugging window
|
||||
bool LocalLogFile = true;
|
||||
|
||||
#if LOGLEVEL > 0
|
||||
void __Log(const char *fmt, ...)
|
||||
{
|
||||
size_t len = strlen(fmt);
|
||||
if (!len)
|
||||
return;
|
||||
char* Msg = (char*)alloca(len + 512);
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(Msg, len + 512, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
g_VideoInitialize.pLog(Msg, FALSE);
|
||||
|
||||
// If we have no file to write to, create one
|
||||
if (pfLog == NULL && LocalLogFile)
|
||||
pfLog = fopen(FULL_LOGS_DIR "oglgfx.txt", "w");
|
||||
|
||||
// Write to file
|
||||
if (pfLog != NULL && LocalLogFile)
|
||||
fwrite(Msg, strlen(Msg), 1, pfLog);
|
||||
|
||||
Console::Print(Msg);
|
||||
}
|
||||
|
||||
void __Log(int type, const char *fmt, ...)
|
||||
{
|
||||
int len = (int)strlen(fmt);
|
||||
if (!len)
|
||||
return;
|
||||
char* Msg = (char*)alloca(len + 512);
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(Msg, len + 512, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
g_VideoInitialize.pLog(Msg, FALSE);
|
||||
Console::Print(Msg);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -24,19 +24,10 @@
|
||||
#include "VideoCommon.h"
|
||||
#include "pluginspecs_video.h"
|
||||
|
||||
#include "ConsoleWindow.h"
|
||||
|
||||
|
||||
// Compile without WxWidgets in Windows to, for debugging purposes
|
||||
//#define HAVE_WX 0
|
||||
|
||||
// Turns file logging on and off
|
||||
extern bool LocalLogFile;
|
||||
|
||||
// A global plugin specification
|
||||
extern PLUGIN_GLOBALS* globals;
|
||||
|
||||
void OpenConsole();
|
||||
void CloseConsole();
|
||||
//void OpenConsole();
|
||||
//void CloseConsole();
|
||||
|
||||
#endif // _GLOBALS_H
|
||||
|
@ -41,8 +41,8 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Declarations and definitions
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void OpenConsole();
|
||||
void CloseConsole();
|
||||
//void OpenConsole();
|
||||
//void CloseConsole();
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
|
||||
|
@ -972,7 +972,7 @@ void ComputeBackbufferRectangle(TRectangle *rc)
|
||||
// Adjust the X and Y offset
|
||||
FloatXOffset = FloatXOffset - (IncreasedWidth / 2.0 / WidthRatio / Ratio);
|
||||
FloatYOffset = FloatYOffset - (IncreasedHeight / 2.0 / HeightRatio / Ratio);
|
||||
//Console::Print("Crop Ratio:%1.2f IncreasedHeight:%3.0f YOffset:%3.0f\n", Ratio, IncreasedHeight, FloatYOffset);
|
||||
//DEBUG_LOG(CONSOLE, "Crop Ratio:%1.2f IncreasedHeight:%3.0f YOffset:%3.0f\n", Ratio, IncreasedHeight, FloatYOffset);
|
||||
}
|
||||
|
||||
// round(float) = floor(float + 0.5)
|
||||
@ -1410,15 +1410,15 @@ void UpdateViewport()
|
||||
GetWindowRect(Child, &RcChild);
|
||||
|
||||
//Console::ClearScreen();
|
||||
Console::Print("----------------------------------------------------------------\n");
|
||||
Console::Print("Top window: X:%03i Y:%03i Width:%03i Height:%03i\n", RcTop.left, RcTop.top, RcTop.right - RcTop.left, RcTop.bottom - RcTop.top);
|
||||
Console::Print("Parent window: X:%03i Y:%03i Width:%03i Height:%03i\n", RcParent.left, RcParent.top, RcParent.right - RcParent.left, RcParent.bottom - RcParent.top);
|
||||
Console::Print("Child window: X:%03i Y:%03i Width:%03i Height:%03i\n", RcChild.left, RcChild.top, RcChild.right - RcChild.left, RcChild.bottom - RcChild.top);
|
||||
Console::Print("----------------------------------------------------------------\n");
|
||||
Console::Print("Res. MValue: X:%f Y:%f XOffs:%f YOffs:%f\n", OpenGL_GetXmax(), OpenGL_GetYmax(), OpenGL_GetXoff(), OpenGL_GetYoff());
|
||||
Console::Print("GLViewPort: X:%03i Y:%03i Width:%03i Height:%03i\n", GLx, GLy, GLWidth, GLHeight);
|
||||
Console::Print("GLDepthRange: Near:%f Far:%f\n", GLNear, GLFar);
|
||||
Console::Print("GLScissor: X:%03i Y:%03i Width:%03i Height:%03i\n", GLScissorX, GLScissorY, GLScissorW, GLScissorH);
|
||||
Console::Print("----------------------------------------------------------------\n");
|
||||
DEBUG_LOG(CONSOLE, "----------------------------------------------------------------\n");
|
||||
DEBUG_LOG(CONSOLE, "Top window: X:%03i Y:%03i Width:%03i Height:%03i\n", RcTop.left, RcTop.top, RcTop.right - RcTop.left, RcTop.bottom - RcTop.top);
|
||||
DEBUG_LOG(CONSOLE, "Parent window: X:%03i Y:%03i Width:%03i Height:%03i\n", RcParent.left, RcParent.top, RcParent.right - RcParent.left, RcParent.bottom - RcParent.top);
|
||||
DEBUG_LOG(CONSOLE, "Child window: X:%03i Y:%03i Width:%03i Height:%03i\n", RcChild.left, RcChild.top, RcChild.right - RcChild.left, RcChild.bottom - RcChild.top);
|
||||
DEBUG_LOG(CONSOLE, "----------------------------------------------------------------\n");
|
||||
DEBUG_LOG(CONSOLE, "Res. MValue: X:%f Y:%f XOffs:%f YOffs:%f\n", OpenGL_GetXmax(), OpenGL_GetYmax(), OpenGL_GetXoff(), OpenGL_GetYoff());
|
||||
DEBUG_LOG(CONSOLE, "GLViewPort: X:%03i Y:%03i Width:%03i Height:%03i\n", GLx, GLy, GLWidth, GLHeight);
|
||||
DEBUG_LOG(CONSOLE, "GLDepthRange: Near:%f Far:%f\n", GLNear, GLFar);
|
||||
DEBUG_LOG(CONSOLE, "GLScissor: X:%03i Y:%03i Width:%03i Height:%03i\n", GLScissorX, GLScissorY, GLScissorW, GLScissorH);
|
||||
DEBUG_LOG(CONSOLE, "----------------------------------------------------------------\n");
|
||||
*/
|
||||
}
|
||||
|
@ -59,7 +59,7 @@
|
||||
// Definitions
|
||||
// --------------------------
|
||||
SVideoInitialize g_VideoInitialize;
|
||||
PLUGIN_GLOBALS* globals;
|
||||
PLUGIN_GLOBALS* globals = NULL;
|
||||
|
||||
// Logging
|
||||
int GLScissorX, GLScissorY, GLScissorW, GLScissorH;
|
||||
@ -95,6 +95,8 @@ void GetDllInfo (PLUGIN_INFO* _PluginInfo)
|
||||
|
||||
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
|
||||
{
|
||||
globals = _pPluginGlobals;
|
||||
LogManager::SetInstance((LogManager *)globals->logManager);
|
||||
}
|
||||
|
||||
// This is used for the fuctions right below here, in DllConfig()
|
||||
@ -318,22 +320,6 @@ void Video_ExitLoop()
|
||||
}
|
||||
/////////////////////////
|
||||
|
||||
|
||||
void DebugLog(const char* _fmt, ...)
|
||||
{
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
|
||||
char* Msg = (char*)alloca(strlen(_fmt)+512);
|
||||
va_list ap;
|
||||
|
||||
va_start( ap, _fmt );
|
||||
vsnprintf( Msg, strlen(_fmt)+512, _fmt, ap );
|
||||
va_end( ap );
|
||||
|
||||
g_VideoInitialize.pLog(Msg, FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Video_Screenshot(const char *_szFilename)
|
||||
{
|
||||
Renderer::SetScreenshot(_szFilename);
|
||||
|
@ -244,21 +244,6 @@ void Video_EnterLoop()
|
||||
Fifo_EnterLoop(g_VideoInitialize);
|
||||
}
|
||||
|
||||
void DebugLog(const char* _fmt, ...)
|
||||
{
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
|
||||
char* Msg = (char*)alloca(strlen(_fmt)+512);
|
||||
va_list ap;
|
||||
|
||||
va_start( ap, _fmt );
|
||||
vsnprintf( Msg, strlen(_fmt)+512, _fmt, ap );
|
||||
va_end( ap );
|
||||
|
||||
g_VideoInitialize.pLog(Msg, FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool ScreenShot(TCHAR *File)
|
||||
{
|
||||
char str[64];
|
||||
|
Reference in New Issue
Block a user