mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Common: Moved Windows console functions to common
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1887 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -15,24 +15,34 @@
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "../Globals.h"
|
||||
|
||||
#include "IniFile.h" // Common files
|
||||
// =======================================================================================
|
||||
// Includes
|
||||
// ---------------
|
||||
#include "../Globals.h" // The precompiled header
|
||||
|
||||
#include "IniFile.h" // Common
|
||||
#include "ConsoleWindow.h" // Move console window
|
||||
|
||||
#include "../Config.h" // Config settings
|
||||
|
||||
#include "PBView.h" // Debugger files
|
||||
#include "Debugger.h"
|
||||
#include "../Logging/Console.h" // open and close console
|
||||
|
||||
// externals
|
||||
extern int gSaveFile; // make this an int to allow multiple save file options
|
||||
extern int gPreset;
|
||||
int A, B;
|
||||
#include "Logging.h" // Open and close console
|
||||
// ========================
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Declare events
|
||||
// Declarations and definitions
|
||||
// ---------------
|
||||
extern int gPreset;
|
||||
int A, B;
|
||||
// ========================
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Event table and class
|
||||
// ---------------
|
||||
BEGIN_EVENT_TABLE(CDebugger,wxDialog)
|
||||
EVT_SHOW(CDebugger::OnShow)
|
||||
EVT_CLOSE(CDebugger::OnClose)
|
||||
@ -48,7 +58,6 @@ BEGIN_EVENT_TABLE(CDebugger,wxDialog)
|
||||
EVT_BUTTON(ID_BP,CDebugger::Bp)
|
||||
EVT_BUTTON(ID_BM,CDebugger::Bm)
|
||||
END_EVENT_TABLE()
|
||||
// =======================================================================================
|
||||
|
||||
|
||||
CDebugger::CDebugger(wxWindow *parent, wxWindowID id, const wxString &title,
|
||||
@ -72,7 +81,61 @@ CDebugger::~CDebugger()
|
||||
this->Save(file);
|
||||
file.Save(DEBUGGER_CONFIG_FILE);
|
||||
}
|
||||
// =========================
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
// System functions
|
||||
// --------------
|
||||
void CDebugger::OnShow(wxShowEvent& /*event*/)
|
||||
{
|
||||
// bring the console back to
|
||||
if(m_Check[2]->IsChecked())
|
||||
{
|
||||
OpenConsole();
|
||||
#ifdef _WIN32
|
||||
MoveWindow(Console::GetHwnd(), 0,400, 1280,500, true); // Move window TODO: make this
|
||||
// adjustable from the debugging window
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void CDebugger::OnClose(wxCloseEvent& /*event*/)
|
||||
{
|
||||
// save the window position when we hide the window to
|
||||
IniFile file;
|
||||
file.Load(DEBUGGER_CONFIG_FILE);
|
||||
this->Save(file);
|
||||
file.Save(DEBUGGER_CONFIG_FILE);
|
||||
|
||||
EndModal(0); // it seems like this works for Show() to, not just ShowModal();
|
||||
CloseConsole(); // The console goes with the wx window
|
||||
}
|
||||
|
||||
|
||||
void CDebugger::DoHide()
|
||||
{
|
||||
Hide();
|
||||
CloseConsole(); // The console goes with the wx window
|
||||
}
|
||||
|
||||
void CDebugger::DoShow()
|
||||
{
|
||||
Show();
|
||||
DoShowHideConsole(); // The console goes with the wx window
|
||||
}
|
||||
|
||||
|
||||
void CDebugger::OnUpdate(wxCommandEvent& /*event*/)
|
||||
{
|
||||
this->NotifyUpdate();
|
||||
}
|
||||
// ===============
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
// Save and load settings
|
||||
// --------------
|
||||
void CDebugger::Save(IniFile& _IniFile) const
|
||||
{
|
||||
// TODO1: make this work when we close the entire program to, currently on total close we get
|
||||
@ -87,7 +150,8 @@ void CDebugger::Save(IniFile& _IniFile) const
|
||||
_IniFile.Set("VideoWindow", "w", GetSize().GetWidth());
|
||||
_IniFile.Set("VideoWindow", "h", GetSize().GetHeight());
|
||||
}
|
||||
_IniFile.Set("VideoWindow", "Console", m_Check[2]->IsChecked()); // save settings
|
||||
_IniFile.Set("VideoWindow", "Console", m_Check[2]->IsChecked()); // Save settings
|
||||
_IniFile.Set("VideoWindow", "WriteToFile", m_Check[0]->IsChecked());
|
||||
_IniFile.Set("VideoWindow", "UpdateFrequency", m_RadioBox[1]->GetSelection());
|
||||
_IniFile.Set("VideoWindow", "LogLevel", g_Config.iLog);
|
||||
}
|
||||
@ -102,12 +166,15 @@ void CDebugger::Load(IniFile& _IniFile)
|
||||
_IniFile.Get("VideoWindow", "h", &h, GetSize().GetHeight());
|
||||
SetSize(x, y, w, h);
|
||||
|
||||
// saved settings
|
||||
// Saved settings
|
||||
bool Console;
|
||||
_IniFile.Get("VideoWindow", "Console", &Console, m_Check[2]->IsChecked());
|
||||
m_Check[2]->SetValue(Console);
|
||||
DoShowHideConsole();
|
||||
|
||||
_IniFile.Get("VideoWindow", "WriteToFile", &LocalLogFile, m_Check[0]->IsChecked());
|
||||
m_Check[0]->SetValue(LocalLogFile);
|
||||
|
||||
_IniFile.Get("VideoWindow", "UpdateFrequency", &gUpdFreq, m_RadioBox[1]->GetSelection());
|
||||
m_RadioBox[1]->SetSelection(gUpdFreq);
|
||||
DoChangeFrequency();
|
||||
@ -115,6 +182,8 @@ void CDebugger::Load(IniFile& _IniFile)
|
||||
_IniFile.Get("VideoWindow", "LogLevel", &g_Config.iLog, 0);
|
||||
m_settings->Check(g_Config.iLog - 1, true);
|
||||
}
|
||||
// ===============
|
||||
|
||||
|
||||
void CDebugger::CreateGUIControls()
|
||||
{
|
||||
@ -183,6 +252,9 @@ void CDebugger::CreateGUIControls()
|
||||
// checkboxes
|
||||
m_Check[0] = new wxCheckBox(m_PageMain, ID_SAVETOFILE, wxT("Save to file"),
|
||||
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
//m_Check[0]->SetToolTip(wxT("This will write the console output to" FULL_LOGS_DIR "oglgfx.txt"));
|
||||
m_Check[0]->SetToolTip(wxT("This will write the console output to" FULL_LOGS_DIR "oglgfx.txt"));
|
||||
|
||||
m_Check[2] = new wxCheckBox(m_PageMain, ID_SHOWCONSOLE, wxT("Show console"),
|
||||
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
|
||||
@ -297,55 +369,6 @@ void CDebugger::CreateGUIControls()
|
||||
}
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
// System functions
|
||||
// --------------
|
||||
void CDebugger::OnShow(wxShowEvent& /*event*/)
|
||||
{
|
||||
// bring the console back to
|
||||
if(m_Check[2]->IsChecked())
|
||||
{
|
||||
OpenConsole();
|
||||
#ifdef _WIN32
|
||||
MoveWindow(GetConsoleHwnd(), 0,400, 1280,500, true); // Move window TODO: make this
|
||||
// adjustable from the debugging window
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void CDebugger::OnClose(wxCloseEvent& /*event*/)
|
||||
{
|
||||
// save the window position when we hide the window to
|
||||
IniFile file;
|
||||
file.Load(DEBUGGER_CONFIG_FILE);
|
||||
this->Save(file);
|
||||
file.Save(DEBUGGER_CONFIG_FILE);
|
||||
|
||||
EndModal(0); // it seems like this works for Show() to, not just ShowModal();
|
||||
CloseConsole(); // The console goes with the wx window
|
||||
}
|
||||
|
||||
|
||||
void CDebugger::DoHide()
|
||||
{
|
||||
Hide();
|
||||
CloseConsole(); // The console goes with the wx window
|
||||
}
|
||||
|
||||
void CDebugger::DoShow()
|
||||
{
|
||||
Show();
|
||||
DoShowHideConsole(); // The console goes with the wx window
|
||||
}
|
||||
|
||||
|
||||
void CDebugger::OnUpdate(wxCommandEvent& /*event*/)
|
||||
{
|
||||
this->NotifyUpdate();
|
||||
}
|
||||
// ===============
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Change preset
|
||||
// --------------
|
||||
@ -422,7 +445,7 @@ void CDebugger::GeneralSettings(wxCommandEvent& event)
|
||||
switch (event.GetId())
|
||||
{
|
||||
case ID_SAVETOFILE: // Save to file
|
||||
gSaveFile = m_Check[0]->IsChecked();
|
||||
LocalLogFile = m_Check[0]->IsChecked();
|
||||
break;
|
||||
case ID_SHOWCONSOLE:
|
||||
DoShowHideConsole();
|
||||
@ -441,8 +464,8 @@ void CDebugger::DoShowHideConsole()
|
||||
{
|
||||
OpenConsole();
|
||||
#ifdef _WIN32
|
||||
MoveWindow(GetConsoleHwnd(), 0,400, 1280,500, true); // move window, TODO: make this
|
||||
// adjustable from the debugging window
|
||||
MoveWindow(Console::GetHwnd(), 0,400, 1280,500, true); // Move window. TODO: make this
|
||||
// adjustable from the debugging window
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@ -33,56 +33,41 @@
|
||||
#include "main.h"
|
||||
|
||||
#include "IniFile.h"
|
||||
#include "ConsoleWindow.h"
|
||||
#include <assert.h>
|
||||
/////////////////////////////////////
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Declarations and definitions
|
||||
// Open and close the Windows console window
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#ifdef _WIN32
|
||||
|
||||
// The Windows console handle. The one for Linux is in Linux/Linux.cpp
|
||||
static HANDLE hConsole = NULL;
|
||||
//////////////////////////////////
|
||||
|
||||
|
||||
void OpenConsole()
|
||||
{
|
||||
COORD csize;
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
|
||||
SMALL_RECT srect;
|
||||
|
||||
if (hConsole)
|
||||
return;
|
||||
AllocConsole();
|
||||
SetConsoleTitle("Opengl Plugin Output");
|
||||
|
||||
// set width and height
|
||||
csize.X = 155; // this fits on 1280 pixels TODO: make it adjustable from the wx debugging window
|
||||
csize.Y = 300; // 300 rows
|
||||
SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), csize);
|
||||
|
||||
// make the internal buffer match the width we set
|
||||
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbiInfo);
|
||||
srect = csbiInfo.srWindow;
|
||||
srect.Right = srect.Left + csize.X - 1; // match
|
||||
srect.Bottom = srect.Top + 44;
|
||||
SetConsoleWindowInfo(GetStdHandle(STD_OUTPUT_HANDLE), TRUE, &srect);
|
||||
|
||||
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
Console::Open(100, 300, "OpenGL Plugin Output"); // give room for 300 rows
|
||||
Console::Print("OpenGL console opened\n");
|
||||
MoveWindow(Console::GetHwnd(), 0,400, 1280,550, true); // Move window. Todo: make this
|
||||
// adjustable from the debugging window
|
||||
}
|
||||
|
||||
void CloseConsole()
|
||||
{
|
||||
if (hConsole == NULL)
|
||||
return;
|
||||
FreeConsole();
|
||||
hConsole = NULL;
|
||||
Console::Close();
|
||||
}
|
||||
#endif
|
||||
//////////////////////////////////
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Write logs
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// The log file handle
|
||||
static FILE* pfLog = NULL;
|
||||
|
||||
// This is on by default, but can be controlled from the debugging window
|
||||
bool LocalLogFile = true;
|
||||
|
||||
void __Log(const char *fmt, ...)
|
||||
{
|
||||
char* Msg = (char*)alloca(strlen(fmt)+512);
|
||||
@ -94,17 +79,20 @@ void __Log(const char *fmt, ...)
|
||||
|
||||
g_VideoInitialize.pLog(Msg, FALSE);
|
||||
|
||||
if (pfLog == NULL)
|
||||
// If we have no file to write to, create one
|
||||
if (pfLog == NULL && LocalLogFile)
|
||||
pfLog = fopen(FULL_LOGS_DIR "oglgfx.txt", "w");
|
||||
|
||||
if (pfLog != NULL)
|
||||
// Write to file
|
||||
if (pfLog != NULL && LocalLogFile)
|
||||
fwrite(Msg, strlen(Msg), 1, pfLog);
|
||||
|
||||
#ifdef _WIN32
|
||||
DWORD tmp;
|
||||
WriteConsole(hConsole, Msg, (DWORD)strlen(Msg), &tmp, 0);
|
||||
// Write to the console screen, if one exists
|
||||
Console::Print(Msg);
|
||||
#else
|
||||
//printf("%s", Msg);
|
||||
#endif
|
||||
//printf("%s", Msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
void __Log(int type, const char *fmt, ...)
|
||||
@ -119,7 +107,8 @@ void __Log(int type, const char *fmt, ...)
|
||||
g_VideoInitialize.pLog(Msg, FALSE);
|
||||
|
||||
#ifdef _WIN32
|
||||
DWORD tmp;
|
||||
WriteConsole(hConsole, Msg, (DWORD)strlen(Msg), &tmp, 0);
|
||||
// Write to the console screen, if one exists
|
||||
Console::Print(Msg);
|
||||
#endif
|
||||
}
|
||||
//////////////////////////////////
|
||||
|
@ -15,18 +15,31 @@
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
// This file should DIE.
|
||||
|
||||
#ifndef _GLOBALS_H
|
||||
#define _GLOBALS_H
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Includes
|
||||
// -------------
|
||||
#include "Common.h"
|
||||
#include "Config.h"
|
||||
|
||||
#include "VideoCommon.h"
|
||||
#include "pluginspecs_video.h"
|
||||
//////////////////////////////
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Declarations and definitions
|
||||
// -------------
|
||||
|
||||
// Turns file logging on and off
|
||||
extern bool LocalLogFile;
|
||||
|
||||
// A global plugin specification
|
||||
extern PLUGIN_GLOBALS* globals;
|
||||
//////////////////////////////
|
||||
|
||||
|
||||
#endif
|
||||
#endif // _GLOBALS_H
|
||||
|
@ -1,213 +0,0 @@
|
||||
// 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/
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Includes
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#include "../Globals.h"
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
//////////////////////////////////
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Declarations and definitions
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// --------------------
|
||||
// On and off
|
||||
bool g_consoleEnable = true;
|
||||
int gSaveFile = 0;
|
||||
#define DEBUGG
|
||||
|
||||
|
||||
// --------------------
|
||||
// Settings
|
||||
int nFiles = 1;
|
||||
|
||||
|
||||
// --------------------
|
||||
// Create handles
|
||||
|
||||
#ifdef DEBUGG
|
||||
FILE* __fStdOut[1]; // you have to update this manually, we can't place a nFiles in there
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
HANDLE __hStdOut = NULL;
|
||||
#endif
|
||||
///////////////////////////////////
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
/* Start console window - width and height is the size of console window, if you specify
|
||||
fname, the output will also be written to this file. TODO: Close the file pointer when the app
|
||||
is closed */
|
||||
// -------------
|
||||
void startConsoleWin(int width, int height, char* fname)
|
||||
{
|
||||
|
||||
#if defined(DEBUGG) && defined(_WIN32)
|
||||
|
||||
AllocConsole();
|
||||
|
||||
SetConsoleTitle(fname);
|
||||
__hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
// swt the width and height of the window
|
||||
COORD co = {width,height};
|
||||
SetConsoleScreenBufferSize(__hStdOut, co);
|
||||
|
||||
// make the internal buffer match the width we set
|
||||
SMALL_RECT coo = {0,0,(width - 1),70}; // top, left, right, bottom
|
||||
SetConsoleWindowInfo(__hStdOut, TRUE, &coo);
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// Write to a file
|
||||
if(fname)
|
||||
{
|
||||
for(int i = 0; i < nFiles; i++)
|
||||
{
|
||||
// Edit the log file name
|
||||
std::string FileEnding = ".log";
|
||||
std::string FileName = fname;
|
||||
char buffer[33]; _itoa(i, buffer, 10); // convert number to string
|
||||
std::string FullFilename = (FileName + buffer + FileEnding);
|
||||
__fStdOut[i] = fopen(FullFilename.c_str(), "w");
|
||||
}
|
||||
}
|
||||
// ---------------
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// File printf function
|
||||
int aprintf(int a, char *fmt, ...)
|
||||
{
|
||||
#if defined(DEBUGG) && defined(_WIN32)
|
||||
if(gSaveFile)
|
||||
{
|
||||
char s[5000]; // WARNING: mind this value
|
||||
va_list argptr;
|
||||
int cnt;
|
||||
|
||||
va_start(argptr, fmt);
|
||||
cnt = vsnprintf(s, 5000, fmt, argptr); // remember to update this value to
|
||||
va_end(argptr);
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
if(__fStdOut[a]) // TODO: make this work, we have to set all default values to NULL
|
||||
//to make it work
|
||||
fprintf(__fStdOut[a], s);
|
||||
// -------------
|
||||
|
||||
return(cnt);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ClearScreen()
|
||||
{
|
||||
#if defined(DEBUGG) && defined(_WIN32)
|
||||
if(g_consoleEnable)
|
||||
{
|
||||
COORD coordScreen = { 0, 0 };
|
||||
DWORD cCharsWritten;
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
DWORD dwConSize;
|
||||
|
||||
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
GetConsoleScreenBufferInfo(hConsole, &csbi);
|
||||
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
|
||||
FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize,
|
||||
coordScreen, &cCharsWritten);
|
||||
GetConsoleScreenBufferInfo(hConsole, &csbi);
|
||||
FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize,
|
||||
coordScreen, &cCharsWritten);
|
||||
SetConsoleCursorPosition(hConsole, coordScreen);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
// VERY UGLY! needs to be fixed soon, just fixing the biuld...
|
||||
void CloseConsole()
|
||||
{
|
||||
}
|
||||
void OpenConsole()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Get the window handle of the console
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#if defined(DEBUGG) && defined(_WIN32)
|
||||
HWND GetConsoleHwnd(void)
|
||||
{
|
||||
|
||||
#define MY_BUFSIZE 1024 // Buffer size for console window titles.
|
||||
HWND hwndFound; // This is what is returned to the caller.
|
||||
char pszNewWindowTitle[MY_BUFSIZE]; // Contains fabricated
|
||||
// WindowTitle.
|
||||
char pszOldWindowTitle[MY_BUFSIZE]; // Contains original
|
||||
// WindowTitle.
|
||||
|
||||
// Fetch current window title.
|
||||
|
||||
GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);
|
||||
|
||||
// Format a "unique" NewWindowTitle.
|
||||
|
||||
wsprintf(pszNewWindowTitle,"%d/%d",
|
||||
GetTickCount(),
|
||||
GetCurrentProcessId());
|
||||
|
||||
// Change current window title.
|
||||
|
||||
SetConsoleTitle(pszNewWindowTitle);
|
||||
|
||||
// Ensure window title has been updated.
|
||||
|
||||
Sleep(40);
|
||||
|
||||
// Look for NewWindowTitle.
|
||||
|
||||
hwndFound = FindWindow(NULL, pszNewWindowTitle);
|
||||
|
||||
// Restore original window title.
|
||||
|
||||
SetConsoleTitle(pszOldWindowTitle);
|
||||
|
||||
return(hwndFound);
|
||||
|
||||
}
|
||||
#endif // win32
|
||||
////////////////////////////////////
|
@ -1,27 +0,0 @@
|
||||
// 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/
|
||||
|
||||
|
||||
void startConsoleWin(int width, int height, char* fname);
|
||||
int aprintf(int a, char *fmt, ...);
|
||||
void ClearScreen();
|
||||
void OpenConsole();
|
||||
void CloseConsole();
|
||||
|
||||
#ifdef _WIN32
|
||||
HWND GetConsoleHwnd(void);
|
||||
#endif
|
@ -1,284 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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/
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "../Globals.h" // this is the precompiled header and must be the first ...
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// Includes
|
||||
// -------------
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <string> // so that we can test std::string == abc
|
||||
#include <math.h> // for the pow() function
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "../GLUtil.h"
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
#include "../Debugger/Debugger.h" // for the CDebugger class
|
||||
#include "../Debugger/PBView.h"
|
||||
#include "Console.h" // open and close console, clear console window
|
||||
#endif
|
||||
#include "../Logging/Logging.h" // for global logging values
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// 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 gSaveFile;
|
||||
|
||||
//extern int gleft, gright, gtop, gbottom; // from BPStructs.cpp
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// Counters
|
||||
// -------------
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
bool iupdonce = false;
|
||||
std::vector<u16> 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
|
||||
|
||||
|
||||
// ==============
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// Write to file
|
||||
// --------------
|
||||
for (int ii = 0; ii < nFiles; ii++)
|
||||
{
|
||||
std::string sfbuff;
|
||||
sfbuff = sfbuff + writeMessage(ii, 0);
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
aprintf(ii, (char *)sfbuff.c_str());
|
||||
#endif
|
||||
}
|
||||
// --------------
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// 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
|
||||
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
|
@ -1,21 +0,0 @@
|
||||
// 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/
|
||||
|
||||
|
||||
// functions
|
||||
void Logging(int a);
|
||||
|
@ -65,7 +65,7 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{ //use wxInitialize() if you don't want GUI instead of the following 12 lines
|
||||
{ // Use wxInitialize() if you don't want GUI instead of the following 12 lines
|
||||
wxSetInstance((HINSTANCE)hinstDLL);
|
||||
int argc = 0;
|
||||
char **argv = NULL;
|
||||
@ -76,8 +76,7 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
CloseConsole();
|
||||
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
|
||||
wxEntryCleanup(); // Use wxUninitialize() if you don't want GUI
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -374,4 +373,4 @@ namespace EmuWindow
|
||||
}
|
||||
|
||||
} // EmuWindow
|
||||
////////////////////////////////////
|
||||
////////////////////////////////////
|
||||
|
@ -15,6 +15,10 @@
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Includes
|
||||
// -------------
|
||||
#include "Globals.h"
|
||||
#include <list>
|
||||
#include <vector>
|
||||
@ -45,17 +49,22 @@
|
||||
#include "VertexLoader.h"
|
||||
#include "XFB.h"
|
||||
#include "Timer.h"
|
||||
#include "Logging/Logging.h" // for Logging()
|
||||
#include "Debugger/Logging.h" // for Logging()
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
#include "Debugger/Debugger.h" // for the CDebugger class
|
||||
#include "Debugger/Debugger.h" // for the CDebugger class
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "OS/Win32.h"
|
||||
#include "OS/Win32.h"
|
||||
#else
|
||||
#endif
|
||||
/////////////////////////////
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Declarations and definitions
|
||||
// -------------
|
||||
struct MESSAGE
|
||||
{
|
||||
MESSAGE() {}
|
||||
@ -69,7 +78,7 @@ CGprofile g_cgvProf;
|
||||
CGprofile g_cgfProf;
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
extern CDebugger* m_frame; // the debugging class
|
||||
extern CDebugger* m_frame; // the debugging class
|
||||
#endif
|
||||
|
||||
static RasterFont* s_pfont = NULL;
|
||||
@ -96,6 +105,8 @@ bool g_bBlendLogicOp = false;
|
||||
int frameCount;
|
||||
|
||||
void HandleCgError(CGcontext ctx, CGerror err, void *appdata);
|
||||
/////////////////////////////
|
||||
|
||||
|
||||
bool Renderer::Init()
|
||||
{
|
||||
@ -1122,4 +1133,4 @@ void UpdateViewport()
|
||||
}
|
||||
|
||||
glDepthRange((xfregs.rawViewport[5]- xfregs.rawViewport[2])/16777215.0f, xfregs.rawViewport[5]/16777215.0f);
|
||||
}
|
||||
}
|
||||
|
@ -53,8 +53,7 @@ if gfxenv['HAVE_WX']:
|
||||
'GUI/ConfigDlg.cpp',
|
||||
'Debugger/Debugger.cpp',
|
||||
'Debugger/PBView.cpp',
|
||||
'Logging/Console.cpp',
|
||||
'Logging/Logging.cpp',
|
||||
'Debugger/Logging.cpp',
|
||||
]
|
||||
|
||||
if gfxenv['HAVE_COCOA']:
|
||||
|
Reference in New Issue
Block a user