mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-06 22:25:41 +12:00
[Kernel] Implement GetHeadphoneStatus, stub SignalEvent
This commit is contained in:
parent
f858107dd0
commit
e02ef8a213
5 changed files with 34 additions and 1 deletions
|
@ -114,6 +114,7 @@ class Kernel {
|
|||
void getThreadID();
|
||||
void releaseMutex();
|
||||
void sendSyncRequest();
|
||||
void signalEvent();
|
||||
void svcCloseHandle();
|
||||
void connectToPort();
|
||||
void outputDebugString();
|
||||
|
|
|
@ -50,6 +50,7 @@ class DSPService {
|
|||
|
||||
// Service functions
|
||||
void convertProcessAddressFromDspDram(u32 messagePointer); // Nice function name
|
||||
void getHeadphoneStatus(u32 messagePointer);
|
||||
void getSemaphoreHandle(u32 messagePointer);
|
||||
void loadComponent(u32 messagePointer);
|
||||
void readPipeIfPossible(u32 messagePointer);
|
||||
|
|
|
@ -33,7 +33,7 @@ void Kernel::createEvent() {
|
|||
void Kernel::clearEvent() {
|
||||
const Handle handle = regs[0];
|
||||
const auto event = getObject(handle, KernelObjectType::Event);
|
||||
logSVC("ClearEvent(event handle = %d)\n", handle);
|
||||
logSVC("ClearEvent(event handle = %X)\n", handle);
|
||||
|
||||
if (event == nullptr) [[unlikely]] {
|
||||
regs[0] = SVCResult::BadHandle;
|
||||
|
@ -44,6 +44,25 @@ void Kernel::clearEvent() {
|
|||
regs[0] = SVCResult::Success;
|
||||
}
|
||||
|
||||
// Result SignalEvent(Handle event)
|
||||
void Kernel::signalEvent() {
|
||||
const Handle handle = regs[0];
|
||||
const auto event = getObject(handle, KernelObjectType::Event);
|
||||
logSVC("SignalEvent(event handle = %X)\n", handle);
|
||||
printf("Stubbed SignalEvent!!\n");
|
||||
|
||||
/*
|
||||
if (event == nullptr) [[unlikely]] {
|
||||
regs[0] = SVCResult::BadHandle;
|
||||
return;
|
||||
}
|
||||
|
||||
event->getData<Event>()->fired = true;
|
||||
*/
|
||||
|
||||
regs[0] = SVCResult::Success;
|
||||
}
|
||||
|
||||
// Result WaitSynchronization1(Handle handle, s64 timeout_nanoseconds)
|
||||
void Kernel::waitSynchronization1() {
|
||||
const Handle handle = regs[0];
|
||||
|
|
|
@ -25,6 +25,7 @@ void Kernel::serviceSVC(u32 svc) {
|
|||
case 0x08: createThread(); break;
|
||||
case 0x14: releaseMutex(); break;
|
||||
case 0x17: createEvent(); break;
|
||||
case 0x18: signalEvent(); break;
|
||||
case 0x19: clearEvent(); break;
|
||||
case 0x1F: mapMemoryBlock(); break;
|
||||
case 0x21: createAddressArbiter(); break;
|
||||
|
|
|
@ -10,12 +10,15 @@ namespace DSPCommands {
|
|||
RegisterInterruptEvents = 0x00150082,
|
||||
GetSemaphoreHandle = 0x00160000,
|
||||
SetSemaphoreMask = 0x00170040,
|
||||
GetHeadphoneStatus = 0x001F0000
|
||||
};
|
||||
}
|
||||
|
||||
namespace Result {
|
||||
enum : u32 {
|
||||
Success = 0,
|
||||
HeadphonesNotInserted = 0,
|
||||
HeadphonesInserted = 1
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -27,6 +30,7 @@ void DSPService::handleSyncRequest(u32 messagePointer) {
|
|||
const u32 command = mem.read32(messagePointer);
|
||||
switch (command) {
|
||||
case DSPCommands::ConvertProcessAddressFromDspDram: convertProcessAddressFromDspDram(messagePointer); break;
|
||||
case DSPCommands::GetHeadphoneStatus: getHeadphoneStatus(messagePointer); break;
|
||||
case DSPCommands::GetSemaphoreHandle: getSemaphoreHandle(messagePointer); break;
|
||||
case DSPCommands::LoadComponent: loadComponent(messagePointer); break;
|
||||
case DSPCommands::ReadPipeIfPossible: readPipeIfPossible(messagePointer); break;
|
||||
|
@ -94,6 +98,13 @@ void DSPService::registerInterruptEvents(u32 messagePointer) {
|
|||
mem.write32(messagePointer + 4, Result::Success);
|
||||
}
|
||||
|
||||
void DSPService::getHeadphoneStatus(u32 messagePointer) {
|
||||
log("DSP::GetHeadphoneStatus\n");
|
||||
|
||||
mem.write32(messagePointer + 4, Result::Success);
|
||||
mem.write32(messagePointer + 8, Result::HeadphonesInserted); // This should be toggleable for shits and giggles
|
||||
}
|
||||
|
||||
void DSPService::getSemaphoreHandle(u32 messagePointer) {
|
||||
log("DSP::GetSemaphoreHandle\n");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue