Made the debugger automatically get the PB address.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@751 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
cf5251331e
commit
b200cd9b73
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Version="9,00"
|
||||
Name="Plugin_DSP_LLE"
|
||||
ProjectGUID="{C60D0E7A-ED05-4C67-9EE7-3A6C0D7801C8}"
|
||||
RootNamespace="Plugin_DSP_LLE"
|
||||
|
@ -706,6 +706,10 @@
|
|||
<Filter
|
||||
Name="Logging"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Src\Logging\AXTask.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\Logging\Console.cpp"
|
||||
>
|
||||
|
|
|
@ -15,10 +15,13 @@
|
|||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <iostream> // I hope this doesn't break anything
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "Common.h" // for Common::swap
|
||||
#include "Globals.h"
|
||||
#include "gdsp_interpreter.h"
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
|
@ -27,17 +30,24 @@
|
|||
void DebugLog(const char* _fmt, ...)
|
||||
{
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
/* char Msg[512];
|
||||
char Msg[512];
|
||||
va_list ap;
|
||||
|
||||
va_start( ap, _fmt );
|
||||
vsprintf( Msg, _fmt, ap );
|
||||
va_end( ap );
|
||||
|
||||
OutputDebugString(Msg);
|
||||
// Only show certain messages
|
||||
std::string sMsg = Msg;
|
||||
if(sMsg.find("Mail") != -1 || sMsg.find("AX") != -1)
|
||||
// no match = -1
|
||||
{
|
||||
OutputDebugString(Msg);
|
||||
g_dspInitialize.pLog(Msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
g_dspInitialize.pLog(Msg);
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
// =============
|
||||
|
@ -61,3 +71,21 @@ void ErrorLog(const char* _fmt, ...)
|
|||
}
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// For PB address detection
|
||||
// --------------
|
||||
u32 RAM_MASK = 0x1FFFFFF;
|
||||
|
||||
|
||||
u16 Memory_Read_U16(u32 _uAddress)
|
||||
{
|
||||
_uAddress &= RAM_MASK;
|
||||
return Common::swap16(*(u16*)&g_dsp.cpu_ram[_uAddress]);
|
||||
}
|
||||
|
||||
u32 Memory_Read_U32(u32 _uAddress)
|
||||
{
|
||||
_uAddress &= RAM_MASK;
|
||||
return Common::swap32(*(u32*)&g_dsp.cpu_ram[_uAddress]);
|
||||
}
|
||||
// =============
|
|
@ -61,5 +61,8 @@ typedef signed long long sint64;
|
|||
|
||||
typedef const uint32 cuint32;
|
||||
|
||||
u16 Memory_Read_U16(u32 _uAddress); // For PB address detection
|
||||
u32 Memory_Read_U32(u32 _uAddress);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
#include "../Globals.h"
|
||||
#include "Common.h"
|
||||
|
||||
|
||||
extern u32 m_addressPBs;
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Get the parameter block location - Example SSBM: We get the addr 8049cf00, first we
|
||||
// always get 0 and go to AXLIST_STUDIOADDR, then we end up at AXLIST_PBADDR.
|
||||
// --------------
|
||||
bool AXTask(u32& _uMail)
|
||||
{
|
||||
u32 uAddress = _uMail;
|
||||
DebugLog("AXTask - ================================================================");
|
||||
DebugLog("AXTask - AXCommandList-Addr: 0x%08x", uAddress);
|
||||
|
||||
bool bExecuteList = true;
|
||||
|
||||
while (bExecuteList)
|
||||
{
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// SSBM: We get the addr 8049cf00, first we always get 0
|
||||
static int last_valid_command = 0;
|
||||
u16 iCommand = Memory_Read_U16(uAddress);
|
||||
uAddress += 2;
|
||||
// ---------------------------------------------------------------------------------------
|
||||
|
||||
switch (iCommand)
|
||||
{
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// ?
|
||||
case 0: // AXLIST_STUDIOADDR: //00
|
||||
{
|
||||
uAddress += 4;
|
||||
DebugLog("AXLIST AXLIST_SBUFFER: %08x", uAddress);
|
||||
}
|
||||
break;
|
||||
// ---------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
case 2: // AXLIST_PBADDR: // 02
|
||||
{
|
||||
m_addressPBs = Memory_Read_U32(uAddress);
|
||||
uAddress += 4;
|
||||
DebugLog("AXLIST PB address: %08x", m_addressPBs);
|
||||
bExecuteList = false;
|
||||
}
|
||||
break;
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
case 7: // AXLIST_SBUFFER: // 7
|
||||
{
|
||||
// Hopefully this is where in main ram to write.
|
||||
uAddress += 4;
|
||||
DebugLog("AXLIST AXLIST_SBUFFER: %08x", uAddress);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
default:
|
||||
{
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// Stop the execution of this TaskList
|
||||
DebugLog("AXLIST default: %08x", uAddress);
|
||||
bExecuteList = false;
|
||||
// ---------------------------------------------------------------------------------------
|
||||
}
|
||||
break;
|
||||
} // end of switch
|
||||
}
|
||||
|
||||
DebugLog("AXTask - done, send resume");
|
||||
DebugLog("AXTask - ================================================================");
|
||||
|
||||
// now resume
|
||||
return true;
|
||||
}
|
||||
// =======================================================================================
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ void ClearScreen();
|
|||
int wprintf(char *fmt, ...)
|
||||
{
|
||||
#ifdef DEBUGG
|
||||
char s[4000]; // WARNING: mind this value
|
||||
char s[6000]; // WARNING: mind this value
|
||||
va_list argptr;
|
||||
int cnt;
|
||||
|
||||
|
|
|
@ -22,12 +22,9 @@
|
|||
|
||||
|
||||
// =======================================================================================
|
||||
// TODO: make this automatic
|
||||
// Externals
|
||||
// --------------
|
||||
//u32 m_addressPBs = 0x804a1a60; // SSBM (PAL)
|
||||
//u32 m_addressPBs = 0x802798c0; // Baten
|
||||
//u32 m_addressPBs = 0x80576d20; // Symphonia
|
||||
u32 m_addressPBs = 0x80671d00; // Paper Mario
|
||||
u32 m_addressPBs = 0;
|
||||
// --------------
|
||||
extern u32 gLastBlock;
|
||||
// ==============
|
||||
|
|
|
@ -46,14 +46,23 @@
|
|||
|
||||
#include "ChunkFile.h"
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Globals
|
||||
// --------------
|
||||
DSPInitialize g_dspInitialize;
|
||||
|
||||
#define GDSP_MBOX_CPU 0
|
||||
#define GDSP_MBOX_DSP 1
|
||||
|
||||
|
||||
uint32 g_LastDMAAddress = 0;
|
||||
uint32 g_LastDMASize = 0;
|
||||
|
||||
extern u32 m_addressPBs;
|
||||
bool AXTask(u32& _uMail);
|
||||
// ==============
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
|
||||
DWORD dwReason, // reason called
|
||||
|
@ -331,7 +340,20 @@ void DSP_WriteMailboxLow(bool _CPUMailbox, u16 _uLowMail)
|
|||
{
|
||||
gdsp_mbox_write_l(GDSP_MBOX_CPU, _uLowMail);
|
||||
|
||||
DebugLog("Write CPU Mail: 0x%08x (pc=0x%04x)\n", gdsp_mbox_peek(GDSP_MBOX_CPU), g_dsp.err_pc);
|
||||
u32 uAddress = gdsp_mbox_peek(GDSP_MBOX_CPU);
|
||||
u16 errpc = g_dsp.err_pc;
|
||||
|
||||
DebugLog("Write CPU Mail: 0x%08x (pc=0x%04x)\n", uAddress, errpc);
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// I couldn't find any better way to detect the AX mails so this had to do. Please feel free
|
||||
// to change it.
|
||||
// --------------
|
||||
if ((errpc == 0x0054 || errpc == 0x0055) && m_addressPBs == 0)
|
||||
{
|
||||
DebugLog("AXTask ======== 0x%08x (pc=0x%04x)", uAddress, errpc);
|
||||
AXTask(uAddress);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue