mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
DSP: Add txt file with luigi ucode comments (very basic). Rename some stuff. Remove function pointer in g_dsp structure, replace with a "Host" function call. Fix a problem where symbols weren't loaded into DSP debugger.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3563 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -21,7 +21,7 @@
|
||||
#include "disassemble.h"
|
||||
|
||||
#include "DSPSymbols.h"
|
||||
#include "gdsp_memory.h"
|
||||
#include "DSPMemoryMap.h"
|
||||
|
||||
void DSPDebugInterface::disasm(unsigned int address, char *dest, int max_size)
|
||||
{
|
||||
|
@ -23,6 +23,14 @@
|
||||
|
||||
extern DSPInitialize g_dspInitialize;
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
|
||||
#include "DSPConfigDlgLLE.h"
|
||||
#include "Debugger/Debugger.h" // For the DSPDebuggerLLE class
|
||||
extern DSPDebuggerLLE* m_DebuggerFrame;
|
||||
|
||||
#endif
|
||||
|
||||
// The user of the DSPCore library must supply a few functions so that the
|
||||
// emulation core can access the environment it runs in. If the emulation
|
||||
// core isn't used, for example in an asm/disasm tool, then most of these
|
||||
@ -48,6 +56,12 @@ bool DSPHost_Running()
|
||||
return !(*g_dspInitialize.pEmulatorState);
|
||||
}
|
||||
|
||||
void DSPHost_InterruptRequest()
|
||||
{
|
||||
// Fire an interrupt on the PPC ASAP.
|
||||
g_dspInitialize.pGenerateDSPInterrupt();
|
||||
}
|
||||
|
||||
u32 DSPHost_CodeLoaded(const u8 *ptr, int size)
|
||||
{
|
||||
u32 crc = GenerateCRC(ptr, size);
|
||||
@ -68,13 +82,22 @@ u32 DSPHost_CodeLoaded(const u8 *ptr, int size)
|
||||
|
||||
// TODO: Don't hardcode for Zelda.
|
||||
NOTICE_LOG(DSPLLE, "CRC: %08x", ector_crc);
|
||||
if (ector_crc != 0x86840740 || !DSPSymbols::ReadAnnotatedAssembly("../../Docs/DSP/DSP_UC_Zelda.txt"))
|
||||
{
|
||||
DSPSymbols::Clear();
|
||||
|
||||
DSPSymbols::Clear();
|
||||
bool success = false;
|
||||
switch (ector_crc) {
|
||||
case 0x86840740: success = DSPSymbols::ReadAnnotatedAssembly("../../Docs/DSP/DSP_UC_Zelda.txt"); break;
|
||||
case 0x42f64ac4: success = DSPSymbols::ReadAnnotatedAssembly("../../Docs/DSP/DSP_UC_Luigi.txt"); break;
|
||||
default: success = false; break;
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
DSPSymbols::AutoDisassembly(0x0, 0x1000);
|
||||
}
|
||||
|
||||
// Always add the ROM.
|
||||
DSPSymbols::AutoDisassembly(0x8000, 0x9000);
|
||||
|
||||
m_DebuggerFrame->Refresh();
|
||||
return crc;
|
||||
}
|
@ -77,7 +77,7 @@ wxGridCellAttr *CRegTable::GetAttr(int row, int col, wxGridCellAttr::wxAttrKind)
|
||||
}
|
||||
|
||||
DSPRegisterView::DSPRegisterView(wxWindow *parent, wxWindowID id)
|
||||
: wxGrid(parent, id)
|
||||
: wxGrid(parent, id, wxDefaultPosition, wxSize(130, 120))
|
||||
{
|
||||
SetTable(new CRegTable(), true);
|
||||
SetRowLabelSize(0);
|
||||
|
@ -41,7 +41,6 @@ DSPDebuggerLLE::DSPDebuggerLLE(wxWindow *parent, wxWindowID id, const wxString &
|
||||
, m_CachedStepCounter(-1)
|
||||
, m_CachedCR(-1)
|
||||
, m_State(RUN)
|
||||
, m_CachedUCodeCRC(-1)
|
||||
{
|
||||
CreateGUIControls();
|
||||
}
|
||||
@ -64,31 +63,27 @@ void DSPDebuggerLLE::CreateGUIControls()
|
||||
m_Toolbar->AddTool(ID_JUMPTOTOOL, wxT("Jump"), wxNullBitmap, wxT("Jump to a specific Address"), wxITEM_NORMAL);
|
||||
m_Toolbar->AddSeparator();
|
||||
|
||||
m_Toolbar->AddCheckTool(ID_CHECK_ASSERTINT, wxT("AssertInt"), wxNullBitmap, wxNullBitmap, wxEmptyString);
|
||||
m_Toolbar->AddCheckTool(ID_CHECK_HALT, wxT("Halt"), wxNullBitmap, wxNullBitmap, wxEmptyString);
|
||||
m_Toolbar->AddCheckTool(ID_CHECK_INIT, wxT("Init"), wxNullBitmap, wxNullBitmap, wxEmptyString);
|
||||
m_Toolbar->AddSeparator();
|
||||
|
||||
m_Toolbar->AddControl(new wxTextCtrl(m_Toolbar, ID_ADDRBOX, _T("")));
|
||||
|
||||
m_Toolbar->Realize();
|
||||
|
||||
wxBoxSizer* sMain = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* sizerLeft = new wxBoxSizer(wxVERTICAL);
|
||||
sizerLeft->Add(m_SymbolList = new wxListBox(this, ID_SYMBOLLIST, wxDefaultPosition, wxSize(90, 100), 0, NULL, wxLB_SORT), 1, wxEXPAND);
|
||||
sizerLeft->Add(m_SymbolList = new wxListBox(this, ID_SYMBOLLIST, wxDefaultPosition, wxSize(140, 100), 0, NULL, wxLB_SORT),
|
||||
1, wxEXPAND);
|
||||
|
||||
m_CodeView = new CCodeView(&debug_interface, &DSPSymbols::g_dsp_symbol_db, this, ID_CODEVIEW);
|
||||
m_CodeView->SetPlain();
|
||||
|
||||
sMain->Add(sizerLeft, 1, wxALL|wxEXPAND, 0);
|
||||
sMain->Add(sizerLeft, 0, wxEXPAND, 0);
|
||||
|
||||
sMain->Add(m_CodeView, 4, wxALL|wxEXPAND, 5);
|
||||
sMain->Add(m_CodeView, 4, wxEXPAND, 0);
|
||||
|
||||
wxStaticLine* m_staticline = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL);
|
||||
sMain->Add(m_staticline, 0, wxEXPAND|wxALL, 5);
|
||||
sMain->Add(m_staticline, 0, wxEXPAND|wxALL, 0);
|
||||
|
||||
m_Regs = new DSPRegisterView(this, ID_DSP_REGS);
|
||||
sMain->Add(m_Regs, 1, wxEXPAND|wxALL, 5);
|
||||
sMain->Add(m_Regs, 0, wxEXPAND|wxALL, 5);
|
||||
|
||||
this->SetSizer(sMain);
|
||||
this->Layout();
|
||||
@ -165,28 +160,15 @@ void DSPDebuggerLLE::UpdateSymbolMap()
|
||||
if (g_dsp.dram == NULL)
|
||||
return;
|
||||
|
||||
if (m_CachedUCodeCRC != g_dsp.iram_crc)
|
||||
m_SymbolList->Freeze(); // HyperIris: wx style fast filling
|
||||
m_SymbolList->Clear();
|
||||
for (SymbolDB::XFuncMap::iterator iter = DSPSymbols::g_dsp_symbol_db.GetIterator();
|
||||
iter != DSPSymbols::g_dsp_symbol_db.End(); iter++)
|
||||
{
|
||||
// load symbol map (if there is one)
|
||||
m_CachedUCodeCRC = g_dsp.iram_crc;
|
||||
char FileName[256];
|
||||
sprintf(FileName, "%sDSP_%08x.map", FULL_MAPS_DIR, m_CachedUCodeCRC);
|
||||
|
||||
// LoadSymbolMap(FileName);
|
||||
|
||||
m_SymbolList->Freeze(); // HyperIris: wx style fast filling
|
||||
m_SymbolList->Clear();
|
||||
for (SymbolDB::XFuncMap::iterator iter = DSPSymbols::g_dsp_symbol_db.GetIterator();
|
||||
iter != DSPSymbols::g_dsp_symbol_db.End(); iter++)
|
||||
{
|
||||
int idx = m_SymbolList->Append(wxString::FromAscii(iter->second.name.c_str()));
|
||||
m_SymbolList->SetClientData(idx, (void*)&iter->second);
|
||||
}
|
||||
m_SymbolList->Thaw();
|
||||
|
||||
// rebuild the disasm
|
||||
// RebuildDisAsmListView();
|
||||
int idx = m_SymbolList->Append(wxString::FromAscii(iter->second.name.c_str()));
|
||||
m_SymbolList->SetClientData(idx, (void*)&iter->second);
|
||||
}
|
||||
m_SymbolList->Thaw();
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::OnSymbolListChange(wxCommandEvent& event)
|
||||
@ -209,9 +191,9 @@ void DSPDebuggerLLE::UpdateRegisterFlags()
|
||||
if (m_CachedCR == g_dsp.cr)
|
||||
return;
|
||||
|
||||
m_Toolbar->ToggleTool(ID_CHECK_ASSERTINT, g_dsp.cr & 0x02 ? true : false);
|
||||
m_Toolbar->ToggleTool(ID_CHECK_HALT, g_dsp.cr & 0x04 ? true : false);
|
||||
m_Toolbar->ToggleTool(ID_CHECK_INIT, g_dsp.cr & 0x800 ? true : false);
|
||||
// m_Toolbar->ToggleTool(ID_CHECK_ASSERTINT, g_dsp.cr & 0x02 ? true : false);
|
||||
// m_Toolbar->ToggleTool(ID_CHECK_HALT, g_dsp.cr & 0x04 ? true : false);
|
||||
// m_Toolbar->ToggleTool(ID_CHECK_INIT, g_dsp.cr & 0x800 ? true : false);
|
||||
|
||||
m_CachedCR = g_dsp.cr;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#include "disassemble.h"
|
||||
#include "gdsp_interpreter.h"
|
||||
#include "gdsp_memory.h"
|
||||
#include "DSPMemoryMap.h"
|
||||
#include "../DSPDebugInterface.h"
|
||||
|
||||
class DSPRegisterView;
|
||||
@ -107,7 +107,6 @@ private:
|
||||
DSPDebugInterface debug_interface;
|
||||
u64 m_CachedStepCounter;
|
||||
u16 m_CachedCR;
|
||||
u32 m_CachedUCodeCRC;
|
||||
|
||||
// GUI updaters
|
||||
void UpdateDisAsmListView();
|
||||
|
@ -26,18 +26,18 @@
|
||||
// =======================================================================================
|
||||
// For PB address detection
|
||||
// --------------
|
||||
|
||||
// This will only work on GC, not Wii.
|
||||
u32 RAM_MASK = 0x1FFFFFF;
|
||||
|
||||
u16 Memory_Read_U16(u32 _uAddress)
|
||||
{
|
||||
_uAddress &= RAM_MASK;
|
||||
return Common::swap16(*(u16*)&g_dsp.cpu_ram[_uAddress]);
|
||||
return Common::swap16(*(u16*)&g_dsp.cpu_ram[_uAddress & RAM_MASK]);
|
||||
}
|
||||
|
||||
u32 Memory_Read_U32(u32 _uAddress)
|
||||
{
|
||||
_uAddress &= RAM_MASK;
|
||||
return Common::swap32(*(u32*)&g_dsp.cpu_ram[_uAddress]);
|
||||
return Common::swap32(*(u32*)&g_dsp.cpu_ram[_uAddress & RAM_MASK]);
|
||||
}
|
||||
|
||||
#if PROFILE
|
||||
|
@ -193,13 +193,6 @@ void DSP_DebugBreak()
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void dspi_req_dsp_irq()
|
||||
{
|
||||
// Fire an interrupt on the PPC ASAP.
|
||||
g_dspInitialize.pGenerateDSPInterrupt();
|
||||
}
|
||||
|
||||
void Initialize(void *init)
|
||||
{
|
||||
bCanWork = true;
|
||||
@ -211,8 +204,6 @@ void Initialize(void *init)
|
||||
std::string coef_filename = File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + DSP_COEF;
|
||||
bCanWork = DSPCore_Init(irom_filename.c_str(), coef_filename.c_str());
|
||||
g_dsp.cpu_ram = g_dspInitialize.pGetMemoryPointer(0);
|
||||
g_dsp.irq_request = dspi_req_dsp_irq;
|
||||
// g_dsp.exception_in_progress_hack = false;
|
||||
DSPCore_Reset();
|
||||
|
||||
if (!bCanWork)
|
||||
|
Reference in New Issue
Block a user