PsfPlayer v0.16

git-svn-id: http://svn.purei.org/purei/trunk@416 b36208d7-6611-0410-8bec-b1987f11c4a2
This commit is contained in:
jpd002 2008-11-14 17:10:21 +00:00
parent 7bfac71738
commit be0de1ee26
10 changed files with 98 additions and 18 deletions

View File

@ -65,7 +65,6 @@ CIopBios::~CIopBios()
SaveAllModulesTags(m_cpu.m_Functions, "functions");
#endif
DeleteModules();
delete m_sifMan;
}
void CIopBios::Reset()
@ -122,6 +121,9 @@ void CIopBios::Reset()
{
RegisterModule(new Iop::CIntrman(*this, m_ram));
}
{
RegisterModule(m_sifMan);
}
#ifdef _IOP_EMULATE_MODULES
{
RegisterModule(new Iop::CFileIo(*m_sifMan, *m_ioman));
@ -403,7 +405,7 @@ uint32 CIopBios::WakeupThread(uint32 threadId, bool inInterrupt)
return thread.wakeupCount;
}
uint32 CIopBios::GetThreadId()
uint32 CIopBios::GetCurrentThreadId()
{
return m_currentThreadId;
}
@ -477,6 +479,12 @@ void CIopBios::Reschedule()
{
LoadThreadContext(nextThreadId);
}
#ifdef _DEBUG
if(nextThreadId != m_currentThreadId)
{
CLog::GetInstance().Print(LOGNAME, "Switched over to thread %i.\r\n", nextThreadId);
}
#endif
m_currentThreadId = nextThreadId;
m_cpu.m_nQuota = 1;
}
@ -733,9 +741,6 @@ void CIopBios::HandleException()
}
else
{
//Hack for FFX PSF ---------------------
//m_cpu.m_State.nGPR[CMIPS::V0].nD0 = 1;
//Hack for FFX PSF ---------------------
#ifdef _DEBUG
CLog::GetInstance().Print(LOGNAME, "%0.8X: Trying to call a function from non-existing module (%s, %d).\r\n",
m_cpu.m_State.nPC, moduleName.c_str(), functionId);

View File

@ -43,7 +43,7 @@ public:
uint32 CreateThread(uint32, uint32);
void StartThread(uint32, uint32* = NULL);
void DelayThread(uint32);
uint32 GetThreadId();
uint32 GetCurrentThreadId();
void SleepThread();
uint32 WakeupThread(uint32, bool);

46
Source/iop/Iop_SifMan.cpp Normal file
View File

@ -0,0 +1,46 @@
#include "Iop_SifMan.h"
#include "../Log.h"
#define LOG_NAME ("iop_sifman")
using namespace Iop;
using namespace std;
CSifMan::CSifMan()
{
}
CSifMan::~CSifMan()
{
}
string CSifMan::GetId() const
{
return "sifman";
}
void CSifMan::Invoke(CMIPS& context, unsigned int functionId)
{
switch(functionId)
{
case 7:
context.m_State.nGPR[CMIPS::V0].nD0 = static_cast<int32>(SifSetDma(
context.m_State.nGPR[CMIPS::A0].nV0,
context.m_State.nGPR[CMIPS::A1].nV0
));
break;
default:
CLog::GetInstance().Print(LOG_NAME, "%0.8X: Unknown function (%d) called.", context.m_State.nPC, functionId);
break;
}
}
uint32 CSifMan::SifSetDma(uint32 structAddr, uint32 length)
{
CLog::GetInstance().Print(LOG_NAME, "SifSetDma(structAddr = 0x%0.8X, length = %X);\r\n",
structAddr, length);
return 1;
}

View File

@ -2,17 +2,25 @@
#define _IOP_SIFMAN_H_
#include "../SifModule.h"
#include "Iop_Module.h"
namespace Iop
{
class CSifMan
class CSifMan : public CModule
{
public:
virtual ~CSifMan() {}
CSifMan();
virtual ~CSifMan();
virtual void RegisterModule(uint32, CSifModule*) = 0;
virtual void SendPacket(void*, uint32) = 0;
virtual void SetDmaBuffer(uint8*, uint32) = 0;
virtual std::string GetId() const;
virtual void Invoke(CMIPS&, unsigned int);
virtual void RegisterModule(uint32, CSifModule*) = 0;
virtual void SendPacket(void*, uint32) = 0;
virtual void SetDmaBuffer(uint8*, uint32) = 0;
private:
uint32 SifSetDma(uint32, uint32);
};
}

View File

@ -256,6 +256,12 @@ void CSpuBase::Render(int16* samples, unsigned int sampleCount, unsigned int sam
}
else
{
if(reader.IsDone())
{
channel.status = STOPPED;
channel.adsrVolume = 0;
continue;
}
uint8* repeat = reader.GetRepeat();
channel.repeat = repeat - m_ram;
}
@ -726,6 +732,11 @@ uint8* CSpuBase::CSampleReader::GetCurrent() const
return m_nextSample;
}
bool CSpuBase::CSampleReader::IsDone() const
{
return m_done;
}
double CSpuBase::CSampleReader::GetSamplingRate() const
{
return m_sourceSamplingRate;

View File

@ -192,6 +192,7 @@ namespace Iop
void GetSamples(int16*, unsigned int, unsigned int);
uint8* GetRepeat() const;
uint8* GetCurrent() const;
bool IsDone() const;
private:
enum

View File

@ -1,9 +1,12 @@
#include "Iop_Thbase.h"
#include "IopBios.h"
#include "../Log.h"
using namespace Iop;
using namespace std;
#define LOG_NAME ("iop_thbase")
CThbase::CThbase(CIopBios& bios, uint8* ram) :
m_ram(ram),
m_bios(bios)
@ -87,7 +90,7 @@ uint32 CThbase::DelayThread(uint32 delay)
uint32 CThbase::GetThreadId()
{
return m_bios.GetThreadId();
return m_bios.GetCurrentThreadId();
}
uint32 CThbase::SleepThread()
@ -108,6 +111,10 @@ uint32 CThbase::iWakeupThread(uint32 threadId)
uint32 CThbase::GetSystemTime(uint32 resultAddr)
{
#ifdef _DEBUG
CLog::GetInstance().Print(LOG_NAME, "%d : GetSystemTime(result);\r\n",
m_bios.GetCurrentThreadId());
#endif
uint64* result = NULL;
if(resultAddr != 0)
{

View File

@ -2,7 +2,7 @@
#define _APPDEF_H_
#define APP_NAME _T("PsfPlayer")
#define APP_VERSION (16)
#define APP_VERSIONSTR _T("0.16")
#define APP_VERSION (17)
#define APP_VERSIONSTR _T("0.17")
#endif

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;DEBUGGER_INCLUDED"
PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_MSVC;_PSX;_NULL_SIFMAN"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@ -700,6 +700,10 @@
RelativePath="..\..\Source\iop\Iop_RootCounters.h"
>
</File>
<File
RelativePath="..\..\Source\iop\Iop_SifMan.cpp"
>
</File>
<File
RelativePath="..\..\Source\iop\Iop_Sifman.h"
>

View File

@ -1,11 +1,9 @@
TODO:
- Final Fantasy 7 - Still More Fighting - Cymbals sound not fading?
- Reverb for SPU2
- Reverb enable option
- Support for both SPU cores.
- Fix nasty bug with PSX sound files and home computer.
- Atelier Iris
- Final Fantasy X
- Seperate Ioman and Fileio modules.
- Exception for invalid PSFs
- 32-bits MA_MIPSIV support