Added a console window to the DSP HLE plugin to more easily see the current parameter block status. TODO: add more presets to show different parameters and add more file logging options.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@755 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2008-10-03 10:59:56 +00:00
parent a8f484a668
commit 2c78946797
15 changed files with 717 additions and 141 deletions

View File

@ -68,17 +68,9 @@ void CBoot::EmulatedBIOS(bool _bDebug)
// Write necessary values
// ---------------------------------------------------------------------------------------
/*
"TODO: Game iso info to 0x80000000 according to yagcd - or does apploader do this?" - Answer, no
apparently it doesn't, at least not in some games (by Namco). In these cases we need to set these
manually. But I guess there's no reason that the Apploader couldn't do this by itself. So I guess we
could do this for only these Namco games that need this by detecting GetUniqueID, but that wouldn't
look pretty, and I think it's likely that this is actually how the GameCube works, it reads these values
by itself. So this is very unlikely to break anything. However, if somebody find a game that has an
apploader that automatically copies the first bytes of the disc to memory that could indicate that
the apploader procedure to load the first bytes fails for some reason in some games... I hope I'm not
being long-winded here :). The yagcd page for this is http://hitmen.c02.at/files/yagcd/yagcd/chap4.ht
ml#sec4.2 by the way. I'm not sure what the bytes 8-10 does (version and streaming), but I include
those to.
Here we write values to memory that the apploader does not take care of. Game iso info goes
to 0x80000000 according to yagcd 4.2. I'm not sure what bytes 8-10 does (version and streaming),
but I include them anyway because it seems like they are supposed to be there.
*/
// ---------------------------------------------------------------------------------------
DVDInterface::DVDRead(0x00000000, 0x80000000, 10); // write boot info needed for multidisc games
@ -99,11 +91,11 @@ void CBoot::EmulatedBIOS(bool _bDebug)
// =======================================================================================
// Load Apploader to Memory - The apploader is hardcoded to begin at 9 280 on the disc, but
// it seems like the size can be variable.
// Load Apploader to Memory - The apploader is hardcoded to begin at byte 9 280 on the disc,
// but it seems like the size can be variable. Compare with yagcd chap 13.
// ---------------------------------------------------------------------------------------
PowerPC::ppcState.gpr[1] = 0x816ffff0; // StackPointer
u32 iAppLoaderOffset = 0x2440; // 0x1c40 (old value perhaps?, I don't know why it's here)
u32 iAppLoaderOffset = 0x2440; // 0x1c40 (what is 0x1c40?)
// ---------------------------------------------------------------------------------------
u32 iAppLoaderEntry = VolumeHandler::Read32(iAppLoaderOffset + 0x10);
u32 iAppLoaderSize = VolumeHandler::Read32(iAppLoaderOffset + 0x14);
@ -132,20 +124,10 @@ void CBoot::EmulatedBIOS(bool _bDebug)
// =======================================================================================
// iAppLoaderMain - This let's the apploader load the DOL (the exe) and the TOC (filesystem)
// and I guess anything else it wishes. To give you an idea about where the stuff is on the disc
// here's an example of the disc structure of these things from Baten Kaitos - Wings. The values
// are given as non hexadecimal (ie normal numbers with base 10 instead of base 16) and they
// are only approximately right. I don't know what's in the gaps or why there are gaps between
// the different things.
// Data From To Size
// Header 0 1 072 1 072
// AppLoader 9 280 121 408 112 128
// DOL (exe) 128 768 2 204 416 2 075 648
// TOC 2 204 160 2 309 120 104 960
// For some reason this game loaded these things in 16 rounds in the loop below. The third and
// last of these were double reads of things it had already copied to memory. But hey, we're
// all human :)
/*
iAppLoaderMain - Here we load the apploader, the DOL (the exe) and the FST (filesystem).
To give you an idea about where the stuff is located on the disc take a look at yagcd chap 13.
*/
// ---------------------------------------------------------------------------------------
LOG(MASTER_LOG, "Call iAppLoaderMain");
do

View File

@ -735,6 +735,14 @@
<Filter
Name="Logging"
>
<File
RelativePath=".\Src\Logging\Console.cpp"
>
</File>
<File
RelativePath=".\Src\Logging\Console.h"
>
</File>
<File
RelativePath=".\Src\Logging\Logging.cpp"
>

View File

@ -22,14 +22,18 @@
#include "Debugger.h"
#include "PBView.h"
#include "IniFile.h"
#include "../Logging/Console.h" // open and close console
// externals
extern int gUpdFreq;
// =======================================================================================
// Declare events
BEGIN_EVENT_TABLE(CDebugger,wxDialog)
EVT_CLOSE(CDebugger::OnClose)
EVT_BUTTON(ID_UPD,CDebugger::OnUpdate)
EVT_CHECKBOX(IDC_CHECK2,CDebugger::ShowHideConsole)
EVT_RADIOBOX(IDC_RADIO1,CDebugger::ChangeFrequency)
END_EVENT_TABLE()
// =======================================================================================
@ -63,6 +67,8 @@ void CDebugger::Save(IniFile& _IniFile) const
_IniFile.Set("SoundWindow", "y", GetPosition().y);
_IniFile.Set("SoundWindow", "w", GetSize().GetWidth());
_IniFile.Set("SoundWindow", "h", GetSize().GetHeight());
_IniFile.Set("SoundWindow", "Console", m_Check[2]->IsChecked()); // save settings
_IniFile.Set("SoundWindow", "UpdateFrequency", m_RadioBox[1]->GetSelection());
}
@ -74,18 +80,33 @@ void CDebugger::Load(IniFile& _IniFile)
_IniFile.Get("SoundWindow", "w", &w, GetSize().GetWidth());
_IniFile.Get("SoundWindow", "h", &h, GetSize().GetHeight());
SetSize(x, y, w, h);
// saved settings
bool Console;
_IniFile.Get("SoundWindow", "Console", &Console, m_Check[2]->IsChecked());
m_Check[2]->SetValue(Console);
DoShowHideConsole();
int UpdateFrequency;
_IniFile.Get("SoundWindow", "UpdateFrequency", &UpdateFrequency, m_RadioBox[1]->GetSelection());
m_RadioBox[1]->SetSelection(UpdateFrequency);
DoChangeFrequency();
}
void CDebugger::CreateGUIControls()
{
SetTitle(wxT("Sound Debugging"));
// basic settings
SetIcon(wxNullIcon);
SetSize(8, 8, 400, 370);
SetSize(8, 8, 200, 100); // these will become the minimin sizes allowed by resizing
Center();
// the big window
m_GPRListView = new CPBView(this, ID_GPR, wxDefaultPosition, GetSize(),
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT | wxLC_SINGLE_SEL | wxLC_SORT_ASCENDING);
// declarations
wxBoxSizer* sMain;
wxButton* m_Upd;
wxButton* m_SelC;
@ -93,32 +114,39 @@ SetTitle(wxT("Sound Debugging"));
wxStaticBoxSizer* sLeft;
// declarations
wxCheckBox *m_Check[2];
wxRadioButton *m_Radio[6];
// checkboxes and labels -----------------------------------------------------
m_Label[0] = new wxStaticBox(this, IDG_LABEL1, wxT("Options"),
wxDefaultPosition, wxDefaultSize, 0);
wxStaticBoxSizer * m_checkSizer = new wxStaticBoxSizer (m_Label[0], wxVERTICAL);
// checkboxes
m_Check[0] = new wxCheckBox(this, IDC_CHECK0, wxT("Save to file"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[1] = new wxCheckBox(this, IDC_CHECK1, wxT("Show updated"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Radio[0] = new wxRadioButton(this, IDC_RADIO0, wxT("Show base 10"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Radio[1] = new wxRadioButton(this, IDC_RADIO1, wxT("Show base 16"),
m_Check[2] = new wxCheckBox(this, IDC_CHECK2, wxT("Show console"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_checkSizer->Add(m_Check[0], 0, 0, 5);
m_checkSizer->Add(m_Check[1], 0, 0, 5);
m_checkSizer->Add(m_Check[2], 0, 0, 5);
// ------------------------
m_Radio[2] = new wxRadioButton(this, IDC_RADIO2, wxT("Never"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Radio[3] = new wxRadioButton(this, IDC_RADIO3, wxT("5 times/s"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Radio[4] = new wxRadioButton(this, IDC_RADIO4, wxT("10 times/s"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
// radio boxes -----------------------------------------------------
int m_radioBoxNChoices[2];
wxString m_radioBoxChoices0[] = { wxT("Show base 10"), wxT("Show base 16") };
m_radioBoxNChoices[0] = sizeof( m_radioBoxChoices0 ) / sizeof( wxString );
m_RadioBox[0] = new wxRadioBox( this, IDC_RADIO0, wxT("Show base"),
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[0], m_radioBoxChoices0, 1, wxRA_SPECIFY_COLS);
wxString m_radioBoxChoices1[] = { wxT("5 times/s"), wxT("15 times/s"), wxT("30 times/s") };
m_radioBoxNChoices[1] = sizeof( m_radioBoxChoices1 ) / sizeof( wxString );
m_RadioBox[1] = new wxRadioBox( this, IDC_RADIO1, wxT("Update freq."),
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[1], m_radioBoxChoices1, 1, wxRA_SPECIFY_COLS);
// ------------------------
// buttons
m_Upd = new wxButton(this, ID_UPD, wxT("Update"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_SelC = new wxButton(this, ID_SELC, wxT("Select Columns"),
@ -128,10 +156,10 @@ SetTitle(wxT("Sound Debugging"));
sLeft = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Current Status"));
wxBoxSizer* sButtons;
sButtons = new wxBoxSizer(wxVERTICAL);
sButtons->AddStretchSpacer(1);
sButtons->Add(m_Upd, 0, 0, 5);
@ -140,19 +168,15 @@ SetTitle(wxT("Sound Debugging"));
sButtons->AddStretchSpacer(1);
sButtons->Add(m_Check[0], 0, 0, 5);
sButtons->Add(m_Check[1], 0, 0, 5);
sButtons->Add(m_checkSizer, 0, 2, 5);
sButtons->AddStretchSpacer(1);
sButtons->Add(m_Radio[0], 0, 0, 5);
sButtons->Add(m_Radio[1], 0, 0, 5);
sButtons->Add(m_RadioBox[0], 0, 0, 5);
sButtons->AddStretchSpacer(1);
sButtons->Add(m_Radio[2], 0, 0, 5);
sButtons->Add(m_Radio[3], 0, 0, 5);
sButtons->Add(m_Radio[4], 0, 0, 5);
sButtons->Add(m_RadioBox[1], 0, 0, 5);
sButtons->AddStretchSpacer(1);
@ -173,6 +197,10 @@ SetTitle(wxT("Sound Debugging"));
void CDebugger::OnClose(wxCloseEvent& /*event*/)
{
EndModal(0);
// I turned this off for now because of the ShowModal() problem and because I wanted
// to look at the logs at the same time as the console window.
//CloseConsole();
}
void CDebugger::OnUpdate(wxCommandEvent& /*event*/)
@ -180,6 +208,46 @@ void CDebugger::OnUpdate(wxCommandEvent& /*event*/)
this->NotifyUpdate();
}
void CDebugger::ChangeFrequency(wxCommandEvent& event)
{
DoChangeFrequency();
}
void CDebugger::DoChangeFrequency()
{
if(m_RadioBox[1]->GetSelection() == 0)
{
gUpdFreq = 5;
}
else if(m_RadioBox[1]->GetSelection() == 1)
{
gUpdFreq = 15;
}
else
{
gUpdFreq = 30;
}
}
void CDebugger::ShowHideConsole(wxCommandEvent& event)
{
DoShowHideConsole();
}
void CDebugger::DoShowHideConsole()
{
if(m_Check[2]->IsChecked())
{
OpenConsole();
}
else
{
CloseConsole();
}
}
void CDebugger::NotifyUpdate()
{
if (m_GPRListView != NULL)

View File

@ -52,22 +52,35 @@ class CDebugger : public wxDialog
void NotifyUpdate();
void OnUpdate(wxCommandEvent& event);
void ShowHideConsole(wxCommandEvent& event);
void DoShowHideConsole();
void ChangeFrequency(wxCommandEvent& event);
void DoChangeFrequency();
CPBView* m_GPRListView;
private:
// declarations
wxCheckBox *m_Check[3];
wxRadioButton *m_Radio[5];
wxRadioBox *m_RadioBox[2];
wxStaticBox *m_Label[1];
wxPanel *m_Controller;
// ---------------------------------------------------------------------------------------
// WARNING: Make sure these are not also elsewhere, for example in resource.h.
enum
{
IDC_CHECK0 = 2000,
IDC_CHECK1,
IDC_CHECK2,
IDC_RADIO0,
IDC_RADIO1,
IDC_RADIO2,
IDC_RADIO3,
IDC_RADIO4,
IDG_LABEL1,
ID_UPD,
ID_SELC,
ID_PRESETS,

View File

@ -0,0 +1,196 @@
// 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>
#ifdef _WIN32
#include <windows.h>
#endif
// --------------------
// ---------------------------------------------------------------------------------------
// On and off
// --------------------
bool g_consoleEnable = true;
#define DEBUGG
//#define DEBUGG_FILEONLY
//#define DEBUGG_NOFILE
// --------------------
// ---------------------------------------------------------------------------------------
// Create handles
// --------------------
#ifdef DEBUGG
FILE* __fStdOut = NULL;
#endif
#ifndef DEBUGG_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 app */
// ---------------------------------------------------------------------------------------
void startConsoleWin(int width, int height, char* fname)
{
#if defined(DEBUGG) && defined(_WIN32)
#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
}
// ---------------------------------------------------------------------------------------
// Printf function
int wprintf(char *fmt, ...)
{
#if defined(DEBUGG) && defined(_WIN32)
char s[3000]; // 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
}
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
}
#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

View File

@ -0,0 +1,26 @@
// 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/
int wprintf(char *fmt, ...);
void ClearScreen();
void OpenConsole();
void CloseConsole();
#ifdef _WIN32
HWND GetConsoleHwnd(void);
#endif

View File

@ -28,7 +28,7 @@
#include <vector>
#include <string> // so that we can test std::string == abc
#ifdef _WIN32
#include <windows.h>
#include <windows.h>
#endif
#include "../UCodes/UCodes.h"
@ -37,9 +37,15 @@
#include "../Debugger/PBView.h"
#include "../Debugger/Debugger.h"
#include "Console.h" // open and close console, clear console window
// Externals
float ratioFactor; // a global to get the ratio factor from MixAdd
int gUpdFreq = 5;
u32 gLastBlock;
// Parameter blocks
@ -85,14 +91,17 @@ std::vector<u16> gis_stream(64);
int j = 0;
int k = 0;
long int l = 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
// More stuff
std::vector< std::vector<int> > vector1(64, std::vector<int>(100,0));
int vectorLength = 8;
std::vector<int> numberRunning(64);
std::vector<u16> vector62(vectorLength);
std::vector<u16> vector63(vectorLength);
@ -118,16 +127,16 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
// Control how often the screen is updated
j++;
l++;
if (j>20)
if (j > (200/gUpdFreq))
{
// Move all items back - vector1 is a vector1[64][100] vector, I think
/*
Move all items back like this:
1 to 2
2 3
3
3 ...
*/
for (int i = 0; i < 64; i++)
{
@ -138,8 +147,6 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
}
// Save the latest value
for (int i = 0; i < numberOfPBs; i++)
@ -147,37 +154,86 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
vector1.at(i).at(vectorLength-1) = PBs[i].running;
}
// =======================================================================================
// Count how many we have running now
// --------------
int jj = 0;
for (int i = 0; i < 64; i++)
{
for (int j = 0; j < vectorLength-1; j++)
{
if (vector1.at(i).at(j) == 1)
{
jj++;
}
numberRunning.at(i) = jj;
}
}
// ==============
// =======================================================================================
// Write header
// --------------
char buffer [1000] = "";
std::string sbuff;
sbuff = sbuff + " Nr pos / end lpos | voll volr | isl[pre yn1 yn2] iss | frac ratio[hi lo] | 1 2 3 4 5\n";
// ==============
// go through all blocks, or only some
// go through all running blocks
for (int i = 0; i < numberOfPBs; i++)
{
//if (PBs[i].running)
//if (PBs[i].running && PBs[i].adpcm_loop_info.yn1 && PBs[i].mixer.volume_left)
if(true)
if (numberRunning.at(i) > 0)
{
// Playback history for the GUI debugger
// Playback history for the GUI debugger --------------------------
if(m_frame)
{
std::string guipr; // gui progress
std::string sbuff;
for (int j = 0; j < vectorLengthGUI; j++)
{
if(vector1.at(i).at(j) == 0)
{
guipr = guipr + "0";
}
else
{
guipr = guipr + "1";
}
}
u32 run = atoi( guipr.c_str());
m_frame->m_GPRListView->m_CachedRegs[1][i] = run;
guipr.clear();
}
// Playback history for the console debugger --------------------------
for (int j = 0; j < vectorLength; j++)
{
if(vector1.at(i).at(j) == 0)
{
sbuff = sbuff + "0";
//strcat(buffer, " ");
sbuff = sbuff + " ";
}
else
{
sbuff = sbuff + "1";
}
}
//sprintf(buffer, "%s%c", buffer, 177); // this will add strange letters if buffer has
// not been given any string yet
sprintf(buffer, "%c", 177);
//strcat(buffer, tmpbuff);
//strcpy(buffer, "");
//sprintf(buffer, "%c", 177);
sbuff = sbuff + buffer; strcpy(buffer, "");
}
}
// ---------
u32 run = atoi( sbuff.c_str());
m_frame->m_GPRListView->m_CachedRegs[1][i] = run;
sbuff.clear();
// 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 lastets active value.
@ -261,14 +317,103 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
m_frame->m_GPRListView->m_CachedRegs[22][i] = gupdates5[i];
}
} // end of if (PBs[i].running)
// =======================================================================================
// PRESETS
// ---------------------------------------------------------------------------------------
/*
/" Nr pos / end lpos | voll volr | isl[pre yn1 yn2] iss | frac ratio[hi lo] | 1 2 3 4 5\n";
"---------------|00 12341234/12341234 12341234 | 00000 00000 | 0[000 00000 00000] 0 | 00000 00000[0 00000] |
*/
sprintf(buffer,"%c%i %08i/%08i %08i | %05i %05i | %i[%03i %05i %05i] %i | %05i %05i[%i %05i] | %i %i %i %i %i",
223, i, gsamplePos[i], gsampleEnd[i], gloopPos[i],
gvolume_left[i], gvolume_right[i],
glooping[i], gloop1[i], gloop2[i], gloop3[i], gis_stream[i],
gfrac[i], gratio[i], gratiohi[i], gratiolo[i],
gupdates1[i], gupdates2[i], gupdates3[i], gupdates4[i], gupdates5[i]
);
// add new line
sbuff = sbuff + buffer; strcpy(buffer, "");
sbuff = sbuff + "\n";
} // end of if (PBs[i].running)
} // end of big loop - for (int i = 0; i < numberOfPBs; i++)
// =======================================================================================
// 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, "");
// ===============
// =======================================================================================
// 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 (int 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 (int i = 0; i < viupd.size(); i++)
{
if(viupd.at(i) == 0)
sbuff = sbuff + " ";
else
sbuff = sbuff + ".";
}
// ================
// =======================================================================================
// Print
// ---------------------------------------------------------------------------------------
ClearScreen();
// we'll always have one to many \n at the end, remove it
//wprintf("%s", sbuff.substr(0, sbuff.length()-1).c_str());
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. I'll add a console window later to show the current status.
//if(m_frame)

View File

@ -32,6 +32,7 @@
// Externals
// -----------
extern float ratioFactor;
extern u32 gLastBlock;
extern CDebugger* m_frame;
// -----------
@ -617,6 +618,9 @@ int CUCode_AX::ReadOutPBs(AXParamBlock* _pPBs, int _num)
for (size_t p = 0; p < sizeof(AXParamBlock) / 2; p++)
{
pDest[p] = Common::swap16(pSrc[p]);
#if defined(_DEBUG) || defined(DEBUGFAST)
gLastBlock = blockAddr + p*2 + 2; // save last block location
#endif
}
blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo;
count++;

View File

@ -123,6 +123,32 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
#endif
// =======================================================================================
// Open close console
HWND GetConsoleHwnd(void);
void startConsoleWin(int width, int height, char* fname);
int wprintf(char *fmt, ...);
// ---------------------------------------------------------------------------------------
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,500, true); // move window, TODO: make this
// adjustable from the debugging window
#endif
}
void CloseConsole()
{
#if defined (_WIN32)
FreeConsole();
#endif
}
// =======================================================================================
// =======================================================================================
// 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

View File

@ -1,3 +1,21 @@
// 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 "../Globals.h"
#include "Common.h"

View File

@ -1,3 +1,21 @@
// 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

View File

@ -1,3 +1,21 @@
// 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);

View File

@ -1,3 +1,21 @@
// 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

View File

@ -1,3 +1,21 @@
// 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 Logging();

View File

@ -1,3 +1,21 @@
// 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
// =======================================================================================