mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-03 12:27:21 +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
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
#include "helpers.hpp"
|
||||
|
||||
using Handle = u32;
|
||||
using HorizonHandle = u32;
|
||||
|
||||
namespace KernelHandles {
|
||||
enum : u32 {
|
||||
|
@ -61,17 +61,17 @@ namespace KernelHandles {
|
|||
};
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// 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) {
|
||||
case AC: return "AC";
|
||||
case ACT: return "ACT";
|
||||
|
|
|
@ -18,6 +18,8 @@ class CPU;
|
|||
struct Scheduler;
|
||||
|
||||
class Kernel {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
std::span<u32, 16> regs;
|
||||
CPU& cpu;
|
||||
Memory& mem;
|
||||
|
|
|
@ -47,7 +47,7 @@ enum class ProcessorID : s32 {
|
|||
struct AddressArbiter {};
|
||||
|
||||
struct ResourceLimits {
|
||||
Handle handle;
|
||||
HorizonHandle handle;
|
||||
|
||||
s32 currentCommit = 0;
|
||||
};
|
||||
|
@ -91,6 +91,8 @@ struct Port {
|
|||
};
|
||||
|
||||
struct Session {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle portHandle; // The port this session is subscribed to
|
||||
Session(Handle portHandle) : portHandle(portHandle) {}
|
||||
};
|
||||
|
@ -109,6 +111,8 @@ enum class ThreadStatus {
|
|||
};
|
||||
|
||||
struct Thread {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
u32 initialSP; // Initial r13 value
|
||||
u32 entrypoint; // Initial r15 value
|
||||
u32 priority;
|
||||
|
@ -161,6 +165,8 @@ static const char* kernelObjectTypeToString(KernelObjectType t) {
|
|||
}
|
||||
|
||||
struct Mutex {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
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 handle; // Handle of the mutex itself
|
||||
|
@ -203,6 +209,8 @@ struct MemoryBlock {
|
|||
|
||||
// Generic kernel object class
|
||||
struct KernelObject {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = 0; // A u32 the OS will use to identify objects
|
||||
void* data = nullptr;
|
||||
KernelObjectType type;
|
||||
|
|
|
@ -102,6 +102,8 @@ namespace KernelMemoryTypes {
|
|||
}
|
||||
|
||||
class Memory {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
u8* fcram;
|
||||
u8* dspRam; // Provided to us by Audio
|
||||
u8* vram; // Provided to the memory class by the GPU class
|
||||
|
@ -213,8 +215,14 @@ private:
|
|||
}
|
||||
|
||||
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 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
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include "result/result.hpp"
|
||||
|
||||
class ACService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::AC;
|
||||
Memory& mem;
|
||||
MAKE_LOG_FUNCTION(log, acLogger)
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include "result/result.hpp"
|
||||
|
||||
class ACTService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::ACT;
|
||||
Memory& mem;
|
||||
MAKE_LOG_FUNCTION(log, actLogger)
|
||||
|
@ -15,7 +17,7 @@ class ACTService {
|
|||
void generateUUID(u32 messagePointer);
|
||||
void getAccountDataBlock(u32 messagePointer);
|
||||
|
||||
public:
|
||||
public:
|
||||
ACTService(Memory& mem) : mem(mem) {}
|
||||
void reset();
|
||||
void handleSyncRequest(u32 messagePointer);
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include "result/result.hpp"
|
||||
|
||||
class AMService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::AM;
|
||||
Memory& mem;
|
||||
MAKE_LOG_FUNCTION(log, amLogger)
|
||||
|
@ -15,7 +17,7 @@ class AMService {
|
|||
void getPatchTitleInfo(u32 messagePointer);
|
||||
void listTitleInfo(u32 messagePointer);
|
||||
|
||||
public:
|
||||
public:
|
||||
AMService(Memory& mem) : mem(mem) {}
|
||||
void reset();
|
||||
void handleSyncRequest(u32 messagePointer);
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
class Kernel;
|
||||
|
||||
enum class ConsoleModel : u32 {
|
||||
Old3DS, New3DS
|
||||
Old3DS,
|
||||
New3DS,
|
||||
};
|
||||
|
||||
// https://www.3dbrew.org/wiki/NS_and_APT_Services#Command
|
||||
|
@ -41,6 +42,8 @@ namespace APT::Transitions {
|
|||
}
|
||||
|
||||
class APTService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::APT;
|
||||
Memory& mem;
|
||||
Kernel& kernel;
|
||||
|
@ -99,7 +102,7 @@ class APTService {
|
|||
|
||||
u32 screencapPostPermission;
|
||||
|
||||
public:
|
||||
public:
|
||||
APTService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel), appletManager(mem) {}
|
||||
void reset();
|
||||
void handleSyncRequest(u32 messagePointer);
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include "result/result.hpp"
|
||||
|
||||
class BOSSService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::BOSS;
|
||||
Memory& mem;
|
||||
MAKE_LOG_FUNCTION(log, bossLogger)
|
||||
|
@ -17,7 +19,7 @@ class BOSSService {
|
|||
void getNewArrivalFlag(u32 messagePointer);
|
||||
void getNsDataIdList(u32 messagePointer, u32 commandWord);
|
||||
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 getTaskInfo(u32 messagePointer);
|
||||
void getTaskServiceStatus(u32 messagePointer);
|
||||
|
@ -35,7 +37,8 @@ class BOSSService {
|
|||
void unregisterTask(u32 messagePointer);
|
||||
|
||||
s8 optoutFlag;
|
||||
public:
|
||||
|
||||
public:
|
||||
BOSSService(Memory& mem) : mem(mem) {}
|
||||
void reset();
|
||||
void handleSyncRequest(u32 messagePointer);
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
class Kernel;
|
||||
|
||||
class CAMService {
|
||||
using Handle = HorizonHandle;
|
||||
using Event = std::optional<Handle>;
|
||||
|
||||
struct Port {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
#include <optional>
|
||||
|
||||
#include "helpers.hpp"
|
||||
#include "kernel_types.hpp"
|
||||
#include "logger.hpp"
|
||||
|
@ -9,6 +10,8 @@
|
|||
class Kernel;
|
||||
|
||||
class CECDService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::CECD;
|
||||
Memory& mem;
|
||||
Kernel& kernel;
|
||||
|
@ -20,7 +23,7 @@ class CECDService {
|
|||
void getInfoEventHandle(u32 messagePointer);
|
||||
void openAndRead(u32 messagePointer);
|
||||
|
||||
public:
|
||||
public:
|
||||
CECDService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel) {}
|
||||
void reset();
|
||||
void handleSyncRequest(u32 messagePointer);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
#include <cstring>
|
||||
|
||||
#include "helpers.hpp"
|
||||
#include "logger.hpp"
|
||||
#include "memory.hpp"
|
||||
|
@ -7,8 +8,10 @@
|
|||
#include "result/result.hpp"
|
||||
|
||||
class CFGService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Memory& mem;
|
||||
CountryCodes country = CountryCodes::US; // Default to USA
|
||||
CountryCodes country = CountryCodes::US; // Default to USA
|
||||
MAKE_LOG_FUNCTION(log, cfgLogger)
|
||||
|
||||
void writeStringU16(u32 pointer, const std::u16string& string);
|
||||
|
@ -27,12 +30,12 @@ class CFGService {
|
|||
|
||||
void getConfigInfo(u32 output, u32 blockID, u32 size, u32 permissionMask);
|
||||
|
||||
public:
|
||||
public:
|
||||
enum class Type {
|
||||
U, // cfg:u
|
||||
I, // cfg:i
|
||||
S, // cfg:s
|
||||
NOR, // cfg:nor
|
||||
U, // cfg:u
|
||||
I, // cfg:i
|
||||
S, // cfg:s
|
||||
NOR, // cfg:nor
|
||||
};
|
||||
|
||||
CFGService(Memory& mem) : mem(mem) {}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
class Kernel;
|
||||
|
||||
class CSNDService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::CSND;
|
||||
Memory& mem;
|
||||
Kernel& kernel;
|
||||
|
@ -30,7 +32,5 @@ class CSNDService {
|
|||
void reset();
|
||||
void handleSyncRequest(u32 messagePointer);
|
||||
|
||||
void setSharedMemory(u8* ptr) {
|
||||
sharedMemory = ptr;
|
||||
}
|
||||
void setSharedMemory(u8* ptr) { sharedMemory = ptr; }
|
||||
};
|
|
@ -8,6 +8,8 @@
|
|||
// Please forgive me for how everything in this file is named
|
||||
// "dlp:SRVR" is not a nice name to work with
|
||||
class DlpSrvrService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::DLP_SRVR;
|
||||
Memory& mem;
|
||||
MAKE_LOG_FUNCTION(log, dlpSrvrLogger)
|
||||
|
@ -15,7 +17,7 @@ class DlpSrvrService {
|
|||
// Service commands
|
||||
void isChild(u32 messagePointer);
|
||||
|
||||
public:
|
||||
public:
|
||||
DlpSrvrService(Memory& mem) : mem(mem) {}
|
||||
void reset();
|
||||
void handleSyncRequest(u32 messagePointer);
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
class Kernel;
|
||||
|
||||
class DSPService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::DSP;
|
||||
Memory& mem;
|
||||
Kernel& kernel;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
#include <cassert>
|
||||
|
||||
#include "helpers.hpp"
|
||||
#include "kernel_types.hpp"
|
||||
#include "logger.hpp"
|
||||
|
@ -15,6 +16,8 @@ struct FriendKey {
|
|||
static_assert(sizeof(FriendKey) == 16);
|
||||
|
||||
class FRDService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Memory& mem;
|
||||
MAKE_LOG_FUNCTION(log, frdLogger)
|
||||
|
||||
|
@ -51,11 +54,11 @@ class FRDService {
|
|||
};
|
||||
static_assert(sizeof(Profile) == 8);
|
||||
|
||||
public:
|
||||
public:
|
||||
enum class Type {
|
||||
A, // frd:a
|
||||
N, // frd:n
|
||||
U, // frd:u
|
||||
A, // frd:a
|
||||
N, // frd:n
|
||||
U, // frd:u
|
||||
};
|
||||
|
||||
FRDService(Memory& mem) : mem(mem) {}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
class Kernel;
|
||||
|
||||
class FSService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::FS;
|
||||
Memory& mem;
|
||||
Kernel& kernel;
|
||||
|
@ -81,7 +83,7 @@ class FSService {
|
|||
// Used for set/get priority: Not sure what sort of priority this is referring to
|
||||
u32 priority;
|
||||
|
||||
public:
|
||||
public:
|
||||
FSService(Memory& mem, Kernel& kernel, const EmulatorConfig& config)
|
||||
: 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),
|
||||
|
|
|
@ -22,6 +22,8 @@ enum class GPUInterrupt : u8 {
|
|||
class Kernel;
|
||||
|
||||
class GPUService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::GPU;
|
||||
Memory& mem;
|
||||
GPU& gpu;
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include "result/result.hpp"
|
||||
|
||||
class LCDService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::LCD;
|
||||
Memory& mem;
|
||||
MAKE_LOG_FUNCTION(log, gspLCDLogger)
|
||||
|
|
|
@ -38,6 +38,8 @@ namespace HID::Keys {
|
|||
class Kernel;
|
||||
|
||||
class HIDService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::HID;
|
||||
Memory& mem;
|
||||
Kernel& kernel;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include "memory.hpp"
|
||||
|
||||
class HTTPService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::HTTP;
|
||||
Memory& mem;
|
||||
MAKE_LOG_FUNCTION(log, httpLogger)
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
class Kernel;
|
||||
|
||||
class IRUserService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
enum class DeviceID : u8 {
|
||||
CirclePadPro = 1,
|
||||
};
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
class Kernel;
|
||||
|
||||
class LDRService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::LDR_RO;
|
||||
Memory& mem;
|
||||
Kernel& kernel;
|
||||
|
@ -22,7 +24,7 @@ class LDRService {
|
|||
void loadCRR(u32 messagePointer);
|
||||
void unloadCRO(u32 messagePointer);
|
||||
|
||||
public:
|
||||
public:
|
||||
LDRService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel) {}
|
||||
void reset();
|
||||
void handleSyncRequest(u32 messagePointer);
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
namespace MCU {
|
||||
class HWCService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::MCU_HWC;
|
||||
Memory& mem;
|
||||
MAKE_LOG_FUNCTION(log, mcuLogger)
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
class Kernel;
|
||||
|
||||
class MICService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::MIC;
|
||||
Memory& mem;
|
||||
Kernel& kernel;
|
||||
|
@ -29,14 +31,14 @@ class MICService {
|
|||
void unmapSharedMem(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 shouldClamp = false;
|
||||
bool currentlySampling = false;
|
||||
|
||||
std::optional<Handle> eventHandle;
|
||||
|
||||
public:
|
||||
public:
|
||||
MICService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel) {}
|
||||
void reset();
|
||||
void handleSyncRequest(u32 messagePointer);
|
||||
|
|
|
@ -6,7 +6,14 @@
|
|||
#include "result/result.hpp"
|
||||
|
||||
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;
|
||||
Memory& mem;
|
||||
|
@ -25,7 +32,7 @@ class NDMService {
|
|||
|
||||
ExclusiveState exclusiveState = ExclusiveState::None;
|
||||
|
||||
public:
|
||||
public:
|
||||
NDMService(Memory& mem) : mem(mem) {}
|
||||
void reset();
|
||||
void handleSyncRequest(u32 messagePointer);
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include "memory.hpp"
|
||||
|
||||
class NewsUService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::NEWS_U;
|
||||
Memory& mem;
|
||||
MAKE_LOG_FUNCTION(log, newsLogger)
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
class Kernel;
|
||||
|
||||
class NFCService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::NFC;
|
||||
Memory& mem;
|
||||
Kernel& kernel;
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include "result/result.hpp"
|
||||
|
||||
class NIMService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::NIM;
|
||||
Memory& mem;
|
||||
MAKE_LOG_FUNCTION(log, nimLogger)
|
||||
|
@ -13,7 +15,7 @@ class NIMService {
|
|||
// Service commands
|
||||
void initialize(u32 messagePointer);
|
||||
|
||||
public:
|
||||
public:
|
||||
NIMService(Memory& mem) : mem(mem) {}
|
||||
void reset();
|
||||
void handleSyncRequest(u32 messagePointer);
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
class Kernel;
|
||||
|
||||
class NwmUdsService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::NWM_UDS;
|
||||
Memory& mem;
|
||||
Kernel& kernel;
|
||||
|
|
|
@ -22,7 +22,7 @@ class PTMService {
|
|||
void getStepHistoryAll(u32 messagePointer);
|
||||
void getTotalStepCount(u32 messagePointer);
|
||||
|
||||
public:
|
||||
public:
|
||||
enum class Type {
|
||||
U, // ptm:u
|
||||
SYSM, // ptm:sysm
|
||||
|
|
|
@ -42,6 +42,8 @@ struct EmulatorConfig;
|
|||
class Kernel;
|
||||
|
||||
class ServiceManager {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
std::span<u32, 16> regs;
|
||||
Memory& mem;
|
||||
Kernel& kernel;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include "memory.hpp"
|
||||
|
||||
class SOCService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::SOC;
|
||||
Memory& mem;
|
||||
MAKE_LOG_FUNCTION(log, socLogger)
|
||||
|
@ -14,7 +16,7 @@ class SOCService {
|
|||
// Service commands
|
||||
void initializeSockets(u32 messagePointer);
|
||||
|
||||
public:
|
||||
public:
|
||||
SOCService(Memory& mem) : mem(mem) {}
|
||||
void reset();
|
||||
void handleSyncRequest(u32 messagePointer);
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
#pragma once
|
||||
#include <random>
|
||||
|
||||
#include "helpers.hpp"
|
||||
#include "kernel_types.hpp"
|
||||
#include "logger.hpp"
|
||||
#include "memory.hpp"
|
||||
|
||||
#include <random>
|
||||
|
||||
class SSLService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::SSL;
|
||||
Memory& mem;
|
||||
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;
|
||||
|
||||
// Service commands
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
#include <array>
|
||||
#include <optional>
|
||||
|
||||
#include "helpers.hpp"
|
||||
#include "kernel_types.hpp"
|
||||
#include "logger.hpp"
|
||||
|
@ -10,6 +11,8 @@
|
|||
class Kernel;
|
||||
|
||||
class Y2RService {
|
||||
using Handle = HorizonHandle;
|
||||
|
||||
Handle handle = KernelHandles::Y2R;
|
||||
Memory& mem;
|
||||
Kernel& kernel;
|
||||
|
@ -20,7 +23,7 @@ class Y2RService {
|
|||
|
||||
enum class BusyStatus : u32 {
|
||||
NotBusy = 0,
|
||||
Busy = 1
|
||||
Busy = 1,
|
||||
};
|
||||
|
||||
enum class InputFormat : u32 {
|
||||
|
@ -35,7 +38,7 @@ class Y2RService {
|
|||
RGB32 = 0,
|
||||
RGB24 = 1,
|
||||
RGB15 = 2,
|
||||
RGB565 = 3
|
||||
RGB565 = 3,
|
||||
};
|
||||
|
||||
// Clockwise rotation
|
||||
|
@ -43,12 +46,12 @@ class Y2RService {
|
|||
None = 0,
|
||||
Rotate90 = 1,
|
||||
Rotate180 = 2,
|
||||
Rotate270 = 3
|
||||
Rotate270 = 3,
|
||||
};
|
||||
|
||||
enum class BlockAlignment : u32 {
|
||||
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.
|
||||
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.
|
||||
};
|
||||
|
||||
// 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
|
||||
}};
|
||||
|
||||
CoefficientSet conversionCoefficients; // Current conversion coefficients
|
||||
CoefficientSet conversionCoefficients; // Current conversion coefficients
|
||||
|
||||
InputFormat inputFmt;
|
||||
OutputFormat outputFmt;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue