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

This commit is contained in:
jpd002 2008-11-04 03:47:36 +00:00
parent 35ea190fbd
commit fab031b4dd
8 changed files with 64 additions and 16 deletions

View File

@ -41,11 +41,7 @@ CIoman::~CIoman()
{ {
delete fileIterator->second; delete fileIterator->second;
} }
for(DeviceMapType::iterator deviceIterator(m_devices.begin()); m_devices.clear();
m_devices.end() != deviceIterator; deviceIterator++)
{
delete deviceIterator->second;
}
if(m_fileIoHandler != NULL) if(m_fileIoHandler != NULL)
{ {
delete m_fileIoHandler; delete m_fileIoHandler;
@ -57,7 +53,7 @@ std::string CIoman::GetId() const
return "ioman"; return "ioman";
} }
void CIoman::RegisterDevice(const char* name, Ioman::CDevice* device) void CIoman::RegisterDevice(const char* name, const DevicePtr& device)
{ {
m_devices[name] = device; m_devices[name] = device;
} }

View File

@ -2,6 +2,7 @@
#define _IOP_IOMAN_H_ #define _IOP_IOMAN_H_
#include <map> #include <map>
#include <memory>
#include "Iop_SifMan.h" #include "Iop_SifMan.h"
#include "Iop_Module.h" #include "Iop_Module.h"
#include "Ioman_Device.h" #include "Ioman_Device.h"
@ -139,6 +140,8 @@ namespace Iop
SIF_MODULE_ID = 0x80000001 SIF_MODULE_ID = 0x80000001
}; };
typedef std::tr1::shared_ptr<Ioman::CDevice> DevicePtr;
CIoman(uint8*, CSifMan&); CIoman(uint8*, CSifMan&);
virtual ~CIoman(); virtual ~CIoman();
@ -146,7 +149,7 @@ namespace Iop
virtual void Invoke(CMIPS&, unsigned int); virtual void Invoke(CMIPS&, unsigned int);
virtual void Invoke(uint32, uint32*, uint32, uint32*, uint32, uint8*); virtual void Invoke(uint32, uint32*, uint32, uint32*, uint32, uint8*);
void RegisterDevice(const char*, Ioman::CDevice*); void RegisterDevice(const char*, const DevicePtr&);
uint32 Open(uint32, const char*); uint32 Open(uint32, const char*);
uint32 Close(uint32); uint32 Close(uint32);
@ -159,7 +162,7 @@ namespace Iop
private: private:
typedef std::map<uint32, Framework::CStream*> FileMapType; typedef std::map<uint32, Framework::CStream*> FileMapType;
typedef std::map<std::string, Ioman::CDevice*> DeviceMapType; typedef std::map<std::string, DevicePtr> DeviceMapType;
void Open(CMIPS&); void Open(CMIPS&);

View File

@ -222,8 +222,8 @@ void CSpu::Render(int16* samples, unsigned int sampleCount, unsigned int sampleR
} }
else else
{ {
uint8* repeat = reader.GetRepeat(); // uint8* repeat = reader.GetRepeat();
channel.repeat = (repeat - m_ram) / 8; // channel.repeat = (repeat - m_ram) / 8;
} }
int16 readSample = 0; int16 readSample = 0;
reader.SetPitch(m_baseSamplingRate, channel.pitch); reader.SetPitch(m_baseSamplingRate, channel.pitch);
@ -508,6 +508,10 @@ void CSpu::WriteRegister(uint32 address, uint16 value)
uint32 CSpu::ReceiveDma(uint8* buffer, uint32 blockSize, uint32 blockAmount) uint32 CSpu::ReceiveDma(uint8* buffer, uint32 blockSize, uint32 blockAmount)
{ {
#ifdef _DEBUG
CLog::GetInstance().Print(LOG_NAME, "Receiving DMA transfer to 0x%0.8X. Size = 0x%0.8X bytes.\r\n",
m_bufferAddr, blockSize * blockAmount);
#endif
unsigned int blocksTransfered = 0; unsigned int blocksTransfered = 0;
for(unsigned int i = 0; i < blockAmount; i++) for(unsigned int i = 0; i < blockAmount; i++)
{ {

View File

@ -42,7 +42,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="&quot;$(FrameworkRoot)\include&quot;;&quot;$(ProjectDir)\..\..\Source&quot;;&quot;$(ProjectDir)\Source&quot;" AdditionalIncludeDirectories="&quot;$(FrameworkRoot)\include&quot;;&quot;$(ProjectDir)\..\..\Source&quot;;&quot;$(ProjectDir)\Source&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MSVC;_CRT_SECURE_NO_WARNINGS;_PSX;_NULL_SIFMAN" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MSVC;_CRT_SECURE_NO_WARNINGS;_PSX;_NULL_SIFMAN;DEBUGGER_INCLUDED"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"

View File

@ -41,6 +41,8 @@ void CCore::Reset()
} }
// memset(m_ram, 0, RAMSIZE); // memset(m_ram, 0, RAMSIZE);
// m_transferAddress.f = 0; // m_transferAddress.f = 0;
m_tempReverb = 0;
m_tempReverbA = 0;
m_coreAttr = 0; m_coreAttr = 0;
} }
@ -129,8 +131,14 @@ uint32 CCore::ReadRegisterCore(unsigned int channelId, uint32 address, uint32 va
result = (transferAddress >> (16 + 1)); result = (transferAddress >> (16 + 1));
} }
break; break;
case A_ESA_LO:
result = (m_tempReverb & 0xFFFF);
break;
case A_EEA_HI:
result = (m_tempReverbA >> 16);
break;
} }
LogRead(address); LogRead(address, result);
return result; return result;
} }
@ -197,6 +205,15 @@ uint32 CCore::WriteRegisterCore(unsigned int channelId, uint32 address, uint32 v
m_spuBase->SetTransferAddress(transferAddress); m_spuBase->SetTransferAddress(transferAddress);
} }
break; break;
case A_ESA_HI:
m_tempReverb = (m_tempReverb & 0xFFFF) | (value << 16);
break;
case A_ESA_LO:
m_tempReverb = (m_tempReverb & 0xF0000) | (value);
break;
case A_EEA_HI:
m_tempReverbA = ((value & 0x0F) << 16) | 0xFFFF;
break;
} }
LogWrite(address, value); LogWrite(address, value);
return 0; return 0;
@ -214,6 +231,9 @@ uint32 CCore::ReadRegisterChannel(unsigned int channelId, uint32 address, uint32
CSpu::CHANNEL& channel(m_spuBase->GetChannel(channelId)); CSpu::CHANNEL& channel(m_spuBase->GetChannel(channelId));
switch(address) switch(address)
{ {
case VP_ENVX:
return (channel.adsrVolume >> 16);
break;
case VA_NAX_HI: case VA_NAX_HI:
result = ((channel.current) >> (16 + 1)) & 0xFFFF; result = ((channel.current) >> (16 + 1)) & 0xFFFF;
break; break;
@ -232,6 +252,7 @@ uint32 CCore::WriteRegisterChannel(unsigned int channelId, uint32 address, uint3
{ {
return 0; return 0;
} }
LogChannelWrite(channelId, address, value);
if(!m_spuBase) return 0; if(!m_spuBase) return 0;
CSpu::CHANNEL& channel(m_spuBase->GetChannel(channelId)); CSpu::CHANNEL& channel(m_spuBase->GetChannel(channelId));
switch(address) switch(address)
@ -327,11 +348,10 @@ uint32 CCore::WriteRegisterChannel(unsigned int channelId, uint32 address, uint3
break; break;
} }
*/ */
LogChannelWrite(channelId, address, value);
return 0; return 0;
} }
void CCore::LogRead(uint32 address) void CCore::LogRead(uint32 address, uint32 value)
{ {
const char* logName = m_logName.c_str(); const char* logName = m_logName.c_str();
switch(address) switch(address)
@ -343,8 +363,14 @@ void CCore::LogRead(uint32 address)
CLog::GetInstance().Print(logName, "= STATX\r\n"); CLog::GetInstance().Print(logName, "= STATX\r\n");
break; break;
case A_TSA_HI: case A_TSA_HI:
CLog::GetInstance().Print(logName, "= A_TSA_HI.\r\n"); CLog::GetInstance().Print(logName, "= A_TSA_HI = 0x%0.4X.\r\n", value);
break; break;
case A_ESA_LO:
CLog::GetInstance().Print(logName, "= A_ESA_LO = 0x%0.4X.\r\n", value);
break;
case A_EEA_HI:
CLog::GetInstance().Print(logName, "= A_EEA_HI = 0x%0.4X.\r\n", value);
break;
default: default:
CLog::GetInstance().Print(logName, "Read an unknown register 0x%0.4X.\r\n", address); CLog::GetInstance().Print(logName, "Read an unknown register 0x%0.4X.\r\n", address);
break; break;
@ -380,6 +406,15 @@ void CCore::LogWrite(uint32 address, uint32 value)
case A_STD: case A_STD:
CLog::GetInstance().Print(logName, "A_STD = 0x%0.4X\r\n", value); CLog::GetInstance().Print(logName, "A_STD = 0x%0.4X\r\n", value);
break; break;
case A_ESA_LO:
CLog::GetInstance().Print(logName, "A_ESA_LO = 0x%0.4X\r\n", value);
break;
case A_ESA_HI:
CLog::GetInstance().Print(logName, "A_ESA_HI = 0x%0.4X\r\n", value);
break;
case A_EEA_HI:
CLog::GetInstance().Print(logName, "A_EEA_HI = 0x%0.4X\r\n", value);
break;
default: default:
CLog::GetInstance().Print(logName, "Write 0x%0.4X to an unknown register 0x%0.4X.\r\n", value, address); CLog::GetInstance().Print(logName, "Write 0x%0.4X to an unknown register 0x%0.4X.\r\n", value, address);
break; break;
@ -391,6 +426,10 @@ void CCore::LogChannelRead(unsigned int channelId, uint32 address, uint32 result
const char* logName = m_logName.c_str(); const char* logName = m_logName.c_str();
switch(address) switch(address)
{ {
case VP_ENVX:
CLog::GetInstance().Print(logName, "ch%0.2i: = VP_ENVX = 0x%0.4X.\r\n",
channelId, result);
break;
case VA_NAX_HI: case VA_NAX_HI:
CLog::GetInstance().Print(logName, "ch%0.2i: = VA_NAX_HI = 0x%0.4X.\r\n", CLog::GetInstance().Print(logName, "ch%0.2i: = VA_NAX_HI = 0x%0.4X.\r\n",
channelId, result); channelId, result);

View File

@ -55,6 +55,10 @@ namespace PS2
VA_NAX_HI = 0x1F9001C8, VA_NAX_HI = 0x1F9001C8,
VA_NAX_LO = 0x1F9001CA, VA_NAX_LO = 0x1F9001CA,
R_REG_BASE = 0x1F9002E0, //Reverb Base R_REG_BASE = 0x1F9002E0, //Reverb Base
A_ESA_HI = 0x1F9002E0,
A_ESA_LO = 0x1F9002E2,
A_EEA_HI = 0x1F90033C,
A_EEA_LO = 0x1F90033E,
STATX = 0x1F900344, STATX = 0x1F900344,
}; };
@ -90,7 +94,7 @@ namespace PS2
uint32 ReadRegisterChannel(unsigned int, uint32, uint32); uint32 ReadRegisterChannel(unsigned int, uint32, uint32);
uint32 WriteRegisterChannel(unsigned int, uint32, uint32); uint32 WriteRegisterChannel(unsigned int, uint32, uint32);
void LogRead(uint32); void LogRead(uint32, uint32);
void LogWrite(uint32, uint32); void LogWrite(uint32, uint32);
void LogChannelRead(unsigned int, uint32, uint32); void LogChannelRead(unsigned int, uint32, uint32);
void LogChannelWrite(unsigned int, uint32, uint32); void LogChannelWrite(unsigned int, uint32, uint32);
@ -104,6 +108,8 @@ namespace PS2
// UNION32_16 m_transferAddress; // UNION32_16 m_transferAddress;
std::string m_logName; std::string m_logName;
CSpu* m_spuBase; CSpu* m_spuBase;
uint32 m_tempReverb;
uint32 m_tempReverbA;
}; };
}; };
}; };

Binary file not shown.

Binary file not shown.