From 794a5a4174976967f38a70bcee5e4ad523f5f640 Mon Sep 17 00:00:00 2001 From: Kostas Missos Date: Tue, 6 Mar 2018 18:56:57 +0200 Subject: [PATCH] [irs] Name image transfer config variables --- nx/include/switch/services/irs.h | 30 ++++++++++++++++++++---------- nx/source/services/irs.c | 18 +++++++++++------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/nx/include/switch/services/irs.h b/nx/include/switch/services/irs.h index ff0b0ab9..60319ce5 100644 --- a/nx/include/switch/services/irs.h +++ b/nx/include/switch/services/irs.h @@ -26,22 +26,32 @@ typedef struct { } PACKED irsPackedMomentProcessorConfig; typedef struct { - u64 unk_x0; - u32 unk_x8; - u32 unk_xc; - u8 unk_x10; + //exposure controls the sensor's exposure time in microseconds. + u64 exposure; + //irLedsMode controls which group of IR leds is enabled. Can be all, group 1, group 2 or none. + u32 irLeds; + //digitalGain controls the signal's digital gain. + u32 digitalGain; + //negative inverts the captured image. + u8 negative; u8 pad[7]; - u32 unk_x18; + //sensorResolution controls the sensor's resolution. + u32 sensorResolution; } irsImageTransferProcessorConfig; typedef struct { - u64 unk_x0; - u8 unk_x8; - u8 unk_x9; - u8 unk_xa; + //exposure controls the sensor's exposure time in microseconds. + u64 exposure; + //irLedsMode controls which group of IR leds is enabled. Can be all, group 1, group 2 or none. + u8 irLeds; + //digitalGain controls the signal's digital gain. + u8 digitalGain; + //negative inverts the captured image. + u8 negative; u8 pad[5]; u32 unk_constant;//offset 0x10 - u8 unk_x14; + //sensorResolution controls the sensor's resolution. + u8 sensorResolution; u8 pad2[3]; } irsPackedImageTransferProcessorConfig; diff --git a/nx/source/services/irs.c b/nx/source/services/irs.c index 51230972..8bbf8ffe 100644 --- a/nx/source/services/irs.c +++ b/nx/source/services/irs.c @@ -334,12 +334,12 @@ Result irsRunImageTransferProcessor(u32 IrCameraHandle, irsImageTransferProcesso memset(&packed_config, 0, sizeof(packed_config)); - packed_config.unk_x0 = config->unk_x0; - packed_config.unk_x8 = config->unk_x8; - packed_config.unk_x9 = config->unk_xc; - packed_config.unk_xa = config->unk_x10; + packed_config.exposure = config->exposure; + packed_config.irLeds = config->irLeds; + packed_config.digitalGain = config->digitalGain; + packed_config.negative = config->negative; packed_config.unk_constant = 0xa0003; - packed_config.unk_x14 = config->unk_x18; + packed_config.sensorResolution = config->sensorResolution; rc = appletGetAppletResourceUserId(&AppletResourceUserId); if (R_FAILED(rc)) @@ -416,8 +416,12 @@ Result irsGetImageTransferProcessorState(u32 IrCameraHandle, void* buffer, size_ void irsGetDefaultImageTransferProcessorConfig(irsImageTransferProcessorConfig *config) { memset(config, 0, sizeof(irsImageTransferProcessorConfig)); - config->unk_x0 = 0x493E0; - config->unk_xc = 0x8; + //Set default exposure 300ms, IR LEDs all ON, 8x digital gain, normal image and resolution 240 x 320. + config->exposure = 300000; + config->irLeds = 0; + config->digitalGain = 8; + config->negative = 0; + config->sensorResolution = 0; } Result irsGetIrCameraHandle(u32 *IrCameraHandle, HidControllerID id) {