diff --git a/Branches/MusicMod/Common/Common.vcproj b/Branches/MusicMod/Common/Common.vcproj
index ee0fbb43e6..bfd7927ca2 100644
--- a/Branches/MusicMod/Common/Common.vcproj
+++ b/Branches/MusicMod/Common/Common.vcproj
@@ -227,18 +227,115 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
diff --git a/Branches/MusicMod/Common/Src/Console.cpp b/Branches/MusicMod/Common/Src/Console.cpp
deleted file mode 100644
index aa5ad57108..0000000000
--- a/Branches/MusicMod/Common/Src/Console.cpp
+++ /dev/null
@@ -1,134 +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/
-
-
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Include
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
-//#include
-#include
-//#include "stdafx.h"
-#include
-#include
-//#include
-/////////////////////////////
-
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Declarations and definitions
-// ŻŻŻŻŻŻŻŻŻŻ
-
-// Enable or disable logging to screen and file
-#define MM_DEBUG
-//#define MM_DEBUG_FILEONLY
-
-#ifdef MM_DEBUG
- FILE* __fStdOut = NULL;
-#endif
-#ifndef MM_DEBUG_FILEONLY
- 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 writton to this file. The file pointer is automatically closed
- when you close the application. */
-// ---------------------
-void StartConsoleWin(int width, int height, char* fname)
-{
-#ifdef MM_DEBUG
-
- #ifndef MM_DEBUG_FILEONLY
- // Allocate console
- AllocConsole();
-
- // Set console window title
- SetConsoleTitle(fname);
-
- // Get window handle to write to
- __hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
-
- // Create coordinates table
- COORD co = {width, height};
-
- // Set the innteral letter space
- SetConsoleScreenBufferSize(__hStdOut, co);
-
- // Set the window width and height
- SMALL_RECT coo = {0,0, (width - 1),50}; // Top, left, right, bottom
- SetConsoleWindowInfo(__hStdOut, true, &coo);
- #endif
-
- if(fname)
- {
- // Edit the log file name
- std::string FileEnding = ".log";
- std::string FileName = fname;
- std::string FullFilename = (FileName + FileEnding);
- __fStdOut = fopen(FullFilename.c_str(), "w");
- }
-
-#endif
-}
-/////////////////////////////
-
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Printf function
-// ŻŻŻŻŻŻŻŻŻŻ
-int wprintf(char *fmt, ...)
-{
- #ifdef MM_DEBUG
- char s[500]; // Bigget message size
- va_list argptr;
- int cnt;
-
- va_start(argptr, fmt);
- cnt = vsprintf(s, fmt, argptr);
- va_end(argptr);
-
- DWORD cCharsWritten;
-
- // ---------------------------------------------------
- // Write to console
- // --------------
- #ifndef MM_DEBUG_FILEONLY
- if(__hStdOut)
- WriteConsole(__hStdOut, s, strlen(s), &cCharsWritten, NULL);
- #endif
- // ----------------------------
-
- // Write to file
- if(__fStdOut)
- {
- fprintf(__fStdOut, s);
- fflush(__fStdOut); // Write file now, don't wait
- }
-
- return(cnt);
- #else
- return 0;
- #endif
-}
-/////////////////////////////
\ No newline at end of file
diff --git a/Branches/MusicMod/Common/Src/Console.h b/Branches/MusicMod/Common/Src/Console.h
deleted file mode 100644
index 259a795ef1..0000000000
--- a/Branches/MusicMod/Common/Src/Console.h
+++ /dev/null
@@ -1,29 +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/
-
-
-#ifndef MM_COMMON_H
-#define MM_COMMON_H
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Declarations and definitions
-// ŻŻŻŻŻŻŻŻŻŻ
-void StartConsoleWin(int width = 100, int height = 2000, char* fname = "Console");
-int wprintf(char *fmt, ...);
-//////////////////////////////////
-
-#endif // MM_COMMON_H
\ No newline at end of file
diff --git a/Branches/MusicMod/Main/Main.vcproj b/Branches/MusicMod/Main/Main.vcproj
index 46988cfd9a..294778b9a4 100644
--- a/Branches/MusicMod/Main/Main.vcproj
+++ b/Branches/MusicMod/Main/Main.vcproj
@@ -169,7 +169,7 @@
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\..\..\Source\Core\Common\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Source\Core\Core\Src"
- PreprocessorDefinitions="_SECURE_SCL=0"
+ PreprocessorDefinitions="NDEBUG;_SECURE_SCL=0"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
WarningLevel="3"
@@ -268,6 +268,133 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Branches/MusicMod/Main/Src/Frame.cpp b/Branches/MusicMod/Main/Src/Frame.cpp
index c3977729b6..799ebeda14 100644
--- a/Branches/MusicMod/Main/Src/Frame.cpp
+++ b/Branches/MusicMod/Main/Src/Frame.cpp
@@ -24,6 +24,7 @@
#include "Core.h" // Core
#include "IniFile.h" // Common
+#include "ConsoleWindow.h"
#include "../../../../Source/Core/DolphinWX/Src/Globals.h" // DolphinWX
#include "../../../../Source/Core/DolphinWX/Src/Frame.h"
@@ -34,7 +35,6 @@
#include "../../../../Source/Core/DolphinWX/resources/KDE.h"
#include "../../../../Source/Core/DolphinWX/resources/X-Plastik.h"
-#include "../../Common/Src/Console.h" // Local
#include "../../Player/Src/PlayerExport.h" // Player
//////////////////////////////////
@@ -282,7 +282,7 @@ CFrame::MM_UpdateGUI()
void
CFrame::MM_OnPlay()
{
- //wprintf("\nCFrame::OnPlayMusicMod > Begin\n");
+ //Console::Print("\nCFrame::OnPlayMusicMod > Begin\n");
// Save the volume
MusicMod::GlobalVolume = mm_Slider->GetValue();
@@ -296,7 +296,7 @@ CFrame::MM_OnPlay()
{
if (Core::GetState() == Core::CORE_RUN)
{
- //wprintf("CFrame::OnPlayMusicMod > Pause\n");
+ //Console::Print("CFrame::OnPlayMusicMod > Pause\n");
if(!MusicMod::GlobalPause) // we may has set this elsewhere
{
MusicMod::GlobalPause = true;
@@ -308,7 +308,7 @@ CFrame::MM_OnPlay()
}
else
{
- //wprintf("CFrame::OnPlayMusicMod > Play\n");
+ //Console::Print("CFrame::OnPlayMusicMod > Play\n");
if(MusicMod::GlobalPause) // we may has set this elsewhere
{
MusicMod::GlobalPause = false;
@@ -336,7 +336,7 @@ CFrame::MM_OnStop()
void
CFrame::MM_OnMute(wxCommandEvent& WXUNUSED (event))
{
- //wprintf("CFrame::OnMute > Begin\n");
+ //Console::Print("CFrame::OnMute > Begin\n");
//MessageBox(0, "", "", 0);
if(!MusicMod::GlobalMute)
@@ -368,7 +368,7 @@ CFrame::MM_OnMute(wxCommandEvent& WXUNUSED (event))
void
CFrame::MM_OnPause(wxCommandEvent& WXUNUSED (event))
{
- wprintf("CFrame::OnPause > Begin\n");
+ Console::Print("CFrame::OnPause > Begin\n");
//MessageBox(0, "", "", 0);
if(!MusicMod::GlobalPause)
@@ -399,7 +399,7 @@ CFrame::MM_OnPause(wxCommandEvent& WXUNUSED (event))
// ---------------------------------------------------------------------------------------
void CFrame::MM_OnVolume(wxScrollEvent& event)
{
- //wprintf("CFrame::OnVolume > Begin <%i>\n", event.GetPosition());
+ //Console::Print("CFrame::OnVolume > Begin <%i>\n", event.GetPosition());
//MessageBox(0, "", "", 0);
//if(event.GetEventType() == wxEVT_SCROLL_PAGEUP || event.GetEventType() == wxEVT_SCROLL_PAGEDOWN)
@@ -434,7 +434,7 @@ void CFrame::MM_OnVolume(wxScrollEvent& event)
// ---------------------------------------------------------------------------------------
void CFrame::MM_OnLog(wxCommandEvent& event)
{
- //wprintf("CFrame::OnLog > Begin\n");
+ //Console::Print("CFrame::OnLog > Begin\n");
//MessageBox(0, "", "", 0);
if(!MusicMod::dllloaded) return; // Avoid crash
@@ -450,7 +450,7 @@ void CFrame::MM_OnLog(wxCommandEvent& event)
else
{
#if defined (_WIN32)
- FreeConsole(); Player_Console(false);
+ Console::Close(); Player_Console(false);
#endif
}
diff --git a/Branches/MusicMod/Main/Src/Main.cpp b/Branches/MusicMod/Main/Src/Main.cpp
index 20fb43d978..9dd48deb4b 100644
--- a/Branches/MusicMod/Main/Src/Main.cpp
+++ b/Branches/MusicMod/Main/Src/Main.cpp
@@ -24,7 +24,9 @@
#include
#include
-#include "IniFile.h" // Common
+#include "Common.h" // Common
+#include "IniFile.h"
+#include "ConsoleWindow.h"
#include "PowerPC/PowerPc.h" // Core
@@ -32,7 +34,6 @@
#include "../../../../Source/Core/DiscIO/Src/VolumeCreator.h"
#include "../../Player/Src/PlayerExport.h" // Local player
-#include "../../Common/Src/Console.h" // Local common
//////////////////////////////////
@@ -54,7 +55,7 @@ void StructSort (std::vector &MyFiles);
// Playback
-std::string currentfile;
+std::string CurrentFile;
std::string unique_gameid;
std::string MusicPath;
@@ -95,7 +96,7 @@ void StructSort (std::vector &MyFiles)
{
MyFilesStructure temp;
- //wprintf("StructSort > Begin\n");
+ //Console::Print("StructSort > Begin\n");
for(int i = 0; i < MyFiles.size() - 1; i++)
{
@@ -116,7 +117,7 @@ void StructSort (std::vector &MyFiles)
std::cout << i << " " << MyFiles[i].path.c_str() << "#" << MyFiles[i].offset << "\n";
}
- //wprintf("StructSort > Done\n");
+ //Console::Print("StructSort > Done\n");
}
// ============================
@@ -126,7 +127,7 @@ void StructSort (std::vector &MyFiles)
// ------------------------
void ShowConsole()
{
- StartConsoleWin(100, 2000, "Console"); // Give room for 2000 rows
+ Console::Open(100, 2000, "MusicMod", true); // Give room for 2000 rows
}
void Init()
@@ -150,9 +151,9 @@ void Init()
// Write version
#ifdef _M_X64
- wprintf("64 bit version\n");
+ Console::Print("64 bit version\n");
#else
- wprintf("32 bit version\n");
+ Console::Print("32 bit version\n");
#endif
// -----------
@@ -162,10 +163,11 @@ void Init()
// Show DLL status
Player_Main(MusicMod::bShowConsole);
//play_file("c:\\demo36_02.ast");
- //wprintf("DLL loaded\n");
+ //Console::Print("DLL loaded\n");
dllloaded = true; // Do this once
}
+// ============================
// =======================================================================================
@@ -198,7 +200,7 @@ void Main(std::string FileName)
LPSECURITY_ATTRIBUTES attr;
attr = NULL;
MusicPath = "Music\\";
- wprintf("Created a Music directory\n");
+ Console::Print("Created a Music directory\n");
CreateDirectory(MusicPath.c_str(), attr);
// ----------------------------------------------------------------------------------------
}
@@ -210,16 +212,16 @@ void Main(std::string FileName)
void CheckFile(std::string File, int FileNumber)
{
// Do nothing if we found the same file again
- if (currentfile == File) return;
+ if (CurrentFile == File) return;
- //wprintf(">>>> (%i)Current read %s <%u = %ux%i> \n", i, CurrentFiles[i].path.c_str(), offset, CurrentFiles[i].offset, size);
+ //Console::Print(">>>> (%i)Current read %s <%u = %ux%i> \n", i, CurrentFiles[i].path.c_str(), offset, CurrentFiles[i].offset, size);
if (CheckFileEnding(File.c_str()))
{
- wprintf("\n >>> (%i/%i) Match %s\n\n", FileNumber,
+ Console::Print("\n >>> (%i/%i) Match %s\n\n", FileNumber,
MyFiles.size(), File.c_str());
- currentfile = File; // save the found file
+ CurrentFile = File; // Save the found file
// ---------------------------------------------------------------------------------------
// We will now save the file to the PC hard drive
@@ -235,7 +237,7 @@ void CheckFile(std::string File, int FileNumber)
std::string FilePath = (MusicPath + fragment);
// ---------------------------------------------------------------------------------------
WritingFile = true; // Avoid detecting the file we are writing
- wprintf("Writing <%s> to <%s>\n", File.c_str(), FilePath.c_str());
+ Console::Print("Writing <%s> to <%s>\n", File.c_str(), FilePath.c_str());
my_pFileSystem->ExportFile(File.c_str(), FilePath.c_str());
WritingFile = false;
@@ -245,7 +247,7 @@ void CheckFile(std::string File, int FileNumber)
{
Player_Play((char*)FilePath.c_str()); // retype it from const char* to char*
} else {
- wprintf("Warning > Music DLL is not loaded");
+ Console::Print("Warning > Music DLL is not loaded");
}
// ---------------------------------------------------------------------------------------
@@ -254,9 +256,9 @@ void CheckFile(std::string File, int FileNumber)
{
if(!remove(CurrentPlayFile.c_str()))
{
- wprintf("The program failed to remove <%s>\n", CurrentPlayFile.c_str());
+ Console::Print("The program failed to remove <%s>\n", CurrentPlayFile.c_str());
} else {
- wprintf("The program removed <%s>\n", CurrentPlayFile.c_str());
+ Console::Print("The program removed <%s>\n", CurrentPlayFile.c_str());
}
}
@@ -268,11 +270,11 @@ void CheckFile(std::string File, int FileNumber)
}
- // Tell about the files we ignored
- wprintf("(%i/%i) Ignored %s\n", FileNumber, MyFiles.size(), File.c_str());
+ // Tell the user about the files we ignored
+ Console::Print("(%i/%i) Ignored %s\n", FileNumber, MyFiles.size(), File.c_str());
// Update the current file
- currentfile = File;
+ CurrentFile = File;
}
@@ -328,4 +330,4 @@ void FindFilename(u64 offset, u64 size)
/////////////////////////////////
-} // end of namespace
\ No newline at end of file
+} // end of namespace
diff --git a/Branches/MusicMod/Player/Player.vcproj b/Branches/MusicMod/Player/Player.vcproj
index ac3c0722d4..4b7df6c15f 100644
--- a/Branches/MusicMod/Player/Player.vcproj
+++ b/Branches/MusicMod/Player/Player.vcproj
@@ -45,6 +45,7 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Branches/MusicMod/Player/Src/Config.cpp b/Branches/MusicMod/Player/Src/Config.cpp
index bdc15d20bb..e49b0b79c6 100644
--- a/Branches/MusicMod/Player/Src/Config.cpp
+++ b/Branches/MusicMod/Player/Src/Config.cpp
@@ -34,7 +34,7 @@ const TCHAR * SECTION = TEXT( "Plainamp" );
ConfVar::ConfVar( TCHAR * szKey, ConfMode mode )
{
// MessageBox( 0, TEXT( "no const @ ConfVar" ), TEXT( "" ), 0 );
- //wprintf("ConfVar::ConfVar(TCHAR) > Got <%s>\n", szKey);
+ //Console::Print("ConfVar::ConfVar(TCHAR) > Got <%s>\n", szKey);
// Init
const int iLen = ( int )_tcslen( szKey );
@@ -59,7 +59,7 @@ ConfVar::ConfVar( TCHAR * szKey, ConfMode mode )
////////////////////////////////////////////////////////////////////////////////
ConfVar::ConfVar( const TCHAR * szKey, ConfMode mode )
{
- //wprintf("ConfVar::ConfVar(const TCHAR) > Got <%s>\n", szKey);
+ //Console::Print("ConfVar::ConfVar(const TCHAR) > Got <%s>\n", szKey);
// Init
m_szKey = ( TCHAR * )szKey;
@@ -73,7 +73,7 @@ ConfVar::ConfVar( const TCHAR * szKey, ConfMode mode )
if( !conf_map ) conf_map = new map;
conf_map->insert( pair( m_szKey, this ) );
- //wprintf("ConfVar::ConfVar(const TCHAR) > Insert <%s>\n", ConfVar::m_szKey);
+ //Console::Print("ConfVar::ConfVar(const TCHAR) > Insert <%s>\n", ConfVar::m_szKey);
}
@@ -96,7 +96,7 @@ ConfVar::~ConfVar()
ConfBool::ConfBool( bool * pbData, TCHAR * szKey, ConfMode mode, bool bDefault ) : ConfVar( szKey, mode )
{
// MessageBox( 0, TEXT( "no const @ ConfBool" ), TEXT( "" ), 0 );
- //wprintf("ConfBool(TCHAR) > Get <%s>\n", szKey);
+ //Console::Print("ConfBool(TCHAR) > Get <%s>\n", szKey);
m_pbData = pbData;
m_bDefault = bDefault;
@@ -112,7 +112,7 @@ ConfBool::ConfBool( bool * pbData, TCHAR * szKey, ConfMode mode, bool bDefault )
////////////////////////////////////////////////////////////////////////////////
ConfBool::ConfBool( bool * pbData, const TCHAR * szKey, ConfMode mode, bool bDefault ) : ConfVar( szKey, mode )
{
- //wprintf("ConfBool(TCHAR) > Get <%s>\n", szKey);
+ //Console::Print("ConfBool(TCHAR) > Get <%s>\n", szKey);
m_pbData = pbData;
m_bDefault = bDefault;
@@ -127,7 +127,7 @@ ConfBool::ConfBool( bool * pbData, const TCHAR * szKey, ConfMode mode, bool bDef
////////////////////////////////////////////////////////////////////////////////
void ConfBool::Read()
{
- //wprintf("ConfBool::Read() > Begin and \n", m_bRead, szIniPath);
+ //Console::Print("ConfBool::Read() > Begin and \n", m_bRead, szIniPath);
if( m_bRead || !szIniPath ) return;
@@ -507,13 +507,13 @@ ConfString::ConfString( TCHAR * szData, const TCHAR * szKey, ConfMode mode, TCHA
////////////////////////////////////////////////////////////////////////////////
void ConfString::Read()
{
- //wprintf( "ConfString::Read() > Begin\n");
+ //Console::Print( "ConfString::Read() > Begin\n");
if( m_bRead || !szIniPath ) return;
GetPrivateProfileString( SECTION, m_szKey, m_szDefault, m_szData, m_iMaxLen, szIniPath );
- //wprintf( "ConfString::Read() > GetPrivateProfileString <%s> <%s> <%s>\n", m_szKey, m_szData, szIniPath);
+ //Console::Print( "ConfString::Read() > GetPrivateProfileString <%s> <%s> <%s>\n", m_szKey, m_szData, szIniPath);
m_bRead = true;
}
@@ -567,7 +567,7 @@ void ConfCurDir::Read()
// Apply
//SetCurrentDirectory( m_szData );
- //wprintf("ConfCurDir::Read > End <%s>\n", m_szData);
+ //Console::Print("ConfCurDir::Read > End <%s>\n", m_szData);
}
// ==============================================================================
@@ -581,7 +581,7 @@ void ConfCurDir::Write()
GetCurrentDirectory( MAX_PATH, m_szData ); // Note: without trailing slash
// MessageBox( 0, m_szData, TEXT( "CurDir" ), 0 );
- //wprintf("ConfCurDir::Read <%s>\n", m_szData);
+ //Console::Print("ConfCurDir::Read <%s>\n", m_szData);
ConfString::Write();
}
@@ -645,7 +645,7 @@ void Conf::Init()
//_sntprintf( szIniPath, _MAX_PATH, TEXT( "%s%s%s" ), szDrive, szDir, fd.cFileName );
_sntprintf( szIniPath, _MAX_PATH, TEXT( "%s%s%s" ), szDrive, szDir, TEXT( "Plainamp.ini" ) );
- wprintf("DLL > We got the ini path <%s>\n", szIniPath);
+ Console::Print("DLL > Ini path <%s>\n", szIniPath);
// =======================================================================================
diff --git a/Branches/MusicMod/Player/Src/Global.h b/Branches/MusicMod/Player/Src/Global.h
index 250038356a..7547403dbd 100644
--- a/Branches/MusicMod/Player/Src/Global.h
+++ b/Branches/MusicMod/Player/Src/Global.h
@@ -22,7 +22,7 @@
//////////////////////////////////////////////////////////////////////////////////////////
// Include
// ŻŻŻŻŻŻŻŻŻŻ
-#include "../../Common/Src/Console.h" // Local common
+#include "../../../../Source/Core/Common/Src/ConsoleWindow.h" // Global common
/////////////////////////
diff --git a/Branches/MusicMod/Player/Src/InputPlugin.cpp b/Branches/MusicMod/Player/Src/InputPlugin.cpp
index beef9ba11d..bf33ad6c29 100644
--- a/Branches/MusicMod/Player/Src/InputPlugin.cpp
+++ b/Branches/MusicMod/Player/Src/InputPlugin.cpp
@@ -37,7 +37,7 @@ InputPlugin::InputPlugin( TCHAR * szDllpath, bool bKeepLoaded ) : Plugin( szDllp
iFiltersLen = 0;
plugin = NULL;
- //wprintf("\InputPlugin::InputPlugin > Begin\n");
+ //Console::Print("\InputPlugin::InputPlugin > Begin\n");
if( !Load() )
{
diff --git a/Branches/MusicMod/Player/Src/Main.cpp b/Branches/MusicMod/Player/Src/Main.cpp
index aee1519087..352c1f8532 100644
--- a/Branches/MusicMod/Player/Src/Main.cpp
+++ b/Branches/MusicMod/Player/Src/Main.cpp
@@ -371,7 +371,7 @@ LRESULT CALLBACK WndprocMain( HWND hwnd, UINT message, WPARAM wp, LPARAM lp )
static bool bRemoveIcon = false;
#ifdef NOGUI
- //wprintf("DLL > Main.cpp:WndprocMain() was called. But nothing will be done. \n");
+ //Console::Print("DLL > Main.cpp:WndprocMain() was called. But nothing will be done. \n");
#else
Console::Append( TEXT( "Main.cpp:WndprocMain was called" ) );
#endif
diff --git a/Branches/MusicMod/Player/Src/Output.cpp b/Branches/MusicMod/Player/Src/Output.cpp
index 8c20840dc9..25c2352fb7 100644
--- a/Branches/MusicMod/Player/Src/Output.cpp
+++ b/Branches/MusicMod/Player/Src/Output.cpp
@@ -266,7 +266,7 @@ void Output_SetVolume( int volume )
//_stprintf( szBuffer, TEXT( "DLL > Output_SetVolume <%i>" ), volume );
//Console::Append( szBuffer );
//Console::Append( TEXT( " " ) );
- //wprintf( "DLL > Output_SetVolume <%i>\n", volume );
+ //Console::Print( "DLL > Output_SetVolume <%i>\n", volume );
// =======================================================================================
for( int i = 0; i < active_output_count; i++ )
diff --git a/Branches/MusicMod/Player/Src/OutputPlugin.cpp b/Branches/MusicMod/Player/Src/OutputPlugin.cpp
index 69b130a5a8..9f43bf0285 100644
--- a/Branches/MusicMod/Player/Src/OutputPlugin.cpp
+++ b/Branches/MusicMod/Player/Src/OutputPlugin.cpp
@@ -248,7 +248,7 @@ bool OutputPlugin::Config( HWND hParent )
////////////////////////////////////////////////////////////////////////////////
bool OutputPlugin::Start()
{
- //wprintf( "OutputPlugin::Start() > Begin \n",
+ //Console::Print( "OutputPlugin::Start() > Begin \n",
// IsLoaded(), bActive, active_output_count );
if( !IsLoaded() ) return false;
@@ -275,7 +275,7 @@ bool OutputPlugin::Start()
Console::Append( szBuffer );
Console::Append( TEXT( " " ) );
#else
- wprintf( "\n >>> Output plugin '%s' activated\n\n" , GetFilename() );
+ Console::Print( "\n >>> Output plugin '%s' activated\n\n" , GetFilename() );
#endif
bActive = true;
diff --git a/Branches/MusicMod/Player/Src/Playback.cpp b/Branches/MusicMod/Player/Src/Playback.cpp
index 1e6c9fbeac..6124c78aca 100644
--- a/Branches/MusicMod/Player/Src/Playback.cpp
+++ b/Branches/MusicMod/Player/Src/Playback.cpp
@@ -60,14 +60,14 @@ void EnableTimer( bool bEnabled )
if( bEnabled )
{
SetTimer( WindowMain, TIMER_SEEK_UPDATE, 1000, NULL );
- wprintf( "EnableTimer > Activated\n" );
+ Console::Print( "EnableTimer > Activated\n" );
}
else
{
KillTimer( WindowMain, TIMER_SEEK_UPDATE );
StatusReset();
- wprintf( "EnableTimer > Killed\n" );
+ Console::Print( "EnableTimer > Killed\n" );
}
bTimerRunning = bEnabled;
@@ -82,7 +82,7 @@ bool OpenPlay( TCHAR * szFilename, int iNumber )
{
// =======================================================================================
#ifdef NOGUI
- //wprintf( "Playback.cpp: OpenPlay > Begin <%i> <%s>\n" , iNumber, szFilename );
+ //Console::Print( "Playback.cpp: OpenPlay > Begin <%i> <%s>\n" , iNumber, szFilename );
#else
TCHAR sszBuffer[ 5000 ];
_stprintf( sszBuffer, TEXT( "Playback.cpp: OpenPlay was called <%i> <%s>" ), iNumber, szFilename );
@@ -121,14 +121,14 @@ bool OpenPlay( TCHAR * szFilename, int iNumber )
{
Console::Append( TEXT( "ERROR: Extension not supported" ) );
Console::Append( " " );
- wprintf("OpenPlay > ERROR: Extension not supported\n");
+ Console::Print("OpenPlay > ERROR: Extension not supported\n");
return false;
}
// ---------------------------------------------------------------------------------------
// Now that we know which input pugin to use we set that one as active
InputPlugin * old_input = active_input_plugin; // Save the last one, if any
active_input_plugin = iter->second;
- wprintf("OpenPlay > Input plugin '%s' activated\n", active_input_plugin->GetFilename());
+ Console::Print("OpenPlay > Input plugin '%s' activated\n", active_input_plugin->GetFilename());
// =======================================================================================
if( old_input )
@@ -145,12 +145,12 @@ bool OpenPlay( TCHAR * szFilename, int iNumber )
{
Console::Append( TEXT( "ERROR: Input plugin is NULL" ) );
Console::Append( " " );
- wprintf("OpenPlay > ERROR: Input plugin is NULL\n");
+ Console::Print("OpenPlay > ERROR: Input plugin is NULL\n");
return false;
}
// Connect
- //wprintf( "OpenPlay > OutMod\n" );
+ //Console::Print( "OpenPlay > OutMod\n" );
active_input_plugin->plugin->outMod = &output_server; // output->plugin;
// =======================================================================================
@@ -190,10 +190,10 @@ bool OpenPlay( TCHAR * szFilename, int iNumber )
TCHAR szTitle[ 2000 ] = TEXT( "\0" );
int length_in_ms;
- //wprintf( "OpenPlay > GetFileInfo\n" );
+ //Console::Print( "OpenPlay > GetFileInfo\n" );
active_input_plugin->plugin->GetFileInfo( szFilename, szTitle, &length_in_ms );
- //wprintf( "OpenPlay > Play\n" );
+ //Console::Print( "OpenPlay > Play\n" );
active_input_plugin->plugin->Play( szFilename );
// =======================================================================================
#endif
@@ -218,7 +218,7 @@ bool OpenPlay( TCHAR * szFilename, int iNumber )
// Timer ON
//EnableTimer( true );
- //wprintf( "OpenPlay > End\n" );
+ //Console::Print( "OpenPlay > End\n" );
return true;
}
@@ -298,7 +298,7 @@ bool Playback::Play()
Console::Append( sszBuffer );
Console::Append( TEXT( " " ) );
#else
- //wprintf( "Playback::Play() > Begin <%i>\n" , bPlaying );
+ //Console::Print( "Playback::Play() > Begin <%i>\n" , bPlaying );
#endif
// ---------------------------------------------------------------------------------------
@@ -393,7 +393,7 @@ bool Playback::Play()
Console::Append( szBuffer );
//Console::Append( TEXT( " " ) );
#else
- //wprintf( "Playback::Play() > Filename <%s>\n", szFilename);
+ //Console::Print( "Playback::Play() > Filename <%s>\n", szFilename);
#endif
// Play
diff --git a/Branches/MusicMod/Player/Src/Player.cpp b/Branches/MusicMod/Player/Src/Player.cpp
index f04338ff20..2dcba8350e 100644
--- a/Branches/MusicMod/Player/Src/Player.cpp
+++ b/Branches/MusicMod/Player/Src/Player.cpp
@@ -125,8 +125,9 @@ void Player_Main(bool Console)
//MessageBox(0, "main() opened", "", 0);
//printf( "main() opened\n" );
- wprintf( "\n=========================================================\n\n" );
- wprintf( "DLL > Player_Main() > Begin\n" );
+ Console::Print( "\n=========================================================\n\n\n" );
+ //Console::Print( "DLL > Player_Main() > Begin\n" );
+ Console::Print( "DLL > Settings:\n", bLoop);
// =======================================================================================
@@ -135,9 +136,9 @@ void Player_Main(bool Console)
Conf::Init( );
// ---------------------------------------------------------------------------------------
- wprintf( "\n\nDLL > Settings:\n", bLoop);
- wprintf( "DLL > Loop: %i\n", bLoop);
- wprintf( "DLL > WarnPluginsMissing: %i\n", bWarnPluginsMissing);
+
+ Console::Print( "DLL > Loop: %i\n", bLoop);
+ Console::Print( "DLL > WarnPluginsMissing: %i\n", bWarnPluginsMissing);
// ---------------------------------------------------------------------------------------
// =======================================================================================
@@ -169,7 +170,7 @@ void Player_Main(bool Console)
memcpy( szPluginDir, szHomeDir, iHomeDirLen * sizeof( TCHAR ) );
memcpy( szPluginDir + iHomeDirLen, TEXT( "PluginsMusic" ), 12 * sizeof( TCHAR ) );
szPluginDir[ iHomeDirLen + 12 ] = TEXT( '\0' );
- wprintf("DLL > Plugindir: %s\n", szPluginDir);
+ Console::Print("DLL > Plugindir: %s\n", szPluginDir);
// =======================================================================================
#ifndef NOGUI
Font::Create();
@@ -182,7 +183,7 @@ void Player_Main(bool Console)
//GlobalVolume = Playback::Volume::Get(); // Don't bother with this for now
//GlobalCurrentVolume = GlobalVolume;
//Output_SetVolume( GlobalVolume );
- wprintf("DLL > Volume: %i\n\n", GlobalVolume);
+ Console::Print("DLL > Volume: %i\n\n", GlobalVolume);
// ---------------------------------------------------------------------------------------
@@ -205,10 +206,10 @@ void Player_Main(bool Console)
Plugin::FindAll ( szPluginDir, TEXT( "dsp_*.dll" ), false );
Plugin::FindAll ( szPluginDir, TEXT( "gen_*.dll" ), true );
- //wprintf( "Winmain.cpp > PluginManager::Fill()\n" );
+ //Console::Print( "Winmain.cpp > PluginManager::Fill()\n" );
PluginManager::Fill();
- //wprintf( "Winmain.cpp > PluginManager::Fill()\n" );
+ //Console::Print( "Winmain.cpp > PluginManager::Fill()\n" );
@@ -250,26 +251,26 @@ void Player_Main(bool Console)
// Check the plugins
if( input_plugins.empty() )
{
- wprintf("\n *** Warning: No valid input plugins found\n\n");
+ Console::Print("\n *** Warning: No valid input plugins found\n\n");
}
else
{
- wprintf(" >>> These valid input plugins were found:\n");
+ Console::Print(" >>> These valid input plugins were found:\n");
for(int i = 0; i < input_plugins.size(); i++)
- wprintf(" %i: %s\n", (i + 1), input_plugins.at(i)->GetFilename());
- wprintf("\n");
+ Console::Print(" %i: %s\n", (i + 1), input_plugins.at(i)->GetFilename());
+ Console::Print("\n");
}
// The input plugins are never activated here, they are activate for each file
if( !active_input_plugin || !active_input_plugin->plugin )
{
- // wprintf("The input plugin is not activated yet\n");
+ // Console::Print("The input plugin is not activated yet\n");
}
else
{
//const int ms_len = active_input_plugin->plugin->GetLength();
//const int ms_cur = active_input_plugin->plugin->GetOutputTime();
- //wprintf("We are at <%i of %i>\n", ms_cur, ms_len);
+ //Console::Print("We are at <%i of %i>\n", ms_cur, ms_len);
}
// ---------------------------------------------------------------------------------------
if( active_output_count > 0 )
@@ -280,11 +281,11 @@ void Player_Main(bool Console)
{
res_temp = active_output_plugins[ i ]->plugin->GetOutputTime();
}
- wprintf("Playback progress <%i>\n", res_temp);*/
+ Console::Print("Playback progress <%i>\n", res_temp);*/
}
else
{
- wprintf("\n *** Warning: The output plugin is not working\n\n");
+ Console::Print("\n *** Warning: The output plugin is not working\n\n");
}
// =======================================================================================
@@ -292,14 +293,14 @@ void Player_Main(bool Console)
// Start the timer
if(!TimerCreated && bLoop) // Only create this the first time
{
- //wprintf("Created the timer\n");
+ //Console::Print("Created the timer\n");
MakeTime();
TimerCreated = true;
}
// =======================================================================================
- wprintf( "\n=========================================================\n\n" );
- //wprintf( "DLL > main_dll() > End\n\n\n" );
+ Console::Print( "\n=========================================================\n\n" );
+ //Console::Print( "DLL > main_dll() > End\n\n\n" );
//std::cin.get();
}
@@ -376,4 +377,4 @@ void close()
//return 0;
}
-// =======================================================================================
\ No newline at end of file
+// =======================================================================================
diff --git a/Branches/MusicMod/Player/Src/PlayerExport.cpp b/Branches/MusicMod/Player/Src/PlayerExport.cpp
index 39cf9dcc67..495d16b09f 100644
--- a/Branches/MusicMod/Player/Src/PlayerExport.cpp
+++ b/Branches/MusicMod/Player/Src/PlayerExport.cpp
@@ -4,9 +4,10 @@
// ŻŻŻŻŻŻŻŻŻŻ
#include // System
-#include "../../../../Source/Core/Common/Src/Common.h" // Global common
+#include "Common.h" // Global common
+#include "ConsoleWindow.h"
-#include "../../Common/Src/Console.h" // Local common
+//#include "../../Common/Src/Console.h" // Local common
#include "OutputPlugin.h" // Local
#include "Playback.h"
@@ -30,7 +31,7 @@ bool Initialized = false;
// -------------------------
-/* We keep the file in the playlist, even though we currently only every have one file here
+/* We keep the file in the playlist, even though we currently only ever have one file here
at a time */
// ---------
void AddFileToPlaylist(char * a)
@@ -59,21 +60,21 @@ void AddFileToPlaylist(char * a)
void Player_Play(char * FileName)
{
- wprintf("Play file <%s>\n", FileName);
+ Console::Print("Play file <%s>\n", FileName);
// Check if the file exists
if(GetFileAttributes(FileName) == INVALID_FILE_ATTRIBUTES)
{
- wprintf("Warning: The file <%s> does not exist. Something is wrong.\n", FileName);
+ Console::Print("Warning: The file <%s> does not exist. Something is wrong.\n", FileName);
return;
}
Playback::Stop();
- //wprintf("Stop\n");
+ //Console::Print("Stop\n");
playlist->RemoveAll();
- //wprintf("RemoveAll\n");
+ //Console::Print("RemoveAll\n");
AddFileToPlaylist(FileName);
- //wprintf("addfiletoplaylist\n");
+ //Console::Print("addfiletoplaylist\n");
// Play the file
Playback::Play();
@@ -83,7 +84,7 @@ void Player_Play(char * FileName)
// ---------------------------------------------------------------------------------------
// Set volume. This must probably be done after the dll is loaded.
//Output_SetVolume( Playback::Volume::Get() );
- //wprintf("Volume(%i)\n", Playback::Volume::Get());
+ //Console::Print("Volume(%i)\n", Playback::Volume::Get());
// ---------------------------------------------------------------------------------------
GlobalPause = false;
@@ -92,7 +93,7 @@ void Player_Play(char * FileName)
void Player_Stop()
{
Playback::Stop();
- //wprintf("Stop\n");
+ //Console::Print("Stop\n");
playlist->RemoveAll();
CurrentlyPlayingFile = "";
@@ -105,13 +106,13 @@ void Player_Pause()
{
if (!GlobalPause)
{
- wprintf("DLL > Pause\n");
+ Console::Print("DLL > Pause\n");
Playback::Pause();
GlobalPause = true;
}
else
{
- wprintf("DLL > UnPause from Pause\n");
+ Console::Print("DLL > UnPause from Pause\n");
Player_Unpause();
GlobalPause = false;
}
@@ -119,7 +120,7 @@ void Player_Pause()
void Player_Unpause()
{
- wprintf("DLL > UnPause\n");
+ Console::Print("DLL > UnPause\n");
Playback::Play();
GlobalPause = false;
}
@@ -135,7 +136,7 @@ void Player_Unpause()
void Player_Mute(int Vol)
{
if(GlobalVolume == -1) GlobalVolume = Vol;
- wprintf("DLL > Mute <%i> <%i>\n", GlobalVolume, GlobalMute);
+ Console::Print("DLL > Mute <%i> <%i>\n", GlobalVolume, GlobalMute);
GlobalMute = !GlobalMute;
@@ -143,15 +144,15 @@ void Player_Mute(int Vol)
if(GlobalMute)
{
Output_SetVolume( 0 );
- wprintf("DLL > Volume <%i>\n", GlobalMute);
+ Console::Print("DLL > Volume <%i>\n", GlobalMute);
}
else
{
Output_SetVolume( GlobalVolume );
- wprintf("DLL > Volume <%i>\n", GlobalMute);
+ Console::Print("DLL > Volume <%i>\n", GlobalMute);
}
- //wprintf("Volume(%i)\n", Playback::Volume::Get());
+ //Console::Print("Volume(%i)\n", Playback::Volume::Get());
}
///////////////////////////////////////
@@ -160,12 +161,12 @@ void Player_Volume(int Vol)
{
GlobalVolume = Vol;
Output_SetVolume( GlobalVolume );
- //wprintf("DLL > Volume <%i> <%i>\n", GlobalVolume, GlobalCurrentVolume);
+ //Console::Print("DLL > Volume <%i> <%i>\n", GlobalVolume, GlobalCurrentVolume);
}
void ShowConsole()
{
- StartConsoleWin(100, 2000, "MusicMod"); // give room for 2000 rows
+ Console::Open(100, 2000, "MusicMod", true); // give room for 2000 rows
}
@@ -177,4 +178,4 @@ void Player_Console(bool Console)
#if defined (_WIN32)
FreeConsole();
#endif
-}
\ No newline at end of file
+}
diff --git a/Branches/MusicMod/Player/Src/PlaylistModel.h b/Branches/MusicMod/Player/Src/PlaylistModel.h
index 76d28fb96f..1992d5db39 100644
--- a/Branches/MusicMod/Player/Src/PlaylistModel.h
+++ b/Branches/MusicMod/Player/Src/PlaylistModel.h
@@ -105,7 +105,7 @@ public:
if( 0 > iIndex || iIndex >= ( int )_database.size() )
{
- wprintf("SetCurIndex > Return");
+ Console::Print("SetCurIndex > Return");
return;
}
diff --git a/Branches/MusicMod/Player/Src/Timer.cpp b/Branches/MusicMod/Player/Src/Timer.cpp
index e079678481..168bd3303f 100644
--- a/Branches/MusicMod/Player/Src/Timer.cpp
+++ b/Branches/MusicMod/Player/Src/Timer.cpp
@@ -48,7 +48,7 @@ extern bool GlobalPause;
void CALLBACK Update(unsigned int,unsigned int,unsigned long,unsigned long,unsigned long)
#endif
{
- //wprintf("DLL > Update() > Begin (%i)\n", active_input_plugin);
+ //Console::Print("DLL > Update() > Begin (%i)\n", active_input_plugin);
// --------------------------------
// Manage restart when playback for a file has reached the end of the file
@@ -56,7 +56,7 @@ extern bool GlobalPause;
// Check if the input plugin is activated
if(!active_input_plugin || !active_input_plugin->plugin)
{
- //wprintf("The input plugin is not activated yet\n");
+ //Console::Print("The input plugin is not activated yet\n");
}
else
{
@@ -73,20 +73,20 @@ extern bool GlobalPause;
if ( progress > 0.7 ) // Only show this if we are getting close to the end, for bugtesting
// basically
{
- //wprintf("Playback progress <%i of %i>\n", ms_cur, ms_len);
+ //Console::Print("Playback progress <%i of %i>\n", ms_cur, ms_len);
}
// Because cur never go all the way to len we can't use a == comparison. Insted of this
// we could also check if the location is the same as right before.
if(ms_cur > ms_len - 1000 && !GlobalPause) // avoid restarting in cases where we just pressed pause
{
- wprintf("Restart <%s>\n", CurrentlyPlayingFile.c_str());
+ Console::Print("Restart <%s>\n", CurrentlyPlayingFile.c_str());
Player_Play((char *)CurrentlyPlayingFile.c_str());
}
}
// --------------
- //wprintf("Make new time\n");
+ //Console::Print("Make new time\n");
MakeTime(); // Make a new one
}
@@ -119,8 +119,8 @@ int MainTimer()
// cout << ".";
//}
- //wprintf("MakeTime\n");
+ //Console::Print("MakeTime\n");
return 0;
}
-///////////////////////////
\ No newline at end of file
+///////////////////////////
diff --git a/Branches/MusicMod/TestPlayer/TestPlayer.vcproj b/Branches/MusicMod/TestPlayer/TestPlayer.vcproj
index 9aa9cb994b..d19f9f460b 100644
--- a/Branches/MusicMod/TestPlayer/TestPlayer.vcproj
+++ b/Branches/MusicMod/TestPlayer/TestPlayer.vcproj
@@ -265,6 +265,130 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Source/Core/Common/Common.vcproj b/Source/Core/Common/Common.vcproj
index 9f7a054811..8e1c43c000 100644
--- a/Source/Core/Common/Common.vcproj
+++ b/Source/Core/Common/Common.vcproj
@@ -566,6 +566,14 @@
RelativePath=".\Src\Common.h"
>
+
+
+
+
diff --git a/Source/Core/Common/Src/Common.h b/Source/Core/Common/Src/Common.h
index a0fbeae3ea..7df31f7cb7 100644
--- a/Source/Core/Common/Src/Common.h
+++ b/Source/Core/Common/Src/Common.h
@@ -36,9 +36,6 @@
#define LOGGING
#endif
- // Allow wxWidgets in Core
- //#define WX_CORE
-
#include "../../../PluginSpecs/CommonTypes.h"
#define HAVE_WIIUSE 1
#define HAVE_WX 1
diff --git a/Source/Plugins/Plugin_Wiimote/Src/Console.h b/Source/Core/Common/Src/ConsoleWindow.h
similarity index 73%
rename from Source/Plugins/Plugin_Wiimote/Src/Console.h
rename to Source/Core/Common/Src/ConsoleWindow.h
index d2ba1ce5d3..2688d0bdb7 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/Console.h
+++ b/Source/Core/Common/Src/ConsoleWindow.h
@@ -1,41 +1,52 @@
-// 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/
-
-#ifndef WIIMOTE_CONSOLE_H
-#define WIIMOTE_CONSOLE_H
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Includes
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
-#include
-//////////////////////////////
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Declarations
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
-std::string Tm(bool Ms = false);
-void startConsoleWin(int width, int height, char* fname);
-int wprintf(const char *fmt, ...);
-int aprintf(int a, const char *fmt, ...);
-void ClearScreen();
-
-#ifdef _WIN32
- HWND GetConsoleHwnd(void);
-#endif
-///////////////////////////////
-
-#endif // WIIMOTE_CONSOLE_H
\ No newline at end of file
+// 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/
+
+#ifndef _CONSOLE_H
+#define _CONSOLE_H
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// Includes
+// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
+#include
+#ifdef _WIN32
+ #include
+#endif
+//////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// Declarations
+// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
+namespace Console
+{
+
+// Settings
+extern bool WriteToFile;
+
+// Functions
+void Open(int Width = 80, int Height = 100, char * Name = "Console", bool File = false);
+void Close();
+int Print(const char *fmt, ...);
+void ClearScreen();
+#ifdef _WIN32
+ HWND GetHwnd(void);
+#endif
+
+} // Console
+///////////////////////////////
+
+
+#endif // _CONSOLE_H
diff --git a/Source/Core/Common/Src/DynamicLibrary.cpp b/Source/Core/Common/Src/DynamicLibrary.cpp
index 4b5f61af5f..47da8e89e3 100644
--- a/Source/Core/Common/Src/DynamicLibrary.cpp
+++ b/Source/Core/Common/Src/DynamicLibrary.cpp
@@ -40,7 +40,6 @@ and stopped.
#include "FileUtil.h"
#include "StringUtil.h"
#include "DynamicLibrary.h"
-#include "../../../../Branches/MusicMod/Common/Src/Console.h"
///////////////////////////////////
@@ -157,7 +156,7 @@ void* DynamicLibrary::Get(const char* funcname) const
if (!retval)
{
LOG(MASTER_LOG, "Symbol %s missing in %s (error: %s)\n", funcname, library_file.c_str(), GetLastErrorAsString().c_str());
- PanicAlert("Symbol %s missing in %s (error: %s)\n", funcname, library_file.c_str(), GetLastErrorAsString().c_str());
+ //PanicAlert("Symbol %s missing in %s (error: %s)\n", funcname, library_file.c_str(), GetLastErrorAsString().c_str());
}
return retval;
diff --git a/Source/Core/Core/Core.vcproj b/Source/Core/Core/Core.vcproj
index 144dcb103f..a8d6ab7dcf 100644
--- a/Source/Core/Core/Core.vcproj
+++ b/Source/Core/Core/Core.vcproj
@@ -1,7 +1,7 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1100,70 +1164,6 @@
>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp
index 1c61df2ea4..718d85f95e 100644
--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp
+++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp
@@ -25,7 +25,6 @@
#include "../Core.h" // Local core functions
#include "../Debugger/Debugger_SymbolMap.h"
#include "../Host.h"
-#include "../../../../Branches/MusicMod/Common/Src/Console.h"
///////////////////////
diff --git a/Source/Core/DolphinWX/DolphinWX.vcproj b/Source/Core/DolphinWX/DolphinWX.vcproj
index 8dfcf72d5c..e575304644 100644
--- a/Source/Core/DolphinWX/DolphinWX.vcproj
+++ b/Source/Core/DolphinWX/DolphinWX.vcproj
@@ -1,7 +1,7 @@
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Blocks.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Blocks.cpp
index 34e351e820..aa1de7dfe4 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Blocks.cpp
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Blocks.cpp
@@ -19,7 +19,10 @@
//
//////////////////////////////////////////////////////////////////////////////////////////
-// includes
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// Includes
+// -------------
#include
#include
#include
@@ -28,13 +31,16 @@
#include
#endif
+#include "ConsoleWindow.h" // Open and close console
+
#include "Debugger.h"
#include "PBView.h"
#include "IniFile.h"
#include "FileUtil.h"
#include "StringUtil.h"
#include "FileSearch.h"
-#include "../Logging/Console.h" // open and close console
+//#include "../Logging/File.h" // Write to file
+///////////////////////////////
// Make the wxTextCtrls scroll with each other
@@ -55,7 +61,7 @@ void CDebugger::DoScrollBlocks()
else if(GetAsyncKeyState(VK_NUMPAD2))
A += 0.11;
- wprintf("GetScrollPos:%i GetScrollRange:%i GetPosition:%i GetLastPosition:%i GetMaxWidth:%i \
+ Console::Print("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),
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp
index 6ce09a24d5..10fba2e918 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp
@@ -19,26 +19,31 @@
//
//////////////////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// Includes
+// -------------
// includes
-#include
+#include // System
#include
#include
-
#ifndef _WIN32
-#include
+ #include
#endif
+#include "ConsoleWindow.h" // Open and close console
+
#include "Debugger.h"
#include "PBView.h"
#include "IniFile.h"
#include "FileUtil.h"
#include "StringUtil.h"
#include "FileSearch.h"
-#include "../Logging/Console.h" // open and close console
-
+#include "../Debugger/File.h" // Write to file
+//////////////////////////////
// =======================================================================================
-// Declare events
+// Event table and class
BEGIN_EVENT_TABLE(CDebugger,wxDialog)
EVT_CLOSE(CDebugger::OnClose) // on close event
@@ -69,8 +74,6 @@ BEGIN_EVENT_TABLE(CDebugger,wxDialog)
//EVT_SCROLL(CDebugger::ScrollBlocks)
//EVT_SCROLLWIN(CDebugger::ScrollBlocks)
END_EVENT_TABLE()
-// =======================================================================================
-
CDebugger::CDebugger(wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &position, const wxSize& size, long style)
@@ -147,7 +150,50 @@ CDebugger::~CDebugger()
this->Save(file);
file.Save(DEBUGGER_CONFIG_FILE);
}
+// ====================
+
+// ========================================================================
+// System functions
+// --------------
+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);
+#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()
+{
+ 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
{
// TODO2: get the screen resolution and make limits from that
@@ -197,7 +243,12 @@ void CDebugger::Load(IniFile& _IniFile)
_IniFile.Get("SoundWindow", "StoreMails", &StoreMails, m_gcwiiset->IsChecked(1));
m_gcwiiset->Check(1, StoreMails);
}
+// ===================
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// Create GUI controls
+// -------------
void CDebugger::CreateGUIControls()
{
SetTitle(wxT("Sound Debugging"));
@@ -517,39 +568,7 @@ SetTitle(wxT("Sound Debugging"));
NotifyUpdate();
// --------------------------------------------------------------------
}
-
-// ========================================================================
-// System functions
-// --------------
-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);
- CloseConsole(); // Take the console window with it
-}
-
-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();
-}
-// ===============
+/////////////////////////////
// =======================================================================================
@@ -663,11 +682,13 @@ void CDebugger::ShowHideConsole(wxCommandEvent& event)
}
void CDebugger::DoShowHideConsole()
-{
+{
+#ifdef _WIN32
if(m_options->IsChecked(3))
OpenConsole();
else
CloseConsole();
+#endif
}
// ==============
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/File.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/File.cpp
new file mode 100644
index 0000000000..eb3dca0c37
--- /dev/null
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/File.cpp
@@ -0,0 +1,117 @@
+// 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
+#include
+#include
+#include "Common.h"
+#ifdef _WIN32
+#include
+#endif
+
+#if defined(HAVE_WX) && HAVE_WX
+#include "../Debugger/Debugger.h"
+#include "../Debugger/File.h"
+extern CDebugger* m_frame;
+#endif
+
+// --------------------
+// On and off
+bool g_consoleEnable = true;
+//int gSaveFile = 0;
+#define DEBUG_HLE
+
+// --------------------
+// Create file handles
+#ifdef DEBUG_HLE
+ FILE* __fStdOut[nFiles];
+#endif
+
+
+// =======================================================================================
+/* Open file handles */
+// -------------
+void StartFile(int width, int height, char* fname)
+{
+#if defined(DEBUG_HLE) && defined(_WIN32)
+ 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
+}
+// ======================
+
+
+//////////////////////////////////////////////////////////////////////////////////////////
+/* Close the file handles */
+// -------------
+void CloseFile()
+{
+ // Close the file handles
+ for(int i = 0; i < nFiles; i++)
+ {
+ if(__fStdOut[i]) fclose(__fStdOut[i]);
+ }
+}
+//////////////////////////////
+
+
+// ---------------------------------------------------------------------------------------
+// File printf function
+// -------------
+int PrintFile(int a, char *fmt, ...)
+{
+#if defined(DEBUG_HLE) && defined(_WIN32)
+
+ if(m_frame->gSaveFile)
+ {
+ char s[StringSize];
+ va_list argptr;
+ int cnt;
+
+ va_start(argptr, fmt);
+ cnt = vsnprintf(s, StringSize, fmt, argptr);
+ 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
+}
+
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Mails.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Mails.cpp
index 0e34eab079..c274e08892 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Mails.cpp
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Mails.cpp
@@ -19,7 +19,10 @@
//
//////////////////////////////////////////////////////////////////////////////////////////
-// includes
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// Includes
+// -------------
#include
#include
#include
@@ -28,23 +31,31 @@
#include
#endif
+//#include "ConsoleWindow.h" // Open and close console
+
#include "Debugger.h"
#include "PBView.h"
#include "IniFile.h"
#include "FileUtil.h"
#include "StringUtil.h"
#include "FileSearch.h"
-#include "../Logging/Console.h" // open and close console
+///////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// Declarations and definitions
+// -------------
extern std::vector sMailLog, sMailTime;
extern CDebugger* m_frame;
+///////////////////////////////
+
// =======================================================================================
// Update mail window
// --------------
void CDebugger::DoUpdateMail()
{
- //wprintf("i %i %i\n", sFullMail.size(), sMailLog.size());
+ //Console::Print("i %i %i\n", sFullMail.size(), sMailLog.size());
if(sFullMail.size() > 0 && sMailLog.size() > 0)
{
@@ -69,7 +80,7 @@ void CDebugger::UpdateMail(wxNotebookEvent& event)
// Change mail from radio button change
void CDebugger::ChangeMail(wxCommandEvent& event)
{
- //wprintf("abc");
+ //Console::Print("abc");
DoUpdateMail();
//if(StoreMails) ReadDir();
}
@@ -120,7 +131,7 @@ void CDebugger::ReadDir()
else
cut = pieces[0];
- //wprintf("%s %s %s\n", pieces[0].c_str(), pieces[1].c_str(),
+ //Console::Print("%s %s %s\n", pieces[0].c_str(), pieces[1].c_str(),
// pieces[2].c_str(), pieces[3].c_str());
if (NoDuplicate(pieces[0]) && pieces.size() >= 3)
@@ -163,11 +174,11 @@ u32 CDebugger::CountFiles(std::string FileName)
for (u32 i = 0; i < all_all_files.size(); i++)
{
- //wprintf("CountFiles %i %s\n", i, all_all_files[i].c_str());
+ //Console::Print("CountFiles %i %s\n", i, all_all_files[i].c_str());
if(all_all_files[i] == FileName)
match++;
}
- //wprintf("We found %i files for this game\n", match);
+ //Console::Print("We found %i files for this game\n", match);
return match;
}
// ==============
@@ -219,13 +230,13 @@ void CDebugger::Readfile(std::string FileName, bool GC)
if(m_RadioBox[3]->IsItemEnabled(i)) curr_n++;
m_RadioBox[3]->Enable(i, false); // disable all
}
- //wprintf("Disabled all: n %i\n", n);
+ //Console::Print("Disabled all: n %i\n", n);
for (u32 i = 0; i < n; i++)
{
m_RadioBox[3]->Enable(i, true); // then anble the right ones
- //wprintf("m_RadioBox[3] enabled: %i\n", i);
+ //Console::Print("m_RadioBox[3] enabled: %i\n", i);
std::string sz = "";
std::ostringstream ci;
@@ -233,7 +244,7 @@ void CDebugger::Readfile(std::string FileName, bool GC)
std::string f0 = FULL_MAIL_LOGS_DIR + FileName + "_sep" + ci.str() + "_sep" + "0_sep" + (GC ? "GC" : "Wii") + "_sep.log";
std::string f1 = FULL_MAIL_LOGS_DIR + FileName + "_sep" + ci.str() + "_sep" + "1_sep" + (GC ? "GC" : "Wii") + "_sep.log";
- //wprintf("ifstream %s %s\n", f0.c_str(), f1.c_str());
+ //Console::Print("ifstream %s %s\n", f0.c_str(), f1.c_str());
if(sFullMail.size() <= i) sFullMail.resize(sFullMail.size() + 1);
if(sMailLog.size() <= i) sMailLog.resize(sMailLog.size() + 1);
@@ -244,7 +255,7 @@ void CDebugger::Readfile(std::string FileName, bool GC)
else sMailLog.at(i) = "";
}
if(n < curr_n) m_RadioBox[3]->Select(n - 1);
- //wprintf("Select: %i | n %i curr_n %i\n", n - 1, n, curr_n);
+ //Console::Print("Select: %i | n %i curr_n %i\n", n - 1, n, curr_n);
DoUpdateMail();
}
// ==============
@@ -278,7 +289,7 @@ void CDebugger::OnGameChange(wxCommandEvent& event)
void CDebugger::MailSettings(wxCommandEvent& event)
{
//for (int i = 0; i < all_all_files.size(); ++i)
- //wprintf("s: %s \n", all_all_files.at(i).c_str());
+ //Console::Print("s: %s \n", all_all_files.at(i).c_str());
ScanMails = m_gcwiiset->IsChecked(0);
StoreMails = m_gcwiiset->IsChecked(1);
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Console.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Console.cpp
deleted file mode 100644
index 6188b75798..0000000000
--- a/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Console.cpp
+++ /dev/null
@@ -1,230 +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
-#include
-#include
-#include "Common.h"
-#ifdef _WIN32
-#include
-#endif
-
-#if defined(HAVE_WX) && HAVE_WX
-#include "../Debugger/Debugger.h"
-
-extern CDebugger* m_frame;
-#endif
-
-// --------------------
-// On and off
-bool g_consoleEnable = true;
-//int gSaveFile = 0;
-#define DEBUG_HLE
-
-
-// --------------------
-// Settings
-int nFiles = 4;
-
-
-// --------------------
-// Create handles
-
-#ifdef DEBUG_HLE
- FILE* __fStdOut[4]; // 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(DEBUG_HLE) && defined(_WIN32)
-
- AllocConsole();
-
- SetConsoleTitle(fname);
- __hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
-
- COORD co = {width,height};
- SetConsoleScreenBufferSize(__hStdOut, co);
-
- 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(DEBUG_HLE) && defined(_WIN32)
-
- if(m_frame->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
-}
-
-
-
-// ---------------------------------------------------------------------------------------
-// Printf to screen function
-int wprintf(const char *fmt, ...)
-{
-#if defined(DEBUG_HLE) && defined(_WIN32)
- char s[1024*20]; // Warning, mind this value
- va_list argptr;
- int cnt;
-
- va_start(argptr, fmt);
- cnt = vsnprintf(s, 1024*20, fmt, argptr);
- va_end(argptr);
-
- DWORD cCharsWritten;
-
- // ---------------------------------------------------------------------------------------
- if(__hStdOut)
- {
- WriteConsole(__hStdOut, s, strlen(s), &cCharsWritten, NULL);
- }
- // -------------
-
- return(cnt);
-#else
- return 0;
-#endif
-}
-
-
-// ---------------------------------------------------------------------------------------
-// Clear console screen
-void ClearScreen()
-{
-#if defined(DEBUG_HLE) && 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
-}
-
-
-// ---------------------------------------------------------------------------------------
-// Get window handle of console window to be able to resize it
-#if defined(DEBUG_HLE) && 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
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Console.h b/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Console.h
deleted file mode 100644
index c28d4ed04c..0000000000
--- a/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Console.h
+++ /dev/null
@@ -1,28 +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 wprintf(const char *fmt, ...);
-int aprintf(int a, char *fmt, ...);
-void ClearScreen();
-void OpenConsole();
-void CloseConsole();
-
-#ifdef _WIN32
- HWND GetConsoleHwnd(void);
-#endif
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Logging.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Logging.cpp
deleted file mode 100644
index 54ecd3c718..0000000000
--- a/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Logging.cpp
+++ /dev/null
@@ -1,943 +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/
-//
-//////////////////////////////////////////////////////////////////////////////////////////
-
-
-
-// Includes
-
-#include
-#include
-#include // so that we can test std::string == abc
-#include // for the pow() function
-#ifdef _WIN32
- #include
-#endif
-
-#include "StringUtil.h"
-
-#include "../Debugger/Debugger.h"
-#include "../Debugger/PBView.h"
-#include "Console.h" // open and close console, clear console window
-
-#include "../Globals.h"
-#include "../UCodes/UCodes.h"
-#include "../UCodes/UCode_AXStructs.h"
-#include "../UCodes/UCode_AX.h"
-#include "../UCodes/UCode_AXWii.h"
-#include "../UCodes/UCode_AX_Voice.h"
-
-// Externals
-extern int nFiles;
-extern CDebugger* m_frame;
-//int PBSize = 128;
-
-// Parameter blocks
-
- std::vector mem(NUMBER_OF_PBS); // mem1 or mem2
- std::vector gloopPos(NUMBER_OF_PBS);
- std::vector gsampleEnd(NUMBER_OF_PBS);
- std::vector gsamplePos(NUMBER_OF_PBS);
-
-// main
- std::vector running(NUMBER_OF_PBS, 0);
- std::vector gsrc_type(NUMBER_OF_PBS);
- std::vector gis_stream(NUMBER_OF_PBS);
-
-// PBSampleRateConverter src
- std::vector gratio(NUMBER_OF_PBS);
- std::vector gratiohi(NUMBER_OF_PBS);
- std::vector gratiolo(NUMBER_OF_PBS);
- std::vector gfrac(NUMBER_OF_PBS);
- std::vector gcoef(NUMBER_OF_PBS);
-
-// PBSampleRateConverter mixer
- std::vector gvolume_left(NUMBER_OF_PBS);
- std::vector gmix_unknown(NUMBER_OF_PBS);
- std::vector gvolume_right(NUMBER_OF_PBS);
- std::vector gmix_unknown2(NUMBER_OF_PBS);
- std::vector gmixer_control(NUMBER_OF_PBS);
- std::vector gmixer_control_wii(NUMBER_OF_PBS);
-
- std::vector gmixer_vol1(NUMBER_OF_PBS);
- std::vector gmixer_vol2(NUMBER_OF_PBS);
- std::vector gmixer_vol3(NUMBER_OF_PBS);
- std::vector gmixer_vol4(NUMBER_OF_PBS);
- std::vector gmixer_vol5(NUMBER_OF_PBS);
- std::vector gmixer_vol6(NUMBER_OF_PBS);
- std::vector gmixer_vol7(NUMBER_OF_PBS);
-
- std::vector gmixer_d1(NUMBER_OF_PBS);
- std::vector gmixer_d2(NUMBER_OF_PBS);
- std::vector gmixer_d3(NUMBER_OF_PBS);
- std::vector gmixer_d4(NUMBER_OF_PBS);
- std::vector gmixer_d5(NUMBER_OF_PBS);
- std::vector gmixer_d6(NUMBER_OF_PBS);
- std::vector gmixer_d7(NUMBER_OF_PBS);
-
-// PBVolumeEnvelope vol_env
- std::vector gcur_volume(NUMBER_OF_PBS);
- std::vector gcur_volume_delta(NUMBER_OF_PBS);
-
-// PBAudioAddr audio_addr (incl looping)
- std::vector gaudioFormat(NUMBER_OF_PBS);
- std::vector glooping(NUMBER_OF_PBS);
- std::vector gloop1(NUMBER_OF_PBS);
- std::vector gloop2(NUMBER_OF_PBS);
- std::vector gloop3(NUMBER_OF_PBS);
-
-// PBADPCMInfo adpcm
- std::vector gadloop1(NUMBER_OF_PBS);
- std::vector gadloop2(NUMBER_OF_PBS);
- std::vector gadloop3(NUMBER_OF_PBS);
-
-// updates
- std::vector gupdates1(NUMBER_OF_PBS);
- std::vector gupdates2(NUMBER_OF_PBS);
- std::vector gupdates3(NUMBER_OF_PBS);
- std::vector gupdates4(NUMBER_OF_PBS);
- std::vector gupdates5(NUMBER_OF_PBS);
- std::vector gupdates_addr(NUMBER_OF_PBS);
- std::vector gupdates_data(NUMBER_OF_PBS);
- std::vector gupdates_data1(NUMBER_OF_PBS);
- std::vector gupdates_data2(NUMBER_OF_PBS);
- std::vector gupdates_data3(NUMBER_OF_PBS);
- std::vector gupdates_data4(NUMBER_OF_PBS);
-
-// Counters
-
-int count1 = 0;
-int count2 = 0;
-int iupd = 0;
-bool iupdonce = false;
-std::vector viupd(15); // the length of the update frequency bar
-int vectorLengthGUI = 8; // length of playback history bar for the GUI version
-int vectorLength = 15; // for console version
-int vectorLength2 = 100; // for console version, how long to show
-
-// More stuff
-
-// should we worry about the additonal memory these lists require? bool will allocate
-// very little memory
-std::vector< std::vector > vector1(NUMBER_OF_PBS, std::vector(vectorLength, false));
-std::vector< std::vector > vector2(NUMBER_OF_PBS, std::vector(vectorLength2, false));
-std::vector numberRunning(NUMBER_OF_PBS);
-
-
-// Classes
-
-extern CDebugger* m_frame;
-
-
-
-// =======================================================================================
-// Write title
-// --------------
-std::string writeTitle(int a, bool Wii)
-{
- std::string b;
- if(a == 0)
- {
- if(m_frame->bShowBase) // show base 10
- {
- b = " adpcm adpcm_loop\n";
- b = b + " Nr m pos / end lpos | voll volr | isl iss | pre yn1 yn2 pre yn1 yn2 | frac ratio[hi lo]\n";
- }
- else
- {
- b = " adpcm adpcm_loop\n";
- b = b + " Nr pos / end lpos | voll volr | isl iss | pre yn1 yn2 pre yn1 yn2 | frac rati[hi lo ]\n";
- }
- }
- else if(a == 1)
- {
- if(m_frame->bShowBase) // show base 10
- {
- b = " Nr pos / end lpos | voll volr | src form coef | 1 2 3 4 5 addr value\n";
- }
- else
- {
- b = " Nr pos / end lpos | voll volr | src form coef | 1 2 3 4 5 addr value\n";
- }
- }
- else if(a == 2)
- {
- if(m_frame->bShowBase) // show base 10
- {
- b = " Nr pos / end lpos | voll volr | isl iss | e-l e-s\n";
- }
- else
- {
- b = " Nr pos / end lpos | voll volr | isl iss | e-l e-s\n";
- }
- }
- else if(a == 3)
- {
- if(m_frame->bShowBase) // show base 10
- {
- if(Wii)
- b = " Nr voll volr dl dr curv delt mixc r | v1 v2 v3 v4 v5 v6 v7 | d1 d2 d3 d4 d5 d6 d7\n";
- else
- b = " Nr voll volr dl dr curv delt mixc r | v1 v2 v3 v4 v5 v6 v7 | d1 d2 d3 d4 d5 d6 d7\n";
- }
- else
- {
- if(Wii)
- b = " Nr voll volr dl dr curv delt mixc r | v1 v2 v3 v4 v5 v6 v7 | d1 d2 d3 d4 d5 d6 d7\n";
- else
- b = " Nr voll volr dl dr curv delt mixc r | v1 v2 v3 v4 v5 v6 v7 | d1 d2 d3 d4 d5 d6 d7\n";
- }
- }
- return b;
-}
-// =======================================================================================
-
-
-
-// =======================================================================================
-// Write main message (presets)
-// --------------
-std::string writeMessage(int a, int i, bool Wii)
-{
- char buf [1000] = "";
- std::string sbuf;
- // =======================================================================================
- // PRESETS
- // ---------------------------------------------------------------------------------------
- /*
- PRESET 0
- " Nr m pos / end lpos | voll volr | isl iss | pre yn1 yn2 pre yn1 yn2 | frac ratio[hi lo]\n";
- "---------------|00 1 12,341,234/134,123,412 12341234 | 00,000 00,000 | 0 0 | 000 00000 00000 000 00000 00000 | 00000 00000[0 00000]
-
- " Nr pos / end lpos | voll volr | isl iss | pre yn1 yn2 pre yn1 yn2 | frac rati[hi lo ]\n";
- "---------------|00 12,341,234/134,123,412 12341234 | 00,000 00,000 | 0 0 | 000 0000 0000 000 0000 0000 | 0000 0000[0 00000]
-
- PRESET 1 (updates)
- " Nr pos / end lpos | voll volr | src form coef | 1 2 3 4 5 addr value\n";
- "---------------|00 12,341,234/12,341,234 12341234 | 00,000 00,000 | 0 0 0 | 0 0 0 0 0 80808080 80808080
-
- PRESET 2
- " Nr pos / end lpos | voll volr | isl iss | e-l e-s\n";
- "---------------|00 12,341,234/12341234 12,341,234 | 00000 00000 | 0 0 | 00,000,000 00,000,000
- */
- if(a == 0)
- {
- if(m_frame->bShowBase) // base 10 (decimal)
- {
- if(Wii) // Wii
- {
- sprintf(buf,"%c%02i %i %10s/%10s %10s | %6s %6s | %i %i | %03i %05i %05i %03i %05i %05i | %05i %05i[%i %05i]",
- 223, i, mem[i], ThS(gsamplePos[i],true).c_str(), ThS(gsampleEnd[i],true).c_str(), ThS(gloopPos[i],true).c_str(),
- ThS(gvolume_left[i]).c_str(), ThS(gvolume_right[i]).c_str(),
- glooping[i], gis_stream[i],
- gadloop1[i], gadloop2[i], gadloop3[i], gloop1[i], gloop2[i], gloop3[i],
- gfrac[i], gratio[i], gratiohi[i], gratiolo[i]
- );
- }
- else // GC
- {
- sprintf(buf,"%c%02i %10s/%10s %10s | %6s %6s | %i %i | %03i %05i %05i %03i %05i %05i | %05i %05i[%i %05i]",
- 223, i, ThS(gsamplePos[i],true).c_str(), ThS(gsampleEnd[i],true).c_str(), ThS(gloopPos[i],true).c_str(),
- ThS(gvolume_left[i]).c_str(), ThS(gvolume_right[i]).c_str(),
- glooping[i], gis_stream[i],
- gadloop1[i], gadloop2[i], gadloop3[i], gloop1[i], gloop2[i], gloop3[i],
- gfrac[i], gratio[i], gratiohi[i], gratiolo[i]
- );
- }
- }
- else
- {
- sprintf(buf,"%c%02i %08x/%08x %08x | %04x %04x | %i %i | %02x %04x %04x %02x %04x %04x | %04x %04x[%i %04x]",
- 223, i, gsamplePos[i], gsampleEnd[i], gloopPos[i],
- gvolume_left[i], gvolume_right[i],
- glooping[i], gis_stream[i],
- gadloop1[i], gadloop2[i], gadloop3[i], gloop1[i], gloop2[i], gloop3[i],
- gfrac[i], gratio[i], gratiohi[i], gratiolo[i]
- );
- }
- }
- else if(a == 1)
- {
- if(m_frame->bShowBase) // base 10 (decimal)
- {
- sprintf(buf,"%c%02i %10s/%10s %10s | %6s %6s | %u %u %u | %u %u %u %u %u %08x %08x %08x %08x %08x %08x",
- 223, i, ThS(gsamplePos[i]).c_str(), ThS(gsampleEnd[i]).c_str(), ThS(gloopPos[i]).c_str(),
- ThS(gvolume_left[i]).c_str(), ThS(gvolume_right[i]).c_str(),
- gsrc_type[i], gaudioFormat[i], gcoef[i],
- gupdates1[i], gupdates2[i], gupdates3[i], gupdates4[i], gupdates5[i], gupdates_addr[i],
- gupdates_data[i], gupdates_data1[i], gupdates_data2[i], gupdates_data3[i], gupdates_data4[i]
- );
- }
- else // base 16 (hexadecimal)
- {
- if(Wii) // Wii
- {
- sprintf(buf,"%c%02i %08x/%08x %08x | %04x %04x | %u %u %u | %u %u %u %08x %08x %08x %08x %08x %08x",
- 223, i, gsamplePos[i], gsampleEnd[i], gloopPos[i],
- gvolume_left[i], gvolume_right[i],
- gsrc_type[i], gaudioFormat[i], gcoef[i],
- gupdates1[i], gupdates2[i], gupdates3[i], gupdates_addr[i],
- gupdates_data[i], gupdates_data1[i], gupdates_data2[i], gupdates_data3[i], gupdates_data4[i]
- );
- }
- else // GC
- {
- sprintf(buf,"%c%02i %08x/%08x %08x | %04x %04x | %u %u %u | %u %u %u %u %u %08x %08x %08x %08x %08x %08x",
- 223, i, gsamplePos[i], gsampleEnd[i], gloopPos[i],
- gvolume_left[i], gvolume_right[i],
- gsrc_type[i], gaudioFormat[i], gcoef[i],
- gupdates1[i], gupdates2[i], gupdates3[i], gupdates4[i], gupdates5[i], gupdates_addr[i],
- gupdates_data[i], gupdates_data1[i], gupdates_data2[i], gupdates_data3[i], gupdates_data4[i]
- );
- }
- }
- }
- else if(a == 2)
- {
- if(m_frame->bShowBase)
- {
- sprintf(buf,"%c%02i %10s/%10s %10s | %05i %05i | %i %i | %10s %10s",
- 223, i, ThS(gsamplePos[i]).c_str(), ThS(gsampleEnd[i]).c_str(), ThS(gloopPos[i]).c_str(),
- gvolume_left[i], gvolume_right[i],
- glooping[i], gis_stream[i],
- ThS(gsampleEnd[i] - gloopPos[i], false).c_str(), ThS(gsampleEnd[i] - gsamplePos[i], false).c_str()
- );
- }
- else
- {
- sprintf(buf,"%c%02i %08x/%08x %08x | %04x %04x | %i %i | %08x %08x",
- 223, i, gsamplePos[i], gsampleEnd[i], gloopPos[i],
- gvolume_left[i], gvolume_right[i],
- glooping[i], gis_stream[i],
- gsampleEnd[i] - gloopPos[i], gsampleEnd[i] - gsamplePos[i]
- );
- }
- }
- /*
- PRESET 3
- " Nr voll volr dl dr curv delt mixc r | v1 v2 v3 v4 v5 v6 v7 | d1 d2 d3 d4 d5 d6 d7\n";
- "---------------|00 00000 00000 00000 00000 00000 00000 00000 0 | 00000 00000 00000 00000 00000 00000 00000 | 00000 00000 00000 00000 00000 00000 00000
- */
- else if(a == 3)
- {
- if(m_frame->bShowBase)
- {
- if(Wii) // Wii
- {
- sprintf(buf,"%c%02i %05i %05i %05i %05i %05i %05i %05i %i | %05i %05i %05i %05i %05i %05i %05i | %05i %05i %05i %05i %05i %05i %05i",
- 223, i,
- gvolume_left[i], gvolume_right[i], gmix_unknown[i], gmix_unknown2[i], gcur_volume[i], gcur_volume_delta[i],
- gmixer_control_wii[i], (gmixer_control_wii[i] & MIXCONTROL_RAMPING),
- gmixer_vol1[i], gmixer_vol2[i], gmixer_vol3[i], gmixer_vol4[i], gmixer_vol5[i],
- gmixer_vol6[i], gmixer_vol7[i],
- gmixer_d1[i], gmixer_d2[i], gmixer_d3[i], gmixer_d4[i], gmixer_d5[i],
- gmixer_d6[i], gmixer_d7[i]
- );
- }
- else // GC
- {
- sprintf(buf,"%c%02i %05i %05i %05i %05i %05i %05i %08i %i | %05i %05i %05i %05i %05i %05i %05i | %05i %05i %05i %05i %05i %05i %05i",
- 223, i,
- gvolume_left[i], gvolume_right[i], gmix_unknown[i], gmix_unknown2[i], gcur_volume[i], gcur_volume_delta[i],
- gmixer_control[i], (gmixer_control[i] & MIXCONTROL_RAMPING),
- gmixer_vol1[i], gmixer_vol2[i], gmixer_vol3[i], gmixer_vol4[i], gmixer_vol5[i],
- gmixer_vol6[i], gmixer_vol7[i],
- gmixer_d1[i], gmixer_d2[i], gmixer_d3[i], gmixer_d4[i], gmixer_d5[i],
- gmixer_d6[i], gmixer_d7[i]
- );
- }
- }
- else
- {
- if(Wii)
- {
- sprintf(buf,"%c%02i %04x %04x %04x %04x %04x %04x %08x %i | %04x %04x %04x %04x %04x %04x %04x | %04x %04x %04x %04x %04x %04x %04x",
- 223, i,
- gvolume_left[i], gvolume_right[i], gmix_unknown[i], gmix_unknown2[i], gcur_volume[i], gcur_volume_delta[i],
- gmixer_control_wii[i], (gmixer_control_wii[i] & MIXCONTROL_RAMPING),
- gmixer_vol1[i], gmixer_vol2[i], gmixer_vol3[i], gmixer_vol4[i], gmixer_vol5[i],
- gmixer_vol6[i], gmixer_vol7[i],
- gmixer_d1[i], gmixer_d2[i], gmixer_d3[i], gmixer_d4[i], gmixer_d5[i],
- gmixer_d6[i], gmixer_d7[i]
- );
- }
- else
- {
- sprintf(buf,"%c%02i %04x %04x %04x %04x %04x %04x %04x %i | %04x %04x %04x %04x %04x %04x %04x | %04x %04x %04x %04x %04x %04x %04x",
- 223, i,
- gvolume_left[i], gvolume_right[i], gmix_unknown[i], gmix_unknown2[i], gcur_volume[i], gcur_volume_delta[i],
- gmixer_control[i], (gmixer_control[i] & MIXCONTROL_RAMPING),
- gmixer_vol1[i], gmixer_vol2[i], gmixer_vol3[i], gmixer_vol4[i], gmixer_vol5[i],
- gmixer_vol6[i], gmixer_vol7[i],
- gmixer_d1[i], gmixer_d2[i], gmixer_d3[i], gmixer_d4[i], gmixer_d5[i],
- gmixer_d6[i], gmixer_d7[i]
- );
- }
- }
- }
- sbuf = buf;
- return sbuf;
-}
-
-
-// ================
-
-
-// =======================================================================================
-// Collect parameters from Wii or GC
-// --------------
-/*
-std::string ShowAllPB(int a, int i)
-{
- if(a == 0)
- {
-
- }
- else if(a == 1)
- {
-
-
- }
- else if(a == 1)
- {
-
- }
- else if(a == 1)
-
-}
-*/
-// ================
-
-
-// =======================================================================================
-// Collect parameters from Wii or GC
-// --------------
-
-//inline void MixAddVoice(ParamBlockType &pb
-//void CollectPB(bool Wii, int i, AXParamBlockWii * PBw, ParamBlockType &pb)
-template void CollectPB(bool Wii, int i, ParamBlockType &PBs)
-//void CollectPB(bool Wii, int i, AXParamBlockWii * PBw, AXParamBlock * PBs)
-{
- // AXPB base
- gsrc_type[i] = PBs[i].src_type;
- gcoef[i] = PBs[i].coef_select;
- if(Wii) gmixer_control_wii[i] = PBs[i].mixer_control;
- else gmixer_control[i] = PBs[i].mixer_control;
-
- //running[i] = PBs[i].running;
- gis_stream[i] = PBs[i].is_stream;
-
- // mixer (some differences)
- gvolume_left[i] = PBs[i].mixer.volume_left;
- gvolume_right[i] = PBs[i].mixer.volume_right;
-
- gmix_unknown[i] = PBs[i].mixer.unknown;
- gmix_unknown2[i] = PBs[i].mixer.unknown2;
-
- gcur_volume[i] = PBs[i].vol_env.cur_volume;
- gcur_volume_delta[i] = PBs[i].vol_env.cur_volume_delta;
-
- gmixer_vol1[i] = PBs[i].mixer.unknown3[0];
- gmixer_vol2[i] = PBs[i].mixer.unknown3[2];
- gmixer_vol3[i] = PBs[i].mixer.unknown3[4];
- gmixer_vol4[i] = PBs[i].mixer.unknown3[6];
- gmixer_vol5[i] = PBs[i].mixer.unknown3[0];
- gmixer_vol6[i] = PBs[i].mixer.unknown3[2];
- gmixer_vol7[i] = PBs[i].mixer.unknown3[4];
-
- gmixer_d1[i] = PBs[i].mixer.unknown4[1];
- gmixer_d2[i] = PBs[i].mixer.unknown4[3];
- gmixer_d3[i] = PBs[i].mixer.unknown4[5];
- gmixer_d4[i] = PBs[i].mixer.unknown4[7];
- gmixer_d5[i] = PBs[i].mixer.unknown4[1];
- gmixer_d6[i] = PBs[i].mixer.unknown4[3];
- gmixer_d7[i] = PBs[i].mixer.unknown4[5];
-
- // PBAudioAddr audio_addr
- glooping[i] = PBs[i].audio_addr.looping;
- gaudioFormat[i] = PBs[i].audio_addr.sample_format;
- gloopPos[i] = (PBs[i].audio_addr.loop_addr_hi << 16) | PBs[i].audio_addr.loop_addr_lo;
- gsampleEnd[i] = (PBs[i].audio_addr.end_addr_hi << 16) | PBs[i].audio_addr.end_addr_lo;
- gsamplePos[i] = (PBs[i].audio_addr.cur_addr_hi << 16) | PBs[i].audio_addr.cur_addr_lo;
-
- if(gloopPos[i] > 0x20000000) gloopPos[i] -= 0x20000000;
- if(gsampleEnd[i] > 0x20000000) gsampleEnd[i] -= 0x20000000;
- if(gsamplePos[i] > 0x20000000) { gsamplePos[i] -= 0x20000000;
- mem[i] = 2;} else { mem[i] = 1; }
-
- // PBADPCMLoopInfo adpcm_loop_info (same in GC and Wii)
- gadloop1[i] = PBs[i].adpcm.pred_scale;
- gadloop2[i] = PBs[i].adpcm.yn1;
- gadloop3[i] = PBs[i].adpcm.yn2;
-
- gloop1[i] = PBs[i].adpcm_loop_info.pred_scale;
- gloop2[i] = PBs[i].adpcm_loop_info.yn1;
- gloop3[i] = PBs[i].adpcm_loop_info.yn2;
-
- // updates (differences)
- gupdates1[i] = PBs[i].updates.num_updates[0];
- gupdates2[i] = PBs[i].updates.num_updates[1];
- gupdates3[i] = PBs[i].updates.num_updates[2];
- gupdates4[i] = PBs[i].updates.num_updates[3];
- gupdates5[i] = PBs[i].updates.num_updates[4];
-
- gupdates_addr[i] = (PBs[i].updates.data_hi << 16) | PBs[i].updates.data_lo;
- if(gupdates_addr[i] > 0x80000000 && gupdates_addr[i] < 0x93ffffff)
- {
- gupdates_data[i] = Memory_Read_U32(gupdates_addr[i]);
- gupdates_data1[i] = Memory_Read_U32(gupdates_addr[i] + 4);
- gupdates_data2[i] = Memory_Read_U32(gupdates_addr[i] + 8);
- gupdates_data3[i] = Memory_Read_U32(gupdates_addr[i] + 12);
- gupdates_data3[i] = Memory_Read_U32(gupdates_addr[i] + 16);
- }
-
- // PBSampleRateConverter src
-
- gratio[i] = (u32)(((PBs[i].src.ratio_hi << 16) + PBs[i].src.ratio_lo) * ratioFactor);
- gratiohi[i] = PBs[i].src.ratio_hi;
- gratiolo[i] = PBs[i].src.ratio_lo;
- gfrac[i] = PBs[i].src.cur_addr_frac;
-}
-// ===============
-
-
-
-// =======================================================================================
-// Prepare the condition that makes us show a certain block
-// --------------
-template
-bool PrepareConditions(bool Wii, int i, ParamBlockType &PBs)
-{
- bool Conditions;
-
- if (m_frame->gOnlyLooping) // show only looping blocks
- {
- Conditions = PBs[i].audio_addr.looping ? true : false;
- }
- else if (m_frame->gShowAll) // show all blocks
- {
- Conditions = true;
- }
- else if (m_frame->giShowAll > -1) // show all blocks
- {
- if (m_frame->giShowAll == 0)
- Conditions = (i < 31);
- else if(m_frame->giShowAll == 1)
- Conditions = (i > 30 && i < 61);
- else if(m_frame->giShowAll == 2)
- Conditions = (i > 60 && i < 91);
- else if(m_frame->giShowAll == 3)
- Conditions = (i > 90 && i < 121);
- }
- else // show only the ones that have recently been running
- {
- Conditions = (numberRunning.at(i) > 0 || PBs[i].audio_addr.looping);
- }
-
- return Conditions;
-}
-// ===============
-
-
-
-template
-void Logging_(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs,
- int numberOfPBs, u32 m_addressPBs)
-//void Logging__(short* _pBuffer, int _iSize, int a, bool Wii)
-{
- bool Conditions; // Select blocks to show
-
- // =======================================================================================
- // Update parameter values
- // --------------
- // We could chose to update these only if a block is currently running. Later I'll add options
- // to see both the current and the latest active value.
- int irun = 0;
- for (int i = 0; i < numberOfPBs; i++)
- {
- // --------------------------------------------------------------------
- // Write a line for the text log if nothing is playing
- // --------------
- if (PBs[i].running)
- {
- irun++;
- }
-
- if (i == numberOfPBs - 1 && irun == 0)
- {
- for (int j = 0; j < nFiles; j++)
- {
- std::string sfbuff;
- sfbuff = "-----\n";
- aprintf(j, (char *)sfbuff.c_str());
- }
- }
- // --------------
-
-
- // --------------------------------------
- // Now go through only a subset of the blocks depending on Conditions
- // ------------------
- /* Prepare conditions. We may for example get Conditions = true for blocks
- that currently have numberRunning.at(i) > 0 */
- Conditions = PrepareConditions(Wii, i, PBs);
- if (Conditions)
- {
- // Collect parameters
- CollectPB(Wii, i, PBs);
-
- // ---------------------------------------------------------------------------------------
- // Write to file
- // --------------
- for (int ii = 0; ii < nFiles; ii++)
- {
- std::string sfbuff;
- if(a == 0) sfbuff = "***"; // note if it's before or after an update (*** = before)
- else sfbuff = " ";
-
- // write running
- char cbuf[10];
- sprintf(cbuf, "%i", PBs[i].running);
- sfbuff = sfbuff + cbuf;
-
- sfbuff = sfbuff + writeMessage(ii, i, Wii);
-
- // write _iSize
- strcpy(cbuf, ""); sprintf(cbuf, "%i", _iSize);
- sfbuff = sfbuff + " | _iSize: " + cbuf + "\n";
-
- aprintf(ii, (char *)sfbuff.c_str());
- }
- // --------------
- }
- }
- // ==============
-
-
- // =======================================================================================
- // Control how often the screen is updated, and then update the screen
- // --------------
- if(a == 0) count1++; // a == 0 when Logging is called before the blocks are updated
- if (m_frame->gUpdFreq > 0 && count1 > (200/m_frame->gUpdFreq))
- {
-
- // =======================================================================================
- /* Save the displayed running history for each block. Vector1 is a vector1[NUMBER_OF_PBS]
- [100] vector. */
- // --------------
- /*
- Move all items back like this:
- 1 to 0
- 2 1
- 3 ...
- 5 to 4
- */
- for (int i = 0; i < numberOfPBs; i++)
- {
- for (int j = 1; j < vectorLength; j++)
- {
- vector1.at(i).at(j-1) = vector1.at(i).at(j);
- }
- // save the latest value
- vector1.at(i).at(vectorLength-1) = PBs[i].running ? true : false;
- }
- // ==============
-
-
- // =======================================================================================
- /* Have a separate set for which ones to show. Currently show blocks that have been
- running at least once the last 100 updates.
- // --------------
-
- Move all items back like this:
- 1 to 0
- 2 1
- 3 ...
- */
- for (int i = 0; i < numberOfPBs; i++)
- {
- for (int j = 1; j < vectorLength2; j++)
- {
- vector2.at(i).at(j-1) = vector2.at(i).at(j);
- }
- // save the latest value
- vector2.at(i).at(vectorLength2-1) = PBs[i].running ? true : false;
- }
- // ==============
-
-
- // =======================================================================================
- // Count how many we have running now in a certain block
- // --------------
- int jj = 0;
- for (int i = 0; i < numberOfPBs; i++)
- {
- jj = 0;
- for (int j = 0; j < vectorLength2-1; j++) // the hundred last updates
- {
- if (vector2.at(i).at(j)) // if it was on then
- {
- jj++;
- }
- numberRunning.at(i) = jj;
- }
- }
- // ==============
-
-
- // =======================================================================================
- // Write header
- // --------------
- char buffer [1000] = "";
- std::string sbuff;
- sbuff = writeTitle(m_frame->gPreset, Wii);
- // ==============
-
-
- // =======================================================================================
- // Now go through all blocks
- // --------------
- for (int i = 0; i < numberOfPBs; i++)
- {
-
-
- // --------------------------------------
- // Now go through only a subset of the blocks depending on Conditions
- // ------------------
- // Prepare conditions
- Conditions = PrepareConditions(Wii, i, PBs);
- if (Conditions)
- {
- // --------------------------------------
- // Save playback history text string for the console and GUI debugger
- // ------------------
- if(m_frame)
- {
- std::string guipr; // gui progress
-
- for (int j = 0; j < vectorLengthGUI; j++)
- {
- if(vector1.at(i).at(j) == false)
- {
- guipr = guipr + "0";
- }
- else
- {
- guipr = guipr + "1";
- }
- }
-
- u32 run = atoi( guipr.c_str());
- m_frame->m_GPRListView->m_CachedRegs[1][i] = run;
- guipr.clear();
- }
-
- // and for the console debugger
- for (int j = 0; j < vectorLength; j++)
- {
- if(vector1.at(i).at(j) == false)
- {
- sbuff = sbuff + " ";
- }
- else
- {
- sprintf(buffer, "%c", 177);
- sbuff = sbuff + buffer; strcpy(buffer, "");
- }
- }
- // ---------
-
-
- // Hopefully this is false if we don't have a debugging window and so it doesn't cause a crash
- if(m_frame)
- {
- m_frame->m_GPRListView->m_CachedRegs[2][i] = gsamplePos[i];
- m_frame->m_GPRListView->m_CachedRegs[3][i] = gsampleEnd[i];
- m_frame->m_GPRListView->m_CachedRegs[4][i] = gloopPos[i];
-
- m_frame->m_GPRListView->m_CachedRegs[5][i] = gvolume_left[i];
- m_frame->m_GPRListView->m_CachedRegs[6][i] = gvolume_right[i];
-
- m_frame->m_GPRListView->m_CachedRegs[7][i] = glooping[i];
- m_frame->m_GPRListView->m_CachedRegs[8][i] = gloop1[i];
- m_frame->m_GPRListView->m_CachedRegs[9][i] = gloop2[i];
- m_frame->m_GPRListView->m_CachedRegs[10][i] = gloop3[i];
-
- m_frame->m_GPRListView->m_CachedRegs[11][i] = gis_stream[i];
-
- m_frame->m_GPRListView->m_CachedRegs[12][i] = gaudioFormat[i];
- m_frame->m_GPRListView->m_CachedRegs[13][i] = gsrc_type[i];
- m_frame->m_GPRListView->m_CachedRegs[14][i] = gcoef[i];
-
- m_frame->m_GPRListView->m_CachedRegs[15][i] = gfrac[i];
-
- m_frame->m_GPRListView->m_CachedRegs[16][i] = gratio[i];
- m_frame->m_GPRListView->m_CachedRegs[17][i] = gratiohi[i];
- m_frame->m_GPRListView->m_CachedRegs[18][i] = gratiolo[i];
-
- m_frame->m_GPRListView->m_CachedRegs[19][i] = gupdates1[i];
- m_frame->m_GPRListView->m_CachedRegs[20][i] = gupdates2[i];
- m_frame->m_GPRListView->m_CachedRegs[21][i] = gupdates3[i];
- m_frame->m_GPRListView->m_CachedRegs[22][i] = gupdates4[i];
- m_frame->m_GPRListView->m_CachedRegs[23][i] = gupdates5[i];
- }
-
- // add new line
- sbuff = sbuff + writeMessage(m_frame->gPreset, i, Wii); strcpy(buffer, "");
- sbuff = sbuff + "\n";
-
- } // end of if(Conditions)
- // ==============
-
- } // end of for (int i = 0; i < numberOfPBs; i++)
-
-
- // =======================================================================================
- // Write global values
- // ---------------
- int nOfBlocks;
- int span = m_frame->gLastBlock - m_addressPBs;
- if(Wii)
- nOfBlocks = (m_frame->gLastBlock-m_addressPBs) / 256;
- else
- nOfBlocks = (m_frame->gLastBlock-m_addressPBs) / 192;
- sprintf(buffer, "\nThe parameter blocks span from %08x to %08x (%s bytes) impl. %i blocks | numberOfPBs %i | _iSize %i\n",
- m_addressPBs, m_frame->gLastBlock, ThS(span).c_str(), nOfBlocks, numberOfPBs, _iSize);
- sbuff = sbuff + buffer; strcpy(buffer, "");
- // ===============
-
-
- // =======================================================================================
- // Write settings
- // ---------------
- sprintf(buffer, "\nSettings: SSBM fix %i | SSBM rem1 %i | SSBM rem2 %i\nSequenced %i | Volume %i | Reset %i | Only looping %i | Save file %i\n",
- gSSBM, gSSBMremedy1, gSSBMremedy2, gSequenced,
- gVolume, gReset, m_frame->gOnlyLooping, m_frame->gSaveFile);
- sbuff = sbuff + buffer; strcpy(buffer, "");
- // ===============
-
-
- // =======================================================================================
- // Show update frequency
- // ---------------
- sbuff = sbuff + "\n";
- if(!iupdonce)
- {
- 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
- // ----------------
- ClearScreen();
- wprintf("%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();
- }
- */
-
- count2=0;
- count1=0;
-
- } // end of if (j>20)
-
-} // end of function
-
-
-// I placed this in CUCode_AX so it can share member values with that class
-void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a, bool Wii)
-{
- /* Doing all this may have a noticable CPU effect, so we can disable it completely
- this way. But remember that "Save to file" will not write anything then either. */
- if (m_frame->gUpdFreq > 0)
- {
- int version; // AX version
- int numberOfPBs;
-
- // Declare structures
- AXParamBlock PBs[NUMBER_OF_PBS];
- AXParamBlockWii PBw[NUMBER_OF_PBS];
- AXParamBlockWii_ PBw_[NUMBER_OF_PBS];
- if(_CRC == 0xfa450138) version = 0; else version = 1;
-
- // Read out structs and number of PBs that have data
- if(Wii)
- {
- if(version == 0)
- {
- numberOfPBs = ReadOutPBsWii(m_addressPBs, PBw, NUMBER_OF_PBS);
- Logging_(_pBuffer, _iSize, a, Wii, PBw, numberOfPBs, m_addressPBs);
- }
- else
- {
- numberOfPBs = ReadOutPBsWii(m_addressPBs, PBw_, NUMBER_OF_PBS);
- Logging_(_pBuffer, _iSize, a, Wii, PBw_, numberOfPBs, m_addressPBs);
- }
- }
- else
- {
- numberOfPBs = ReadOutPBs(m_addressPBs, PBs, NUMBER_OF_PBS);
- Logging_(_pBuffer, _iSize, a, Wii, PBs, numberOfPBs, m_addressPBs);
- }
- }
-}
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/PCHW/Mixer.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/PCHW/Mixer.cpp
index 4d36a3166a..803ae90d30 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/PCHW/Mixer.cpp
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/PCHW/Mixer.cpp
@@ -15,20 +15,29 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
-// This queue solution is temporary. I'll implement something more efficient later.
-#include
-#include "../Config.h"
+//////////////////////////////////////////////////////////////////////////////////////////
+// Includes
+// -------------
+// This queue solution is temporary. I'll implement something more efficient later.
+#include // System
+
+#include "Thread.h" // Common
+#include "ConsoleWindow.h"
+
+#include "../Config.h" // Local
#include "../Globals.h"
#include "../DSPHandler.h"
-#include "../Logging/Console.h"
-#include "Thread.h"
+#include "../Debugger/File.h"
+
#include "Mixer.h"
#include "FixedSizeQueue.h"
#ifdef _WIN32
#include "../PCHW/DSoundStream.h"
#endif
+///////////////////////
+
namespace {
Common::CriticalSection push_sync;
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/SConscript b/Source/Plugins/Plugin_DSP_HLE/Src/SConscript
index 8439ff39e7..7102508fc0 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/SConscript
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/SConscript
@@ -17,7 +17,7 @@ files = [
'Globals.cpp',
'PCHW/AOSoundStream.cpp',
'PCHW/Mixer.cpp',
- 'Logging/Console.cpp',
+ 'Debugger/File.cpp',
'UCodes/UCode_AX.cpp',
'UCodes/UCode_AXWii.cpp',
'UCodes/UCode_CARD.cpp',
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp
index 72052eee96..ab0741db17 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp
@@ -15,11 +15,11 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
-#include "FileUtil.h" // for IsDirectory
-#include "StringUtil.h" // for StringFromFormat
+#include "FileUtil.h" // For IsDirectory()
+#include "StringUtil.h" // For StringFromFormat()
#if defined(HAVE_WX) && HAVE_WX
#include "../Debugger/Debugger.h"
-#include "../Logging/Console.h" // for aprintf
+//#include "../Logging/File.h" // For PrintFile()
extern CDebugger* m_frame;
#endif
#include
@@ -119,7 +119,7 @@ if(m_frame->ScanMails)
{
if(saveNext && saveNext < 100) // limit because saveNext is not initialized
{
- //wprintf("End");
+ //Console::Print("End");
// Save the timestamps and comment
std::ostringstream ci;
@@ -217,7 +217,7 @@ if(m_frame->ScanMails)
// In case the mail didn't match any saved mail, save it
if(addnew == m_frame->sMail.size())
{
- //wprintf("%i | %i\n", addnew, m_frame->sMail.size());
+ //Console::Print("%i | %i\n", addnew, m_frame->sMail.size());
u32 resizeTo = m_frame->sMail.size() + 1;
// ------------------------------------
@@ -248,7 +248,7 @@ if(m_frame->ScanMails)
// Save as file
if(m_frame->StoreMails)
{
- //wprintf("m_frame->sMail.size(): %i | resizeTo:%i\n", m_frame->sMail.size(), resizeTo);
+ //Console::Print("m_frame->sMail.size(): %i | resizeTo:%i\n", m_frame->sMail.size(), resizeTo);
SaveLogFile(lMail, resizeTo, 0, Wii);
}
@@ -377,7 +377,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
if (on > 0 && off > 0) pDest[7] = 1;
}
- //aprintf(1, "%08x %04x %04x\n", updaddr, updpar, upddata);
+ //PrintFile(1, "%08x %04x %04x\n", updaddr, updpar, upddata);
// ------------
for (int i = 0; i < numberOfPBs; i++)
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.cpp
index caab7bec35..89e637886e 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.cpp
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.cpp
@@ -19,7 +19,7 @@
#if defined(HAVE_WX) && HAVE_WX
#include "../Debugger/Debugger.h"
-#include "../Logging/Console.h" // for aprintf
+//#include "../Logging/File.h" // For PrintFile
extern CDebugger * m_frame;
#endif
@@ -194,7 +194,7 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs)
if (on > 0 && off > 0) pDest[7] = 1;
}
- //aprintf(1, "%08x %04x %04x\n", updaddr, updpar, upddata);
+ //PrintFile(1, "%08x %04x %04x\n", updaddr, updpar, upddata);
// ------------
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp
index 91c7b397bf..a2f7d6b182 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp
@@ -15,32 +15,42 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// Includes
+// -------------
#include
-#include "Globals.h"
+#include "Globals.h" // Local
#if defined(HAVE_WX) && HAVE_WX
-#include "Logging/Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
-#include "Debugger/Debugger.h" // for the CDebugger class
-CDebugger* m_frame;
+ #include "Debugger/File.h" // For file logging
+ #include "Debugger/Debugger.h" // For the CDebugger class
+ CDebugger* m_frame;
#endif
+#include "ConsoleWindow.h" // Common: For the Windows console
#include "ChunkFile.h"
#include "WaveFile.h"
+
#include "resource.h"
-
#ifdef _WIN32
-#include "PCHW/DSoundStream.h"
-#include "ConfigDlg.h"
+ #include "PCHW/DSoundStream.h"
+ #include "ConfigDlg.h"
#else
-#include "PCHW/AOSoundStream.h"
+ #include "PCHW/AOSoundStream.h"
#endif
-
#include "PCHW/Mixer.h"
-
#include "DSPHandler.h"
#include "Config.h"
+
+///////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// Declarations and definitions
+// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
DSPInitialize g_dspInitialize;
u8* g_pMemory;
extern std::vector sMailLog, sMailTime;
@@ -50,6 +60,11 @@ std::string gpName;
static bool log_ai = false;
static WaveFileWriter g_wave_writer;
+
+
+// --------------------------------------
+// Mailbox utility
+// ----------
struct DSPState
{
u32 CPUMailbox;
@@ -69,14 +84,15 @@ struct DSPState
DSPMailbox_Read[1] = true;
}
};
-
DSPState g_dspState;
-// ====================
+// -------------------
+///////////////////////////////
-#if defined(HAVE_WX) && HAVE_WX
//////////////////////////////////////////////////////////////////////////////////////////
-// wxWidgets - Some kind of stuff wx needs
+// wxWidgets: Create the wxApp
+// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
+#if defined(HAVE_WX) && HAVE_WX
class wxDLLApp : public wxApp
{
bool OnInit()
@@ -87,9 +103,13 @@ class wxDLLApp : public wxApp
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
-///////////////////
#endif
+///////////////////
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// DllMain
+// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
#ifdef _WIN32
HINSTANCE g_hInstance = NULL;
@@ -126,6 +146,7 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
return(TRUE);
}
#endif
+///////////////////
// =======================================================================================
@@ -134,9 +155,9 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
void OpenConsole()
{
#if defined (_WIN32)
- startConsoleWin(155, 100, "Sound Debugging"); // give room for 100 rows
- wprintf("OpenConsole > Console opened\n");
- MoveWindow(GetConsoleHwnd(), 0,400, 1280,550, true); // move window, TODO: make this
+ Console::Open(155, 100, "Sound Debugging"); // give room for 100 rows
+ Console::Print("OpenConsole > Console opened\n");
+ MoveWindow(Console::GetHwnd(), 0,400, 1280,550, true); // move window, TODO: make this
// adjustable from the debugging window
#endif
}
@@ -150,6 +171,10 @@ void CloseConsole()
// ===================
+//////////////////////////////////////////////////////////////////////////////////////////
+// Exported fuctions
+// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
+
// =======================================================================================
// Create debugging window - We could use use wxWindow win; new CDebugger(win) like nJoy but I don't
// know why it would be better. - There's a lockup problem with ShowModal(), but Show() doesn't work
@@ -216,11 +241,11 @@ void Initialize(void *init)
gpName = g_dspInitialize.pName(); // save the game name globally
for (u32 i = 0; i < gpName.length(); ++i) // and fix it
{
- wprintf(L"%c", gpName[i]);
+ Console::Print(L"%c", gpName[i]);
std::cout << gpName[i];
if (gpName[i] == ':') gpName[i] = ' ';
}
- wprintf(L"\n");
+ Console::Print(L"\n");
#endif
CDSPHandler::CreateInstance();
@@ -269,7 +294,13 @@ void Shutdown()
void DoState(unsigned char **ptr, int mode) {
PointerWrap p(ptr, mode);
}
+///////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// Mailbox fuctions
+// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
unsigned short DSP_ReadMailboxHigh(bool _CPUMailbox)
{
if (_CPUMailbox)
@@ -334,7 +365,12 @@ void DSP_WriteMailboxLow(bool _CPUMailbox, unsigned short _Value)
PanicAlert("CPU can't write %08x to DSP mailbox", _Value);
}
}
+///////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// Other DSP fuctions
+// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
unsigned short DSP_WriteControlRegister(unsigned short _Value)
{
return CDSPHandler::GetInstance().WriteControlRegister(_Value);
@@ -369,3 +405,4 @@ void DSP_SendAIBuffer(unsigned int address, int sample_rate)
DSound::DSound_UpdateSound();
#endif
}
+///////////////////////////////
diff --git a/Source/Plugins/Plugin_DSP_LLE/Plugin_DSP_LLE.vcproj b/Source/Plugins/Plugin_DSP_LLE/Plugin_DSP_LLE.vcproj
index 201cbac0da..125ca31bf4 100644
--- a/Source/Plugins/Plugin_DSP_LLE/Plugin_DSP_LLE.vcproj
+++ b/Source/Plugins/Plugin_DSP_LLE/Plugin_DSP_LLE.vcproj
@@ -710,14 +710,6 @@
RelativePath=".\Src\Logging\AXTask.cpp"
>
-
-
-
-
diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/Logging/Console.cpp b/Source/Plugins/Plugin_DSP_LLE/Src/Logging/Console.cpp
deleted file mode 100644
index 7c174733d4..0000000000
--- a/Source/Plugins/Plugin_DSP_LLE/Src/Logging/Console.cpp
+++ /dev/null
@@ -1,197 +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/
-
-
-#ifdef _WIN32
-
-
-
-// =======================================================================================
-// Includes
-// --------------
-#include
-#include
-#include
-
-
-// ---------------------------------------------------------------------------------------
-// Defines and settings
-// --------------
-bool g_consoleEnable = true;
-#define DEBUGG
-//#define DEBUGG_FILEONLY
-//#define DEBUGG_NOFILE
-// ---------------------------------------------------------------------------------------
-
-
-// ---------------------------------------------------------------------------------------
-// Handles
-// --------------
-#ifdef DEBUGG
- FILE* __fStdOut = NULL;
-#endif
-#ifndef DEBUGG_FILEONLY
- HANDLE __hStdOut = NULL;
-#endif
-// ==============
-
-
-// =======================================================================================
-// Width and height is the size of console window, if you specify fname,
-// the output will also be writton to this file. The file pointer is automatically closed
-// when you close the app
-// --------------
-void startConsoleWin(int width, int height, char* fname)
-{
-#ifdef DEBUGG
-
-#ifndef DEBUGG_FILEONLY
- AllocConsole();
-
- SetConsoleTitle(fname);
- __hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
-
- COORD co = {width,height};
- SetConsoleScreenBufferSize(__hStdOut, co);
-
- SMALL_RECT coo = {0,0,(width - 1),70}; // top, left, right, bottom
- SetConsoleWindowInfo(__hStdOut, TRUE, &coo);
-
-#endif
-#ifndef DEBUGG_NOFILE
- // ---------------------------------------------------------------------------------------
- // Write to a file
- if(fname)
- {
- // Edit the log file name
- std::string FileEnding = ".log";
- std::string FileName = fname;
- std::string FullFilename = (FileName + FileEnding);
- __fStdOut = fopen(FullFilename.c_str(), "w");
- }
- // -----------------
-#endif
-
-#endif
-}
-
-
-void ClearScreen();
-int wprintf(char *fmt, ...)
-{
-#ifdef DEBUGG
- char s[6000]; // WARNING: mind this value
- va_list argptr;
- int cnt;
-
- va_start(argptr, fmt);
- cnt = vsnprintf(s, 3000, fmt, argptr);
- va_end(argptr);
-
- DWORD cCharsWritten;
-
- // ---------------------------------------------------------------------------------------
-#ifndef DEBUGG_FILEONLY
- if(__hStdOut)
- {
- WriteConsole(__hStdOut, s, strlen(s), &cCharsWritten, NULL);
- }
-#endif
-#ifndef DEBUGG_NOFILE
- // ---------------------------------------------------------------------------------------
-
- if(__fStdOut)
- fprintf(__fStdOut, s);
- // ---------------------------------------------------------------------------------------
-#endif
-
- return(cnt);
-#else
- return 0;
-#endif
-}
-
-
-// =======================================================================================
-// Clear screen
-// --------------
-void ClearScreen()
-{
- if(g_consoleEnable)
- {
- COORD coordScreen = { 0, 0 };
- DWORD cCharsWritten;
- CONSOLE_SCREEN_BUFFER_INFO csbi;
- DWORD dwConSize;
-
- HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
- //HANDLE hConsole = __hStdOut;
-
- 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);
- }
-}
-
-
-// =======================================================================================
-// Get console HWND to be able to use MoveWindow()
-// --------------
-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
\ No newline at end of file
diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/Logging/Console.h b/Source/Plugins/Plugin_DSP_LLE/Src/Logging/Console.h
deleted file mode 100644
index 8d83f1e494..0000000000
--- a/Source/Plugins/Plugin_DSP_LLE/Src/Logging/Console.h
+++ /dev/null
@@ -1,26 +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/
-
-
-#ifdef _WIN32
-
-void startConsoleWin(int width, int height, char* fname);
-int wprintf(char *fmt, ...);
-void ClearScreen();
-HWND GetConsoleHwnd(void);
-
-#endif
\ No newline at end of file
diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/Logging/Logging.cpp b/Source/Plugins/Plugin_DSP_LLE/Src/Logging/Logging.cpp
index f7ca3b1855..1259cbe14d 100644
--- a/Source/Plugins/Plugin_DSP_LLE/Src/Logging/Logging.cpp
+++ b/Source/Plugins/Plugin_DSP_LLE/Src/Logging/Logging.cpp
@@ -30,16 +30,20 @@
#include "Common.h"
#include "UCode_AXStructs.h" // they are only in a virtual dir called UCodes AX
-#include "Console.h" // For wprintf, ClearScreen
+#include "ConsoleWindow.h" // For Console::Print, Console::ClearScreen
+// =====================
-// ---------------------------------------------------------------------------------------
-// Declarations
+
+// =======================================================================================
+// Declarations and definitions
+// --------------
+
+// ----------------------------------
+// Settings
// --------------
#define NUMBER_OF_PBS 64 // Todo: move this to a logging class
-
-
-// ---------------------------------------------------------------------------------------
+// -----------------------------------
// Externals
// --------------
extern u32 m_addressPBs;
@@ -49,9 +53,8 @@ short globalpBuffer;
u32 gLastBlock;
// --------------
-
-// ---------------------------------------------------------------------------------------
-// Vectors and other stuff
+// -----------------------------------
+// Vectors and other things
// --------------
std::vector gloopPos(64);
std::vector gsampleEnd(64);
@@ -91,7 +94,7 @@ std::vector gsamplePos(64);
std::vector gupdates5(64);
std::vector gupdates_addr(64);
-// other stuff
+// Other things
std::vector Jump(64); // this is 1 or 0
std::vector musicLength(64);
std::vector< std::vector > vector1(64, std::vector(100,0));
@@ -110,7 +113,7 @@ std::vector vector62(vectorLength);
std::vector vector63(vectorLength);
int ReadOutPBs(AXParamBlock * _pPBs, int _num);
-// ===========
+// =====================
// =======================================================================================
@@ -359,8 +362,8 @@ void Logging()
// =======================================================================================
// Print
// ---------------
- ClearScreen();
- wprintf("%s", sbuff.c_str());
+ Console::ClearScreen();
+ Console::Print("%s", sbuff.c_str());
sbuff.clear(); strcpy(buffer, "");
// ---------------
k=0;
@@ -377,4 +380,4 @@ void Logging()
-#endif
\ No newline at end of file
+#endif
diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/Logging/ReadPBs.cpp b/Source/Plugins/Plugin_DSP_LLE/Src/Logging/ReadPBs.cpp
index e3d6f947be..31a815c5f6 100644
--- a/Source/Plugins/Plugin_DSP_LLE/Src/Logging/ReadPBs.cpp
+++ b/Source/Plugins/Plugin_DSP_LLE/Src/Logging/ReadPBs.cpp
@@ -28,7 +28,7 @@
#include "CommonTypes.h" // Pluginspecs
#include "UCode_AXStructs.h" // For the AXParamBlock structure
-#include "Console.h" // For wprintf, ClearScreen
+#include "ConsoleWindow.h" // For Console::Print, Console::ClearScreen
u32 m_addressPBs = 0;
@@ -54,7 +54,7 @@ int ReadOutPBs(AXParamBlock * _pPBs, int _num)
// reading and 'halfword' swap
n++;
- if (n > 20 && logall) {ClearScreen();}
+ if (n > 20 && logall) {Console::ClearScreen();}
for (int i = 0; i < _num; i++)
{
// ---------------------------------------------------------------------------------------
@@ -68,7 +68,7 @@ int ReadOutPBs(AXParamBlock * _pPBs, int _num)
// Create a shortcut that let us update struct members
short * pDest = (short *) & _pPBs[i];
- if (n > 20 && logall) {wprintf("%c%i:", 223, i);} // logging
+ if (n > 20 && logall) {Console::Print("%c%i:", 223, i);} // logging
// --------------
// Here we update the PB. We do it by going through all 192 / 2 = 96 u16 values
@@ -80,7 +80,7 @@ int ReadOutPBs(AXParamBlock * _pPBs, int _num)
{
if (pSrc[p] != 0 && n > 20 && logall)
{
- wprintf("%i %04x | ", p, Common::swap16(pSrc[p]));
+ Console::Print("%i %04x | ", p, Common::swap16(pSrc[p]));
}
}
@@ -88,7 +88,7 @@ int ReadOutPBs(AXParamBlock * _pPBs, int _num)
}
- if(n > 20 && logall) {wprintf("\n");} // logging
+ if(n > 20 && logall) {Console::Print("\n");} // logging
// --------------
// Here we update the block address to the starting point of the next PB
blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo;
diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp b/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp
index 395dc6c9c3..153ac79edc 100644
--- a/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp
+++ b/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp
@@ -15,12 +15,17 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
-#include "Common.h"
-#include "Globals.h"
+
+// =======================================================================================
+// Includes
+// --------------
+#include "Common.h" // Common
#include "WaveFile.h"
#include "CommonTypes.h"
#include "Mixer.h"
+#include "ConsoleWindow.h" // For Console::Open, Console::Print
+#include "Globals.h" // Local
#include "gdsp_interpreter.h"
#include "gdsp_interface.h"
#include "disassemble.h"
@@ -28,7 +33,6 @@
#ifdef _WIN32
#include "DisAsmDlg.h"
#include "DSoundStream.h"
- #include "Logging/Console.h" // For wprintf, ClearScreen
#include "Logging/Logging.h" // For Logging
HINSTANCE g_hInstance = NULL;
@@ -47,10 +51,11 @@
#endif
#include "ChunkFile.h"
+// ==============
// =======================================================================================
-// Globals
+// Global declarations and definitions
// --------------
DSPInitialize g_dspInitialize;
@@ -68,7 +73,6 @@ bool bCanWork = false;
// Set this if you want to log audio. search for log_ai in this file to see the filename.
static bool log_ai = false;
WaveFileWriter g_wave_writer;
-
// ==============
@@ -134,12 +138,12 @@ void DllDebugger(HWND _hParent, bool Show)
MoveWindow(g_Dialog.m_hWnd, 450,0, 780,530, true);
// Open the console window
- startConsoleWin(155, 100, "Sound Debugging"); // give room for 100 rows
- wprintf("DllDebugger > Console opened\n");
- // TODO: Make this adjustable from the Debugging window
- MoveWindow(GetConsoleHwnd(), 0,400, 1280,500, true);
+ Console::Open(155, 100, "Sound Debugging"); // give room for 100 rows
+ Console::Print("DllDebugger > Console opened\n");
+ // Todo: Make this adjustable from the Debugging window
+ MoveWindow(Console::GetHwnd(), 0,400, 1280,500, true);
#else
- MessageBox(0, "Can't open debugging window in Release build of this plugin.", "DSP LLE", 0);
+ MessageBox(0, "Can't open debugging window in the Release build of this plugin.", "DSP LLE", 0);
#endif
#endif
}
diff --git a/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcproj b/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcproj
index 0a62821176..7202ae84dd 100644
--- a/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcproj
+++ b/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcproj
@@ -1,7 +1,7 @@
-
-
-
-
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
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Globals.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Globals.cpp
index 0fe4e32e48..58fee09b0d 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/Globals.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/Globals.cpp
@@ -33,56 +33,41 @@
#include "main.h"
#include "IniFile.h"
+#include "ConsoleWindow.h"
#include
/////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
-// Declarations and definitions
+// Open and close the Windows console window
// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
#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
+// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
+
+// 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
}
+//////////////////////////////////
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Globals.h b/Source/Plugins/Plugin_VideoOGL/Src/Globals.h
index 9cbcbd7830..63c1a3869c 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/Globals.h
+++ b/Source/Plugins/Plugin_VideoOGL/Src/Globals.h
@@ -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
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Logging/Console.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Logging/Console.cpp
deleted file mode 100644
index d6f2d835b3..0000000000
--- a/Source/Plugins/Plugin_VideoOGL/Src/Logging/Console.cpp
+++ /dev/null
@@ -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
-// ŻŻŻŻŻŻŻŻŻŻ
-#include "../Globals.h"
-#include
-#include
-#ifdef _WIN32
-#include
-#endif
-//////////////////////////////////
-
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Declarations and definitions
-// ŻŻŻŻŻŻŻŻŻŻ
-
-// --------------------
-// 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
-// ŻŻŻŻŻŻŻŻŻŻ
-#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
-////////////////////////////////////
\ No newline at end of file
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Logging/Console.h b/Source/Plugins/Plugin_VideoOGL/Src/Logging/Console.h
deleted file mode 100644
index 8c890ceb8e..0000000000
--- a/Source/Plugins/Plugin_VideoOGL/Src/Logging/Console.h
+++ /dev/null
@@ -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
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Logging/Logging.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Logging/Logging.cpp
deleted file mode 100644
index efd0299b63..0000000000
--- a/Source/Plugins/Plugin_VideoOGL/Src/Logging/Logging.cpp
+++ /dev/null
@@ -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
-#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 "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 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
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Logging/Logging.h b/Source/Plugins/Plugin_VideoOGL/Src/Logging/Logging.h
deleted file mode 100644
index bf7ea46c05..0000000000
--- a/Source/Plugins/Plugin_VideoOGL/Src/Logging/Logging.h
+++ /dev/null
@@ -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);
-
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp b/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp
index d9a0682454..f0552897f8 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp
@@ -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
-////////////////////////////////////
\ No newline at end of file
+////////////////////////////////////
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
index 1b1d9bf1ef..2c6c710f96 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
@@ -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
#include
@@ -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);
-}
\ No newline at end of file
+}
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/SConscript b/Source/Plugins/Plugin_VideoOGL/Src/SConscript
index 6f8c4a4dfa..2c974b53a5 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/SConscript
+++ b/Source/Plugins/Plugin_VideoOGL/Src/SConscript
@@ -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']:
diff --git a/Source/Plugins/Plugin_Wiimote/Plugin_Wiimote.vcproj b/Source/Plugins/Plugin_Wiimote/Plugin_Wiimote.vcproj
index 4070219693..931493e29c 100644
--- a/Source/Plugins/Plugin_Wiimote/Plugin_Wiimote.vcproj
+++ b/Source/Plugins/Plugin_Wiimote/Plugin_Wiimote.vcproj
@@ -1,7 +1,7 @@
diff --git a/Source/Plugins/Plugin_Wiimote/Src/Console.cpp b/Source/Plugins/Plugin_Wiimote/Src/Console.cpp
deleted file mode 100644
index 458de92d0a..0000000000
--- a/Source/Plugins/Plugin_Wiimote/Src/Console.cpp
+++ /dev/null
@@ -1,268 +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
-//
-#include
-#include
-#ifdef _WIN32
- #include
-#endif
-
-#include "StringUtil.h"
-
-#define HAVE_WX 1
-#if defined(HAVE_WX) && HAVE_WX // wxWidgets
- #include // for the timestamps
-#endif
-///////////////////////////
-
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Settings
-//
-
-// On and off
-bool g_consoleEnable = true;
-bool gSaveFile = true;
-#define DEBUG_WIIMOTE // On or off
-const int nFiles = 1;
-
-// Create handles
-#ifdef DEBUG_WIIMOTE
- FILE* __fStdOut[nFiles];
-#endif
-#ifdef _WIN32
- HANDLE __hStdOut = NULL;
-#endif
-
-//////////////////////////////
-
-
-// =======================================================================================
-/* Get Timestamp */
-// -------------
-std::string Tm(bool Ms)
-{
- #if defined(HAVE_WX) && HAVE_WX
- std::string Tmp;
- if(Ms)
- {
- wxDateTime datetime = wxDateTime::UNow(); // Get timestamp
- Tmp = StringFromFormat("%02i:%02i:%03i",
- datetime.GetMinute(), datetime.GetSecond(), datetime.GetMillisecond());
- }
- else
- {
- wxDateTime datetime = wxDateTime::Now(); // Get timestamp
- Tmp = StringFromFormat("%02i:%02i",
- datetime.GetMinute(), datetime.GetSecond());
- }
- return Tmp;
- #else
- std::string Tmp = "";
- return Tmp;
- #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(DEBUG_WIIMOTE) && defined(_WIN32)
-
- AllocConsole();
-
- SetConsoleTitle(fname);
- __hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
-
- COORD co = {width,height};
- SetConsoleScreenBufferSize(__hStdOut, co);
-
- SMALL_RECT coo = {0,0,(width - 1),70}; // top, left, right, bottom
- SetConsoleWindowInfo(__hStdOut, TRUE, &coo);
-
- // ---------------------------------------------------------------------------------------
- // Create a file for this
- 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(DEBUG_WIIMOTE) && defined(_WIN32)
- if(gSaveFile)
- {
- char s[500]; // WARNING: mind this value
- va_list argptr;
- int cnt;
-
- va_start(argptr, fmt);
- cnt = vsnprintf(s, 500, 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);
- fflush(__fStdOut[0]); // Write file now, don't wait
- // -------------
-
- return(cnt);
- }
- else
- {
- return 0;
- }
-#else
- return 0;
-#endif
-}
-
-
-
-// ---------------------------------------------------------------------------------------
-// Printf to screen function
-int wprintf(const char *fmt, ...)
-{
-#if defined(DEBUG_WIIMOTE) && defined(_WIN32)
- char s[500]; // WARNING: mind this value
- va_list argptr;
- int cnt;
-
- va_start(argptr, fmt);
- cnt = vsnprintf(s, 500, fmt, argptr);
- va_end(argptr);
-
- DWORD cCharsWritten; // We will get a value back here
-
- // ------------------------------------------
- // Write to console
- // ----------------
- if(__hStdOut)
- {
- WriteConsole(__hStdOut, s, strlen(s), &cCharsWritten, NULL);
- }
-
- // ----------------------------------------
- // Write to file
- // ----------------
- aprintf(0, s);
-
- return(cnt);
-#else
- return 0;
-#endif
-}
-
-
-// ---------------------------------------------------------------------------------------
-// Clear console screen
-void ClearScreen()
-{
-#if 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
-}
-
-
-// ---------------------------------------------------------------------------------------
-// Get window handle of console window to be able to resize it
-#if 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
diff --git a/Source/Plugins/Plugin_Wiimote/Src/DataReports.cpp b/Source/Plugins/Plugin_Wiimote/Src/DataReports.cpp
index b075609e4e..42496ebbbb 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/DataReports.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/DataReports.cpp
@@ -63,7 +63,7 @@
#include "EmuSubroutines.h"
#include "EmuDefinitions.h"
#include "Encryption.h" // for extension encryption
-#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
+#include "Logging.h" // for startConsoleWin, Console::Print, GetConsoleHwnd
#include "Config.h" // for g_Config
///////////////////////////////////
@@ -91,8 +91,8 @@ void WmDataReporting(u16 _channelID, wm_data_reporting* dr)
LOG(WII_IPC_WIIMOTE, " Continuous: %x", dr->continuous);
LOG(WII_IPC_WIIMOTE, " All The Time: %x (not only on data change)", dr->all_the_time);
LOG(WII_IPC_WIIMOTE, " Mode: 0x%02x", dr->mode);
- //wprintf("Data reporting mode: 0x%02x\n", dr->mode);
- //wprintf("Data reporting channel: 0x%04x\n", _channelID);
+ //Console::Print("Data reporting mode: 0x%02x\n", dr->mode);
+ //Console::Print("Data reporting channel: 0x%04x\n", _channelID);
g_ReportingMode = dr->mode;
g_ReportingChannel = _channelID;
@@ -159,7 +159,7 @@ void SendReportCoreAccel(u16 _channelID)
/*if(GetAsyncKeyState('V'))
{
std::string Temp = WiiMoteEmu::ArrayToString(DataFrame, Offset, 0, 30);
- wprintf("DataFrame: %s\n", Temp.c_str());
+ Console::Print("DataFrame: %s\n", Temp.c_str());
}*/
#endif
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
@@ -191,7 +191,7 @@ void SendReportCoreAccelIr12(u16 _channelID) {
/*if(GetAsyncKeyState('V'))
{
std::string Temp = WiiMoteEmu::ArrayToString(DataFrame, Offset, 0, 30);
- wprintf("DataFrame: %s\n", Temp.c_str());
+ Console::Print("DataFrame: %s\n", Temp.c_str());
}*/
#endif
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
@@ -239,7 +239,7 @@ void SendReportCoreAccelExt16(u16 _channelID)
/*if(GetAsyncKeyState('V'))
{
std::string Temp = WiiMoteEmu::ArrayToString(DataFrame, Offset, 0, 30);
- wprintf("DataFrame: %s\n", Temp.c_str());
+ Console::Print("DataFrame: %s\n", Temp.c_str());
}*/
#endif
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
@@ -284,7 +284,7 @@ void SendReportCoreAccelIr10Ext(u16 _channelID)
/*if(GetAsyncKeyState('V'))
{
std::string Temp = ArrayToString(DataFrame, Offset, 0, 30);
- wprintf("DataFrame: %s\n", Temp.c_str());
+ Console::Print("DataFrame: %s\n", Temp.c_str());
}*/
#endif
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.cpp
index 1e72df255e..7059c5be36 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.cpp
@@ -29,7 +29,7 @@
#include "wiimote_hid.h"
#include "EmuDefinitions.h"
#include "Encryption.h"
-#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
+#include "Logging.h" // for startConsoleWin, Console::Print, GetConsoleHwnd
//////////////////////////
extern SWiimoteInitialize g_WiimoteInitialize;
diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h
index 828f7564f8..106617c614 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h
+++ b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h
@@ -27,7 +27,7 @@
#include "wiimote_hid.h"
#include "Encryption.h"
-#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
+#include "Logging.h" // for startConsoleWin, Console::Print, GetConsoleHwnd
extern SWiimoteInitialize g_WiimoteInitialize;
//extern void __Log(int log, const char *format, ...);
@@ -158,4 +158,4 @@ static const u8 partially_id[] =
} // namespace
-#endif //_EMU_DEFINITIONS_
\ No newline at end of file
+#endif //_EMU_DEFINITIONS_
diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp
index d626580995..6d91cc07a9 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp
@@ -32,7 +32,7 @@
#include "EmuDefinitions.h"
#include "EmuMain.h"
#include "Encryption.h" // for extension encryption
-#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
+#include "Logging.h" // for startConsoleWin, Console::Print, GetConsoleHwnd
#include "Config.h" // for g_Config
////////////////////////////////////
@@ -184,7 +184,7 @@ void CheckAckDelay()
}
AckDelay.at(i).Delay--;
- //wprintf("%i 0x%04x 0x%02x", i, AckDelay.at(i).ChannelID, AckDelay.at(i).ReportID);
+ //Console::Print("%i 0x%04x 0x%02x", i, AckDelay.at(i).ChannelID, AckDelay.at(i).ReportID);
}
}
}
@@ -238,7 +238,7 @@ void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
}
std::string Temp = ArrayToString(data, size + 2, 0, 30);
//LOGV(WII_IPC_WIIMOTE, 3, " Data: %s", Temp.c_str());
- wprintf("\n%s: InterruptChannel: %s\n", Tm(true).c_str(), Temp.c_str());*/
+ Console::Print("\n%s: InterruptChannel: %s\n", Tm(true).c_str(), Temp.c_str());*/
// -----------------------------------
hid_packet* hidp = (hid_packet*) data;
@@ -300,7 +300,7 @@ void ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
{
LOG(WII_IPC_WIIMOTE, "Wiimote_ControlChannel");
std::string Temp = ArrayToString(data, 0, _Size);
- wprintf("\n%s: ControlChannel: %s\n", Tm().c_str(), Temp.c_str());
+ Console::Print("\n%s: ControlChannel: %s\n", Tm().c_str(), Temp.c_str());
LOG(WII_IPC_WIIMOTE, " Data: %s", Temp.c_str());
}
diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.cpp
index f19179725a..df3908346d 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.cpp
@@ -51,7 +51,7 @@
#include "EmuMain.h"
#include "EmuSubroutines.h"
#include "EmuDefinitions.h"
-#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
+#include "Logging.h" // for startConsoleWin, Console::Print, GetConsoleHwnd
#include "Config.h" // for g_Config
/////////////////////////////////
@@ -99,7 +99,7 @@ void HidOutputReport(u16 _channelID, wm_report* sr) {
case WM_REQUEST_STATUS: // 0x15
WmRequestStatus(_channelID, (wm_request_status*)sr->data);
//Temp = ArrayToString(sr->data, sizeof(wm_request_status), 0);
- //wprintf("\n%s: InterruptChannel: %s\n", Tm().c_str(), Temp.c_str());
+ //Console::Print("\n%s: InterruptChannel: %s\n", Tm().c_str(), Temp.c_str());
break;
case WM_READ_DATA: // 0x17
WmReadData(_channelID, (wm_read_data*)sr->data);
@@ -110,7 +110,7 @@ void HidOutputReport(u16 _channelID, wm_report* sr) {
case WM_IR_PIXEL_CLOCK: // 0x13
case WM_IR_LOGIC: // 0x1a
LOGV(WII_IPC_WIIMOTE, 0, " IR Enable 0x%02x: 0x%02x", sr->channel, sr->data[0]);
- wprintf("IR Enable/Disable 0x%02x: 0x%02x\n", sr->channel, sr->data[0]);
+ Console::Print("IR Enable/Disable 0x%02x: 0x%02x\n", sr->channel, sr->data[0]);
if(sr->data[0] == 0x02) g_IR = 0;
else if(sr->data[0] == 0x06) g_IR = 1;
break;
@@ -120,13 +120,13 @@ void HidOutputReport(u16 _channelID, wm_report* sr) {
break;
case WM_SPEAKER_ENABLE: // 0x14
LOGV(WII_IPC_WIIMOTE, 1, " WM Speaker Enable 0x%02x: 0x%02x", sr->channel, sr->data[0]);
- wprintf("Speaker Enable/Disable 0x%02x: 0x%02x\n", sr->channel, sr->data[0]);
+ Console::Print("Speaker Enable/Disable 0x%02x: 0x%02x\n", sr->channel, sr->data[0]);
if(sr->data[0] == 0x02) g_Speaker = 0;
else if(sr->data[0] == 0x06) g_Speaker = 1;
break;
case WM_SPEAKER_MUTE:
LOGV(WII_IPC_WIIMOTE, 1, " WM Mute Enable 0x%02x: 0x%02x", sr->channel, sr->data[0]);
- wprintf("Speaker Mute/Unmute 0x%02x: 0x%02x\n", sr->channel, sr->data[0]);
+ Console::Print("Speaker Mute/Unmute 0x%02x: 0x%02x\n", sr->channel, sr->data[0]);
if(sr->data[0] == 0x02) g_SpeakerVoice = 0; // g_SpeakerVoice
else if(sr->data[0] == 0x06) g_SpeakerVoice = 1;
break;
@@ -198,13 +198,13 @@ void WmSendAck(u16 _channelID, u8 _reportID, u32 address)
LOGV(WII_IPC_WIIMOTE, 2, " Report ID: %02x", _reportID);
//std::string Temp = ArrayToString(DataFrame, Offset, 0);
//LOGV(WII_IPC_WIIMOTE, 2, " Data: %s", Temp.c_str());
- //wprintf("%s: WMSendAck: %s\n", Tm(true).c_str(), Temp.c_str());
+ //Console::Print("%s: WMSendAck: %s\n", Tm(true).c_str(), Temp.c_str());
/* Debug. Write the report for extension registry writes.
if((_reportID == 0x16 || _reportID == 0x17) && ((address >> 16) & 0xfe) == 0xa4)
{
- wprintf("\nWMSendAck Report ID: %02x Encryption: %02x\n", _reportID, g_RegExt[0xf0]);
- wprintf("Data: %s\n", Temp.c_str());
+ Console::Print("\nWMSendAck Report ID: %02x Encryption: %02x\n", _reportID, g_RegExt[0xf0]);
+ Console::Print("Data: %s\n", Temp.c_str());
}*/
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
@@ -252,7 +252,7 @@ void WmReadData(u16 _channelID, wm_read_data* rd)
LOGV(WII_IPC_WIIMOTE, 0, " Case 0xa2: g_RegSpeaker");
//Tmp = ArrayToString(g_RegSpeaker, size, (address & 0xffff));
//LOGV(WII_IPC_WIIMOTE, 0, " Data: %s", Temp.c_str());
- //wprintf("Read RegSpkr: Size %i Address %08x Offset %08x\nData %s\n",
+ //Console::Print("Read RegSpkr: Size %i Address %08x Offset %08x\nData %s\n",
// size, address, (address & 0xffff), Tmp.c_str());
break;
case 0xA4:
@@ -261,7 +261,7 @@ void WmReadData(u16 _channelID, wm_read_data* rd)
LOGV(WII_IPC_WIIMOTE, 0, " Case 0xa4: Read ExtReg ****************************");
//Tmp = ArrayToString(g_RegExt, size, (address & 0xffff));
//LOGV(WII_IPC_WIIMOTE, 0, " Data: %s", Temp.c_str());
- //wprintf("Read RegExt: Size %i Address %08x Offset %08x\nData %s\n",
+ //Console::Print("Read RegExt: Size %i Address %08x Offset %08x\nData %s\n",
// size, address, (address & 0xffff), Tmp.c_str());
break;
case 0xB0:
@@ -270,7 +270,7 @@ void WmReadData(u16 _channelID, wm_read_data* rd)
LOGV(WII_IPC_WIIMOTE, 0, " Case: 0xb0 g_RegIr");
//Tmp = ArrayToString(g_RegIr, size, (address & 0xffff));
//LOGV(WII_IPC_WIIMOTE, 0, " Data: %s", Temp.c_str());
- //wprintf("Read RegIR: Size %i Address %08x Offset %08x\nData %s\n",
+ //Console::Print("Read RegIR: Size %i Address %08x Offset %08x\nData %s\n",
// size, address, (address & 0xffff), Tmp.c_str());
break;
default:
@@ -285,12 +285,12 @@ void WmReadData(u16 _channelID, wm_read_data* rd)
if(((address >> 16) & 0xfe) == 0xa4)
{
/* Debugging
- wprintf("\n\nWmReadData Address: %08x Offset: %08x Size: %i byte\n",
+ Console::Print("\n\nWmReadData Address: %08x Offset: %08x Size: %i byte\n",
address, address & 0xffff, (u8)size);
// Debugging
u32 offset = address & 0xffff;
std::string Temp = ArrayToString(g_RegExt, size, offset);
- wprintf("Unencrypted data:\n%s\n", Temp.c_str());*/
+ Console::Print("Unencrypted data:\n%s\n", Temp.c_str());*/
// Check if encrypted reads is on
if(g_RegExt[0xf0] == 0xaa)
@@ -304,7 +304,7 @@ void WmReadData(u16 _channelID, wm_read_data* rd)
/* Debugging: Show the encrypted data
std::string Temp = ArrayToString(g_RegExtTmp, size, offset);
- wprintf("Encrypted data:\n%s\n", Temp.c_str());*/
+ Console::Print("Encrypted data:\n%s\n", Temp.c_str());*/
// Update the block that SendReadDataReply will eventually send to the Wii
block = g_RegExtTmp;
@@ -372,9 +372,9 @@ void WmWriteData(u16 _channelID, wm_write_data* wd)
block = g_RegSpeaker;
blockSize = WIIMOTE_REG_SPEAKER_SIZE;
LOGV(WII_IPC_WIIMOTE, 0, " Case 0xa2: RegSpeaker");
- //wprintf("Write RegSpeaker: Size: %i, Address: %08x, Offset: %08x\n",
+ //Console::Print("Write RegSpeaker: Size: %i, Address: %08x, Offset: %08x\n",
// wd->size, address, (address & 0xffff));
- //wprintf("Data: %s\n", Temp.c_str());
+ //Console::Print("Data: %s\n", Temp.c_str());
break;
case 0xA4:
block = g_RegExt; // Extension Controller register
@@ -382,17 +382,17 @@ void WmWriteData(u16 _channelID, wm_write_data* wd)
//LOGV(WII_IPC_WIIMOTE, 0, " *******************************************************");
LOGV(WII_IPC_WIIMOTE, 0, " Case 0xa4: ExtReg");
//LOGV(WII_IPC_WIIMOTE, 0, " *******************************************************");
- /*wprintf("Write RegExt Size: %i Address: %08x Offset: %08x \n",
+ /*Console::Print("Write RegExt Size: %i Address: %08x Offset: %08x \n",
wd->size, address, (address & 0xffff));
- wprintf("Data: %s\n", Temp.c_str());*/
+ Console::Print("Data: %s\n", Temp.c_str());*/
break;
case 0xB0:
block = g_RegIr;
blockSize = WIIMOTE_REG_IR_SIZE;
LOGV(WII_IPC_WIIMOTE, 0, " Case 0xb0: RegIr");
- /*wprintf("Write RegIR Size: %i Address: %08x Offset: %08x \n",
+ /*Console::Print("Write RegIR Size: %i Address: %08x Offset: %08x \n",
wd->size, address, (address & 0xffff));
- wprintf("Data: %s\n", Temp.c_str());*/
+ Console::Print("Data: %s\n", Temp.c_str());*/
break;
default:
PanicAlert("WmWriteData: bad register block!");
@@ -419,8 +419,8 @@ void WmWriteData(u16 _channelID, wm_write_data* wd)
if(blockSize == WIIMOTE_REG_EXT_SIZE)
{
/* Debugging. Write the data.
- wprintf("Data: %s\n", Temp.c_str());
- wprintf("Current address: %08x\n", address); */
+ Console::Print("Data: %s\n", Temp.c_str());
+ Console::Print("Current address: %08x\n", address); */
/* Run the key generation on all writes in the key area, it doesn't matter
that we send it parts of a key, only the last full key will have an
diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.h b/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.h
index 20ac1f3c4f..dd772ad824 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.h
+++ b/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.h
@@ -32,7 +32,7 @@
#include "wiimote_hid.h" // Local
#include "EmuDefinitions.h"
#include "Encryption.h"
-#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
+#include "Logging.h" // for startConsoleWin, Console::Print, GetConsoleHwnd
////////////////////////////
diff --git a/Source/Plugins/Plugin_Wiimote/Src/Encryption.cpp b/Source/Plugins/Plugin_Wiimote/Src/Encryption.cpp
index 72b531bf43..97fee94974 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/Encryption.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/Encryption.cpp
@@ -19,7 +19,7 @@
#include "pluginspecs_wiimote.h"
#include "Common.h"
-#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
+#include "Logging.h" // for startConsoleWin, Console::Print, GetConsoleHwnd
#include "Encryption.h"
@@ -262,8 +262,8 @@ void wiimote_gen_key(wiimote_key *key, u8 *keydata)
for(int i=0;i<6;i++)
skey[5-i] = keydata[i+10];
- wprintf("rand: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", rand[0], rand[1], rand[2], rand[3], rand[4], rand[5], rand[6], rand[7], rand[8], rand[9]);
- wprintf("key: %02x %02x %02x %02x %02x %02x\n", skey[0], skey[1], skey[2], skey[3], skey[4], skey[5]);
+ Console::Print("rand: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", rand[0], rand[1], rand[2], rand[3], rand[4], rand[5], rand[6], rand[7], rand[8], rand[9]);
+ Console::Print("key: %02x %02x %02x %02x %02x %02x\n", skey[0], skey[1], skey[2], skey[3], skey[4], skey[5]);
for(idx=0;idx<7;idx++)
{
@@ -272,12 +272,12 @@ void wiimote_gen_key(wiimote_key *key, u8 *keydata)
break;
}
// default case is idx = 7 which is valid (homebrew uses it for the 0x17 case)
- wprintf("idx: %d\n", idx);
+ Console::Print("idx: %d\n", idx);
gentabs(rand, skey, idx, key->ft, key->sb);
- wprintf("ft: %02x %02x %02x %02x %02x %02x %02x %02x\n", key->ft[0], key->ft[1], key->ft[2], key->ft[3], key->ft[4], key->ft[5], key->ft[6], key->ft[7]);
- wprintf("sb: %02x %02x %02x %02x %02x %02x %02x %02x\n", key->sb[0], key->sb[1], key->sb[2], key->sb[3], key->sb[4], key->sb[5], key->sb[6], key->sb[7]);
+ Console::Print("ft: %02x %02x %02x %02x %02x %02x %02x %02x\n", key->ft[0], key->ft[1], key->ft[2], key->ft[3], key->ft[4], key->ft[5], key->ft[6], key->ft[7]);
+ Console::Print("sb: %02x %02x %02x %02x %02x %02x %02x %02x\n", key->sb[0], key->sb[1], key->sb[2], key->sb[3], key->sb[4], key->sb[5], key->sb[6], key->sb[7]);
// for homebrew, ft and sb are all 0x97 which is equivalent to 0x17
}
@@ -290,8 +290,8 @@ void wiimote_encrypt(wiimote_key *key, u8 *data, int addr, u8 len)
{
for(int i = 0; i < len; i++, addr++)
{
- //wprintf("data[%i] from %02x ", i, data[i]);
+ //Console::Print("data[%i] from %02x ", i, data[i]);
data[i] = (data[i] - key->ft[addr%8]) ^ key->sb[addr%8];
- //wprintf("to %02x\n", data[i]);
+ //Console::Print("to %02x\n", data[i]);
}
}
diff --git a/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp b/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp
index 78e64be1fd..853fb1d9c5 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp
@@ -32,7 +32,7 @@
#include "EmuMain.h"
#include "EmuSubroutines.h"
#include "EmuDefinitions.h"
-#include "Console.h" // For startConsoleWin, wprintf, GetConsoleHwnd
+#include "Logging.h" // For startConsoleWin, Console::Print, GetConsoleHwnd
#include "Config.h" // For g_Config
//////////////////////////////////
@@ -271,13 +271,13 @@ void FillReportAcc(wm_accel& _acc)
//if(consoleDisplay == 0)
- wprintf("x: %03i | y: %03i | z: %03i | A:%i B:%i C:%i a:%i b:%i c:%i d:%i X:%i Y:%i Z:%i\n",
+ Console::Print("x: %03i | y: %03i | z: %03i | A:%i B:%i C:%i a:%i b:%i c:%i d:%i X:%i Y:%i Z:%i\n",
_acc.x, _acc.y, _acc.z,
A, B, C,
a, b, c, d,
X, Y, Z
);
- wprintf("x: %03i | y: %03i | z: %03i | X:%i Y:%i Z:%i | AX:%i AY:%i AZ:%i \n",
+ Console::Print("x: %03i | y: %03i | z: %03i | X:%i Y:%i Z:%i | AX:%i AY:%i AZ:%i \n",
_acc.x, _acc.y, _acc.z,
X, Y, Z,
AX, AY, AZ
@@ -358,11 +358,11 @@ void FillReportIR(wm_ir_extended& _ir0, wm_ir_extended& _ir1)
//ClearScreen();
//if(consoleDisplay == 1)
- wprintf("x0:%03i x1:%03i y0:%03i y1:%03i irx0:%03i y0:%03i x1:%03i y1:%03i | T:%i L:%i R:%i B:%i S:%i\n",
+ Console::Print("x0:%03i x1:%03i y0:%03i y1:%03i irx0:%03i y0:%03i x1:%03i y1:%03i | T:%i L:%i R:%i B:%i S:%i\n",
x0, x1, y0, y1, _ir0.x, _ir0.y, _ir1.x, _ir1.y, Top, Left, Right, Bottom, SensorBarRadius
);
- wprintf("\n");
- wprintf("ir0.x:%02x xHi:%02x ir1.x:%02x xHi:%02x | ir0.y:%02x yHi:%02x ir1.y:%02x yHi:%02x | 1.s:%02x 2:%02x\n",
+ Console::Print("\n");
+ Console::Print("ir0.x:%02x xHi:%02x ir1.x:%02x xHi:%02x | ir0.y:%02x yHi:%02x ir1.y:%02x yHi:%02x | 1.s:%02x 2:%02x\n",
_ir0.x, _ir0.xHi, _ir1.x, _ir1.xHi,
_ir0.y, _ir0.yHi, _ir1.y, _ir1.yHi,
_ir0.size, _ir1.size
@@ -445,11 +445,11 @@ void FillReportIRBasic(wm_ir_basic& _ir0, wm_ir_basic& _ir1)
//ClearScreen();
//if(consoleDisplay == 1)
- wprintf("x1:%03i x2:%03i y1:%03i y2:%03i irx1:%02x y1:%02x x2:%02x y2:%02x | T:%i L:%i R:%i B:%i S:%i\n",
+ Console::Print("x1:%03i x2:%03i y1:%03i y2:%03i irx1:%02x y1:%02x x2:%02x y2:%02x | T:%i L:%i R:%i B:%i S:%i\n",
x1, x2, y1, y2, _ir0.x1, _ir0.y1, _ir1.x2, _ir1.y2, Top, Left, Right, Bottom, SensorBarRadius
);
- wprintf("\n");
- wprintf("ir0.x1:%02x x1h:%02x x2:%02x x2h:%02x | ir0.y1:%02x y1h:%02x y2:%02x y2h:%02x | ir1.x1:%02x x1h:%02x x2:%02x x2h:%02x | ir1.y1:%02x y1h:%02x y2:%02x y2h:%02x\n",
+ Console::Print("\n");
+ Console::Print("ir0.x1:%02x x1h:%02x x2:%02x x2h:%02x | ir0.y1:%02x y1h:%02x y2:%02x y2h:%02x | ir1.x1:%02x x1h:%02x x2:%02x x2h:%02x | ir1.y1:%02x y1h:%02x y2:%02x y2h:%02x\n",
_ir0.x1, _ir0.x1Hi, _ir0.x2, _ir0.x2Hi,
_ir0.y1, _ir0.y1Hi, _ir0.y2, _ir0.y2Hi,
_ir1.x1, _ir1.x1Hi, _ir1.x2, _ir1.x2Hi,
diff --git a/Source/Plugins/Plugin_Wiimote/Src/SConscript b/Source/Plugins/Plugin_Wiimote/Src/SConscript
index 987e041111..805feb2cdc 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/SConscript
+++ b/Source/Plugins/Plugin_Wiimote/Src/SConscript
@@ -18,7 +18,7 @@ files = [
if wmenv['HAVE_WX']:
files += [
"ConfigDlg.cpp",
- "Console.cpp",
+ "Logging.cpp",
"FillReport.cpp",
]
diff --git a/Source/Plugins/Plugin_Wiimote/Src/main.cpp b/Source/Plugins/Plugin_Wiimote/Src/main.cpp
index 5bc22a5681..db5a3b5e12 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/main.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/main.cpp
@@ -19,9 +19,10 @@
//////////////////////////////////////////////////////////////////////////////////////////
// Includes
// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
-#include "Common.h"
+#include "Common.h" // Common
#include "Config.h"
#include "StringUtil.h"
+#include "ConsoleWindow.h" // For Start, Print, GetHwnd
#if defined(HAVE_WX) && HAVE_WX
#include
@@ -35,8 +36,6 @@
#if HAVE_WIIUSE
#include "wiimote_real.h"
#endif
-
-#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
///////////////////////////////////
@@ -144,25 +143,25 @@ extern "C" void Initialize(void *init)
// ----------------------------------------
// Debugging window
// ----------
- /*startConsoleWin(100, 750, "Wiimote"); // give room for 20 rows
- wprintf("Wiimote console opened\n");
+ /*Console::Open(100, 750, "Wiimote"); // give room for 20 rows
+ Console::Print("Wiimote console opened\n");
- // Move window, TODO: make this
- //MoveWindow(GetConsoleHwnd(), 0,400, 100*8,10*14, true); // small window
- MoveWindow(GetConsoleHwnd(), 400,0, 100*8,70*14, true); // big window*/
+ // Move window
+ //MoveWindow(Console::GetHwnd(), 0,400, 100*8,10*14, true); // small window
+ MoveWindow(Console::GetHwnd(), 400,0, 100*8,70*14, true); // big window*/
// ---------------
g_WiimoteInitialize = _WiimoteInitialize;
- /* We will run WiiMoteReal::Initialize() even if we are not using a
- real wiimote, we will initiate wiiuse.dll, but we will return before
- creating a new thread for it if we find no real Wiimotes. Then
- g_UseRealWiiMote will also be false This function call will be done
- instantly if there is no real Wiimote connected. I'm not sure how
- long time it takes if a Wiimote is connected. */
-#if HAVE_WIIUSE
- g_UseRealWiiMote = WiiMoteReal::Initialize() > 0;
-#endif
+ /* We will run WiiMoteReal::Initialize() even if we are not using a real wiimote,
+ to check if there is a real wiimote connected. We will initiate wiiuse.dll, but
+ we will return before creating a new thread for it if we find no real Wiimotes.
+ Then g_UseRealWiiMote will also be false. This function call will be done
+ instantly if there is no real Wiimote connected. I'm not sure how long time
+ it takes if a Wiimote is connected. */
+ #if HAVE_WIIUSE
+ g_UseRealWiiMote = WiiMoteReal::Initialize() > 0;
+ #endif
g_Config.Load(); // load config settings
WiiMoteEmu::Initialize();