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:
Shawn Hoffman
2009-03-18 17:17:58 +00:00
parent 03ba466b5b
commit 2301d072a6
120 changed files with 1758 additions and 1103 deletions

View File

@ -31,8 +31,6 @@
#include <stdlib.h>
#endif
#include "ConsoleWindow.h" // Open and close console
#include "Debugger.h"
#include "PBView.h"
#include "IniFile.h"
@ -61,7 +59,7 @@ void CDebugger::DoScrollBlocks()
else if(GetAsyncKeyState(VK_NUMPAD2))
A += 0.11;
Console::Print("GetScrollPos:%i GetScrollRange:%i GetPosition:%i GetLastPosition:%i GetMaxWidth:%i \
DEBUG_LOG(CONSOLE, "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),

View File

@ -31,8 +31,6 @@
#include <stdlib.h>
#endif
#include "ConsoleWindow.h" // Open and close console
#include "Debugger.h"
#include "PBView.h"
#include "IniFile.h"
@ -165,17 +163,11 @@ void CDebugger::OnClose(wxCloseEvent& /*event*/)
file.Save(DEBUGGER_CONFIG_FILE);
EndModal(0);
#ifdef _WIN32
Console::Close(); // Take the console window with it
#endif
}
void CDebugger::DoHide()
{
Hide();
#ifdef _WIN32
Console::Close(); // The console goes with the wx window
#endif
}
void CDebugger::DoShow()
@ -683,12 +675,13 @@ void CDebugger::ShowHideConsole(wxCommandEvent& event)
void CDebugger::DoShowHideConsole()
{
#ifdef _WIN32
if(m_options->IsChecked(3))
OpenConsole();
else
CloseConsole();
#endif
// #ifdef _WIN32
// if(m_options->IsChecked(3))
// OpenConsole();
// else
// CloseConsole();
// #endif
PanicAlert("oh crap");
}
// ==============

View File

@ -33,7 +33,6 @@
#endif
#include "StringUtil.h" // Common
#include "ConsoleWindow.h" // Open, close, clear console window
#include "../Debugger/Debugger.h" // Local
#include "../Debugger/PBView.h"
@ -887,8 +886,8 @@ void Logging_(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs,
// =======================================================================================
// Print
// ----------------
Console::ClearScreen();
Console::Print("%s", sbuff.c_str());
// FIXME: Console::ClearScreen();
INFO_LOG(CONSOLE, "%s", sbuff.c_str());
sbuff.clear(); strcpy(buffer, "");
// ================

View File

@ -21,40 +21,6 @@
#include "Globals.h"
#include "Common.h"
void __Log(int, const char *fmt, ...)
{
DebugLog(fmt);
}
void __Log_(int v, const char *fmt, ...)
{
char Msg[512];
va_list ap;
va_start(ap, fmt);
vsprintf(Msg, fmt, ap);
va_end(ap);
g_dspInitialize.pLog(Msg, v);
}
void DebugLog(const char* _fmt, ...)
{
#if defined(_DEBUG) || defined(DEBUGFAST)
//if(strncmp (_fmt, "AX", 2)) // match = 0, in that case this is ignored
{
char Msg[512];
va_list ap;
va_start(ap, _fmt);
vsprintf(Msg, _fmt, ap);
va_end(ap);
g_dspInitialize.pLog(Msg, 0);
}
#endif
}
extern u8* g_pMemory;
// debugger externals that are needed even in Release builds

View File

@ -20,18 +20,9 @@
#include "Common.h"
#include "pluginspecs_dsp.h"
#include "ConsoleWindow.h"
#include "StringUtil.h"
extern DSPInitialize g_dspInitialize;
void DebugLog(const char* _fmt, ...);
void __Log_(int v, const char *fmt, ...);
#if defined(_DEBUG) || defined(DEBUGFAST)
#define LOG_(v, ...) __Log_(v, __VA_ARGS__);
#else
#define LOG_(_v_, ...)
#endif
extern bool gSSBM;
extern bool gSSBMremedy1;

View File

@ -20,7 +20,6 @@
#include <queue> // System
#include "Thread.h" // Common
#include "ConsoleWindow.h"
#include "../Config.h" // Local
#include "../Globals.h"

View File

@ -147,7 +147,7 @@ if(m_frame->ScanMails)
#endif
TmpMailLog += Msg;
TmpMailLog += "\n";
LOG_(1, Msg); // also write it to the log
DEBUG_LOG(DSPHLE, "%s", Msg); // also write it to the log
#if defined(HAVE_WX) && HAVE_WX
}
}
@ -415,11 +415,11 @@ void CUCode_AX::HandleMail(u32 _uMail)
if ((_uMail & 0xFFFF0000) == MAIL_AX_ALIST)
{
// a new List
DebugLog(" >>>> u32 MAIL : General Mail (%08x)", _uMail);
DEBUG_LOG(DSPHLE, " >>>> u32 MAIL : General Mail (%08x)", _uMail);
}
else
{
DebugLog(" >>>> u32 MAIL : AXTask Mail (%08x)", _uMail);
DEBUG_LOG(DSPHLE, " >>>> u32 MAIL : AXTask Mail (%08x)", _uMail);
AXTask(_uMail);
}

View File

@ -178,7 +178,7 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs)
&& gSequenced) // on and off option
{
//PanicAlert("Update %i: %i = %04x", i, updpar, upddata);
//DebugLog("Update: %i = %04x", updpar, upddata);
//DEBUG_LOG(DSPHLE, "Update: %i = %04x", updpar, upddata);
pDest[updpar] = upddata;
}
if (updpar == 7 && upddata == 1) on++;
@ -364,7 +364,7 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
/* case 0x0009:
Addr__9 = Memory_Read_U32(uAddress);
uAddress += 4;
DebugLog("AXLIST 6 address: %08x", Addr__9);
DEBUG_LOG(DSPHLE, "AXLIST 6 address: %08x", Addr__9);
break;*/
case 0x000a: // AXLIST_COMPRESSORTABLE

View File

@ -24,7 +24,7 @@
CUCode_CARD::CUCode_CARD(CMailHandler& _rMailHandler)
: IUCode(_rMailHandler)
{
DebugLog("CUCode_CARD - initialized");
DEBUG_LOG(DSPHLE, "CUCode_CARD - initialized");
m_rMailHandler.PushMail(DSP_INIT);
}
@ -52,7 +52,7 @@ void CUCode_CARD::HandleMail(u32 _uMail)
}
else
{
DebugLog("CUCode_CARD - unknown cmd: %x (size %i)", _uMail);
DEBUG_LOG(DSPHLE, "CUCode_CARD - unknown cmd: %x (size %i)", _uMail);
}
m_rMailHandler.PushMail(DSP_DONE);

View File

@ -26,7 +26,7 @@ CUCode_InitAudioSystem::CUCode_InitAudioSystem(CMailHandler& _rMailHandler)
, m_NextParameter(0)
, IsInitialized(false)
{
DebugLog("CUCode_InitAudioSystem - initialized");
DEBUG_LOG(DSPHLE, "CUCode_InitAudioSystem - initialized");
}

View File

@ -24,7 +24,7 @@ CUCode_Jac::CUCode_Jac(CMailHandler& _rMailHandler)
: IUCode(_rMailHandler)
, m_bListInProgress(false)
{
DebugLog("CUCode_Jac: init");
DEBUG_LOG(DSPHLE, "CUCode_Jac: init");
m_rMailHandler.PushMail(0xDCD10000);
m_rMailHandler.PushMail(0x80000000);
}
@ -69,7 +69,7 @@ void CUCode_Jac::HandleMail(u32 _uMail)
default:
PanicAlert("UCode Jac");
DebugLog("UCode Jac - unknown cmd: %x", _uMail & 0xFFFF);
DEBUG_LOG(DSPHLE, "UCode Jac - unknown cmd: %x", _uMail & 0xFFFF);
break;
}
}
@ -105,8 +105,8 @@ void CUCode_Jac::ExecuteList()
u16 cmd = Read16();
u16 sync = Read16();
DebugLog("==============================================================================");
DebugLog("UCode Jac - execute dlist (cmd: 0x%04x : sync: 0x%04x)", cmd, sync);
DEBUG_LOG(DSPHLE, "==============================================================================");
DEBUG_LOG(DSPHLE, "UCode Jac - execute dlist (cmd: 0x%04x : sync: 0x%04x)", cmd, sync);
switch (cmd)
{
@ -121,11 +121,11 @@ void CUCode_Jac::ExecuteList()
tmp[2] = Read32();
tmp[3] = Read32();
DebugLog("DsetupTable");
DebugLog("???: 0x%08x", tmp[0]);
DebugLog("DSPRES_FILTER (size: 0x40): 0x%08x", tmp[1]);
DebugLog("DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]);
DebugLog("???: 0x%08x", tmp[3]);
DEBUG_LOG(DSPHLE, "DsetupTable");
DEBUG_LOG(DSPHLE, "???: 0x%08x", tmp[0]);
DEBUG_LOG(DSPHLE, "DSPRES_FILTER (size: 0x40): 0x%08x", tmp[1]);
DEBUG_LOG(DSPHLE, "DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]);
DEBUG_LOG(DSPHLE, "???: 0x%08x", tmp[3]);
}
break;
@ -140,16 +140,16 @@ void CUCode_Jac::ExecuteList()
tmp[1] = Read32();
tmp[2] = Read32();
DebugLog("UpdateDSPChannel");
DebugLog("audiomemory: 0x%08x", tmp[0]);
DebugLog("audiomemory: 0x%08x", tmp[1]);
DebugLog("DSPADPCM_FILTER (size: 0x40): 0x%08x", tmp[2]);
DEBUG_LOG(DSPHLE, "UpdateDSPChannel");
DEBUG_LOG(DSPHLE, "audiomemory: 0x%08x", tmp[0]);
DEBUG_LOG(DSPHLE, "audiomemory: 0x%08x", tmp[1]);
DEBUG_LOG(DSPHLE, "DSPADPCM_FILTER (size: 0x40): 0x%08x", tmp[2]);
}
break;
default:
PanicAlert("UCode Jac unknown cmd: %s (size %i)", cmd, m_numSteps);
DebugLog("Jac UCode - unknown cmd: %x (size %i)", cmd, m_numSteps);
DEBUG_LOG(DSPHLE, "Jac UCode - unknown cmd: %x (size %i)", cmd, m_numSteps);
break;
}

View File

@ -25,7 +25,7 @@ CUCode_Rom::CUCode_Rom(CMailHandler& _rMailHandler)
, m_BootTask_numSteps(0)
, m_NextParameter(0)
{
DebugLog("UCode_Rom - initialized");
DEBUG_LOG(DSPHLE, "UCode_Rom - initialized");
m_rMailHandler.Clear();
m_rMailHandler.PushMail(0x8071FEED);
}
@ -98,13 +98,13 @@ void CUCode_Rom::BootUCode()
crc = (crc << 3) | (crc >> 29);
}
DebugLog("CurrentUCode SOURCE Addr: 0x%08x", m_CurrentUCode.m_RAMAddress);
DebugLog("CurrentUCode Length: 0x%08x", m_CurrentUCode.m_Length);
DebugLog("CurrentUCode DEST Addr: 0x%08x", m_CurrentUCode.m_IMEMAddress);
DebugLog("CurrentUCode ???: 0x%08x", m_CurrentUCode.m_Unk);
DebugLog("CurrentUCode init_vector: 0x%08x", m_CurrentUCode.m_StartPC);
DebugLog("CurrentUCode CRC: 0x%08x", crc);
DebugLog("BootTask - done");
DEBUG_LOG(DSPHLE, "CurrentUCode SOURCE Addr: 0x%08x", m_CurrentUCode.m_RAMAddress);
DEBUG_LOG(DSPHLE, "CurrentUCode Length: 0x%08x", m_CurrentUCode.m_Length);
DEBUG_LOG(DSPHLE, "CurrentUCode DEST Addr: 0x%08x", m_CurrentUCode.m_IMEMAddress);
DEBUG_LOG(DSPHLE, "CurrentUCode ???: 0x%08x", m_CurrentUCode.m_Unk);
DEBUG_LOG(DSPHLE, "CurrentUCode init_vector: 0x%08x", m_CurrentUCode.m_StartPC);
DEBUG_LOG(DSPHLE, "CurrentUCode CRC: 0x%08x", crc);
DEBUG_LOG(DSPHLE, "BootTask - done");
CDSPHandler::GetInstance().SetUCode(crc);
}

View File

@ -34,7 +34,7 @@ CUCode_Zelda::CUCode_Zelda(CMailHandler& _rMailHandler)
, m_step(0)
, m_readOffset(0)
{
DebugLog("UCode_Zelda - add boot mails for handshake");
DEBUG_LOG(DSPHLE, "UCode_Zelda - add boot mails for handshake");
m_rMailHandler.PushMail(DSP_INIT);
m_rMailHandler.PushMail(0x80000000); // handshake
memset(m_Buffer, 0, sizeof(m_Buffer));
@ -126,8 +126,8 @@ void CUCode_Zelda::ExecuteList()
u32 Command = (Temp >> 24) & 0x7f;
u32 Sync = Temp >> 16;
DebugLog("==============================================================================");
DebugLog("Zelda UCode - execute dlist (cmd: 0x%04x : sync: 0x%04x)", Command, Sync);
DEBUG_LOG(DSPHLE, "==============================================================================");
DEBUG_LOG(DSPHLE, "Zelda UCode - execute dlist (cmd: 0x%04x : sync: 0x%04x)", Command, Sync);
switch (Command)
{
@ -140,11 +140,11 @@ void CUCode_Zelda::ExecuteList()
tmp[2] = Read32();
tmp[3] = Read32();
DebugLog("DsetupTable");
DebugLog("???: 0x%08x", tmp[0]);
DebugLog("DSPRES_FILTER (size: 0x40): 0x%08x", tmp[1]);
DebugLog("DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]);
DebugLog("???: 0x%08x", tmp[3]);
DEBUG_LOG(DSPHLE, "DsetupTable");
DEBUG_LOG(DSPHLE, "???: 0x%08x", tmp[0]);
DEBUG_LOG(DSPHLE, "DSPRES_FILTER (size: 0x40): 0x%08x", tmp[1]);
DEBUG_LOG(DSPHLE, "DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]);
DEBUG_LOG(DSPHLE, "???: 0x%08x", tmp[3]);
}
break;
@ -159,14 +159,14 @@ void CUCode_Zelda::ExecuteList()
// We're ready to mix
mixer_HLEready = true;
DebugLog("Update the SoundThread to be in sync");
DEBUG_LOG(DSPHLE, "Update the SoundThread to be in sync");
soundStream->Update(); //do it in this thread to avoid sync problems
DebugLog("DsyncFrame");
DebugLog("???: 0x%08x", tmp[0]);
DebugLog("???: 0x%08x", tmp[1]);
DebugLog("DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]);
DEBUG_LOG(DSPHLE, "DsyncFrame");
DEBUG_LOG(DSPHLE, "???: 0x%08x", tmp[0]);
DEBUG_LOG(DSPHLE, "???: 0x%08x", tmp[1]);
DEBUG_LOG(DSPHLE, "DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]);
}
break;
@ -188,9 +188,9 @@ void CUCode_Zelda::ExecuteList()
tmp[0] = Read32();
tmp[1] = Read32();
DebugLog("DSetDolbyDelay");
DebugLog("DOLBY2_DELAY_BUF (size 0x960): 0x%08x", tmp[0]);
DebugLog("DSPRES_FILTER (size 0x500): 0x%08x", tmp[1]);
DEBUG_LOG(DSPHLE, "DSetDolbyDelay");
DEBUG_LOG(DSPHLE, "DOLBY2_DELAY_BUF (size 0x960): 0x%08x", tmp[0]);
DEBUG_LOG(DSPHLE, "DSPRES_FILTER (size 0x500): 0x%08x", tmp[1]);
}
break;

View File

@ -44,7 +44,7 @@ IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler)
case 0xd73338cf: // IPL
case 0x42f64ac4: // Luigi (after fix)
case 0x4be6a5cb: // AC, Pikmin (after fix)
Console::Print("JAC ucode chosen\n");
INFO_LOG(CONSOLE, "JAC ucode chosen\n");
return new CUCode_Jac(_rMailHandler);
case 0x3ad3b7ac: // Naruto3
@ -56,20 +56,20 @@ IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler)
case 0x07f88145: // bustamove, ikaruga, fzero, robotech battle cry, star soldier, soul calibur2,
// Zelda:OOT, Tony hawk, viewtiful joe
case 0xe2136399: // billy hatcher, dragonballz, mario party 5, TMNT, ava1080
Console::Print("AX ucode chosen, yay!\n");
INFO_LOG(CONSOLE, "AX ucode chosen, yay!\n");
return new CUCode_AX(_rMailHandler);
case 0x6CA33A6D: // DK Jungle Beat
case 0x86840740: // zelda
case 0x56d36052: // mario
case 0x2fcdf1ec: // mariokart, zelda 4 swords
Console::Print("Zelda ucode chosen\n");
INFO_LOG(CONSOLE, "Zelda ucode chosen\n");
return new CUCode_Zelda(_rMailHandler);
// WII CRCs
case 0x6c3f6f94: // zelda - PAL
case 0xd643001f: // mario galaxy - PAL
Console::Print("Zelda Wii ucode chosen\n");
INFO_LOG(CONSOLE, "Zelda Wii ucode chosen\n");
return new CUCode_Zelda(_rMailHandler);
case 0x5ef56da3: // AX demo
@ -79,7 +79,7 @@ IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler)
case 0xb7eb9a9c: // Wii Pikmin - JAP
case 0x4cc52064: // Bleach: Versus Crusade
case 0xd9c4bf34: // WiiMenu ... pray
Console::Print("Wii - AXWii chosen\n");
INFO_LOG(CONSOLE, "Wii - AXWii chosen\n");
return new CUCode_AXWii(_rMailHandler, _CRC);
default:

View File

@ -26,7 +26,6 @@
CDebugger* m_frame = NULL;
#endif
#include "ConsoleWindow.h" // Common: For the Windows console
#include "ChunkFile.h"
#include "WaveFile.h"
#include "PCHW/Mixer.h"
@ -40,6 +39,7 @@ CDebugger* m_frame = NULL;
#include "PCHW/NullSoundStream.h"
// Declarations and definitions
PLUGIN_GLOBALS* globals = NULL;
DSPInitialize g_dspInitialize;
u8* g_pMemory;
extern std::vector<std::string> sMailLog, sMailTime;
@ -127,12 +127,13 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
#endif
/*
// Open and close console
void OpenConsole()
{
#if defined (_WIN32)
Console::Open(155, 100, "Sound Debugging"); // give room for 100 rows
Console::Print("OpenConsole > Console opened\n");
DEBUG_LOG(CONSOLE, "OpenConsole > Console opened\n");
MoveWindow(Console::GetHwnd(), 0,400, 1280,550, true); // move window, TODO: make this
// adjustable from the debugging window
#endif
@ -144,7 +145,7 @@ void CloseConsole()
FreeConsole();
#endif
}
*/
// Exported fuctions
@ -186,7 +187,11 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
#endif
}
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
{
globals = _pPluginGlobals;
LogManager::SetInstance((LogManager *)globals->logManager);
}
void DllConfig(HWND _hParent)