mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-06 06:05:40 +12:00
Implement CloseHandle for FIle sessions
This commit is contained in:
parent
35fa6783c6
commit
9b78951147
1 changed files with 23 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <cstdio>
|
||||||
#include "kernel.hpp"
|
#include "kernel.hpp"
|
||||||
#include "kernel_types.hpp"
|
#include "kernel_types.hpp"
|
||||||
#include "cpu.hpp"
|
#include "cpu.hpp"
|
||||||
|
@ -177,7 +178,29 @@ u32 Kernel::getTLSPointer() {
|
||||||
|
|
||||||
// Result CloseHandle(Handle handle)
|
// Result CloseHandle(Handle handle)
|
||||||
void Kernel::svcCloseHandle() {
|
void Kernel::svcCloseHandle() {
|
||||||
|
Handle handle = regs[0];
|
||||||
logSVC("CloseHandle(handle = %d) (Unimplemented)\n", regs[0]);
|
logSVC("CloseHandle(handle = %d) (Unimplemented)\n", regs[0]);
|
||||||
|
|
||||||
|
KernelObject* object = getObject(handle);
|
||||||
|
|
||||||
|
if (object == nullptr) {
|
||||||
|
Helpers::warn("svcCloseHandle with invalid object");
|
||||||
|
} else {
|
||||||
|
switch (object->type) {
|
||||||
|
case KernelObjectType::File: {
|
||||||
|
FileSession* session = object->getData<FileSession>();
|
||||||
|
session->isOpen = false;
|
||||||
|
|
||||||
|
if (session->fd) {
|
||||||
|
fclose(session->fd);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default: break; // Unimplemented atm
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
regs[0] = Result::Success;
|
regs[0] = Result::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue