metal: initial support

This commit is contained in:
Samuliak 2024-07-02 08:28:41 +02:00
parent 29d9ed7224
commit f0547d1a71
167 changed files with 28839 additions and 1271 deletions

View file

@ -8,7 +8,7 @@
#include "result/result.hpp"
class ACService {
Handle handle = KernelHandles::AC;
HandleType handle = KernelHandles::AC;
Memory& mem;
MAKE_LOG_FUNCTION(log, acLogger)
@ -25,10 +25,10 @@ class ACService {
void setClientVersion(u32 messagePointer);
bool connected = false;
std::optional<Handle> disconnectEvent = std::nullopt;
std::optional<HandleType> disconnectEvent = std::nullopt;
public:
ACService(Memory& mem) : mem(mem) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};
};

View file

@ -6,7 +6,7 @@
#include "result/result.hpp"
class ACTService {
Handle handle = KernelHandles::ACT;
HandleType handle = KernelHandles::ACT;
Memory& mem;
MAKE_LOG_FUNCTION(log, actLogger)
@ -15,8 +15,8 @@ class ACTService {
void generateUUID(u32 messagePointer);
void getAccountDataBlock(u32 messagePointer);
public:
public:
ACTService(Memory& mem) : mem(mem) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};
};

View file

@ -6,7 +6,7 @@
#include "result/result.hpp"
class AMService {
Handle handle = KernelHandles::AM;
HandleType handle = KernelHandles::AM;
Memory& mem;
MAKE_LOG_FUNCTION(log, amLogger)
@ -15,8 +15,8 @@ class AMService {
void getPatchTitleInfo(u32 messagePointer);
void listTitleInfo(u32 messagePointer);
public:
public:
AMService(Memory& mem) : mem(mem) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};
};

View file

@ -1,19 +1,17 @@
#pragma once
#include <optional>
#include "applets/applet_manager.hpp"
#include "helpers.hpp"
#include "kernel_types.hpp"
#include "logger.hpp"
#include "memory.hpp"
#include "result/result.hpp"
#include "applets/applet_manager.hpp"
// Yay, more circular dependencies
class Kernel;
enum class ConsoleModel : u32 {
Old3DS, New3DS
};
enum class ConsoleModel : u32 { Old3DS, New3DS };
// https://www.3dbrew.org/wiki/NS_and_APT_Services#Command
namespace APT::Transitions {
@ -41,13 +39,13 @@ namespace APT::Transitions {
}
class APTService {
Handle handle = KernelHandles::APT;
HandleType handle = KernelHandles::APT;
Memory& mem;
Kernel& kernel;
std::optional<Handle> lockHandle = std::nullopt;
std::optional<Handle> notificationEvent = std::nullopt;
std::optional<Handle> resumeEvent = std::nullopt;
std::optional<HandleType> lockHandle = std::nullopt;
std::optional<HandleType> notificationEvent = std::nullopt;
std::optional<HandleType> resumeEvent = std::nullopt;
ConsoleModel model = ConsoleModel::Old3DS;
Applets::AppletManager appletManager;
@ -99,8 +97,8 @@ class APTService {
u32 screencapPostPermission;
public:
public:
APTService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel), appletManager(mem) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};
};

View file

@ -6,7 +6,7 @@
#include "result/result.hpp"
class BOSSService {
Handle handle = KernelHandles::BOSS;
HandleType handle = KernelHandles::BOSS;
Memory& mem;
MAKE_LOG_FUNCTION(log, bossLogger)
@ -17,7 +17,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,8 +35,9 @@ class BOSSService {
void unregisterTask(u32 messagePointer);
s8 optoutFlag;
public:
public:
BOSSService(Memory& mem) : mem(mem) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};
};

View file

@ -12,7 +12,7 @@
class Kernel;
class CAMService {
using Event = std::optional<Handle>;
using Event = std::optional<HandleType>;
struct Port {
Event bufferErrorInterruptEvent = std::nullopt;
@ -26,7 +26,7 @@ class CAMService {
}
};
Handle handle = KernelHandles::CAM;
HandleType handle = KernelHandles::CAM;
Memory& mem;
Kernel& kernel;
MAKE_LOG_FUNCTION(log, camLogger)
@ -56,4 +56,4 @@ class CAMService {
CAMService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};
};

View file

@ -1,5 +1,6 @@
#pragma once
#include <optional>
#include "helpers.hpp"
#include "kernel_types.hpp"
#include "logger.hpp"
@ -9,19 +10,19 @@
class Kernel;
class CECDService {
Handle handle = KernelHandles::CECD;
HandleType handle = KernelHandles::CECD;
Memory& mem;
Kernel& kernel;
MAKE_LOG_FUNCTION(log, cecdLogger)
std::optional<Handle> infoEvent;
std::optional<HandleType> infoEvent;
// Service commands
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);
};
};

View file

@ -10,13 +10,13 @@
class Kernel;
class CSNDService {
Handle handle = KernelHandles::CSND;
HandleType handle = KernelHandles::CSND;
Memory& mem;
Kernel& kernel;
MAKE_LOG_FUNCTION(log, csndLogger)
u8* sharedMemory = nullptr;
std::optional<Handle> csndMutex = std::nullopt;
std::optional<HandleType> csndMutex = std::nullopt;
size_t sharedMemSize = 0;
bool initialized = false;
@ -30,7 +30,5 @@ class CSNDService {
void reset();
void handleSyncRequest(u32 messagePointer);
void setSharedMemory(u8* ptr) {
sharedMemory = ptr;
}
};
void setSharedMemory(u8* ptr) { sharedMemory = ptr; }
};

View file

@ -8,15 +8,15 @@
// Please forgive me for how everything in this file is named
// "dlp:SRVR" is not a nice name to work with
class DlpSrvrService {
Handle handle = KernelHandles::DLP_SRVR;
HandleType handle = KernelHandles::DLP_SRVR;
Memory& mem;
MAKE_LOG_FUNCTION(log, dlpSrvrLogger)
// Service commands
void isChild(u32 messagePointer);
public:
public:
DlpSrvrService(Memory& mem) : mem(mem) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};
};

View file

@ -14,7 +14,7 @@
class Kernel;
class DSPService {
Handle handle = KernelHandles::DSP;
HandleType handle = KernelHandles::DSP;
Memory& mem;
Kernel& kernel;
Audio::DSPCore* dsp = nullptr;
@ -24,7 +24,7 @@ class DSPService {
static constexpr size_t pipeCount = 8;
// DSP service event handles
using DSPEvent = std::optional<Handle>;
using DSPEvent = std::optional<HandleType>;
DSPEvent semaphoreEvent;
DSPEvent interrupt0;
@ -82,4 +82,4 @@ class DSPService {
void triggerInterrupt1();
ComponentDumpResult dumpComponent(const std::filesystem::path& path);
};
};

View file

@ -16,7 +16,7 @@
class Kernel;
class FSService {
Handle handle = KernelHandles::FS;
HandleType handle = KernelHandles::FS;
Memory& mem;
Kernel& kernel;
@ -38,9 +38,9 @@ class FSService {
SystemSaveDataArchive systemSaveData;
ArchiveBase* getArchiveFromID(u32 id, const FSPath& archivePath);
Rust::Result<Handle, HorizonResult> openArchiveHandle(u32 archiveID, const FSPath& path);
Rust::Result<Handle, HorizonResult> openDirectoryHandle(ArchiveBase* archive, const FSPath& path);
std::optional<Handle> openFileHandle(ArchiveBase* archive, const FSPath& path, const FSPath& archivePath, const FilePerms& perms);
Rust::Result<HandleType, HorizonResult> openArchiveHandle(u32 archiveID, const FSPath& path);
Rust::Result<HandleType, HorizonResult> openDirectoryHandle(ArchiveBase* archive, const FSPath& path);
std::optional<HandleType> openFileHandle(ArchiveBase* archive, const FSPath& path, const FSPath& archivePath, const FilePerms& perms);
FSPath readPath(u32 type, u32 pointer, u32 size);
const EmulatorConfig& config;
@ -81,7 +81,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),
@ -91,4 +91,4 @@ public:
void handleSyncRequest(u32 messagePointer);
// Creates directories for NAND, ExtSaveData, etc if they don't already exist. Should be executed after loading a new ROM.
void initializeFilesystem();
};
};

View file

@ -1,6 +1,7 @@
#pragma once
#include <cstring>
#include <optional>
#include "PICA/gpu.hpp"
#include "helpers.hpp"
#include "kernel_types.hpp"
@ -9,12 +10,12 @@
#include "result/result.hpp"
enum class GPUInterrupt : u8 {
PSC0 = 0, // Memory fill completed
PSC1 = 1, // ?
VBlank0 = 2, // ?
VBlank1 = 3, // ?
PPF = 4, // Display transfer finished
P3D = 5, // Command list processing finished
PSC0 = 0, // Memory fill completed
PSC1 = 1, // ?
VBlank0 = 2, // ?
VBlank1 = 3, // ?
PPF = 4, // Display transfer finished
P3D = 5, // Command list processing finished
DMA = 6
};
@ -22,17 +23,17 @@ enum class GPUInterrupt : u8 {
class Kernel;
class GPUService {
Handle handle = KernelHandles::GPU;
HandleType handle = KernelHandles::GPU;
Memory& mem;
GPU& gpu;
Kernel& kernel;
u32& currentPID; // Process ID of the current process
u8* sharedMem; // Pointer to GSP shared memory
u32& currentPID; // Process ID of the current process
u8* sharedMem; // Pointer to GSP shared memory
// At any point in time only 1 process has privileges to use rendering functions
// This is the PID of that process
u32 privilegedProcess;
std::optional<Handle> interruptEvent;
std::optional<HandleType> interruptEvent;
// Number of threads registered via RegisterInterruptRelayQueue
u32 gspThreadCount = 0;
@ -62,8 +63,8 @@ class GPUService {
// Used for saving and restoring GPU state via ImportDisplayCaptureInfo
struct CaptureInfo {
u32 leftFramebuffer; // Left framebuffer VA
u32 rightFramebuffer; // Right framebuffer VA (Top screen only)
u32 leftFramebuffer; // Left framebuffer VA
u32 rightFramebuffer; // Right framebuffer VA (Top screen only)
u32 format;
u32 stride;
};
@ -106,15 +107,14 @@ class GPUService {
FramebufferUpdate* getTopFramebufferInfo() { return getFramebufferInfo(0); }
FramebufferUpdate* getBottomFramebufferInfo() { return getFramebufferInfo(1); }
public:
GPUService(Memory& mem, GPU& gpu, Kernel& kernel, u32& currentPID) : mem(mem), gpu(gpu),
kernel(kernel), currentPID(currentPID) {}
public:
GPUService(Memory& mem, GPU& gpu, Kernel& kernel, u32& currentPID) : mem(mem), gpu(gpu), kernel(kernel), currentPID(currentPID) {}
void reset();
void handleSyncRequest(u32 messagePointer);
void requestInterrupt(GPUInterrupt type);
void setSharedMem(u8* ptr) {
sharedMem = ptr;
if (ptr != nullptr) { // Zero-fill shared memory in case the process tries to read stale service data or vice versa
if (ptr != nullptr) { // Zero-fill shared memory in case the process tries to read stale service data or vice versa
std::memset(ptr, 0, 0x1000);
}
}

View file

@ -6,14 +6,14 @@
#include "result/result.hpp"
class LCDService {
Handle handle = KernelHandles::LCD;
HandleType handle = KernelHandles::LCD;
Memory& mem;
MAKE_LOG_FUNCTION(log, gspLCDLogger)
// Service commands
public:
public:
LCDService(Memory& mem) : mem(mem) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};
};

View file

@ -38,7 +38,7 @@ namespace HID::Keys {
class Kernel;
class HIDService {
Handle handle = KernelHandles::HID;
HandleType handle = KernelHandles::HID;
Memory& mem;
Kernel& kernel;
u8* sharedMem = nullptr; // Pointer to HID shared memory
@ -60,7 +60,7 @@ class HIDService {
bool gyroEnabled;
bool touchScreenPressed;
std::array<std::optional<Handle>, 5> events;
std::array<std::optional<HandleType>, 5> events;
MAKE_LOG_FUNCTION(log, hidLogger)
@ -141,9 +141,7 @@ class HIDService {
touchScreenPressed = true;
}
void releaseTouchScreen() {
touchScreenPressed = false;
}
void releaseTouchScreen() { touchScreenPressed = false; }
bool isTouchScreenPressed() { return touchScreenPressed; }
};

View file

@ -5,7 +5,7 @@
#include "memory.hpp"
class HTTPService {
Handle handle = KernelHandles::HTTP;
HandleType handle = KernelHandles::HTTP;
Memory& mem;
MAKE_LOG_FUNCTION(log, httpLogger)
@ -20,4 +20,4 @@ class HTTPService {
HTTPService(Memory& mem) : mem(mem) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};
};

View file

@ -15,7 +15,7 @@ class IRUserService {
CirclePadPro = 1,
};
Handle handle = KernelHandles::IR_USER;
HandleType handle = KernelHandles::IR_USER;
Memory& mem;
Kernel& kernel;
MAKE_LOG_FUNCTION(log, irUserLogger)
@ -29,7 +29,7 @@ class IRUserService {
void requireConnection(u32 messagePointer);
void sendIrnop(u32 messagePointer);
using IREvent = std::optional<Handle>;
using IREvent = std::optional<HandleType>;
IREvent connectionStatusEvent = std::nullopt;
IREvent receiveEvent = std::nullopt;
@ -58,4 +58,4 @@ class IRUserService {
IRUserService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};
};

View file

@ -8,7 +8,7 @@
class Kernel;
class LDRService {
Handle handle = KernelHandles::LDR_RO;
HandleType handle = KernelHandles::LDR_RO;
Memory& mem;
Kernel& kernel;
MAKE_LOG_FUNCTION(log, ldrLogger)
@ -22,8 +22,8 @@ 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);
};
};

View file

@ -7,7 +7,7 @@
namespace MCU {
class HWCService {
Handle handle = KernelHandles::MCU_HWC;
HandleType handle = KernelHandles::MCU_HWC;
Memory& mem;
MAKE_LOG_FUNCTION(log, mcuLogger)
@ -21,4 +21,4 @@ namespace MCU {
void reset();
void handleSyncRequest(u32 messagePointer);
};
} // namespace MCU
} // namespace MCU

View file

@ -9,7 +9,7 @@
class Kernel;
class MICService {
Handle handle = KernelHandles::MIC;
HandleType handle = KernelHandles::MIC;
Memory& mem;
Kernel& kernel;
MAKE_LOG_FUNCTION(log, micLogger)
@ -29,15 +29,15 @@ 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;
std::optional<HandleType> eventHandle;
public:
public:
MICService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};
};

View file

@ -8,7 +8,7 @@
class NDMService {
enum class ExclusiveState : u32 { None = 0, Infrastructure = 1, LocalComms = 2, StreetPass = 3, StreetPassData = 4 };
Handle handle = KernelHandles::NDM;
HandleType handle = KernelHandles::NDM;
Memory& mem;
MAKE_LOG_FUNCTION(log, ndmLogger)
@ -25,8 +25,8 @@ class NDMService {
ExclusiveState exclusiveState = ExclusiveState::None;
public:
public:
NDMService(Memory& mem) : mem(mem) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};
};

View file

@ -5,7 +5,7 @@
#include "memory.hpp"
class NewsUService {
Handle handle = KernelHandles::NEWS_U;
HandleType handle = KernelHandles::NEWS_U;
Memory& mem;
MAKE_LOG_FUNCTION(log, newsLogger)
@ -15,4 +15,4 @@ class NewsUService {
NewsUService(Memory& mem) : mem(mem) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};
};

View file

@ -12,7 +12,7 @@
class Kernel;
class NFCService {
Handle handle = KernelHandles::NFC;
HandleType handle = KernelHandles::NFC;
Memory& mem;
Kernel& kernel;
MAKE_LOG_FUNCTION(log, nfcLogger)
@ -34,7 +34,7 @@ class NFCService {
};
// Kernel events signaled when an NFC tag goes in and out of range respectively
std::optional<Handle> tagInRangeEvent, tagOutOfRangeEvent;
std::optional<HandleType> tagInRangeEvent, tagOutOfRangeEvent;
AmiiboDevice device;
Old3DSAdapterStatus adapterStatus;
@ -63,4 +63,4 @@ class NFCService {
void handleSyncRequest(u32 messagePointer);
bool loadAmiibo(const std::filesystem::path& path);
};
};

View file

@ -6,15 +6,15 @@
#include "result/result.hpp"
class NIMService {
Handle handle = KernelHandles::NIM;
HandleType handle = KernelHandles::NIM;
Memory& mem;
MAKE_LOG_FUNCTION(log, nimLogger)
// Service commands
void initialize(u32 messagePointer);
public:
public:
NIMService(Memory& mem) : mem(mem) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};
};

View file

@ -10,13 +10,13 @@
class Kernel;
class NwmUdsService {
Handle handle = KernelHandles::NWM_UDS;
HandleType handle = KernelHandles::NWM_UDS;
Memory& mem;
Kernel& kernel;
MAKE_LOG_FUNCTION(log, nwmUdsLogger)
bool initialized = false;
std::optional<Handle> eventHandle = std::nullopt;
std::optional<HandleType> eventHandle = std::nullopt;
// Service commands
void initializeWithVersion(u32 messagePointer);
@ -25,4 +25,4 @@ class NwmUdsService {
NwmUdsService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};
};

View file

@ -28,10 +28,10 @@
#include "services/mcu/mcu_hwc.hpp"
#include "services/mic.hpp"
#include "services/ndm.hpp"
#include "services/nwm_uds.hpp"
#include "services/news_u.hpp"
#include "services/nfc.hpp"
#include "services/nim.hpp"
#include "services/nwm_uds.hpp"
#include "services/ptm.hpp"
#include "services/soc.hpp"
#include "services/ssl.hpp"
@ -46,15 +46,15 @@ class ServiceManager {
Memory& mem;
Kernel& kernel;
std::optional<Handle> notificationSemaphore;
std::optional<HandleType> notificationSemaphore;
MAKE_LOG_FUNCTION(log, srvLogger)
ACService ac;
ACService ac;
ACTService act;
AMService am;
AMService am;
APTService apt;
BOSSService boss;
BOSSService boss;
CAMService cam;
CECDService cecd;
CFGService cfg;
@ -74,7 +74,7 @@ class ServiceManager {
NewsUService news_u;
NFCService nfc;
NwmUdsService nwm_uds;
NIMService nim;
NIMService nim;
PTMService ptm;
SOCService soc;
SSLService ssl;
@ -97,7 +97,7 @@ class ServiceManager {
void handleSyncRequest(u32 messagePointer);
// Forward a SendSyncRequest IPC message to the service with the respective handle
void sendCommandToService(u32 messagePointer, Handle handle);
void sendCommandToService(u32 messagePointer, HandleType handle);
// Wrappers for communicating with certain services
void sendGPUInterrupt(GPUInterrupt type) { gsp_gpu.requestInterrupt(type); }

View file

@ -5,7 +5,7 @@
#include "memory.hpp"
class SOCService {
Handle handle = KernelHandles::SOC;
HandleType handle = KernelHandles::SOC;
Memory& mem;
MAKE_LOG_FUNCTION(log, socLogger)
@ -14,8 +14,8 @@ class SOCService {
// Service commands
void initializeSockets(u32 messagePointer);
public:
public:
SOCService(Memory& mem) : mem(mem) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};
};

View file

@ -1,17 +1,17 @@
#pragma once
#include <random>
#include "helpers.hpp"
#include "kernel_types.hpp"
#include "logger.hpp"
#include "memory.hpp"
#include <random>
class SSLService {
Handle handle = KernelHandles::SSL;
HandleType 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
@ -22,4 +22,4 @@ class SSLService {
SSLService(Memory& mem) : mem(mem) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};
};

View file

@ -1,6 +1,7 @@
#pragma once
#include <array>
#include <optional>
#include "helpers.hpp"
#include "kernel_types.hpp"
#include "logger.hpp"
@ -10,18 +11,15 @@
class Kernel;
class Y2RService {
Handle handle = KernelHandles::Y2R;
HandleType handle = KernelHandles::Y2R;
Memory& mem;
Kernel& kernel;
MAKE_LOG_FUNCTION(log, y2rLogger)
std::optional<Handle> transferEndEvent;
std::optional<HandleType> transferEndEvent;
bool transferEndInterruptEnabled;
enum class BusyStatus : u32 {
NotBusy = 0,
Busy = 1
};
enum class BusyStatus : u32 { NotBusy = 0, Busy = 1 };
enum class InputFormat : u32 {
YUV422_Individual8 = 0,
@ -31,24 +29,14 @@ class Y2RService {
YUV422_Batch = 4,
};
enum class OutputFormat : u32 {
RGB32 = 0,
RGB24 = 1,
RGB15 = 2,
RGB565 = 3
};
enum class OutputFormat : u32 { RGB32 = 0, RGB24 = 1, RGB15 = 2, RGB565 = 3 };
// Clockwise rotation
enum class Rotation : u32 {
None = 0,
Rotate90 = 1,
Rotate180 = 2,
Rotate270 = 3
};
enum class Rotation : u32 { None = 0, Rotate90 = 1, Rotate180 = 2, 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 +48,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;
@ -113,8 +101,8 @@ class Y2RService {
void startConversion(u32 messagePointer);
void stopConversion(u32 messagePointer);
public:
public:
Y2RService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};
};