NS services: Difference between revisions

Line 1,672: Line 1,672:
If this version value is less than a state field, the state field value is used instead (state field originates from [[System_Settings|system-setting]] <code>contents_delivery!required_system_version_to_deliver_application</code>).
If this version value is less than a state field, the state field value is used instead (state field originates from [[System_Settings|system-setting]] <code>contents_delivery!required_system_version_to_deliver_application</code>).


Then this selects a [[#SystemDeliveryInfo]] with the latest version from the input array, where the minimum version is the previously mentioned value. The version must also be also be at least the version value from the type-0x15 [[#SystemDeliveryInfo]] buffer. This also does various validation, etc. The output s32 is an index in that array for the selected entry, -1 if none found.
Then this selects the [[#SystemDeliveryInfo]] with the latest version from the input array. The output s32 is an index in that array for the selected entry, -1 if none found.
 
During the above loop it first calls the [[#SystemDeliveryInfo]] validation func, returning the Result on failure. Then it runs additional validation, with the [[#SystemDeliveryInfo]] entry being ignored on failure:
* The above latest-version value must be at least the version value from the type-0x15 [[#SystemDeliveryInfo]] buffer and the [[#SystemDeliveryInfo]] array entry.
* When HasExFat is set in the type-0x15 [[#SystemDeliveryInfo]] buffer, it must be set in the [[#SystemDeliveryInfo]] array entry.
* FirmwareVariationId in the type-0x15 [[#SystemDeliveryInfo]] buffer must not be 0xFF.
* UpdatableFirmwareGroupId in the [[#SystemDeliveryInfo]] array entry must not be 0xFF. The value must be within bounds of the settings array ([[System_Settings|sys-settings]] <code>contents_delivery!updatable_firmware_group_string</code>).
* PlatformRegion in the [[#SystemDeliveryInfo]] array entry and the type-0x15 [[#SystemDeliveryInfo]] buffer must match.
* Lastly when the following is true, this indicates success: (settings_array[UpdatableFirmwareGroupId] >> {above FirmwareVariationId}) & 1.


==== VerifyDeliveryProtocolVersion ====
==== VerifyDeliveryProtocolVersion ====