Added mail viewer to the HLE DSP plugin. Use it by selecting Mail > Scan mails in the sound debugger.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1109 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2008-11-10 10:32:18 +00:00
parent 6492b21367
commit 814aa547ac
14 changed files with 831 additions and 135 deletions

View File

@ -73,6 +73,7 @@ namespace Core
void Callback_VideoLog(const TCHAR* _szMessage, BOOL _bDoBreak); void Callback_VideoLog(const TCHAR* _szMessage, BOOL _bDoBreak);
void Callback_VideoCopiedToXFB(); void Callback_VideoCopiedToXFB();
void Callback_DSPLog(const TCHAR* _szMessage); void Callback_DSPLog(const TCHAR* _szMessage);
char * Callback_ISOName(void);
void Callback_DSPInterrupt(); void Callback_DSPInterrupt();
void Callback_PADLog(const TCHAR* _szMessage); void Callback_PADLog(const TCHAR* _szMessage);
void Callback_WiimoteLog(const TCHAR* _szMessage); void Callback_WiimoteLog(const TCHAR* _szMessage);
@ -291,6 +292,7 @@ THREAD_RETURN EmuThread(void *pArg)
dspInit.pGetARAMPointer = DSP::GetARAMPtr; dspInit.pGetARAMPointer = DSP::GetARAMPtr;
dspInit.pGetMemoryPointer = Memory::GetPointer; dspInit.pGetMemoryPointer = Memory::GetPointer;
dspInit.pLog = Callback_DSPLog; dspInit.pLog = Callback_DSPLog;
dspInit.pName = Callback_ISOName;
dspInit.pDebuggerBreak = Callback_DebuggerBreak; dspInit.pDebuggerBreak = Callback_DebuggerBreak;
dspInit.pGenerateDSPInterrupt = Callback_DSPInterrupt; dspInit.pGenerateDSPInterrupt = Callback_DSPInterrupt;
dspInit.pGetAudioStreaming = AudioInterface::Callback_GetStreaming; dspInit.pGetAudioStreaming = AudioInterface::Callback_GetStreaming;
@ -556,7 +558,20 @@ void Callback_PADLog(const TCHAR* _szMessage)
LOG(SERIALINTERFACE, _szMessage); LOG(SERIALINTERFACE, _szMessage);
} }
// __________________________________________________________________________________________________
// Callback_ISOName: Let the DSP plugin get the game name
//
//std::string Callback_ISOName(void)
char * Callback_ISOName(void)
{
char * a = "";
if(g_CoreStartupParameter.m_strName.length() > 0)
return (char *)g_CoreStartupParameter.m_strName.c_str();
else
return a;
}
// __________________________________________________________________________________________________
// Called from ANY thread! // Called from ANY thread!
void Callback_KeyPress(int key, BOOL shift, BOOL control) void Callback_KeyPress(int key, BOOL shift, BOOL control)
{ {

View File

@ -73,6 +73,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBios _BootBios)
PanicAlert("Your GCM/ISO file seems to be invalid, or not a GC/Wii ISO."); PanicAlert("Your GCM/ISO file seems to be invalid, or not a GC/Wii ISO.");
return false; return false;
} }
m_strName = pVolume->GetName();
m_strUniqueID = pVolume->GetUniqueID(); m_strUniqueID = pVolume->GetUniqueID();
bWii = DiscIO::IsVolumeWiiDisc(pVolume); bWii = DiscIO::IsVolumeWiiDisc(pVolume);

View File

@ -92,6 +92,7 @@ struct SCoreStartupParameter
std::string m_strDefaultGCM; std::string m_strDefaultGCM;
std::string m_strDVDRoot; std::string m_strDVDRoot;
std::string m_strUniqueID; std::string m_strUniqueID;
std::string m_strName;
// //
SCoreStartupParameter(); SCoreStartupParameter();

View File

@ -6,13 +6,13 @@
#define _DSP_H_INCLUDED__ #define _DSP_H_INCLUDED__
#include "PluginSpecs.h" #include "PluginSpecs.h"
#include "ExportProlog.h" #include "ExportProlog.h"
typedef unsigned char (*TARAM_Read_U8)(const unsigned int _uAddress); typedef unsigned char (*TARAM_Read_U8)(const unsigned int _uAddress);
typedef unsigned char* (*TGetMemoryPointer)(const unsigned int _uAddress); typedef unsigned char* (*TGetMemoryPointer)(const unsigned int _uAddress);
typedef unsigned char* (*TGetARAMPointer)(void); typedef unsigned char* (*TGetARAMPointer)(void);
typedef void (*TLog)(const char* _szMessage); typedef void (*TLog)(const char* _szMessage);
typedef char * (*TName)(void);
typedef void (*TDebuggerBreak)(void); typedef void (*TDebuggerBreak)(void);
typedef void (*TGenerateDSPInt)(void); typedef void (*TGenerateDSPInt)(void);
typedef unsigned int(*TAudioGetStreaming)(short* _pDestBuffer, unsigned int _numSamples); typedef unsigned int(*TAudioGetStreaming)(short* _pDestBuffer, unsigned int _numSamples);
@ -24,6 +24,7 @@ typedef struct
TGetMemoryPointer pGetMemoryPointer; TGetMemoryPointer pGetMemoryPointer;
TGetARAMPointer pGetARAMPointer; TGetARAMPointer pGetARAMPointer;
TLog pLog; TLog pLog;
TName pName;
TDebuggerBreak pDebuggerBreak; TDebuggerBreak pDebuggerBreak;
TGenerateDSPInt pGenerateDSPInterrupt; TGenerateDSPInt pGenerateDSPInterrupt;
TAudioGetStreaming pGetAudioStreaming; TAudioGetStreaming pGetAudioStreaming;

View File

@ -19,22 +19,22 @@
// //
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// includes
#include <iostream>
#include <fstream>
#include "Debugger.h" #include "Debugger.h"
#include "PBView.h" #include "PBView.h"
#include "IniFile.h" #include "IniFile.h"
#include "FileUtil.h"
#include "StringUtil.h"
#include "FileSearch.h"
#include "../Logging/Console.h" // open and close console #include "../Logging/Console.h" // open and close console
// externals // externals
extern int gSaveFile; // make this an int to allow multiple save file options extern std::vector<std::string> sMailLog, sMailTime;
extern int gUpdFreq;
extern int gPreset;
extern bool gReset;
extern bool gSSBM;
extern bool gSSBMremedy1;
extern bool gSSBMremedy2;
extern bool gSequenced;
extern bool gVolume;
extern bool gOnlyLooping;
// ======================================================================================= // =======================================================================================
// Declare events // Declare events
@ -52,6 +52,12 @@ BEGIN_EVENT_TABLE(CDebugger,wxDialog)
EVT_RADIOBOX(IDC_RADIO2,CDebugger::ChangePreset) // presets EVT_RADIOBOX(IDC_RADIO2,CDebugger::ChangePreset) // presets
EVT_CHECKLISTBOX(IDC_CHECKLIST1, CDebugger::OnSettingsCheck) // settings EVT_CHECKLISTBOX(IDC_CHECKLIST1, CDebugger::OnSettingsCheck) // settings
EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, CDebugger::UpdateMail) // mails
EVT_RADIOBOX(IDC_RADIO3,CDebugger::ChangeMail)
EVT_CHECKLISTBOX(IDC_CHECKLIST2, CDebugger::OnGameChange) // gc
EVT_CHECKLISTBOX(IDC_CHECKLIST3, CDebugger::OnGameChange) // wii
EVT_CHECKLISTBOX(IDC_CHECKLIST4, CDebugger::MailSettings) // settings
END_EVENT_TABLE() END_EVENT_TABLE()
// ======================================================================================= // =======================================================================================
@ -60,6 +66,14 @@ CDebugger::CDebugger(wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &position, const wxSize& size, long style) const wxPoint &position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style) : wxDialog(parent, id, title, position, size, style)
, m_GPRListView(NULL) , m_GPRListView(NULL)
//, gUpdFreq(5) // loaded from file
, gPreset(0)
, gSSBM(true)
, gSSBMremedy1(true)
, gSSBMremedy2(true)
, gSequenced(true)
, gVolume(true)
, gReset(false)
{ {
CreateGUIControls(); CreateGUIControls();
@ -92,6 +106,8 @@ void CDebugger::Save(IniFile& _IniFile) const
} }
_IniFile.Set("SoundWindow", "Console", m_Check[2]->IsChecked()); // save settings _IniFile.Set("SoundWindow", "Console", m_Check[2]->IsChecked()); // save settings
_IniFile.Set("SoundWindow", "UpdateFrequency", m_RadioBox[1]->GetSelection()); _IniFile.Set("SoundWindow", "UpdateFrequency", m_RadioBox[1]->GetSelection());
_IniFile.Set("SoundWindow", "ScanMails", m_gcwiiset->IsChecked(0));
_IniFile.Set("SoundWindow", "StoreMails", m_gcwiiset->IsChecked(1));
} }
@ -110,45 +126,105 @@ void CDebugger::Load(IniFile& _IniFile)
m_Check[2]->SetValue(Console); m_Check[2]->SetValue(Console);
DoShowHideConsole(); DoShowHideConsole();
int UpdateFrequency; _IniFile.Get("SoundWindow", "UpdateFrequency", &gUpdFreq, m_RadioBox[1]->GetSelection());
_IniFile.Get("SoundWindow", "UpdateFrequency", &UpdateFrequency, m_RadioBox[1]->GetSelection()); m_RadioBox[1]->SetSelection(gUpdFreq);
m_RadioBox[1]->SetSelection(UpdateFrequency); //DoChangeFrequency();
DoChangeFrequency();
// Read and store mails on/off
_IniFile.Get("SoundWindow", "ScanMails", &ScanMails, m_gcwiiset->IsChecked(0));
m_gcwiiset->Check(0, ScanMails);
_IniFile.Get("SoundWindow", "StoreMails", &StoreMails, m_gcwiiset->IsChecked(1));
m_gcwiiset->Check(1, StoreMails);
} }
void CDebugger::CreateGUIControls() void CDebugger::CreateGUIControls()
{ {
SetTitle(wxT("Sound Debugging")); SetTitle(wxT("Sound Debugging"));
// basic settings // Basic settings
SetIcon(wxNullIcon); SetIcon(wxNullIcon);
SetSize(8, 8, 200, 100); // these will become the minimin sizes allowed by resizing SetSize(8, 8, 200, 100); // these will become the minimin sizes allowed by resizing
Center(); 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 // Declarations
wxBoxSizer* sMain; wxBoxSizer * sMAIN, * sMain, * sMail;
wxButton* m_Upd; wxButton* m_Upd;
wxButton* m_SelC; wxButton* m_SelC;
wxButton* m_Presets; wxButton* m_Presets;
wxStaticBoxSizer* sLeft; wxStaticBoxSizer* sLeft;
// checkboxes and labels ----------------------------------------------------- int m_radioBoxNChoices[3];
wxStaticBoxSizer * m_checkSizer = new wxStaticBoxSizer (wxVERTICAL, this, wxT("Options"));
// Notebook -----------------------------------------------------
m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
m_PageMain = new wxPanel(m_Notebook, ID_PAGEMAIN, wxDefaultPosition, wxDefaultSize);
m_Notebook->AddPage(m_PageMain, wxT("Main"));
m_PageMail = new wxPanel(m_Notebook, ID_PAGEMAIL, wxDefaultPosition, wxDefaultSize);
m_Notebook->AddPage(m_PageMail, wxT("Mail"));
// ===================================================================
// Mail Page
wxStaticBoxSizer * m_m1Sizer = new wxStaticBoxSizer (wxVERTICAL, m_PageMail, wxT("Entire mail"));
m_log = new wxTextCtrl(m_PageMail, ID_LOG, _T(""), wxDefaultPosition, wxSize(175, 120),
wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP | wxNO_BORDER);
m_m1Sizer->Add(m_log, 1, wxEXPAND | wxALL, 0);
wxStaticBoxSizer * m_m2Sizer = new wxStaticBoxSizer (wxVERTICAL, m_PageMail, wxT("Logged mail"));
m_log1 = new wxTextCtrl(m_PageMail, ID_LOG1, _T(""), wxDefaultPosition, wxSize(300, 120),
wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP | wxNO_BORDER );
m_m2Sizer->Add(m_log1, 1, wxEXPAND | wxALL, 0);
// Show different mails, make room for five mails, in usual circumstances it's two or three
wxString m_radioBoxChoices3[] = { wxT("0"), wxT("1"), wxT("2"), wxT("3"), wxT("4") };
m_radioBoxNChoices[3] = sizeof( m_radioBoxChoices3 ) / sizeof( wxString );
m_RadioBox[3] = new wxRadioBox( m_PageMail, IDC_RADIO3, wxT("Show mail"),
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[3], m_radioBoxChoices3, 1, wxRA_SPECIFY_COLS);
m_RadioBox[3]->Enable(false);
// Games checkboxes (m_PageMail) -----------------------------
wxStaticBoxSizer * m_gameSizer1 = new wxStaticBoxSizer(wxVERTICAL, m_PageMail, wxT("GC"));
m_gc = new wxCheckListBox(m_PageMail, IDC_CHECKLIST2, wxDefaultPosition, wxDefaultSize,
0, NULL, wxNO_BORDER | wxLB_SINGLE);
m_gameSizer1->Add(m_gc, 1, wxEXPAND | wxALL, 0);
wxStaticBoxSizer * m_gameSizer2 = new wxStaticBoxSizer(wxVERTICAL, m_PageMail, wxT("Wii"));
m_wii = new wxCheckListBox(m_PageMail, IDC_CHECKLIST3, wxDefaultPosition, wxDefaultSize,
0, NULL, wxNO_BORDER | wxLB_SINGLE);
m_gameSizer2->Add(m_wii, 1, wxEXPAND | wxALL, 0);
// Settings
wxStaticBoxSizer * m_gameSizer3 = new wxStaticBoxSizer(wxVERTICAL, m_PageMail, wxT("Settings"));
m_gcwiiset = new wxCheckListBox(m_PageMail, IDC_CHECKLIST4, wxDefaultPosition, wxDefaultSize,
0, NULL, wxNO_BORDER | wxLB_SINGLE);
m_gameSizer3->Add(m_gcwiiset, 0, 0, 0);
m_gcwiiset->Append(wxT("Scan mails"));
m_gcwiiset->Append(wxT("Store mails"));
// ===================================================================
// Main Page
// Options checkboxlist (m_PageMain) -----------------------------------
wxStaticBoxSizer * m_checkSizer = new wxStaticBoxSizer (wxVERTICAL, m_PageMain, wxT("Options"));
// checkboxes // checkboxes
m_Check[0] = new wxCheckBox(this, IDC_CHECK1, wxT("Save to file"), m_Check[0] = new wxCheckBox(m_PageMain, IDC_CHECK1, wxT("Save to file"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[1] = new wxCheckBox(this, IDC_CHECK2, wxT("Show updated"), m_Check[1] = new wxCheckBox(m_PageMain, IDC_CHECK2, wxT("Show updated"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[1]->Enable(false); m_Check[1]->Enable(false);
m_Check[7] = new wxCheckBox(this, IDC_CHECK3, wxT("Only looping"), m_Check[7] = new wxCheckBox(m_PageMain, IDC_CHECK3, wxT("Only looping"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[2] = new wxCheckBox(this, IDC_CHECK4, wxT("Show console"), m_Check[2] = new wxCheckBox(m_PageMain, IDC_CHECK4, wxT("Show console"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_checkSizer->Add(m_Check[0], 0, 0, 5); m_checkSizer->Add(m_Check[0], 0, 0, 5);
@ -157,9 +233,11 @@ SetTitle(wxT("Sound Debugging"));
m_checkSizer->Add(m_Check[2], 0, 0, 5); m_checkSizer->Add(m_Check[2], 0, 0, 5);
// ------------------------ // ------------------------
// settings checkboxes -----------------------------------------------------
wxStaticBoxSizer * m_checkSizer2 = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Settings"));
m_settings = new wxCheckListBox(this, IDC_CHECKLIST1, wxDefaultPosition, wxDefaultSize, // Settings checkboxes (m_PageMain) -----------------------------
wxStaticBoxSizer * m_checkSizer2 = new wxStaticBoxSizer(wxVERTICAL, m_PageMain, wxT("Settings"));
m_settings = new wxCheckListBox(m_PageMain, IDC_CHECKLIST1, wxDefaultPosition, wxDefaultSize,
0, NULL, wxNO_BORDER); 0, NULL, wxNO_BORDER);
m_settings->Append(wxT("SSBM fix")); m_settings->Append(wxT("SSBM fix"));
@ -182,43 +260,49 @@ SetTitle(wxT("Sound Debugging"));
m_settings->SetMinSize(wxSize(m_settings->GetSize().GetWidth() - 40, m_settings->SetMinSize(wxSize(m_settings->GetSize().GetWidth() - 40,
m_settings->GetCount() * 15)); m_settings->GetCount() * 15));
#ifdef _WIN32 #ifdef _WIN32
for (int i = 0; i < m_settings->GetCount(); ++i) //for (int i = 0; i < m_settings->GetCount(); ++i)
m_settings->GetItem(i)->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)); // m_settings->GetItem(i)->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
#endif #endif
m_checkSizer2->Add(m_settings, 0, 0, 0); m_checkSizer2->Add(m_settings, 0, 0, 0);
// ------------------------ // ------------------------
// radio boxes -----------------------------------------------------
int m_radioBoxNChoices[2];
// Update frequency, numeric base, presets radio boxes --------------------
wxString m_radioBoxChoices0[] = { wxT("Show base 10"), wxT("Show base 16") }; wxString m_radioBoxChoices0[] = { wxT("Show base 10"), wxT("Show base 16") };
m_radioBoxNChoices[0] = sizeof( m_radioBoxChoices0 ) / sizeof( wxString ); m_radioBoxNChoices[0] = sizeof( m_radioBoxChoices0 ) / sizeof( wxString );
m_RadioBox[0] = new wxRadioBox( this, IDC_RADIO0, wxT("Show base"), m_RadioBox[0] = new wxRadioBox( m_PageMain, IDC_RADIO0, wxT("Show base"),
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[0], m_radioBoxChoices0, 1, wxRA_SPECIFY_COLS); wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[0], m_radioBoxChoices0, 1, wxRA_SPECIFY_COLS);
m_RadioBox[0]->Enable(false); m_RadioBox[0]->Enable(false);
wxString m_radioBoxChoices1[] = { wxT("Never"), wxT("5 times/s"), wxT("15 times/s"), wxT("30 times/s") }; wxString m_radioBoxChoices1[] = { wxT("Never"), wxT("5 times/s"), wxT("15 times/s"), wxT("30 times/s") };
m_radioBoxNChoices[1] = sizeof( m_radioBoxChoices1 ) / sizeof( wxString ); m_radioBoxNChoices[1] = sizeof( m_radioBoxChoices1 ) / sizeof( wxString );
m_RadioBox[1] = new wxRadioBox( this, IDC_RADIO1, wxT("Update freq."), m_RadioBox[1] = new wxRadioBox( m_PageMain, IDC_RADIO1, wxT("Update freq."),
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[1], m_radioBoxChoices1, 1, wxRA_SPECIFY_COLS); wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[1], m_radioBoxChoices1, 1, wxRA_SPECIFY_COLS);
wxString m_radioBoxChoices2[] = { wxT("Preset 1"), wxT("Updates"), wxT("Looping"), wxT("Mixer") }; wxString m_radioBoxChoices2[] = { wxT("Preset 1"), wxT("Updates"), wxT("Looping"), wxT("Mixer") };
m_radioBoxNChoices[2] = sizeof( m_radioBoxChoices2 ) / sizeof( wxString ); m_radioBoxNChoices[2] = sizeof( m_radioBoxChoices2 ) / sizeof( wxString );
m_RadioBox[2] = new wxRadioBox( this, IDC_RADIO2, wxT("Presets"), m_RadioBox[2] = new wxRadioBox( m_PageMain, IDC_RADIO2, wxT("Presets"),
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[2], m_radioBoxChoices2, 1, wxRA_SPECIFY_COLS); wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[2], m_radioBoxChoices2, 1, wxRA_SPECIFY_COLS);
// ------------------------ // ------------------------
// buttons
m_Upd = new wxButton(this, ID_UPD, wxT("Update"), // --------------------------------------------------------------------
// Buttons
// ------------------------
m_Upd = new wxButton(m_PageMain, ID_UPD, wxT("Update"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_SelC = new wxButton(this, ID_SELC, wxT("Select Columns"), m_SelC = new wxButton(m_PageMain, ID_SELC, wxT("Select Columns"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_SelC->Enable(false); m_SelC->Enable(false);
m_Presets = new wxButton(this, ID_PRESETS, wxT("Presets"), m_Presets = new wxButton(m_PageMain, ID_PRESETS, wxT("Presets"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Presets->Enable(false); m_Presets->Enable(false);
// --------------------------------------------------------------------
// right buttons
// --------------------------------------------------------------------
// Right buttons and checkboxes (MAIN)
// ------------------------
wxBoxSizer* sButtons2; wxBoxSizer* sButtons2;
sButtons2 = new wxBoxSizer(wxVERTICAL); sButtons2 = new wxBoxSizer(wxVERTICAL);
@ -228,7 +312,7 @@ SetTitle(wxT("Sound Debugging"));
sButtons2->Add(m_checkSizer2, 0, 0, 5); sButtons2->Add(m_checkSizer2, 0, 0, 5);
sButtons2->AddStretchSpacer(1); sButtons2->AddStretchSpacer(1);
// left buttons // Left buttons and checkboxes
wxBoxSizer* sButtons; wxBoxSizer* sButtons;
sButtons = new wxBoxSizer(wxVERTICAL); sButtons = new wxBoxSizer(wxVERTICAL);
@ -246,22 +330,63 @@ SetTitle(wxT("Sound Debugging"));
sButtons->Add(m_RadioBox[1], 0, 0, 5); sButtons->Add(m_RadioBox[1], 0, 0, 5);
sButtons->AddSpacer(5); sButtons->AddSpacer(5);
// --------------------------------------------------------------------
// --------------------------------------------------------------------
// Parameter tables view (MAIN)
sLeft = new wxStaticBoxSizer(wxVERTICAL, m_PageMain, wxT("Current Status"));
// The big window that holds the parameter tables
m_GPRListView = new CPBView(m_PageMain, ID_GPR, wxDefaultPosition, GetSize(),
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT | wxLC_SINGLE_SEL | wxLC_SORT_ASCENDING);
// blocks view
sLeft = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Current Status"));
sLeft->Add(m_GPRListView, 1, wxEXPAND|wxALL, 5); sLeft->Add(m_GPRListView, 1, wxEXPAND|wxALL, 5);
// --------------------------------------------------------------------
// add all stuff to the main container
// --------------------------------------------------------------------
// Add all stuff to the mail container (MAIL)
// -----------------------------
// For the buttons on the right
wxBoxSizer * sMailRight = new wxBoxSizer(wxVERTICAL);
//wxStaticBoxSizer * sMailRight = new wxStaticBoxSizer(wxVERTICAL, m_PageMail, wxT("Current"));
sMail = new wxBoxSizer(wxHORIZONTAL);
sMail->Add(m_m1Sizer, 0, wxEXPAND | (wxUP | wxDOWN), 5); // margin = 5
sMail->Add(m_m2Sizer, 1, wxEXPAND | (wxUP | wxDOWN | wxLEFT), 5); // margin = 5
sMail->Add(sMailRight, 0, wxEXPAND | wxALL, 0); // margin = 0
sMailRight->Add(m_RadioBox[3], 0, wxALL, 5); // margin = 5
sMailRight->Add(m_gameSizer1, 1, wxEXPAND | wxALL, 5); // margin = 5
sMailRight->Add(m_gameSizer2, 1, wxEXPAND | wxALL, 5); // margin = 5
sMailRight->Add(m_gameSizer3, 0, wxALL, 5); // margin = 5
// --------------------------------------------------------------------
// --------------------------------------------------------------------
// Main containers
// -----------------------------
sMain = new wxBoxSizer(wxHORIZONTAL); sMain = new wxBoxSizer(wxHORIZONTAL);
sMain->Add(sLeft, 1, wxEXPAND | wxALL, 5); // margin = 5 sMain->Add(sLeft, 1, wxEXPAND | wxALL, 5); // margin = 5
sMain->Add(sButtons, 0, wxALL, 0); sMain->Add(sButtons, 0, wxALL, 0);
sMain->Add(sButtons2, 0, wxALL, 5); // margin = 5 sMain->Add(sButtons2, 0, wxALL, 5); // margin = 5
this->SetSizer(sMain); sMAIN = new wxBoxSizer(wxVERTICAL);
sMain->SetSizeHints(this); sMAIN->Add(m_Notebook, 1, wxEXPAND | wxALL, 5);
//sMAIN->SetSizeHints(this);
this->SetSizer(sMAIN);
//this->Layout();
m_PageMain->SetSizer(sMain);
m_PageMail->SetSizer(sMail);
//sMain->Layout();
NotifyUpdate(); NotifyUpdate();
// --------------------------------------------------------------------
} }
void CDebugger::OnClose(wxCloseEvent& /*event*/) void CDebugger::OnClose(wxCloseEvent& /*event*/)
@ -296,6 +421,7 @@ void CDebugger::OnSettingsCheck(wxCommandEvent& event)
gSequenced = m_settings->IsChecked(3); gSequenced = m_settings->IsChecked(3);
gVolume = m_settings->IsChecked(4); gVolume = m_settings->IsChecked(4);
gReset = m_settings->IsChecked(5); gReset = m_settings->IsChecked(5);
} }
// ======================================================================================= // =======================================================================================
@ -384,14 +510,9 @@ void CDebugger::OnlyLooping(wxCommandEvent& event)
void CDebugger::SaveFile(wxCommandEvent& event) void CDebugger::SaveFile(wxCommandEvent& event)
{ {
if(m_Check[0]->IsChecked()) if(m_Check[0]->IsChecked())
{
gSaveFile = 1; gSaveFile = 1;
}
else else
{
gSaveFile = 0; gSaveFile = 0;
}
} }
// ============== // ==============
@ -425,3 +546,247 @@ void CDebugger::NotifyUpdate()
m_GPRListView->Update(); m_GPRListView->Update();
} }
} }
// =======================================================================================
// Update mail window
// --------------
void CDebugger::DoUpdateMail()
{
//wprintf("i %i %i\n", sFullMail.size(), sMailLog.size());
if(sFullMail.size() > 0 && sMailLog.size() > 0)
{
m_log->SetValue(sFullMail.at(m_RadioBox[3]->GetSelection()).c_str());
m_log->SetDefaultStyle(wxTextAttr(*wxBLUE)); // doesn't work because of the current wx
m_log1->SetValue(sMailLog.at(m_RadioBox[3]->GetSelection()).c_str());
m_log1->AppendText(wxT("\n\n"));
}
}
void CDebugger::UpdateMail(wxNotebookEvent& event)
{
DoUpdateMail();
if(StoreMails) ReadDir();
}
// Change mail from radio button change
void CDebugger::ChangeMail(wxCommandEvent& event)
{
//wprintf("abc");
DoUpdateMail();
//if(StoreMails) ReadDir();
}
// ==============
// =======================================================================================
// Read out mails from dir
// --------------
void CDebugger::ReadDir()
{
CFileSearch::XStringVector Directories;
Directories.push_back("Logs/Mail");
CFileSearch::XStringVector Extensions;
Extensions.push_back("*.log");
CFileSearch FileSearch(Extensions, Directories);
const CFileSearch::XStringVector& rFilenames = FileSearch.GetFileNames();
//m_gc->Show(false);
//m_gc->Append(wxT("SSBM ffffix"));
//m_gc->Show(true);
// Clear in case we already did this earlier
all_all_files.clear();
if (rFilenames.size() > 0 && m_gc && m_wii)
{
for (u32 i = 0; i < rFilenames.size(); i++)
{
std::string FileName;
SplitPath(rFilenames[i], NULL, &FileName, NULL); // place the filename in FileName
//std::string FileName = StripSpaces(*FileName);
std::vector<std::string> pieces;
SplitString(FileName, "_sep", pieces); // split string
// Save all filenames heres
if(pieces[2] == "0") all_all_files.push_back(pieces[0]);
// Cut to size
std::string cut;
if(pieces[0].length() > 18)
cut = pieces[0].substr(0, 18) + "...";
else
cut = pieces[0];
//wprintf("%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)
{
all_files.push_back(pieces[0]);
if (pieces[3] == "GC")
{
gc_files.push_back(pieces[0]);
m_gc->Append(wxString::FromAscii(cut.c_str()));
}
else
{
wii_files.push_back(pieces[0]);
m_wii->Append(wxString::FromAscii(cut.c_str()));
}
}
}
}
}
// =======================================================================================
// Check for duplicates and count files from all_all_files
// --------------
bool CDebugger::NoDuplicate(std::string FileName)
{
for (int i = 0; i < all_files.size(); i++)
{
if(all_files.at(i) == FileName)
return false;
}
return true;
}
// Count the number of files for each game
int CDebugger::CountFiles(std::string FileName)
{
int match = 0;
for (u32 i = 0; i < all_all_files.size(); i++)
{
//wprintf("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);
return match;
}
// ==============
// =======================================================================================
// Read file from harddrive
// --------------
std::string CDebugger::Readfile_(std::string FileName)
{
char c; // declare a char variable
FILE *file; // declare a FILE pointer
std::string sz = "";
char ch[1] = "";
if(File::Exists(FileName.c_str()))
file = fopen(FileName.c_str(), "r"); // open a text file for reading
else
return "";
if(file == NULL)
{
// file could not be opened
}
else
{
while(1) // looping through file
{
c = fgetc(file);
if(c != EOF)
sz += c; // print the file one character at a time
else
break; // break when EOF is reached
}
fclose(file);
return sz;
}
}
// Read file
void CDebugger::Readfile(std::string FileName, bool GC)
{
int n = CountFiles(FileName);
int curr_n = 0;
std::ifstream file;
for (int i = 0; i < m_RadioBox[3]->GetCount(); i++)
{
if(m_RadioBox[3]->IsItemEnabled(i)) curr_n++;
m_RadioBox[3]->Enable(i, false); // disable all
}
//wprintf("Disabled all: n %i\n", n);
for (int i = 0; i < n; i++)
{
m_RadioBox[3]->Enable(i, true); // then anble the right ones
//wprintf("m_RadioBox[3] enabled: %i\n", i);
std::string sz = "";
char ci[10]; itoa(i, ci, 10);
std::string f0 = "Logs/Mail/" + FileName + "_sep" + ci + "_sep" + "0_sep" + (GC ? "GC" : "Wii") + "_sep.log";
std::string f1 = "Logs/Mail/" + FileName + "_sep" + ci + "_sep" + "1_sep" + (GC ? "GC" : "Wii") + "_sep.log";
//wprintf("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);
if(Readfile_(f0).length() > 0) sFullMail.at(i) = Readfile_(f0);
else sFullMail.at(i) = "";
if(Readfile_(f1).length() > 0) sMailLog.at(i) = Readfile_(f1);
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);
DoUpdateMail();
}
// ==============
// =======================================================================================
// Only allow one selected game at a time
// ---------------
void CDebugger::OnGameChange(wxCommandEvent& event)
{
if(event.GetId() == 2006)
{
for (int i = 0; i < m_gc->GetCount(); ++i)
if(i != event.GetInt()) m_gc->Check(i, false);
for (int i = 0; i < m_wii->GetCount(); ++i)
m_wii->Check(i, false);
Readfile(gc_files[event.GetInt()], true);
}
else
{
for (int i = 0; i < m_gc->GetCount(); ++i)
m_gc->Check(i, false);
for (int i = 0; i < m_wii->GetCount(); ++i)
if(i != event.GetInt()) m_wii->Check(i, false);
Readfile(wii_files[event.GetInt()], false);
}
}
// Settings
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());
ScanMails = m_gcwiiset->IsChecked(0);
StoreMails = m_gcwiiset->IsChecked(1);
}
// ==============

View File

@ -22,6 +22,9 @@
#ifndef __CDebugger_h__ #ifndef __CDebugger_h__
#define __CDebugger_h__ #define __CDebugger_h__
// general things
#include <iostream>
#include <vector>
// wx stuff, I'm not sure if we use all these // wx stuff, I'm not sure if we use all these
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
@ -35,8 +38,10 @@
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/statbox.h> #include <wx/statbox.h>
#include <wx/statbmp.h> #include <wx/statbmp.h>
#include <wx/datetime.h> // for the timestamps
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/notebook.h>
#include <wx/filepicker.h> #include <wx/filepicker.h>
#include <wx/listctrl.h> #include <wx/listctrl.h>
#include <wx/imaglist.h> #include <wx/imaglist.h>
@ -46,9 +51,8 @@
class CPBView; class CPBView;
class IniFile; class IniFile;
// Window settings - I'm not sure what these do. I just copied them gtom elsewhere basically. // Window settings
#undef CDebugger_STYLE #undef CDebugger_STYLE
#define CDebugger_STYLE wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE #define CDebugger_STYLE wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE
class CDebugger : public wxDialog class CDebugger : public wxDialog
@ -82,17 +86,53 @@ class CDebugger : public wxDialog
void OnSettingsCheck(wxCommandEvent& event); // settings void OnSettingsCheck(wxCommandEvent& event); // settings
// ============== Mail
void DoUpdateMail();
void UpdateMail(wxNotebookEvent& event);
void ChangeMail(wxCommandEvent& event);
void ReadDir();
bool NoDuplicate(std::string FileName);
void OnGameChange(wxCommandEvent& event);
void MailSettings(wxCommandEvent& event);
void Readfile(std::string FileName, bool GC);
std::string Readfile_(std::string FileName);
int CountFiles(std::string FileName);
CPBView* m_GPRListView; CPBView* m_GPRListView;
std::vector<std::string> sMail, sMailEnd, sFullMail;
wxRadioBox *m_RadioBox[4];
bool gSaveFile; // main options
bool gOnlyLooping;
int gUpdFreq;// main update freq.
bool gPreset; // main presets
bool gSSBM; // main settings
bool gSSBMremedy1;
bool gSSBMremedy2;
bool gSequenced;
bool gVolume;
bool gReset;
bool ScanMails; // mail settings
bool StoreMails;
private: private:
// declarations // declarations
wxNotebook *m_Notebook; // notebook
wxPanel *m_PageMain;
wxPanel *m_PageMail;
wxTextCtrl * m_log, * m_log1; // mail
wxCheckBox *m_Check[9]; wxCheckBox *m_Check[9];
wxRadioButton *m_Radio[5]; wxRadioButton *m_Radio[5];
wxRadioBox *m_RadioBox[3]; wxCheckListBox * m_settings, * m_gc, * m_wii, * m_gcwiiset;
wxCheckListBox * m_settings;
wxPanel *m_Controller; wxPanel *m_Controller;
std::vector<std::string> all_all_files, all_files, gc_files, wii_files;
// WARNING: Make sure these are not also elsewhere, for example in resource.h. // WARNING: Make sure these are not also elsewhere, for example in resource.h.
enum enum
{ {
@ -101,17 +141,18 @@ class CDebugger : public wxDialog
IDC_CHECK2, IDC_CHECK2,
IDC_CHECK3, IDC_CHECK3,
IDC_CHECK4, IDC_CHECK4,
IDC_CHECKLIST1, IDC_CHECKLIST1, IDC_CHECKLIST2, IDC_CHECKLIST3, IDC_CHECKLIST4,
IDC_RADIO0, IDC_RADIO0, IDC_RADIO1, IDC_RADIO2, IDC_RADIO3,
IDC_RADIO1, IDG_LABEL1, IDG_LABEL2,
IDC_RADIO2,
IDC_RADIO3,
IDG_LABEL1,
IDG_LABEL2,
ID_UPD, ID_UPD,
ID_SELC, ID_SELC,
ID_PRESETS, ID_PRESETS,
ID_GPR, ID_GPR,
ID_NOTEBOOK, // notebook
ID_PAGEMAIN,
ID_PAGEMAIL,
ID_LOG, // mails
ID_LOG1,
ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values
}; };

View File

@ -1,3 +1,20 @@
// 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 <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
@ -11,7 +28,8 @@ void __Log(int, const char *fmt, ...)
void DebugLog(const char* _fmt, ...) void DebugLog(const char* _fmt, ...)
{ {
#if defined(_DEBUG) || defined(DEBUGFAST) #if defined(_DEBUG) || defined(DEBUGFAST)
if(strncmp (_fmt, "AX", 2)) // match = 0, in that case this is ignored //if(strncmp (_fmt, "AX", 2)) // match = 0, in that case this is ignored
if(true)
{ {
char Msg[512]; char Msg[512];
va_list ap; va_list ap;

View File

@ -23,7 +23,6 @@
// Includes // Includes
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <string> // so that we can test std::string == abc #include <string> // so that we can test std::string == abc
@ -44,18 +43,11 @@
// Externals // Externals
u32 gLastBlock;
extern int nFiles; extern int nFiles;
float ratioFactor; // a global to get the ratio factor from MixAdd float ratioFactor; // a global to get the ratio factor from MixAdd
int gUpdFreq = 5; extern CDebugger* m_frame;
int gPreset = 0;
extern bool gSSBM;
extern bool gSSBMremedy1;
extern bool gSSBMremedy2;
extern bool gSequenced;
extern bool gVolume;
extern bool gReset;
bool gOnlyLooping = false;
extern int gSaveFile;
// Parameter blocks // Parameter blocks
@ -292,7 +284,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
// Prepare conditions // Prepare conditions
// -------------- // --------------
bool Conditions; bool Conditions;
if (gOnlyLooping) if (m_frame->gOnlyLooping)
{ {
Conditions = PBs[i].audio_addr.looping; Conditions = PBs[i].audio_addr.looping;
} }
@ -404,7 +396,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
if(a == 0) j++; if(a == 0) j++;
//if(l == pow((double)2,32)) l=0; // reset l //if(l == pow((double)2,32)) l=0; // reset l
//l++; //l++;
if (gUpdFreq > 0 && j > (200/gUpdFreq)) if (m_frame->gUpdFreq > 0 && j > (200/m_frame->gUpdFreq))
{ {
// ======================================================================================= // =======================================================================================
@ -480,7 +472,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
// -------------- // --------------
char buffer [1000] = ""; char buffer [1000] = "";
std::string sbuff; std::string sbuff;
sbuff = writeTitle(gPreset); sbuff = writeTitle(m_frame->gPreset);
// ============== // ==============
@ -492,7 +484,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
// Prepare conditions. TODO: We use this in two places now, make it only one // Prepare conditions. TODO: We use this in two places now, make it only one
// -------------- // --------------
bool Conditions; bool Conditions;
if (gOnlyLooping) if (m_frame->gOnlyLooping)
{ {
Conditions = PBs[i].audio_addr.looping; Conditions = PBs[i].audio_addr.looping;
} }
@ -582,7 +574,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
} }
// add new line // add new line
sbuff = sbuff + writeMessage(gPreset, i); strcpy(buffer, ""); sbuff = sbuff + writeMessage(m_frame->gPreset, i); strcpy(buffer, "");
sbuff = sbuff + "\n"; sbuff = sbuff + "\n";
@ -595,7 +587,8 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
// ======================================================================================= // =======================================================================================
// Write global values // Write global values
// --------------- // ---------------
sprintf(buffer, "\nThe parameter blocks span from %08x", m_addressPBs); sprintf(buffer, "\nThe parameter blocks span from %08x to %08x | distance %i | num. of blocks %i | _iSize %i\n",
m_addressPBs, gLastBlock, (gLastBlock-m_addressPBs), (gLastBlock-m_addressPBs) / 192, _iSize);
sbuff = sbuff + buffer; strcpy(buffer, ""); sbuff = sbuff + buffer; strcpy(buffer, "");
// =============== // ===============
@ -604,7 +597,8 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
// Write settings // 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", 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, gOnlyLooping, gSaveFile); m_frame->gSSBM, m_frame->gSSBMremedy1, m_frame->gSSBMremedy2, m_frame->gSequenced,
m_frame->gVolume, m_frame->gReset, m_frame->gOnlyLooping, m_frame->gSaveFile);
sbuff = sbuff + buffer; strcpy(buffer, ""); sbuff = sbuff + buffer; strcpy(buffer, "");
// =============== // ===============

View File

@ -15,6 +15,7 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "FileUtil.h" // for IsDirectory
#include "../Debugger/Debugger.h" #include "../Debugger/Debugger.h"
#include "../Logging/Console.h" // for aprintf #include "../Logging/Console.h" // for aprintf
@ -29,19 +30,17 @@
#include "UCode_AX.h" #include "UCode_AX.h"
#include "UCode_AX_Voice.h" #include "UCode_AX_Voice.h"
// ---------------------------------------------------------------------------------------
// ------------------------------------------------------------------
// Externals // Externals
// ----------- // -----------
extern float ratioFactor; extern u32 gLastBlock;
bool gSSBM = true; // used externally extern std::string gpName;
bool gSSBMremedy1 = true; // used externally
bool gSSBMremedy2 = true; // used externally
bool gSequenced = true; // used externally
bool gVolume = true; // used externally
bool gReset = false; // used externally
extern CDebugger* m_frame; extern CDebugger* m_frame;
std::vector<std::string> sMailLog, sMailTime;
// ----------- // -----------
CUCode_AX::CUCode_AX(CMailHandler& _rMailHandler) CUCode_AX::CUCode_AX(CMailHandler& _rMailHandler)
: IUCode(_rMailHandler) : IUCode(_rMailHandler)
, m_addressPBs(0xFFFFFFFF) , m_addressPBs(0xFFFFFFFF)
@ -61,17 +60,183 @@ CUCode_AX::~CUCode_AX()
delete [] temprbuffer; delete [] temprbuffer;
} }
void CUCode_AX::HandleMail(u32 _uMail)
// ============================================
// Save file to harddrive
// ----------------
void CUCode_AX::SaveLogFile(std::string f, int resizeTo, bool type, bool Wii)
{ {
if ((_uMail & 0xFFFF0000) == MAIL_AX_ALIST) if (!File::IsDirectory("Logs/Mail")) File::CreateDir("Logs/Mail");
char ci[10]; itoa(resizeTo - 1, ci, 10); // write ci
char cType[10]; itoa(type, cType, 10); // write cType
std::string FileName = "Logs/Mail/"; FileName += gpName;
FileName += "_sep"; FileName += ci; FileName += "_sep"; FileName += cType;
FileName += Wii ? "_sepWii_sep" : "_sepGC_sep"; FileName += ".log";
FILE* fhandle = fopen(FileName.c_str(), "w");
fprintf(fhandle, f.c_str());
fflush(fhandle); fhandle = NULL;
}
// ============================================
// Save the logged AX mail
// ----------------
void CUCode_AX::SaveLog_(bool Wii, const char* _fmt, ...)
{
if(m_frame->ScanMails)
{
char Msg[512*10];
va_list ap;
va_start(ap, _fmt);
vsprintf(Msg, _fmt, ap);
va_end(ap);
//wxMessageBox( wxString::Format("SaveLog_ again: %s\n", Msg) );
if(strcmp(Msg, "Begin") == 0)
{ {
// a new List TmpMailLog = "";
}
else if(strcmp(Msg, "End") == 0)
{
if(saveNext && saveNext < 100) // limit because saveNext is not initialized
{
//wprintf("End");
// Save the timestamps and comment
char ci[10]; itoa(saveNext - 1, ci, 10); // write ci
TmpMailLog += "\n\n";
TmpMailLog += "-----------------------------------------------------------------------\n";
TmpMailLog += "Current mail: " + gpName + " mail " + ci + "\n\n";
for (int i = 0; i < sMailTime.size(); i++)
{
char tmpbuf[128]; sprintf(tmpbuf, "Mail %i received: %s\n", i, sMailTime.at(i).c_str());
TmpMailLog += tmpbuf;
}
TmpMailLog += "-----------------------------------------------------------------------";
sMailLog.push_back(TmpMailLog);
// Save file to disc
if(m_frame->StoreMails)
{
SaveLogFile(TmpMailLog, saveNext, 1, Wii);
}
m_frame->DoUpdateMail(); // update the view
saveNext = 0;
}
} }
else else
{ {
AXTask(_uMail); TmpMailLog += Msg;
TmpMailLog += "\n";
g_dspInitialize.pLog(Msg);
} }
} }
}
// ----------------
// ============================================
// Save the whole AX mail
// ----------------
void CUCode_AX::SaveMail(bool Wii, u32 _uMail)
{
if(m_frame->ScanMails)
{
int i = 0;
std::string sTemp;
std::string sTempEnd;
std::string * sAct = &sTemp;
bool doOnce = true; // for the while loop, to avoid getting stuck
// Go through the mail
while (i < 250)
{
// Make a new row for each AX-Command
u16 axcomm = Memory_Read_U16(_uMail + i);
if(axcomm < 15 && axcomm != 0) // we can at most write 8 messages per log
{
*sAct += "\n";
}
char szTemp2[128] = "";
sprintf(szTemp2, "%08x : 0x%04x\n", _uMail + i, axcomm);
*sAct += szTemp2;
// set i to 160 so that we show some things after the end to
if ((axcomm == AXLIST_END || axcomm == 0x000e) && doOnce)
{
i = 160;
sAct = &sTempEnd;
doOnce = false;
}
i += 2;
}
// Compare this mail to old mails
int addnew = 0;
for (int i = 0; i < m_frame->sMail.size(); i++)
{
if(m_frame->sMail.at(i).length() != sTemp.length())
{
//wxMessageBox( wxString::Format("%s \n\n%s", m_frame->sMail.at(i).c_str(),
// sTemp.c_str()) );
addnew++;
}
}
// 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());
int resizeTo = m_frame->sMail.size() + 1;
// ------------------------------------
// get timestamp
wxDateTime datetime = wxDateTime::UNow();
char Msg[128];
sprintf(Msg, "%04i-%02i-%02i %02i:%02i:%02i:%03i",
datetime.GetYear(), datetime.GetMonth() + 1, datetime.GetDay(),
datetime.GetHour(), datetime.GetMinute(), datetime.GetSecond(), datetime.GetMillisecond());
sMailTime.push_back(Msg);
// ------------------------------------
m_frame->sMail.push_back(sTemp); // save the main comparison mail
std::string lMail = sTemp + "------------------\n" + sTempEnd;
m_frame->sFullMail.push_back(lMail);
// enable the radio button and update view
if(resizeTo <= m_frame->m_RadioBox[3]->GetCount())
{
m_frame->m_RadioBox[3]->Enable(resizeTo - 1, true);
m_frame->m_RadioBox[3]->Select(resizeTo - 1);
}
addnew = 0;
saveNext = resizeTo; // save the log to
// ------------------------------------
// Save as file
if(m_frame->StoreMails)
{
//wprintf("m_frame->sMail.size(): %i | resizeTo:%i\n", m_frame->sMail.size(), resizeTo);
SaveLogFile(lMail, resizeTo, 0, Wii);
}
}
sTemp = "";
sTempEnd = "";
}
}
// ----------------
void DoVoiceHacks(AXParamBlock &pb) void DoVoiceHacks(AXParamBlock &pb)
{ {
@ -83,8 +248,7 @@ void DoVoiceHacks(AXParamBlock &pb)
const u16 upddata = Memory_Read_U16(updaddr + 2); const u16 upddata = Memory_Read_U16(updaddr + 2);
// ======================================================================================= // =======================================================================================
/* /* Fix problems introduced with the SSBM fix - Sometimes when a music stream ended sampleEnd
Fix problems introduced with the SSBM fix - Sometimes when a music stream ended sampleEnd
would become extremely high and the game would play random sound data from ARAM resulting in would become extremely high and the game would play random sound data from ARAM resulting in
a strange noise. This should take care of that. - Some games (Monkey Ball 1 and Tales of a strange noise. This should take care of that. - Some games (Monkey Ball 1 and Tales of
Symphonia and other) also had one odd last block with a strange high loopPos and strange Symphonia and other) also had one odd last block with a strange high loopPos and strange
@ -93,7 +257,7 @@ void DoVoiceHacks(AXParamBlock &pb)
// ------------ // ------------
if ( if (
(sampleEnd > 0x10000000 || loopPos > 0x10000000) (sampleEnd > 0x10000000 || loopPos > 0x10000000)
&& gSSBMremedy1 && m_frame->gSSBMremedy1
) )
{ {
pb.running = 0; pb.running = 0;
@ -132,7 +296,7 @@ void DoVoiceHacks(AXParamBlock &pb)
&& pb.mixer_control == 0 // only use this in SSBM && pb.mixer_control == 0 // only use this in SSBM
&& gSSBMremedy2 // let us turn this fix on and off && m_frame->gSSBMremedy2 // let us turn this fix on and off
) )
{ {
// reset the detection values // reset the detection values
@ -154,7 +318,7 @@ void DoVoiceHacks(AXParamBlock &pb)
// ======================================================================================= // =======================================================================================
// Reset all values // Reset all values
// ------------ // ------------
if (gReset if (m_frame->gReset
&& (pb.running || pb.audio_addr.looping || pb.adpcm_loop_info.pred_scale) && (pb.running || pb.audio_addr.looping || pb.adpcm_loop_info.pred_scale)
) )
{ {
@ -188,6 +352,10 @@ int ReadOutPBs(u32 pbs_address, AXParamBlock* _pPBs, int _num)
for (size_t p = 0; p < sizeof(AXParamBlock) / 2; p++) for (size_t p = 0; p < sizeof(AXParamBlock) / 2; p++)
{ {
pDest[p] = Common::swap16(pSrc[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; blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo;
count++; count++;
@ -257,7 +425,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
// 0-3, those are important // 0-3, those are important
&& (upd0 || upd1 || upd2 || upd3 || upd4) // We should use these in some way to I think && (upd0 || upd1 || upd2 || upd3 || upd4) // We should use these in some way to I think
// but I don't know how or when // but I don't know how or when
&& gSequenced) // on and off option && m_frame->gSequenced) // on and off option
{ {
pDest[updpar] = upddata; pDest[updpar] = upddata;
} }
@ -296,6 +464,28 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
} }
// ------------------------------------------------------------------------------
// Handle incoming mail
// -----------
void CUCode_AX::HandleMail(u32 _uMail)
{
if ((_uMail & 0xFFFF0000) == MAIL_AX_ALIST)
{
// a new List
DebugLog(" >>>> u32 MAIL : General Mail (%08x)", _uMail);
}
else
{
DebugLog(" >>>> u32 MAIL : AXTask Mail (%08x)", _uMail);
AXTask(_uMail);
}
}
// ------------------------------------------------------------------------------
// Update with DSP Interrupt
// -----------
void CUCode_AX::Update() void CUCode_AX::Update()
{ {
// check if we have to sent something // check if we have to sent something
@ -304,14 +494,23 @@ void CUCode_AX::Update()
g_dspInitialize.pGenerateDSPInterrupt(); g_dspInitialize.pGenerateDSPInterrupt();
} }
} }
// -----------
// Shortcut
void CUCode_AX::SaveLog(const char* _fmt, ...) { if(m_frame) SaveLog_(false, _fmt); }
// ============================================
// AX seems to bootup one task only and waits for resume-callbacks // AX seems to bootup one task only and waits for resume-callbacks
// everytime the DSP has "spare time" it sends a resume-mail to the CPU // everytime the DSP has "spare time" it sends a resume-mail to the CPU
// and the __DSPHandler calls a AX-Callback which generates a new AXFrame // and the __DSPHandler calls a AX-Callback which generates a new AXFrame
bool CUCode_AX::AXTask(u32& _uMail) bool CUCode_AX::AXTask(u32& _uMail)
{ {
u32 uAddress = _uMail; u32 uAddress = _uMail;
DebugLog("AXTask - AXCommandList-Addr: 0x%08x", uAddress); SaveLog("Begin");
SaveLog("=====================================================================");
SaveLog("%08x : AXTask - AXCommandList-Addr:", uAddress);
u32 Addr__AXStudio; u32 Addr__AXStudio;
u32 Addr__AXOutSBuffer; u32 Addr__AXOutSBuffer;
@ -330,6 +529,8 @@ bool CUCode_AX::AXTask(u32& _uMail)
bool bExecuteList = true; bool bExecuteList = true;
if(m_frame) SaveMail(false, _uMail); // Save mail for debugging
while (bExecuteList) while (bExecuteList)
{ {
static int last_valid_command = 0; static int last_valid_command = 0;
@ -340,7 +541,7 @@ bool CUCode_AX::AXTask(u32& _uMail)
case AXLIST_STUDIOADDR: //00 case AXLIST_STUDIOADDR: //00
Addr__AXStudio = Memory_Read_U32(uAddress); Addr__AXStudio = Memory_Read_U32(uAddress);
uAddress += 4; uAddress += 4;
DebugLog("AXLIST studio address: %08x", Addr__AXStudio); SaveLog("%08x : AXLIST studio address: %08x", uAddress, Addr__AXStudio);
break; break;
case 0x001: // 2byte x 10 case 0x001: // 2byte x 10
@ -353,7 +554,7 @@ bool CUCode_AX::AXTask(u32& _uMail)
uAddress += 2; uAddress += 2;
u16 param3 = Memory_Read_U16(uAddress); u16 param3 = Memory_Read_U16(uAddress);
uAddress += 2; uAddress += 2;
DebugLog("AXLIST 1: %08x, %04x, %04x, %04x", address, param1, param2, param3); SaveLog("%08x : AXLIST 1: %08x, %04x, %04x, %04x", uAddress, address, param1, param2, param3);
} }
break; break;
@ -368,16 +569,16 @@ bool CUCode_AX::AXTask(u32& _uMail)
uAddress += 4; uAddress += 4;
mixer_HLEready = true; mixer_HLEready = true;
DebugLog("AXLIST PB address: %08x", m_addressPBs); SaveLog("%08x : AXLIST PB address: %08x", uAddress, m_addressPBs);
#ifdef _WIN32 #ifdef _WIN32
DebugLog("Update the SoundThread to be in sync"); SaveLog("Update the SoundThread to be in sync");
DSound::DSound_UpdateSound(); //do it in this thread to avoid sync problems DSound::DSound_UpdateSound(); //do it in this thread to avoid sync problems
#endif #endif
} }
break; break;
case 0x0003: case 0x0003:
DebugLog("AXLIST command 0x0003 ????"); SaveLog("%08x : AXLIST command 0x0003 ????");
break; break;
case 0x0004: // AUX? case 0x0004: // AUX?
@ -385,7 +586,7 @@ bool CUCode_AX::AXTask(u32& _uMail)
uAddress += 4; uAddress += 4;
Addr__4_2 = Memory_Read_U32(uAddress); Addr__4_2 = Memory_Read_U32(uAddress);
uAddress += 4; uAddress += 4;
DebugLog("AXLIST 4_1 4_2 addresses: %08x %08x", Addr__4_1, Addr__4_2); SaveLog("%08x : AXLIST 4_1 4_2 addresses: %08x %08x", uAddress, Addr__4_1, Addr__4_2);
break; break;
case 0x0005: case 0x0005:
@ -393,31 +594,31 @@ bool CUCode_AX::AXTask(u32& _uMail)
uAddress += 4; uAddress += 4;
Addr__5_2 = Memory_Read_U32(uAddress); Addr__5_2 = Memory_Read_U32(uAddress);
uAddress += 4; uAddress += 4;
DebugLog("AXLIST 5_1 5_2 addresses: %08x %08x", Addr__5_1, Addr__5_2); SaveLog("%08x : AXLIST 5_1 5_2 addresses: %08x %08x", uAddress, Addr__5_1, Addr__5_2);
break; break;
case 0x0006: case 0x0006:
Addr__6 = Memory_Read_U32(uAddress); Addr__6 = Memory_Read_U32(uAddress);
uAddress += 4; uAddress += 4;
DebugLog("AXLIST 6 address: %08x", Addr__6); SaveLog("%08x : AXLIST 6 address: %08x", uAddress, Addr__6);
break; break;
case AXLIST_SBUFFER: case AXLIST_SBUFFER:
Addr__AXOutSBuffer = Memory_Read_U32(uAddress); Addr__AXOutSBuffer = Memory_Read_U32(uAddress);
uAddress += 4; uAddress += 4;
DebugLog("AXLIST OutSBuffer address: %08x", Addr__AXOutSBuffer); SaveLog("%08x : AXLIST OutSBuffer address: %08x", uAddress, Addr__AXOutSBuffer);
break; break;
case 0x0009: case 0x0009:
Addr__9 = Memory_Read_U32(uAddress); Addr__9 = Memory_Read_U32(uAddress);
uAddress += 4; uAddress += 4;
DebugLog("AXLIST 6 address: %08x", Addr__9); SaveLog("%08x : AXLIST 6 address: %08x", Addr__9);
break; break;
case AXLIST_COMPRESSORTABLE: // 0xa case AXLIST_COMPRESSORTABLE: // 0xa
Addr__A = Memory_Read_U32(uAddress); Addr__A = Memory_Read_U32(uAddress);
uAddress += 4; uAddress += 4;
DebugLog("AXLIST CompressorTable address: %08x", Addr__A); SaveLog("%08x : AXLIST CompressorTable address: %08x", uAddress, Addr__A);
break; break;
case 0x000e: case 0x000e:
@ -428,16 +629,16 @@ bool CUCode_AX::AXTask(u32& _uMail)
// Although we don't, currently. // Although we don't, currently.
Addr__AXOutSBuffer_2 = Memory_Read_U32(uAddress); Addr__AXOutSBuffer_2 = Memory_Read_U32(uAddress);
uAddress += 4; uAddress += 4;
DebugLog("AXLIST sbuf2 addresses: %08x %08x", Addr__AXOutSBuffer_1, Addr__AXOutSBuffer_2); SaveLog("%08x : AXLIST sbuf2 addresses: %08x %08x", uAddress, Addr__AXOutSBuffer_1, Addr__AXOutSBuffer_2);
break; break;
case AXLIST_END: case AXLIST_END:
bExecuteList = false; bExecuteList = false;
DebugLog("AXLIST end"); SaveLog("%08x : AXLIST end", uAddress);
break; break;
case 0x0010: //Super Monkey Ball 2 case 0x0010: //Super Monkey Ball 2
DebugLog("AXLIST unknown"); SaveLog("%08x : AXLIST 0x0010", uAddress);
//should probably read/skip stuff here //should probably read/skip stuff here
uAddress += 8; uAddress += 8;
break; break;
@ -485,7 +686,9 @@ bool CUCode_AX::AXTask(u32& _uMail)
if (bExecuteList) if (bExecuteList)
last_valid_command = iCommand; last_valid_command = iCommand;
} }
DebugLog("AXTask - done, send resume"); SaveLog("AXTask - done, send resume");
SaveLog("=====================================================================");
SaveLog("End");
// i hope resume is okay AX // i hope resume is okay AX
m_rMailHandler.PushMail(0xDCD10001); m_rMailHandler.PushMail(0xDCD10001);

View File

@ -18,6 +18,7 @@
#ifndef _UCODE_AX #ifndef _UCODE_AX
#define _UCODE_AX #define _UCODE_AX
#include <iostream>
#include "UCode_AXStructs.h" #include "UCode_AXStructs.h"
enum enum
@ -35,8 +36,16 @@ public:
void MixAdd(short* _pBuffer, int _iSize); void MixAdd(short* _pBuffer, int _iSize);
void Update(); void Update();
// this is a little ugly perhaps, feel free to move it out of here // Logging
void Logging(short* _pBuffer, int _iSize, int a); void Logging(short* _pBuffer, int _iSize, int a);
void SaveLog_(bool Wii, const char* _fmt, ...);
void SaveMail(bool Wii, u32 _uMail);
void SaveLogFile(std::string f, int resizeTo, bool type, bool Wii);
std::string TmpMailLog;
int saveNext;
// PBs
u32 m_addressPBs;
private: private:
enum enum
@ -49,14 +58,12 @@ private:
AXLIST_END = 0x000F AXLIST_END = 0x000F
}; };
// PBs
u32 m_addressPBs;
int *templbuffer; int *templbuffer;
int *temprbuffer; int *temprbuffer;
// ax task message handler // ax task message handler
bool AXTask(u32& _uMail); bool AXTask(u32& _uMail);
void SaveLog(const char* _fmt, ...);
void SendMail(u32 _uMail); void SendMail(u32 _uMail);
}; };

View File

@ -26,9 +26,19 @@
#include "UCodes.h" #include "UCodes.h"
#include "UCode_AXStructs.h" #include "UCode_AXStructs.h"
#include "UCode_AX.h" // for some functions in CUCode_AX
#include "UCode_AXWii.h" #include "UCode_AXWii.h"
#include "UCode_AX_Voice.h" #include "UCode_AX_Voice.h"
// ------------------------------------------------------------------
// Declarations
// -----------
extern u32 gLastBlock;
extern CDebugger * m_frame;
// -----------
CUCode_AXWii::CUCode_AXWii(CMailHandler& _rMailHandler) CUCode_AXWii::CUCode_AXWii(CMailHandler& _rMailHandler)
: IUCode(_rMailHandler) : IUCode(_rMailHandler)
, m_addressPBs(0xFFFFFFFF) , m_addressPBs(0xFFFFFFFF)
@ -39,6 +49,8 @@ CUCode_AXWii::CUCode_AXWii(CMailHandler& _rMailHandler)
templbuffer = new int[1024 * 1024]; templbuffer = new int[1024 * 1024];
temprbuffer = new int[1024 * 1024]; temprbuffer = new int[1024 * 1024];
lCUCode_AX = new CUCode_AX(_rMailHandler);
} }
CUCode_AXWii::~CUCode_AXWii() CUCode_AXWii::~CUCode_AXWii()
@ -75,6 +87,10 @@ int ReadOutPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num)
for (size_t p = 0; p < sizeof(AXParamBlock) / 2; p++) for (size_t p = 0; p < sizeof(AXParamBlock) / 2; p++)
{ {
pDest[p] = Common::swap16(pSrc[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; blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo;
count++; count++;
@ -120,9 +136,9 @@ void CUCode_AXWii::MixAdd(short* _pBuffer, int _iSize)
memset(temprbuffer, 0, _iSize * sizeof(int)); memset(temprbuffer, 0, _iSize * sizeof(int));
// write logging data to debugger // write logging data to debugger
//if (m_frame) if (m_frame)
{ {
// CUCode_AXWii::Logging(_pBuffer, _iSize, 0); lCUCode_AX->Logging(_pBuffer, _iSize, 0);
} }
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
@ -192,13 +208,19 @@ void CUCode_AXWii::Update()
} }
} }
// Shortcut
void CUCode_AXWii::SaveLog(const char* _fmt, ...) { if(m_frame) lCUCode_AX->SaveLog_(true, _fmt); }
// AX seems to bootup one task only and waits for resume-callbacks // AX seems to bootup one task only and waits for resume-callbacks
// everytime the DSP has "spare time" it sends a resume-mail to the CPU // everytime the DSP has "spare time" it sends a resume-mail to the CPU
// and the __DSPHandler calls a AX-Callback which generates a new AXFrame // and the __DSPHandler calls a AX-Callback which generates a new AXFrame
bool CUCode_AXWii::AXTask(u32& _uMail) bool CUCode_AXWii::AXTask(u32& _uMail)
{ {
u32 uAddress = _uMail; u32 uAddress = _uMail;
DebugLog("AXTask - AXCommandList-Addr: 0x%08x", uAddress); SaveLog("Begin");
SaveLog("=====================================================================");
SaveLog("%08x: AXTask - AXCommandList-Addr", uAddress);
u32 Addr__AXStudio; u32 Addr__AXStudio;
u32 Addr__AXOutSBuffer; u32 Addr__AXOutSBuffer;
@ -213,6 +235,8 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
bool bExecuteList = true; bool bExecuteList = true;
if(m_frame) lCUCode_AX->SaveMail(true, uAddress); // Save mail for debugging
if (false) if (false)
{ {
// PanicAlert("%i", sizeof(AXParamBlockWii)); // 252 ?? // PanicAlert("%i", sizeof(AXParamBlockWii)); // 252 ??
@ -242,14 +266,14 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
case 0x0000: //00 case 0x0000: //00
Addr__AXStudio = Memory_Read_U32(uAddress); Addr__AXStudio = Memory_Read_U32(uAddress);
uAddress += 4; uAddress += 4;
DebugLog("AXLIST studio address: %08x", Addr__AXStudio); SaveLog("%08x : AXLIST studio address: %08x", uAddress, Addr__AXStudio);
break; break;
case 0x0001: case 0x0001:
{ {
u32 address = Memory_Read_U32(uAddress); u32 address = Memory_Read_U32(uAddress);
uAddress += 4; uAddress += 4;
DebugLog("AXLIST 1: %08x", address); SaveLog("%08x : AXLIST 1: %08x", uAddress, address);
} }
break; break;
@ -257,14 +281,15 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
{ {
u32 address = Memory_Read_U32(uAddress); u32 address = Memory_Read_U32(uAddress);
uAddress += 4; uAddress += 4;
DebugLog("AXLIST 3: %08x", address); SaveLog("%08x : AXLIST 3: %08x", uAddress, address);
} }
break; break;
case 0x0004: // PBs are here now case 0x0004: // PBs are here now
m_addressPBs = Memory_Read_U32(uAddress); m_addressPBs = Memory_Read_U32(uAddress);
lCUCode_AX->m_addressPBs = m_addressPBs; // for the sake of logging
mixer_HLEready = true; mixer_HLEready = true;
DebugLog("AXLIST PB address: %08x", m_addressPBs); SaveLog("%08x : AXLIST PB address: %08x", uAddress, m_addressPBs);
#ifdef _WIN32 #ifdef _WIN32
DebugLog("Update the SoundThread to be in sync"); DebugLog("Update the SoundThread to be in sync");
DSound::DSound_UpdateSound(); //do it in this thread to avoid sync problems DSound::DSound_UpdateSound(); //do it in this thread to avoid sync problems
@ -279,13 +304,13 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
uAddress += 4; uAddress += 4;
uAddress += 2; uAddress += 2;
DebugLog("AXLIST 5_1 5_2 addresses: %08x %08x", Addr__5_1, Addr__5_2); SaveLog("%08x : AXLIST 5_1 5_2 addresses: %08x %08x", uAddress, Addr__5_1, Addr__5_2);
break; break;
case 0x0006: case 0x0006:
Addr__6 = Memory_Read_U32(uAddress); Addr__6 = Memory_Read_U32(uAddress);
uAddress += 10; uAddress += 10;
DebugLog("AXLIST 6 address: %08x", Addr__6); SaveLog("%08x : AXLIST 6 address: %08x", uAddress, Addr__6);
break; break;
/* case 0x0007: // AXLIST_SBUFFER /* case 0x0007: // AXLIST_SBUFFER
@ -306,7 +331,7 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
uAddress += 4; uAddress += 4;
//Addr__A = Memory_Read_U32(uAddress); //Addr__A = Memory_Read_U32(uAddress);
uAddress += 4; uAddress += 4;
DebugLog("AXLIST CompressorTable address: %08x", Addr__A); SaveLog("%08x : AXLIST CompressorTable address: %08x", uAddress, Addr__A);
break; break;
case 0x000b: case 0x000b:
@ -326,7 +351,7 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
case 0x000e: case 0x000e:
// This is the end. // This is the end.
bExecuteList = false; bExecuteList = false;
DebugLog("AXLIST end, wii stylee."); SaveLog("%08x : AXLIST end, wii stylee.", uAddress);
break; break;
default: default:
@ -359,7 +384,9 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
if (bExecuteList) if (bExecuteList)
last_valid_command = iCommand; last_valid_command = iCommand;
} }
DebugLog("AXTask - done, send resume"); SaveLog("AXTask - done, send resume");
SaveLog("=====================================================================");
SaveLog("End");
// i hope resume is okay AX // i hope resume is okay AX
m_rMailHandler.PushMail(0xDCD10001); m_rMailHandler.PushMail(0xDCD10001);

View File

@ -34,6 +34,8 @@ public:
// this is a little ugly perhaps, feel free to move it out of here // this is a little ugly perhaps, feel free to move it out of here
void Logging(short* _pBuffer, int _iSize, int a); void Logging(short* _pBuffer, int _iSize, int a);
CUCode_AX * lCUCode_AX; // we need the logging functions in there
private: private:
enum enum
@ -49,6 +51,7 @@ private:
// ax task message handler // ax task message handler
bool AXTask(u32& _uMail); bool AXTask(u32& _uMail);
void SaveLog(const char* _fmt, ...);
void SendMail(u32 _uMail); void SendMail(u32 _uMail);
}; };

View File

@ -37,6 +37,8 @@
DSPInitialize g_dspInitialize; DSPInitialize g_dspInitialize;
u8* g_pMemory; u8* g_pMemory;
extern std::vector<std::string> sMailLog, sMailTime;
std::string gpName;
// Set this if you want to log audio. search for log_ai in this file to see the filename. // Set this if you want to log audio. search for log_ai in this file to see the filename.
static bool log_ai = false; static bool log_ai = false;
@ -197,6 +199,15 @@ void DSP_Initialize(DSPInitialize _dspInitialize)
g_pMemory = g_dspInitialize.pGetMemoryPointer(0); g_pMemory = g_dspInitialize.pGetMemoryPointer(0);
gpName = g_dspInitialize.pName(); // save the game name globally
for (int i = 0; i < gpName.length(); ++i) // and fix it
{
wprintf("%c", gpName[i]);
std::cout << gpName[i];
if (gpName[i] == ':') gpName[i] = ' ';
}
wprintf("\n");
CDSPHandler::CreateInstance(); CDSPHandler::CreateInstance();
#ifdef _WIN32 #ifdef _WIN32
@ -227,6 +238,15 @@ void DSP_Shutdown()
AOSound::AOSound_StopSound(); AOSound::AOSound_StopSound();
#endif #endif
CDSPHandler::Destroy(); CDSPHandler::Destroy();
// Reset mails
if(m_frame)
{
sMailLog.clear();
sMailTime.clear();
m_frame->sMail.clear();
m_frame->sMailEnd.clear();
}
} }
void DSP_DoState(unsigned char **ptr, int mode) { void DSP_DoState(unsigned char **ptr, int mode) {

View File

@ -66,7 +66,7 @@ bool AXTask(u32& _uMail);
bool bCanWork = false; bool bCanWork = false;
// Set this if you want to log audio. search for log_ai in this file to see the filename. // Set this if you want to log audio. search for log_ai in this file to see the filename.
static bool log_ai = true; static bool log_ai = false;
WaveFileWriter g_wave_writer; WaveFileWriter g_wave_writer;
// ============== // ==============