mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 20:42:44 +02:00
Add set:cal service with a few cal functions. (#356)
* Add set:cal service with a few functions * Added more cal structs`
This commit is contained in:
parent
d25bcc486a
commit
0881fb9e0b
@ -262,6 +262,128 @@ typedef struct {
|
||||
u32 extra_color; ///< Extra Color.
|
||||
} SetSysHomeMenuScheme;
|
||||
|
||||
typedef struct {
|
||||
u8 offset[0x6];
|
||||
} SetCalAccelerometerOffset;
|
||||
|
||||
typedef struct {
|
||||
u8 scale[0x6];
|
||||
} SetCalAccelerometerScale;
|
||||
|
||||
typedef struct {
|
||||
u8 cert[0x70];
|
||||
} SetCalAmiiboEcdsaCertificate;
|
||||
|
||||
typedef struct {
|
||||
u8 cert[0x20];
|
||||
} SetCalAmiiboEcqvBlsCertificate;
|
||||
|
||||
typedef struct {
|
||||
u8 key[0x44];
|
||||
} SetCalAmiiboEcqvBlsKey;
|
||||
|
||||
typedef struct {
|
||||
u8 cert[0x90];
|
||||
} SetCalAmiiboEcqvBlsRootCertificate;
|
||||
|
||||
typedef struct {
|
||||
u8 cert[0x14];
|
||||
} SetCalAmiiboEcqvCertificate;
|
||||
|
||||
typedef struct {
|
||||
u8 key[0x54];
|
||||
} SetCalAmiiboKey;
|
||||
|
||||
typedef struct {
|
||||
u8 calibration[0x9];
|
||||
} SetCalAnalogStickFactoryCalibration;
|
||||
|
||||
typedef struct {
|
||||
u8 parameter[0x12];
|
||||
} SetCalAnalogStickModelParameter;
|
||||
|
||||
typedef struct {
|
||||
u8 battery_lot[0x18];
|
||||
} SetCalBatteryLot;
|
||||
|
||||
typedef struct {
|
||||
u8 bd_addr[0x6];
|
||||
} SetCalBdAddress;
|
||||
|
||||
typedef struct {
|
||||
u8 cfg[0x1E];
|
||||
} SetCalConfigurationId1;
|
||||
|
||||
typedef struct {
|
||||
u8 offset[0x6];
|
||||
} SetCalConsoleSixAxisSensorHorizontalOffset;
|
||||
|
||||
typedef struct {
|
||||
u32 code[0x4]; ///< Country code.
|
||||
} SetCalCountryCode;
|
||||
|
||||
typedef struct {
|
||||
u32 offset; ///< Relative to current position.
|
||||
u8 cert[0x17C];
|
||||
} SetCalEccB233DeviceCertificate;
|
||||
|
||||
typedef struct {
|
||||
u8 key[0x58];
|
||||
} SetCalEccB233DeviceKey;
|
||||
|
||||
typedef struct {
|
||||
u8 cert[0x400];
|
||||
} SetCalGameCardCertificate;
|
||||
|
||||
typedef struct {
|
||||
u32 size; ///< Size of the entire key.
|
||||
u8 key[0x130];
|
||||
} SetCalGameCardKey;
|
||||
|
||||
typedef struct {
|
||||
u8 offset[0x6];
|
||||
} SetCalGyroscopeOffset;
|
||||
|
||||
typedef struct {
|
||||
u8 scale[0x6];
|
||||
} SetCalGyroscopeScale;
|
||||
|
||||
typedef struct {
|
||||
u8 addr[0x6]; ///< Mac address.
|
||||
} SetCalMacAddress;
|
||||
|
||||
typedef struct {
|
||||
u32 offset; ///< Relative to current position.
|
||||
u8 cert[0x23C];
|
||||
} SetCalRsa2048DeviceCertificate;
|
||||
|
||||
typedef struct {
|
||||
u32 size; ///< Size of the entire key.
|
||||
u8 key[0x240];
|
||||
} SetCalRsa2048DeviceKey;
|
||||
|
||||
typedef struct {
|
||||
u8 number[0x18];
|
||||
} SetCalSerialNumber;
|
||||
|
||||
typedef struct {
|
||||
u8 parameter[0x5A];
|
||||
} SetCalSpeakerParameter;
|
||||
|
||||
typedef struct {
|
||||
u32 size; ///< Size of the certificate data.
|
||||
u8 cert[0x800];
|
||||
} SetCalSslCertificate;
|
||||
|
||||
typedef struct {
|
||||
u32 size; ///< Size of the entire key.
|
||||
u8 key[0x130];
|
||||
} SetCalSslKey;
|
||||
|
||||
typedef struct {
|
||||
u32 code; ///< Region code.
|
||||
} SetCalRegionCode;
|
||||
|
||||
/// Initialize set.
|
||||
Result setInitialize(void);
|
||||
|
||||
@ -885,3 +1007,33 @@ Result setsysGetTouchScreenMode(SetSysTouchScreenMode *out);
|
||||
* @param[in] mode \ref SetSysTouchScreenMode
|
||||
*/
|
||||
Result setsysSetTouchScreenMode(SetSysTouchScreenMode mode);
|
||||
|
||||
/// Initialize setcal.
|
||||
Result setcalInitialize(void);
|
||||
|
||||
/// Exit setcal.
|
||||
void setcalExit(void);
|
||||
|
||||
/// Gets the Service object for the actual setcal service session.
|
||||
Service* setcalGetServiceSession(void);
|
||||
|
||||
/// Gets the \ref SetCalEccB233DeviceCertificate.
|
||||
Result setcalGetEciDeviceCertificate(SetCalEccB233DeviceCertificate *out);
|
||||
|
||||
/// Gets the \ref SetCalRsa2048DeviceCertificate.
|
||||
Result setcalGetEticketDeviceCertificate(SetCalRsa2048DeviceCertificate *out);
|
||||
|
||||
/// Gets the \ref SetCalSslKey.
|
||||
Result setcalGetSslKey(SetCalSslKey *out);
|
||||
|
||||
/// Gets the \ref SetCalSslCertificate.
|
||||
Result setcalGetSslCertificate(SetCalSslCertificate *out);
|
||||
|
||||
/// Gets the \ref SetCalGameCardKey.
|
||||
Result setcalGetGameCardKey(SetCalGameCardKey *out);
|
||||
|
||||
/// Gets the \ref SetCalGameCardCertificate.
|
||||
Result setcalGetGameCardCertificate(SetCalGameCardCertificate *out);
|
||||
|
||||
/// Gets the \ref SetCalRsa2048DeviceKey.
|
||||
Result setcalGetEticketDeviceKey(SetCalRsa2048DeviceKey *out);
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
static Service g_setSrv;
|
||||
static Service g_setsysSrv;
|
||||
static Service g_setcalSrv;
|
||||
|
||||
static bool g_setLanguageCodesInitialized;
|
||||
static u64 g_setLanguageCodes[0x40];
|
||||
@ -44,6 +45,20 @@ Service* setsysGetServiceSession(void) {
|
||||
return &g_setsysSrv;
|
||||
}
|
||||
|
||||
NX_GENERATE_SERVICE_GUARD(setcal);
|
||||
|
||||
Result _setcalInitialize(void) {
|
||||
return smGetService(&g_setcalSrv, "set:cal");
|
||||
}
|
||||
|
||||
void _setcalCleanup(void) {
|
||||
serviceClose(&g_setcalSrv);
|
||||
}
|
||||
|
||||
Service* setcalGetServiceSession(void) {
|
||||
return &g_setcalSrv;
|
||||
}
|
||||
|
||||
static Result _setCmdGetHandle(Service* srv, Handle* handle_out, u32 cmd_id) {
|
||||
return serviceDispatch(srv, cmd_id,
|
||||
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
|
||||
@ -765,3 +780,52 @@ Result setsysSetTouchScreenMode(SetSysTouchScreenMode mode) {
|
||||
|
||||
return _setCmdInU32NoOut(&g_setsysSrv, mode, 188);
|
||||
}
|
||||
|
||||
Result setcalGetEciDeviceCertificate(SetCalEccB233DeviceCertificate *out) {
|
||||
return serviceDispatch(&g_setcalSrv, 14,
|
||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
||||
.buffers = { { out, sizeof(SetCalEccB233DeviceCertificate) } },
|
||||
);
|
||||
}
|
||||
|
||||
Result setcalGetEticketDeviceCertificate(SetCalRsa2048DeviceCertificate *out) {
|
||||
return serviceDispatch(&g_setcalSrv, 15,
|
||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
||||
.buffers = { { out, sizeof(SetCalRsa2048DeviceCertificate) } },
|
||||
);
|
||||
}
|
||||
|
||||
Result setcalGetSslKey(SetCalSslKey *out) {
|
||||
return serviceDispatch(&g_setcalSrv, 16,
|
||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
||||
.buffers = { { out, sizeof(SetCalSslKey) } },
|
||||
);
|
||||
}
|
||||
|
||||
Result setcalGetSslCertificate(SetCalSslCertificate *out) {
|
||||
return serviceDispatch(&g_setcalSrv, 17,
|
||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
||||
.buffers = { { out, sizeof(SetCalSslCertificate) } },
|
||||
);
|
||||
}
|
||||
|
||||
Result setcalGetGameCardKey(SetCalGameCardKey *out) {
|
||||
return serviceDispatch(&g_setcalSrv, 18,
|
||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
||||
.buffers = { { out, sizeof(SetCalGameCardKey) } },
|
||||
);
|
||||
}
|
||||
|
||||
Result setcalGetGameCardCertificate(SetCalGameCardCertificate *out) {
|
||||
return serviceDispatch(&g_setcalSrv, 19,
|
||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
||||
.buffers = { { out, sizeof(SetCalGameCardCertificate) } },
|
||||
);
|
||||
}
|
||||
|
||||
Result setcalGetEticketDeviceKey(SetCalRsa2048DeviceKey *out) {
|
||||
return serviceDispatch(&g_setcalSrv, 21,
|
||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
||||
.buffers = { { out, sizeof(SetCalRsa2048DeviceKey) } },
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user