mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-28 09:59:32 -06:00
Use correct exceptions for d3 reads/writes
This commit is contained in:

committed by
Tillmann Karras

parent
c9bb258e88
commit
c7d8afc5a7
@ -81,7 +81,7 @@ u16 Accelerator::ReadRaw()
|
|||||||
{
|
{
|
||||||
// Set address back to start address (confirmed on hardware)
|
// Set address back to start address (confirmed on hardware)
|
||||||
m_current_address = m_start_address;
|
m_current_address = m_start_address;
|
||||||
OnEndException();
|
OnRawReadEndException();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCurrentAddress(m_current_address);
|
SetCurrentAddress(m_current_address);
|
||||||
@ -103,6 +103,7 @@ void Accelerator::WriteRaw(u16 value)
|
|||||||
WriteMemory(m_current_address * 2, value >> 8);
|
WriteMemory(m_current_address * 2, value >> 8);
|
||||||
WriteMemory(m_current_address * 2 + 1, value & 0xFF);
|
WriteMemory(m_current_address * 2 + 1, value & 0xFF);
|
||||||
m_current_address++;
|
m_current_address++;
|
||||||
|
OnRawWriteEndException();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -228,7 +229,7 @@ u16 Accelerator::ReadSample(const s16* coefs)
|
|||||||
// Set address back to start address.
|
// Set address back to start address.
|
||||||
m_current_address = m_start_address;
|
m_current_address = m_start_address;
|
||||||
m_reads_stopped = true;
|
m_reads_stopped = true;
|
||||||
OnEndException();
|
OnSampleReadEndException();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCurrentAddress(m_current_address);
|
SetCurrentAddress(m_current_address);
|
||||||
|
@ -40,7 +40,9 @@ public:
|
|||||||
void DoState(PointerWrap& p);
|
void DoState(PointerWrap& p);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void OnEndException() = 0;
|
virtual void OnRawReadEndException() = 0;
|
||||||
|
virtual void OnRawWriteEndException() = 0;
|
||||||
|
virtual void OnSampleReadEndException() = 0;
|
||||||
virtual u8 ReadMemory(u32 address) = 0;
|
virtual u8 ReadMemory(u32 address) = 0;
|
||||||
virtual void WriteMemory(u32 address, u8 value) = 0;
|
virtual void WriteMemory(u32 address, u8 value) = 0;
|
||||||
u16 GetCurrentSample();
|
u16 GetCurrentSample();
|
||||||
|
@ -109,7 +109,18 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
u8 ReadMemory(u32 address) override { return Host::ReadHostMemory(address); }
|
u8 ReadMemory(u32 address) override { return Host::ReadHostMemory(address); }
|
||||||
void WriteMemory(u32 address, u8 value) override { Host::WriteHostMemory(value, address); }
|
void WriteMemory(u32 address, u8 value) override { Host::WriteHostMemory(value, address); }
|
||||||
void OnEndException() override { m_dsp.SetException(ExceptionType::AcceleratorOverflow); }
|
void OnRawReadEndException() override
|
||||||
|
{
|
||||||
|
m_dsp.SetException(ExceptionType::AcceleratorRawReadOverflow);
|
||||||
|
}
|
||||||
|
void OnRawWriteEndException() override
|
||||||
|
{
|
||||||
|
m_dsp.SetException(ExceptionType::AcceleratorRawWriteOverflow);
|
||||||
|
}
|
||||||
|
void OnSampleReadEndException() override
|
||||||
|
{
|
||||||
|
m_dsp.SetException(ExceptionType::AcceleratorSampleReadOverflow);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SDSP& m_dsp;
|
SDSP& m_dsp;
|
||||||
|
@ -228,9 +228,9 @@ enum class ExceptionType
|
|||||||
{
|
{
|
||||||
StackOverflow = 1, // 0x0002 stack under/over flow
|
StackOverflow = 1, // 0x0002 stack under/over flow
|
||||||
EXP_2 = 2, // 0x0004
|
EXP_2 = 2, // 0x0004
|
||||||
EXP_3 = 3, // 0x0006
|
AcceleratorRawReadOverflow = 3, // 0x0006 accelerator raw read address overflow
|
||||||
EXP_4 = 4, // 0x0008
|
AcceleratorRawWriteOverflow = 4, // 0x0008 accelerator raw write address overflow
|
||||||
AcceleratorOverflow = 5, // 0x000a accelerator address overflow
|
AcceleratorSampleReadOverflow = 5, // 0x000a accelerator sample reads address overflow
|
||||||
EXP_6 = 6, // 0x000c
|
EXP_6 = 6, // 0x000c
|
||||||
ExternalInterrupt = 7 // 0x000e external int (message from CPU)
|
ExternalInterrupt = 7 // 0x000e external int (message from CPU)
|
||||||
};
|
};
|
||||||
|
@ -246,7 +246,7 @@ AESndAccelerator::AESndAccelerator(DSP::DSPManager& dsp) : m_dsp(dsp)
|
|||||||
|
|
||||||
AESndAccelerator::~AESndAccelerator() = default;
|
AESndAccelerator::~AESndAccelerator() = default;
|
||||||
|
|
||||||
void AESndAccelerator::OnEndException()
|
void AESndAccelerator::OnSampleReadEndException()
|
||||||
{
|
{
|
||||||
// exception5 - this updates internal state
|
// exception5 - this updates internal state
|
||||||
SetYn1(GetYn1());
|
SetYn1(GetYn1());
|
||||||
@ -372,7 +372,7 @@ void AESndUCode::DoMixing()
|
|||||||
while (counter_h >= 1)
|
while (counter_h >= 1)
|
||||||
{
|
{
|
||||||
counter_h--;
|
counter_h--;
|
||||||
new_r = m_accelerator.Read(ACCELERATOR_COEFS.data());
|
new_r = m_accelerator.ReadSample(ACCELERATOR_COEFS.data());
|
||||||
new_l = new_r;
|
new_l = new_r;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -383,8 +383,8 @@ void AESndUCode::DoMixing()
|
|||||||
while (counter_h >= 1)
|
while (counter_h >= 1)
|
||||||
{
|
{
|
||||||
counter_h--;
|
counter_h--;
|
||||||
new_r = m_accelerator.Read(ACCELERATOR_COEFS.data());
|
new_r = m_accelerator.ReadSample(ACCELERATOR_COEFS.data());
|
||||||
new_l = m_accelerator.Read(ACCELERATOR_COEFS.data());
|
new_l = m_accelerator.ReadSample(ACCELERATOR_COEFS.data());
|
||||||
}
|
}
|
||||||
break; // falls through to mix_samples normally
|
break; // falls through to mix_samples normally
|
||||||
|
|
||||||
@ -394,7 +394,7 @@ void AESndUCode::DoMixing()
|
|||||||
while (counter_h >= 1)
|
while (counter_h >= 1)
|
||||||
{
|
{
|
||||||
counter_h--;
|
counter_h--;
|
||||||
new_r = m_accelerator.Read(ACCELERATOR_COEFS.data());
|
new_r = m_accelerator.ReadSample(ACCELERATOR_COEFS.data());
|
||||||
new_l = new_r;
|
new_l = new_r;
|
||||||
}
|
}
|
||||||
new_r ^= 0x8000;
|
new_r ^= 0x8000;
|
||||||
@ -407,8 +407,8 @@ void AESndUCode::DoMixing()
|
|||||||
while (counter_h >= 1)
|
while (counter_h >= 1)
|
||||||
{
|
{
|
||||||
counter_h--;
|
counter_h--;
|
||||||
new_r = m_accelerator.Read(ACCELERATOR_COEFS.data());
|
new_r = m_accelerator.ReadSample(ACCELERATOR_COEFS.data());
|
||||||
new_l = m_accelerator.Read(ACCELERATOR_COEFS.data());
|
new_l = m_accelerator.ReadSample(ACCELERATOR_COEFS.data());
|
||||||
}
|
}
|
||||||
new_r ^= 0x8000;
|
new_r ^= 0x8000;
|
||||||
new_l ^= 0x8000;
|
new_l ^= 0x8000;
|
||||||
|
@ -30,7 +30,9 @@ public:
|
|||||||
~AESndAccelerator();
|
~AESndAccelerator();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void OnEndException() override;
|
void OnRawReadEndException() override {}
|
||||||
|
void OnRawWriteEndException() override {}
|
||||||
|
void OnSampleReadEndException() override;
|
||||||
u8 ReadMemory(u32 address) override;
|
u8 ReadMemory(u32 address) override;
|
||||||
void WriteMemory(u32 address, u8 value) override;
|
void WriteMemory(u32 address, u8 value) override;
|
||||||
|
|
||||||
|
@ -134,7 +134,9 @@ public:
|
|||||||
PB_TYPE* acc_pb = nullptr;
|
PB_TYPE* acc_pb = nullptr;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void OnEndException() override
|
void OnRawReadEndException() override {}
|
||||||
|
void OnRawWriteEndException() override {}
|
||||||
|
void OnSampleReadEndException() override
|
||||||
{
|
{
|
||||||
if (acc_pb->audio_addr.looping)
|
if (acc_pb->audio_addr.looping)
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,9 @@ public:
|
|||||||
bool EndExceptionRaised() const { return m_accov_raised; }
|
bool EndExceptionRaised() const { return m_accov_raised; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void OnEndException() override
|
void OnRawReadEndException() override {}
|
||||||
|
void OnRawWriteEndException() override {}
|
||||||
|
void OnSampleReadEndException() override
|
||||||
{
|
{
|
||||||
EXPECT_TRUE(m_reads_stopped);
|
EXPECT_TRUE(m_reads_stopped);
|
||||||
m_accov_raised = true;
|
m_accov_raised = true;
|
||||||
|
Reference in New Issue
Block a user