diff --git a/src/Globals.h b/src/Globals.h index 72a57f5b..1d5febda 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -32,6 +32,7 @@ #define VERBOSE_DMA3 128 #define VERBOSE_UNDEFINED 256 #define VERBOSE_AGBPRINT 512 +#define VERBOSE_SOUNDOUTPUT 1024 extern reg_pair reg[45]; extern bool ioReadable[0x400]; diff --git a/src/win32/Logging.cpp b/src/win32/Logging.cpp index d1b067f3..26a2873d 100644 --- a/src/win32/Logging.cpp +++ b/src/win32/Logging.cpp @@ -25,6 +25,8 @@ #include "FileDlg.h" #include "Logging.h" +#include "../Globals.h" + #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE @@ -39,6 +41,7 @@ CString Logging::text; Logging::Logging(CWnd* pParent /*=NULL*/) : ResizeDlg(Logging::IDD, pParent) + , m_sound_output(FALSE) { //{{AFX_DATA_INIT(Logging) m_swi = FALSE; @@ -57,25 +60,23 @@ Logging::Logging(CWnd* pParent /*=NULL*/) void Logging::DoDataExchange(CDataExchange* pDX) { - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(Logging) - DDX_Control(pDX, IDC_LOG, m_log); - DDX_Check(pDX, IDC_VERBOSE_SWI, m_swi); - DDX_Check(pDX, IDC_VERBOSE_UNALIGNED_ACCESS, m_unaligned_access); - DDX_Check(pDX, IDC_VERBOSE_ILLEGAL_WRITE, m_illegal_write); - DDX_Check(pDX, IDC_VERBOSE_ILLEGAL_READ, m_illegal_read); - DDX_Check(pDX, IDC_VERBOSE_DMA0, m_dma0); - DDX_Check(pDX, IDC_VERBOSE_DMA1, m_dma1); - DDX_Check(pDX, IDC_VERBOSE_DMA2, m_dma2); - DDX_Check(pDX, IDC_VERBOSE_DMA3, m_dma3); - DDX_Check(pDX, IDC_VERBOSE_AGBPRINT, m_agbprint); - DDX_Check(pDX, IDC_VERBOSE_UNDEFINED, m_undefined); - //}}AFX_DATA_MAP + CDialog::DoDataExchange(pDX); + DDX_Control(pDX, IDC_LOG, m_log); + DDX_Check(pDX, IDC_VERBOSE_SWI, m_swi); + DDX_Check(pDX, IDC_VERBOSE_UNALIGNED_ACCESS, m_unaligned_access); + DDX_Check(pDX, IDC_VERBOSE_ILLEGAL_WRITE, m_illegal_write); + DDX_Check(pDX, IDC_VERBOSE_ILLEGAL_READ, m_illegal_read); + DDX_Check(pDX, IDC_VERBOSE_DMA0, m_dma0); + DDX_Check(pDX, IDC_VERBOSE_DMA1, m_dma1); + DDX_Check(pDX, IDC_VERBOSE_DMA2, m_dma2); + DDX_Check(pDX, IDC_VERBOSE_DMA3, m_dma3); + DDX_Check(pDX, IDC_VERBOSE_AGBPRINT, m_agbprint); + DDX_Check(pDX, IDC_VERBOSE_UNDEFINED, m_undefined); + DDX_Check(pDX, IDC_VERBOSE_SOUNDOUTPUT, m_sound_output); } BEGIN_MESSAGE_MAP(Logging, CDialog) - //{{AFX_MSG_MAP(Logging) ON_BN_CLICKED(ID_OK, OnOk) ON_BN_CLICKED(IDC_CLEAR, OnClear) 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_UNALIGNED_ACCESS, OnVerboseUnalignedAccess) ON_BN_CLICKED(IDC_VERBOSE_UNDEFINED, OnVerboseUndefined) + ON_BN_CLICKED(IDC_VERBOSE_SOUNDOUTPUT, OnVerboseSoundoutput) ON_BN_CLICKED(IDC_SAVE, OnSave) ON_EN_ERRSPACE(IDC_LOG, OnErrspaceLog) ON_EN_MAXTEXT(IDC_LOG, OnMaxtextLog) ON_WM_CLOSE() - //}}AFX_MSG_MAP - END_MESSAGE_MAP() +END_MESSAGE_MAP() - ///////////////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////////////////// // Logging message handlers void Logging::OnOk() @@ -111,54 +113,59 @@ void Logging::OnClear() 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() { - systemVerbose ^= 1; + systemVerbose ^= VERBOSE_SWI; } 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() { - systemVerbose ^= 256; + systemVerbose ^= VERBOSE_UNDEFINED; +} + +void Logging::OnVerboseAgbprint() +{ + systemVerbose ^= VERBOSE_AGBPRINT; +} + +void Logging::OnVerboseSoundoutput() +{ + systemVerbose ^= VERBOSE_SOUNDOUTPUT; } void Logging::OnSave() @@ -216,16 +223,17 @@ BOOL Logging::OnInitDialog() HKEY_CURRENT_USER, "Software\\Emulators\\VisualBoyAdvance\\Viewer\\LogView", NULL); - m_swi = (systemVerbose & 1) != 0; - m_unaligned_access = (systemVerbose & 2) != 0; - m_illegal_write = (systemVerbose & 4) != 0; - m_illegal_read = (systemVerbose & 8) != 0; - m_dma0 = (systemVerbose & 16) != 0; - m_dma1 = (systemVerbose & 32) != 0; - m_dma2 = (systemVerbose & 64) != 0; - m_dma3 = (systemVerbose & 128) != 0; - m_undefined = (systemVerbose & 256) != 0; - m_agbprint = (systemVerbose & 512) != 0; + m_swi = (systemVerbose & VERBOSE_SWI) != 0; + m_unaligned_access = (systemVerbose & VERBOSE_UNALIGNED_MEMORY) != 0; + m_illegal_write = (systemVerbose & VERBOSE_ILLEGAL_WRITE) != 0; + m_illegal_read = (systemVerbose & VERBOSE_ILLEGAL_READ) != 0; + m_dma0 = (systemVerbose & VERBOSE_DMA0) != 0; + m_dma1 = (systemVerbose & VERBOSE_DMA1) != 0; + m_dma2 = (systemVerbose & VERBOSE_DMA2) != 0; + m_dma3 = (systemVerbose & VERBOSE_DMA3) != 0; + m_undefined = (systemVerbose & VERBOSE_UNDEFINED) != 0; + m_agbprint = (systemVerbose & VERBOSE_AGBPRINT) != 0; + m_sound_output = (systemVerbose & VERBOSE_SOUNDOUTPUT) != 0; UpdateData(FALSE); m_log.LimitText(-1); diff --git a/src/win32/Logging.h b/src/win32/Logging.h index 7e6288ee..09e6c219 100644 --- a/src/win32/Logging.h +++ b/src/win32/Logging.h @@ -17,89 +17,68 @@ // along with this program; if not, write to the Free Software Foundation, // 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 -#endif // _MSC_VER > 1000 -// Logging.h : header file -// #include "ResizeDlg.h" + ///////////////////////////////////////////////////////////////////////////// // Logging dialog class Logging : public ResizeDlg { - // Construction - public: - void log(const char *); - void clearLog(); - Logging(CWnd* pParent = NULL); // standard constructor +public: + void log(const char *); + void clearLog(); + Logging(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + enum { IDD = IDD_LOGGING }; + CEdit m_log; + BOOL m_swi; + BOOL m_unaligned_access; + BOOL m_illegal_write; + BOOL m_illegal_read; + BOOL m_dma0; + BOOL m_dma1; + BOOL m_dma2; + BOOL m_dma3; + BOOL m_agbprint; + BOOL m_undefined; + BOOL m_sound_output; - // Dialog Data - //{{AFX_DATA(Logging) - enum { IDD = IDD_LOGGING }; - CEdit m_log; - BOOL m_swi; - BOOL m_unaligned_access; - BOOL m_illegal_write; - BOOL m_illegal_read; - BOOL m_dma0; - BOOL m_dma1; - BOOL m_dma2; - BOOL m_dma3; - BOOL m_agbprint; - BOOL m_undefined; - //}}AFX_DATA +// Overrides +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void PostNcDestroy(); +protected: + afx_msg void OnOk(); + afx_msg void OnClear(); + afx_msg void OnVerboseAgbprint(); + afx_msg void OnVerboseDma0(); + afx_msg void OnVerboseDma1(); + afx_msg void OnVerboseDma2(); + afx_msg void OnVerboseDma3(); + afx_msg void OnVerboseIllegalRead(); + afx_msg void OnVerboseIllegalWrite(); + afx_msg void OnVerboseSwi(); + afx_msg void OnVerboseUnalignedAccess(); + afx_msg void OnVerboseUndefined(); + afx_msg void OnVerboseSoundoutput(); + afx_msg void OnSave(); + afx_msg void OnClose(); + afx_msg void OnErrspaceLog(); + afx_msg void OnMaxtextLog(); + virtual BOOL OnInitDialog(); - // Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(Logging) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual void PostNcDestroy(); - //}}AFX_VIRTUAL - - // Implementation - protected: - - // Generated message map functions - //{{AFX_MSG(Logging) - afx_msg void OnOk(); - afx_msg void OnClear(); - afx_msg void OnVerboseAgbprint(); - afx_msg void OnVerboseDma0(); - afx_msg void OnVerboseDma1(); - afx_msg void OnVerboseDma2(); - afx_msg void OnVerboseDma3(); - afx_msg void OnVerboseIllegalRead(); - afx_msg void OnVerboseIllegalWrite(); - afx_msg void OnVerboseSwi(); - afx_msg void OnVerboseUnalignedAccess(); - afx_msg void OnVerboseUndefined(); - afx_msg void OnSave(); - afx_msg void OnErrspaceLog(); - afx_msg void OnMaxtextLog(); - virtual BOOL OnInitDialog(); - afx_msg void OnClose(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() - public: - static Logging *instance; - static CString text; + DECLARE_MESSAGE_MAP() +public: + static Logging *instance; + static CString text; }; -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - void toolsLogging(); void toolsLoggingClose(); void toolsLog(const char *s); void toolsClearLog(); - - -#endif // !defined(AFX_LOGGING_H__222FC21A_D40D_450D_8A1C_D33305E47B85__INCLUDED_) diff --git a/src/win32/OpenAL.cpp b/src/win32/OpenAL.cpp index f7e99e9c..96c20d87 100644 --- a/src/win32/OpenAL.cpp +++ b/src/win32/OpenAL.cpp @@ -291,10 +291,12 @@ void OpenAL::write() #ifdef _DEBUG 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 ) ) { - // we only want to know about it when we are emulating at full speed (or faster) - static int i = 0; - log( "OpenAL: Buffers were not refilled fast enough (%i)\n", i++ ); + if( systemVerbose & VERBOSE_SOUNDOUTPUT ) { + static int i = 0; + log( "OpenAL: Buffers were not refilled fast enough (i=%i)\n", i++ ); + } } } #endif diff --git a/src/win32/VBA.rc b/src/win32/VBA.rc index f7af9efe..7910bf1c 100644 --- a/src/win32/VBA.rc +++ b/src/win32/VBA.rc @@ -7,10 +7,12 @@ // // Generated from the TEXTINCLUDE 2 resource. // -#include "afxres.h" +#include "afxres.h" + ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS + ///////////////////////////////////////////////////////////////////////////// // English (U.S.) resources @@ -810,26 +812,27 @@ BEGIN LTEXT "",IDC_PORT,143,7,36,8,SS_NOPREFIX 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 CAPTION "Logging" -FONT 8, "MS Sans Serif" +FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN - CONTROL "SWI",IDC_VERBOSE_SWI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,17,87,10 - CONTROL "Unaligned memory",IDC_VERBOSE_UNALIGNED_ACCESS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,30,87,10 - CONTROL "Illegal write",IDC_VERBOSE_ILLEGAL_WRITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,43,87,10 - CONTROL "Illegal read",IDC_VERBOSE_ILLEGAL_READ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,56,87,10 - CONTROL "DMA 0",IDC_VERBOSE_DMA0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,69,87,10 - CONTROL "DMA 1",IDC_VERBOSE_DMA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,82,87,10 - CONTROL "DMA 2",IDC_VERBOSE_DMA2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,95,87,10 - CONTROL "DMA 3",IDC_VERBOSE_DMA3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,108,87,10 - CONTROL "Undefined instruction",IDC_VERBOSE_UNDEFINED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,121,87,10 - CONTROL "AGBPrint",IDC_VERBOSE_AGBPRINT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,134,87,10 - EDITTEXT IDC_LOG,107,7,252,183,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL - PUSHBUTTON "Save...",IDC_SAVE,75,197,50,14 - PUSHBUTTON "Clear",IDC_CLEAR,137,197,50,14 - DEFPUSHBUTTON "OK",ID_OK,197,197,50,14 - GROUPBOX "Verbose",IDC_STATIC,7,7,93,142 + 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,12,36,90,12 + 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,12,72,90,12 + 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,12,108,90,12 + 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,12,144,90,12 + 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,12,180,90,12 + EDITTEXT IDC_LOG,114,6,258,192,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL + PUSHBUTTON "Save...",IDC_SAVE,114,204,48,12 + PUSHBUTTON "Clear",IDC_CLEAR,168,204,48,12 + DEFPUSHBUTTON "OK",ID_OK,324,204,48,12 + GROUPBOX "Verbose",IDC_STATIC,6,6,102,210 + CONTROL "Sound output",IDC_VERBOSE_SOUNDOUTPUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,198,90,12 END IDD_EXPORT_SPS DIALOGEX 0, 0, 248, 148 @@ -1373,9 +1376,9 @@ BEGIN IDD_LOGGING, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 359 + RIGHTMARGIN, 374 TOPMARGIN, 7 - BOTTOMMARGIN, 211 + BOTTOMMARGIN, 214 END 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 ///////////////////////////////////////////////////////////////////////////// diff --git a/src/win32/XAudio2.cpp b/src/win32/XAudio2.cpp index d9a4b806..153cb923 100644 --- a/src/win32/XAudio2.cpp +++ b/src/win32/XAudio2.cpp @@ -36,7 +36,7 @@ // Internals #include "../Sound.h" // for soundBufferLen, soundFinalWave and soundQuality #include "../System.h" // for systemMessage() -#include "../Globals.h" // for 'speedup' and 'synchronize' +#include "../Globals.h" // Synchronization Event @@ -258,8 +258,10 @@ void XAudio2_Output::write() #ifdef _DEBUG if( vState.BuffersQueued == 0 ) { // buffers ran dry - static int i = 0; - log( "XAudio2: Buffers were not refilled fast enough (%i)\n", i++ ); + if( systemVerbose & VERBOSE_SOUNDOUTPUT ) { + static unsigned int i = 0; + log( "XAudio2: Buffers were not refilled fast enough (i=%i)\n", i++ ); + } } #endif break; diff --git a/src/win32/resource.h b/src/win32/resource.h index 32895619..fba68827 100644 --- a/src/win32/resource.h +++ b/src/win32/resource.h @@ -477,6 +477,8 @@ #define IDC_TITLE 1234 #define IDC_VERBOSE_AGBPRINT 1234 #define IDC_CURRENT_ADDRESS 1235 +#define IDC_VERBOSE_AGBPRINT2 1235 +#define IDC_VERBOSE_SOUNDOUTPUT 1235 #define IDC_NOTES 1236 #define IDC_CURRENT_ADDRESS_LABEL 1236 #define IDC_LOAD 1238