diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp index a95a052faf..8f58dc3ea8 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp @@ -48,14 +48,13 @@ BEGIN_EVENT_TABLE(CDebugger,wxDialog) EVT_BUTTON(ID_UPD,CDebugger::OnUpdate) // buttons - EVT_CHECKBOX(IDC_CHECK1,CDebugger::SaveFile) // options - EVT_CHECKBOX(IDC_CHECK3,CDebugger::OnlyLooping) - EVT_CHECKBOX(IDC_CHECK4,CDebugger::ShowHideConsole) + // left cotrols + EVT_CHECKLISTBOX(IDC_CHECKLIST5, CDebugger::OnOptions) // options + EVT_CHECKLISTBOX(IDC_CHECKLIST6, CDebugger::OnShowAll) + // right cotrols EVT_RADIOBOX(IDC_RADIO1,CDebugger::ChangeFrequency) // update frequency - EVT_RADIOBOX(IDC_RADIO2,CDebugger::ChangePreset) // presets - EVT_CHECKLISTBOX(IDC_CHECKLIST1, CDebugger::OnSettingsCheck) // settings 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) //, gUpdFreq(5) // loaded from file , gPreset(0) + , giShowAll(-1) + , gSSBM(true) , gSSBMremedy1(true) , gSSBMremedy2(true) @@ -108,8 +109,8 @@ void CDebugger::Save(IniFile& _IniFile) const _IniFile.Set("SoundWindow", "y", GetPosition().y); _IniFile.Set("SoundWindow", "w", GetSize().GetWidth()); _IniFile.Set("SoundWindow", "h", GetSize().GetHeight()); - } - _IniFile.Set("SoundWindow", "Console", m_Check[2]->IsChecked()); // save settings + } + _IniFile.Set("SoundWindow", "Console", m_options->IsChecked(3)); // save settings _IniFile.Set("SoundWindow", "UpdateFrequency", m_RadioBox[1]->GetSelection()); _IniFile.Set("SoundWindow", "ScanMails", m_gcwiiset->IsChecked(0)); _IniFile.Set("SoundWindow", "StoreMails", m_gcwiiset->IsChecked(1)); @@ -127,21 +128,19 @@ void CDebugger::Load(IniFile& _IniFile) // saved settings bool Console; - _IniFile.Get("SoundWindow", "Console", &Console, m_Check[2]->IsChecked()); - m_Check[2]->SetValue(Console); + _IniFile.Get("SoundWindow", "Console", &Console, m_options->IsChecked(3)); + m_options->Check(3, Console); DoShowHideConsole(); _IniFile.Get("SoundWindow", "UpdateFrequency", &gUpdFreq, m_RadioBox[1]->GetSelection()); m_RadioBox[1]->SetSelection(gUpdFreq); - //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); - - + m_gcwiiset->Check(1, StoreMails); } void CDebugger::CreateGUIControls() @@ -220,27 +219,66 @@ SetTitle(wxT("Sound Debugging")); // Options checkboxlist (m_PageMain) ----------------------------------- 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 - m_Check[0] = new wxCheckBox(m_PageMain, IDC_CHECK1, wxT("Save to file"), - wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - m_Check[1] = new wxCheckBox(m_PageMain, IDC_CHECK2, wxT("Show updated"), - wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - 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_options->Append(wxT("Save to file")); + m_options->Append(wxT("Only looping")); + m_options->Append(wxT("Show all")); + m_options->Append(wxT("Show console")); + + m_options->Check(0, gSaveFile); + m_options->Check(1, gOnlyLooping); + m_options->Check(2, gShowAll); + 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); + // ------------------------ + - m_checkSizer->Add(m_Check[0], 0, 0, 5); - m_checkSizer->Add(m_Check[1], 0, 0, 5); - m_checkSizer->Add(m_Check[7], 0, 0, 5); - m_checkSizer->Add(m_Check[2], 0, 0, 5); + // 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); + + // 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) ----------------------------- + // -------------------------------------------------------------------- + // 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); @@ -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 // ------------------------ @@ -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; sButtons = new wxBoxSizer(wxVERTICAL); @@ -330,12 +339,28 @@ SetTitle(wxT("Sound Debugging")); sButtons->AddStretchSpacer(1); sButtons->Add(m_checkSizer, 0, 0, 5); sButtons->AddStretchSpacer(1); - sButtons->Add(m_RadioBox[0], 0, 0, 5); + sButtons->Add(m_showallSizer, 0, 0, 5); sButtons->AddStretchSpacer(1); - sButtons->Add(m_RadioBox[1], 0, 0, 5); + sButtons->Add(m_RadioBox[0], 0, 0, 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) // ----------------------------- @@ -442,21 +465,13 @@ void CDebugger::ChangePreset(wxCommandEvent& event) void CDebugger::DoChangePreset() { if(m_RadioBox[2]->GetSelection() == 0) - { gPreset = 0; - } else if(m_RadioBox[2]->GetSelection() == 1) - { gPreset = 1; - } else if(m_RadioBox[2]->GetSelection() == 2) - { gPreset = 2; - } else if(m_RadioBox[2]->GetSelection() == 3) - { gPreset = 3; - } } // ============== @@ -472,54 +487,44 @@ void CDebugger::ChangeFrequency(wxCommandEvent& event) void CDebugger::DoChangeFrequency() { if(m_RadioBox[1]->GetSelection() == 0) - { gUpdFreq = 0; - } else if(m_RadioBox[1]->GetSelection() == 1) - { gUpdFreq = 5; - } else if(m_RadioBox[1]->GetSelection() == 2) - { gUpdFreq = 15; - } - else - { + else if(m_RadioBox[1]->GetSelection() == 3) gUpdFreq = 30; - } } // ============== // ======================================================================================= -// Show only looping blocks +// Options // -------------- -void CDebugger::OnlyLooping(wxCommandEvent& event) -{ - if(m_Check[7]->IsChecked()) - { - gOnlyLooping = true; +void CDebugger::OnOptions(wxCommandEvent& event) +{ + gSaveFile = m_options->IsChecked(0); + gOnlyLooping = m_options->IsChecked(1); + gShowAll = m_options->IsChecked(2); + gSaveFile = m_options->IsChecked(3); - } - else - { - gOnlyLooping = false; - } + if(event.GetInt() == 3) DoShowHideConsole(); } -// ============== +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() { - if(m_Check[2]->IsChecked()) + if(m_options->IsChecked(3)) { OpenConsole(); } diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h index eb52ed5f6f..60c3111f20 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h @@ -73,11 +73,11 @@ class CDebugger : public wxDialog void NotifyUpdate(); void OnUpdate(wxCommandEvent& event); - void SaveFile(wxCommandEvent& event); // options - void ShowHideConsole(wxCommandEvent& event); + void ShowHideConsole(wxCommandEvent& event); // options 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 DoChangeFrequency(); @@ -100,12 +100,14 @@ class CDebugger : public wxDialog CPBView* m_GPRListView; std::vector sMail, sMailEnd, sFullMail; - wxRadioBox *m_RadioBox[4]; + wxRadioBox * m_RadioBox[4], * m_RadioBoxShowAll; bool gSaveFile; // main options bool gOnlyLooping; + bool gShowAll; + int giShowAll; int gUpdFreq;// main update freq. - bool gPreset; // main presets + int gPreset; // main presets bool gSSBM; // main settings bool gSSBMremedy1; @@ -128,7 +130,7 @@ class CDebugger : public wxDialog wxCheckBox *m_Check[9]; 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; std::vector all_all_files, all_files, gc_files, wii_files; @@ -141,8 +143,8 @@ class CDebugger : public wxDialog IDC_CHECK2, IDC_CHECK3, IDC_CHECK4, - IDC_CHECKLIST1, IDC_CHECKLIST2, IDC_CHECKLIST3, IDC_CHECKLIST4, - IDC_RADIO0, IDC_RADIO1, IDC_RADIO2, IDC_RADIO3, + IDC_CHECKLIST1, IDC_CHECKLIST2, IDC_CHECKLIST3, IDC_CHECKLIST4, IDC_CHECKLIST5, IDC_CHECKLIST6, + IDC_RADIO0, IDC_RADIO1, IDC_RADIO2, IDC_RADIO3, IDC_RADIO4, IDG_LABEL1, IDG_LABEL2, ID_UPD, ID_SELC, diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Globals.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Globals.cpp index f212286fca..747f7fd881 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Globals.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Globals.cpp @@ -28,8 +28,8 @@ void __Log(int, const char *fmt, ...) void DebugLog(const char* _fmt, ...) { #if defined(_DEBUG) || defined(DEBUGFAST) -//if(strncmp (_fmt, "AX", 2)) // match = 0, in that case this is ignored -if(true) +if(strncmp (_fmt, "AX", 2)) // match = 0, in that case this is ignored +//if(true) { char Msg[512]; va_list ap; diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Console.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Console.cpp index 936b9b58a2..a506fc66fd 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Console.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Console.cpp @@ -23,12 +23,14 @@ #ifdef _WIN32 #include #endif +#include "../Debugger/Debugger.h" +extern CDebugger* m_frame; // -------------------- // On and off bool g_consoleEnable = true; -int gSaveFile = 0; +//int gSaveFile = 0; #define DEBUG_HLE @@ -93,7 +95,7 @@ void startConsoleWin(int width, int height, char* fname) int aprintf(int a, char *fmt, ...) { #if defined(DEBUG_HLE) && defined(_WIN32) - if(gSaveFile) + if(m_frame->gSaveFile) { char s[5000]; // WARNING: mind this value va_list argptr; @@ -127,12 +129,12 @@ int aprintf(int a, char *fmt, ...) int wprintf(char *fmt, ...) { #if defined(DEBUG_HLE) && defined(_WIN32) - char s[5000]; // WARNING: mind this value + char s[1024*20]; // Warning, mind this value va_list argptr; int cnt; va_start(argptr, fmt); - cnt = vsnprintf(s, 5000, fmt, argptr); + cnt = vsnprintf(s, 1024*20, fmt, argptr); va_end(argptr); DWORD cCharsWritten; diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Logging.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Logging.cpp index 812fd107ee..5c4542a8ee 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Logging.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Logging.cpp @@ -39,7 +39,7 @@ #include "../UCodes/UCodes.h" #include "../UCodes/UCode_AXStructs.h" #include "../UCodes/UCode_AX.h" - +#include "../UCodes/UCode_AXWii.h" // Externals @@ -47,72 +47,72 @@ u32 gLastBlock; extern int nFiles; float ratioFactor; // a global to get the ratio factor from MixAdd extern CDebugger* m_frame; - +//int PBSize = 128; // Parameter blocks - std::vector gloopPos(64); - std::vector gsampleEnd(64); - std::vector gsamplePos(64); + std::vector gloopPos(NUMBER_OF_PBS); + std::vector gsampleEnd(NUMBER_OF_PBS); + std::vector gsamplePos(NUMBER_OF_PBS); // main - std::vector gsrc_type(64); - std::vector gis_stream(64); + std::vector gsrc_type(NUMBER_OF_PBS); + std::vector gis_stream(NUMBER_OF_PBS); // PBSampleRateConverter src - std::vector gratio(64); - std::vector gratiohi(64); - std::vector gratiolo(64); - std::vector gfrac(64); - std::vector gcoef(64); + std::vector gratio(NUMBER_OF_PBS); + std::vector gratiohi(NUMBER_OF_PBS); + std::vector gratiolo(NUMBER_OF_PBS); + std::vector gfrac(NUMBER_OF_PBS); + std::vector gcoef(NUMBER_OF_PBS); // PBSampleRateConverter mixer - std::vector gvolume_left(64); - std::vector gmix_unknown(64); - std::vector gvolume_right(64); - std::vector gmix_unknown2(64); - std::vector gmixer_control(64); + std::vector gvolume_left(NUMBER_OF_PBS); + std::vector gmix_unknown(NUMBER_OF_PBS); + std::vector gvolume_right(NUMBER_OF_PBS); + std::vector gmix_unknown2(NUMBER_OF_PBS); + std::vector gmixer_control(NUMBER_OF_PBS); - std::vector gmixer_vol1(64); - std::vector gmixer_vol2(64); - std::vector gmixer_vol3(64); - std::vector gmixer_vol4(64); - std::vector gmixer_vol5(64); - std::vector gmixer_vol6(64); - std::vector gmixer_vol7(64); + std::vector gmixer_vol1(NUMBER_OF_PBS); + std::vector gmixer_vol2(NUMBER_OF_PBS); + std::vector gmixer_vol3(NUMBER_OF_PBS); + std::vector gmixer_vol4(NUMBER_OF_PBS); + std::vector gmixer_vol5(NUMBER_OF_PBS); + std::vector gmixer_vol6(NUMBER_OF_PBS); + std::vector gmixer_vol7(NUMBER_OF_PBS); - std::vector gmixer_d1(64); - std::vector gmixer_d2(64); - std::vector gmixer_d3(64); - std::vector gmixer_d4(64); - std::vector gmixer_d5(64); - std::vector gmixer_d6(64); - std::vector gmixer_d7(64); + std::vector gmixer_d1(NUMBER_OF_PBS); + std::vector gmixer_d2(NUMBER_OF_PBS); + std::vector gmixer_d3(NUMBER_OF_PBS); + std::vector gmixer_d4(NUMBER_OF_PBS); + std::vector gmixer_d5(NUMBER_OF_PBS); + std::vector gmixer_d6(NUMBER_OF_PBS); + std::vector gmixer_d7(NUMBER_OF_PBS); // PBVolumeEnvelope vol_env - std::vector gcur_volume(64); - std::vector gcur_volume_delta(64); + std::vector gcur_volume(NUMBER_OF_PBS); + std::vector gcur_volume_delta(NUMBER_OF_PBS); // PBAudioAddr audio_addr (incl looping) - std::vector gaudioFormat(64); - std::vector glooping(64); - std::vector gloop1(64); - std::vector gloop2(64); - std::vector gloop3(64); + std::vector gaudioFormat(NUMBER_OF_PBS); + std::vector glooping(NUMBER_OF_PBS); + std::vector gloop1(NUMBER_OF_PBS); + std::vector gloop2(NUMBER_OF_PBS); + std::vector gloop3(NUMBER_OF_PBS); // PBADPCMInfo adpcm - std::vector gadloop1(64); - std::vector gadloop2(64); - std::vector gadloop3(64); + std::vector gadloop1(NUMBER_OF_PBS); + std::vector gadloop2(NUMBER_OF_PBS); + std::vector gadloop3(NUMBER_OF_PBS); // updates - std::vector gupdates1(64); - std::vector gupdates2(64); - std::vector gupdates3(64); - std::vector gupdates4(64); - std::vector gupdates5(64); - std::vector gupdates_addr(64); - std::vector gupdates_data(64); + std::vector gupdates1(NUMBER_OF_PBS); + std::vector gupdates2(NUMBER_OF_PBS); + std::vector gupdates3(NUMBER_OF_PBS); + std::vector gupdates4(NUMBER_OF_PBS); + std::vector gupdates5(NUMBER_OF_PBS); + std::vector gupdates_addr(NUMBER_OF_PBS); + std::vector gupdates_data(NUMBER_OF_PBS); // Counters @@ -132,9 +132,9 @@ int vectorLength2 = 100; // for console version // should we worry about the additonal memory these lists require? bool will allocate // very little memory -std::vector< std::vector > vector1(64, std::vector(vectorLength, 0)); -std::vector< std::vector > vector2(64, std::vector(vectorLength2, 0)); -std::vector numberRunning(64); +std::vector< std::vector > vector1(NUMBER_OF_PBS, std::vector(vectorLength, 0)); +std::vector< std::vector > vector2(NUMBER_OF_PBS, std::vector(vectorLength2, 0)); +std::vector numberRunning(NUMBER_OF_PBS); // Classes @@ -245,31 +245,207 @@ std::string writeMessage(int a, int i) } -// ======================================================================================= +// ================ +// ======================================================================================= +// Collect parameters from Wii or GC +// -------------- +/* +std::string ShowAllPB(int a, int i) +{ + if(a == 0) + { + + } + else if(a == 1) + { + + + } + 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 void CollectPB(bool Wii, int i, ParamBlockType &PBs) +//void CollectPB(bool Wii, int i, AXParamBlockWii * PBw, AXParamBlock * PBs) +{ + // AXPB base + gcoef[i] = PBs[i].coef_select; + + 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; + gsamplePos[i] = (PBs[i].audio_addr.cur_addr_hi << 16) | PBs[i].audio_addr.cur_addr_lo; + + // mixer (some differences) + gvolume_left[i] = PBs[i].mixer.volume_left; + 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_unknown2[i] = PBs[i].mixer.unknown2; + + gmixer_control[i] = PBs[i].mixer_control; + gcur_volume[i] = PBs[i].vol_env.cur_volume; + gcur_volume_delta[i] = PBs[i].vol_env.cur_volume_delta; + + gmixer_vol1[i] = PBs[i].mixer.unknown3[0]; + gmixer_vol2[i] = PBs[i].mixer.unknown3[2]; + gmixer_vol3[i] = PBs[i].mixer.unknown3[4]; + gmixer_vol4[i] = PBs[i].mixer.unknown3[6]; + gmixer_vol5[i] = PBs[i].mixer.unknown3[0]; + gmixer_vol6[i] = PBs[i].mixer.unknown3[2]; + gmixer_vol7[i] = PBs[i].mixer.unknown3[4]; + + //gmixer_d1[i] = PBs[i].mixer.unknown4[1]; + 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_d4[i] = PBs[i].mixer.unknown4[7]; + gmixer_d5[i] = PBs[i].mixer.unknown4[1]; + gmixer_d6[i] = PBs[i].mixer.unknown4[3]; + 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 +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. -void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a) +//template +//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) { - AXParamBlock PBs[NUMBER_OF_PBS]; - int numberOfPBs = ReadOutPBs(m_addressPBs, PBs, NUMBER_OF_PBS); + // 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 lastets active value. + // 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++; } - - // write a line if nothing is playing + if (i == numberOfPBs - 1 && irun == 0) { for (int i = 0; i < nFiles; i++) @@ -279,88 +455,24 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a) aprintf(i, (char *)sfbuff.c_str()); } } + // -------------- + - // --------------------------------------------------------------------------------------- // Prepare conditions - // -------------- - bool Conditions; - if (m_frame->gOnlyLooping) - { - Conditions = PBs[i].audio_addr.looping; - } + /**/ + if(Wii) + Conditions = PrepareConditions(Wii, i, PBw); else - { - Conditions = numberRunning.at(i) > 0 || PBs[i].audio_addr.looping; - } - // -------------- + Conditions = PrepareConditions(Wii, i, PBs); if (Conditions) { - // AXPB base - gcoef[i] = PBs[i].unknown1; - - 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; - gsamplePos[i] = (PBs[i].audio_addr.cur_addr_hi << 16) | PBs[i].audio_addr.cur_addr_lo; - - // 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; - - // 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_right[i] = PBs[i].mixer.volume_right; - - gmix_unknown[i] = PBs[i].mixer.unknown; - gmix_unknown2[i] = PBs[i].mixer.unknown2; - - gmixer_control[i] = PBs[i].mixer_control; - gcur_volume[i] = PBs[i].vol_env.cur_volume; - gcur_volume_delta[i] = PBs[i].vol_env.cur_volume_delta; - - gmixer_vol1[i] = PBs[i].mixer.unknown3[0]; - gmixer_vol2[i] = PBs[i].mixer.unknown3[2]; - gmixer_vol3[i] = PBs[i].mixer.unknown3[4]; - gmixer_vol4[i] = PBs[i].mixer.unknown3[6]; - gmixer_vol5[i] = PBs[i].mixer.unknown3[0]; - gmixer_vol6[i] = PBs[i].mixer.unknown3[2]; - gmixer_vol7[i] = PBs[i].mixer.unknown3[4]; - - gmixer_d1[i] = PBs[i].mixer.unknown4[1]; - gmixer_d2[i] = PBs[i].mixer.unknown4[3]; - gmixer_d3[i] = PBs[i].mixer.unknown4[5]; - gmixer_d4[i] = PBs[i].mixer.unknown4[7]; - gmixer_d5[i] = PBs[i].mixer.unknown4[1]; - gmixer_d6[i] = PBs[i].mixer.unknown4[3]; - gmixer_d7[i] = PBs[i].mixer.unknown4[5]; + // Collect parameters + if(Wii) + CollectPB(Wii, i, PBw); + else + CollectPB(Wii, i, PBs); // --------------------------------------------------------------------------------------- // Write to file @@ -368,7 +480,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a) for (int ii = 0; ii < nFiles; ii++) { 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 = " "; // 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 // -------------- 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)) { // ======================================================================================= - // 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: @@ -408,7 +521,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a) 2 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++) { @@ -433,7 +546,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a) 2 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++) { @@ -453,7 +566,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a) // Count how many we have running now // -------------- 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++) { @@ -472,35 +585,23 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a) // -------------- char buffer [1000] = ""; std::string sbuff; - sbuff = writeTitle(m_frame->gPreset); + sbuff = writeTitle(m_frame->gPreset); // ============== // go through all running blocks for (int i = 0; i < numberOfPBs; i++) { - - // --------------------------------------------------------------------------------------- // Prepare conditions. TODO: We use this in two places now, make it only one - // -------------- - bool Conditions; - if (m_frame->gOnlyLooping) - { - Conditions = PBs[i].audio_addr.looping; - } + /**/if(Wii) + Conditions = PrepareConditions(Wii, i, PBw); else - { - Conditions = (numberRunning.at(i) > 0 || PBs[i].audio_addr.looping); - } - // -------------- + Conditions = PrepareConditions(Wii, i, PBs); - - // use the condition + // Use the condition if (Conditions) - { - - - // Playback history for the GUI debugger -------------------------- + { + // Save playback history for the GUI debugger -------------------------- if(m_frame) { 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++) { 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) { 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 + "\n"; - } // end of if (PBs[i].running) } // 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 // --------------- - 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); + int nOfBlocks; + 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, ""); // =============== @@ -609,12 +714,6 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a) sbuff = sbuff + "\n"; if(!iupdonce) { - /* - for (int i = 0; i < 10; i++) - { - viupd.at(i) == 0; - } - */ viupd.at(0) = 1; viupd.at(1) = 1; viupd.at(2) = 1; diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp index fee288eedb..419582415e 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp @@ -408,7 +408,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize) // write logging data to debugger 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 if (m_frame) { - CUCode_AX::Logging(_pBuffer, _iSize, 1); + CUCode_AX::Logging(_pBuffer, _iSize, 1, false); } } diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.h index 2cae446a50..b7ca8ad0a4 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.h @@ -23,7 +23,7 @@ enum { - NUMBER_OF_PBS = 64 + NUMBER_OF_PBS = 128 }; class CUCode_AX : public IUCode @@ -37,7 +37,9 @@ public: void Update(); // Logging - void Logging(short* _pBuffer, int _iSize, int a); + //template + //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 SaveMail(bool Wii, u32 _uMail); void SaveLogFile(std::string f, int resizeTo, bool type, bool Wii); diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXStructs.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXStructs.h index ebe745e059..63a98ddcc0 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXStructs.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXStructs.h @@ -135,7 +135,7 @@ struct AXParamBlock u16 this_pb_lo; u16 src_type; // Type of sample rate converter (none, ?, linear) - u16 unknown1; + u16 coef_select; u16 mixer_control; u16 running; // 1=RUN 0=STOP diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.cpp index 244ecda830..ecfba7bb55 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.cpp @@ -50,7 +50,7 @@ CUCode_AXWii::CUCode_AXWii(CMailHandler& _rMailHandler) templbuffer = new int[1024 * 1024]; temprbuffer = new int[1024 * 1024]; - lCUCode_AX = new CUCode_AX(_rMailHandler); + lCUCode_AX = new CUCode_AX(_rMailHandler); } CUCode_AXWii::~CUCode_AXWii() @@ -76,24 +76,27 @@ int ReadOutPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num) { int count = 0; u32 blockAddr = pbs_address; + u32 pAddr = 0; // reading and 'halfword' swap for (int i = 0; i < _num; i++) { 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]; - 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]); - + #if defined(_DEBUG) || defined(DEBUGFAST) gLastBlock = blockAddr + p*2 + 2; // save last block location #endif } blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo; - count++; + count++; } else break; @@ -113,7 +116,7 @@ void WriteBackPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num) short* pSrc = (short*)&_pPBs[i]; short* pDest = (short*)g_dspInitialize.pGetMemoryPointer(blockAddr); for (size_t p = 0; p < sizeof(AXParamBlockWii) / 2; p++) - { + { pDest[p] = Common::swap16(pSrc[p]); } @@ -138,7 +141,7 @@ void CUCode_AXWii::MixAdd(short* _pBuffer, int _iSize) // write logging data to debugger if (m_frame) { - lCUCode_AX->Logging(_pBuffer, _iSize, 0); + lCUCode_AX->Logging(_pBuffer, _iSize, 0, true); } // --------------------------------------------------------------------------------------- @@ -170,12 +173,11 @@ void CUCode_AXWii::MixAdd(short* _pBuffer, int _iSize) // ------------ for (int i = 0; i < numberOfPBs; i++) - { + { AXParamBlockWii& pb = PBs[i]; MixAddVoice(pb, templbuffer, temprbuffer, _iSize); - } + } - // write back out pbs WriteBackPBsWii(m_addressPBs, PBs, numberOfPBs); 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 - //if (m_frame) + if (m_frame) { -// CUCode_AXWii::Logging(_pBuffer, _iSize, 1); + lCUCode_AX->Logging(_pBuffer, _iSize, 1, true); } } diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.h index 522d00ee3d..e2d6f777bd 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.h @@ -20,7 +20,7 @@ #include "UCode_AXStructs.h" -#define NUMBER_OF_PBS 64 +#define NUMBER_OF_PBS 128 class CUCode_AXWii : public IUCode { diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_ADPCM.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_ADPCM.h index ab69842595..029ed3e838 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_ADPCM.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_ADPCM.h @@ -67,10 +67,12 @@ inline u16 ADPCM_Vol(u16 vol, u16 delta, u16 mixer_control) int x = vol; if (delta && delta < 0x5000) 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) * 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 + //x -= 1 * 20 * 16; // make lower limits if (x < 0) x = 0; diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_Voice.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_Voice.h index 1362ea9635..ac3dbd0c8d 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_Voice.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_Voice.h @@ -187,10 +187,18 @@ inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer, } } // 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.audio_addr.cur_addr_hi = samplePos >> 16; pb.audio_addr.cur_addr_lo = (u16)samplePos; - } + } //if (pb.running) } #endif // _UCODE_AX_VOICE_H diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp index cf2b2a43c3..c4f21ba733 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp @@ -199,6 +199,7 @@ void DSP_Initialize(DSPInitialize _dspInitialize) g_pMemory = g_dspInitialize.pGetMemoryPointer(0); +#if defined(_DEBUG) || defined(DEBUGFAST) gpName = g_dspInitialize.pName(); // save the game name globally 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] = ' '; } wprintf("\n"); +#endif CDSPHandler::CreateInstance();