git-svn-id: http://svn.purei.org/purei/trunk@422 b36208d7-6611-0410-8bec-b1987f11c4a2

This commit is contained in:
jpd002 2008-11-24 23:23:25 +00:00
parent fa611a85fa
commit 10e676922a
11 changed files with 102 additions and 13 deletions

View File

@ -11,6 +11,11 @@ public:
virtual void HandleInterrupt() = 0;
virtual void CountTicks(uint32) = 0;
#ifdef DEBUGGER_INCLUDED
virtual void SaveDebugTags(const char*) = 0;
virtual void LoadDebugTags(const char*) = 0;
#endif
private:
};

View File

@ -2,8 +2,11 @@
#include "PsfLoader.h"
#include "PlayerWnd.h"
#include "MiniDebugger.h"
#include <boost/filesystem/path.hpp>
using namespace Framework;
using namespace std;
namespace filesystem = boost::filesystem;
//int main(int argc, char** argv)
int WINAPI WinMain(HINSTANCE, HINSTANCE, char*, int)
@ -13,12 +16,15 @@ int WINAPI WinMain(HINSTANCE, HINSTANCE, char*, int)
#ifdef DEBUGGER_INCLUDED
{
virtualMachine.Reset();
// CPsfLoader::LoadPsf(virtualMachine, "C:\\Media\\PS2\\FFXI_psf2\\FFXI_psf2\\104 Ronfaure.psf2");
// CPsfLoader::LoadPsf(virtualMachine, "C:\\Media\\PS2\\FF4\\ff4-01.psf2");
CPsfLoader::LoadPsf(virtualMachine, "C:\\Media\\PS2\\FF10_psf\\102 In Zanarkand.minipsf2");
// filesystem::path loadPath("C:\\Media\\PS2\\Ys4_psf2\\13 - Blazing Sword.psf2", filesystem::native);
filesystem::path loadPath("C:\\Media\\PSX\\vp-psf\\vp-103.minipsf", filesystem::native);
CPsfLoader::LoadPsf(virtualMachine, loadPath.string().c_str());
string tagPackageName = loadPath.leaf();
virtualMachine.LoadDebugTags(tagPackageName.c_str());
CMiniDebugger debugger(virtualMachine, virtualMachine.GetDebugInfo());
debugger.Show(SW_SHOW);
debugger.Run();
virtualMachine.SaveDebugTags(tagPackageName.c_str());
}
#else
{

View File

@ -80,6 +80,7 @@ m_memoryView(NULL)
CMiniDebugger::~CMiniDebugger()
{
m_virtualMachine.Pause();
delete m_functionsView;
delete m_disAsmView;
delete m_registerView;

View File

@ -47,3 +47,17 @@ void CPsfBios::CountTicks(uint32 ticks)
{
m_bios.CountTicks(ticks);
}
#ifdef DEBUGGER_INCLUDED
void CPsfBios::LoadDebugTags(const char* packagePath)
{
}
void CPsfBios::SaveDebugTags(const char* packagePath)
{
}
#endif

View File

@ -16,6 +16,11 @@ namespace PS2
void HandleInterrupt();
void CountTicks(uint32);
#ifdef DEBUGGER_INCLUDED
void LoadDebugTags(const char*);
void SaveDebugTags(const char*);
#endif
void AppendArchive(const CPsfBase&);
void Start();

View File

@ -12,6 +12,7 @@ using namespace std::tr1;
using namespace std::tr1::placeholders;
using namespace boost;
using namespace Iop;
using namespace Framework;
#define FRAMES_PER_SEC (60)
@ -62,21 +63,12 @@ m_frameCounter(g_frameTicks)
m_cpu.m_pArch = &g_MAMIPSIV;
m_cpu.m_pAddrTranslator = &CMIPS::TranslateAddress64;
#ifdef _DEBUG
m_cpu.m_Functions.Unserialize("rawr.functions");
m_cpu.m_Comments.Unserialize("rawr.comments");
#endif
m_dmac.SetReceiveFunction(4, bind(&CSpuBase::ReceiveDma, &m_spuCore0, _1, _2, _3));
m_dmac.SetReceiveFunction(8, bind(&CSpuBase::ReceiveDma, &m_spuCore1, _1, _2, _3));
}
CPsfVm::~CPsfVm()
{
#ifdef _DEBUG
m_cpu.m_Functions.Serialize("rawr.functions");
m_cpu.m_Comments.Serialize("rawr.comments");
#endif
delete [] m_ram;
delete [] m_scratchPad;
delete [] m_spuRam;
@ -106,6 +98,30 @@ void CPsfVm::Reset()
m_spuUpdateCounter = g_spuUpdateTicks;
}
#ifdef DEBUGGER_INCLUDED
string CPsfVm::MakeTagPackagePath(const char* packageName)
{
return string(packageName) + ".tags.xml";
}
void CPsfVm::LoadDebugTags(const char* packageName)
{
m_cpu.m_Functions.Unserialize("rawr.functions");
m_cpu.m_Comments.Unserialize("rawr.comments");
}
void CPsfVm::SaveDebugTags(const char* packageName)
{
m_cpu.m_Functions.Serialize("rawr.functions");
m_cpu.m_Comments.Serialize("rawr.comments");
string packagePath = MakeTagPackagePath(packageName);
m_bios->SaveDebugTags(packagePath.c_str());
}
#endif
uint32 CPsfVm::ReadIoRegister(uint32 address)
{
if(address == 0x1F801814)

View File

@ -59,6 +59,12 @@ public:
virtual void Pause();
virtual void Resume();
#ifdef DEBUGGER_INCLUDED
std::string MakeTagPackagePath(const char*);
void LoadDebugTags(const char*);
void SaveDebugTags(const char*);
#endif
boost::signal<void ()> OnNewFrame;
private:

View File

@ -3,6 +3,8 @@
#include "Log.h"
#include "iop/Iop_Intc.h"
#include "MipsAssembler.h"
#include "xml/Node.h"
#include "xml/Writer.h"
#define LOG_NAME ("psxbios")
#define SC_PARAM0 (CMIPS::A0)
@ -13,6 +15,7 @@
using namespace std;
using namespace Iop;
using namespace Framework;
#define LONGJMP_BUFFER (0x0200)
#define INTR_HANDLER (0x1000)
@ -107,6 +110,32 @@ void CPsxBios::LoadExe(uint8* exe)
}
}
#ifdef DEBUGGER_INCLUDED
void CPsxBios::LoadDebugTags(const char* packagePath)
{
}
void CPsxBios::SaveDebugTags(const char* packagePath)
{
Xml::CNode* document = new Xml::CNode("tags", true);
{
Xml::CNode* functionsNode = new Xml::CNode("functions", true);
m_cpu.m_Functions.Serialize(functionsNode);
document->InsertNode(functionsNode);
}
{
Xml::CNode* commentsNode = new Xml::CNode("comments", true);
m_cpu.m_Comments.Serialize(commentsNode);
document->InsertNode(commentsNode);
}
Xml::CWriter::WriteDocument(&CStdStream(packagePath, "wb"), document);
delete document;
}
#endif
void CPsxBios::CountTicks(uint32 ticks)
{

View File

@ -17,6 +17,11 @@ public:
void LoadExe(uint8*);
#ifdef DEBUGGER_INCLUDED
void LoadDebugTags(const char*);
void SaveDebugTags(const char*);
#endif
private:
struct EXEHEADER
{

View File

@ -41,7 +41,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;C:\Program Files\OpenAL 1.1 SDK\include&quot;;C:\Projects\Rawr\Source;C:\Projects\zlib;C:\Components\boost_1_35_0\boost\tr1\tr1;C:\Components\boost_1_35_0;C:\Projects\Framework\include;C:\Projects\Rawr\tools\PsfPlayer2\Source"
PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_MSVC;_PSX;_NULL_SIFMAN"
PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_MSVC;_PSX;DEBUGGER_INCLUDED"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"

View File

@ -1,8 +1,10 @@
TODO:
- Final Fantasy 7 - Still More Fighting - Cymbals sound not fading?
- SPU updating for too long? (CPU/SPU desync)
- Reverb for SPU2
- Reverb enable option
- Fix nasty bug with PSX sound files and home computer.
- Happens on other computers too.
- Final Fantasy X
- Exception for invalid PSFs
- 32-bits MA_MIPSIV support