Small changes to DSP HLE. Still no sound in Wii AX. Blocks are turned on but something is wrong, it seems like cur_addr was not moving (in Top Spin 3), if I understand the log correctly.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1111 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2008-11-10 20:32:36 +00:00
parent 145d868585
commit fe19642762
13 changed files with 433 additions and 309 deletions

View file

@ -48,14 +48,13 @@ BEGIN_EVENT_TABLE(CDebugger,wxDialog)
EVT_BUTTON(ID_UPD,CDebugger::OnUpdate) // buttons EVT_BUTTON(ID_UPD,CDebugger::OnUpdate) // buttons
EVT_CHECKBOX(IDC_CHECK1,CDebugger::SaveFile) // options // left cotrols
EVT_CHECKBOX(IDC_CHECK3,CDebugger::OnlyLooping) EVT_CHECKLISTBOX(IDC_CHECKLIST5, CDebugger::OnOptions) // options
EVT_CHECKBOX(IDC_CHECK4,CDebugger::ShowHideConsole) EVT_CHECKLISTBOX(IDC_CHECKLIST6, CDebugger::OnShowAll)
// right cotrols
EVT_RADIOBOX(IDC_RADIO1,CDebugger::ChangeFrequency) // update frequency EVT_RADIOBOX(IDC_RADIO1,CDebugger::ChangeFrequency) // update frequency
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_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, CDebugger::UpdateMail) // mails
@ -73,6 +72,8 @@ CDebugger::CDebugger(wxWindow *parent, wxWindowID id, const wxString &title,
, m_GPRListView(NULL) , m_GPRListView(NULL)
//, gUpdFreq(5) // loaded from file //, gUpdFreq(5) // loaded from file
, gPreset(0) , gPreset(0)
, giShowAll(-1)
, gSSBM(true) , gSSBM(true)
, gSSBMremedy1(true) , gSSBMremedy1(true)
, gSSBMremedy2(true) , gSSBMremedy2(true)
@ -109,7 +110,7 @@ void CDebugger::Save(IniFile& _IniFile) const
_IniFile.Set("SoundWindow", "w", GetSize().GetWidth()); _IniFile.Set("SoundWindow", "w", GetSize().GetWidth());
_IniFile.Set("SoundWindow", "h", GetSize().GetHeight()); _IniFile.Set("SoundWindow", "h", GetSize().GetHeight());
} }
_IniFile.Set("SoundWindow", "Console", m_Check[2]->IsChecked()); // save settings _IniFile.Set("SoundWindow", "Console", m_options->IsChecked(3)); // 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", "ScanMails", m_gcwiiset->IsChecked(0));
_IniFile.Set("SoundWindow", "StoreMails", m_gcwiiset->IsChecked(1)); _IniFile.Set("SoundWindow", "StoreMails", m_gcwiiset->IsChecked(1));
@ -127,21 +128,19 @@ void CDebugger::Load(IniFile& _IniFile)
// saved settings // saved settings
bool Console; bool Console;
_IniFile.Get("SoundWindow", "Console", &Console, m_Check[2]->IsChecked()); _IniFile.Get("SoundWindow", "Console", &Console, m_options->IsChecked(3));
m_Check[2]->SetValue(Console); m_options->Check(3, Console);
DoShowHideConsole(); DoShowHideConsole();
_IniFile.Get("SoundWindow", "UpdateFrequency", &gUpdFreq, m_RadioBox[1]->GetSelection()); _IniFile.Get("SoundWindow", "UpdateFrequency", &gUpdFreq, m_RadioBox[1]->GetSelection());
m_RadioBox[1]->SetSelection(gUpdFreq); m_RadioBox[1]->SetSelection(gUpdFreq);
//DoChangeFrequency(); DoChangeFrequency();
// Read and store mails on/off // Read and store mails on/off
_IniFile.Get("SoundWindow", "ScanMails", &ScanMails, m_gcwiiset->IsChecked(0)); _IniFile.Get("SoundWindow", "ScanMails", &ScanMails, m_gcwiiset->IsChecked(0));
m_gcwiiset->Check(0, ScanMails); m_gcwiiset->Check(0, ScanMails);
_IniFile.Get("SoundWindow", "StoreMails", &StoreMails, m_gcwiiset->IsChecked(1)); _IniFile.Get("SoundWindow", "StoreMails", &StoreMails, m_gcwiiset->IsChecked(1));
m_gcwiiset->Check(1, StoreMails); m_gcwiiset->Check(1, StoreMails);
} }
void CDebugger::CreateGUIControls() void CDebugger::CreateGUIControls()
@ -220,27 +219,66 @@ SetTitle(wxT("Sound Debugging"));
// Options checkboxlist (m_PageMain) ----------------------------------- // Options checkboxlist (m_PageMain) -----------------------------------
wxStaticBoxSizer * m_checkSizer = new wxStaticBoxSizer (wxVERTICAL, m_PageMain, wxT("Options")); wxStaticBoxSizer * m_checkSizer = new wxStaticBoxSizer (wxVERTICAL, m_PageMain, wxT("Options"));
m_options = new wxCheckListBox(m_PageMain, IDC_CHECKLIST5, wxDefaultPosition, wxDefaultSize,
0, NULL, wxNO_BORDER);
// checkboxes // checkboxes
m_Check[0] = new wxCheckBox(m_PageMain, IDC_CHECK1, wxT("Save to file"), m_options->Append(wxT("Save to file"));
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_options->Append(wxT("Only looping"));
m_Check[1] = new wxCheckBox(m_PageMain, IDC_CHECK2, wxT("Show updated"), m_options->Append(wxT("Show all"));
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_options->Append(wxT("Show console"));
m_Check[1]->Enable(false);
m_Check[7] = new wxCheckBox(m_PageMain, IDC_CHECK3, wxT("Only looping"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[2] = new wxCheckBox(m_PageMain, IDC_CHECK4, wxT("Show console"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_checkSizer->Add(m_Check[0], 0, 0, 5); m_options->Check(0, gSaveFile);
m_checkSizer->Add(m_Check[1], 0, 0, 5); m_options->Check(1, gOnlyLooping);
m_checkSizer->Add(m_Check[7], 0, 0, 5); m_options->Check(2, gShowAll);
m_checkSizer->Add(m_Check[2], 0, 0, 5); m_options->Check(3, gSaveFile);
m_options->SetMinSize(wxSize(m_options->GetSize().GetWidth() - 40,
m_options->GetCount() * 15));
m_checkSizer->Add(m_options, 0, 0, 0);
// ------------------------ // ------------------------
// Options checkboxlist (m_PageMain) -----------------------------------
wxStaticBoxSizer * m_showallSizer = new wxStaticBoxSizer (wxVERTICAL, m_PageMain, wxT("Show all"));
m_opt_showall = new wxCheckListBox(m_PageMain, IDC_CHECKLIST6, wxDefaultPosition, wxDefaultSize,
0, NULL, wxNO_BORDER);
// Settings checkboxes (m_PageMain) ----------------------------- // checkboxes
m_opt_showall->Append(wxT("Part 1"));
m_opt_showall->Append(wxT("Part 2"));
m_opt_showall->Append(wxT("Part 3"));
m_opt_showall->Append(wxT("Part 4"));
m_opt_showall->SetMinSize(wxSize(m_opt_showall->GetSize().GetWidth() - 40,
m_opt_showall->GetCount() * 15));
m_showallSizer->Add(m_opt_showall, 0, 0, 0);
// Update frequency, numeric base, presets radio boxes --------------------
wxString m_radioBoxChoices0[] = { wxT("Show base 10"), wxT("Show base 16") };
m_radioBoxNChoices[0] = sizeof( m_radioBoxChoices0 ) / sizeof( wxString );
m_RadioBox[0] = new wxRadioBox( m_PageMain, IDC_RADIO0, wxT("Show base"),
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[0], m_radioBoxChoices0, 1, wxRA_SPECIFY_COLS);
m_RadioBox[0]->Enable(false);
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_RadioBox[1] = new wxRadioBox( m_PageMain, IDC_RADIO1, wxT("Update freq."),
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[1], m_radioBoxChoices1, 1, wxRA_SPECIFY_COLS);
wxString m_radioBoxChoices2[] = { wxT("Preset 1"), wxT("Updates"), wxT("Looping"), wxT("Mixer") };
m_radioBoxNChoices[2] = sizeof( m_radioBoxChoices2 ) / sizeof( wxString );
m_RadioBox[2] = new wxRadioBox( m_PageMain, IDC_RADIO2, wxT("Presets"),
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[2], m_radioBoxChoices2, 1, wxRA_SPECIFY_COLS);
// ------------------------
// --------------------------------------------------------------------
// Settings checkboxes (m_PageMain)
// -------------------------
wxStaticBoxSizer * m_checkSizer2 = new wxStaticBoxSizer(wxVERTICAL, m_PageMain, wxT("Settings")); wxStaticBoxSizer * m_checkSizer2 = new wxStaticBoxSizer(wxVERTICAL, m_PageMain, wxT("Settings"));
m_settings = new wxCheckListBox(m_PageMain, IDC_CHECKLIST1, wxDefaultPosition, wxDefaultSize, m_settings = new wxCheckListBox(m_PageMain, IDC_CHECKLIST1, wxDefaultPosition, wxDefaultSize,
0, NULL, wxNO_BORDER); 0, NULL, wxNO_BORDER);
@ -272,25 +310,6 @@ SetTitle(wxT("Sound Debugging"));
// ------------------------ // ------------------------
// Update frequency, numeric base, presets radio boxes --------------------
wxString m_radioBoxChoices0[] = { wxT("Show base 10"), wxT("Show base 16") };
m_radioBoxNChoices[0] = sizeof( m_radioBoxChoices0 ) / sizeof( wxString );
m_RadioBox[0] = new wxRadioBox( m_PageMain, IDC_RADIO0, wxT("Show base"),
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[0], m_radioBoxChoices0, 1, wxRA_SPECIFY_COLS);
m_RadioBox[0]->Enable(false);
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_RadioBox[1] = new wxRadioBox( m_PageMain, IDC_RADIO1, wxT("Update freq."),
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[1], m_radioBoxChoices1, 1, wxRA_SPECIFY_COLS);
wxString m_radioBoxChoices2[] = { wxT("Preset 1"), wxT("Updates"), wxT("Looping"), wxT("Mixer") };
m_radioBoxNChoices[2] = sizeof( m_radioBoxChoices2 ) / sizeof( wxString );
m_RadioBox[2] = new wxRadioBox( m_PageMain, IDC_RADIO2, wxT("Presets"),
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[2], m_radioBoxChoices2, 1, wxRA_SPECIFY_COLS);
// ------------------------
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// Buttons // Buttons
// ------------------------ // ------------------------
@ -306,18 +325,8 @@ SetTitle(wxT("Sound Debugging"));
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// Right buttons and checkboxes (MAIN) // Left buttons and checkboxes (MAIN
// ------------------------ // ------------------------
wxBoxSizer* sButtons2;
sButtons2 = new wxBoxSizer(wxVERTICAL);
sButtons2->AddStretchSpacer(1);
sButtons2->Add(m_RadioBox[2], 0, 0, 5);
sButtons2->AddStretchSpacer(1);
sButtons2->Add(m_checkSizer2, 0, 0, 5);
sButtons2->AddStretchSpacer(1);
// Left buttons and checkboxes
wxBoxSizer* sButtons; wxBoxSizer* sButtons;
sButtons = new wxBoxSizer(wxVERTICAL); sButtons = new wxBoxSizer(wxVERTICAL);
@ -330,12 +339,28 @@ SetTitle(wxT("Sound Debugging"));
sButtons->AddStretchSpacer(1); sButtons->AddStretchSpacer(1);
sButtons->Add(m_checkSizer, 0, 0, 5); sButtons->Add(m_checkSizer, 0, 0, 5);
sButtons->AddStretchSpacer(1); sButtons->AddStretchSpacer(1);
sButtons->Add(m_RadioBox[0], 0, 0, 5); sButtons->Add(m_showallSizer, 0, 0, 5);
sButtons->AddStretchSpacer(1); sButtons->AddStretchSpacer(1);
sButtons->Add(m_RadioBox[1], 0, 0, 5); sButtons->Add(m_RadioBox[0], 0, 0, 5);
sButtons->AddSpacer(5); sButtons->AddSpacer(5);
// ------------------------
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// Right buttons and checkboxes (MAIN)
// ------------------------
wxBoxSizer* sButtons2;
sButtons2 = new wxBoxSizer(wxVERTICAL);
sButtons2->AddStretchSpacer(1);
sButtons2->Add(m_RadioBox[1], 0, 0, 5); // Update freq.
sButtons2->AddStretchSpacer(1);
sButtons2->Add(m_RadioBox[2], 0, 0, 5);
sButtons2->AddStretchSpacer(1);
sButtons2->Add(m_checkSizer2, 0, 0, 5);
sButtons2->AddStretchSpacer(1);
// ------------------------
// -------------------------------------------------------------------- // --------------------------------------------------------------------
@ -350,8 +375,6 @@ SetTitle(wxT("Sound Debugging"));
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// Add all stuff to the mail container (MAIL) // Add all stuff to the mail container (MAIL)
// ----------------------------- // -----------------------------
@ -442,21 +465,13 @@ void CDebugger::ChangePreset(wxCommandEvent& event)
void CDebugger::DoChangePreset() void CDebugger::DoChangePreset()
{ {
if(m_RadioBox[2]->GetSelection() == 0) if(m_RadioBox[2]->GetSelection() == 0)
{
gPreset = 0; gPreset = 0;
}
else if(m_RadioBox[2]->GetSelection() == 1) else if(m_RadioBox[2]->GetSelection() == 1)
{
gPreset = 1; gPreset = 1;
}
else if(m_RadioBox[2]->GetSelection() == 2) else if(m_RadioBox[2]->GetSelection() == 2)
{
gPreset = 2; gPreset = 2;
}
else if(m_RadioBox[2]->GetSelection() == 3) else if(m_RadioBox[2]->GetSelection() == 3)
{
gPreset = 3; gPreset = 3;
}
} }
// ============== // ==============
@ -472,54 +487,44 @@ void CDebugger::ChangeFrequency(wxCommandEvent& event)
void CDebugger::DoChangeFrequency() void CDebugger::DoChangeFrequency()
{ {
if(m_RadioBox[1]->GetSelection() == 0) if(m_RadioBox[1]->GetSelection() == 0)
{
gUpdFreq = 0; gUpdFreq = 0;
}
else if(m_RadioBox[1]->GetSelection() == 1) else if(m_RadioBox[1]->GetSelection() == 1)
{
gUpdFreq = 5; gUpdFreq = 5;
}
else if(m_RadioBox[1]->GetSelection() == 2) else if(m_RadioBox[1]->GetSelection() == 2)
{
gUpdFreq = 15; gUpdFreq = 15;
} else if(m_RadioBox[1]->GetSelection() == 3)
else
{
gUpdFreq = 30; gUpdFreq = 30;
}
} }
// ============== // ==============
// ======================================================================================= // =======================================================================================
// Show only looping blocks // Options
// -------------- // --------------
void CDebugger::OnlyLooping(wxCommandEvent& event) void CDebugger::OnOptions(wxCommandEvent& event)
{ {
if(m_Check[7]->IsChecked()) gSaveFile = m_options->IsChecked(0);
{ gOnlyLooping = m_options->IsChecked(1);
gOnlyLooping = true; gShowAll = m_options->IsChecked(2);
gSaveFile = m_options->IsChecked(3);
} if(event.GetInt() == 3) DoShowHideConsole();
else
{
gOnlyLooping = false;
}
} }
// ==============
void CDebugger::OnShowAll(wxCommandEvent& event)
{
/// Only allow one selection at a time
for (int i = 0; i < m_opt_showall->GetCount(); ++i)
if(i != event.GetInt()) m_opt_showall->Check(i, false);
if(m_opt_showall->IsChecked(0)) giShowAll = 0;
else if(m_opt_showall->IsChecked(1)) giShowAll = 1;
else if(m_opt_showall->IsChecked(2)) giShowAll = 2;
else if(m_opt_showall->IsChecked(3)) giShowAll = 3;
else giShowAll = -1;
}
// =======================================================================================
// Save to file
// -------------- // --------------
void CDebugger::SaveFile(wxCommandEvent& event)
{
if(m_Check[0]->IsChecked())
gSaveFile = 1;
else
gSaveFile = 0;
}
// ==============
// ======================================================================================= // =======================================================================================
@ -532,7 +537,7 @@ void CDebugger::ShowHideConsole(wxCommandEvent& event)
void CDebugger::DoShowHideConsole() void CDebugger::DoShowHideConsole()
{ {
if(m_Check[2]->IsChecked()) if(m_options->IsChecked(3))
{ {
OpenConsole(); OpenConsole();
} }

View file

@ -73,11 +73,11 @@ class CDebugger : public wxDialog
void NotifyUpdate(); void NotifyUpdate();
void OnUpdate(wxCommandEvent& event); void OnUpdate(wxCommandEvent& event);
void SaveFile(wxCommandEvent& event); // options void ShowHideConsole(wxCommandEvent& event); // options
void ShowHideConsole(wxCommandEvent& event);
void DoShowHideConsole(); void DoShowHideConsole();
void OnlyLooping(wxCommandEvent& event); //void OnlyLooping(wxCommandEvent& event);
void OnOptions(wxCommandEvent& event);
void OnShowAll(wxCommandEvent& event);
void ChangeFrequency(wxCommandEvent& event); // update frequency void ChangeFrequency(wxCommandEvent& event); // update frequency
void DoChangeFrequency(); void DoChangeFrequency();
@ -100,12 +100,14 @@ class CDebugger : public wxDialog
CPBView* m_GPRListView; CPBView* m_GPRListView;
std::vector<std::string> sMail, sMailEnd, sFullMail; std::vector<std::string> sMail, sMailEnd, sFullMail;
wxRadioBox *m_RadioBox[4]; wxRadioBox * m_RadioBox[4], * m_RadioBoxShowAll;
bool gSaveFile; // main options bool gSaveFile; // main options
bool gOnlyLooping; bool gOnlyLooping;
bool gShowAll;
int giShowAll;
int gUpdFreq;// main update freq. int gUpdFreq;// main update freq.
bool gPreset; // main presets int gPreset; // main presets
bool gSSBM; // main settings bool gSSBM; // main settings
bool gSSBMremedy1; bool gSSBMremedy1;
@ -128,7 +130,7 @@ class CDebugger : public wxDialog
wxCheckBox *m_Check[9]; wxCheckBox *m_Check[9];
wxRadioButton *m_Radio[5]; wxRadioButton *m_Radio[5];
wxCheckListBox * m_settings, * m_gc, * m_wii, * m_gcwiiset; wxCheckListBox * m_options, * m_opt_showall, * m_settings, * m_gc, * m_wii, * m_gcwiiset;
wxPanel *m_Controller; wxPanel *m_Controller;
std::vector<std::string> all_all_files, all_files, gc_files, wii_files; std::vector<std::string> all_all_files, all_files, gc_files, wii_files;
@ -141,8 +143,8 @@ class CDebugger : public wxDialog
IDC_CHECK2, IDC_CHECK2,
IDC_CHECK3, IDC_CHECK3,
IDC_CHECK4, IDC_CHECK4,
IDC_CHECKLIST1, IDC_CHECKLIST2, IDC_CHECKLIST3, IDC_CHECKLIST4, IDC_CHECKLIST1, IDC_CHECKLIST2, IDC_CHECKLIST3, IDC_CHECKLIST4, IDC_CHECKLIST5, IDC_CHECKLIST6,
IDC_RADIO0, IDC_RADIO1, IDC_RADIO2, IDC_RADIO3, IDC_RADIO0, IDC_RADIO1, IDC_RADIO2, IDC_RADIO3, IDC_RADIO4,
IDG_LABEL1, IDG_LABEL2, IDG_LABEL1, IDG_LABEL2,
ID_UPD, ID_UPD,
ID_SELC, ID_SELC,

View file

@ -28,8 +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) //if(true)
{ {
char Msg[512]; char Msg[512];
va_list ap; va_list ap;

View file

@ -23,12 +23,14 @@
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#endif #endif
#include "../Debugger/Debugger.h"
extern CDebugger* m_frame;
// -------------------- // --------------------
// On and off // On and off
bool g_consoleEnable = true; bool g_consoleEnable = true;
int gSaveFile = 0; //int gSaveFile = 0;
#define DEBUG_HLE #define DEBUG_HLE
@ -93,7 +95,7 @@ void startConsoleWin(int width, int height, char* fname)
int aprintf(int a, char *fmt, ...) int aprintf(int a, char *fmt, ...)
{ {
#if defined(DEBUG_HLE) && defined(_WIN32) #if defined(DEBUG_HLE) && defined(_WIN32)
if(gSaveFile) if(m_frame->gSaveFile)
{ {
char s[5000]; // WARNING: mind this value char s[5000]; // WARNING: mind this value
va_list argptr; va_list argptr;
@ -127,12 +129,12 @@ int aprintf(int a, char *fmt, ...)
int wprintf(char *fmt, ...) int wprintf(char *fmt, ...)
{ {
#if defined(DEBUG_HLE) && defined(_WIN32) #if defined(DEBUG_HLE) && defined(_WIN32)
char s[5000]; // WARNING: mind this value char s[1024*20]; // Warning, mind this value
va_list argptr; va_list argptr;
int cnt; int cnt;
va_start(argptr, fmt); va_start(argptr, fmt);
cnt = vsnprintf(s, 5000, fmt, argptr); cnt = vsnprintf(s, 1024*20, fmt, argptr);
va_end(argptr); va_end(argptr);
DWORD cCharsWritten; DWORD cCharsWritten;

View file

@ -39,7 +39,7 @@
#include "../UCodes/UCodes.h" #include "../UCodes/UCodes.h"
#include "../UCodes/UCode_AXStructs.h" #include "../UCodes/UCode_AXStructs.h"
#include "../UCodes/UCode_AX.h" #include "../UCodes/UCode_AX.h"
#include "../UCodes/UCode_AXWii.h"
// Externals // Externals
@ -47,72 +47,72 @@ 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
extern CDebugger* m_frame; extern CDebugger* m_frame;
//int PBSize = 128;
// Parameter blocks // Parameter blocks
std::vector<u32> gloopPos(64); std::vector<u32> gloopPos(NUMBER_OF_PBS);
std::vector<u32> gsampleEnd(64); std::vector<u32> gsampleEnd(NUMBER_OF_PBS);
std::vector<u32> gsamplePos(64); std::vector<u32> gsamplePos(NUMBER_OF_PBS);
// main // main
std::vector<u16> gsrc_type(64); std::vector<u16> gsrc_type(NUMBER_OF_PBS);
std::vector<u16> gis_stream(64); std::vector<u16> gis_stream(NUMBER_OF_PBS);
// PBSampleRateConverter src // PBSampleRateConverter src
std::vector<u32> gratio(64); std::vector<u32> gratio(NUMBER_OF_PBS);
std::vector<u32> gratiohi(64); std::vector<u32> gratiohi(NUMBER_OF_PBS);
std::vector<u32> gratiolo(64); std::vector<u32> gratiolo(NUMBER_OF_PBS);
std::vector<u32> gfrac(64); std::vector<u32> gfrac(NUMBER_OF_PBS);
std::vector<u32> gcoef(64); std::vector<u32> gcoef(NUMBER_OF_PBS);
// PBSampleRateConverter mixer // PBSampleRateConverter mixer
std::vector<u16> gvolume_left(64); std::vector<u16> gvolume_left(NUMBER_OF_PBS);
std::vector<u16> gmix_unknown(64); std::vector<u16> gmix_unknown(NUMBER_OF_PBS);
std::vector<u16> gvolume_right(64); std::vector<u16> gvolume_right(NUMBER_OF_PBS);
std::vector<u16> gmix_unknown2(64); std::vector<u16> gmix_unknown2(NUMBER_OF_PBS);
std::vector<u16> gmixer_control(64); std::vector<u16> gmixer_control(NUMBER_OF_PBS);
std::vector<u16> gmixer_vol1(64); std::vector<u16> gmixer_vol1(NUMBER_OF_PBS);
std::vector<u16> gmixer_vol2(64); std::vector<u16> gmixer_vol2(NUMBER_OF_PBS);
std::vector<u16> gmixer_vol3(64); std::vector<u16> gmixer_vol3(NUMBER_OF_PBS);
std::vector<u16> gmixer_vol4(64); std::vector<u16> gmixer_vol4(NUMBER_OF_PBS);
std::vector<u16> gmixer_vol5(64); std::vector<u16> gmixer_vol5(NUMBER_OF_PBS);
std::vector<u16> gmixer_vol6(64); std::vector<u16> gmixer_vol6(NUMBER_OF_PBS);
std::vector<u16> gmixer_vol7(64); std::vector<u16> gmixer_vol7(NUMBER_OF_PBS);
std::vector<u16> gmixer_d1(64); std::vector<u16> gmixer_d1(NUMBER_OF_PBS);
std::vector<u16> gmixer_d2(64); std::vector<u16> gmixer_d2(NUMBER_OF_PBS);
std::vector<u16> gmixer_d3(64); std::vector<u16> gmixer_d3(NUMBER_OF_PBS);
std::vector<u16> gmixer_d4(64); std::vector<u16> gmixer_d4(NUMBER_OF_PBS);
std::vector<u16> gmixer_d5(64); std::vector<u16> gmixer_d5(NUMBER_OF_PBS);
std::vector<u16> gmixer_d6(64); std::vector<u16> gmixer_d6(NUMBER_OF_PBS);
std::vector<u16> gmixer_d7(64); std::vector<u16> gmixer_d7(NUMBER_OF_PBS);
// PBVolumeEnvelope vol_env // PBVolumeEnvelope vol_env
std::vector<u16> gcur_volume(64); std::vector<u16> gcur_volume(NUMBER_OF_PBS);
std::vector<u16> gcur_volume_delta(64); std::vector<u16> gcur_volume_delta(NUMBER_OF_PBS);
// PBAudioAddr audio_addr (incl looping) // PBAudioAddr audio_addr (incl looping)
std::vector<u16> gaudioFormat(64); std::vector<u16> gaudioFormat(NUMBER_OF_PBS);
std::vector<u16> glooping(64); std::vector<u16> glooping(NUMBER_OF_PBS);
std::vector<u16> gloop1(64); std::vector<u16> gloop1(NUMBER_OF_PBS);
std::vector<u16> gloop2(64); std::vector<u16> gloop2(NUMBER_OF_PBS);
std::vector<u16> gloop3(64); std::vector<u16> gloop3(NUMBER_OF_PBS);
// PBADPCMInfo adpcm // PBADPCMInfo adpcm
std::vector<u16> gadloop1(64); std::vector<u16> gadloop1(NUMBER_OF_PBS);
std::vector<u16> gadloop2(64); std::vector<u16> gadloop2(NUMBER_OF_PBS);
std::vector<u16> gadloop3(64); std::vector<u16> gadloop3(NUMBER_OF_PBS);
// updates // updates
std::vector<u16> gupdates1(64); std::vector<u16> gupdates1(NUMBER_OF_PBS);
std::vector<u16> gupdates2(64); std::vector<u16> gupdates2(NUMBER_OF_PBS);
std::vector<u16> gupdates3(64); std::vector<u16> gupdates3(NUMBER_OF_PBS);
std::vector<u16> gupdates4(64); std::vector<u16> gupdates4(NUMBER_OF_PBS);
std::vector<u16> gupdates5(64); std::vector<u16> gupdates5(NUMBER_OF_PBS);
std::vector<u32> gupdates_addr(64); std::vector<u32> gupdates_addr(NUMBER_OF_PBS);
std::vector<u32> gupdates_data(64); std::vector<u32> gupdates_data(NUMBER_OF_PBS);
// Counters // Counters
@ -132,9 +132,9 @@ int vectorLength2 = 100; // for console version
// should we worry about the additonal memory these lists require? bool will allocate // should we worry about the additonal memory these lists require? bool will allocate
// very little memory // very little memory
std::vector< std::vector<bool> > vector1(64, std::vector<bool>(vectorLength, 0)); std::vector< std::vector<bool> > vector1(NUMBER_OF_PBS, std::vector<bool>(vectorLength, 0));
std::vector< std::vector<bool> > vector2(64, std::vector<bool>(vectorLength2, 0)); std::vector< std::vector<bool> > vector2(NUMBER_OF_PBS, std::vector<bool>(vectorLength2, 0));
std::vector<int> numberRunning(64); std::vector<int> numberRunning(NUMBER_OF_PBS);
// Classes // Classes
@ -245,100 +245,58 @@ std::string writeMessage(int a, int i)
} }
// ================
// ======================================================================================= // =======================================================================================
// Collect parameters from Wii or GC
// --------------
/*
// I placed this in CUCode_AX because it needs access to private members of that class. std::string ShowAllPB(int a, int i)
void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
{ {
AXParamBlock PBs[NUMBER_OF_PBS]; if(a == 0)
int numberOfPBs = ReadOutPBs(m_addressPBs, PBs, NUMBER_OF_PBS); {
// =======================================================================================
// Update parameter values
// --------------
// We could chose to update these only if a block is currently running - Later I'll add options
// to see both the current and the lastets active value.
//if (PBs[i].running)
int irun = 0;
for (int i = 0; i < numberOfPBs; i++)
{
if (PBs[i].running)
{
irun++;
} }
else if(a == 1)
// write a line if nothing is playing
if (i == numberOfPBs - 1 && irun == 0)
{ {
for (int i = 0; i < nFiles; i++)
{
std::string sfbuff;
sfbuff = "-----";
aprintf(i, (char *)sfbuff.c_str());
}
}
// ---------------------------------------------------------------------------------------
// Prepare conditions
// --------------
bool Conditions;
if (m_frame->gOnlyLooping)
{
Conditions = PBs[i].audio_addr.looping;
}
else
{
Conditions = numberRunning.at(i) > 0 || PBs[i].audio_addr.looping;
}
// --------------
if (Conditions) }
else if(a == 1)
{ {
}
else if(a == 1)
}
*/
// ================
// =======================================================================================
// Collect parameters from Wii or GC
// --------------
//inline void MixAddVoice(ParamBlockType &pb
//void CollectPB(bool Wii, int i, AXParamBlockWii * PBw, ParamBlockType &pb)
template<class ParamBlockType> void CollectPB(bool Wii, int i, ParamBlockType &PBs)
//void CollectPB(bool Wii, int i, AXParamBlockWii * PBw, AXParamBlock * PBs)
{
// AXPB base // AXPB base
gcoef[i] = PBs[i].unknown1; gcoef[i] = PBs[i].coef_select;
gloopPos[i] = (PBs[i].audio_addr.loop_addr_hi << 16) | PBs[i].audio_addr.loop_addr_lo; gloopPos[i] = (PBs[i].audio_addr.loop_addr_hi << 16) | PBs[i].audio_addr.loop_addr_lo;
gsampleEnd[i] = (PBs[i].audio_addr.end_addr_hi << 16) | PBs[i].audio_addr.end_addr_lo; gsampleEnd[i] = (PBs[i].audio_addr.end_addr_hi << 16) | PBs[i].audio_addr.end_addr_lo;
gsamplePos[i] = (PBs[i].audio_addr.cur_addr_hi << 16) | PBs[i].audio_addr.cur_addr_lo; gsamplePos[i] = (PBs[i].audio_addr.cur_addr_hi << 16) | PBs[i].audio_addr.cur_addr_lo;
// PBSampleRateConverter src // mixer (some differences)
gratio[i] = (u32)(((PBs[i].src.ratio_hi << 16) + PBs[i].src.ratio_lo) * ratioFactor);
gratiohi[i] = PBs[i].src.ratio_hi;
gratiolo[i] = PBs[i].src.ratio_lo;
gfrac[i] = PBs[i].src.cur_addr_frac;
// adpcm_loop_info
gadloop1[i] = PBs[i].adpcm.pred_scale;
gadloop2[i] = PBs[i].adpcm.yn1;
gadloop3[i] = PBs[i].adpcm.yn2;
gloop1[i] = PBs[i].adpcm_loop_info.pred_scale;
gloop2[i] = PBs[i].adpcm_loop_info.yn1;
gloop3[i] = PBs[i].adpcm_loop_info.yn2;
// updates
gupdates1[i] = PBs[i].updates.num_updates[0];
gupdates2[i] = PBs[i].updates.num_updates[1];
gupdates3[i] = PBs[i].updates.num_updates[2];
gupdates4[i] = PBs[i].updates.num_updates[3];
gupdates5[i] = PBs[i].updates.num_updates[4];
gupdates_addr[i] = (PBs[i].updates.data_hi << 16) | PBs[i].updates.data_lo;
gupdates_data[i] = Memory_Read_U32(gupdates_addr[i]);
gaudioFormat[i] = PBs[i].audio_addr.sample_format;
glooping[i] = PBs[i].audio_addr.looping;
gsrc_type[i] = PBs[i].src_type;
gis_stream[i] = PBs[i].is_stream;
// mixer
gvolume_left[i] = PBs[i].mixer.volume_left; gvolume_left[i] = PBs[i].mixer.volume_left;
gvolume_right[i] = PBs[i].mixer.volume_right; gvolume_right[i] = PBs[i].mixer.volume_right;
if(i == 94 && (PBs[i].mixer.unknown > 0 || PBs[i].mixer.unknown2 > 0))
DebugLog("(%i) | LOG Read Left: %04x | Right: %04x", i, PBs[i].mixer.unknown, PBs[i].mixer.unknown2);
gmix_unknown[i] = PBs[i].mixer.unknown; gmix_unknown[i] = PBs[i].mixer.unknown;
gmix_unknown2[i] = PBs[i].mixer.unknown2; gmix_unknown2[i] = PBs[i].mixer.unknown2;
@ -354,21 +312,175 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
gmixer_vol6[i] = PBs[i].mixer.unknown3[2]; gmixer_vol6[i] = PBs[i].mixer.unknown3[2];
gmixer_vol7[i] = PBs[i].mixer.unknown3[4]; gmixer_vol7[i] = PBs[i].mixer.unknown3[4];
gmixer_d1[i] = PBs[i].mixer.unknown4[1]; //gmixer_d1[i] = PBs[i].mixer.unknown4[1];
gmixer_d2[i] = PBs[i].mixer.unknown4[3]; gmixer_d1[i] = PBs[i].next_pb_lo;
gmixer_d2[i] = PBs[i].next_pb_hi;
//gmixer_d2[i] = PBs[i].mixer.unknown4[3];
gmixer_d3[i] = PBs[i].mixer.unknown4[5]; gmixer_d3[i] = PBs[i].mixer.unknown4[5];
gmixer_d4[i] = PBs[i].mixer.unknown4[7]; gmixer_d4[i] = PBs[i].mixer.unknown4[7];
gmixer_d5[i] = PBs[i].mixer.unknown4[1]; gmixer_d5[i] = PBs[i].mixer.unknown4[1];
gmixer_d6[i] = PBs[i].mixer.unknown4[3]; gmixer_d6[i] = PBs[i].mixer.unknown4[3];
gmixer_d7[i] = PBs[i].mixer.unknown4[5]; gmixer_d7[i] = PBs[i].mixer.unknown4[5];
// adpcm_loop_info (same in GC and Wii)
gadloop1[i] = PBs[i].adpcm.pred_scale;
gadloop2[i] = PBs[i].adpcm.yn1;
gadloop3[i] = PBs[i].adpcm.yn2;
gloop1[i] = PBs[i].adpcm_loop_info.pred_scale;
gloop2[i] = PBs[i].adpcm_loop_info.yn1;
gloop3[i] = PBs[i].adpcm_loop_info.yn2;
// updates (differences)
gupdates1[i] = PBs[i].updates.num_updates[0];
gupdates2[i] = PBs[i].updates.num_updates[1];
gupdates3[i] = PBs[i].updates.num_updates[2];
gupdates4[i] = PBs[i].updates.num_updates[3];
gupdates5[i] = PBs[i].updates.num_updates[4];
gupdates_addr[i] = (PBs[i].updates.data_hi << 16) | PBs[i].updates.data_lo;
gupdates_data[i] = Memory_Read_U32(gupdates_addr[i]);
gaudioFormat[i] = PBs[i].audio_addr.sample_format;
glooping[i] = PBs[i].audio_addr.looping;
gsrc_type[i] = PBs[i].src_type;
gis_stream[i] = PBs[i].is_stream;
// PBSampleRateConverter src
gratio[i] = (u32)(((PBs[i].src.ratio_hi << 16) + PBs[i].src.ratio_lo) * ratioFactor);
gratiohi[i] = PBs[i].src.ratio_hi;
gratiolo[i] = PBs[i].src.ratio_lo;
gfrac[i] = PBs[i].src.cur_addr_frac;
}
// ===============
// =======================================================================================
// Prepare the condition that makes us show a certain block
// --------------
template<class ParamBlockType>
bool PrepareConditions(bool Wii, int i, ParamBlockType &PBs)
{
bool Conditions;
if (m_frame->gOnlyLooping) // show only looping blocks
{
Conditions = PBs[i].audio_addr.looping;
}
else if (m_frame->gShowAll) // show all blocks
{
Conditions = true;
}
else if (m_frame->giShowAll > -1) // show all blocks
{
if (m_frame->giShowAll == 0)
Conditions = (i < 31);
else if(m_frame->giShowAll == 1)
Conditions = (i > 30 && i < 61);
else if(m_frame->giShowAll == 2)
Conditions = (i > 60 && i < 91);
else if(m_frame->giShowAll == 3)
Conditions = (i > 90 && i < 121);
}
else // show only the ones that have recently been running
{
Conditions = (numberRunning.at(i) > 0 || PBs[i].audio_addr.looping);
}
return Conditions;
}
// ===============
// I placed this in CUCode_AX because it needs access to private members of that class.
//template<class ParamBlockType>
//void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a, bool Wii, AXParamBlockWii *PBs, int numberOfPBs)
void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a, bool Wii)
{
// Declare structures
/**/
AXParamBlock PBs[64];
AXParamBlockWii PBw[NUMBER_OF_PBS];
int numberOfPBsWii = ReadOutPBsWii(m_addressPBs, PBw, NUMBER_OF_PBS - 1);
int numberOfPBsGC = ReadOutPBs(m_addressPBs, PBs, 64);
/**/
// Read out the number of PBs that have data
int numberOfPBs;
if(Wii)
numberOfPBs = numberOfPBsWii;
else
numberOfPBs = numberOfPBsGC;
/*
DebugLog("After Read LOG: Left: %04x | Right: %04x || Left: %04x | Right: %04x ",
PBs[94].mixer.unknown, PBs[94].mixer.unknown2,
PBw[94].mixer.unknown, PBw[94].mixer.unknown2
);
*/
// Select blocks to show
bool Conditions;
// =======================================================================================
// Update parameter values
// --------------
// We could chose to update these only if a block is currently running. Later I'll add options
// to see both the current and the latest active value.
//if (PBs[i].running)
int irun = 0;
for (int i = 0; i < numberOfPBs; i++)
{
// --------------------------------------------------------------------
// Write a line for the text log if nothing is playing
// --------------
if (PBs[i].running)
{
irun++;
}
if (i == numberOfPBs - 1 && irun == 0)
{
for (int i = 0; i < nFiles; i++)
{
std::string sfbuff;
sfbuff = "-----";
aprintf(i, (char *)sfbuff.c_str());
}
}
// --------------
// Prepare conditions
/**/
if(Wii)
Conditions = PrepareConditions(Wii, i, PBw);
else
Conditions = PrepareConditions(Wii, i, PBs);
if (Conditions)
{
// Collect parameters
if(Wii)
CollectPB(Wii, i, PBw);
else
CollectPB(Wii, i, PBs);
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// Write to file // Write to file
// -------------- // --------------
for (int ii = 0; ii < nFiles; ii++) for (int ii = 0; ii < nFiles; ii++)
{ {
std::string sfbuff; std::string sfbuff;
if(a == 0) sfbuff = "***"; // note if it's before or after an update if(a == 0) sfbuff = "***"; // note if it's before or after an update (*** = before)
else sfbuff = " "; else sfbuff = " ";
// write running // write running
@ -390,17 +502,18 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
// ============== // ==============
//PanicAlert("Done now before: %i", numberOfPBs);
// ======================================================================================= // =======================================================================================
// Control how often the screen is updated, and then update the screen // Control how often the screen is updated, and then update the screen
// -------------- // --------------
if(a == 0) j++; if(a == 0) j++;
//if(l == pow((double)2,32)) l=0; // reset l
//l++;
if (m_frame->gUpdFreq > 0 && j > (200/m_frame->gUpdFreq)) if (m_frame->gUpdFreq > 0 && j > (200/m_frame->gUpdFreq))
{ {
// ======================================================================================= // =======================================================================================
// Move all items back - Vector1 is a vector1[64][100] vector // Move all items back. Vector1 is a vector1[NUMBER_OF_PBS][100] vector.
// -------------- // --------------
/* /*
Move all items back like this: Move all items back like this:
@ -408,7 +521,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
2 3 2 3
3 ... 3 ...
*/ */
for (int i = 0; i < 64; i++) for (int i = 0; i < NUMBER_OF_PBS; i++)
{ {
for (int j = 1; j < vectorLength; j++) for (int j = 1; j < vectorLength; j++)
{ {
@ -433,7 +546,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
2 3 2 3
3 ... 3 ...
*/ */
for (int i = 0; i < 64; i++) for (int i = 0; i < NUMBER_OF_PBS; i++)
{ {
for (int j = 1; j < vectorLength2; j++) for (int j = 1; j < vectorLength2; j++)
{ {
@ -453,7 +566,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
// Count how many we have running now // Count how many we have running now
// -------------- // --------------
int jj = 0; int jj = 0;
for (int i = 0; i < 64; i++) for (int i = 0; i < NUMBER_OF_PBS; i++)
{ {
for (int j = 0; j < vectorLength2-1; j++) for (int j = 0; j < vectorLength2-1; j++)
{ {
@ -479,28 +592,16 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
// go through all running blocks // go through all running blocks
for (int i = 0; i < numberOfPBs; i++) for (int i = 0; i < numberOfPBs; i++)
{ {
// ---------------------------------------------------------------------------------------
// 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
// -------------- /**/if(Wii)
bool Conditions; Conditions = PrepareConditions(Wii, i, PBw);
if (m_frame->gOnlyLooping)
{
Conditions = PBs[i].audio_addr.looping;
}
else else
{ Conditions = PrepareConditions(Wii, i, PBs);
Conditions = (numberRunning.at(i) > 0 || PBs[i].audio_addr.looping);
}
// --------------
// Use the condition
// use the condition
if (Conditions) if (Conditions)
{ {
// Save playback history for the GUI debugger --------------------------
// Playback history for the GUI debugger --------------------------
if(m_frame) if(m_frame)
{ {
std::string guipr; // gui progress std::string guipr; // gui progress
@ -523,7 +624,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
} }
// Playback history for the console debugger -------------------------- // Make the playback history (progress bar) to display in the console debugger
for (int j = 0; j < vectorLength; j++) for (int j = 0; j < vectorLength; j++)
{ {
if(vector1.at(i).at(j) == 0) if(vector1.at(i).at(j) == 0)
@ -539,7 +640,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
// --------- // ---------
// hopefully this is false if we don't have a debugging window and so it doesn't cause a crash // Hopefully this is false if we don't have a debugging window and so it doesn't cause a crash
if(m_frame) if(m_frame)
{ {
m_frame->m_GPRListView->m_CachedRegs[2][i] = gsamplePos[i]; m_frame->m_GPRListView->m_CachedRegs[2][i] = gsamplePos[i];
@ -577,7 +678,6 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
sbuff = sbuff + writeMessage(m_frame->gPreset, i); strcpy(buffer, ""); sbuff = sbuff + writeMessage(m_frame->gPreset, i); strcpy(buffer, "");
sbuff = sbuff + "\n"; sbuff = sbuff + "\n";
} // end of if (PBs[i].running) } // end of if (PBs[i].running)
} // end of big loop - for (int i = 0; i < numberOfPBs; i++) } // end of big loop - for (int i = 0; i < numberOfPBs; i++)
@ -587,8 +687,13 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
// ======================================================================================= // =======================================================================================
// Write global values // Write global values
// --------------- // ---------------
sprintf(buffer, "\nThe parameter blocks span from %08x to %08x | distance %i | num. of blocks %i | _iSize %i\n", int nOfBlocks;
m_addressPBs, gLastBlock, (gLastBlock-m_addressPBs), (gLastBlock-m_addressPBs) / 192, _iSize); if(Wii)
nOfBlocks = (gLastBlock-m_addressPBs) / 256;
else
nOfBlocks = (gLastBlock-m_addressPBs) / 192;
sprintf(buffer, "\nThe parameter blocks span from %08x to %08x | distance %i | num. of blocks %i | _iSize %i | numberOfPBs %i\n",
m_addressPBs, gLastBlock, (gLastBlock-m_addressPBs), nOfBlocks, _iSize, numberOfPBs);
sbuff = sbuff + buffer; strcpy(buffer, ""); sbuff = sbuff + buffer; strcpy(buffer, "");
// =============== // ===============
@ -609,12 +714,6 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
sbuff = sbuff + "\n"; sbuff = sbuff + "\n";
if(!iupdonce) if(!iupdonce)
{ {
/*
for (int i = 0; i < 10; i++)
{
viupd.at(i) == 0;
}
*/
viupd.at(0) = 1; viupd.at(0) = 1;
viupd.at(1) = 1; viupd.at(1) = 1;
viupd.at(2) = 1; viupd.at(2) = 1;

View file

@ -408,7 +408,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
// write logging data to debugger // write logging data to debugger
if (m_frame) if (m_frame)
{ {
CUCode_AX::Logging(_pBuffer, _iSize, 0); CUCode_AX::Logging(_pBuffer, _iSize, 0, false);
} }
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
@ -464,7 +464,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
// write logging data to debugger again after the update // write logging data to debugger again after the update
if (m_frame) if (m_frame)
{ {
CUCode_AX::Logging(_pBuffer, _iSize, 1); CUCode_AX::Logging(_pBuffer, _iSize, 1, false);
} }
} }

View file

@ -23,7 +23,7 @@
enum enum
{ {
NUMBER_OF_PBS = 64 NUMBER_OF_PBS = 128
}; };
class CUCode_AX : public IUCode class CUCode_AX : public IUCode
@ -37,7 +37,9 @@ public:
void Update(); void Update();
// Logging // Logging
void Logging(short* _pBuffer, int _iSize, int a); //template<class ParamBlockType>
//void Logging(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, int numberOfPBs);
void Logging(short* _pBuffer, int _iSize, int a, bool Wii);
void SaveLog_(bool Wii, const char* _fmt, ...); void SaveLog_(bool Wii, const char* _fmt, ...);
void SaveMail(bool Wii, u32 _uMail); void SaveMail(bool Wii, u32 _uMail);
void SaveLogFile(std::string f, int resizeTo, bool type, bool Wii); void SaveLogFile(std::string f, int resizeTo, bool type, bool Wii);

View file

@ -135,7 +135,7 @@ struct AXParamBlock
u16 this_pb_lo; u16 this_pb_lo;
u16 src_type; // Type of sample rate converter (none, ?, linear) u16 src_type; // Type of sample rate converter (none, ?, linear)
u16 unknown1; u16 coef_select;
u16 mixer_control; u16 mixer_control;
u16 running; // 1=RUN 0=STOP u16 running; // 1=RUN 0=STOP

View file

@ -76,15 +76,18 @@ int ReadOutPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num)
{ {
int count = 0; int count = 0;
u32 blockAddr = pbs_address; u32 blockAddr = pbs_address;
u32 pAddr = 0;
// reading and 'halfword' swap // reading and 'halfword' swap
for (int i = 0; i < _num; i++) for (int i = 0; i < _num; i++)
{ {
const short *pSrc = (const short *)g_dspInitialize.pGetMemoryPointer(blockAddr); const short *pSrc = (const short *)g_dspInitialize.pGetMemoryPointer(blockAddr);
if (pSrc != NULL) pAddr = blockAddr;
u32 nextBlock = (Common::swap16(pSrc[162]) << 16 | Common::swap16(pSrc[163]));
if (pSrc != NULL && nextBlock == blockAddr + 320) // new way to stop
{ {
short *pDest = (short *)&_pPBs[i]; short *pDest = (short *)&_pPBs[i];
for (size_t p = 0; p < sizeof(AXParamBlock) / 2; p++) for (int p = 0; p < sizeof(AXParamBlockWii) / 2; p++)
{ {
pDest[p] = Common::swap16(pSrc[p]); pDest[p] = Common::swap16(pSrc[p]);
@ -138,7 +141,7 @@ void CUCode_AXWii::MixAdd(short* _pBuffer, int _iSize)
// write logging data to debugger // write logging data to debugger
if (m_frame) if (m_frame)
{ {
lCUCode_AX->Logging(_pBuffer, _iSize, 0); lCUCode_AX->Logging(_pBuffer, _iSize, 0, true);
} }
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
@ -175,7 +178,6 @@ void CUCode_AXWii::MixAdd(short* _pBuffer, int _iSize)
MixAddVoice(pb, templbuffer, temprbuffer, _iSize); MixAddVoice(pb, templbuffer, temprbuffer, _iSize);
} }
// write back out pbs
WriteBackPBsWii(m_addressPBs, PBs, numberOfPBs); WriteBackPBsWii(m_addressPBs, PBs, numberOfPBs);
for (int i = 0; i < _iSize; i++) for (int i = 0; i < _iSize; i++)
@ -192,9 +194,9 @@ void CUCode_AXWii::MixAdd(short* _pBuffer, int _iSize)
} }
// write logging data to debugger again after the update // write logging data to debugger again after the update
//if (m_frame) if (m_frame)
{ {
// CUCode_AXWii::Logging(_pBuffer, _iSize, 1); lCUCode_AX->Logging(_pBuffer, _iSize, 1, true);
} }
} }

View file

@ -20,7 +20,7 @@
#include "UCode_AXStructs.h" #include "UCode_AXStructs.h"
#define NUMBER_OF_PBS 64 #define NUMBER_OF_PBS 128
class CUCode_AXWii : public IUCode class CUCode_AXWii : public IUCode
{ {

View file

@ -67,10 +67,12 @@ inline u16 ADPCM_Vol(u16 vol, u16 delta, u16 mixer_control)
int x = vol; int x = vol;
if (delta && delta < 0x5000) if (delta && delta < 0x5000)
x += delta * 20 * 8; // unsure what the right step is x += delta * 20 * 8; // unsure what the right step is
else if (delta && delta > 0x5000) //x += 1 * 20 * 8;
else if (delta && delta > 05000)
//x -= (0x10000 - delta); // this is to small, it's often 1 //x -= (0x10000 - delta); // this is to small, it's often 1
x -= (0x10000 - delta) * 20 * 16; // if this was 20 * 8 the sounds in Fire Emblem and Paper Mario x -= (0x10000 - delta) * 20 * 16; // if this was 20 * 8 the sounds in Fire Emblem and Paper Mario
// did not have time to go to zero before the were closed // did not have time to go to zero before the were closed
//x -= 1 * 20 * 16;
// make lower limits // make lower limits
if (x < 0) x = 0; if (x < 0) x = 0;

View file

@ -187,10 +187,18 @@ inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer,
} }
} // end of the _iSize loop } // end of the _iSize loop
// Update volume
if(m_frame->gVolume) // allow us to turn this off in the debugger
{
pb.mixer.volume_left = ADPCM_Vol(pb.mixer.volume_left, pb.mixer.unknown, pb.mixer_control);
pb.mixer.volume_right = ADPCM_Vol(pb.mixer.volume_right, pb.mixer.unknown2, pb.mixer_control);
}
pb.src.cur_addr_frac = (u16)frac; pb.src.cur_addr_frac = (u16)frac;
pb.audio_addr.cur_addr_hi = samplePos >> 16; pb.audio_addr.cur_addr_hi = samplePos >> 16;
pb.audio_addr.cur_addr_lo = (u16)samplePos; pb.audio_addr.cur_addr_lo = (u16)samplePos;
} } //if (pb.running)
} }
#endif // _UCODE_AX_VOICE_H #endif // _UCODE_AX_VOICE_H

View file

@ -199,6 +199,7 @@ void DSP_Initialize(DSPInitialize _dspInitialize)
g_pMemory = g_dspInitialize.pGetMemoryPointer(0); g_pMemory = g_dspInitialize.pGetMemoryPointer(0);
#if defined(_DEBUG) || defined(DEBUGFAST)
gpName = g_dspInitialize.pName(); // save the game name globally gpName = g_dspInitialize.pName(); // save the game name globally
for (int i = 0; i < gpName.length(); ++i) // and fix it for (int i = 0; i < gpName.length(); ++i) // and fix it
{ {
@ -207,6 +208,7 @@ void DSP_Initialize(DSPInitialize _dspInitialize)
if (gpName[i] == ':') gpName[i] = ' '; if (gpName[i] == ':') gpName[i] = ' ';
} }
wprintf("\n"); wprintf("\n");
#endif
CDSPHandler::CreateInstance(); CDSPHandler::CreateInstance();