Zelda HLE: Make the implementation less strict for recoverable errors.

It kind of sucks that we don't emulate some behaviors properly, but there is
very little ROI for some of these features and I'm not going to spend time
implementing them any time soon. Making the PanicAlerts optional allows for
more testing of the core features on more games while "just" breaking less
important features like reverb.
This commit is contained in:
Pierre Bourdon 2014-12-26 19:17:35 +01:00
parent 837b8041c0
commit 89037781e0
1 changed files with 13 additions and 0 deletions

View File

@ -7,6 +7,11 @@
#include "Core/HW/DSPHLE/UCodes/UCodes.h" #include "Core/HW/DSPHLE/UCodes/UCodes.h"
#include "Core/HW/DSPHLE/UCodes/Zelda.h" #include "Core/HW/DSPHLE/UCodes/Zelda.h"
// Uncomment this to have a strict version of the HLE implementation, which
// PanicAlerts on recoverable unknown behaviors instead of silently ignoring
// them. Recommended for development.
// #define STRICT_ZELDA_HLE 1
// These flags modify the behavior of the HLE implementation based on the UCode // These flags modify the behavior of the HLE implementation based on the UCode
// version. When introducing a new flag, please recheck the behavior of each // version. When introducing a new flag, please recheck the behavior of each
// UCode version. // UCode version.
@ -808,8 +813,10 @@ void ZeldaAudioRenderer::PrepareFrame()
// TODO: Back left and back right should have a filter applied to them, // TODO: Back left and back right should have a filter applied to them,
// then get mixed into front left and front right. In practice, TWW never // then get mixed into front left and front right. In practice, TWW never
// uses this AFAICT. PanicAlert to help me find places that use this. // uses this AFAICT. PanicAlert to help me find places that use this.
#ifdef STRICT_ZELDA_HLE
if (!(m_flags & LIGHT_PROTOCOL) && (m_buf_back_left[0] != 0 || m_buf_back_right[0] != 0)) if (!(m_flags & LIGHT_PROTOCOL) && (m_buf_back_left[0] != 0 || m_buf_back_right[0] != 0))
PanicAlert("Zelda HLE using back mixing buffers"); PanicAlert("Zelda HLE using back mixing buffers");
#endif
// Add reverb data from previous frame. // Add reverb data from previous frame.
ApplyReverb(false); ApplyReverb(false);
@ -837,7 +844,9 @@ void ZeldaAudioRenderer::ApplyReverb(bool post_rendering)
{ {
if (!m_reverb_pb_base_addr) if (!m_reverb_pb_base_addr)
{ {
#ifdef STRICT_ZELDA_HLE
PanicAlert("Trying to apply reverb without available parameters."); PanicAlert("Trying to apply reverb without available parameters.");
#endif
return; return;
} }
@ -912,7 +921,9 @@ void ZeldaAudioRenderer::ApplyReverb(bool post_rendering)
MixingBuffer* dest_buffer = BufferForID(dest.buffer_id); MixingBuffer* dest_buffer = BufferForID(dest.buffer_id);
if (!dest_buffer) if (!dest_buffer)
{ {
#ifdef STRICT_ZELDA_HLE
PanicAlert("RPB mixing to an unknown buffer: %04x", dest.buffer_id); PanicAlert("RPB mixing to an unknown buffer: %04x", dest.buffer_id);
#endif
continue; continue;
} }
AddBuffersWithVolume(dest_buffer->data(), buffer.data(), AddBuffersWithVolume(dest_buffer->data(), buffer.data(),
@ -1085,7 +1096,9 @@ void ZeldaAudioRenderer::AddVoice(u16 voice_id)
MixingBuffer* dst_buffer = BufferForID(vpb.channels[i].id); MixingBuffer* dst_buffer = BufferForID(vpb.channels[i].id);
if (!dst_buffer) if (!dst_buffer)
{ {
#ifdef STRICT_ZELDA_HLE
PanicAlert("Mixing to an unmapped buffer: %04x", vpb.channels[i].id); PanicAlert("Mixing to an unmapped buffer: %04x", vpb.channels[i].id);
#endif
continue; continue;
} }