Difference between revisions of "News Services"
Jump to navigation
Jump to search
DaniElectra (talk | contribs) m (→News service "news:s": GetNotificationHeaderOther -> SetNotificationHeaderOther) |
|||
(21 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
This system module handles the system notifications. | This system module handles the system notifications. | ||
+ | |||
+ | The maximum number of notifications that can be stored/handled is 100, hence the intended range for notificationIDs is 0-99. | ||
=News service <nowiki>"news:u"</nowiki>= | =News service <nowiki>"news:u"</nowiki>= | ||
Line 8: | Line 10: | ||
|- | |- | ||
| 0x000100C8 | | 0x000100C8 | ||
− | | | + | | [[NEWSU:AddNotification|AddNotification]] |
|} | |} | ||
Line 21: | Line 23: | ||
| 0x000100C6 | | 0x000100C6 | ||
| [[NEWSS:AddNotification|AddNotification]] | | [[NEWSS:AddNotification|AddNotification]] | ||
+ | |- | ||
+ | | 0x0002.... | ||
+ | | Stubbed, only returns 0. | ||
+ | |- | ||
+ | | 0x0003.... | ||
+ | | Stubbed, only returns 0. | ||
+ | |- | ||
+ | | 0x00040000 | ||
+ | | [[NEWSS:ResetNotifications|ResetNotifications]] | ||
|- | |- | ||
| 0x00050000 | | 0x00050000 | ||
| [[NEWSS:GetTotalNotifications|GetTotalNotifications]] | | [[NEWSS:GetTotalNotifications|GetTotalNotifications]] | ||
+ | |- | ||
+ | | 0x00060042 | ||
+ | | [[NEWSS:SetNewsDBHeader|SetNewsDBHeader]] | ||
|- | |- | ||
| 0x00070082 | | 0x00070082 | ||
| [[NEWSS:SetNotificationHeader|SetNotificationHeader]] | | [[NEWSS:SetNotificationHeader|SetNotificationHeader]] | ||
+ | |- | ||
+ | | 0x00080082 | ||
+ | | [[NEWSS:SetNotificationMessage|SetNotificationMessage]] | ||
+ | |- | ||
+ | | 0x00090082 | ||
+ | | [[NEWSS:SetNotificationImage|SetNotificationImage]] | ||
+ | |- | ||
+ | | 0x000A0042 | ||
+ | | [[NEWSS:GetNewsDBHeader|GetNewsDBHeader]] | ||
|- | |- | ||
| 0x000B0082 | | 0x000B0082 | ||
Line 36: | Line 59: | ||
| 0x000D0082 | | 0x000D0082 | ||
| [[NEWSS:GetNotificationImage|GetNotificationImage]] | | [[NEWSS:GetNotificationImage|GetNotificationImage]] | ||
+ | |- | ||
+ | | 0x000E0040 | ||
+ | | [[NEWSS:SetInfoLEDPattern|SetInfoLEDPattern]] | ||
+ | |- | ||
+ | | 0x000F0000 | ||
+ | | [[NEWSS:SyncArrivedNotifications|SyncArrivedNotifications]] | ||
+ | |- | ||
+ | | 0x00100040 | ||
+ | | [[NEWSS:SyncOneArrivedNotification|SyncOneArrivedNotification]] | ||
+ | |- | ||
+ | | 0x00110040 | ||
+ | | [[NEWSS:SetAutomaticSyncFlag|SetAutomaticSyncFlag]] | ||
+ | |- | ||
+ | | 0x00120082 | ||
+ | | [[NEWSS:SetNotificationHeaderOther|SetNotificationHeaderOther]] | ||
+ | |- | ||
+ | | 0x00130000 | ||
+ | | [[NEWSS:WriteNewsDBSavedata|WriteNewsDBSavedata]] | ||
+ | |- | ||
+ | | 0x00140000 | ||
+ | | [[NEWSS:GetTotalArrivedNotifications|GetTotalArrivedNotifications]] | ||
|} | |} | ||
− | =News module savedata= | + | =News module NAND [[System_SaveData|savedata]]= |
* "news.db": This is the main save-file, the filesize is fixed to 0x2BD0-bytes. | * "news.db": This is the main save-file, the filesize is fixed to 0x2BD0-bytes. | ||
− | * "newsXXX.txt" This is the [[NEWSS:AddNotification|message]] data for this notification, where XXX is the decimal [[NEWSS: | + | * "newsXXX.txt" This is the [[NEWSS:AddNotification|message]] data for this notification, where XXX is the decimal notification-index in the below headers-array. The filesize should be <= <size listed [[NEWSS:GetNotificationMessage|here]]>, since that's the max size read by the notifications applet. |
− | * "newsXXX.mpo" This is the [[NEWSS:AddNotification|MPO]] data for this notification if any, where XXX is the decimal | + | * "newsXXX.mpo" This is the [[NEWSS:AddNotification|MPO]] data for this notification if any, where XXX is the decimal notification-index in the below headers-array. The filesize should be <= <size listed [[NEWSS:GetNotificationImage|here]]>, since that's the max size read by the notifications applet. |
==news.db== | ==news.db== | ||
Line 52: | Line 96: | ||
| 0x0 | | 0x0 | ||
| 0x10 | | 0x10 | ||
− | | Header, | + | | Header, see below. |
|- | |- | ||
| 0x10 | | 0x10 | ||
| 0x2BC0 (100 * 0x70) | | 0x2BC0 (100 * 0x70) | ||
| Array of [[NEWSS:AddNotification|headers]] for each notification. | | Array of [[NEWSS:AddNotification|headers]] for each notification. | ||
+ | |} | ||
+ | |||
+ | ===Header=== | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x1 | ||
+ | | Must be 0x1 "is valid". | ||
+ | |- | ||
+ | | 0x1 | ||
+ | | 0x1 | ||
+ | | Flags | ||
+ | |- | ||
+ | | 0x2 | ||
+ | | 0xE | ||
+ | | Normally zero? | ||
+ | |} | ||
+ | |||
+ | ===Flags=== | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Bit | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0 | ||
+ | | Set by news module when handling BOSS notifications and the AddNotification commands. This indicates that there's "unread" notifications, the notifications applet clears this once all notifications have been "read". | ||
+ | |- | ||
+ | | 1 | ||
+ | | Set by news module when handling CECD notifications. | ||
+ | |} | ||
+ | |||
+ | =News module startup= | ||
+ | The actual main function called by main() does the following: | ||
+ | * srv_init() | ||
+ | * Registers services <nowiki>"news:u" and "news:s"</nowiki>. | ||
+ | * Initializes the service session handle for "ptm:sysm". | ||
+ | * Loads 4 handles from somewhere, which gets used with svcReplyAndReceive later. | ||
+ | * Does notificationID state init, uses [[SRV:GetNotificationSemaphore]], then subscribes to srv notifications 0x104 and 0x106. | ||
+ | * <Some func calls> | ||
+ | * Here [[PTMSYSM:SetInfoLEDPattern]] is used. | ||
+ | * Some state init is done, then the usual svcReplyAndReceive loop begins. | ||
+ | |||
+ | =Errors= | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Error code | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0xC8A12805 | ||
+ | | The news.db or notification header data for the specified notificationID is not set(the specified notification doesn't exist). | ||
+ | |} | ||
+ | |||
+ | =Title Versions= | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Title version | ||
+ | ! System version | ||
+ | ! Changes | ||
+ | |- | ||
+ | | v7168 | ||
+ | | [[9.7.0-25|9.7.0-X]] | ||
+ | | All of the changes are the following: | ||
+ | * See [[9.7.0-25|here]] regarding the updated CTRSDK function code. | ||
+ | * This function is eventually called by newss_cmdf, newss_cmd10, and <certain function>. When calling a certain function fails in here, this code now calls <another certain function> before returning. | ||
+ | * Mutex enter/leave function calls were added to a certain function. | ||
+ | * More state init was added to the start of an initialization function called during news module startup(crt0?). | ||
+ | * 0x14 new bytes were added to .rodata. | ||
|} | |} |
Latest revision as of 11:44, 20 January 2024
This system module handles the system notifications.
The maximum number of notifications that can be stored/handled is 100, hence the intended range for notificationIDs is 0-99.
News service "news:u"[edit]
Command Header | Description |
---|---|
0x000100C8 | AddNotification |
This service only has one command.
News service "news:s"[edit]
Command Header | Description |
---|---|
0x000100C6 | AddNotification |
0x0002.... | Stubbed, only returns 0. |
0x0003.... | Stubbed, only returns 0. |
0x00040000 | ResetNotifications |
0x00050000 | GetTotalNotifications |
0x00060042 | SetNewsDBHeader |
0x00070082 | SetNotificationHeader |
0x00080082 | SetNotificationMessage |
0x00090082 | SetNotificationImage |
0x000A0042 | GetNewsDBHeader |
0x000B0082 | GetNotificationHeader |
0x000C0082 | GetNotificationMessage |
0x000D0082 | GetNotificationImage |
0x000E0040 | SetInfoLEDPattern |
0x000F0000 | SyncArrivedNotifications |
0x00100040 | SyncOneArrivedNotification |
0x00110040 | SetAutomaticSyncFlag |
0x00120082 | SetNotificationHeaderOther |
0x00130000 | WriteNewsDBSavedata |
0x00140000 | GetTotalArrivedNotifications |
News module NAND savedata[edit]
- "news.db": This is the main save-file, the filesize is fixed to 0x2BD0-bytes.
- "newsXXX.txt" This is the message data for this notification, where XXX is the decimal notification-index in the below headers-array. The filesize should be <= <size listed here>, since that's the max size read by the notifications applet.
- "newsXXX.mpo" This is the MPO data for this notification if any, where XXX is the decimal notification-index in the below headers-array. The filesize should be <= <size listed here>, since that's the max size read by the notifications applet.
news.db[edit]
Offset | Size | Description |
---|---|---|
0x0 | 0x10 | Header, see below. |
0x10 | 0x2BC0 (100 * 0x70) | Array of headers for each notification. |
Header[edit]
Offset | Size | Description |
---|---|---|
0x0 | 0x1 | Must be 0x1 "is valid". |
0x1 | 0x1 | Flags |
0x2 | 0xE | Normally zero? |
Flags[edit]
Bit | Description |
---|---|
0 | Set by news module when handling BOSS notifications and the AddNotification commands. This indicates that there's "unread" notifications, the notifications applet clears this once all notifications have been "read". |
1 | Set by news module when handling CECD notifications. |
News module startup[edit]
The actual main function called by main() does the following:
- srv_init()
- Registers services "news:u" and "news:s".
- Initializes the service session handle for "ptm:sysm".
- Loads 4 handles from somewhere, which gets used with svcReplyAndReceive later.
- Does notificationID state init, uses SRV:GetNotificationSemaphore, then subscribes to srv notifications 0x104 and 0x106.
- <Some func calls>
- Here PTMSYSM:SetInfoLEDPattern is used.
- Some state init is done, then the usual svcReplyAndReceive loop begins.
Errors[edit]
Error code | Description |
---|---|
0xC8A12805 | The news.db or notification header data for the specified notificationID is not set(the specified notification doesn't exist). |
Title Versions[edit]
Title version | System version | Changes |
---|---|---|
v7168 | 9.7.0-X | All of the changes are the following:
|