mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-07-07 15:52:59 +12:00
Rename Handle to HorizonHandle, add metal-cpp submodule, format
This commit is contained in:
parent
855a374f67
commit
0f80d0af7a
46 changed files with 150 additions and 60 deletions
|
@ -12,7 +12,7 @@ static const char* arbitrationTypeToString(u32 type) {
|
|||
}
|
||||
}
|
||||
|
||||
Handle Kernel::makeArbiter() {
|
||||
HorizonHandle Kernel::makeArbiter() {
|
||||
if (arbiterCount >= appResourceLimits.maxAddressArbiters) {
|
||||
Helpers::panic("Overflowed the number of address arbiters");
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ const char* Kernel::resetTypeToString(u32 type) {
|
|||
}
|
||||
}
|
||||
|
||||
Handle Kernel::makeEvent(ResetType resetType, Event::CallbackType callback) {
|
||||
HorizonHandle Kernel::makeEvent(ResetType resetType, Event::CallbackType callback) {
|
||||
Handle ret = makeObject(KernelObjectType::Event);
|
||||
objects[ret].data = new Event(resetType, callback);
|
||||
return ret;
|
||||
|
|
|
@ -82,7 +82,7 @@ void Kernel::setVersion(u8 major, u8 minor) {
|
|||
mem.kernelVersion = descriptor; // The memory objects needs a copy because you can read the kernel ver from config mem
|
||||
}
|
||||
|
||||
Handle Kernel::makeProcess(u32 id) {
|
||||
HorizonHandle Kernel::makeProcess(u32 id) {
|
||||
const Handle processHandle = makeObject(KernelObjectType::Process);
|
||||
const Handle resourceLimitHandle = makeObject(KernelObjectType::ResourceLimit);
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ void Kernel::mapMemoryBlock() {
|
|||
regs[0] = Result::Success;
|
||||
}
|
||||
|
||||
Handle Kernel::makeMemoryBlock(u32 addr, u32 size, u32 myPermission, u32 otherPermission) {
|
||||
HorizonHandle Kernel::makeMemoryBlock(u32 addr, u32 size, u32 myPermission, u32 otherPermission) {
|
||||
Handle ret = makeObject(KernelObjectType::MemoryBlock);
|
||||
objects[ret].data = new MemoryBlock(addr, size, myPermission, otherPermission);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "kernel.hpp"
|
||||
#include <cstring>
|
||||
|
||||
Handle Kernel::makePort(const char* name) {
|
||||
HorizonHandle Kernel::makePort(const char* name) {
|
||||
Handle ret = makeObject(KernelObjectType::Port);
|
||||
portHandles.push_back(ret); // Push the port handle to our cache of port handles
|
||||
objects[ret].data = new Port(name);
|
||||
|
@ -9,7 +9,7 @@ Handle Kernel::makePort(const char* name) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
Handle Kernel::makeSession(Handle portHandle) {
|
||||
HorizonHandle Kernel::makeSession(Handle portHandle) {
|
||||
const auto port = getObject(portHandle, KernelObjectType::Port);
|
||||
if (port == nullptr) [[unlikely]] {
|
||||
Helpers::panic("Trying to make session for non-existent port");
|
||||
|
@ -23,7 +23,7 @@ Handle Kernel::makeSession(Handle portHandle) {
|
|||
|
||||
// Get the handle of a port based on its name
|
||||
// If there's no such port, return nullopt
|
||||
std::optional<Handle> Kernel::getPortHandle(const char* name) {
|
||||
std::optional<HorizonHandle> Kernel::getPortHandle(const char* name) {
|
||||
for (auto handle : portHandles) {
|
||||
const auto data = objects[handle].getData<Port>();
|
||||
if (std::strncmp(name, data->name, Port::maxNameLen) == 0) {
|
||||
|
|
|
@ -109,7 +109,7 @@ void Kernel::rescheduleThreads() {
|
|||
}
|
||||
|
||||
// Internal OS function to spawn a thread
|
||||
Handle Kernel::makeThread(u32 entrypoint, u32 initialSP, u32 priority, ProcessorID id, u32 arg, ThreadStatus status) {
|
||||
HorizonHandle Kernel::makeThread(u32 entrypoint, u32 initialSP, u32 priority, ProcessorID id, u32 arg, ThreadStatus status) {
|
||||
int index; // Index of the created thread in the threads array
|
||||
|
||||
if (threadCount < appResourceLimits.maxThreads) [[likely]] { // If we have not yet created over too many threads
|
||||
|
@ -161,7 +161,7 @@ Handle Kernel::makeThread(u32 entrypoint, u32 initialSP, u32 priority, Processor
|
|||
return ret;
|
||||
}
|
||||
|
||||
Handle Kernel::makeMutex(bool locked) {
|
||||
HorizonHandle Kernel::makeMutex(bool locked) {
|
||||
Handle ret = makeObject(KernelObjectType::Mutex);
|
||||
objects[ret].data = new Mutex(locked, ret);
|
||||
|
||||
|
@ -201,7 +201,7 @@ void Kernel::releaseMutex(Mutex* moo) {
|
|||
}
|
||||
}
|
||||
|
||||
Handle Kernel::makeSemaphore(u32 initialCount, u32 maximumCount) {
|
||||
HorizonHandle Kernel::makeSemaphore(u32 initialCount, u32 maximumCount) {
|
||||
Handle ret = makeObject(KernelObjectType::Semaphore);
|
||||
objects[ret].data = new Semaphore(initialCount, maximumCount);
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "kernel.hpp"
|
||||
#include "scheduler.hpp"
|
||||
|
||||
Handle Kernel::makeTimer(ResetType type) {
|
||||
HorizonHandle Kernel::makeTimer(ResetType type) {
|
||||
Handle ret = makeObject(KernelObjectType::Timer);
|
||||
objects[ret].data = new Timer(type);
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ ArchiveBase* FSService::getArchiveFromID(u32 id, const FSPath& archivePath) {
|
|||
}
|
||||
}
|
||||
|
||||
std::optional<Handle> FSService::openFileHandle(ArchiveBase* archive, const FSPath& path, const FSPath& archivePath, const FilePerms& perms) {
|
||||
std::optional<HorizonHandle> FSService::openFileHandle(ArchiveBase* archive, const FSPath& path, const FSPath& archivePath, const FilePerms& perms) {
|
||||
FileDescriptor opened = archive->openFile(path, perms);
|
||||
if (opened.has_value()) { // If opened doesn't have a value, we failed to open the file
|
||||
auto handle = kernel.makeObject(KernelObjectType::File);
|
||||
|
@ -119,7 +119,7 @@ std::optional<Handle> FSService::openFileHandle(ArchiveBase* archive, const FSPa
|
|||
}
|
||||
}
|
||||
|
||||
Rust::Result<Handle, Result::HorizonResult> FSService::openDirectoryHandle(ArchiveBase* archive, const FSPath& path) {
|
||||
Rust::Result<HorizonHandle, Result::HorizonResult> FSService::openDirectoryHandle(ArchiveBase* archive, const FSPath& path) {
|
||||
Rust::Result<DirectorySession, Result::HorizonResult> opened = archive->openDirectory(path);
|
||||
if (opened.isOk()) { // If opened doesn't have a value, we failed to open the directory
|
||||
auto handle = kernel.makeObject(KernelObjectType::Directory);
|
||||
|
@ -132,7 +132,7 @@ Rust::Result<Handle, Result::HorizonResult> FSService::openDirectoryHandle(Archi
|
|||
}
|
||||
}
|
||||
|
||||
Rust::Result<Handle, Result::HorizonResult> FSService::openArchiveHandle(u32 archiveID, const FSPath& path) {
|
||||
Rust::Result<HorizonHandle, Result::HorizonResult> FSService::openArchiveHandle(u32 archiveID, const FSPath& path) {
|
||||
ArchiveBase* archive = getArchiveFromID(archiveID, path);
|
||||
|
||||
if (archive == nullptr) [[unlikely]] {
|
||||
|
|
|
@ -93,7 +93,7 @@ void ServiceManager::registerClient(u32 messagePointer) {
|
|||
}
|
||||
|
||||
// clang-format off
|
||||
static std::map<std::string, Handle> serviceMap = {
|
||||
static std::map<std::string, HorizonHandle> serviceMap = {
|
||||
{ "ac:u", KernelHandles::AC },
|
||||
{ "act:a", KernelHandles::ACT },
|
||||
{ "act:u", KernelHandles::ACT },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue