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
@@ -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();
}
@@ -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<std::string> 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<std::string> 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,
@@ -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;
@@ -23,12 +23,14 @@
#ifdef _WIN32
#include <windows.h>
#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;
File diff suppressed because it is too large Load Diff
@@ -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);
}
}
@@ -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<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 SaveMail(bool Wii, u32 _uMail);
void SaveLogFile(std::string f, int resizeTo, bool type, bool Wii);
@@ -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
@@ -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);
}
}
@@ -20,7 +20,7 @@
#include "UCode_AXStructs.h"
#define NUMBER_OF_PBS 64
#define NUMBER_OF_PBS 128
class CUCode_AXWii : public IUCode
{
@@ -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;
@@ -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
@@ -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();