mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-06 06:05:40 +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
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -73,3 +73,6 @@
|
||||||
[submodule "third_party/hips"]
|
[submodule "third_party/hips"]
|
||||||
path = third_party/hips
|
path = third_party/hips
|
||||||
url = https://github.com/wheremyfoodat/Hips
|
url = https://github.com/wheremyfoodat/Hips
|
||||||
|
[submodule "third_party/metal-cpp"]
|
||||||
|
path = third_party/metal-cpp
|
||||||
|
url = https://github.com/Panda3DS-emu/metal-cpp
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "helpers.hpp"
|
#include "helpers.hpp"
|
||||||
|
|
||||||
using Handle = u32;
|
using HorizonHandle = u32;
|
||||||
|
|
||||||
namespace KernelHandles {
|
namespace KernelHandles {
|
||||||
enum : u32 {
|
enum : u32 {
|
||||||
|
@ -61,17 +61,17 @@ namespace KernelHandles {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Returns whether "handle" belongs to one of the OS services
|
// Returns whether "handle" belongs to one of the OS services
|
||||||
static constexpr bool isServiceHandle(Handle handle) {
|
static constexpr bool isServiceHandle(HorizonHandle handle) {
|
||||||
return handle >= MinServiceHandle && handle <= MaxServiceHandle;
|
return handle >= MinServiceHandle && handle <= MaxServiceHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns whether "handle" belongs to one of the OS services' shared memory areas
|
// Returns whether "handle" belongs to one of the OS services' shared memory areas
|
||||||
static constexpr bool isSharedMemHandle(Handle handle) {
|
static constexpr bool isSharedMemHandle(HorizonHandle handle) {
|
||||||
return handle >= MinSharedMemHandle && handle <= MaxSharedMemHandle;
|
return handle >= MinSharedMemHandle && handle <= MaxSharedMemHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the name of a handle as a string based on the given handle
|
// Returns the name of a handle as a string based on the given handle
|
||||||
static const char* getServiceName(Handle handle) {
|
static const char* getServiceName(HorizonHandle handle) {
|
||||||
switch (handle) {
|
switch (handle) {
|
||||||
case AC: return "AC";
|
case AC: return "AC";
|
||||||
case ACT: return "ACT";
|
case ACT: return "ACT";
|
||||||
|
|
|
@ -18,6 +18,8 @@ class CPU;
|
||||||
struct Scheduler;
|
struct Scheduler;
|
||||||
|
|
||||||
class Kernel {
|
class Kernel {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
std::span<u32, 16> regs;
|
std::span<u32, 16> regs;
|
||||||
CPU& cpu;
|
CPU& cpu;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
|
|
|
@ -47,7 +47,7 @@ enum class ProcessorID : s32 {
|
||||||
struct AddressArbiter {};
|
struct AddressArbiter {};
|
||||||
|
|
||||||
struct ResourceLimits {
|
struct ResourceLimits {
|
||||||
Handle handle;
|
HorizonHandle handle;
|
||||||
|
|
||||||
s32 currentCommit = 0;
|
s32 currentCommit = 0;
|
||||||
};
|
};
|
||||||
|
@ -91,6 +91,8 @@ struct Port {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Session {
|
struct Session {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle portHandle; // The port this session is subscribed to
|
Handle portHandle; // The port this session is subscribed to
|
||||||
Session(Handle portHandle) : portHandle(portHandle) {}
|
Session(Handle portHandle) : portHandle(portHandle) {}
|
||||||
};
|
};
|
||||||
|
@ -109,6 +111,8 @@ enum class ThreadStatus {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Thread {
|
struct Thread {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
u32 initialSP; // Initial r13 value
|
u32 initialSP; // Initial r13 value
|
||||||
u32 entrypoint; // Initial r15 value
|
u32 entrypoint; // Initial r15 value
|
||||||
u32 priority;
|
u32 priority;
|
||||||
|
@ -161,6 +165,8 @@ static const char* kernelObjectTypeToString(KernelObjectType t) {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Mutex {
|
struct Mutex {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
u64 waitlist; // Refer to the getWaitlist function below for documentation
|
u64 waitlist; // Refer to the getWaitlist function below for documentation
|
||||||
Handle ownerThread = 0; // Index of the thread that holds the mutex if it's locked
|
Handle ownerThread = 0; // Index of the thread that holds the mutex if it's locked
|
||||||
Handle handle; // Handle of the mutex itself
|
Handle handle; // Handle of the mutex itself
|
||||||
|
@ -203,6 +209,8 @@ struct MemoryBlock {
|
||||||
|
|
||||||
// Generic kernel object class
|
// Generic kernel object class
|
||||||
struct KernelObject {
|
struct KernelObject {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = 0; // A u32 the OS will use to identify objects
|
Handle handle = 0; // A u32 the OS will use to identify objects
|
||||||
void* data = nullptr;
|
void* data = nullptr;
|
||||||
KernelObjectType type;
|
KernelObjectType type;
|
||||||
|
|
|
@ -102,6 +102,8 @@ namespace KernelMemoryTypes {
|
||||||
}
|
}
|
||||||
|
|
||||||
class Memory {
|
class Memory {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
u8* fcram;
|
u8* fcram;
|
||||||
u8* dspRam; // Provided to us by Audio
|
u8* dspRam; // Provided to us by Audio
|
||||||
u8* vram; // Provided to the memory class by the GPU class
|
u8* vram; // Provided to the memory class by the GPU class
|
||||||
|
@ -213,8 +215,14 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class BatteryLevel {
|
enum class BatteryLevel {
|
||||||
Empty = 0, AlmostEmpty, OneBar, TwoBars, ThreeBars, FourBars
|
Empty = 0,
|
||||||
|
AlmostEmpty,
|
||||||
|
OneBar,
|
||||||
|
TwoBars,
|
||||||
|
ThreeBars,
|
||||||
|
FourBars,
|
||||||
};
|
};
|
||||||
|
|
||||||
u8 getBatteryState(bool adapterConnected, bool charging, BatteryLevel batteryLevel) {
|
u8 getBatteryState(bool adapterConnected, bool charging, BatteryLevel batteryLevel) {
|
||||||
u8 value = static_cast<u8>(batteryLevel) << 2; // Bits 2:4 are the battery level from 0 to 5
|
u8 value = static_cast<u8>(batteryLevel) << 2; // Bits 2:4 are the battery level from 0 to 5
|
||||||
if (adapterConnected) value |= 1 << 0; // Bit 0 shows if the charger is connected
|
if (adapterConnected) value |= 1 << 0; // Bit 0 shows if the charger is connected
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include "result/result.hpp"
|
#include "result/result.hpp"
|
||||||
|
|
||||||
class ACService {
|
class ACService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::AC;
|
Handle handle = KernelHandles::AC;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
MAKE_LOG_FUNCTION(log, acLogger)
|
MAKE_LOG_FUNCTION(log, acLogger)
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include "result/result.hpp"
|
#include "result/result.hpp"
|
||||||
|
|
||||||
class ACTService {
|
class ACTService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::ACT;
|
Handle handle = KernelHandles::ACT;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
MAKE_LOG_FUNCTION(log, actLogger)
|
MAKE_LOG_FUNCTION(log, actLogger)
|
||||||
|
@ -15,7 +17,7 @@ class ACTService {
|
||||||
void generateUUID(u32 messagePointer);
|
void generateUUID(u32 messagePointer);
|
||||||
void getAccountDataBlock(u32 messagePointer);
|
void getAccountDataBlock(u32 messagePointer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ACTService(Memory& mem) : mem(mem) {}
|
ACTService(Memory& mem) : mem(mem) {}
|
||||||
void reset();
|
void reset();
|
||||||
void handleSyncRequest(u32 messagePointer);
|
void handleSyncRequest(u32 messagePointer);
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include "result/result.hpp"
|
#include "result/result.hpp"
|
||||||
|
|
||||||
class AMService {
|
class AMService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::AM;
|
Handle handle = KernelHandles::AM;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
MAKE_LOG_FUNCTION(log, amLogger)
|
MAKE_LOG_FUNCTION(log, amLogger)
|
||||||
|
@ -15,7 +17,7 @@ class AMService {
|
||||||
void getPatchTitleInfo(u32 messagePointer);
|
void getPatchTitleInfo(u32 messagePointer);
|
||||||
void listTitleInfo(u32 messagePointer);
|
void listTitleInfo(u32 messagePointer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AMService(Memory& mem) : mem(mem) {}
|
AMService(Memory& mem) : mem(mem) {}
|
||||||
void reset();
|
void reset();
|
||||||
void handleSyncRequest(u32 messagePointer);
|
void handleSyncRequest(u32 messagePointer);
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
class Kernel;
|
class Kernel;
|
||||||
|
|
||||||
enum class ConsoleModel : u32 {
|
enum class ConsoleModel : u32 {
|
||||||
Old3DS, New3DS
|
Old3DS,
|
||||||
|
New3DS,
|
||||||
};
|
};
|
||||||
|
|
||||||
// https://www.3dbrew.org/wiki/NS_and_APT_Services#Command
|
// https://www.3dbrew.org/wiki/NS_and_APT_Services#Command
|
||||||
|
@ -41,6 +42,8 @@ namespace APT::Transitions {
|
||||||
}
|
}
|
||||||
|
|
||||||
class APTService {
|
class APTService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::APT;
|
Handle handle = KernelHandles::APT;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
Kernel& kernel;
|
Kernel& kernel;
|
||||||
|
@ -99,7 +102,7 @@ class APTService {
|
||||||
|
|
||||||
u32 screencapPostPermission;
|
u32 screencapPostPermission;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
APTService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel), appletManager(mem) {}
|
APTService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel), appletManager(mem) {}
|
||||||
void reset();
|
void reset();
|
||||||
void handleSyncRequest(u32 messagePointer);
|
void handleSyncRequest(u32 messagePointer);
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include "result/result.hpp"
|
#include "result/result.hpp"
|
||||||
|
|
||||||
class BOSSService {
|
class BOSSService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::BOSS;
|
Handle handle = KernelHandles::BOSS;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
MAKE_LOG_FUNCTION(log, bossLogger)
|
MAKE_LOG_FUNCTION(log, bossLogger)
|
||||||
|
@ -17,7 +19,7 @@ class BOSSService {
|
||||||
void getNewArrivalFlag(u32 messagePointer);
|
void getNewArrivalFlag(u32 messagePointer);
|
||||||
void getNsDataIdList(u32 messagePointer, u32 commandWord);
|
void getNsDataIdList(u32 messagePointer, u32 commandWord);
|
||||||
void getOptoutFlag(u32 messagePointer);
|
void getOptoutFlag(u32 messagePointer);
|
||||||
void getStorageEntryInfo(u32 messagePointer); // Unknown what this is, name taken from Citra
|
void getStorageEntryInfo(u32 messagePointer); // Unknown what this is, name taken from Citra
|
||||||
void getTaskIdList(u32 messagePointer);
|
void getTaskIdList(u32 messagePointer);
|
||||||
void getTaskInfo(u32 messagePointer);
|
void getTaskInfo(u32 messagePointer);
|
||||||
void getTaskServiceStatus(u32 messagePointer);
|
void getTaskServiceStatus(u32 messagePointer);
|
||||||
|
@ -35,7 +37,8 @@ class BOSSService {
|
||||||
void unregisterTask(u32 messagePointer);
|
void unregisterTask(u32 messagePointer);
|
||||||
|
|
||||||
s8 optoutFlag;
|
s8 optoutFlag;
|
||||||
public:
|
|
||||||
|
public:
|
||||||
BOSSService(Memory& mem) : mem(mem) {}
|
BOSSService(Memory& mem) : mem(mem) {}
|
||||||
void reset();
|
void reset();
|
||||||
void handleSyncRequest(u32 messagePointer);
|
void handleSyncRequest(u32 messagePointer);
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
class Kernel;
|
class Kernel;
|
||||||
|
|
||||||
class CAMService {
|
class CAMService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
using Event = std::optional<Handle>;
|
using Event = std::optional<Handle>;
|
||||||
|
|
||||||
struct Port {
|
struct Port {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
#include "helpers.hpp"
|
#include "helpers.hpp"
|
||||||
#include "kernel_types.hpp"
|
#include "kernel_types.hpp"
|
||||||
#include "logger.hpp"
|
#include "logger.hpp"
|
||||||
|
@ -9,6 +10,8 @@
|
||||||
class Kernel;
|
class Kernel;
|
||||||
|
|
||||||
class CECDService {
|
class CECDService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::CECD;
|
Handle handle = KernelHandles::CECD;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
Kernel& kernel;
|
Kernel& kernel;
|
||||||
|
@ -20,7 +23,7 @@ class CECDService {
|
||||||
void getInfoEventHandle(u32 messagePointer);
|
void getInfoEventHandle(u32 messagePointer);
|
||||||
void openAndRead(u32 messagePointer);
|
void openAndRead(u32 messagePointer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CECDService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel) {}
|
CECDService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel) {}
|
||||||
void reset();
|
void reset();
|
||||||
void handleSyncRequest(u32 messagePointer);
|
void handleSyncRequest(u32 messagePointer);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "helpers.hpp"
|
#include "helpers.hpp"
|
||||||
#include "logger.hpp"
|
#include "logger.hpp"
|
||||||
#include "memory.hpp"
|
#include "memory.hpp"
|
||||||
|
@ -7,8 +8,10 @@
|
||||||
#include "result/result.hpp"
|
#include "result/result.hpp"
|
||||||
|
|
||||||
class CFGService {
|
class CFGService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
CountryCodes country = CountryCodes::US; // Default to USA
|
CountryCodes country = CountryCodes::US; // Default to USA
|
||||||
MAKE_LOG_FUNCTION(log, cfgLogger)
|
MAKE_LOG_FUNCTION(log, cfgLogger)
|
||||||
|
|
||||||
void writeStringU16(u32 pointer, const std::u16string& string);
|
void writeStringU16(u32 pointer, const std::u16string& string);
|
||||||
|
@ -27,12 +30,12 @@ class CFGService {
|
||||||
|
|
||||||
void getConfigInfo(u32 output, u32 blockID, u32 size, u32 permissionMask);
|
void getConfigInfo(u32 output, u32 blockID, u32 size, u32 permissionMask);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum class Type {
|
enum class Type {
|
||||||
U, // cfg:u
|
U, // cfg:u
|
||||||
I, // cfg:i
|
I, // cfg:i
|
||||||
S, // cfg:s
|
S, // cfg:s
|
||||||
NOR, // cfg:nor
|
NOR, // cfg:nor
|
||||||
};
|
};
|
||||||
|
|
||||||
CFGService(Memory& mem) : mem(mem) {}
|
CFGService(Memory& mem) : mem(mem) {}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
class Kernel;
|
class Kernel;
|
||||||
|
|
||||||
class CSNDService {
|
class CSNDService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::CSND;
|
Handle handle = KernelHandles::CSND;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
Kernel& kernel;
|
Kernel& kernel;
|
||||||
|
@ -30,7 +32,5 @@ class CSNDService {
|
||||||
void reset();
|
void reset();
|
||||||
void handleSyncRequest(u32 messagePointer);
|
void handleSyncRequest(u32 messagePointer);
|
||||||
|
|
||||||
void setSharedMemory(u8* ptr) {
|
void setSharedMemory(u8* ptr) { sharedMemory = ptr; }
|
||||||
sharedMemory = ptr;
|
|
||||||
}
|
|
||||||
};
|
};
|
|
@ -8,6 +8,8 @@
|
||||||
// Please forgive me for how everything in this file is named
|
// Please forgive me for how everything in this file is named
|
||||||
// "dlp:SRVR" is not a nice name to work with
|
// "dlp:SRVR" is not a nice name to work with
|
||||||
class DlpSrvrService {
|
class DlpSrvrService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::DLP_SRVR;
|
Handle handle = KernelHandles::DLP_SRVR;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
MAKE_LOG_FUNCTION(log, dlpSrvrLogger)
|
MAKE_LOG_FUNCTION(log, dlpSrvrLogger)
|
||||||
|
@ -15,7 +17,7 @@ class DlpSrvrService {
|
||||||
// Service commands
|
// Service commands
|
||||||
void isChild(u32 messagePointer);
|
void isChild(u32 messagePointer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DlpSrvrService(Memory& mem) : mem(mem) {}
|
DlpSrvrService(Memory& mem) : mem(mem) {}
|
||||||
void reset();
|
void reset();
|
||||||
void handleSyncRequest(u32 messagePointer);
|
void handleSyncRequest(u32 messagePointer);
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
class Kernel;
|
class Kernel;
|
||||||
|
|
||||||
class DSPService {
|
class DSPService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::DSP;
|
Handle handle = KernelHandles::DSP;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
Kernel& kernel;
|
Kernel& kernel;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "helpers.hpp"
|
#include "helpers.hpp"
|
||||||
#include "kernel_types.hpp"
|
#include "kernel_types.hpp"
|
||||||
#include "logger.hpp"
|
#include "logger.hpp"
|
||||||
|
@ -15,6 +16,8 @@ struct FriendKey {
|
||||||
static_assert(sizeof(FriendKey) == 16);
|
static_assert(sizeof(FriendKey) == 16);
|
||||||
|
|
||||||
class FRDService {
|
class FRDService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
MAKE_LOG_FUNCTION(log, frdLogger)
|
MAKE_LOG_FUNCTION(log, frdLogger)
|
||||||
|
|
||||||
|
@ -51,11 +54,11 @@ class FRDService {
|
||||||
};
|
};
|
||||||
static_assert(sizeof(Profile) == 8);
|
static_assert(sizeof(Profile) == 8);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum class Type {
|
enum class Type {
|
||||||
A, // frd:a
|
A, // frd:a
|
||||||
N, // frd:n
|
N, // frd:n
|
||||||
U, // frd:u
|
U, // frd:u
|
||||||
};
|
};
|
||||||
|
|
||||||
FRDService(Memory& mem) : mem(mem) {}
|
FRDService(Memory& mem) : mem(mem) {}
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
class Kernel;
|
class Kernel;
|
||||||
|
|
||||||
class FSService {
|
class FSService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::FS;
|
Handle handle = KernelHandles::FS;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
Kernel& kernel;
|
Kernel& kernel;
|
||||||
|
@ -81,7 +83,7 @@ class FSService {
|
||||||
// Used for set/get priority: Not sure what sort of priority this is referring to
|
// Used for set/get priority: Not sure what sort of priority this is referring to
|
||||||
u32 priority;
|
u32 priority;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FSService(Memory& mem, Kernel& kernel, const EmulatorConfig& config)
|
FSService(Memory& mem, Kernel& kernel, const EmulatorConfig& config)
|
||||||
: mem(mem), saveData(mem), sharedExtSaveData_nand(mem, "../SharedFiles/NAND", true), extSaveData_sdmc(mem, "SDMC"), sdmc(mem),
|
: mem(mem), saveData(mem), sharedExtSaveData_nand(mem, "../SharedFiles/NAND", true), extSaveData_sdmc(mem, "SDMC"), sdmc(mem),
|
||||||
sdmcWriteOnly(mem, true), selfNcch(mem), ncch(mem), userSaveData1(mem, ArchiveID::UserSaveData1),
|
sdmcWriteOnly(mem, true), selfNcch(mem), ncch(mem), userSaveData1(mem, ArchiveID::UserSaveData1),
|
||||||
|
|
|
@ -22,6 +22,8 @@ enum class GPUInterrupt : u8 {
|
||||||
class Kernel;
|
class Kernel;
|
||||||
|
|
||||||
class GPUService {
|
class GPUService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::GPU;
|
Handle handle = KernelHandles::GPU;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
GPU& gpu;
|
GPU& gpu;
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include "result/result.hpp"
|
#include "result/result.hpp"
|
||||||
|
|
||||||
class LCDService {
|
class LCDService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::LCD;
|
Handle handle = KernelHandles::LCD;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
MAKE_LOG_FUNCTION(log, gspLCDLogger)
|
MAKE_LOG_FUNCTION(log, gspLCDLogger)
|
||||||
|
|
|
@ -38,6 +38,8 @@ namespace HID::Keys {
|
||||||
class Kernel;
|
class Kernel;
|
||||||
|
|
||||||
class HIDService {
|
class HIDService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::HID;
|
Handle handle = KernelHandles::HID;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
Kernel& kernel;
|
Kernel& kernel;
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include "memory.hpp"
|
#include "memory.hpp"
|
||||||
|
|
||||||
class HTTPService {
|
class HTTPService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::HTTP;
|
Handle handle = KernelHandles::HTTP;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
MAKE_LOG_FUNCTION(log, httpLogger)
|
MAKE_LOG_FUNCTION(log, httpLogger)
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
class Kernel;
|
class Kernel;
|
||||||
|
|
||||||
class IRUserService {
|
class IRUserService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
enum class DeviceID : u8 {
|
enum class DeviceID : u8 {
|
||||||
CirclePadPro = 1,
|
CirclePadPro = 1,
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
class Kernel;
|
class Kernel;
|
||||||
|
|
||||||
class LDRService {
|
class LDRService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::LDR_RO;
|
Handle handle = KernelHandles::LDR_RO;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
Kernel& kernel;
|
Kernel& kernel;
|
||||||
|
@ -22,7 +24,7 @@ class LDRService {
|
||||||
void loadCRR(u32 messagePointer);
|
void loadCRR(u32 messagePointer);
|
||||||
void unloadCRO(u32 messagePointer);
|
void unloadCRO(u32 messagePointer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LDRService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel) {}
|
LDRService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel) {}
|
||||||
void reset();
|
void reset();
|
||||||
void handleSyncRequest(u32 messagePointer);
|
void handleSyncRequest(u32 messagePointer);
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
namespace MCU {
|
namespace MCU {
|
||||||
class HWCService {
|
class HWCService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::MCU_HWC;
|
Handle handle = KernelHandles::MCU_HWC;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
MAKE_LOG_FUNCTION(log, mcuLogger)
|
MAKE_LOG_FUNCTION(log, mcuLogger)
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
class Kernel;
|
class Kernel;
|
||||||
|
|
||||||
class MICService {
|
class MICService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::MIC;
|
Handle handle = KernelHandles::MIC;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
Kernel& kernel;
|
Kernel& kernel;
|
||||||
|
@ -29,14 +31,14 @@ class MICService {
|
||||||
void unmapSharedMem(u32 messagePointer);
|
void unmapSharedMem(u32 messagePointer);
|
||||||
void theCaptainToadFunction(u32 messagePointer);
|
void theCaptainToadFunction(u32 messagePointer);
|
||||||
|
|
||||||
u8 gain = 0; // How loud our microphone input signal is
|
u8 gain = 0; // How loud our microphone input signal is
|
||||||
bool micEnabled = false;
|
bool micEnabled = false;
|
||||||
bool shouldClamp = false;
|
bool shouldClamp = false;
|
||||||
bool currentlySampling = false;
|
bool currentlySampling = false;
|
||||||
|
|
||||||
std::optional<Handle> eventHandle;
|
std::optional<Handle> eventHandle;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MICService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel) {}
|
MICService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel) {}
|
||||||
void reset();
|
void reset();
|
||||||
void handleSyncRequest(u32 messagePointer);
|
void handleSyncRequest(u32 messagePointer);
|
||||||
|
|
|
@ -6,7 +6,14 @@
|
||||||
#include "result/result.hpp"
|
#include "result/result.hpp"
|
||||||
|
|
||||||
class NDMService {
|
class NDMService {
|
||||||
enum class ExclusiveState : u32 { None = 0, Infrastructure = 1, LocalComms = 2, StreetPass = 3, StreetPassData = 4 };
|
using Handle = HorizonHandle;
|
||||||
|
enum class ExclusiveState : u32 {
|
||||||
|
None = 0,
|
||||||
|
Infrastructure = 1,
|
||||||
|
LocalComms = 2,
|
||||||
|
StreetPass = 3,
|
||||||
|
StreetPassData = 4,
|
||||||
|
};
|
||||||
|
|
||||||
Handle handle = KernelHandles::NDM;
|
Handle handle = KernelHandles::NDM;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
|
@ -25,7 +32,7 @@ class NDMService {
|
||||||
|
|
||||||
ExclusiveState exclusiveState = ExclusiveState::None;
|
ExclusiveState exclusiveState = ExclusiveState::None;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NDMService(Memory& mem) : mem(mem) {}
|
NDMService(Memory& mem) : mem(mem) {}
|
||||||
void reset();
|
void reset();
|
||||||
void handleSyncRequest(u32 messagePointer);
|
void handleSyncRequest(u32 messagePointer);
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include "memory.hpp"
|
#include "memory.hpp"
|
||||||
|
|
||||||
class NewsUService {
|
class NewsUService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::NEWS_U;
|
Handle handle = KernelHandles::NEWS_U;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
MAKE_LOG_FUNCTION(log, newsLogger)
|
MAKE_LOG_FUNCTION(log, newsLogger)
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
class Kernel;
|
class Kernel;
|
||||||
|
|
||||||
class NFCService {
|
class NFCService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::NFC;
|
Handle handle = KernelHandles::NFC;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
Kernel& kernel;
|
Kernel& kernel;
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include "result/result.hpp"
|
#include "result/result.hpp"
|
||||||
|
|
||||||
class NIMService {
|
class NIMService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::NIM;
|
Handle handle = KernelHandles::NIM;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
MAKE_LOG_FUNCTION(log, nimLogger)
|
MAKE_LOG_FUNCTION(log, nimLogger)
|
||||||
|
@ -13,7 +15,7 @@ class NIMService {
|
||||||
// Service commands
|
// Service commands
|
||||||
void initialize(u32 messagePointer);
|
void initialize(u32 messagePointer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NIMService(Memory& mem) : mem(mem) {}
|
NIMService(Memory& mem) : mem(mem) {}
|
||||||
void reset();
|
void reset();
|
||||||
void handleSyncRequest(u32 messagePointer);
|
void handleSyncRequest(u32 messagePointer);
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
class Kernel;
|
class Kernel;
|
||||||
|
|
||||||
class NwmUdsService {
|
class NwmUdsService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::NWM_UDS;
|
Handle handle = KernelHandles::NWM_UDS;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
Kernel& kernel;
|
Kernel& kernel;
|
||||||
|
|
|
@ -22,7 +22,7 @@ class PTMService {
|
||||||
void getStepHistoryAll(u32 messagePointer);
|
void getStepHistoryAll(u32 messagePointer);
|
||||||
void getTotalStepCount(u32 messagePointer);
|
void getTotalStepCount(u32 messagePointer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum class Type {
|
enum class Type {
|
||||||
U, // ptm:u
|
U, // ptm:u
|
||||||
SYSM, // ptm:sysm
|
SYSM, // ptm:sysm
|
||||||
|
|
|
@ -42,6 +42,8 @@ struct EmulatorConfig;
|
||||||
class Kernel;
|
class Kernel;
|
||||||
|
|
||||||
class ServiceManager {
|
class ServiceManager {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
std::span<u32, 16> regs;
|
std::span<u32, 16> regs;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
Kernel& kernel;
|
Kernel& kernel;
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include "memory.hpp"
|
#include "memory.hpp"
|
||||||
|
|
||||||
class SOCService {
|
class SOCService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::SOC;
|
Handle handle = KernelHandles::SOC;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
MAKE_LOG_FUNCTION(log, socLogger)
|
MAKE_LOG_FUNCTION(log, socLogger)
|
||||||
|
@ -14,7 +16,7 @@ class SOCService {
|
||||||
// Service commands
|
// Service commands
|
||||||
void initializeSockets(u32 messagePointer);
|
void initializeSockets(u32 messagePointer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SOCService(Memory& mem) : mem(mem) {}
|
SOCService(Memory& mem) : mem(mem) {}
|
||||||
void reset();
|
void reset();
|
||||||
void handleSyncRequest(u32 messagePointer);
|
void handleSyncRequest(u32 messagePointer);
|
||||||
|
|
|
@ -1,17 +1,19 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <random>
|
||||||
|
|
||||||
#include "helpers.hpp"
|
#include "helpers.hpp"
|
||||||
#include "kernel_types.hpp"
|
#include "kernel_types.hpp"
|
||||||
#include "logger.hpp"
|
#include "logger.hpp"
|
||||||
#include "memory.hpp"
|
#include "memory.hpp"
|
||||||
|
|
||||||
#include <random>
|
|
||||||
|
|
||||||
class SSLService {
|
class SSLService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::SSL;
|
Handle handle = KernelHandles::SSL;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
MAKE_LOG_FUNCTION(log, sslLogger)
|
MAKE_LOG_FUNCTION(log, sslLogger)
|
||||||
|
|
||||||
std::mt19937 rng; // Use a Mersenne Twister for RNG since this service is supposed to have better rng than just rand()
|
std::mt19937 rng; // Use a Mersenne Twister for RNG since this service is supposed to have better rng than just rand()
|
||||||
bool initialized;
|
bool initialized;
|
||||||
|
|
||||||
// Service commands
|
// Service commands
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
#include "helpers.hpp"
|
#include "helpers.hpp"
|
||||||
#include "kernel_types.hpp"
|
#include "kernel_types.hpp"
|
||||||
#include "logger.hpp"
|
#include "logger.hpp"
|
||||||
|
@ -10,6 +11,8 @@
|
||||||
class Kernel;
|
class Kernel;
|
||||||
|
|
||||||
class Y2RService {
|
class Y2RService {
|
||||||
|
using Handle = HorizonHandle;
|
||||||
|
|
||||||
Handle handle = KernelHandles::Y2R;
|
Handle handle = KernelHandles::Y2R;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
Kernel& kernel;
|
Kernel& kernel;
|
||||||
|
@ -20,7 +23,7 @@ class Y2RService {
|
||||||
|
|
||||||
enum class BusyStatus : u32 {
|
enum class BusyStatus : u32 {
|
||||||
NotBusy = 0,
|
NotBusy = 0,
|
||||||
Busy = 1
|
Busy = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class InputFormat : u32 {
|
enum class InputFormat : u32 {
|
||||||
|
@ -35,7 +38,7 @@ class Y2RService {
|
||||||
RGB32 = 0,
|
RGB32 = 0,
|
||||||
RGB24 = 1,
|
RGB24 = 1,
|
||||||
RGB15 = 2,
|
RGB15 = 2,
|
||||||
RGB565 = 3
|
RGB565 = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Clockwise rotation
|
// Clockwise rotation
|
||||||
|
@ -43,12 +46,12 @@ class Y2RService {
|
||||||
None = 0,
|
None = 0,
|
||||||
Rotate90 = 1,
|
Rotate90 = 1,
|
||||||
Rotate180 = 2,
|
Rotate180 = 2,
|
||||||
Rotate270 = 3
|
Rotate270 = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class BlockAlignment : u32 {
|
enum class BlockAlignment : u32 {
|
||||||
Line = 0, // Output buffer's pixels are arranged linearly. Used when outputting to the framebuffer.
|
Line = 0, // Output buffer's pixels are arranged linearly. Used when outputting to the framebuffer.
|
||||||
Block8x8 = 1, // Output buffer's pixels are morton swizzled. Used when outputting to a GPU texture.
|
Block8x8 = 1, // Output buffer's pixels are morton swizzled. Used when outputting to a GPU texture.
|
||||||
};
|
};
|
||||||
|
|
||||||
// https://github.com/citra-emu/citra/blob/ac9d72a95ca9a60de8d39484a14aecf489d6d016/src/core/hle/service/cam/y2r_u.cpp#L33
|
// https://github.com/citra-emu/citra/blob/ac9d72a95ca9a60de8d39484a14aecf489d6d016/src/core/hle/service/cam/y2r_u.cpp#L33
|
||||||
|
@ -60,7 +63,7 @@ class Y2RService {
|
||||||
{{0x12A, 0x1CA, 0x88, 0x36, 0x21C, -0x1F04, 0x99C, -0x2421}}, // ITU_Rec709_Scaling
|
{{0x12A, 0x1CA, 0x88, 0x36, 0x21C, -0x1F04, 0x99C, -0x2421}}, // ITU_Rec709_Scaling
|
||||||
}};
|
}};
|
||||||
|
|
||||||
CoefficientSet conversionCoefficients; // Current conversion coefficients
|
CoefficientSet conversionCoefficients; // Current conversion coefficients
|
||||||
|
|
||||||
InputFormat inputFmt;
|
InputFormat inputFmt;
|
||||||
OutputFormat outputFmt;
|
OutputFormat outputFmt;
|
||||||
|
|
|
@ -12,7 +12,7 @@ static const char* arbitrationTypeToString(u32 type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle Kernel::makeArbiter() {
|
HorizonHandle Kernel::makeArbiter() {
|
||||||
if (arbiterCount >= appResourceLimits.maxAddressArbiters) {
|
if (arbiterCount >= appResourceLimits.maxAddressArbiters) {
|
||||||
Helpers::panic("Overflowed the number of address arbiters");
|
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);
|
Handle ret = makeObject(KernelObjectType::Event);
|
||||||
objects[ret].data = new Event(resetType, callback);
|
objects[ret].data = new Event(resetType, callback);
|
||||||
return ret;
|
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
|
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 processHandle = makeObject(KernelObjectType::Process);
|
||||||
const Handle resourceLimitHandle = makeObject(KernelObjectType::ResourceLimit);
|
const Handle resourceLimitHandle = makeObject(KernelObjectType::ResourceLimit);
|
||||||
|
|
||||||
|
|
|
@ -154,7 +154,7 @@ void Kernel::mapMemoryBlock() {
|
||||||
regs[0] = Result::Success;
|
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);
|
Handle ret = makeObject(KernelObjectType::MemoryBlock);
|
||||||
objects[ret].data = new MemoryBlock(addr, size, myPermission, otherPermission);
|
objects[ret].data = new MemoryBlock(addr, size, myPermission, otherPermission);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "kernel.hpp"
|
#include "kernel.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
Handle Kernel::makePort(const char* name) {
|
HorizonHandle Kernel::makePort(const char* name) {
|
||||||
Handle ret = makeObject(KernelObjectType::Port);
|
Handle ret = makeObject(KernelObjectType::Port);
|
||||||
portHandles.push_back(ret); // Push the port handle to our cache of port handles
|
portHandles.push_back(ret); // Push the port handle to our cache of port handles
|
||||||
objects[ret].data = new Port(name);
|
objects[ret].data = new Port(name);
|
||||||
|
@ -9,7 +9,7 @@ Handle Kernel::makePort(const char* name) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle Kernel::makeSession(Handle portHandle) {
|
HorizonHandle Kernel::makeSession(Handle portHandle) {
|
||||||
const auto port = getObject(portHandle, KernelObjectType::Port);
|
const auto port = getObject(portHandle, KernelObjectType::Port);
|
||||||
if (port == nullptr) [[unlikely]] {
|
if (port == nullptr) [[unlikely]] {
|
||||||
Helpers::panic("Trying to make session for non-existent port");
|
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
|
// Get the handle of a port based on its name
|
||||||
// If there's no such port, return nullopt
|
// 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) {
|
for (auto handle : portHandles) {
|
||||||
const auto data = objects[handle].getData<Port>();
|
const auto data = objects[handle].getData<Port>();
|
||||||
if (std::strncmp(name, data->name, Port::maxNameLen) == 0) {
|
if (std::strncmp(name, data->name, Port::maxNameLen) == 0) {
|
||||||
|
|
|
@ -109,7 +109,7 @@ void Kernel::rescheduleThreads() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Internal OS function to spawn a thread
|
// 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
|
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
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle Kernel::makeMutex(bool locked) {
|
HorizonHandle Kernel::makeMutex(bool locked) {
|
||||||
Handle ret = makeObject(KernelObjectType::Mutex);
|
Handle ret = makeObject(KernelObjectType::Mutex);
|
||||||
objects[ret].data = new Mutex(locked, ret);
|
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);
|
Handle ret = makeObject(KernelObjectType::Semaphore);
|
||||||
objects[ret].data = new Semaphore(initialCount, maximumCount);
|
objects[ret].data = new Semaphore(initialCount, maximumCount);
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "kernel.hpp"
|
#include "kernel.hpp"
|
||||||
#include "scheduler.hpp"
|
#include "scheduler.hpp"
|
||||||
|
|
||||||
Handle Kernel::makeTimer(ResetType type) {
|
HorizonHandle Kernel::makeTimer(ResetType type) {
|
||||||
Handle ret = makeObject(KernelObjectType::Timer);
|
Handle ret = makeObject(KernelObjectType::Timer);
|
||||||
objects[ret].data = new Timer(type);
|
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);
|
FileDescriptor opened = archive->openFile(path, perms);
|
||||||
if (opened.has_value()) { // If opened doesn't have a value, we failed to open the file
|
if (opened.has_value()) { // If opened doesn't have a value, we failed to open the file
|
||||||
auto handle = kernel.makeObject(KernelObjectType::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);
|
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
|
if (opened.isOk()) { // If opened doesn't have a value, we failed to open the directory
|
||||||
auto handle = kernel.makeObject(KernelObjectType::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);
|
ArchiveBase* archive = getArchiveFromID(archiveID, path);
|
||||||
|
|
||||||
if (archive == nullptr) [[unlikely]] {
|
if (archive == nullptr) [[unlikely]] {
|
||||||
|
|
|
@ -93,7 +93,7 @@ void ServiceManager::registerClient(u32 messagePointer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static std::map<std::string, Handle> serviceMap = {
|
static std::map<std::string, HorizonHandle> serviceMap = {
|
||||||
{ "ac:u", KernelHandles::AC },
|
{ "ac:u", KernelHandles::AC },
|
||||||
{ "act:a", KernelHandles::ACT },
|
{ "act:a", KernelHandles::ACT },
|
||||||
{ "act:u", KernelHandles::ACT },
|
{ "act:u", KernelHandles::ACT },
|
||||||
|
|
1
third_party/metal-cpp
vendored
Submodule
1
third_party/metal-cpp
vendored
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit a63bd172ddcba73a3d87ca32032b66ad41ddb9a6
|
Loading…
Add table
Reference in a new issue