Tried another SSBM fix. Please test if "SSBM remedy 2" is still needed in SSBM by turning it off from the debugger. I didn't need it but perhaps someone else does.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@786 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
f4b9a22324
commit
c0af02df49
|
@ -25,21 +25,33 @@
|
|||
#include "../Logging/Console.h" // open and close console
|
||||
|
||||
// externals
|
||||
extern int gSaveFile; // make this an int to allow multiple save file options
|
||||
extern int gUpdFreq;
|
||||
extern int gPreset;
|
||||
extern bool gReset;
|
||||
extern bool gSSBM;
|
||||
extern bool gSSBMremedy1;
|
||||
extern bool gSSBMremedy2;
|
||||
extern bool gSequenced;
|
||||
extern bool gOnlyLooping;
|
||||
|
||||
// =======================================================================================
|
||||
// Declare events
|
||||
BEGIN_EVENT_TABLE(CDebugger,wxDialog)
|
||||
EVT_CLOSE(CDebugger::OnClose)
|
||||
EVT_BUTTON(ID_UPD,CDebugger::OnUpdate)
|
||||
EVT_CHECKBOX(IDC_CHECK0,CDebugger::SaveFile)
|
||||
EVT_CHECKBOX(IDC_CHECK2,CDebugger::ShowHideConsole)
|
||||
|
||||
EVT_CHECKBOX(IDC_CHECK3,CDebugger::SSBM)
|
||||
EVT_CHECKBOX(IDC_CHECK4,CDebugger::SSBMremedy1)
|
||||
EVT_CHECKBOX(IDC_CHECK5,CDebugger::SSBMremedy2)
|
||||
EVT_CHECKBOX(IDC_CHECK8,CDebugger::Sequenced)
|
||||
EVT_CHECKBOX(IDC_CHECK6,CDebugger::Reset)
|
||||
EVT_CHECKBOX(IDC_CHECK7,CDebugger::OnlyLooping)
|
||||
|
||||
EVT_RADIOBOX(IDC_RADIO1,CDebugger::ChangeFrequency)
|
||||
EVT_RADIOBOX(IDC_RADIO2,CDebugger::ChangePreset)
|
||||
END_EVENT_TABLE()
|
||||
// =======================================================================================
|
||||
|
||||
|
@ -130,12 +142,16 @@ SetTitle(wxT("Sound Debugging"));
|
|||
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_Check[1] = new wxCheckBox(this, IDC_CHECK1, wxT("Show updated"),
|
||||
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_Check[1]->Enable(false);
|
||||
m_Check[7] = new wxCheckBox(this, IDC_CHECK7, wxT("Only looping"),
|
||||
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_Check[2] = new wxCheckBox(this, IDC_CHECK2, wxT("Show console"),
|
||||
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
|
||||
m_checkSizer->Add(m_Check[0], 0, 0, 5);
|
||||
m_checkSizer->Add(m_Check[1], 0, 0, 5);
|
||||
m_checkSizer->Add(m_Check[2], 0, 0, 5);
|
||||
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);
|
||||
// ------------------------
|
||||
|
||||
// settings checkboxes -----------------------------------------------------
|
||||
|
@ -153,11 +169,18 @@ SetTitle(wxT("Sound Debugging"));
|
|||
m_Check[5] = new wxCheckBox(this, IDC_CHECK5, wxT("SSBM remedy 2"),
|
||||
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_Check[5]->SetValue(gSSBMremedy2);
|
||||
|
||||
m_Check[8] = new wxCheckBox(this, IDC_CHECK8, wxT("Sequenced"),
|
||||
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_Check[8]->SetValue(gSequenced);
|
||||
m_Check[6] = new wxCheckBox(this, IDC_CHECK6, wxT("Reset all"),
|
||||
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_Check[6]->SetValue(gReset);
|
||||
|
||||
m_checkSizer2->Add(m_Check[3], 0, 0, 5);
|
||||
m_checkSizer2->Add(m_Check[4], 0, 0, 5);
|
||||
m_checkSizer2->Add(m_Check[5], 0, 0, 5);
|
||||
m_checkSizer2->Add(m_Check[3], 0, 0, 5);
|
||||
m_checkSizer2->Add(m_Check[4], 0, 0, 5);
|
||||
m_checkSizer2->Add(m_Check[5], 0, 0, 5);
|
||||
m_checkSizer2->Add(m_Check[8], 0, 0, 5);
|
||||
m_checkSizer2->Add(m_Check[6], 0, 0, 5);
|
||||
// ------------------------
|
||||
|
||||
|
||||
|
@ -168,11 +191,17 @@ SetTitle(wxT("Sound Debugging"));
|
|||
m_radioBoxNChoices[0] = sizeof( m_radioBoxChoices0 ) / sizeof( wxString );
|
||||
m_RadioBox[0] = new wxRadioBox( this, 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("5 times/s"), wxT("15 times/s"), wxT("30 times/s") };
|
||||
m_radioBoxNChoices[1] = sizeof( m_radioBoxChoices1 ) / sizeof( wxString );
|
||||
m_RadioBox[1] = new wxRadioBox( this, IDC_RADIO1, wxT("Update freq."),
|
||||
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[1], m_radioBoxChoices1, 1, wxRA_SPECIFY_COLS);
|
||||
|
||||
wxString m_radioBoxChoices2[] = { wxT("Preset 1"), wxT("Preset 2"), wxT("Preset 3") };
|
||||
m_radioBoxNChoices[2] = sizeof( m_radioBoxChoices2 ) / sizeof( wxString );
|
||||
m_RadioBox[2] = new wxRadioBox( this, IDC_RADIO2, wxT("Presets"),
|
||||
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[2], m_radioBoxChoices2, 1, wxRA_SPECIFY_COLS);
|
||||
// ------------------------
|
||||
|
||||
// buttons
|
||||
|
@ -180,13 +209,17 @@ SetTitle(wxT("Sound Debugging"));
|
|||
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_SelC = new wxButton(this, ID_SELC, wxT("Select Columns"),
|
||||
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_SelC->Enable(false);
|
||||
m_Presets = new wxButton(this, ID_PRESETS, wxT("Presets"),
|
||||
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_Presets->Enable(false);
|
||||
|
||||
// right buttons
|
||||
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, 2, 5);
|
||||
sButtons2->AddStretchSpacer(1);
|
||||
|
@ -272,9 +305,53 @@ void CDebugger::SSBMremedy2(wxCommandEvent& event)
|
|||
else
|
||||
{gSSBMremedy2 = false;}
|
||||
}
|
||||
void CDebugger::Sequenced(wxCommandEvent& event)
|
||||
{
|
||||
if(m_Check[8]->IsChecked() == 1)
|
||||
{gSequenced = true;}
|
||||
else
|
||||
{gSequenced = false;}
|
||||
}
|
||||
void CDebugger::Reset(wxCommandEvent& event)
|
||||
{
|
||||
if(m_Check[6]->IsChecked() == 1)
|
||||
{gReset = true;}
|
||||
else
|
||||
{gReset = false;}
|
||||
}
|
||||
// =======================================================================================
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Change preset
|
||||
// --------------
|
||||
void CDebugger::ChangePreset(wxCommandEvent& event)
|
||||
{
|
||||
DoChangePreset();
|
||||
}
|
||||
|
||||
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 = 9;
|
||||
}
|
||||
}
|
||||
// ==============
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Change update frequency
|
||||
// --------------
|
||||
|
@ -301,6 +378,41 @@ void CDebugger::DoChangeFrequency()
|
|||
// ==============
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Show only looping blocks
|
||||
// --------------
|
||||
void CDebugger::OnlyLooping(wxCommandEvent& event)
|
||||
{
|
||||
if(m_Check[7]->IsChecked())
|
||||
{
|
||||
gOnlyLooping = true;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
gOnlyLooping = false;
|
||||
}
|
||||
}
|
||||
// ==============
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Save to file
|
||||
// --------------
|
||||
void CDebugger::SaveFile(wxCommandEvent& event)
|
||||
{
|
||||
if(m_Check[0]->IsChecked())
|
||||
{
|
||||
gSaveFile = 1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
gSaveFile = 0;
|
||||
}
|
||||
}
|
||||
// ==============
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Show or hide console window
|
||||
|
|
|
@ -68,13 +68,22 @@ class CDebugger : public wxDialog
|
|||
|
||||
void NotifyUpdate();
|
||||
void OnUpdate(wxCommandEvent& event);
|
||||
|
||||
void SaveFile(wxCommandEvent& event);
|
||||
void ShowHideConsole(wxCommandEvent& event);
|
||||
void DoShowHideConsole();
|
||||
void ChangeFrequency(wxCommandEvent& event);
|
||||
void DoChangeFrequency();
|
||||
void ChangePreset(wxCommandEvent& event);
|
||||
void DoChangePreset();
|
||||
|
||||
void SSBM(wxCommandEvent& event);
|
||||
void SSBMremedy1(wxCommandEvent& event);
|
||||
void SSBMremedy2(wxCommandEvent& event);
|
||||
void BSDON(wxCommandEvent& event);
|
||||
void Sequenced(wxCommandEvent& event);
|
||||
void Reset(wxCommandEvent& event);
|
||||
void OnlyLooping(wxCommandEvent& event);
|
||||
|
||||
CPBView* m_GPRListView;
|
||||
|
||||
|
@ -82,9 +91,9 @@ class CDebugger : public wxDialog
|
|||
private:
|
||||
|
||||
// declarations
|
||||
wxCheckBox *m_Check[3];
|
||||
wxCheckBox *m_Check[6];
|
||||
wxRadioButton *m_Radio[5];
|
||||
wxRadioBox *m_RadioBox[2];
|
||||
wxRadioBox *m_RadioBox[3];
|
||||
wxStaticBox *m_Label[1];
|
||||
wxPanel *m_Controller;
|
||||
|
||||
|
@ -97,6 +106,9 @@ class CDebugger : public wxDialog
|
|||
IDC_CHECK3,
|
||||
IDC_CHECK4,
|
||||
IDC_CHECK5,
|
||||
IDC_CHECK6,
|
||||
IDC_CHECK7,
|
||||
IDC_CHECK8,
|
||||
IDC_RADIO0,
|
||||
IDC_RADIO1,
|
||||
IDC_RADIO2,
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
|
||||
// On and off
|
||||
bool g_consoleEnable = true;
|
||||
int gSaveFile = 0;
|
||||
#define DEBUGG
|
||||
//#define DEBUGG_FILEONLY
|
||||
//#define DEBUGG_NOFILE
|
||||
// --------------------
|
||||
|
||||
|
||||
|
@ -70,7 +70,6 @@ void startConsoleWin(int width, int height, char* fname)
|
|||
SetConsoleWindowInfo(__hStdOut, TRUE, &coo);
|
||||
|
||||
#endif
|
||||
#ifndef DEBUGG_NOFILE
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// Write to a file
|
||||
if(fname)
|
||||
|
@ -82,7 +81,6 @@ void startConsoleWin(int width, int height, char* fname)
|
|||
__fStdOut = fopen(FullFilename.c_str(), "w");
|
||||
}
|
||||
// ---------------------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
@ -93,7 +91,7 @@ void startConsoleWin(int width, int height, char* fname)
|
|||
int wprintf(char *fmt, ...)
|
||||
{
|
||||
#if defined(DEBUGG) && defined(_WIN32)
|
||||
char s[3000]; // WARNING: Mind this value
|
||||
char s[7000]; // WARNING: Mind this value
|
||||
va_list argptr;
|
||||
int cnt;
|
||||
|
||||
|
@ -110,13 +108,15 @@ int wprintf(char *fmt, ...)
|
|||
WriteConsole(__hStdOut, s, strlen(s), &cCharsWritten, NULL);
|
||||
}
|
||||
#endif
|
||||
#ifndef DEBUGG_NOFILE
|
||||
// -------------
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
|
||||
if(__fStdOut)
|
||||
fprintf(__fStdOut, s);
|
||||
// ---------------------------------------------------------------------------------------
|
||||
#endif
|
||||
if(gSaveFile)
|
||||
{
|
||||
if(__fStdOut)
|
||||
fprintf(__fStdOut, s);
|
||||
}
|
||||
// -------------
|
||||
|
||||
return(cnt);
|
||||
#else
|
||||
|
|
|
@ -40,29 +40,40 @@
|
|||
#include "../UCodes/UCode_AXStructs.h"
|
||||
#include "../UCodes/UCode_AX.h"
|
||||
|
||||
|
||||
// Externals
|
||||
|
||||
float ratioFactor; // a global to get the ratio factor from MixAdd
|
||||
int gUpdFreq = 5;
|
||||
int gPreset = 0;
|
||||
u32 gLastBlock;
|
||||
extern bool gSSBM;
|
||||
extern bool gSSBMremedy1;
|
||||
extern bool gSSBMremedy2;
|
||||
extern bool gSequenced;
|
||||
extern bool gReset;
|
||||
bool gOnlyLooping = false;
|
||||
extern int gSaveFile;
|
||||
|
||||
// Parameter blocks
|
||||
|
||||
std::vector<u32> gloopPos(64);
|
||||
std::vector<u32> gsampleEnd(64);
|
||||
std::vector<u32> gsamplePos(64);
|
||||
|
||||
// PBSampleRateConverter src
|
||||
std::vector<u32> gratio(64);
|
||||
std::vector<u32> gratiohi(64);
|
||||
std::vector<u32> gratiolo(64);
|
||||
std::vector<u32> gfrac(64);
|
||||
std::vector<u32> gcoef(64);
|
||||
|
||||
// PBSampleRateConverter mixer
|
||||
std::vector<u16> gvolume_left(64);
|
||||
std::vector<u16> gvolume_right(64);
|
||||
std::vector<u16> gmixer_control(64);
|
||||
std::vector<u16> gcur_volume(64);
|
||||
std::vector<u16> gcur_volume_delta(64);
|
||||
|
||||
std::vector<u16> gaudioFormat(64);
|
||||
std::vector<u16> glooping(64);
|
||||
|
@ -201,20 +212,53 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
|
|||
}
|
||||
// ==============
|
||||
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Write header
|
||||
// --------------
|
||||
char buffer [1000] = "";
|
||||
std::string sbuff;
|
||||
sbuff = sbuff + " Nr pos / end lpos | voll volr | isl[pre yn1 yn2] iss | frac ratio[hi lo] | 1 2 3 4 5\n";
|
||||
if(gPreset == 0)
|
||||
{
|
||||
sbuff = sbuff + " adpcm adpcm_loop\n";
|
||||
sbuff = sbuff + " Nr pos / end lpos | voll volr | isl iss | pre yn1 yn2 pre yn1 yn2 | frac ratio[hi lo] | 1 2 3 4 5\n";
|
||||
}
|
||||
else if(gPreset == 1)
|
||||
{
|
||||
sbuff = sbuff + " Nr pos / end lpos | voll volr curv vold | src coef mixc\n";
|
||||
}
|
||||
else if(gPreset == 2)
|
||||
{
|
||||
sbuff = sbuff + " Nr pos / end lpos | voll volr | isl iss | e-l e-s\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ==============
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// go through all running blocks
|
||||
for (int i = 0; i < numberOfPBs; i++)
|
||||
{
|
||||
if (numberRunning.at(i) > 0)
|
||||
|
||||
// =======================================================================================
|
||||
// Prepare conditions
|
||||
// --------------
|
||||
bool Conditions;
|
||||
if (gOnlyLooping)
|
||||
{
|
||||
Conditions = PBs[i].audio_addr.looping;
|
||||
}
|
||||
else
|
||||
{
|
||||
Conditions = (numberRunning.at(i) > 0 || PBs[i].audio_addr.looping);
|
||||
}
|
||||
// ==============
|
||||
|
||||
if (Conditions)
|
||||
{
|
||||
|
||||
|
||||
|
@ -311,6 +355,11 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
|
|||
// mixer
|
||||
gvolume_left[i] = PBs[i].mixer.volume_left;
|
||||
gvolume_right[i] = PBs[i].mixer.volume_right;
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
// hopefully this is false if we don't have a debugging window and so it doesn't cause a crash
|
||||
|
@ -352,16 +401,46 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
|
|||
// PRESETS
|
||||
// ---------------------------------------------------------------------------------------
|
||||
/*
|
||||
/" Nr pos / end lpos | voll volr | isl[pre yn1 yn2] iss | frac ratio[hi lo] | 1 2 3 4 5\n";
|
||||
"---------------|00 12341234/12341234 12341234 | 00000 00000 | 0[000 00000 00000] 0 | 00000 00000[0 00000] |
|
||||
PRESET 0
|
||||
" Nr pos / end lpos | voll volr | isl iss | pre yn1 yn2 pre yn1 yn2 | frac ratio[hi lo] | 1 2 3 4 5\n";
|
||||
"---------------|00 12341234/12341234 12341234 | 00000 00000 | 0 0 | 000 00000 00000 000 00000 00000 | 00000 00000[0 00000] |
|
||||
|
||||
PRESET 1
|
||||
" Nr pos / end lpos | voll volr curv vold | src coef mixc\n";
|
||||
"---------------|00 12341234/12341234 12341234 | 00000 00000 00000 00000 | 0 0 0
|
||||
|
||||
PRESET 2
|
||||
" Nr pos / end lpos | voll volr | isl iss | e-l e-s\n";
|
||||
"---------------|00 12341234/12341234 12341234 | 00000 00000 | 0 0 | 000000 000000
|
||||
*/
|
||||
sprintf(buffer,"%c%i %08i/%08i %08i | %05i %05i | %i[%03i %05i %05i] %i | %05i %05i[%i %05i] | %i %i %i %i %i",
|
||||
if(gPreset == 0)
|
||||
{
|
||||
sprintf(buffer,"%c%i %08i/%08i %08i | %05i %05i | %i %i | %03i %05i %05i %03i %05i %05i | %05i %05i[%i %05i] | %i %i %i %i %i",
|
||||
223, i, gsamplePos[i], gsampleEnd[i], gloopPos[i],
|
||||
gvolume_left[i], gvolume_right[i],
|
||||
glooping[i], gloop1[i], gloop2[i], gloop3[i], gis_stream[i],
|
||||
glooping[i], gis_stream[i],
|
||||
gadloop1[i], gadloop2[i], gadloop3[i], gloop1[i], gloop2[i], gloop3[i],
|
||||
gfrac[i], gratio[i], gratiohi[i], gratiolo[i],
|
||||
gupdates1[i], gupdates2[i], gupdates3[i], gupdates4[i], gupdates5[i]
|
||||
);
|
||||
}
|
||||
else if(gPreset == 1)
|
||||
{
|
||||
sprintf(buffer,"%c%i %08i/%08i %08i | %05i %05i %05i %05i | %i %i %i",
|
||||
223, i, gsamplePos[i], gsampleEnd[i], gloopPos[i],
|
||||
gvolume_left[i], gvolume_right[i], gcur_volume[i], gcur_volume_delta[i],
|
||||
gsrc_type[i], gcoef[i], gmixer_control[i]
|
||||
);
|
||||
}
|
||||
else if(gPreset == 2)
|
||||
{
|
||||
sprintf(buffer,"%c%i %08i/%08i %08i | %05i %05i | %i %i | %06i %06i",
|
||||
223, i, gsamplePos[i], gsampleEnd[i], gloopPos[i],
|
||||
gvolume_left[i], gvolume_right[i],
|
||||
glooping[i], gis_stream[i],
|
||||
gsampleEnd[i] - gloopPos[i], gsampleEnd[i] - gsamplePos[i]
|
||||
);
|
||||
}
|
||||
|
||||
// add new line
|
||||
sbuff = sbuff + buffer; strcpy(buffer, "");
|
||||
|
@ -385,8 +464,8 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
|
|||
// =======================================================================================
|
||||
// Write settings
|
||||
// ---------------
|
||||
sprintf(buffer, "\nSettings: SSBM fix %i | SSBM remedy 1 %i | SSBM remedy 2 %i \n",
|
||||
gSSBM, gSSBMremedy1, gSSBMremedy2);
|
||||
sprintf(buffer, "\nSettings: SSBM fix %i | SSBM rem1 %i | SSBM rem2 %i | Sequenced %i | Reset %i | Only looping %i | Save file %i\n",
|
||||
gSSBM, gSSBMremedy1, gSSBMremedy2, gSequenced, gReset, gOnlyLooping, gSaveFile);
|
||||
sbuff = sbuff + buffer; strcpy(buffer, "");
|
||||
// ===============
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@ extern u32 gLastBlock;
|
|||
bool gSSBM = true; // used externally
|
||||
bool gSSBMremedy1 = true; // used externally
|
||||
bool gSSBMremedy2 = true; // used externally
|
||||
bool gSequenced = true; // used externally
|
||||
bool gReset = false; // used externally
|
||||
extern CDebugger* m_frame;
|
||||
// -----------
|
||||
|
||||
|
@ -161,14 +163,13 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
|
|||
would become extremely high and the game would play random sound data from ARAM resulting in
|
||||
a strange noise. This should take care of that. - Some games (Monkey Ball 1 and Tales of
|
||||
Symphonia) also had one odd block with a strange high loopPos and strange num_updates values,
|
||||
the loopPos limit turns those off also. - Please report any side effects.Please report any
|
||||
side effects.
|
||||
the loopPos limit turns those off also. - Please report any side effects.
|
||||
*/
|
||||
// ------------
|
||||
const u32 sampleEnd = (pb.audio_addr.end_addr_hi << 16) | pb.audio_addr.end_addr_lo;
|
||||
const u32 loopPos = (pb.audio_addr.loop_addr_hi << 16) | pb.audio_addr.loop_addr_lo;
|
||||
if (
|
||||
sampleEnd > 0x10000000 || loopPos > 0x10000000
|
||||
(sampleEnd > 0x10000000 || loopPos > 0x10000000)
|
||||
&& gSSBMremedy1
|
||||
)
|
||||
{
|
||||
|
@ -179,16 +180,24 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
|
|||
pb.audio_addr.end_addr_hi = 0; pb.audio_addr.end_addr_lo = 0;
|
||||
pb.audio_addr.loop_addr_hi = 0; pb.audio_addr.loop_addr_lo = 0;
|
||||
|
||||
pb.src.cur_addr_frac = 0; PBs[i].src.ratio_hi = 0; PBs[i].src.ratio_lo = 0;
|
||||
pb.adpcm.pred_scale = 0; pb.adpcm.yn1 = 0; pb.adpcm.yn2 = 0;
|
||||
|
||||
pb.audio_addr.looping = 0;
|
||||
pb.adpcm_loop_info.pred_scale = 0;
|
||||
pb.adpcm_loop_info.yn1 = 0; pb.adpcm_loop_info.yn2 = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
// the fact that no settings are reset (except running) after a SSBM type music stream has ended
|
||||
could cause loud garbled sound to be played from several blocks. It could be seen as five or six
|
||||
simultaneous looping blocks that presumable produced garbled music. My guess is that it was sound
|
||||
effects that were placed in previous music blocks and mutated into these looping noise machines.
|
||||
// the fact that no settings are reset (except running) after a SSBM type music stream or another
|
||||
looping block (for example in Battle Stadium DON) has ended could cause loud garbled sound to be
|
||||
played from one or more blocks. Battle Stadium DON would usually have as much as five short looping
|
||||
sounds (for example for running water and other things), but one or more of those would turn in to
|
||||
looping noise machines if the old SSBM fix (withouth the pb.mixer_control check) was applied. This
|
||||
would fix that by resetting the values after a looping block had ended. But it would be at the price
|
||||
of turing off all looping sounds except the music streams, it seemed. But hopefully with the improved
|
||||
SSBM music fix this check is not needed. I'll save it for now but it may perhaps be deleted in the
|
||||
future.
|
||||
*/
|
||||
if (
|
||||
// detect blocks that have recently been running that we should reset
|
||||
|
@ -197,6 +206,8 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
|
|||
// this prevents us from ruining sequenced music blocks
|
||||
&& !(pb.updates.num_updates[0] || pb.updates.num_updates[1] || pb.updates.num_updates[2]
|
||||
|| pb.updates.num_updates[3] || pb.updates.num_updates[4])
|
||||
|
||||
&& pb.mixer_control == 0 // only use this in SSBM
|
||||
|
||||
&& gSSBMremedy2 // let us turn this fix on and off
|
||||
)
|
||||
|
@ -206,6 +217,9 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
|
|||
pb.audio_addr.end_addr_hi = 0; pb.audio_addr.end_addr_lo = 0;
|
||||
pb.audio_addr.loop_addr_hi = 0; pb.audio_addr.loop_addr_lo = 0;
|
||||
|
||||
pb.src.cur_addr_frac = 0; PBs[i].src.ratio_hi = 0; PBs[i].src.ratio_lo = 0;
|
||||
pb.adpcm.pred_scale = 0; pb.adpcm.yn1 = 0; pb.adpcm.yn2 = 0;
|
||||
|
||||
pb.audio_addr.looping = 0;
|
||||
pb.adpcm_loop_info.pred_scale = 0;
|
||||
pb.adpcm_loop_info.yn1 = 0; pb.adpcm_loop_info.yn2 = 0;
|
||||
|
@ -216,24 +230,49 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
|
|||
|
||||
// =======================================================================================
|
||||
/*
|
||||
// Sequenced music fix - Because SSBM type music did no have its pred_scale (or any other parameter
|
||||
except running) turned off after a song was stopped a pred_scale check here had the effect of
|
||||
turning those blocks on immediately after the stopped. Because the pred_scale check caused these
|
||||
effects I'm trying the num_updates check instead. Please report any side effects.
|
||||
Sequenced music fix - Because SSBM type music and other (for example Battle Stadium DON) looping
|
||||
blocks did no have its pred_scale (or any other parameter except running) turned off after a song
|
||||
was stopped a pred_scale check here had the effect of turning those blocks on immediately after
|
||||
the stopped. Because the pred_scale check caused these effects I'm trying the num_updates check
|
||||
instead. Please report any side effects.
|
||||
*/
|
||||
// ------------
|
||||
//if (!pb.running && pb.adpcm_loop_info.pred_scale)
|
||||
/**/
|
||||
if (!pb.running &&
|
||||
(pb.updates.num_updates[0] || pb.updates.num_updates[1] || pb.updates.num_updates[2]
|
||||
|| pb.updates.num_updates[3] || pb.updates.num_updates[4])
|
||||
)
|
||||
|
||||
|| pb.updates.num_updates[3] || pb.updates.num_updates[4])
|
||||
&& gSequenced
|
||||
)
|
||||
{
|
||||
pb.running = 1;
|
||||
}
|
||||
// =============
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Reset all values
|
||||
// ------------
|
||||
if (gReset
|
||||
&& (pb.running || pb.audio_addr.looping || pb.adpcm_loop_info.pred_scale)
|
||||
)
|
||||
{
|
||||
pb.running = 0;
|
||||
|
||||
pb.audio_addr.cur_addr_hi = 0; pb.audio_addr.cur_addr_lo = 0;
|
||||
pb.audio_addr.end_addr_hi = 0; pb.audio_addr.end_addr_lo = 0;
|
||||
pb.audio_addr.loop_addr_hi = 0; pb.audio_addr.loop_addr_lo = 0;
|
||||
|
||||
pb.src.cur_addr_frac = 0; PBs[i].src.ratio_hi = 0; PBs[i].src.ratio_lo = 0;
|
||||
pb.adpcm.pred_scale = 0; pb.adpcm.yn1 = 0; pb.adpcm.yn2 = 0;
|
||||
|
||||
pb.audio_addr.looping = 0;
|
||||
pb.adpcm_loop_info.pred_scale = 0;
|
||||
pb.adpcm_loop_info.yn1 = 0; pb.adpcm_loop_info.yn2 = 0;
|
||||
}
|
||||
// =============
|
||||
|
||||
|
||||
if (pb.running)
|
||||
{
|
||||
// =======================================================================================
|
||||
|
@ -272,16 +311,18 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
|
|||
// =======================================================================================
|
||||
// Games that use looping to play non-looping music streams - SSBM has info in all
|
||||
// pb.adpcm_loop_info parameters but has pb.audio_addr.looping = 0. If we treat these streams
|
||||
// like any other looping streams the music works.
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// like any other looping streams the music works. It seems like pb.mixer_control == 0 may
|
||||
// identify these types of blocks.
|
||||
// --------------
|
||||
if(
|
||||
pb.adpcm_loop_info.pred_scale || pb.adpcm_loop_info.yn1 || pb.adpcm_loop_info.yn2
|
||||
(pb.adpcm_loop_info.pred_scale || pb.adpcm_loop_info.yn1 || pb.adpcm_loop_info.yn2)
|
||||
&& pb.mixer_control == 0
|
||||
&& gSSBM
|
||||
)
|
||||
{
|
||||
pb.audio_addr.looping = 1;
|
||||
}
|
||||
// =======================================================================================
|
||||
// ==============
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
|
@ -297,7 +338,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
|
|||
that also use is_stream = 1 has no problem wuth the volume, but its settings are somewhat
|
||||
different, it uses src_type = 1 and pb.src.ratio_lo (fraction) != 0
|
||||
*/
|
||||
// =======================================================================================
|
||||
// ==============
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
|
@ -311,7 +352,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
|
|||
|
||||
// =======================================================================================
|
||||
// Process sample format
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// --------------
|
||||
switch (pb.audio_addr.sample_format)
|
||||
{
|
||||
case AUDIOFORMAT_PCM8:
|
||||
|
@ -348,7 +389,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
// =======================================================================================
|
||||
// ================
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
|
@ -369,7 +410,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
|
|||
|
||||
int leftmix = pb.mixer.volume_left >> 5;
|
||||
int rightmix = pb.mixer.volume_right >> 5;
|
||||
// =======================================================================================
|
||||
// ===============
|
||||
|
||||
|
||||
int left = sample * leftmix >> 8;
|
||||
|
@ -394,7 +435,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
|
|||
}
|
||||
}
|
||||
} // end of the _iSize loop
|
||||
// =======================================================================================
|
||||
// ============
|
||||
|
||||
|
||||
pb.src.cur_addr_frac = (u16)frac;
|
||||
|
|
Loading…
Reference in New Issue