GRC services: Difference between revisions

(7 intermediate revisions by the same user not shown)
Line 168: Line 168:


== OpenOffscreenLayer ==
== OpenOffscreenLayer ==
Takes an input u64 '''LayerHandle''', returns an output u32.
Takes an input u64 '''LayerHandle''', returns an output s32 '''ID'''.
 
This gets the '''ID''' for the [[#IHOSBinderDriver]] returned by [[#CreateVideoProxy]].


== CloseOffscreenLayer ==
== CloseOffscreenLayer ==
Line 183: Line 185:
== RequestOffscreenRecordingFinishReady ==
== RequestOffscreenRecordingFinishReady ==
Takes an input u64 '''LayerHandle''', no output.
Takes an input u64 '''LayerHandle''', no output.
This is the first cmd used by official sw when finishing recording. Then it waits on the Event originally loaded from [[#GetOffscreenLayerRecordingFinishReadyEvent]]. Then CompleteOffscreenRecordingFinishEx* is used, depending on the sdk-nso version. On any errors, [[#AbortOffscreenRecording]] is used.


== StartOffscreenRecordingEx ==
== StartOffscreenRecordingEx ==
Line 191: Line 195:


Seems to be unused by official user processes, [[#CompleteOffscreenRecordingFinishEx0]] is used instead.
Seems to be unused by official user processes, [[#CompleteOffscreenRecordingFinishEx0]] is used instead.
The input buffer contains the optional ApplicationData for the JPEG thumbnail, size must be <=0x400.
The recorded video will not be accessible via the Album-applet since it's stored separately from other Album data.


== CompleteOffscreenRecordingFinishEx0 ==
== CompleteOffscreenRecordingFinishEx0 ==
Takes two input u32s '''width'''/'''height''', an input u64 '''LayerHandle''' and 2 type-0x5 input buffers, no output.
Takes two input s32s '''width'''/'''height''', an input u64 '''LayerHandle''' and 2 type-0x5 input buffers, no output.


The input buffers are optional, addr=NULL and size=0 can be used for these.
The input buffers are optional, addr=NULL and size=0 can be used for these. The first buffer is for [[#CompleteOffscreenRecordingFinish|ApplicationData]], the second buffer buffer contains the RGBA8 image thumbnail.


'''width'''/'''height''' must be 1280x720, these fields are unused afterwards.
'''width'''/'''height''' must be 1280x720, these fields are unused afterwards.
Line 202: Line 210:


== CompleteOffscreenRecordingFinishEx1 ==
== CompleteOffscreenRecordingFinishEx1 ==
Takes two input u32s '''width'''/'''height''', an input u64 '''LayerHandle''' and two type-0x5 input buffers, returns a 0x20-byte output struct.
Takes two input s32s '''width'''/'''height''', an input u64 '''LayerHandle''' and two type-0x5 input buffers, returns an output [[Capture_services|ApplicationAlbumEntry]].


Same as [[#CompleteOffscreenRecordingFinishEx0]] except the output struct is returned in the cmdreply.
Same as [[#CompleteOffscreenRecordingFinishEx0]] except the output struct is returned in the cmdreply. Official sw copies the output struct into a "nn::album::AlbumFileEntry".
 
== GetOffscreenLayerError ==
Takes an input u64 '''LayerHandle''', no output.


== EncodeOffscreenLayerAudioSample ==
== EncodeOffscreenLayerAudioSample ==
Takes an input u64 '''LayerHandle''' and a type-0x5 input buffer, returns an output u64.
Takes an input u64 '''LayerHandle''' and a type-0x5 input buffer, returns an output u64 '''out_size'''.


== GetOffscreenLayerError ==
Official sw enters a loop for handling the user-specified buffer:
Takes an input u64 '''LayerHandle''', no output.
* Waits on the Event originally loaded from [[#GetOffscreenLayerAudioEncodeReadyEvent]].
* Uses the cmd with the current buffer_addr+pos and the remaining_size.
* Updates the current pos and remaining_size with the '''out_size'''.
* Repeats the loop until the remaining_size is 0.


== GetOffscreenLayerRecordingFinishReadyEvent ==
== GetOffscreenLayerRecordingFinishReadyEvent ==
Line 219: Line 233:


= OffscreenRecordingParameter =
= OffscreenRecordingParameter =
This is a 0x80-byte struct.
{| class="wikitable" border="1"
|-
! Offset || Size || Description || Default value
|-
| 0x0 || 0x10 || ? || 0
|-
| 0x10 || 0x4 || Unknown, must match 0x103. || 0x103
|-
| 0x14 || 0x4 || s32 VideoBitRate, 0 is invalid. || 8000000
|-
| 0x18 || 0x4 || s32 VideoWidth, must match 1280 or 1920. || 1280
|-
| 0x1C || 0x4 || s32 VideoHeight, must match 720 or 1080. || 720
|-
| 0x20 || 0x4 || s32 VideoFrameRate, must match 30 or 60. || 30
|-
| 0x24 || 0x4 || s32 VideoKeyFrameInterval, 0 is invalid. || 30
|-
| 0x28 || 0x4 || s32 AudioBitRate || 128000 ([5.0.0-5.1.0] 1536000)
|-
| 0x2C || 0x4 || s32 AudioSampleRate, 0 is invalid. || 48000
|-
| 0x30 || 0x4 || s32 AudioChannelCount, must match 2. || 2
|-
| 0x34 || 0x4 || "nn::audio::SampleFormat" AudioSampleFormat, must match 2. || 2
|-
| 0x38 || 0x4 || "nn::album::ImageOrientation" VideoImageOrientation. || 0
|-
| 0x3C || 0x44 || ? || 0
|}
 
This is "nn::grcsrv::OffscreenRecordingParameter". This is a 0x80-byte struct. "nn::grc::OffscreenRecordingParameter" and "nn::album::MovieMakerMovieParameter" are identical to this.
 
The above default values are initialized by the official user-process via sdk-nso funcs "nn::album::MovieMakerMovieParameter::GetDefaultValue()" / "nn::album::MovieMakerMovieParameter::MovieMakerMovieParameter()" (both funcs are identical).


= GameMovieId =
= GameMovieId =