Another small DSP HLE update.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1123 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2008-11-11 16:28:46 +00:00
parent f38b1688cc
commit cfcd1b6dd5
10 changed files with 285 additions and 107 deletions

View File

@ -371,3 +371,26 @@ int ChooseStringFrom(const char* str, const char* * items)
}
return -1;
}
// Thousand separator. Turns 12345678 into 12,345,678.
std::string ThS(int a, bool b)
{
char cbuf[20]; int j = 0;
// determine treatment of signed or unsigned
if(b) sprintf(cbuf, "%u", a); else sprintf(cbuf, "%i", a);
std::string sbuf = cbuf;
for (int i = 0; i < sbuf.length(); ++i)
{
if((i & 3) == 3)
{
sbuf.insert(sbuf.length() - i, ",");
}
}
return sbuf;
}

View File

@ -50,6 +50,7 @@ inline void CharArrayFromFormat(char (& out)[Count], const char* format, ...)
std::string StripSpaces(const std::string &s);
std::string StripQuotes(const std::string &s);
std::string StripNewline(const std::string &s);
std::string ThS(int a, bool b = true); // thousand separator
std::string StringFromInt(int value);

View File

@ -57,8 +57,10 @@ BEGIN_EVENT_TABLE(CDebugger,wxDialog)
// left cotrols
EVT_CHECKLISTBOX(IDC_CHECKLIST5, CDebugger::OnOptions) // options
EVT_CHECKLISTBOX(IDC_CHECKLIST6, CDebugger::OnShowAll)
EVT_RADIOBOX(IDC_RADIO0,CDebugger::ShowBase) // update frequency
// right cotrols
EVT_RADIOBOX(IDC_RADIO0,CDebugger::ShowBase)
EVT_RADIOBOX(IDC_RADIO1,CDebugger::ChangeFrequency) // update frequency
EVT_RADIOBOX(IDC_RADIO2,CDebugger::ChangePreset) // presets
EVT_CHECKLISTBOX(IDC_CHECKLIST1, CDebugger::OnSettingsCheck) // settings
@ -113,6 +115,7 @@ void CDebugger::Save(IniFile& _IniFile) const
_IniFile.Set("SoundWindow", "UpdateFrequency", m_RadioBox[1]->GetSelection());
_IniFile.Set("SoundWindow", "ScanMails", m_gcwiiset->IsChecked(0));
_IniFile.Set("SoundWindow", "StoreMails", m_gcwiiset->IsChecked(1));
_IniFile.Set("SoundWindow", "ShowBase", m_RadioBox[0]->GetSelection() ? false : true);
}
@ -125,12 +128,16 @@ void CDebugger::Load(IniFile& _IniFile)
_IniFile.Get("SoundWindow", "h", &h, GetSize().GetHeight());
SetSize(x, y, w, h);
// saved settings
// Show console or not
bool Console;
_IniFile.Get("SoundWindow", "Console", &Console, m_options->IsChecked(3));
m_options->Check(3, Console);
DoShowHideConsole();
// Show number base
_IniFile.Get("SoundWindow", "ShowBase", &bShowBase, !m_RadioBox[0]->GetSelection());
m_RadioBox[0]->SetSelection(!bShowBase);
_IniFile.Get("SoundWindow", "UpdateFrequency", &gUpdFreq, m_RadioBox[1]->GetSelection());
m_RadioBox[1]->SetSelection(gUpdFreq);
DoChangeFrequency();
@ -261,7 +268,6 @@ SetTitle(wxT("Sound Debugging"));
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 );
@ -475,6 +481,19 @@ void CDebugger::DoChangePreset()
// ==============
// =======================================================================================
// Show base
// --------------
void CDebugger::ShowBase(wxCommandEvent& event)
{
if(m_RadioBox[0]->GetSelection() == 0)
bShowBase = true;
else if(m_RadioBox[0]->GetSelection() == 1)
bShowBase = false;
}
// ==============
// =======================================================================================
// Change update frequency
// --------------

View File

@ -74,6 +74,7 @@ class CDebugger : public wxDialog
void OnUpdate(wxCommandEvent& event);
void ShowHideConsole(wxCommandEvent& event); // options
void ShowBase(wxCommandEvent& event);
void DoShowHideConsole();
//void OnlyLooping(wxCommandEvent& event);
void OnOptions(wxCommandEvent& event);
@ -108,13 +109,7 @@ class CDebugger : public wxDialog
int giShowAll;
int gUpdFreq;// main update freq.
int gPreset; // main presets
bool gSSBM; // main settings
bool gSSBMremedy1;
bool gSSBMremedy2;
bool gSequenced;
bool gVolume;
bool gReset;
bool bShowBase; // main presets
bool ScanMails; // mail settings
bool StoreMails;

View File

@ -31,6 +31,8 @@
#include <windows.h>
#endif
#include "StringUtil.h"
#include "../Debugger/Debugger.h"
#include "../Debugger/PBView.h"
#include "Console.h" // open and close console, clear console window
@ -43,6 +45,12 @@
// Externals
extern bool gSSBM;
extern bool gSSBMremedy1;
extern bool gSSBMremedy2;
extern bool gSequenced;
extern bool gVolume;
extern bool gReset;
u32 gLastBlock;
extern int nFiles;
float ratioFactor; // a global to get the ratio factor from MixAdd
@ -148,25 +156,60 @@ extern CDebugger* m_frame;
// =======================================================================================
// Write title
// --------------
std::string writeTitle(int a)
std::string writeTitle(int a, bool Wii)
{
std::string b;
if(a == 0)
{
b = " adpcm adpcm_loop\n";
b = b + " Nr pos / end lpos | voll volr | isl iss | pre yn1 yn2 pre yn1 yn2 | frac ratio[hi lo]\n";
if(m_frame->bShowBase) // show base 10
{
b = " adpcm adpcm_loop\n";
b = b + " Nr pos / end lpos | voll volr | isl iss | pre yn1 yn2 pre yn1 yn2 | frac ratio[hi lo]\n";
}
else
{
b = " adpcm adpcm_loop\n";
b = b + " Nr pos / end lpos | voll volr | isl iss | pre yn1 yn2 pre yn1 yn2 | frac rati[hi lo ]\n";
}
}
else if(a == 1)
{
b = " Nr pos / end lpos | voll volr | src form coef | 1 2 3 4 5\n";
if(m_frame->bShowBase) // show base 10
{
b = " Nr pos / end lpos | voll volr | src form coef | 1 2 3 4 5 addr value\n";
}
else
{
b = " Nr pos / end lpos | voll volr | src form coef | 1 2 3 4 5 addr value\n";
}
}
else if(a == 2)
{
b = " Nr pos / end lpos | voll volr | isl iss | e-l e-s\n";
if(m_frame->bShowBase) // show base 10
{
b = " Nr pos / end lpos | voll volr | isl iss | e-l e-s\n";
}
else
{
b = " Nr pos / end lpos | voll volr | isl iss | e-l e-s\n";
}
}
else if(a == 3)
{
b = " Nr voll volr dl dr curv delt mixc r | v1 v2 v3 v4 v5 v6 v7 | d1 d2 d3 d4 d5 d6 d7\n";
if(m_frame->bShowBase) // show base 10
{
if(Wii)
b = " Nr voll volr dl dr curv delt mixc r | v1 v2 v3 v4 v5 v6 v7 | d1 d2 d3 d4 d5 d6 d7\n";
else
b = " Nr voll volr dl dr curv delt mixc r | v1 v2 v3 v4 v5 v6 v7 | d1 d2 d3 d4 d5 d6 d7\n";
}
else
{
if(Wii)
b = " Nr voll volr dl dr curv delt mixc r | v1 v2 v3 v4 v5 v6 v7 | d1 d2 d3 d4 d5 d6 d7\n";
else
b = " Nr voll volr dl dr curv delt mixc r | v1 v2 v3 v4 v5 v6 v7 | d1 d2 d3 d4 d5 d6 d7\n";
}
}
return b;
}
@ -177,7 +220,7 @@ std::string writeTitle(int a)
// =======================================================================================
// Write main message (presets)
// --------------
std::string writeMessage(int a, int i)
std::string writeMessage(int a, int i, bool Wii)
{
char buf [1000] = "";
std::string sbuf;
@ -186,44 +229,84 @@ std::string writeMessage(int a, int i)
// ---------------------------------------------------------------------------------------
/*
PRESET 0
" Nr pos / end lpos | voll volr | isl iss | pre yn1 yn2 pre yn1 yn2 | frac ratio[hi lo]\n";
"---------------|00 12341234/1234123412 12341234 | 00000 00000 | 0 0 | 000 00000 00000 000 00000 00000 | 00000 00000[0 00000]
" Nr pos / end lpos | voll volr | isl iss | pre yn1 yn2 pre yn1 yn2 | frac ratio[hi lo]\n";
"---------------|00 12,341,234/134,123,412 12341234 | 00,000 00,000 | 0 0 | 000 00000 00000 000 00000 00000 | 00000 00000[0 00000]
" Nr pos / end lpos | voll volr | isl iss | pre yn1 yn2 pre yn1 yn2 | frac rati[hi lo ]\n";
"---------------|00 12,341,234/134,123,412 12341234 | 00,000 00,000 | 0 0 | 000 0000 0000 000 0000 0000 | 0000 0000[0 00000]
PRESET 1 (updates)
" Nr pos / end lpos | voll volr | src form coef | 1 2 3 4 5\n";
"---------------|00 12341234/12341234 12341234 | 00000 00000 | 0 0 0 | 0 0 0 0 0
" Nr pos / end lpos | voll volr | src form coef | 1 2 3 4 5 addr value\n";
"---------------|00 12,341,234/12,341,234 12341234 | 00,000 00,000 | 0 0 0 | 0 0 0 0 0 80808080 80808080
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
" Nr pos / end lpos | voll volr | isl iss | e-l e-s\n";
"---------------|00 12,341,234/12341234 12,341,234 | 00000 00000 | 0 0 | 00,000,000 00,000,000
*/
if(a == 0)
{
sprintf(buf,"%c%02i %08x/%08x %08x | %05u %05u | %i %i | %03i %05i %05i %03i %05i %05i | %05i %05i[%i %05i]",
223, i, gsamplePos[i], gsampleEnd[i], gloopPos[i],
gvolume_left[i], gvolume_right[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]
);
if(m_frame->bShowBase)
{
sprintf(buf,"%c%02i %10s/%10s %10s | %06s %06s | %i %i | %03i %05i %05i %03i %05i %05i | %05i %05i[%i %05i]",
223, i, ThS(gsamplePos[i],true).c_str(), ThS(gsampleEnd[i],true).c_str(), ThS(gloopPos[i],true).c_str(),
ThS(gvolume_left[i]).c_str(), ThS(gvolume_right[i]).c_str(),
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]
);
}
else
{
sprintf(buf,"%c%02i %08x/%08x %08x | %04x %04x | %i %i | %02x %04x %04x %02x %04x %04x | %04x %04x[%i %04x]",
223, i, gsamplePos[i], gsampleEnd[i], gloopPos[i],
gvolume_left[i], gvolume_right[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]
);
}
}
else if(a == 1)
{
sprintf(buf,"%c%02i %08x/%08x %08x | %05u %05u | %i %i %i | %i %i %i %i %i %08x %08x",
223, i, gsamplePos[i], gsampleEnd[i], gloopPos[i],
gvolume_left[i], gvolume_right[i],
gsrc_type[i], gaudioFormat[i], gcoef[i],
gupdates1[i], gupdates2[i], gupdates3[i], gupdates4[i], gupdates5[i], gupdates_addr[i], gupdates_data[i]
);
if(m_frame->bShowBase)
{
sprintf(buf,"%c%02i %10s/%10s %10s | %06s %06s | %u %u %u | %u %u %u %u %u %08x %08x",
223, i, ThS(gsamplePos[i]).c_str(), ThS(gsampleEnd[i]).c_str(), ThS(gloopPos[i]).c_str(),
ThS(gvolume_left[i]).c_str(), ThS(gvolume_right[i]).c_str(),
gsrc_type[i], gaudioFormat[i], gcoef[i],
gupdates1[i], gupdates2[i], gupdates3[i], gupdates4[i], gupdates5[i], gupdates_addr[i], gupdates_data[i]
);
}
else
{
sprintf(buf,"%c%02i %08x/%08x %08x | %04x %04x | %u %u %u | %u %u %u %u %u %08x %08x",
223, i, ThS(gsamplePos[i]).c_str(), ThS(gsampleEnd[i]).c_str(), ThS(gloopPos[i]).c_str(),
gvolume_left[i], gvolume_right[i],
gsrc_type[i], gaudioFormat[i], gcoef[i],
gupdates1[i], gupdates2[i], gupdates3[i], gupdates4[i], gupdates5[i], gupdates_addr[i], gupdates_data[i]
);
}
}
else if(a == 2)
{
sprintf(buf,"%c%02i %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]
);
if(m_frame->bShowBase)
{
sprintf(buf,"%c%02i %10s/%10s %10s | %05i %05i | %i %i | %10s %10s",
223, i, ThS(gsamplePos[i]).c_str(), ThS(gsampleEnd[i]).c_str(), ThS(gloopPos[i]).c_str(),
gvolume_left[i], gvolume_right[i],
glooping[i], gis_stream[i],
ThS(gsampleEnd[i] - gloopPos[i], false).c_str(), ThS(gsampleEnd[i] - gsamplePos[i], false).c_str()
);
}
else
{
sprintf(buf,"%c%02i %08x/%08x %08x | %04x %04x | %i %i | %08x %08x",
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]
);
}
}
/*
PRESET 3
@ -232,15 +315,60 @@ std::string writeMessage(int a, int i)
*/
else if(a == 3)
{
sprintf(buf,"%c%02i %05i %05i %05i %05i %05i %05i %05i %i | %05i %05i %05i %05i %05i %05i %05i | %05i %05i %05i %05i %05i %05i %05i",
223, i,
gvolume_left[i], gvolume_right[i], gmix_unknown[i], gmix_unknown2[i], gcur_volume[i], gcur_volume_delta[i],
gmixer_control[i], (gmixer_control[i] & MIXCONTROL_RAMPING),
gmixer_vol1[i], gmixer_vol2[i], gmixer_vol3[i], gmixer_vol4[i], gmixer_vol5[i],
gmixer_vol6[i], gmixer_vol7[i],
gmixer_d1[i], gmixer_d2[i], gmixer_d3[i], gmixer_d4[i], gmixer_d5[i],
gmixer_d6[i], gmixer_d7[i]
);
if(m_frame->bShowBase)
{
if(Wii)
{
sprintf(buf,"%c%02i %05i %05i %05i %05i %05i %05i %05i %i | %05i %05i %05i %05i %05i %05i %05i | %05i %05i %05i %05i %05i %05i %05i",
223, i,
gvolume_left[i], gvolume_right[i], gmix_unknown[i], gmix_unknown2[i], gcur_volume[i], gcur_volume_delta[i],
gmixer_control_wii[i], (gmixer_control_wii[i] & MIXCONTROL_RAMPING),
gmixer_vol1[i], gmixer_vol2[i], gmixer_vol3[i], gmixer_vol4[i], gmixer_vol5[i],
gmixer_vol6[i], gmixer_vol7[i],
gmixer_d1[i], gmixer_d2[i], gmixer_d3[i], gmixer_d4[i], gmixer_d5[i],
gmixer_d6[i], gmixer_d7[i]
);
}
else
{
sprintf(buf,"%c%02i %05i %05i %05i %05i %05i %05i %08i %i | %05i %05i %05i %05i %05i %05i %05i | %05i %05i %05i %05i %05i %05i %05i",
223, i,
gvolume_left[i], gvolume_right[i], gmix_unknown[i], gmix_unknown2[i], gcur_volume[i], gcur_volume_delta[i],
gmixer_control[i], (gmixer_control[i] & MIXCONTROL_RAMPING),
gmixer_vol1[i], gmixer_vol2[i], gmixer_vol3[i], gmixer_vol4[i], gmixer_vol5[i],
gmixer_vol6[i], gmixer_vol7[i],
gmixer_d1[i], gmixer_d2[i], gmixer_d3[i], gmixer_d4[i], gmixer_d5[i],
gmixer_d6[i], gmixer_d7[i]
);
}
}
else
{
if(Wii)
{
sprintf(buf,"%c%02i %04x %04x %04x %04x %04x %04x %08x %i | %04x %04x %04x %04x %04x %04x %04x | %04x %04x %04x %04x %04x %04x %04x",
223, i,
gvolume_left[i], gvolume_right[i], gmix_unknown[i], gmix_unknown2[i], gcur_volume[i], gcur_volume_delta[i],
gmixer_control_wii[i], (gmixer_control_wii[i] & MIXCONTROL_RAMPING),
gmixer_vol1[i], gmixer_vol2[i], gmixer_vol3[i], gmixer_vol4[i], gmixer_vol5[i],
gmixer_vol6[i], gmixer_vol7[i],
gmixer_d1[i], gmixer_d2[i], gmixer_d3[i], gmixer_d4[i], gmixer_d5[i],
gmixer_d6[i], gmixer_d7[i]
);
}
else
{
sprintf(buf,"%c%02i %04x %04x %04x %04x %04x %04x %04x %i | %04x %04x %04x %04x %04x %04x %04x | %04x %04x %04x %04x %04x %04x %04x",
223, i,
gvolume_left[i], gvolume_right[i], gmix_unknown[i], gmix_unknown2[i], gcur_volume[i], gcur_volume_delta[i],
gmixer_control[i], (gmixer_control[i] & MIXCONTROL_RAMPING),
gmixer_vol1[i], gmixer_vol2[i], gmixer_vol3[i], gmixer_vol4[i], gmixer_vol5[i],
gmixer_vol6[i], gmixer_vol7[i],
gmixer_d1[i], gmixer_d2[i], gmixer_d3[i], gmixer_d4[i], gmixer_d5[i],
gmixer_d6[i], gmixer_d7[i]
);
}
}
}
sbuf = buf;
return sbuf;
@ -445,7 +573,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a, bool Wii)
for (int i = 0; i < nFiles; i++)
{
std::string sfbuff;
sfbuff = "-----";
sfbuff = "-----\n";
aprintf(i, (char *)sfbuff.c_str());
}
}
@ -482,7 +610,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a, bool Wii)
sprintf(cbuf, "%i", running[i]);
sfbuff = sfbuff + cbuf;
sfbuff = sfbuff + writeMessage(ii, i);
sfbuff = sfbuff + writeMessage(ii, i, Wii);
// write _iSize
strcpy(cbuf, ""); sprintf(cbuf, "%i", _iSize);
@ -588,7 +716,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a, bool Wii)
// --------------
char buffer [1000] = "";
std::string sbuff;
sbuff = writeTitle(m_frame->gPreset);
sbuff = writeTitle(m_frame->gPreset, Wii);
// ==============
@ -678,7 +806,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a, bool Wii)
}
// add new line
sbuff = sbuff + writeMessage(m_frame->gPreset, i); strcpy(buffer, "");
sbuff = sbuff + writeMessage(m_frame->gPreset, i, Wii); strcpy(buffer, "");
sbuff = sbuff + "\n";
} // end of if (PBs[i].running)
@ -705,8 +833,8 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a, bool Wii)
// Write settings
// ---------------
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",
m_frame->gSSBM, m_frame->gSSBMremedy1, m_frame->gSSBMremedy2, m_frame->gSequenced,
m_frame->gVolume, m_frame->gReset, m_frame->gOnlyLooping, m_frame->gSaveFile);
gSSBM, gSSBMremedy1, gSSBMremedy2, gSequenced,
gVolume, gReset, m_frame->gOnlyLooping, m_frame->gSaveFile);
sbuff = sbuff + buffer; strcpy(buffer, "");
// ===============

View File

@ -73,36 +73,35 @@ CUCode_AX::~CUCode_AX()
// ----------------
void CUCode_AX::SaveLogFile(std::string f, int resizeTo, bool type, bool Wii)
{
if (!File::IsDirectory("Logs/Mail")) File::CreateDir("Logs/Mail");
std::ostringstream ci;
std::ostringstream cType;
if(gpName.length() > 0) // thios is currently off in the Release build
{
if (!File::IsDirectory("Logs/Mail")) File::CreateDir("Logs/Mail");
std::ostringstream ci;
std::ostringstream cType;
ci << (resizeTo - 1); // write ci
cType << type; // write cType
ci << (resizeTo - 1); // write ci
cType << type; // write cType
std::string FileName = "Logs/Mail/"; FileName += gpName;
FileName += "_sep"; FileName += ci.str(); FileName += "_sep"; FileName += cType.str();
FileName += Wii ? "_sepWii_sep" : "_sepGC_sep"; FileName += ".log";
std::string FileName = "Logs/Mail/"; FileName += gpName;
FileName += "_sep"; FileName += ci.str(); FileName += "_sep"; FileName += cType.str();
FileName += Wii ? "_sepWii_sep" : "_sepGC_sep"; FileName += ".log";
FILE* fhandle = fopen(FileName.c_str(), "w");
fprintf(fhandle, f.c_str());
fflush(fhandle); fhandle = NULL;
FILE* fhandle = fopen(FileName.c_str(), "w");
fprintf(fhandle, f.c_str());
fflush(fhandle); fhandle = NULL;
}
}
// ============================================
// Save the logged AX mail
// ----------------
void CUCode_AX::SaveLog_(bool Wii, const char* _fmt, ...)
void CUCode_AX::SaveLog_(bool Wii, const char* _fmt, va_list ap)
{
if(m_frame->ScanMails)
{
char Msg[512*10];
va_list ap;
va_start(ap, _fmt);
char Msg[512];
vsprintf(Msg, _fmt, ap);
va_end(ap);
//wxMessageBox( wxString::Format("SaveLog_ again: %s\n", Msg) );
@ -508,8 +507,11 @@ void CUCode_AX::Update()
// -----------
// Shortcut
void CUCode_AX::SaveLog(const char* _fmt, ...) { if(m_frame) SaveLog_(false, _fmt); }
// Shortcut to avoid having to write SaveLog(false, ...) every time
void CUCode_AX::SaveLog(const char* _fmt, ...)
{
va_list ap; va_start(ap, _fmt); if(m_frame) SaveLog_(false, _fmt, ap); va_end(ap);
}
// ============================================

View File

@ -40,7 +40,7 @@ public:
//template<class ParamBlockType>
//void Logging(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, int numberOfPBs);
void Logging(short* _pBuffer, int _iSize, int a, bool Wii);
void SaveLog_(bool Wii, const char* _fmt, ...);
void SaveLog_(bool Wii, const char* _fmt, va_list ap);
void SaveMail(bool Wii, u32 _uMail);
void SaveLogFile(std::string f, int resizeTo, bool type, bool Wii);
std::string TmpMailLog;

View File

@ -185,18 +185,18 @@ struct AXParamBlockWii
u16 running; // 1=RUN 0=STOP
u16 is_stream; // 1 = stream, 0 = one shot
PBMixerWii mixer;
PBInitialTimeDelay initial_time_delay;
PBUpdatesWii updates;
PBDpopWii dpop;
PBVolumeEnvelope vol_env;
PBAudioAddr audio_addr;
PBADPCMInfo adpcm;
PBSampleRateConverter src;
PBADPCMLoopInfo adpcm_loop_info;
PBLpf lpf;
PBHpf hpf;
u16 pad[22];
/* 10 */ PBMixerWii mixer;
/* 34 */ PBInitialTimeDelay initial_time_delay;
/* 41 */ PBUpdatesWii updates;
/* 46 */ PBDpopWii dpop;
/* 58 */ PBVolumeEnvelope vol_env;
/* 60 */ PBAudioAddr audio_addr;
/* 68 */ PBADPCMInfo adpcm;
/* 88 */ PBSampleRateConverter src;
/* 95 */ PBADPCMLoopInfo adpcm_loop_info;
/* 98 */ PBLpf lpf;
/* 102 */ PBHpf hpf;
/* 106 */ u16 pad[22];
};
enum {

View File

@ -90,12 +90,14 @@ int ReadOutPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num)
short *pDest = (short *)&_pPBs[i];
for (int p = 0; p < sizeof(AXParamBlockWii) / 2; p++)
{
pDest[p] = Common::swap16(pSrc[p]);
if(p == 6 || p == 7) pDest[p] = pSrc[p]; // control for the u32
else pDest[p] = Common::swap16(pSrc[p]);
#if defined(_DEBUG) || defined(DEBUGFAST)
gLastBlock = blockAddr + p*2 + 2; // save last block location
#endif
}
_pPBs[i].mixer_control = Common::swap32(_pPBs[i].mixer_control);
blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo;
count++;
@ -120,9 +122,11 @@ void WriteBackPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num)
{
short* pSrc = (short*)&_pPBs[i];
short* pDest = (short*)g_dspInitialize.pGetMemoryPointer(blockAddr);
_pPBs[i].mixer_control = Common::swap32(_pPBs[i].mixer_control);
for (size_t p = 0; p < sizeof(AXParamBlockWii) / 2; p++)
{
pDest[p] = Common::swap16(pSrc[p]);
if(p == 6 || p == 7) pDest[p] = pSrc[p]; // control for the u32
else pDest[p] = Common::swap16(pSrc[p]);
}
// next block
@ -140,6 +144,7 @@ void CUCode_AXWii::MixAdd(short* _pBuffer, int _iSize)
if (_iSize > 1024 * 1024)
_iSize = 1024 * 1024;
// write zeroes to the beginning of templbuffer
memset(templbuffer, 0, _iSize * sizeof(int));
memset(temprbuffer, 0, _iSize * sizeof(int));
@ -189,6 +194,7 @@ void CUCode_AXWii::MixAdd(short* _pBuffer, int _iSize)
WriteBackPBsWii(m_addressPBs, PBs, numberOfPBs);
// We write the sound to _pBuffer
for (int i = 0; i < _iSize; i++)
{
// Clamp into 16-bit. Maybe we should add a volume compressor here.
@ -219,8 +225,12 @@ void CUCode_AXWii::Update()
}
}
// Shortcut
void CUCode_AXWii::SaveLog(const char* _fmt, ...) { if(m_frame) lCUCode_AX->SaveLog_(true, _fmt); }
void CUCode_AXWii::SaveLog(const char* _fmt, ...)
{
va_list ap; va_start(ap, _fmt); if(m_frame) lCUCode_AX->SaveLog_(true, _fmt, ap); va_end(ap);
}
// AX seems to bootup one task only and waits for resume-callbacks

View File

@ -96,12 +96,6 @@ inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer,
// Top Spin 3 Wii
if(pb.audio_addr.sample_format > 25) pb.audio_addr.sample_format = 0;
/* What's with the high samplePos values in Wii? Should we adjust them somehow?
samplePos = ((samplePos/14)*16) + (samplePos % 14) + 2;
sampleEnd = ((sampleEnd/14)*16) + (sampleEnd % 14) + 2;
loopPos = ((loopPos/14)*16) + (loopPos % 14) + 2;
*/
// =======================================================================================
// Walk through _iSize. _iSize = numSamples. If the game goes slow _iSize will be higher to
// compensate for that. _iSize can be as low as 100 or as high as 2000 some cases.
@ -154,8 +148,9 @@ inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer,
}
// ================
// =======================================================================================
// Volume control
// ===================================================================
// Overall volume control. In addition to this there is also separate volume settings to
// different channels (left, right etc).
frac &= 0xffff;
int vol = pb.vol_env.cur_volume >> 9;
@ -173,13 +168,16 @@ inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer,
int leftmix = pb.mixer.volume_left >> 5;
int rightmix = pb.mixer.volume_right >> 5;
// ===============
int left = sample * leftmix >> 8;
int right = sample * rightmix >> 8;
//adpcm has to walk from oldSamplePos to samplePos here
templbuffer[s] += left;
temprbuffer[s] += right;
// ===============
// ===================================================================
// Control the behavior when we reach the end of the sample
if (samplePos >= sampleEnd)
{
if (pb.audio_addr.looping == 1)
@ -201,6 +199,8 @@ inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer,
break;
}
}
// ===============
} // end of the _iSize loop
// Update volume
@ -214,7 +214,7 @@ inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer,
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)
} // if (pb.running)
}
#endif // _UCODE_AX_VOICE_H