mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 09:09:52 -06:00
Common: Moved Windows console functions to common
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1887 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -742,15 +742,15 @@
|
||||
Name="Logging"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Src\Logging\Console.cpp"
|
||||
RelativePath=".\Src\Debugger\File.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\Logging\Console.h"
|
||||
RelativePath=".\Src\Debugger\File.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\Logging\Logging.cpp"
|
||||
RelativePath=".\Src\Debugger\Logging.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
|
@ -19,7 +19,10 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// includes
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Includes
|
||||
// -------------
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
@ -28,13 +31,16 @@
|
||||
#include <stdlib.h>
|
||||
#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),
|
||||
|
@ -19,26 +19,31 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Includes
|
||||
// -------------
|
||||
// includes
|
||||
#include <iostream>
|
||||
#include <iostream> // System
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <stdlib.h>
|
||||
#include <stdlib.h>
|
||||
#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
|
||||
}
|
||||
// ==============
|
||||
|
||||
|
117
Source/Plugins/Plugin_DSP_HLE/Src/Debugger/File.cpp
Normal file
117
Source/Plugins/Plugin_DSP_HLE/Src/Debugger/File.cpp
Normal file
@ -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 <string>
|
||||
#include <stdio.h>
|
||||
#include "Common.h"
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#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
|
||||
}
|
||||
|
@ -19,7 +19,10 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// includes
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Includes
|
||||
// -------------
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
@ -28,23 +31,31 @@
|
||||
#include <stdlib.h>
|
||||
#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<std::string> 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);
|
||||
|
@ -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 <string>
|
||||
#include <stdio.h>
|
||||
#include "Common.h"
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#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
|
@ -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
|
@ -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 <iostream>
|
||||
#include <vector>
|
||||
#include <string> // so that we can test std::string == abc
|
||||
#include <math.h> // for the pow() function
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "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<int> mem(NUMBER_OF_PBS); // mem1 or mem2
|
||||
std::vector<u32> gloopPos(NUMBER_OF_PBS);
|
||||
std::vector<u32> gsampleEnd(NUMBER_OF_PBS);
|
||||
std::vector<u32> gsamplePos(NUMBER_OF_PBS);
|
||||
|
||||
// main
|
||||
std::vector<u16> running(NUMBER_OF_PBS, 0);
|
||||
std::vector<u16> gsrc_type(NUMBER_OF_PBS);
|
||||
std::vector<u16> gis_stream(NUMBER_OF_PBS);
|
||||
|
||||
// PBSampleRateConverter src
|
||||
std::vector<u32> gratio(NUMBER_OF_PBS);
|
||||
std::vector<u32> gratiohi(NUMBER_OF_PBS);
|
||||
std::vector<u32> gratiolo(NUMBER_OF_PBS);
|
||||
std::vector<u32> gfrac(NUMBER_OF_PBS);
|
||||
std::vector<u32> gcoef(NUMBER_OF_PBS);
|
||||
|
||||
// PBSampleRateConverter mixer
|
||||
std::vector<u16> gvolume_left(NUMBER_OF_PBS);
|
||||
std::vector<u16> gmix_unknown(NUMBER_OF_PBS);
|
||||
std::vector<u16> gvolume_right(NUMBER_OF_PBS);
|
||||
std::vector<u16> gmix_unknown2(NUMBER_OF_PBS);
|
||||
std::vector<u16> gmixer_control(NUMBER_OF_PBS);
|
||||
std::vector<u32> gmixer_control_wii(NUMBER_OF_PBS);
|
||||
|
||||
std::vector<u16> gmixer_vol1(NUMBER_OF_PBS);
|
||||
std::vector<u16> gmixer_vol2(NUMBER_OF_PBS);
|
||||
std::vector<u16> gmixer_vol3(NUMBER_OF_PBS);
|
||||
std::vector<u16> gmixer_vol4(NUMBER_OF_PBS);
|
||||
std::vector<u16> gmixer_vol5(NUMBER_OF_PBS);
|
||||
std::vector<u16> gmixer_vol6(NUMBER_OF_PBS);
|
||||
std::vector<u16> gmixer_vol7(NUMBER_OF_PBS);
|
||||
|
||||
std::vector<u16> gmixer_d1(NUMBER_OF_PBS);
|
||||
std::vector<u16> gmixer_d2(NUMBER_OF_PBS);
|
||||
std::vector<u16> gmixer_d3(NUMBER_OF_PBS);
|
||||
std::vector<u16> gmixer_d4(NUMBER_OF_PBS);
|
||||
std::vector<u16> gmixer_d5(NUMBER_OF_PBS);
|
||||
std::vector<u16> gmixer_d6(NUMBER_OF_PBS);
|
||||
std::vector<u16> gmixer_d7(NUMBER_OF_PBS);
|
||||
|
||||
// PBVolumeEnvelope vol_env
|
||||
std::vector<u16> gcur_volume(NUMBER_OF_PBS);
|
||||
std::vector<u16> gcur_volume_delta(NUMBER_OF_PBS);
|
||||
|
||||
// PBAudioAddr audio_addr (incl looping)
|
||||
std::vector<u16> gaudioFormat(NUMBER_OF_PBS);
|
||||
std::vector<u16> glooping(NUMBER_OF_PBS);
|
||||
std::vector<u16> gloop1(NUMBER_OF_PBS);
|
||||
std::vector<u16> gloop2(NUMBER_OF_PBS);
|
||||
std::vector<u16> gloop3(NUMBER_OF_PBS);
|
||||
|
||||
// PBADPCMInfo adpcm
|
||||
std::vector<u16> gadloop1(NUMBER_OF_PBS);
|
||||
std::vector<u16> gadloop2(NUMBER_OF_PBS);
|
||||
std::vector<u16> gadloop3(NUMBER_OF_PBS);
|
||||
|
||||
// updates
|
||||
std::vector<u16> gupdates1(NUMBER_OF_PBS);
|
||||
std::vector<u16> gupdates2(NUMBER_OF_PBS);
|
||||
std::vector<u16> gupdates3(NUMBER_OF_PBS);
|
||||
std::vector<u16> gupdates4(NUMBER_OF_PBS);
|
||||
std::vector<u16> gupdates5(NUMBER_OF_PBS);
|
||||
std::vector<u32> gupdates_addr(NUMBER_OF_PBS);
|
||||
std::vector<u32> gupdates_data(NUMBER_OF_PBS);
|
||||
std::vector<u32> gupdates_data1(NUMBER_OF_PBS);
|
||||
std::vector<u32> gupdates_data2(NUMBER_OF_PBS);
|
||||
std::vector<u32> gupdates_data3(NUMBER_OF_PBS);
|
||||
std::vector<u32> gupdates_data4(NUMBER_OF_PBS);
|
||||
|
||||
// Counters
|
||||
|
||||
int count1 = 0;
|
||||
int count2 = 0;
|
||||
int iupd = 0;
|
||||
bool iupdonce = false;
|
||||
std::vector<u16> 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<bool> > vector1(NUMBER_OF_PBS, std::vector<bool>(vectorLength, false));
|
||||
std::vector< std::vector<bool> > vector2(NUMBER_OF_PBS, std::vector<bool>(vectorLength2, false));
|
||||
std::vector<int> 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<class ParamBlockType> 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<class ParamBlockType>
|
||||
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<class ParamBlockType>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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 <queue>
|
||||
#include "../Config.h"
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Includes
|
||||
// -------------
|
||||
// This queue solution is temporary. I'll implement something more efficient later.
|
||||
#include <queue> // 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;
|
||||
|
@ -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',
|
||||
|
@ -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 <sstream>
|
||||
@ -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++)
|
||||
|
@ -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);
|
||||
// ------------
|
||||
|
||||
|
||||
|
@ -15,32 +15,42 @@
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Includes
|
||||
// -------------
|
||||
#include <iostream>
|
||||
|
||||
#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
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
DSPInitialize g_dspInitialize;
|
||||
u8* g_pMemory;
|
||||
extern std::vector<std::string> 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
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#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
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#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
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// =======================================================================================
|
||||
// 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
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
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
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
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
|
||||
}
|
||||
///////////////////////////////
|
||||
|
Reference in New Issue
Block a user