Moved updates closer to how it actually should work. It's still a little buggy, perhaps because of some kind of timing issue. In RE Remake it seems like the music stopped sometimes, and sometimes to many blocks were running. The Skies music didn't seem to work very well either.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@834 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
3d1cc88b4f
commit
3043bd6003
|
@ -33,6 +33,7 @@ extern bool gSSBM;
|
|||
extern bool gSSBMremedy1;
|
||||
extern bool gSSBMremedy2;
|
||||
extern bool gSequenced;
|
||||
extern bool gVolume;
|
||||
extern bool gOnlyLooping;
|
||||
|
||||
// =======================================================================================
|
||||
|
@ -47,6 +48,7 @@ BEGIN_EVENT_TABLE(CDebugger,wxDialog)
|
|||
EVT_CHECKBOX(IDC_CHECK4,CDebugger::SSBMremedy1)
|
||||
EVT_CHECKBOX(IDC_CHECK5,CDebugger::SSBMremedy2)
|
||||
EVT_CHECKBOX(IDC_CHECK8,CDebugger::Sequenced)
|
||||
EVT_CHECKBOX(IDC_CHECK9,CDebugger::Volume)
|
||||
EVT_CHECKBOX(IDC_CHECK6,CDebugger::Reset)
|
||||
EVT_CHECKBOX(IDC_CHECK7,CDebugger::OnlyLooping)
|
||||
|
||||
|
@ -80,10 +82,16 @@ CDebugger::~CDebugger()
|
|||
|
||||
void CDebugger::Save(IniFile& _IniFile) const
|
||||
{
|
||||
_IniFile.Set("SoundWindow", "x", GetPosition().x);
|
||||
_IniFile.Set("SoundWindow", "y", GetPosition().y);
|
||||
_IniFile.Set("SoundWindow", "w", GetSize().GetWidth());
|
||||
_IniFile.Set("SoundWindow", "h", GetSize().GetHeight());
|
||||
// TODO2: get the screen resolution and make limits from that
|
||||
if(GetPosition().x < 1000 && GetPosition().y < 1000
|
||||
&& GetSize().GetWidth() < 1000 && GetSize().GetHeight() < 1000
|
||||
)
|
||||
{
|
||||
_IniFile.Set("SoundWindow", "x", GetPosition().x);
|
||||
_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", "UpdateFrequency", m_RadioBox[1]->GetSelection());
|
||||
}
|
||||
|
@ -171,6 +179,9 @@ SetTitle(wxT("Sound Debugging"));
|
|||
m_Check[8] = new wxCheckBox(this, IDC_CHECK8, wxT("Sequenced"),
|
||||
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_Check[8]->SetValue(gSequenced);
|
||||
m_Check[9] = new wxCheckBox(this, IDC_CHECK9, wxT("Volume delta"),
|
||||
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_Check[9]->SetValue(gVolume);
|
||||
m_Check[6] = new wxCheckBox(this, IDC_CHECK6, wxT("Reset all"),
|
||||
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_Check[6]->SetValue(gReset);
|
||||
|
@ -179,6 +190,7 @@ SetTitle(wxT("Sound Debugging"));
|
|||
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[9], 0, 0, 5);
|
||||
m_checkSizer2->Add(m_Check[6], 0, 0, 5);
|
||||
// ------------------------
|
||||
|
||||
|
@ -192,7 +204,7 @@ SetTitle(wxT("Sound Debugging"));
|
|||
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") };
|
||||
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( this, IDC_RADIO1, wxT("Update freq."),
|
||||
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[1], m_radioBoxChoices1, 1, wxRA_SPECIFY_COLS);
|
||||
|
@ -317,6 +329,13 @@ void CDebugger::Sequenced(wxCommandEvent& event)
|
|||
else
|
||||
{gSequenced = false;}
|
||||
}
|
||||
void CDebugger::Volume(wxCommandEvent& event)
|
||||
{
|
||||
if(m_Check[9]->IsChecked() == 1)
|
||||
{gVolume = true;}
|
||||
else
|
||||
{gVolume = false;}
|
||||
}
|
||||
void CDebugger::Reset(wxCommandEvent& event)
|
||||
{
|
||||
if(m_Check[6]->IsChecked() == 1)
|
||||
|
@ -369,9 +388,13 @@ void CDebugger::DoChangeFrequency()
|
|||
{
|
||||
if(m_RadioBox[1]->GetSelection() == 0)
|
||||
{
|
||||
gUpdFreq = 5;
|
||||
gUpdFreq = 0;
|
||||
}
|
||||
else if(m_RadioBox[1]->GetSelection() == 1)
|
||||
{
|
||||
gUpdFreq = 5;
|
||||
}
|
||||
else if(m_RadioBox[1]->GetSelection() == 2)
|
||||
{
|
||||
gUpdFreq = 15;
|
||||
}
|
||||
|
|
|
@ -81,7 +81,8 @@ class CDebugger : public wxDialog
|
|||
void SSBMremedy1(wxCommandEvent& event);
|
||||
void SSBMremedy2(wxCommandEvent& event);
|
||||
void BSDON(wxCommandEvent& event);
|
||||
void Sequenced(wxCommandEvent& event);
|
||||
void Sequenced(wxCommandEvent& event);
|
||||
void Volume(wxCommandEvent& event);
|
||||
void Reset(wxCommandEvent& event);
|
||||
void OnlyLooping(wxCommandEvent& event);
|
||||
|
||||
|
@ -91,7 +92,7 @@ class CDebugger : public wxDialog
|
|||
private:
|
||||
|
||||
// declarations
|
||||
wxCheckBox *m_Check[6];
|
||||
wxCheckBox *m_Check[9];
|
||||
wxRadioButton *m_Radio[5];
|
||||
wxRadioBox *m_RadioBox[3];
|
||||
wxStaticBox *m_Label[1];
|
||||
|
@ -109,6 +110,7 @@ class CDebugger : public wxDialog
|
|||
IDC_CHECK6,
|
||||
IDC_CHECK7,
|
||||
IDC_CHECK8,
|
||||
IDC_CHECK9,
|
||||
IDC_RADIO0,
|
||||
IDC_RADIO1,
|
||||
IDC_RADIO2,
|
||||
|
|
|
@ -11,6 +11,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
|
||||
{
|
||||
char Msg[512];
|
||||
va_list ap;
|
||||
|
||||
|
@ -19,6 +21,7 @@ void DebugLog(const char* _fmt, ...)
|
|||
va_end(ap);
|
||||
|
||||
g_dspInitialize.pLog(Msg);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ extern bool gSSBM;
|
|||
extern bool gSSBMremedy1;
|
||||
extern bool gSSBMremedy2;
|
||||
extern bool gSequenced;
|
||||
extern bool gVolume;
|
||||
extern bool gReset;
|
||||
bool gOnlyLooping = false;
|
||||
extern int gSaveFile;
|
||||
|
@ -380,6 +381,12 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
|
|||
std::string sfbuff;
|
||||
if(a == 0) sfbuff = "***"; // note if it's before or after an update
|
||||
else sfbuff = " ";
|
||||
|
||||
// write running
|
||||
char cbuf[10];
|
||||
sprintf(cbuf, "%i", PBs[i].running);
|
||||
sfbuff = sfbuff + cbuf;
|
||||
|
||||
sfbuff = sfbuff + writeMessage(ii, i);
|
||||
sfbuff = sfbuff + "\n";
|
||||
aprintf(ii, (char *)sfbuff.c_str());
|
||||
|
@ -396,7 +403,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
|
|||
if(a == 0) j++;
|
||||
//if(l == pow((double)2,32)) l=0; // reset l
|
||||
//l++;
|
||||
if (j > (200/gUpdFreq))
|
||||
if (gUpdFreq > 0 && j > (200/gUpdFreq))
|
||||
{
|
||||
|
||||
// =======================================================================================
|
||||
|
@ -603,8 +610,8 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
|
|||
// =======================================================================================
|
||||
// Write settings
|
||||
// ---------------
|
||||
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);
|
||||
sprintf(buffer, "\nSettings: SSBM fix %i | SSBM rem1 %i | SSBM rem2 %i\nSequenced %i | Volume %i | Reset %i | Only looping %i | Save file %i\n",
|
||||
gSSBM, gSSBMremedy1, gSSBMremedy2, gSequenced, gVolume, gReset, gOnlyLooping, gSaveFile);
|
||||
sbuff = sbuff + buffer; strcpy(buffer, "");
|
||||
// ===============
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "../Debugger/Debugger.h"
|
||||
#include "../Logging/Console.h" // for aprintf
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "../PCHW/DSoundStream.h"
|
||||
|
@ -37,6 +38,7 @@ bool gSSBM = true; // used externally
|
|||
bool gSSBMremedy1 = true; // used externally
|
||||
bool gSSBMremedy2 = true; // used externally
|
||||
bool gSequenced = true; // used externally
|
||||
bool gVolume= true; // used externally
|
||||
bool gReset = false; // used externally
|
||||
extern CDebugger* m_frame;
|
||||
// -----------
|
||||
|
@ -142,11 +144,16 @@ u16 ADPCM_Vol(u16 vol, u16 delta, u16 mixer_control)
|
|||
else if (delta && delta > 0x4000)
|
||||
//x -= (0x8000 - pb.mixer.unknown); // this didn't work
|
||||
x--;
|
||||
if (x < 0) x = 0; // make limits
|
||||
|
||||
// make lower limits
|
||||
if (x < 0) x = 0;
|
||||
// does this make any sense?
|
||||
//if (pb.mixer_control < 1000 && x < pb.mixer_control) x = pb.mixer_control;
|
||||
//if (x >= 0x7fff) xl = 0x7fff; // this seems to high
|
||||
if (mixer_control > 1000 && x > mixer_control) x = mixer_control;
|
||||
|
||||
// make upper limits
|
||||
if (mixer_control > 1000 && x > mixer_control) x = mixer_control; // I don't know if this is correct
|
||||
//if (x >= 0x7fff) x = 0x7fff; // this seems a little high
|
||||
if (x >= 0x4e20) x = 0x4e20; // add a definitive limit at 20 000
|
||||
return x; // update volume
|
||||
}
|
||||
|
||||
|
@ -162,8 +169,10 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
|
|||
|
||||
memset(templbuffer, 0, _iSize * sizeof(int));
|
||||
memset(temprbuffer, 0, _iSize * sizeof(int));
|
||||
|
||||
// read out pbs
|
||||
int numberOfPBs = ReadOutPBs(PBs, NUMBER_OF_PBS);
|
||||
|
||||
#ifdef _WIN32
|
||||
ratioFactor = 32000.0f / (float)DSound::DSound_GetSampleRate();
|
||||
#else
|
||||
|
@ -185,7 +194,8 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
|
|||
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;
|
||||
const u32 updaddr = (u32)(pb.updates.data_hi << 16) | pb.updates.data_lo;
|
||||
const u32 upddata = Memory_Read_U32(updaddr);
|
||||
const u16 updpar = Memory_Read_U16(updaddr);
|
||||
const u16 upddata = Memory_Read_U16(updaddr + 2);
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
|
@ -234,7 +244,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
|
|||
&& !(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])
|
||||
*/
|
||||
&& !upddata
|
||||
&& !(updpar || upddata)
|
||||
|
||||
&& pb.mixer_control == 0 // only use this in SSBM
|
||||
|
||||
|
@ -257,37 +267,6 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
|
|||
// =============
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
/*
|
||||
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. One way to easily test this is to start a game in BS DON, wait for the Fight message
|
||||
so that the loops begin, and then exit the game and you can see that the sound effects will
|
||||
continue to play in the menus. That's not good. Because the pred_scale check caused these effects
|
||||
I'm trying an update data check instead, it relieas on the assumption that all games that don't
|
||||
use sequencing have blank memory at the update address so that upddata = 0 in those cases. That
|
||||
turned out to now hold, many games that don't use sequencing still had update_addr pointing to
|
||||
some memory location with data, either inside the parameter block space or close before or after
|
||||
it.
|
||||
*/
|
||||
// ------------
|
||||
//if (!pb.running && pb.adpcm_loop_info.pred_scale)
|
||||
//if (!pb.running && pb.audio_addr.looping)
|
||||
if (!pb.running && upddata)
|
||||
/*
|
||||
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])
|
||||
&& gSequenced
|
||||
)
|
||||
*/
|
||||
{
|
||||
pb.running = 1;
|
||||
}
|
||||
// =============
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Reset all values
|
||||
// ------------
|
||||
|
@ -431,8 +410,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
|
|||
if (x >= 0x7fff) x = 0x7fff;
|
||||
pb.vol_env.cur_volume = x; // maybe not per sample?? :P
|
||||
|
||||
// strange way to not use this in Skies where it didn't work well
|
||||
if(pb.mixer_control != 9 && pb.mixer_control != 123)
|
||||
if(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);
|
||||
|
@ -738,6 +716,25 @@ int CUCode_AX::ReadOutPBs(AXParamBlock* _pPBs, int _num)
|
|||
gLastBlock = blockAddr + p*2 + 2; // save last block location
|
||||
#endif
|
||||
}
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// Make the updates we are told to do
|
||||
// ------------
|
||||
u16 upd_hi = pDest[39];
|
||||
u16 upd_lo = pDest[40];
|
||||
const u32 updaddr = (u32)(upd_hi << 16) | upd_lo;
|
||||
const u16 updpar = Memory_Read_U16(updaddr);
|
||||
const u16 upddata = Memory_Read_U16(updaddr + 2);
|
||||
// some safety checks, I hope it's enough, how long does the memory go?
|
||||
if(updaddr > 0x80000000 && updaddr < 0x82000000
|
||||
&& updpar < 63 && updpar > 3 && upddata >= 0 // updpar > 3 because we don't want to change
|
||||
// 0-3, those are important
|
||||
&& gSequenced) // on and off option
|
||||
{
|
||||
pDest[updpar] = upddata;
|
||||
}
|
||||
//aprintf(1, "%08x %04x %04x\n", updaddr, updpar, upddata);
|
||||
// ------------
|
||||
|
||||
blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo;
|
||||
count++;
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ void OpenConsole()
|
|||
#if defined (_WIN32)
|
||||
startConsoleWin(155, 100, "Sound Debugging"); // give room for 100 rows
|
||||
wprintf("OpenConsole > Console opened\n");
|
||||
MoveWindow(GetConsoleHwnd(), 0,400, 1280,500, true); // move window, TODO: make this
|
||||
MoveWindow(GetConsoleHwnd(), 0,450, 1280,500, true); // move window, TODO: make this
|
||||
// adjustable from the debugging window
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue