mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-08 20:11:39 +12:00
Filesystem stuff
This commit is contained in:
parent
5992a58351
commit
272cdefca1
13 changed files with 222 additions and 32 deletions
18
src/core/kernel/file_operations.cpp
Normal file
18
src/core/kernel/file_operations.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "kernel.hpp"
|
||||
|
||||
namespace FileOps {
|
||||
enum : u32 {
|
||||
Read = 0x080200C2
|
||||
};
|
||||
}
|
||||
|
||||
void Kernel::handleFileOperation(u32 messagePointer, Handle file) {
|
||||
const u32 cmd = mem.read32(messagePointer);
|
||||
switch (cmd) {
|
||||
default: Helpers::panic("Unknown file operation: %08X", cmd);
|
||||
}
|
||||
}
|
||||
|
||||
void Kernel::readFile(u32 messagePointer, Handle file) {
|
||||
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
#include "cpu.hpp"
|
||||
|
||||
Kernel::Kernel(CPU& cpu, Memory& mem, GPU& gpu)
|
||||
: cpu(cpu), regs(cpu.regs()), mem(mem), handleCounter(0), serviceManager(regs, mem, gpu, currentProcess) {
|
||||
: cpu(cpu), regs(cpu.regs()), mem(mem), handleCounter(0), serviceManager(regs, mem, gpu, currentProcess, *this) {
|
||||
objects.reserve(512); // Make room for a few objects to avoid further memory allocs later
|
||||
portHandles.reserve(32);
|
||||
|
||||
|
|
|
@ -84,9 +84,18 @@ void Kernel::sendSyncRequest() {
|
|||
return;
|
||||
}
|
||||
|
||||
// Check if our sync request is targetting a file instead of a service
|
||||
bool isFileOperation = getObject(handle, KernelObjectType::File) != nullptr;
|
||||
if (isFileOperation) {
|
||||
handleFileOperation(messagePointer, handle);
|
||||
regs[0] = SVCResult::Success;
|
||||
return;
|
||||
}
|
||||
|
||||
// If we're actually communicating with a port
|
||||
const auto session = getObject(handle, KernelObjectType::Session);
|
||||
if (session == nullptr) [[unlikely]] {
|
||||
Helpers::panic("SendSyncRequest: Invalid session handle");
|
||||
Helpers::panic("SendSyncRequest: Invalid handle");
|
||||
regs[0] = SVCResult::BadHandle;
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue