mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-11 00:25:41 +12:00
Add CSND::AcquireSoundChannels
This commit is contained in:
parent
db50054128
commit
8ac22e35e9
2 changed files with 14 additions and 0 deletions
|
@ -19,6 +19,7 @@ class CSNDService {
|
||||||
std::optional<Handle> csndMutex = std::nullopt;
|
std::optional<Handle> csndMutex = std::nullopt;
|
||||||
|
|
||||||
// Service functions
|
// Service functions
|
||||||
|
void acquireSoundChannels(u32 messagePointer);
|
||||||
void initialize(u32 messagePointer);
|
void initialize(u32 messagePointer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
namespace CSNDCommands {
|
namespace CSNDCommands {
|
||||||
enum : u32 {
|
enum : u32 {
|
||||||
Initialize = 0x00010140,
|
Initialize = 0x00010140,
|
||||||
|
AcquireSoundChannels = 0x00050000,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +20,7 @@ void CSNDService::handleSyncRequest(u32 messagePointer) {
|
||||||
const u32 command = mem.read32(messagePointer);
|
const u32 command = mem.read32(messagePointer);
|
||||||
|
|
||||||
switch (command) {
|
switch (command) {
|
||||||
|
case CSNDCommands::AcquireSoundChannels: acquireSoundChannels(messagePointer); break;
|
||||||
case CSNDCommands::Initialize: initialize(messagePointer); break;
|
case CSNDCommands::Initialize: initialize(messagePointer); break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -28,6 +30,17 @@ void CSNDService::handleSyncRequest(u32 messagePointer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSNDService::acquireSoundChannels(u32 messagePointer) {
|
||||||
|
log("CSND::AcquireSoundChannels\n");
|
||||||
|
// The CSND service talks to the DSP using the DSP FIFO to negotiate what CSND channels are allocated to the DSP, and this seems to be channels 0-7 (usually). The rest are dedicated to CSND services.
|
||||||
|
// https://www.3dbrew.org/wiki/CSND_Services
|
||||||
|
constexpr u32 csndChannelMask = 0xFFFFFF00;
|
||||||
|
|
||||||
|
mem.write32(messagePointer, IPC::responseHeader(0x5, 2, 0));
|
||||||
|
mem.write32(messagePointer + 4, Result::Success);
|
||||||
|
mem.write32(messagePointer + 8, csndChannelMask);
|
||||||
|
}
|
||||||
|
|
||||||
void CSNDService::initialize(u32 messagePointer) {
|
void CSNDService::initialize(u32 messagePointer) {
|
||||||
u32 blockSize = mem.read32(messagePointer + 4);
|
u32 blockSize = mem.read32(messagePointer + 4);
|
||||||
const u32 offset0 = mem.read32(messagePointer + 8);
|
const u32 offset0 = mem.read32(messagePointer + 8);
|
||||||
|
|
Loading…
Add table
Reference in a new issue