Add CSND::AcquireSoundChannels
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user