mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-06 06:05:40 +12:00
Add SendSyncRequest
This commit is contained in:
parent
0e66af8dae
commit
ee74b375e3
3 changed files with 23 additions and 1 deletions
|
@ -63,6 +63,7 @@ class Kernel {
|
|||
void getResourceLimit();
|
||||
void getResourceLimitLimitValues();
|
||||
void getResourceLimitCurrentValues();
|
||||
void sendSyncRequest();
|
||||
void svcCloseHandle();
|
||||
void connectToPort();
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ void Kernel::serviceSVC(u32 svc) {
|
|||
case 0x21: createAddressArbiter(); break;
|
||||
case 0x23: svcCloseHandle(); break;
|
||||
case 0x2D: connectToPort(); break;
|
||||
case 0x32: sendSyncRequest(); break;
|
||||
case 0x38: getResourceLimit(); break;
|
||||
case 0x39: getResourceLimitLimitValues(); break;
|
||||
case 0x3A: getResourceLimitCurrentValues(); break;
|
||||
|
|
|
@ -43,7 +43,7 @@ void Kernel::connectToPort() {
|
|||
}
|
||||
|
||||
const auto portHandle = getPortHandle(port);
|
||||
if (!portHandle.has_value()) {
|
||||
if (!portHandle.has_value()) [[unlikely]] {
|
||||
Helpers::panic("ConnectToPort: Port doesn't exist\n");
|
||||
regs[0] = SVCResult::ObjectNotFound;
|
||||
return;
|
||||
|
@ -52,6 +52,26 @@ void Kernel::connectToPort() {
|
|||
// TODO: Actually create session
|
||||
Handle sessionHandle = makeObject(KernelObjectType::Session);
|
||||
|
||||
// TODO: Should the result be written back to [r0]?
|
||||
regs[0] = SVCResult::Success;
|
||||
regs[1] = sessionHandle;
|
||||
}
|
||||
|
||||
// Result SendSyncRequest(Handle session)
|
||||
void Kernel::sendSyncRequest() {
|
||||
const auto handle = regs[0];
|
||||
const auto session = getObject(handle, KernelObjectType::Session);
|
||||
printf("SendSyncRequest(session handle = %d)\n", handle);
|
||||
|
||||
if (session == nullptr) [[unlikely]] {
|
||||
Helpers::panic("SendSyncRequest: Invalid session handle");
|
||||
regs[0] = SVCResult::BadHandle;
|
||||
return;
|
||||
}
|
||||
|
||||
const auto sessionData = static_cast<SessionData*>(session->data);
|
||||
const u32 messagePointer = VirtualAddrs::TLSBase + 0x80;
|
||||
|
||||
Helpers::panic("SendSyncRequest: Message header: %08X", mem.read32(messagePointer));
|
||||
regs[0] = SVCResult::Success;
|
||||
}
|
Loading…
Add table
Reference in a new issue