Added mail viewer to the HLE DSP plugin. Use it by selecting Mail > Scan mails in the sound debugger.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1109 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2008-11-10 10:32:18 +00:00
parent 6492b21367
commit 814aa547ac
14 changed files with 831 additions and 135 deletions
+15
View File
@@ -73,6 +73,7 @@ namespace Core
void Callback_VideoLog(const TCHAR* _szMessage, BOOL _bDoBreak);
void Callback_VideoCopiedToXFB();
void Callback_DSPLog(const TCHAR* _szMessage);
char * Callback_ISOName(void);
void Callback_DSPInterrupt();
void Callback_PADLog(const TCHAR* _szMessage);
void Callback_WiimoteLog(const TCHAR* _szMessage);
@@ -291,6 +292,7 @@ THREAD_RETURN EmuThread(void *pArg)
dspInit.pGetARAMPointer = DSP::GetARAMPtr;
dspInit.pGetMemoryPointer = Memory::GetPointer;
dspInit.pLog = Callback_DSPLog;
dspInit.pName = Callback_ISOName;
dspInit.pDebuggerBreak = Callback_DebuggerBreak;
dspInit.pGenerateDSPInterrupt = Callback_DSPInterrupt;
dspInit.pGetAudioStreaming = AudioInterface::Callback_GetStreaming;
@@ -556,7 +558,20 @@ void Callback_PADLog(const TCHAR* _szMessage)
LOG(SERIALINTERFACE, _szMessage);
}
// __________________________________________________________________________________________________
// Callback_ISOName: Let the DSP plugin get the game name
//
//std::string Callback_ISOName(void)
char * Callback_ISOName(void)
{
char * a = "";
if(g_CoreStartupParameter.m_strName.length() > 0)
return (char *)g_CoreStartupParameter.m_strName.c_str();
else
return a;
}
// __________________________________________________________________________________________________
// Called from ANY thread!
void Callback_KeyPress(int key, BOOL shift, BOOL control)
{
+1
View File
@@ -73,6 +73,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBios _BootBios)
PanicAlert("Your GCM/ISO file seems to be invalid, or not a GC/Wii ISO.");
return false;
}
m_strName = pVolume->GetName();
m_strUniqueID = pVolume->GetUniqueID();
bWii = DiscIO::IsVolumeWiiDisc(pVolume);
+1
View File
@@ -92,6 +92,7 @@ struct SCoreStartupParameter
std::string m_strDefaultGCM;
std::string m_strDVDRoot;
std::string m_strUniqueID;
std::string m_strName;
//
SCoreStartupParameter();
+2 -1
View File
@@ -6,13 +6,13 @@
#define _DSP_H_INCLUDED__
#include "PluginSpecs.h"
#include "ExportProlog.h"
typedef unsigned char (*TARAM_Read_U8)(const unsigned int _uAddress);
typedef unsigned char* (*TGetMemoryPointer)(const unsigned int _uAddress);
typedef unsigned char* (*TGetARAMPointer)(void);
typedef void (*TLog)(const char* _szMessage);
typedef char * (*TName)(void);
typedef void (*TDebuggerBreak)(void);
typedef void (*TGenerateDSPInt)(void);
typedef unsigned int(*TAudioGetStreaming)(short* _pDestBuffer, unsigned int _numSamples);
@@ -24,6 +24,7 @@ typedef struct
TGetMemoryPointer pGetMemoryPointer;
TGetARAMPointer pGetARAMPointer;
TLog pLog;
TName pName;
TDebuggerBreak pDebuggerBreak;
TGenerateDSPInt pGenerateDSPInterrupt;
TAudioGetStreaming pGetAudioStreaming;
File diff suppressed because it is too large Load Diff
@@ -22,6 +22,9 @@
#ifndef __CDebugger_h__
#define __CDebugger_h__
// general things
#include <iostream>
#include <vector>
// wx stuff, I'm not sure if we use all these
#ifndef WX_PRECOMP
@@ -35,8 +38,10 @@
#include <wx/stattext.h>
#include <wx/statbox.h>
#include <wx/statbmp.h>
#include <wx/datetime.h> // for the timestamps
#include <wx/sizer.h>
#include <wx/notebook.h>
#include <wx/filepicker.h>
#include <wx/listctrl.h>
#include <wx/imaglist.h>
@@ -46,9 +51,8 @@
class CPBView;
class IniFile;
// Window settings - I'm not sure what these do. I just copied them gtom elsewhere basically.
// Window settings
#undef CDebugger_STYLE
#define CDebugger_STYLE wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE
class CDebugger : public wxDialog
@@ -82,17 +86,53 @@ class CDebugger : public wxDialog
void OnSettingsCheck(wxCommandEvent& event); // settings
CPBView* m_GPRListView;
// ============== Mail
void DoUpdateMail();
void UpdateMail(wxNotebookEvent& event);
void ChangeMail(wxCommandEvent& event);
void ReadDir();
bool NoDuplicate(std::string FileName);
void OnGameChange(wxCommandEvent& event);
void MailSettings(wxCommandEvent& event);
void Readfile(std::string FileName, bool GC);
std::string Readfile_(std::string FileName);
int CountFiles(std::string FileName);
CPBView* m_GPRListView;
std::vector<std::string> sMail, sMailEnd, sFullMail;
wxRadioBox *m_RadioBox[4];
bool gSaveFile; // main options
bool gOnlyLooping;
int gUpdFreq;// main update freq.
bool gPreset; // main presets
bool gSSBM; // main settings
bool gSSBMremedy1;
bool gSSBMremedy2;
bool gSequenced;
bool gVolume;
bool gReset;
bool ScanMails; // mail settings
bool StoreMails;
private:
// declarations
wxNotebook *m_Notebook; // notebook
wxPanel *m_PageMain;
wxPanel *m_PageMail;
wxTextCtrl * m_log, * m_log1; // mail
wxCheckBox *m_Check[9];
wxRadioButton *m_Radio[5];
wxRadioBox *m_RadioBox[3];
wxCheckListBox * m_settings;
wxCheckListBox * m_settings, * m_gc, * m_wii, * m_gcwiiset;
wxPanel *m_Controller;
std::vector<std::string> all_all_files, all_files, gc_files, wii_files;
// WARNING: Make sure these are not also elsewhere, for example in resource.h.
enum
{
@@ -101,17 +141,18 @@ class CDebugger : public wxDialog
IDC_CHECK2,
IDC_CHECK3,
IDC_CHECK4,
IDC_CHECKLIST1,
IDC_RADIO0,
IDC_RADIO1,
IDC_RADIO2,
IDC_RADIO3,
IDG_LABEL1,
IDG_LABEL2,
IDC_CHECKLIST1, IDC_CHECKLIST2, IDC_CHECKLIST3, IDC_CHECKLIST4,
IDC_RADIO0, IDC_RADIO1, IDC_RADIO2, IDC_RADIO3,
IDG_LABEL1, IDG_LABEL2,
ID_UPD,
ID_SELC,
ID_PRESETS,
ID_GPR,
ID_NOTEBOOK, // notebook
ID_PAGEMAIN,
ID_PAGEMAIL,
ID_LOG, // mails
ID_LOG1,
ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values
};
+19 -1
View File
@@ -1,3 +1,20 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include <stdarg.h>
#include <stdio.h>
@@ -11,7 +28,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
//if(strncmp (_fmt, "AX", 2)) // match = 0, in that case this is ignored
if(true)
{
char Msg[512];
va_list ap;
@@ -23,7 +23,6 @@
// Includes
#include <iostream>
#include <vector>
#include <string> // so that we can test std::string == abc
@@ -44,18 +43,11 @@
// Externals
u32 gLastBlock;
extern int nFiles;
float ratioFactor; // a global to get the ratio factor from MixAdd
int gUpdFreq = 5;
int gPreset = 0;
extern bool gSSBM;
extern bool gSSBMremedy1;
extern bool gSSBMremedy2;
extern bool gSequenced;
extern bool gVolume;
extern bool gReset;
bool gOnlyLooping = false;
extern int gSaveFile;
extern CDebugger* m_frame;
// Parameter blocks
@@ -292,7 +284,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
// Prepare conditions
// --------------
bool Conditions;
if (gOnlyLooping)
if (m_frame->gOnlyLooping)
{
Conditions = PBs[i].audio_addr.looping;
}
@@ -404,7 +396,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 (gUpdFreq > 0 && j > (200/gUpdFreq))
if (m_frame->gUpdFreq > 0 && j > (200/m_frame->gUpdFreq))
{
// =======================================================================================
@@ -480,7 +472,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
// --------------
char buffer [1000] = "";
std::string sbuff;
sbuff = writeTitle(gPreset);
sbuff = writeTitle(m_frame->gPreset);
// ==============
@@ -492,7 +484,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
// Prepare conditions. TODO: We use this in two places now, make it only one
// --------------
bool Conditions;
if (gOnlyLooping)
if (m_frame->gOnlyLooping)
{
Conditions = PBs[i].audio_addr.looping;
}
@@ -582,7 +574,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
}
// add new line
sbuff = sbuff + writeMessage(gPreset, i); strcpy(buffer, "");
sbuff = sbuff + writeMessage(m_frame->gPreset, i); strcpy(buffer, "");
sbuff = sbuff + "\n";
@@ -595,7 +587,8 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
// =======================================================================================
// Write global values
// ---------------
sprintf(buffer, "\nThe parameter blocks span from %08x", m_addressPBs);
sprintf(buffer, "\nThe parameter blocks span from %08x to %08x | distance %i | num. of blocks %i | _iSize %i\n",
m_addressPBs, gLastBlock, (gLastBlock-m_addressPBs), (gLastBlock-m_addressPBs) / 192, _iSize);
sbuff = sbuff + buffer; strcpy(buffer, "");
// ===============
@@ -604,7 +597,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\nSequenced %i | Volume %i | Reset %i | Only looping %i | Save file %i\n",
gSSBM, gSSBMremedy1, gSSBMremedy2, gSequenced, gVolume, gReset, gOnlyLooping, gSaveFile);
m_frame->gSSBM, m_frame->gSSBMremedy1, m_frame->gSSBMremedy2, m_frame->gSequenced,
m_frame->gVolume, m_frame->gReset, m_frame->gOnlyLooping, m_frame->gSaveFile);
sbuff = sbuff + buffer; strcpy(buffer, "");
// ===============
@@ -15,6 +15,7 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "FileUtil.h" // for IsDirectory
#include "../Debugger/Debugger.h"
#include "../Logging/Console.h" // for aprintf
@@ -29,19 +30,17 @@
#include "UCode_AX.h"
#include "UCode_AX_Voice.h"
// ---------------------------------------------------------------------------------------
// ------------------------------------------------------------------
// Externals
// -----------
extern float ratioFactor;
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 u32 gLastBlock;
extern std::string gpName;
extern CDebugger* m_frame;
std::vector<std::string> sMailLog, sMailTime;
// -----------
CUCode_AX::CUCode_AX(CMailHandler& _rMailHandler)
: IUCode(_rMailHandler)
, m_addressPBs(0xFFFFFFFF)
@@ -61,17 +60,183 @@ CUCode_AX::~CUCode_AX()
delete [] temprbuffer;
}
void CUCode_AX::HandleMail(u32 _uMail)
// ============================================
// Save file to harddrive
// ----------------
void CUCode_AX::SaveLogFile(std::string f, int resizeTo, bool type, bool Wii)
{
if ((_uMail & 0xFFFF0000) == MAIL_AX_ALIST)
if (!File::IsDirectory("Logs/Mail")) File::CreateDir("Logs/Mail");
char ci[10]; itoa(resizeTo - 1, ci, 10); // write ci
char cType[10]; itoa(type, cType, 10); // write cType
std::string FileName = "Logs/Mail/"; FileName += gpName;
FileName += "_sep"; FileName += ci; FileName += "_sep"; FileName += cType;
FileName += Wii ? "_sepWii_sep" : "_sepGC_sep"; FileName += ".log";
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, ...)
{
if(m_frame->ScanMails)
{
char Msg[512*10];
va_list ap;
va_start(ap, _fmt);
vsprintf(Msg, _fmt, ap);
va_end(ap);
//wxMessageBox( wxString::Format("SaveLog_ again: %s\n", Msg) );
if(strcmp(Msg, "Begin") == 0)
{
// a new List
TmpMailLog = "";
}
else if(strcmp(Msg, "End") == 0)
{
if(saveNext && saveNext < 100) // limit because saveNext is not initialized
{
//wprintf("End");
// Save the timestamps and comment
char ci[10]; itoa(saveNext - 1, ci, 10); // write ci
TmpMailLog += "\n\n";
TmpMailLog += "-----------------------------------------------------------------------\n";
TmpMailLog += "Current mail: " + gpName + " mail " + ci + "\n\n";
for (int 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_frame->StoreMails)
{
SaveLogFile(TmpMailLog, saveNext, 1, Wii);
}
m_frame->DoUpdateMail(); // update the view
saveNext = 0;
}
}
else
{
AXTask(_uMail);
TmpMailLog += Msg;
TmpMailLog += "\n";
g_dspInitialize.pLog(Msg);
}
}
}
// ----------------
// ============================================
// Save the whole AX mail
// ----------------
void CUCode_AX::SaveMail(bool Wii, u32 _uMail)
{
if(m_frame->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
int addnew = 0;
for (int i = 0; i < m_frame->sMail.size(); i++)
{
if(m_frame->sMail.at(i).length() != sTemp.length())
{
//wxMessageBox( wxString::Format("%s \n\n%s", m_frame->sMail.at(i).c_str(),
// sTemp.c_str()) );
addnew++;
}
}
// In case the mail didn't match any saved mail, save it
if(addnew == m_frame->sMail.size())
{
//wprintf("%i | %i\n", addnew, m_frame->sMail.size());
int resizeTo = m_frame->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_frame->sMail.push_back(sTemp); // save the main comparison mail
std::string lMail = sTemp + "------------------\n" + sTempEnd;
m_frame->sFullMail.push_back(lMail);
// enable the radio button and update view
if(resizeTo <= m_frame->m_RadioBox[3]->GetCount())
{
m_frame->m_RadioBox[3]->Enable(resizeTo - 1, true);
m_frame->m_RadioBox[3]->Select(resizeTo - 1);
}
addnew = 0;
saveNext = resizeTo; // save the log to
// ------------------------------------
// Save as file
if(m_frame->StoreMails)
{
//wprintf("m_frame->sMail.size(): %i | resizeTo:%i\n", m_frame->sMail.size(), resizeTo);
SaveLogFile(lMail, resizeTo, 0, Wii);
}
}
sTemp = "";
sTempEnd = "";
}
}
// ----------------
void DoVoiceHacks(AXParamBlock &pb)
{
@@ -83,8 +248,7 @@ void DoVoiceHacks(AXParamBlock &pb)
const u16 upddata = Memory_Read_U16(updaddr + 2);
// =======================================================================================
/*
Fix problems introduced with the SSBM fix - Sometimes when a music stream ended sampleEnd
/* Fix problems introduced with the SSBM fix - Sometimes when a music stream ended sampleEnd
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 and other) also had one odd last block with a strange high loopPos and strange
@@ -93,7 +257,7 @@ void DoVoiceHacks(AXParamBlock &pb)
// ------------
if (
(sampleEnd > 0x10000000 || loopPos > 0x10000000)
&& gSSBMremedy1
&& m_frame->gSSBMremedy1
)
{
pb.running = 0;
@@ -132,7 +296,7 @@ void DoVoiceHacks(AXParamBlock &pb)
&& pb.mixer_control == 0 // only use this in SSBM
&& gSSBMremedy2 // let us turn this fix on and off
&& m_frame->gSSBMremedy2 // let us turn this fix on and off
)
{
// reset the detection values
@@ -154,7 +318,7 @@ void DoVoiceHacks(AXParamBlock &pb)
// =======================================================================================
// Reset all values
// ------------
if (gReset
if (m_frame->gReset
&& (pb.running || pb.audio_addr.looping || pb.adpcm_loop_info.pred_scale)
)
{
@@ -188,6 +352,10 @@ int ReadOutPBs(u32 pbs_address, AXParamBlock* _pPBs, int _num)
for (size_t p = 0; p < sizeof(AXParamBlock) / 2; p++)
{
pDest[p] = Common::swap16(pSrc[p]);
#if defined(_DEBUG) || defined(DEBUGFAST)
gLastBlock = blockAddr + p*2 + 2; // save last block location
#endif
}
blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo;
count++;
@@ -257,7 +425,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
// 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
&& m_frame->gSequenced) // on and off option
{
pDest[updpar] = upddata;
}
@@ -296,6 +464,28 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
}
// ------------------------------------------------------------------------------
// Handle incoming mail
// -----------
void CUCode_AX::HandleMail(u32 _uMail)
{
if ((_uMail & 0xFFFF0000) == MAIL_AX_ALIST)
{
// a new List
DebugLog(" >>>> u32 MAIL : General Mail (%08x)", _uMail);
}
else
{
DebugLog(" >>>> u32 MAIL : AXTask Mail (%08x)", _uMail);
AXTask(_uMail);
}
}
// ------------------------------------------------------------------------------
// Update with DSP Interrupt
// -----------
void CUCode_AX::Update()
{
// check if we have to sent something
@@ -304,14 +494,23 @@ void CUCode_AX::Update()
g_dspInitialize.pGenerateDSPInterrupt();
}
}
// -----------
// Shortcut
void CUCode_AX::SaveLog(const char* _fmt, ...) { if(m_frame) SaveLog_(false, _fmt); }
// ============================================
// AX seems to bootup one task only and waits for resume-callbacks
// everytime the DSP has "spare time" it sends a resume-mail to the CPU
// and the __DSPHandler calls a AX-Callback which generates a new AXFrame
bool CUCode_AX::AXTask(u32& _uMail)
{
u32 uAddress = _uMail;
DebugLog("AXTask - AXCommandList-Addr: 0x%08x", uAddress);
SaveLog("Begin");
SaveLog("=====================================================================");
SaveLog("%08x : AXTask - AXCommandList-Addr:", uAddress);
u32 Addr__AXStudio;
u32 Addr__AXOutSBuffer;
@@ -330,6 +529,8 @@ bool CUCode_AX::AXTask(u32& _uMail)
bool bExecuteList = true;
if(m_frame) SaveMail(false, _uMail); // Save mail for debugging
while (bExecuteList)
{
static int last_valid_command = 0;
@@ -340,7 +541,7 @@ bool CUCode_AX::AXTask(u32& _uMail)
case AXLIST_STUDIOADDR: //00
Addr__AXStudio = Memory_Read_U32(uAddress);
uAddress += 4;
DebugLog("AXLIST studio address: %08x", Addr__AXStudio);
SaveLog("%08x : AXLIST studio address: %08x", uAddress, Addr__AXStudio);
break;
case 0x001: // 2byte x 10
@@ -353,7 +554,7 @@ bool CUCode_AX::AXTask(u32& _uMail)
uAddress += 2;
u16 param3 = Memory_Read_U16(uAddress);
uAddress += 2;
DebugLog("AXLIST 1: %08x, %04x, %04x, %04x", address, param1, param2, param3);
SaveLog("%08x : AXLIST 1: %08x, %04x, %04x, %04x", uAddress, address, param1, param2, param3);
}
break;
@@ -368,16 +569,16 @@ bool CUCode_AX::AXTask(u32& _uMail)
uAddress += 4;
mixer_HLEready = true;
DebugLog("AXLIST PB address: %08x", m_addressPBs);
SaveLog("%08x : AXLIST PB address: %08x", uAddress, m_addressPBs);
#ifdef _WIN32
DebugLog("Update the SoundThread to be in sync");
SaveLog("Update the SoundThread to be in sync");
DSound::DSound_UpdateSound(); //do it in this thread to avoid sync problems
#endif
}
break;
case 0x0003:
DebugLog("AXLIST command 0x0003 ????");
SaveLog("%08x : AXLIST command 0x0003 ????");
break;
case 0x0004: // AUX?
@@ -385,7 +586,7 @@ bool CUCode_AX::AXTask(u32& _uMail)
uAddress += 4;
Addr__4_2 = Memory_Read_U32(uAddress);
uAddress += 4;
DebugLog("AXLIST 4_1 4_2 addresses: %08x %08x", Addr__4_1, Addr__4_2);
SaveLog("%08x : AXLIST 4_1 4_2 addresses: %08x %08x", uAddress, Addr__4_1, Addr__4_2);
break;
case 0x0005:
@@ -393,31 +594,31 @@ bool CUCode_AX::AXTask(u32& _uMail)
uAddress += 4;
Addr__5_2 = Memory_Read_U32(uAddress);
uAddress += 4;
DebugLog("AXLIST 5_1 5_2 addresses: %08x %08x", Addr__5_1, Addr__5_2);
SaveLog("%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;
DebugLog("AXLIST 6 address: %08x", Addr__6);
SaveLog("%08x : AXLIST 6 address: %08x", uAddress, Addr__6);
break;
case AXLIST_SBUFFER:
Addr__AXOutSBuffer = Memory_Read_U32(uAddress);
uAddress += 4;
DebugLog("AXLIST OutSBuffer address: %08x", Addr__AXOutSBuffer);
SaveLog("%08x : AXLIST OutSBuffer address: %08x", uAddress, Addr__AXOutSBuffer);
break;
case 0x0009:
Addr__9 = Memory_Read_U32(uAddress);
uAddress += 4;
DebugLog("AXLIST 6 address: %08x", Addr__9);
SaveLog("%08x : AXLIST 6 address: %08x", Addr__9);
break;
case AXLIST_COMPRESSORTABLE: // 0xa
Addr__A = Memory_Read_U32(uAddress);
uAddress += 4;
DebugLog("AXLIST CompressorTable address: %08x", Addr__A);
SaveLog("%08x : AXLIST CompressorTable address: %08x", uAddress, Addr__A);
break;
case 0x000e:
@@ -428,16 +629,16 @@ bool CUCode_AX::AXTask(u32& _uMail)
// Although we don't, currently.
Addr__AXOutSBuffer_2 = Memory_Read_U32(uAddress);
uAddress += 4;
DebugLog("AXLIST sbuf2 addresses: %08x %08x", Addr__AXOutSBuffer_1, Addr__AXOutSBuffer_2);
SaveLog("%08x : AXLIST sbuf2 addresses: %08x %08x", uAddress, Addr__AXOutSBuffer_1, Addr__AXOutSBuffer_2);
break;
case AXLIST_END:
bExecuteList = false;
DebugLog("AXLIST end");
SaveLog("%08x : AXLIST end", uAddress);
break;
case 0x0010: //Super Monkey Ball 2
DebugLog("AXLIST unknown");
SaveLog("%08x : AXLIST 0x0010", uAddress);
//should probably read/skip stuff here
uAddress += 8;
break;
@@ -485,7 +686,9 @@ bool CUCode_AX::AXTask(u32& _uMail)
if (bExecuteList)
last_valid_command = iCommand;
}
DebugLog("AXTask - done, send resume");
SaveLog("AXTask - done, send resume");
SaveLog("=====================================================================");
SaveLog("End");
// i hope resume is okay AX
m_rMailHandler.PushMail(0xDCD10001);
@@ -18,6 +18,7 @@
#ifndef _UCODE_AX
#define _UCODE_AX
#include <iostream>
#include "UCode_AXStructs.h"
enum
@@ -35,8 +36,16 @@ public:
void MixAdd(short* _pBuffer, int _iSize);
void Update();
// this is a little ugly perhaps, feel free to move it out of here
// Logging
void Logging(short* _pBuffer, int _iSize, int a);
void SaveLog_(bool Wii, const char* _fmt, ...);
void SaveMail(bool Wii, u32 _uMail);
void SaveLogFile(std::string f, int resizeTo, bool type, bool Wii);
std::string TmpMailLog;
int saveNext;
// PBs
u32 m_addressPBs;
private:
enum
@@ -49,14 +58,12 @@ private:
AXLIST_END = 0x000F
};
// PBs
u32 m_addressPBs;
int *templbuffer;
int *temprbuffer;
// ax task message handler
bool AXTask(u32& _uMail);
void SaveLog(const char* _fmt, ...);
void SendMail(u32 _uMail);
};
@@ -26,9 +26,19 @@
#include "UCodes.h"
#include "UCode_AXStructs.h"
#include "UCode_AX.h" // for some functions in CUCode_AX
#include "UCode_AXWii.h"
#include "UCode_AX_Voice.h"
// ------------------------------------------------------------------
// Declarations
// -----------
extern u32 gLastBlock;
extern CDebugger * m_frame;
// -----------
CUCode_AXWii::CUCode_AXWii(CMailHandler& _rMailHandler)
: IUCode(_rMailHandler)
, m_addressPBs(0xFFFFFFFF)
@@ -39,6 +49,8 @@ CUCode_AXWii::CUCode_AXWii(CMailHandler& _rMailHandler)
templbuffer = new int[1024 * 1024];
temprbuffer = new int[1024 * 1024];
lCUCode_AX = new CUCode_AX(_rMailHandler);
}
CUCode_AXWii::~CUCode_AXWii()
@@ -75,6 +87,10 @@ int ReadOutPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num)
for (size_t p = 0; p < sizeof(AXParamBlock) / 2; p++)
{
pDest[p] = Common::swap16(pSrc[p]);
#if defined(_DEBUG) || defined(DEBUGFAST)
gLastBlock = blockAddr + p*2 + 2; // save last block location
#endif
}
blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo;
count++;
@@ -120,9 +136,9 @@ void CUCode_AXWii::MixAdd(short* _pBuffer, int _iSize)
memset(temprbuffer, 0, _iSize * sizeof(int));
// write logging data to debugger
//if (m_frame)
if (m_frame)
{
// CUCode_AXWii::Logging(_pBuffer, _iSize, 0);
lCUCode_AX->Logging(_pBuffer, _iSize, 0);
}
// ---------------------------------------------------------------------------------------
@@ -192,13 +208,19 @@ void CUCode_AXWii::Update()
}
}
// Shortcut
void CUCode_AXWii::SaveLog(const char* _fmt, ...) { if(m_frame) lCUCode_AX->SaveLog_(true, _fmt); }
// AX seems to bootup one task only and waits for resume-callbacks
// everytime the DSP has "spare time" it sends a resume-mail to the CPU
// and the __DSPHandler calls a AX-Callback which generates a new AXFrame
bool CUCode_AXWii::AXTask(u32& _uMail)
{
u32 uAddress = _uMail;
DebugLog("AXTask - AXCommandList-Addr: 0x%08x", uAddress);
SaveLog("Begin");
SaveLog("=====================================================================");
SaveLog("%08x: AXTask - AXCommandList-Addr", uAddress);
u32 Addr__AXStudio;
u32 Addr__AXOutSBuffer;
@@ -213,6 +235,8 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
bool bExecuteList = true;
if(m_frame) lCUCode_AX->SaveMail(true, uAddress); // Save mail for debugging
if (false)
{
// PanicAlert("%i", sizeof(AXParamBlockWii)); // 252 ??
@@ -242,14 +266,14 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
case 0x0000: //00
Addr__AXStudio = Memory_Read_U32(uAddress);
uAddress += 4;
DebugLog("AXLIST studio address: %08x", Addr__AXStudio);
SaveLog("%08x : AXLIST studio address: %08x", uAddress, Addr__AXStudio);
break;
case 0x0001:
{
u32 address = Memory_Read_U32(uAddress);
uAddress += 4;
DebugLog("AXLIST 1: %08x", address);
SaveLog("%08x : AXLIST 1: %08x", uAddress, address);
}
break;
@@ -257,14 +281,15 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
{
u32 address = Memory_Read_U32(uAddress);
uAddress += 4;
DebugLog("AXLIST 3: %08x", address);
SaveLog("%08x : AXLIST 3: %08x", uAddress, address);
}
break;
case 0x0004: // PBs are here now
m_addressPBs = Memory_Read_U32(uAddress);
lCUCode_AX->m_addressPBs = m_addressPBs; // for the sake of logging
mixer_HLEready = true;
DebugLog("AXLIST PB address: %08x", m_addressPBs);
SaveLog("%08x : AXLIST PB address: %08x", uAddress, m_addressPBs);
#ifdef _WIN32
DebugLog("Update the SoundThread to be in sync");
DSound::DSound_UpdateSound(); //do it in this thread to avoid sync problems
@@ -279,13 +304,13 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
uAddress += 4;
uAddress += 2;
DebugLog("AXLIST 5_1 5_2 addresses: %08x %08x", Addr__5_1, Addr__5_2);
SaveLog("%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 += 10;
DebugLog("AXLIST 6 address: %08x", Addr__6);
SaveLog("%08x : AXLIST 6 address: %08x", uAddress, Addr__6);
break;
/* case 0x0007: // AXLIST_SBUFFER
@@ -306,7 +331,7 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
uAddress += 4;
//Addr__A = Memory_Read_U32(uAddress);
uAddress += 4;
DebugLog("AXLIST CompressorTable address: %08x", Addr__A);
SaveLog("%08x : AXLIST CompressorTable address: %08x", uAddress, Addr__A);
break;
case 0x000b:
@@ -326,7 +351,7 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
case 0x000e:
// This is the end.
bExecuteList = false;
DebugLog("AXLIST end, wii stylee.");
SaveLog("%08x : AXLIST end, wii stylee.", uAddress);
break;
default:
@@ -359,7 +384,9 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
if (bExecuteList)
last_valid_command = iCommand;
}
DebugLog("AXTask - done, send resume");
SaveLog("AXTask - done, send resume");
SaveLog("=====================================================================");
SaveLog("End");
// i hope resume is okay AX
m_rMailHandler.PushMail(0xDCD10001);
@@ -34,6 +34,8 @@ public:
// this is a little ugly perhaps, feel free to move it out of here
void Logging(short* _pBuffer, int _iSize, int a);
CUCode_AX * lCUCode_AX; // we need the logging functions in there
private:
enum
@@ -49,6 +51,7 @@ private:
// ax task message handler
bool AXTask(u32& _uMail);
void SaveLog(const char* _fmt, ...);
void SendMail(u32 _uMail);
};
@@ -37,6 +37,8 @@
DSPInitialize g_dspInitialize;
u8* g_pMemory;
extern std::vector<std::string> sMailLog, sMailTime;
std::string gpName;
// Set this if you want to log audio. search for log_ai in this file to see the filename.
static bool log_ai = false;
@@ -197,6 +199,15 @@ void DSP_Initialize(DSPInitialize _dspInitialize)
g_pMemory = g_dspInitialize.pGetMemoryPointer(0);
gpName = g_dspInitialize.pName(); // save the game name globally
for (int i = 0; i < gpName.length(); ++i) // and fix it
{
wprintf("%c", gpName[i]);
std::cout << gpName[i];
if (gpName[i] == ':') gpName[i] = ' ';
}
wprintf("\n");
CDSPHandler::CreateInstance();
#ifdef _WIN32
@@ -227,6 +238,15 @@ void DSP_Shutdown()
AOSound::AOSound_StopSound();
#endif
CDSPHandler::Destroy();
// Reset mails
if(m_frame)
{
sMailLog.clear();
sMailTime.clear();
m_frame->sMail.clear();
m_frame->sMailEnd.clear();
}
}
void DSP_DoState(unsigned char **ptr, int mode) {
+1 -1
View File
@@ -66,7 +66,7 @@ bool AXTask(u32& _uMail);
bool bCanWork = false;
// Set this if you want to log audio. search for log_ai in this file to see the filename.
static bool log_ai = true;
static bool log_ai = false;
WaveFileWriter g_wave_writer;
// ==============