Added seperate verbose channel for sound output

git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@522 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
spacy51 2008-05-20 14:24:49 +00:00
parent a10d254829
commit c52e4df3fc
7 changed files with 157 additions and 196 deletions

View File

@ -32,6 +32,7 @@
#define VERBOSE_DMA3 128 #define VERBOSE_DMA3 128
#define VERBOSE_UNDEFINED 256 #define VERBOSE_UNDEFINED 256
#define VERBOSE_AGBPRINT 512 #define VERBOSE_AGBPRINT 512
#define VERBOSE_SOUNDOUTPUT 1024
extern reg_pair reg[45]; extern reg_pair reg[45];
extern bool ioReadable[0x400]; extern bool ioReadable[0x400];

View File

@ -25,6 +25,8 @@
#include "FileDlg.h" #include "FileDlg.h"
#include "Logging.h" #include "Logging.h"
#include "../Globals.h"
#ifdef _DEBUG #ifdef _DEBUG
#define new DEBUG_NEW #define new DEBUG_NEW
#undef THIS_FILE #undef THIS_FILE
@ -39,6 +41,7 @@ CString Logging::text;
Logging::Logging(CWnd* pParent /*=NULL*/) Logging::Logging(CWnd* pParent /*=NULL*/)
: ResizeDlg(Logging::IDD, pParent) : ResizeDlg(Logging::IDD, pParent)
, m_sound_output(FALSE)
{ {
//{{AFX_DATA_INIT(Logging) //{{AFX_DATA_INIT(Logging)
m_swi = FALSE; m_swi = FALSE;
@ -58,7 +61,6 @@ Logging::Logging(CWnd* pParent /*=NULL*/)
void Logging::DoDataExchange(CDataExchange* pDX) void Logging::DoDataExchange(CDataExchange* pDX)
{ {
CDialog::DoDataExchange(pDX); CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(Logging)
DDX_Control(pDX, IDC_LOG, m_log); DDX_Control(pDX, IDC_LOG, m_log);
DDX_Check(pDX, IDC_VERBOSE_SWI, m_swi); DDX_Check(pDX, IDC_VERBOSE_SWI, m_swi);
DDX_Check(pDX, IDC_VERBOSE_UNALIGNED_ACCESS, m_unaligned_access); DDX_Check(pDX, IDC_VERBOSE_UNALIGNED_ACCESS, m_unaligned_access);
@ -70,12 +72,11 @@ void Logging::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_VERBOSE_DMA3, m_dma3); DDX_Check(pDX, IDC_VERBOSE_DMA3, m_dma3);
DDX_Check(pDX, IDC_VERBOSE_AGBPRINT, m_agbprint); DDX_Check(pDX, IDC_VERBOSE_AGBPRINT, m_agbprint);
DDX_Check(pDX, IDC_VERBOSE_UNDEFINED, m_undefined); DDX_Check(pDX, IDC_VERBOSE_UNDEFINED, m_undefined);
//}}AFX_DATA_MAP DDX_Check(pDX, IDC_VERBOSE_SOUNDOUTPUT, m_sound_output);
} }
BEGIN_MESSAGE_MAP(Logging, CDialog) BEGIN_MESSAGE_MAP(Logging, CDialog)
//{{AFX_MSG_MAP(Logging)
ON_BN_CLICKED(ID_OK, OnOk) ON_BN_CLICKED(ID_OK, OnOk)
ON_BN_CLICKED(IDC_CLEAR, OnClear) ON_BN_CLICKED(IDC_CLEAR, OnClear)
ON_BN_CLICKED(IDC_VERBOSE_AGBPRINT, OnVerboseAgbprint) ON_BN_CLICKED(IDC_VERBOSE_AGBPRINT, OnVerboseAgbprint)
@ -88,14 +89,15 @@ BEGIN_MESSAGE_MAP(Logging, CDialog)
ON_BN_CLICKED(IDC_VERBOSE_SWI, OnVerboseSwi) ON_BN_CLICKED(IDC_VERBOSE_SWI, OnVerboseSwi)
ON_BN_CLICKED(IDC_VERBOSE_UNALIGNED_ACCESS, OnVerboseUnalignedAccess) ON_BN_CLICKED(IDC_VERBOSE_UNALIGNED_ACCESS, OnVerboseUnalignedAccess)
ON_BN_CLICKED(IDC_VERBOSE_UNDEFINED, OnVerboseUndefined) ON_BN_CLICKED(IDC_VERBOSE_UNDEFINED, OnVerboseUndefined)
ON_BN_CLICKED(IDC_VERBOSE_SOUNDOUTPUT, OnVerboseSoundoutput)
ON_BN_CLICKED(IDC_SAVE, OnSave) ON_BN_CLICKED(IDC_SAVE, OnSave)
ON_EN_ERRSPACE(IDC_LOG, OnErrspaceLog) ON_EN_ERRSPACE(IDC_LOG, OnErrspaceLog)
ON_EN_MAXTEXT(IDC_LOG, OnMaxtextLog) ON_EN_MAXTEXT(IDC_LOG, OnMaxtextLog)
ON_WM_CLOSE() ON_WM_CLOSE()
//}}AFX_MSG_MAP END_MESSAGE_MAP()
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Logging message handlers // Logging message handlers
void Logging::OnOk() void Logging::OnOk()
@ -111,54 +113,59 @@ void Logging::OnClear()
m_log.SetWindowText(""); m_log.SetWindowText("");
} }
void Logging::OnVerboseAgbprint()
{
systemVerbose ^= 512;
}
void Logging::OnVerboseDma0()
{
systemVerbose ^= 16;
}
void Logging::OnVerboseDma1()
{
systemVerbose ^= 32;
}
void Logging::OnVerboseDma2()
{
systemVerbose ^= 64;
}
void Logging::OnVerboseDma3()
{
systemVerbose ^= 128;
}
void Logging::OnVerboseIllegalRead()
{
systemVerbose ^= 8;
}
void Logging::OnVerboseIllegalWrite()
{
systemVerbose ^= 4;
}
void Logging::OnVerboseSwi() void Logging::OnVerboseSwi()
{ {
systemVerbose ^= 1; systemVerbose ^= VERBOSE_SWI;
} }
void Logging::OnVerboseUnalignedAccess() void Logging::OnVerboseUnalignedAccess()
{ {
systemVerbose ^= 2; systemVerbose ^= VERBOSE_UNALIGNED_MEMORY;
}
void Logging::OnVerboseIllegalWrite()
{
systemVerbose ^= VERBOSE_ILLEGAL_WRITE;
}
void Logging::OnVerboseIllegalRead()
{
systemVerbose ^= VERBOSE_ILLEGAL_READ;
}
void Logging::OnVerboseDma0()
{
systemVerbose ^= VERBOSE_DMA0;
}
void Logging::OnVerboseDma1()
{
systemVerbose ^= VERBOSE_DMA1;
}
void Logging::OnVerboseDma2()
{
systemVerbose ^= VERBOSE_DMA2;
}
void Logging::OnVerboseDma3()
{
systemVerbose ^= VERBOSE_DMA3;
} }
void Logging::OnVerboseUndefined() void Logging::OnVerboseUndefined()
{ {
systemVerbose ^= 256; systemVerbose ^= VERBOSE_UNDEFINED;
}
void Logging::OnVerboseAgbprint()
{
systemVerbose ^= VERBOSE_AGBPRINT;
}
void Logging::OnVerboseSoundoutput()
{
systemVerbose ^= VERBOSE_SOUNDOUTPUT;
} }
void Logging::OnSave() void Logging::OnSave()
@ -216,16 +223,17 @@ BOOL Logging::OnInitDialog()
HKEY_CURRENT_USER, HKEY_CURRENT_USER,
"Software\\Emulators\\VisualBoyAdvance\\Viewer\\LogView", "Software\\Emulators\\VisualBoyAdvance\\Viewer\\LogView",
NULL); NULL);
m_swi = (systemVerbose & 1) != 0; m_swi = (systemVerbose & VERBOSE_SWI) != 0;
m_unaligned_access = (systemVerbose & 2) != 0; m_unaligned_access = (systemVerbose & VERBOSE_UNALIGNED_MEMORY) != 0;
m_illegal_write = (systemVerbose & 4) != 0; m_illegal_write = (systemVerbose & VERBOSE_ILLEGAL_WRITE) != 0;
m_illegal_read = (systemVerbose & 8) != 0; m_illegal_read = (systemVerbose & VERBOSE_ILLEGAL_READ) != 0;
m_dma0 = (systemVerbose & 16) != 0; m_dma0 = (systemVerbose & VERBOSE_DMA0) != 0;
m_dma1 = (systemVerbose & 32) != 0; m_dma1 = (systemVerbose & VERBOSE_DMA1) != 0;
m_dma2 = (systemVerbose & 64) != 0; m_dma2 = (systemVerbose & VERBOSE_DMA2) != 0;
m_dma3 = (systemVerbose & 128) != 0; m_dma3 = (systemVerbose & VERBOSE_DMA3) != 0;
m_undefined = (systemVerbose & 256) != 0; m_undefined = (systemVerbose & VERBOSE_UNDEFINED) != 0;
m_agbprint = (systemVerbose & 512) != 0; m_agbprint = (systemVerbose & VERBOSE_AGBPRINT) != 0;
m_sound_output = (systemVerbose & VERBOSE_SOUNDOUTPUT) != 0;
UpdateData(FALSE); UpdateData(FALSE);
m_log.LimitText(-1); m_log.LimitText(-1);

View File

@ -17,30 +17,22 @@
// along with this program; if not, write to the Free Software Foundation, // along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#if !defined(AFX_LOGGING_H__222FC21A_D40D_450D_8A1C_D33305E47B85__INCLUDED_)
#define AFX_LOGGING_H__222FC21A_D40D_450D_8A1C_D33305E47B85__INCLUDED_
#if _MSC_VER > 1000
#pragma once #pragma once
#endif // _MSC_VER > 1000
// Logging.h : header file
//
#include "ResizeDlg.h" #include "ResizeDlg.h"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Logging dialog // Logging dialog
class Logging : public ResizeDlg class Logging : public ResizeDlg
{ {
// Construction public:
public:
void log(const char *); void log(const char *);
void clearLog(); void clearLog();
Logging(CWnd* pParent = NULL); // standard constructor Logging(CWnd* pParent = NULL); // standard constructor
// Dialog Data // Dialog Data
//{{AFX_DATA(Logging)
enum { IDD = IDD_LOGGING }; enum { IDD = IDD_LOGGING };
CEdit m_log; CEdit m_log;
BOOL m_swi; BOOL m_swi;
@ -53,22 +45,14 @@ class Logging : public ResizeDlg
BOOL m_dma3; BOOL m_dma3;
BOOL m_agbprint; BOOL m_agbprint;
BOOL m_undefined; BOOL m_undefined;
//}}AFX_DATA BOOL m_sound_output;
// Overrides
// Overrides protected:
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(Logging)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual void PostNcDestroy(); virtual void PostNcDestroy();
//}}AFX_VIRTUAL
// Implementation protected:
protected:
// Generated message map functions
//{{AFX_MSG(Logging)
afx_msg void OnOk(); afx_msg void OnOk();
afx_msg void OnClear(); afx_msg void OnClear();
afx_msg void OnVerboseAgbprint(); afx_msg void OnVerboseAgbprint();
@ -81,25 +65,20 @@ class Logging : public ResizeDlg
afx_msg void OnVerboseSwi(); afx_msg void OnVerboseSwi();
afx_msg void OnVerboseUnalignedAccess(); afx_msg void OnVerboseUnalignedAccess();
afx_msg void OnVerboseUndefined(); afx_msg void OnVerboseUndefined();
afx_msg void OnVerboseSoundoutput();
afx_msg void OnSave(); afx_msg void OnSave();
afx_msg void OnClose();
afx_msg void OnErrspaceLog(); afx_msg void OnErrspaceLog();
afx_msg void OnMaxtextLog(); afx_msg void OnMaxtextLog();
virtual BOOL OnInitDialog(); virtual BOOL OnInitDialog();
afx_msg void OnClose();
//}}AFX_MSG
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
public: public:
static Logging *instance; static Logging *instance;
static CString text; static CString text;
}; };
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
void toolsLogging(); void toolsLogging();
void toolsLoggingClose(); void toolsLoggingClose();
void toolsLog(const char *s); void toolsLog(const char *s);
void toolsClearLog(); void toolsClearLog();
#endif // !defined(AFX_LOGGING_H__222FC21A_D40D_450D_8A1C_D33305E47B85__INCLUDED_)

View File

@ -291,10 +291,12 @@ void OpenAL::write()
#ifdef _DEBUG #ifdef _DEBUG
if( nBuffersProcessed == theApp.oalBufferCount ) { if( nBuffersProcessed == theApp.oalBufferCount ) {
// we only want to know about it when we are emulating at full speed or faster:
if( ( theApp.throttle >= 100 ) || ( theApp.throttle == 0 ) ) { if( ( theApp.throttle >= 100 ) || ( theApp.throttle == 0 ) ) {
// we only want to know about it when we are emulating at full speed (or faster) if( systemVerbose & VERBOSE_SOUNDOUTPUT ) {
static int i = 0; static int i = 0;
log( "OpenAL: Buffers were not refilled fast enough (%i)\n", i++ ); log( "OpenAL: Buffers were not refilled fast enough (i=%i)\n", i++ );
}
} }
} }
#endif #endif

View File

@ -8,9 +8,11 @@
// Generated from the TEXTINCLUDE 2 resource. // Generated from the TEXTINCLUDE 2 resource.
// //
#include "afxres.h" #include "afxres.h"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS #undef APSTUDIO_READONLY_SYMBOLS
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources // English (U.S.) resources
@ -810,26 +812,27 @@ BEGIN
LTEXT "",IDC_PORT,143,7,36,8,SS_NOPREFIX LTEXT "",IDC_PORT,143,7,36,8,SS_NOPREFIX
END END
IDD_LOGGING DIALOG 0, 0, 366, 218 IDD_LOGGING DIALOGEX 0, 0, 381, 221
STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
CAPTION "Logging" CAPTION "Logging"
FONT 8, "MS Sans Serif" FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN BEGIN
CONTROL "SWI",IDC_VERBOSE_SWI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,17,87,10 CONTROL "SWI",IDC_VERBOSE_SWI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,18,90,12
CONTROL "Unaligned memory",IDC_VERBOSE_UNALIGNED_ACCESS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,30,87,10 CONTROL "Unaligned memory",IDC_VERBOSE_UNALIGNED_ACCESS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,36,90,12
CONTROL "Illegal write",IDC_VERBOSE_ILLEGAL_WRITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,43,87,10 CONTROL "Illegal write",IDC_VERBOSE_ILLEGAL_WRITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,54,90,12
CONTROL "Illegal read",IDC_VERBOSE_ILLEGAL_READ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,56,87,10 CONTROL "Illegal read",IDC_VERBOSE_ILLEGAL_READ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,72,90,12
CONTROL "DMA 0",IDC_VERBOSE_DMA0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,69,87,10 CONTROL "DMA 0",IDC_VERBOSE_DMA0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,90,90,12
CONTROL "DMA 1",IDC_VERBOSE_DMA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,82,87,10 CONTROL "DMA 1",IDC_VERBOSE_DMA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,108,90,12
CONTROL "DMA 2",IDC_VERBOSE_DMA2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,95,87,10 CONTROL "DMA 2",IDC_VERBOSE_DMA2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,126,90,12
CONTROL "DMA 3",IDC_VERBOSE_DMA3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,108,87,10 CONTROL "DMA 3",IDC_VERBOSE_DMA3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,144,90,12
CONTROL "Undefined instruction",IDC_VERBOSE_UNDEFINED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,121,87,10 CONTROL "Undefined instruction",IDC_VERBOSE_UNDEFINED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,162,90,12
CONTROL "AGBPrint",IDC_VERBOSE_AGBPRINT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,134,87,10 CONTROL "AGBPrint",IDC_VERBOSE_AGBPRINT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,180,90,12
EDITTEXT IDC_LOG,107,7,252,183,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL EDITTEXT IDC_LOG,114,6,258,192,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL
PUSHBUTTON "Save...",IDC_SAVE,75,197,50,14 PUSHBUTTON "Save...",IDC_SAVE,114,204,48,12
PUSHBUTTON "Clear",IDC_CLEAR,137,197,50,14 PUSHBUTTON "Clear",IDC_CLEAR,168,204,48,12
DEFPUSHBUTTON "OK",ID_OK,197,197,50,14 DEFPUSHBUTTON "OK",ID_OK,324,204,48,12
GROUPBOX "Verbose",IDC_STATIC,7,7,93,142 GROUPBOX "Verbose",IDC_STATIC,6,6,102,210
CONTROL "Sound output",IDC_VERBOSE_SOUNDOUTPUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,198,90,12
END END
IDD_EXPORT_SPS DIALOGEX 0, 0, 248, 148 IDD_EXPORT_SPS DIALOGEX 0, 0, 248, 148
@ -1373,9 +1376,9 @@ BEGIN
IDD_LOGGING, DIALOG IDD_LOGGING, DIALOG
BEGIN BEGIN
LEFTMARGIN, 7 LEFTMARGIN, 7
RIGHTMARGIN, 359 RIGHTMARGIN, 374
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 211 BOTTOMMARGIN, 214
END END
IDD_EXPORT_SPS, DIALOG IDD_EXPORT_SPS, DIALOG
@ -2203,42 +2206,6 @@ END
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (Australia) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\r\0"
END
1 TEXTINCLUDE
BEGIN
"resource.\0"
END
3 TEXTINCLUDE
BEGIN
"\r\0"
END
#endif // APSTUDIO_INVOKED
#endif // English (Australia) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED #ifndef APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View File

@ -36,7 +36,7 @@
// Internals // Internals
#include "../Sound.h" // for soundBufferLen, soundFinalWave and soundQuality #include "../Sound.h" // for soundBufferLen, soundFinalWave and soundQuality
#include "../System.h" // for systemMessage() #include "../System.h" // for systemMessage()
#include "../Globals.h" // for 'speedup' and 'synchronize' #include "../Globals.h"
// Synchronization Event // Synchronization Event
@ -258,8 +258,10 @@ void XAudio2_Output::write()
#ifdef _DEBUG #ifdef _DEBUG
if( vState.BuffersQueued == 0 ) { if( vState.BuffersQueued == 0 ) {
// buffers ran dry // buffers ran dry
static int i = 0; if( systemVerbose & VERBOSE_SOUNDOUTPUT ) {
log( "XAudio2: Buffers were not refilled fast enough (%i)\n", i++ ); static unsigned int i = 0;
log( "XAudio2: Buffers were not refilled fast enough (i=%i)\n", i++ );
}
} }
#endif #endif
break; break;

View File

@ -477,6 +477,8 @@
#define IDC_TITLE 1234 #define IDC_TITLE 1234
#define IDC_VERBOSE_AGBPRINT 1234 #define IDC_VERBOSE_AGBPRINT 1234
#define IDC_CURRENT_ADDRESS 1235 #define IDC_CURRENT_ADDRESS 1235
#define IDC_VERBOSE_AGBPRINT2 1235
#define IDC_VERBOSE_SOUNDOUTPUT 1235
#define IDC_NOTES 1236 #define IDC_NOTES 1236
#define IDC_CURRENT_ADDRESS_LABEL 1236 #define IDC_CURRENT_ADDRESS_LABEL 1236
#define IDC_LOAD 1238 #define IDC_LOAD 1238