"GlobalTV" registry section. Higher-level helpers handle credentials, server state, and UI preferences as typed values.
Registry section and keys
All data is stored in theGlobalTV section of the Roku persistent registry (roRegistrySection).
| Key constant | Registry key | Value type | Description |
|--------------------------|----------------------|------------|--------------------------------------------||
| REG_KEY_USER | username | String | Authenticated username |
| REG_KEY_PASS | password | String | Authenticated password |
| REG_KEY_SERVER | lastServer | String | Last successfully used server base URL |
| REG_KEY_CHANNEL | lastChannelIndex | String | Last viewed channel index (integer) |
| REG_KEY_SAFE_MARGIN | uiSafeMarginPct | String | UI safe-area margin percentage (0–10) |
| REG_KEY_SERVER_PROFILES| serverProfiles | String | JSON-encoded array of server profile objects |
Low-level functions
GTV_RegRead
GlobalTV registry section.
The registry key to read.
Value returned when the key does not exist. Defaults to
"".defaultVal if the key is absent.
GTV_RegWrite
GlobalTV registry section and immediately calls Flush() to persist it to disk.
The registry key to write.
The string value to store.
GTV_RegDelete
GlobalTV registry section if it exists, then calls Flush().
The registry key to delete.
Credential functions
GTV_RegHasCredentials
true if both username and password keys are non-empty in the registry.
GTV_RegLoadCredentials
roAssociativeArray {username: String, password: String}, or invalid if either value is empty.
Example
GTV_RegSaveCredentials
The username to store.
The password to store.
GTV_RegClearCredentials
username and password keys from the registry. Use this on logout or auth failure.
Example
Session cache functions
GTV_RegClearCache
lastServer and lastChannelIndex keys. Call this when you want to force a fresh server probe and channel reset on the next launch.
GTV_RegLoadLastServer
GTV_ServerNormalizeBaseUrl before returning. Returns "" if no server has been saved.
GTV_RegSaveLastServer
serverUrl and writes it to the lastServer registry key.
GTV_RegLoadLastChannelIndex
0 if the key is absent.
GTV_RegSaveLastChannelIndex
idx.ToStr()).
UI preference functions
GTV_RegLoadSafeMarginPct
GTV_GetSafeMarginPct() (the AppConstants default) if the key is absent. The returned value is clamped to UI_SAFE_MARGIN_MIN_PCT–UI_SAFE_MARGIN_MAX_PCT (0–10).
GTV_RegSaveSafeMarginPct
pct to the 0–10 range and writes it to the registry.
Desired safe-area margin as a whole-number percentage (0–10).
Persistence model
Every write calls
roRegistrySection.Flush() immediately. There is no deferred batching — each GTV_RegWrite or GTV_RegDelete call is a synchronous disk operation.