summaryrefslogtreecommitdiff
path: root/src/audio_core/hle/pipe.cpp
diff options
context:
space:
mode:
authorGravatar MerryMage2016-02-21 13:13:52 +0000
committerGravatar MerryMage2016-02-21 13:13:52 +0000
commit8b00954ec79fad71691ad2d4c82d5c1c60e21b0c (patch)
tree443d275fd39c58928e68ef22ce3fe0fa56c73642 /src/audio_core/hle/pipe.cpp
parentMerge pull request #1406 from MerryMage/bitfield2 (diff)
downloadyuzu-8b00954ec79fad71691ad2d4c82d5c1c60e21b0c.tar.gz
yuzu-8b00954ec79fad71691ad2d4c82d5c1c60e21b0c.tar.xz
yuzu-8b00954ec79fad71691ad2d4c82d5c1c60e21b0c.zip
AudioCore: Skeleton Implementation
This commit: * Adds a new subproject, audio_core. * Defines structures that exist in DSP shared memory. * Hooks up various other parts of the emulator into audio core. This sets the foundation for a later HLE DSP implementation.
Diffstat (limited to 'src/audio_core/hle/pipe.cpp')
-rw-r--r--src/audio_core/hle/pipe.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/audio_core/hle/pipe.cpp b/src/audio_core/hle/pipe.cpp
new file mode 100644
index 000000000..6542c760c
--- /dev/null
+++ b/src/audio_core/hle/pipe.cpp
@@ -0,0 +1,55 @@
1// Copyright 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include <array>
6#include <vector>
7
8#include "audio_core/hle/pipe.h"
9
10#include "common/common_types.h"
11#include "common/logging/log.h"
12
13namespace DSP {
14namespace HLE {
15
16static size_t pipe2position = 0;
17
18void ResetPipes() {
19 pipe2position = 0;
20}
21
22std::vector<u8> PipeRead(u32 pipe_number, u32 length) {
23 if (pipe_number != 2) {
24 LOG_WARNING(Audio_DSP, "pipe_number = %u (!= 2), unimplemented", pipe_number);
25 return {}; // We currently don't handle anything other than the audio pipe.
26 }
27
28 // Canned DSP responses that games expect. These were taken from HW by 3dmoo team.
29 // TODO: Our implementation will actually use a slightly different response than this one.
30 // TODO: Use offsetof on DSP structures instead for a proper response.
31 static const std::array<u8, 32> canned_response {{
32 0x0F, 0x00, 0xFF, 0xBF, 0x8E, 0x9E, 0x80, 0x86, 0x8E, 0xA7, 0x30, 0x94, 0x00, 0x84, 0x40, 0x85,
33 0x8E, 0x94, 0x10, 0x87, 0x10, 0x84, 0x0E, 0xA9, 0x0E, 0xAA, 0xCE, 0xAA, 0x4E, 0xAC, 0x58, 0xAC
34 }};
35
36 // TODO: Move this into dsp::DSP service since it happens on the service side.
37 // Hardware observation: No data is returned if requested length reads beyond the end of the data in-pipe.
38 if (pipe2position + length > canned_response.size()) {
39 return {};
40 }
41
42 std::vector<u8> ret;
43 for (size_t i = 0; i < length; i++, pipe2position++) {
44 ret.emplace_back(canned_response[pipe2position]);
45 }
46
47 return ret;
48}
49
50void PipeWrite(u32 pipe_number, const std::vector<u8>& buffer) {
51 // TODO: proper pipe behaviour
52}
53
54} // namespace HLE
55} // namespace DSP