Skip to content

Safety Rules

fosterbarnes edited this page Oct 29, 2026 · 2 revisions

Rules for code that can delete or replace system data. The user-facing side is on System Changes.

The rule

Every action that can delete or replace a system title, ticket, or save, or write system storage, goes through source/app/safety.{c,h}. A new action of that kind adds its check there or calls the existing ones. The lock is settings.systemChanges (key systemChanges), off by default.

The checks

Function Thread Use
safety_is_system_title(titleId) any Title ID category (bits 32-47) & 0x10, or & 0x1 for TWL titles (category 0x8000), per the 3dbrew title list
safety_is_native_firm(titleId) any 0004013800000002 (Old 3DS) or 0004013820000002 (New 3DS)
safety_allowed() any The toggle's value
safety_check(what) UI False and a "<what> is locked." notice while locked
safety_check_title(titleId) worker R_APP_SYSTEM_LOCKED for a system title while locked, else 0
safety_confirm_install(titleId, ...) worker Locked: R_APP_SYSTEM_LOCKED. Unlocked: a red confirmation for system titles (NATIVE_FIRM wording when it is one); R_APP_SKIPPED when declined.

dataop.c shows R_APP_SYSTEM_LOCKED once without the Retry prompt, since retrying would fail the same way.

Where the gates are

Action File Gate
Delete title, delete title and ticket action/deletetitle.c safety_check on system titles
Delete ticket action/deletetickets.c System tickets blocked; "Delete unused tickets" keeps them and reports the count
Delete system save data action/deletesystemsavedata.c Always (every system save is system data)
Delete shared ext save data action/deleteextsavedata.c Shared ext data only
Install ticket action/ticketinstall.c (ticket_install_begin), used by installtickets.c and installurl.c safety_check_title on the ticket's own title ID
Install CIA action/ciainstall.c (cia_install_begin), used by installcias.c and installurl.c safety_confirm_install on the title ID from the CIA's first block; installcias.c also drops system CIAs before its confirmation while locked and counts them
File browser files.c (files_read_only) CTR NAND, TWL NAND, system save data, shared ext data list only Copy, Copy all contents, and installs while locked

The gates live in the shared actions, so FBI's frozen legacy/titles.c is protected without changing it.

Testing

Never test a destructive system action on a real console. Lock tests check only that actions are blocked while the toggle is off.

Clone this wiki locally