code cleanup, focusing on dsp hle

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5143 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman
2010-02-28 18:21:22 +00:00
parent cff39f5382
commit 80d303222b
32 changed files with 673 additions and 3590 deletions

View File

@ -17,11 +17,6 @@
#include "FileUtil.h" // For IsDirectory()
#include "StringUtil.h" // For StringFromFormat()
#if defined(HAVE_WX) && HAVE_WX
#include "../Debugger/Debugger.h"
//#include "../Logging/File.h" // For PrintFile()
extern DSPDebuggerHLE* m_DebuggerFrame;
#endif
#include <sstream>
#include "../Config.h"
@ -34,26 +29,12 @@ extern DSPDebuggerHLE* m_DebuggerFrame;
#include "UCode_AX.h"
#include "UCode_AX_Voice.h"
// ------------------------------------------------------------------
// Externals
// -----------
extern bool gSSBM;
extern bool gSSBMremedy1;
extern bool gSSBMremedy2;
extern bool gSequenced;
extern bool gVolume;
extern bool gReset;
std::vector<std::string> sMailLog, sMailTime;
// -----------
CUCode_AX::CUCode_AX(CMailHandler& _rMailHandler)
: IUCode(_rMailHandler)
, m_addressPBs(0xFFFFFFFF)
: IUCode(_rMailHandler)
, m_addressPBs(0xFFFFFFFF)
{
// we got loaded
m_rMailHandler.PushMail(0xDCD10000);
m_rMailHandler.PushMail(DSP_INIT);
templbuffer = new int[1024 * 1024];
temprbuffer = new int[1024 * 1024];
@ -66,257 +47,114 @@ CUCode_AX::~CUCode_AX()
delete [] temprbuffer;
}
// Save file to harddrive
void CUCode_AX::SaveLogFile(std::string f, int resizeTo, bool type, bool Wii)
// Needs A LOT of love!
static void ProcessUpdates(AXPB &PB)
{
//#ifdef DEBUG_LEVEL
std::ostringstream ci;
std::ostringstream cType;
ci << (resizeTo - 1); // write ci
cType << type; // write cType
std::string FileName = std::string(File::GetUserPath(D_MAILLOGS_IDX)) + std::string(globals->unique_id);
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, "%s", f.c_str());
fflush(fhandle); fhandle = NULL;
//#endif
}
// ============================================
// Save the logged AX mail
// ----------------
void CUCode_AX::SaveLog_(bool Wii, const char* _fmt, va_list ap)
{
char Msg[512];
vsprintf(Msg, _fmt, ap);
#if defined(HAVE_WX) && HAVE_WX
if (m_DebuggerFrame->ScanMails)
{
if (strcmp(Msg, "Begin") == 0)
{
TmpMailLog = "";
}
else if (strcmp(Msg, "End") == 0)
{
if (saveNext && saveNext < 100) // limit because saveNext is not initialized
{
// Save the timestamps and comment
std::ostringstream ci;
ci << (saveNext - 1);
TmpMailLog += "\n\n";
TmpMailLog += "-----------------------------------------------------------------------\n";
// TmpMailLog += "Current mail: " + std::string(globals->unique_id) + " mail " + ci + "\n";
if (Wii)
TmpMailLog += "Current CRC: " + StringFromFormat("0x%08x \n\n", _CRC);
for (u32 i = 0; i < sMailTime.size(); i++)
{
char tmpbuf[128]; sprintf(tmpbuf, "Mail %i received: %s\n", i, sMailTime.at(i).c_str());
TmpMailLog += tmpbuf;
}
TmpMailLog += "-----------------------------------------------------------------------";
sMailLog.push_back(TmpMailLog);
// Save file to disc
if (m_DebuggerFrame->StoreMails)
{
SaveLogFile(TmpMailLog, saveNext, 1, Wii);
}
m_DebuggerFrame->DoUpdateMail(); // update the view
saveNext = 0;
}
}
else
{
#endif
TmpMailLog += Msg;
TmpMailLog += "\n";
DEBUG_LOG(DSPHLE, "%s", Msg); // also write it to the log
#if defined(HAVE_WX) && HAVE_WX
}
}
#endif
}
// ----------------
// ============================================
// Save the whole AX mail
// ----------------
void CUCode_AX::SaveMail(bool Wii, u32 _uMail)
{
#if defined(HAVE_WX) && HAVE_WX
if (!m_DebuggerFrame) return;
if (m_DebuggerFrame->ScanMails)
{
int i = 0;
std::string sTemp;
std::string sTempEnd;
std::string * sAct = &sTemp;
bool doOnce = true; // for the while loop, to avoid getting stuck
// Go through the mail
while (i < 250)
{
// Make a new row for each AX-Command
u16 axcomm = Memory_Read_U16(_uMail + i);
if (axcomm < 15 && axcomm != 0) // we can at most write 8 messages per log
{
*sAct += "\n";
}
char szTemp2[128] = "";
sprintf(szTemp2, "%08x : 0x%04x\n", _uMail + i, axcomm);
*sAct += szTemp2;
// set i to 160 so that we show some things after the end to
if ((axcomm == AXLIST_END || axcomm == 0x000e) && doOnce)
{
i = 160;
sAct = &sTempEnd;
doOnce = false;
}
i += 2;
}
// Compare this mail to old mails
u32 addnew = 0;
for (u32 j = 0; j < m_DebuggerFrame->sMail.size(); j++)
{
if (m_DebuggerFrame->sMail.at(j).length() != sTemp.length())
{
//wxMessageBox( wxString::Format("%s \n\n%s", m_DebuggerFrame->sMail.at(i).c_str(),
// sTemp.c_str()) );
addnew++;
}
}
// In case the mail didn't match any saved mail, save it
if (addnew == m_DebuggerFrame->sMail.size())
{
//Console::Print("%i | %i\n", addnew, m_DebuggerFrame->sMail.size());
u32 resizeTo = (u32)(m_DebuggerFrame->sMail.size() + 1);
// ------------------------------------
// get timestamp
wxDateTime datetime = wxDateTime::UNow();
char Msg[128];
sprintf(Msg, "%04i-%02i-%02i %02i:%02i:%02i:%03i",
datetime.GetYear(), datetime.GetMonth() + 1, datetime.GetDay(),
datetime.GetHour(), datetime.GetMinute(), datetime.GetSecond(), datetime.GetMillisecond());
sMailTime.push_back(Msg);
// ------------------------------------
m_DebuggerFrame->sMail.push_back(sTemp); // save the main comparison mail
std::string lMail = sTemp + "------------------\n" + sTempEnd;
m_DebuggerFrame->sFullMail.push_back(lMail);
// enable the radio button and update view
if (resizeTo <= m_DebuggerFrame->m_RadioBox[3]->GetCount())
{
m_DebuggerFrame->m_RadioBox[3]->Enable(resizeTo - 1, true);
m_DebuggerFrame->m_RadioBox[3]->Select(resizeTo - 1);
}
addnew = 0;
saveNext = resizeTo; // save the log to
// ------------------------------------
// Save as file
if (m_DebuggerFrame->StoreMails)
{
//Console::Print("m_DebuggerFrame->sMail.size(): %i | resizeTo:%i\n", m_DebuggerFrame->sMail.size(), resizeTo);
SaveLogFile(lMail, resizeTo, 0, Wii);
}
}
sTemp = "";
sTempEnd = "";
}
#endif
}
// ----------------
static bool ReadOutPB(u32 pb_address, AXParamBlock &PB)
{
const u16 *pSrc = (const u16 *)g_dspInitialize.pGetMemoryPointer(pb_address);
if (!pSrc)
return false;
u16 *pDest = (u16 *)&PB;
// TODO: SSE. Although it won't help much.
for (int p = 0; p < (int)sizeof(AXParamBlock) / 2; p++)
{
pDest[p] = Common::swap16(pSrc[p]);
}
return true;
}
static bool WriteBackPB(u32 pb_address, AXParamBlock &PB)
{
const u16 *pSrc = (const u16*)&PB;
u16 *pDest = (u16 *)g_dspInitialize.pGetMemoryPointer(pb_address);
if (!pDest)
return false;
// TODO: SSE. Although it won't help much.
for (size_t p = 0; p < sizeof(AXParamBlock) / 2; p++)
{
pDest[p] = Common::swap16(pSrc[p]);
}
return true;
}
static void ProcessUpdates(AXParamBlock &PB)
{
// ---------------------------------------------------------------------------------------
/* Make the updates we are told to do. When there are multiple updates for a block they
are placed in memory directly following updaddr. They are mostly for initial time
delays, sometimes for the FIR filter or channel volumes. We do all of them at once here.
If we get both an on and an off update we chose on. Perhaps that makes the RE1 music
work better. */
u16 *pDest = (u16 *)&PB;
u16 upd0 = pDest[34]; u16 upd1 = pDest[35]; u16 upd2 = pDest[36]; // num_updates
u16 upd3 = pDest[37]; u16 upd4 = pDest[38];
u16 upd_hi = pDest[39]; // update addr
u16 upd_lo = pDest[40];
int numupd = upd0 + upd1 + upd2 + upd3 + upd4;
if (numupd > 64) numupd = 64; // prevent crazy values
const u32 updaddr = (u32)(upd_hi << 16) | upd_lo;
int on = false, off = false;
// Make the updates we are told to do. When there are multiple updates for a block they
// are placed in memory directly following updaddr. They are mostly for initial time
// delays, sometimes for the FIR filter or channel volumes. We do all of them at once here.
// If we get both an on and an off update we chose on. Perhaps that makes the RE1 music
// work better.
int numupd = 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];
if (numupd > 64) numupd = 64; // prevent crazy values TODO: LOL WHAT
const u32 updaddr = (u32)(PB.updates.data_hi << 16) | PB.updates.data_lo;
int on = 0, off = 0;
for (int j = 0; j < numupd; j++)
{
int k = g_Config.m_EnableRE0Fix ? 0 : j;
const u16 updpar = Memory_Read_U16(updaddr + k);
const u16 upddata = Memory_Read_U16(updaddr + k + 2);
const u16 updpar = Memory_Read_U16(updaddr + k);
const u16 upddata = Memory_Read_U16(updaddr + k + 2);
// some safety checks, I hope it's enough
if (updaddr > 0x80000000 && updaddr < 0x817fffff
&& updpar < 63 && updpar > 3 && upddata >= 0 // updpar > 3 because we don't want to change
// 0-3, those are important
//&& (upd0 || upd1 || upd2 || upd3 || upd4) // We should use these in some way to I think
// but I don't know how or when
&& gSequenced) // on and off option
)
{
pDest[updpar] = upddata;
((u16*)&PB)[updpar] = upddata; // WTF ABOUNDS!
}
if (updpar == 7 && upddata == 1) on++;
if (updpar == 7 && upddata == 1) off++;
// hack: if we get both an on and an off select on rather than off
if (on > 0 && off > 0) pDest[7] = 1;
if (on > 0 && off > 0) PB.running = 1;
}
}
static void VoiceHacks(AXPB &pb)
{
// get necessary values
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 u16 updpar = Memory_Read_U16(updaddr);
// const u16 upddata = Memory_Read_U16(updaddr + 2);
// =======================================================================================
/* Fix problems introduced with the SSBM fix. Sometimes when a music stream ended sampleEnd
would end up outside of bounds while the block was still playing resulting in noise
a strange noise. This should take care of that.
*/
if (
(sampleEnd > (0x017fffff * 2) || loopPos > (0x017fffff * 2)) // ARAM bounds in nibbles
)
{
pb.running = 0;
// also reset all values if it makes any difference
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; pb.src.ratio_hi = 0; pb.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 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. Perhaps it was in conjunction with the old sequenced music fix below,
I'm not sure. This was an attempt to prevent that anyway by resetting all. But I'm not sure if this
is needed anymore. Please try to play SSBM without it and see if it works anyway.
*/
if (
// detect blocks that have recently been running that we should reset
pb.running == 0 && pb.audio_addr.looping == 1
//pb.running == 0 && pb.adpcm_loop_info.pred_scale
// this prevents us from ruining sequenced music blocks, may not be needed
/*
&& !(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])
*/
//&& !(updpar || upddata)
&& pb.mixer_control == 0 // only use this in SSBM
)
{
// reset the detection values
pb.audio_addr.looping = 0;
pb.adpcm_loop_info.pred_scale = 0;
pb.adpcm_loop_info.yn1 = 0; pb.adpcm_loop_info.yn2 = 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;
}
}
void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
{
@ -326,40 +164,30 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
memset(templbuffer, 0, _iSize * sizeof(int));
memset(temprbuffer, 0, _iSize * sizeof(int));
#if defined(HAVE_WX) && HAVE_WX
// write logging data to debugger
if (m_DebuggerFrame && _pBuffer)
{
CUCode_AX::Logging(_pBuffer, _iSize, 0, false);
}
#endif
AXParamBlock PB;
AXPB PB;
for (int x = 0; x < numPBaddr; x++)
{
//u32 blockAddr = m_addressPBs;
u32 blockAddr = PBaddr[x];
if (!blockAddr)
return;
// ------------
for (int i = 0; i < NUMBER_OF_PBS; i++)
{
if (!ReadOutPB(blockAddr, PB))
if (!ReadPB(blockAddr, PB))
break;
ProcessUpdates(PB);
MixAddVoice(PB, templbuffer, temprbuffer, _iSize, false);
if (!WriteBackPB(blockAddr, PB))
VoiceHacks(PB);
MixAddVoice(PB, templbuffer, temprbuffer, _iSize);
if (!WritePB(blockAddr, PB))
break;
// next PB, or done
blockAddr = (PB.next_pb_hi << 16) | PB.next_pb_lo;
// Guess we're out of blocks
if (!blockAddr)
break;
}
@ -380,29 +208,21 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
*_pBuffer++ = right;
}
}
#if defined(HAVE_WX) && HAVE_WX
// write logging data to debugger again after the update
if (m_DebuggerFrame && _pBuffer)
{
CUCode_AX::Logging(_pBuffer, _iSize, 1, false);
}
#endif
}
// ------------------------------------------------------------------------------
// Handle incoming mail
// -----------
void CUCode_AX::HandleMail(u32 _uMail)
{
if ((_uMail & 0xFFFF0000) == MAIL_AX_ALIST)
{
// a new List
DEBUG_LOG(DSPHLE, " >>>> u32 MAIL : General Mail (%08x)", _uMail);
// We are expected to get a new CmdBlock
DEBUG_LOG(DSPHLE, "GetNextCmdBlock (%ibytes)", (u16)_uMail);
}
else if (_uMail == 0xCDD10000) // Action 0 - restart
{
m_rMailHandler.PushMail(0xDCD10001);
m_rMailHandler.PushMail(DSP_RESUME);
}
else if (_uMail == 0xCDD10001) // Action 1 - new ucode upload
{
@ -421,28 +241,14 @@ void CUCode_AX::HandleMail(u32 _uMail)
// ------------------------------------------------------------------------------
// Update with DSP Interrupt
// -----------
void CUCode_AX::Update(int cycles)
{
// check if we have to sent something
// check if we have to send something
if (!m_rMailHandler.IsEmpty())
{
g_dspInitialize.pGenerateDSPInterrupt();
}
}
// -----------
// Shortcut to avoid having to write SaveLog(false, ...) every time
void CUCode_AX::SaveLog(const char* _fmt, ...)
{
#if defined(HAVE_WX) && HAVE_WX
va_list ap; va_start(ap, _fmt);
if (m_DebuggerFrame) SaveLog_(false, _fmt, ap);
va_end(ap);
#endif
}
// ============================================
// AX seems to bootup one task only and waits for resume-callbacks
@ -451,9 +257,9 @@ void CUCode_AX::SaveLog(const char* _fmt, ...)
bool CUCode_AX::AXTask(u32& _uMail)
{
u32 uAddress = _uMail;
SaveLog("Begin");
SaveLog("=====================================================================");
SaveLog("%08x : AXTask - AXCommandList-Addr:", uAddress);
DEBUG_LOG(DSPHLE, "Begin");
DEBUG_LOG(DSPHLE, "=====================================================================");
DEBUG_LOG(DSPHLE, "%08x : AXTask - AXCommandList-Addr:", uAddress);
u32 Addr__AXStudio;
u32 Addr__AXOutSBuffer;
@ -463,8 +269,8 @@ bool CUCode_AX::AXTask(u32& _uMail)
u32 Addr__12;
u32 Addr__4_1;
u32 Addr__4_2;
// u32 Addr__4_3;
// u32 Addr__4_4;
//u32 Addr__4_3;
//u32 Addr__4_4;
u32 Addr__5_1;
u32 Addr__5_2;
u32 Addr__6;
@ -474,9 +280,6 @@ bool CUCode_AX::AXTask(u32& _uMail)
numPBaddr = 0;
#if defined(HAVE_WX) && HAVE_WX
if (m_DebuggerFrame) SaveMail(false, _uMail); // Save mail for debugging
#endif
while (bExecuteList)
{
static int last_valid_command = 0;
@ -485,159 +288,155 @@ bool CUCode_AX::AXTask(u32& _uMail)
switch (iCommand)
{
case AXLIST_STUDIOADDR: //00
Addr__AXStudio = Memory_Read_U32(uAddress);
uAddress += 4;
SaveLog("%08x : AXLIST studio address: %08x", uAddress, Addr__AXStudio);
break;
case AXLIST_STUDIOADDR: //00
Addr__AXStudio = Memory_Read_U32(uAddress);
uAddress += 4;
DEBUG_LOG(DSPHLE, "%08x : AXLIST studio address: %08x", uAddress, Addr__AXStudio);
break;
case 0x001: // 2byte x 10
{
u32 address = Memory_Read_U32(uAddress);
uAddress += 4;
u16 param1 = Memory_Read_U16(uAddress);
uAddress += 2;
u16 param2 = Memory_Read_U16(uAddress);
uAddress += 2;
u16 param3 = Memory_Read_U16(uAddress);
uAddress += 2;
SaveLog("%08x : AXLIST 1: %08x, %04x, %04x, %04x", uAddress, address, param1, param2, param3);
}
break;
case 0x001: // 2byte x 10
{
u32 address = Memory_Read_U32(uAddress);
uAddress += 4;
u16 param1 = Memory_Read_U16(uAddress);
uAddress += 2;
u16 param2 = Memory_Read_U16(uAddress);
uAddress += 2;
u16 param3 = Memory_Read_U16(uAddress);
uAddress += 2;
DEBUG_LOG(DSPHLE, "%08x : AXLIST 1: %08x, %04x, %04x, %04x", uAddress, address, param1, param2, param3);
}
break;
//
// Somewhere we should be getting a bitmask of AX_SYNC values
// that tells us what has been updated
// Dunno if important
//
case AXLIST_PBADDR: //02
{
PBaddr[numPBaddr] = Memory_Read_U32(uAddress);
numPBaddr++;
//
// Somewhere we should be getting a bitmask of AX_SYNC values
// that tells us what has been updated
// Dunno if important
//
case AXLIST_PBADDR: //02
{
PBaddr[numPBaddr] = Memory_Read_U32(uAddress);
numPBaddr++;
m_addressPBs = Memory_Read_U32(uAddress); // left in for now
uAddress += 4;
soundStream->GetMixer()->SetHLEReady(true);
SaveLog("%08x : AXLIST PB address: %08x", uAddress, m_addressPBs);
SaveLog("Update the SoundThread to be in sync");
// soundStream->Update(); //do it in this thread to avoid sync problems
}
break;
m_addressPBs = Memory_Read_U32(uAddress); // left in for now
uAddress += 4;
soundStream->GetMixer()->SetHLEReady(true);
DEBUG_LOG(DSPHLE, "%08x : AXLIST PB address: %08x", uAddress, m_addressPBs);
}
break;
case 0x0003:
SaveLog("%08x : AXLIST command 0x0003 ????");
break;
case 0x0003:
DEBUG_LOG(DSPHLE, "%08x : AXLIST command 0x0003 ????");
break;
case 0x0004: // AUX?
Addr__4_1 = Memory_Read_U32(uAddress);
uAddress += 4;
Addr__4_2 = Memory_Read_U32(uAddress);
uAddress += 4;
SaveLog("%08x : AXLIST 4_1 4_2 addresses: %08x %08x", uAddress, Addr__4_1, Addr__4_2);
break;
case 0x0004: // AUX?
Addr__4_1 = Memory_Read_U32(uAddress);
uAddress += 4;
Addr__4_2 = Memory_Read_U32(uAddress);
uAddress += 4;
DEBUG_LOG(DSPHLE, "%08x : AXLIST 4_1 4_2 addresses: %08x %08x", uAddress, Addr__4_1, Addr__4_2);
break;
case 0x0005:
Addr__5_1 = Memory_Read_U32(uAddress);
uAddress += 4;
Addr__5_2 = Memory_Read_U32(uAddress);
uAddress += 4;
SaveLog("%08x : AXLIST 5_1 5_2 addresses: %08x %08x", uAddress, Addr__5_1, Addr__5_2);
break;
case 0x0005:
Addr__5_1 = Memory_Read_U32(uAddress);
uAddress += 4;
Addr__5_2 = Memory_Read_U32(uAddress);
uAddress += 4;
DEBUG_LOG(DSPHLE, "%08x : AXLIST 5_1 5_2 addresses: %08x %08x", uAddress, Addr__5_1, Addr__5_2);
break;
case 0x0006:
Addr__6 = Memory_Read_U32(uAddress);
uAddress += 4;
SaveLog("%08x : AXLIST 6 address: %08x", uAddress, Addr__6);
break;
case 0x0006:
Addr__6 = Memory_Read_U32(uAddress);
uAddress += 4;
DEBUG_LOG(DSPHLE, "%08x : AXLIST 6 address: %08x", uAddress, Addr__6);
break;
case AXLIST_SBUFFER:
Addr__AXOutSBuffer = Memory_Read_U32(uAddress);
uAddress += 4;
SaveLog("%08x : AXLIST OutSBuffer address: %08x", uAddress, Addr__AXOutSBuffer);
break;
case AXLIST_SBUFFER:
Addr__AXOutSBuffer = Memory_Read_U32(uAddress);
uAddress += 4;
DEBUG_LOG(DSPHLE, "%08x : AXLIST OutSBuffer address: %08x", uAddress, Addr__AXOutSBuffer);
break;
case 0x0009:
Addr__9 = Memory_Read_U32(uAddress);
uAddress += 4;
SaveLog("%08x : AXLIST 6 address: %08x", Addr__9);
break;
case 0x0009:
Addr__9 = Memory_Read_U32(uAddress);
uAddress += 4;
DEBUG_LOG(DSPHLE, "%08x : AXLIST 6 address: %08x", Addr__9);
break;
case AXLIST_COMPRESSORTABLE: // 0xa
Addr__A = Memory_Read_U32(uAddress);
uAddress += 4;
SaveLog("%08x : AXLIST CompressorTable address: %08x", uAddress, Addr__A);
break;
case AXLIST_COMPRESSORTABLE: // 0xa
Addr__A = Memory_Read_U32(uAddress);
uAddress += 4;
DEBUG_LOG(DSPHLE, "%08x : AXLIST CompressorTable address: %08x", uAddress, Addr__A);
break;
case 0x000e:
Addr__AXOutSBuffer_1 = Memory_Read_U32(uAddress);
uAddress += 4;
case 0x000e:
Addr__AXOutSBuffer_1 = Memory_Read_U32(uAddress);
uAddress += 4;
// Addr__AXOutSBuffer_2 is the address in RAM that we are supposed to mix to.
// Although we don't, currently.
Addr__AXOutSBuffer_2 = Memory_Read_U32(uAddress);
uAddress += 4;
SaveLog("%08x : AXLIST sbuf2 addresses: %08x %08x", uAddress, Addr__AXOutSBuffer_1, Addr__AXOutSBuffer_2);
break;
Addr__AXOutSBuffer_2 = Memory_Read_U32(uAddress);
uAddress += 4;
DEBUG_LOG(DSPHLE, "%08x : AXLIST sbuf2 addresses: %08x %08x", uAddress, Addr__AXOutSBuffer_1, Addr__AXOutSBuffer_2);
break;
case AXLIST_END:
bExecuteList = false;
SaveLog("%08x : AXLIST end", uAddress);
break;
case AXLIST_END:
bExecuteList = false;
DEBUG_LOG(DSPHLE, "%08x : AXLIST end", uAddress);
break;
case 0x0010: //Super Monkey Ball 2
SaveLog("%08x : AXLIST 0x0010", uAddress);
//should probably read/skip stuff here
uAddress += 8;
break;
case 0x0010: //Super Monkey Ball 2
DEBUG_LOG(DSPHLE, "%08x : AXLIST 0x0010", uAddress);
//should probably read/skip stuff here
uAddress += 8;
break;
case 0x0011:
uAddress += 4;
break;
case 0x0011:
uAddress += 4;
break;
case 0x0012:
Addr__12 = Memory_Read_U16(uAddress);
uAddress += 2;
break;
case 0x0012:
Addr__12 = Memory_Read_U16(uAddress);
uAddress += 2;
break;
case 0x0013:
uAddress += 6 * 4; // 6 Addresses.
break;
case 0x0013:
uAddress += 6 * 4; // 6 Addresses.
break;
default:
{
static bool bFirst = true;
if (bFirst == true)
{
char szTemp[2048];
sprintf(szTemp, "Unknown AX-Command 0x%x (address: 0x%08x). Last valid: %02x\n",
iCommand, uAddress - 2, last_valid_command);
int num = -32;
while (num < 64+32)
{
char szTemp2[128] = "";
sprintf(szTemp2, "%s0x%04x\n", num == 0 ? ">>" : " ", Memory_Read_U16(uAddress + num));
strcat(szTemp, szTemp2);
num += 2;
}
static bool bFirst = true;
if (bFirst == true)
{
char szTemp[2048];
sprintf(szTemp, "Unknown AX-Command 0x%x (address: 0x%08x). Last valid: %02x\n",
iCommand, uAddress - 2, last_valid_command);
int num = -32;
while (num < 64+32)
{
char szTemp2[128] = "";
sprintf(szTemp2, "%s0x%04x\n", num == 0 ? ">>" : " ", Memory_Read_U16(uAddress + num));
strcat(szTemp, szTemp2);
num += 2;
}
// Wii AX will always show this
PanicAlert(szTemp);
// bFirst = false;
}
PanicAlert(szTemp);
// bFirst = false;
}
// unknown command so stop the execution of this TaskList
bExecuteList = false;
// unknown command so stop the execution of this TaskList
bExecuteList = false;
}
break;
}
if (bExecuteList)
last_valid_command = iCommand;
}
SaveLog("AXTask - done, send resume");
SaveLog("=====================================================================");
SaveLog("End");
DEBUG_LOG(DSPHLE, "AXTask - done, send resume");
DEBUG_LOG(DSPHLE, "=====================================================================");
DEBUG_LOG(DSPHLE, "End");
// i hope resume is okay AX
m_rMailHandler.PushMail(0xDCD10002);
m_rMailHandler.PushMail(DSP_YIELD);
return true;
}