summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2014-12-20 04:24:43 +0100
committerPierre Bourdon <delroth@gmail.com>2015-08-14 16:01:29 +0200
commit58fd39d57a0fd91603c20e665f42a1268ba5788a (patch)
treeba4ceebef14f53cc57c26a3fa2cb09f7ba5e7ae9 /Source/Core
parent34341af17d8cd46812f07d4b82044ff07fd3225c (diff)
Zelda HLE: Value-initialize the std::arrays.
I was under the wrong impression that std::array's default constructor performed value initialization. Turns out it does not, so an array of POD will not be initialized.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp3
-rw-r--r--Source/Core/Core/HW/DSPHLE/UCodes/Zelda.h40
2 files changed, 15 insertions, 28 deletions
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp
index 5f99618a7d..18424e573c 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp
@@ -549,6 +549,9 @@ void ZeldaAudioRenderer::PrepareFrame()
if (m_buf_back_left[0] != 0 || m_buf_back_right[0] != 0)
PanicAlert("Zelda HLE using back mixing buffers");
+ m_buf_back_left.fill(0);
+ m_buf_back_right.fill(0);
+
// TODO: Dolby/reverb mixing here.
m_prepared = true;
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.h b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.h
index 1b5b32057b..7dbfadbf82 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.h
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.h
@@ -88,14 +88,14 @@ private:
// Mixing buffers.
typedef std::array<s16, 0x50> MixingBuffer;
- MixingBuffer m_buf_front_left;
- MixingBuffer m_buf_front_right;
- MixingBuffer m_buf_back_left;
- MixingBuffer m_buf_back_right;
- MixingBuffer m_buf_front_left_reverb;
- MixingBuffer m_buf_front_right_reverb;
- MixingBuffer m_buf_back_left_reverb;
- MixingBuffer m_buf_back_right_reverb;
+ MixingBuffer m_buf_front_left{};
+ MixingBuffer m_buf_front_right{};
+ MixingBuffer m_buf_back_left{};
+ MixingBuffer m_buf_back_right{};
+ MixingBuffer m_buf_front_left_reverb{};
+ MixingBuffer m_buf_front_right_reverb{};
+ MixingBuffer m_buf_back_left_reverb{};
+ MixingBuffer m_buf_back_right_reverb{};
// Base address where VPBs are stored linearly in RAM.
u32 m_vpb_base_addr;
@@ -104,7 +104,7 @@ private:
// Sine table transferred from MRAM. Contains sin(x) values for x in
// [0.0;pi/4] (sin(x) in [1.0;0.0]), in 1.15 fixed format.
- std::array<s16, 0x80> m_sine_table;
+ std::array<s16, 0x80> m_sine_table{};
// Fills up a buffer with the input samples for a voice, represented by its
// VPB.
@@ -121,22 +121,6 @@ private:
// Coefficients used for resampling.
std::array<s16, 0x100> m_resampling_coeffs{};
- // If non zero, base MRAM address for sound data transfers from ARAM. On
- // the Wii, this points to some MRAM location since there is no ARAM to be
- // used. If zero, use the top of ARAM.
- u32 m_aram_base_addr = 0;
- void* GetARAMPtr() const;
-
- // Downloads PCM encoded samples from ARAM. Handles looping and other
- // parameters appropriately.
- template <typename T> void DownloadPCMSamplesFromARAM(s16* dst, VPB* vpb, u16 requested_samples_count);
-
- // Downloads AFC encoded samples from ARAM and decode them. Handles looping
- // and other parameters appropriately.
- void DownloadAFCSamplesFromARAM(s16* dst, VPB* vpb, u16 requested_samples_count);
- void DecodeAFC(VPB* vpb, s16* dst, size_t block_count);
- std::array<s16, 0x20> m_afc_coeffs{};
-
// Downloads samples from MRAM while handling appropriate length / looping
// behavior.
void DownloadRawSamplesFromMRAM(s16* dst, VPB* vpb, u16 requested_samples_count);
@@ -145,7 +129,7 @@ private:
// and other parameters appropriately.
void DownloadAFCSamplesFromARAM(s16* dst, VPB* vpb, u16 requested_samples_count);
void DecodeAFC(VPB* vpb, s16* dst, size_t block_count);
- std::array<s16, 0x20> m_afc_coeffs;
+ std::array<s16, 0x20> m_afc_coeffs{};
};
class ZeldaUCode : public UCodeInterface
@@ -192,12 +176,12 @@ private:
// these sync mails contain 16 bit values that are used as bitfields to
// control voice skipping on a voice per voice level.
u32 m_sync_max_voice_id = 0;
- std::array<u32, 256> m_sync_voice_skip_flags;
+ std::array<u32, 256> m_sync_voice_skip_flags{};
// Command buffer (circular queue with r/w indices). Filled by HandleMail
// when the state machine is in WRITING_CMD state. Commands get executed
// when entering WAITING state and we are not rendering audio.
- std::array<u32, 64> m_cmd_buffer;
+ std::array<u32, 64> m_cmd_buffer{};
u32 m_read_offset = 0;
u32 m_write_offset = 0;
u32 m_pending_commands_count = 0;