mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-06 22:25:41 +12:00
[MIC] Implement GetGain & SetGain
This commit is contained in:
parent
980139e588
commit
29a740dae9
2 changed files with 25 additions and 2 deletions
|
@ -10,7 +10,11 @@ class MICService {
|
|||
MAKE_LOG_FUNCTION(log, micLogger)
|
||||
|
||||
// Service commands
|
||||
void getGain(u32 messagePointer);
|
||||
void mapSharedMem(u32 messagePointer);
|
||||
void setGain(u32 messagePointer);
|
||||
|
||||
u8 gain = 0; // How loud our microphone input signal is
|
||||
|
||||
public:
|
||||
MICService(Memory& mem) : mem(mem) {}
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
namespace MICCommands {
|
||||
enum : u32 {
|
||||
MapSharedMem = 0x00010042
|
||||
MapSharedMem = 0x00010042,
|
||||
SetGain = 0x00080040,
|
||||
GetGain = 0x00090000
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -12,12 +14,16 @@ namespace Result {
|
|||
};
|
||||
}
|
||||
|
||||
void MICService::reset() {}
|
||||
void MICService::reset() {
|
||||
gain = 0;
|
||||
}
|
||||
|
||||
void MICService::handleSyncRequest(u32 messagePointer) {
|
||||
const u32 command = mem.read32(messagePointer);
|
||||
switch (command) {
|
||||
case MICCommands::GetGain: getGain(messagePointer); break;
|
||||
case MICCommands::MapSharedMem: mapSharedMem(messagePointer); break;
|
||||
case MICCommands::SetGain: setGain(messagePointer); break;
|
||||
default: Helpers::panic("MIC service requested. Command: %08X\n", command);
|
||||
}
|
||||
}
|
||||
|
@ -27,5 +33,18 @@ void MICService::mapSharedMem(u32 messagePointer) {
|
|||
u32 handle = mem.read32(messagePointer + 12);
|
||||
|
||||
log("MIC::MapSharedMem (size = %08X, handle = %X) (stubbed)\n", size, handle);
|
||||
mem.write32(messagePointer + 4, Result::Success);
|
||||
}
|
||||
|
||||
void MICService::getGain(u32 messagePointer) {
|
||||
log("MIC::GetGain\n");
|
||||
mem.write32(messagePointer + 4, Result::Success);
|
||||
mem.write8(messagePointer + 8, gain);
|
||||
}
|
||||
|
||||
void MICService::setGain(u32 messagePointer) {
|
||||
gain = mem.read8(messagePointer + 4);
|
||||
log("MIC::SetGain (value = %d)\n", gain);
|
||||
|
||||
mem.write32(messagePointer + 4, Result::Success);
|
||||
}
|
Loading…
Add table
Reference in a new issue