mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Fixed Wii AX sound, for real this time
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1169 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -138,13 +138,6 @@ CDebugger::CDebugger(wxWindow *parent, wxWindowID id, const wxString &title,
|
||||
//wxEVT_RIGHT_DOWN, wxEVT_MOUSEWHEEL, wxEVT_LEFT_UP,
|
||||
//m_bl95, m_PageBlock, sBlock
|
||||
|
||||
/*
|
||||
for (int i = 0; i < 127; ++i)
|
||||
{
|
||||
m_bl0->AppendText(wxString::Format("%02i|68 : 01a70144\n", i));
|
||||
m_bl95->AppendText(wxString::Format("%i Mouse\n", i));
|
||||
}*/
|
||||
|
||||
m_bl95->Connect(wxID_ANY, wxEVT_SCROLLWIN_THUMBTRACK,
|
||||
wxScrollWinEventHandler(CDebugger::ScrollBlocksCursor), (wxObject*)NULL, this);
|
||||
m_bl95->Connect(wxID_ANY, wxEVT_SCROLLWIN_THUMBRELEASE,
|
||||
@ -729,7 +722,8 @@ void CDebugger::ChangeMail(wxCommandEvent& event)
|
||||
void CDebugger::ReadDir()
|
||||
{
|
||||
CFileSearch::XStringVector Directories;
|
||||
Directories.push_back("Logs/Mail");
|
||||
//Directories.push_back("Logs/Mail");
|
||||
Directories.push_back(FULL_MAIL_LOGS_DIR);
|
||||
|
||||
CFileSearch::XStringVector Extensions;
|
||||
Extensions.push_back("*.log");
|
||||
@ -857,7 +851,7 @@ std::string CDebugger::Readfile_(std::string FileName)
|
||||
// Read file
|
||||
void CDebugger::Readfile(std::string FileName, bool GC)
|
||||
{
|
||||
int n = CountFiles(FileName);
|
||||
int n = CountFiles(FileName); // count how many mails we have
|
||||
int curr_n = 0;
|
||||
std::ifstream file;
|
||||
for (int i = 0; i < m_RadioBox[3]->GetCount(); i++)
|
||||
@ -897,12 +891,13 @@ void CDebugger::Readfile(std::string FileName, bool GC)
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Only allow one selected game at a time
|
||||
// Read the file to the text window
|
||||
// ---------------
|
||||
void CDebugger::OnGameChange(wxCommandEvent& event)
|
||||
{
|
||||
if(event.GetId() == 2006)
|
||||
{
|
||||
// Only allow one selected game at a time
|
||||
for (int i = 0; i < m_gc->GetCount(); ++i)
|
||||
if(i != event.GetInt()) m_gc->Check(i, false);
|
||||
for (int i = 0; i < m_wii->GetCount(); ++i)
|
||||
|
@ -532,7 +532,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a, bool Wii)
|
||||
/**/
|
||||
AXParamBlock PBs[64];
|
||||
AXParamBlockWii PBw[NUMBER_OF_PBS];
|
||||
int numberOfPBsWii = ReadOutPBsWii(m_addressPBs, PBw, NUMBER_OF_PBS - 1);
|
||||
int numberOfPBsWii = ReadOutPBsWii(m_addressPBs, PBw, NUMBER_OF_PBS, true);
|
||||
int numberOfPBsGC = ReadOutPBs(m_addressPBs, PBs, 64);
|
||||
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "FileUtil.h" // for IsDirectory
|
||||
#include "StringUtil.h" // for StringFromFormat
|
||||
#include "../Debugger/Debugger.h"
|
||||
#include "../Logging/Console.h" // for aprintf
|
||||
#include <sstream>
|
||||
@ -119,7 +120,9 @@ if(m_frame->ScanMails)
|
||||
ci << (saveNext - 1);
|
||||
TmpMailLog += "\n\n";
|
||||
TmpMailLog += "-----------------------------------------------------------------------\n";
|
||||
TmpMailLog += "Current mail: " + gpName + " mail " + ci.str() + "\n\n";
|
||||
TmpMailLog += "Current mail: " + gpName + " mail " + ci.str() + "\n";
|
||||
if(Wii)
|
||||
TmpMailLog += "Current CRC: " + StringFromFormat("0x%08x \n\n", _CRC);
|
||||
|
||||
for (int i = 0; i < sMailTime.size(); i++)
|
||||
{
|
||||
@ -143,7 +146,7 @@ if(m_frame->ScanMails)
|
||||
{
|
||||
TmpMailLog += Msg;
|
||||
TmpMailLog += "\n";
|
||||
LOG_(1, Msg);
|
||||
LOG_(1, Msg); // also write it to the log
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ public:
|
||||
|
||||
// PBs
|
||||
u32 m_addressPBs;
|
||||
u32 _CRC;
|
||||
|
||||
private:
|
||||
enum
|
||||
|
@ -79,7 +79,7 @@ struct PBDpop
|
||||
s16 unknown[12];
|
||||
};
|
||||
|
||||
struct PBDpopWii_
|
||||
struct PBDpopWii_ // new CRC version
|
||||
{
|
||||
s16 unknown[7];
|
||||
};
|
||||
@ -204,7 +204,7 @@ struct AXParamBlockWii
|
||||
/* 106 */ u16 pad[22];
|
||||
};
|
||||
|
||||
struct AXParamBlockWii_
|
||||
struct AXParamBlockWii_ // new CRC version
|
||||
{
|
||||
u16 next_pb_hi;
|
||||
u16 next_pb_lo;
|
||||
|
@ -54,6 +54,7 @@ CUCode_AXWii::CUCode_AXWii(CMailHandler& _rMailHandler, u32 _CRC)
|
||||
temprbuffer = new int[1024 * 1024];
|
||||
|
||||
lCUCode_AX = new CUCode_AX(_rMailHandler);
|
||||
lCUCode_AX->_CRC = _CRC;
|
||||
_CRC = _CRC;
|
||||
}
|
||||
|
||||
@ -86,6 +87,7 @@ void CUCode_AXWii::MixAdd(short* _pBuffer, int _iSize)
|
||||
}
|
||||
else
|
||||
{
|
||||
//LOG_(0, "else");
|
||||
AXParamBlockWii_ PBs[NUMBER_OF_PBS];
|
||||
MixAdd_(_pBuffer, _iSize, PBs);
|
||||
}
|
||||
@ -99,7 +101,7 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs)
|
||||
//AXParamBlockWii PBs[NUMBER_OF_PBS];
|
||||
|
||||
// read out pbs
|
||||
int numberOfPBs = ReadOutPBsWii(m_addressPBs, PBs, NUMBER_OF_PBS);
|
||||
int numberOfPBs = ReadOutPBsWii(m_addressPBs, PBs, NUMBER_OF_PBS, false);
|
||||
|
||||
if (_iSize > 1024 * 1024)
|
||||
_iSize = 1024 * 1024;
|
||||
@ -194,10 +196,9 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs)
|
||||
//MixAddVoice(pb, templbuffer, temprbuffer, _iSize);
|
||||
MixAddVoice(PBs[i], templbuffer, temprbuffer, _iSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WriteBackPBsWii(m_addressPBs, PBs, numberOfPBs);
|
||||
|
||||
// We write the sound to _pBuffer
|
||||
for (int i = 0; i < _iSize; i++)
|
||||
{
|
||||
@ -350,7 +351,7 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
|
||||
Addr__AXOutSBuffer = Memory_Read_U32(uAddress);
|
||||
uAddress += 10;
|
||||
// uAddress += 12;
|
||||
DebugLog("%08x : AXLIST OutSBuffer (0x0007) address: %08x", uAddress, Addr__AXOutSBuffer);
|
||||
SaveLog("%08x : AXLIST OutSBuffer (0x0007) address: %08x", uAddress, Addr__AXOutSBuffer);
|
||||
break;
|
||||
|
||||
/* case 0x0009:
|
||||
|
@ -26,12 +26,11 @@
|
||||
// -----------
|
||||
extern bool gSequenced;
|
||||
extern bool gVolume;
|
||||
|
||||
|
||||
extern float ratioFactor;
|
||||
|
||||
|
||||
template<class ParamBlockType>
|
||||
inline int ReadOutPBsWii(u32 pbs_address, ParamBlockType& _pPBs, int _num)
|
||||
inline int ReadOutPBsWii(u32 pbs_address, ParamBlockType& _pPBs, int _num, int _deb)
|
||||
//int ReadOutPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num)
|
||||
{
|
||||
int count = 0;
|
||||
@ -50,14 +49,13 @@ inline int ReadOutPBsWii(u32 pbs_address, ParamBlockType& _pPBs, int _num)
|
||||
for (int p = 0; p < sizeof(AXParamBlockWii) / 2; p++)
|
||||
{
|
||||
if(p == 6 || p == 7) pDest[p] = pSrc[p]; // control for the u32
|
||||
//else if(p == 62 || p == 63 || p == 64 || p == 65 || p == 66 || p == 67)
|
||||
// pDest[p] = Common::swap16(pSrc[p-1]);
|
||||
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++;
|
||||
@ -88,10 +86,8 @@ inline void WriteBackPBsWii(u32 pbs_address, ParamBlockType& _pPBs, int _num)
|
||||
_pPBs[i].mixer_control = Common::swap32(_pPBs[i].mixer_control);
|
||||
for (size_t p = 0; p < sizeof(AXParamBlockWii) / 2; p++)
|
||||
{
|
||||
if(p == 6 || p == 7) pDest[p] = pSrc[p]; // control for the u32
|
||||
//else if(p == 62 || p == 63 || p == 64 || p == 65 || p == 66 || p == 67)
|
||||
// pDest[p-1] = Common::swap16(pSrc[p]);
|
||||
else 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
|
||||
@ -100,18 +96,13 @@ inline void WriteBackPBsWii(u32 pbs_address, ParamBlockType& _pPBs, int _num)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<class ParamBlockType>
|
||||
inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer, int _iSize)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
float ratioFactor = 32000.0f / (float)DSound::DSound_GetSampleRate();
|
||||
ratioFactor = 32000.0f / (float)DSound::DSound_GetSampleRate();
|
||||
#else
|
||||
float ratioFactor = 32000.0f / 44100.0f;
|
||||
ratioFactor = 32000.0f / 44100.0f;
|
||||
#endif
|
||||
|
||||
// DoVoiceHacks(pb);
|
||||
@ -123,7 +114,7 @@ inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer,
|
||||
// =======================================================================================
|
||||
// Read initial parameters
|
||||
// ------------
|
||||
//constants
|
||||
//constants
|
||||
const u32 ratio = (u32)(((pb.src.ratio_hi << 16) + pb.src.ratio_lo) * ratioFactor);
|
||||
u32 sampleEnd = (pb.audio_addr.end_addr_hi << 16) | pb.audio_addr.end_addr_lo;
|
||||
u32 loopPos = (pb.audio_addr.loop_addr_hi << 16) | pb.audio_addr.loop_addr_lo;
|
||||
@ -132,7 +123,7 @@ inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer,
|
||||
u32 samplePos = (pb.audio_addr.cur_addr_hi << 16) | pb.audio_addr.cur_addr_lo;
|
||||
u32 frac = pb.src.cur_addr_frac;
|
||||
// =============
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Handle no-src streams - No src streams have pb.src_type == 2 and have pb.src.ratio_hi = 0
|
||||
// and pb.src.ratio_lo = 0. We handle that by setting the sampling ratio integer to 1. This
|
||||
@ -155,6 +146,7 @@ inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer,
|
||||
}
|
||||
// =============
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// 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
|
||||
@ -278,7 +270,6 @@ inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer,
|
||||
}
|
||||
}
|
||||
// ===============
|
||||
|
||||
} // end of the _iSize loop
|
||||
|
||||
// Update volume
|
||||
@ -292,6 +283,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)
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,6 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
|
||||
g_hInstance = hinstDLL;
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -154,7 +153,7 @@ CDebugger* m_frame;
|
||||
void DllDebugger(HWND _hParent)
|
||||
{
|
||||
m_frame = new CDebugger(NULL);
|
||||
m_frame->ShowModal();
|
||||
m_frame->Show();
|
||||
}
|
||||
// ===================
|
||||
|
||||
|
Reference in New Issue
Block a user