Shared Database services: Difference between revisions

No edit summary
No edit summary
Line 244: Line 244:


== NotifyAppletEvent ==
== NotifyAppletEvent ==
Takes an input u8 [[#AppletEventType]], an u8 [[Applet_Manager_services#AppletId|AppletId]], an u8 [[Filesystem_services#StorageId|StorageId]], an u8 [[#PlayLogPolicy]], an u32 '''event_x8''', and an u64 '''titleID'''. Returns no output.
Takes an input u8 [[#AppletEventType]], an u8 [[Applet_Manager_services#AppletId|AppletId]], an u8 [[Filesystem_services#StorageId|StorageId]], an u8 [[#PlayLogPolicy]], an u32 '''event_x8''', and an u64 '''ProgramId'''. Returns no output.


When [[#PlayLogPolicy]] is 2 ("None") this will immediately return 0.
When [[#PlayLogPolicy]] is 2 ("None") this will immediately return 0.
Line 252: Line 252:
* u8 +0xF = [[#AppletEventType]].
* u8 +0xF = [[#AppletEventType]].
* Sets the 3 timestamps.
* Sets the 3 timestamps.
* Converts '''titleID''' and writes it to +0x0.
* Converts '''ProgramId''' and writes it to +0x0.
* u32 +0x8 = '''event_x8'''.
* u32 +0x8 = '''event_x8'''.
* u8 +0xC = [[Applet_Manager_services#AppletId|AppletId]], u8 +0xD = [[Filesystem_services#StorageId|StorageId]], and u8 +0xE = [[#PlayLogPolicy]].
* u8 +0xC = [[Applet_Manager_services#AppletId|AppletId]], u8 +0xD = [[Filesystem_services#StorageId|StorageId]], and u8 +0xE = [[#PlayLogPolicy]].
Line 281: Line 281:


== Cmd8 ==
== Cmd8 ==
Takes an input u8 [[#AppletEventType]], an u8 [[Applet_Manager_services#LibraryAppletMode|LibraryAppletMode]], an u8 [[Applet_Manager_services#AppletId|AppletId]], an u8 [[Filesystem_services#StorageId|StorageId]], an u8 [[#PlayLogPolicy]], and an u64 '''titleID'''. Returns no output.
Takes an input u8 [[#AppletEventType]], an u8 [[Applet_Manager_services#LibraryAppletMode|LibraryAppletMode]], an u8 [[Applet_Manager_services#AppletId|AppletId]], an u8 [[Filesystem_services#StorageId|StorageId]], an u8 [[#PlayLogPolicy]], and an u64 '''ProgramId'''. Returns no output.


This is similar to [[#NotifyAppletEvent]].
This is similar to [[#NotifyAppletEvent]].
Line 291: Line 291:
* u8 +0xF = [[#AppletEventType]].
* u8 +0xF = [[#AppletEventType]].
* Sets the 3 timestamps.
* Sets the 3 timestamps.
* Converts '''titleID''' and writes it to +0x0.
* Converts '''ProgramId''' and writes it to +0x0.
* u8 +0x9 = [[Applet_Manager_services#LibraryAppletMode|LibraryAppletMode]].
* u8 +0x9 = [[Applet_Manager_services#LibraryAppletMode|LibraryAppletMode]].
* u8 +0x8 = 1.
* u8 +0x8 = 1.
Line 424: Line 424:
Takes ([10.0.0+] an input u8 bool), an input u128 '''Uid''', a type-0x6 output buffer containing an array of u64 '''ApplicationId''', and returns an output s32 for actual total output entries.
Takes ([10.0.0+] an input u8 bool), an input u128 '''Uid''', a type-0x6 output buffer containing an array of u64 '''ApplicationId''', and returns an output s32 for actual total output entries.


Returns a list of titles played by the specified user.
Returns a list of applications played by the specified user.


== GetRecentlyPlayedApplicationUpdateEvent ==
== GetRecentlyPlayedApplicationUpdateEvent ==
Line 688: Line 688:
This is "nn::pdm::LastPlayTime".
This is "nn::pdm::LastPlayTime".


This is a 0x18-byte struct and contains data from the last time the title was played.
This is a 0x18-byte struct and contains data from the last time the program was played.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 696: Line 696:
! Description
! Description
|-
|-
| 0x0 || 0x8 || titleID
| 0x0 || 0x8 || ProgramId
|-
|-
| 0x8 || 0x4 || Same as the first [[#AppletEvent]] timestamp.
| 0x8 || 0x4 || Same as the first [[#AppletEvent]] timestamp.
Line 702: Line 702:
| 0xC || 0x4 || Same as the second [[#AppletEvent]] timestamp.
| 0xC || 0x4 || Same as the second [[#AppletEvent]] timestamp.
|-
|-
| 0x10 || 0x4 || Total minutes since the title was last played.
| 0x10 || 0x4 || Total minutes since the program was last played.
|-
|-
| 0x14 || 0x1 || Flag indicating whether the above field is set.
| 0x14 || 0x1 || Flag indicating whether the above field is set.
Line 794: Line 794:
* [[#QueryAppletEvent]], [[#QueryLastPlayTime]], and [[#QueryApplicationPlayStatisticsForSystem]]: PlayEvent +0x1C must be 0, and [[#PlayLogPolicy]] must be 0. [10.0.0+] These will also allow [[#PlayLogPolicy]] value 3, if the input flag is set.
* [[#QueryAppletEvent]], [[#QueryLastPlayTime]], and [[#QueryApplicationPlayStatisticsForSystem]]: PlayEvent +0x1C must be 0, and [[#PlayLogPolicy]] must be 0. [10.0.0+] These will also allow [[#PlayLogPolicy]] value 3, if the input flag is set.
** With [[#QueryLastPlayTime]]/[[#QueryApplicationPlayStatisticsForSystem]] the [[Applet_Manager_services#AppletId|AppletId]] must be 1. [10.0.0+] These now also allow [[Applet_Manager_services#AppletId|AppletId]] 0x1F/0x20.
** With [[#QueryLastPlayTime]]/[[#QueryApplicationPlayStatisticsForSystem]] the [[Applet_Manager_services#AppletId|AppletId]] must be 1. [10.0.0+] These now also allow [[Applet_Manager_services#AppletId|AppletId]] 0x1F/0x20.
* [[#QueryPlayStatisticsByApplicationId]]: PlayEvent +0x1C must be 0, +0xC must be 1 ([10.0.0+] or 0x1F/0x20), and the titleID must match. [10.0.0+] [[#PlayLogPolicy]] must be 0. Value 3 is allowed if the input flag is set.
* [[#QueryPlayStatisticsByApplicationId]]: PlayEvent +0x1C must be 0, +0xC must be 1 ([10.0.0+] or 0x1F/0x20), and the ProgramId must match. [10.0.0+] [[#PlayLogPolicy]] must be 0. Value 3 is allowed if the input flag is set.
* [[#QueryAccountEvent]]: PlayEvent +0x1C must be 1 and PlayEvent +0x18 must be <=1.
* [[#QueryAccountEvent]]: PlayEvent +0x1C must be 1 and PlayEvent +0x18 must be <=1.
* [[#QueryApplicationPlayStatisticsForSystem]]: In addition to the above, this also handles [[#PlayEventType]] PowerStateChange, where PlayEvent +0x0 is value 0 or 1.
* [[#QueryApplicationPlayStatisticsForSystem]]: In addition to the above, this also handles [[#PlayEventType]] PowerStateChange, where PlayEvent +0x0 is value 0 or 1.


The structure of the first 0x1C-bytes are determined by [[#PlayEventType]]. For titleIDs/userIDs, the low/high u32 in each u64 is swapped.
The structure of the first 0x1C-bytes are determined by [[#PlayEventType]]. For ProgramIds/userIDs, the low/high u32 in each u64 is swapped.


Applet:
Applet:
Line 961: Line 961:
! Description
! Description
|-
|-
| 0x0 || 0x8 || titleID
| 0x0 || 0x8 || ProgramId
|-
|-
| 0x8 || 0x8 || Total play-time in nanoseconds.
| 0x8 || 0x8 || Total play-time in nanoseconds.
|-
|-
| 0x10 || 0x8 || Total times the application title was launched.
| 0x10 || 0x8 || Total times the program was launched.
|}
|}