diff --git a/AGENTS.md b/AGENTS.md index 7e329bb..7ceb704 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -54,7 +54,7 @@ The app is C for GCC 2.95 (prc-tools-remix) and PilRC, against the Palm OS 3.5 S - During any launch, `SysCurAppDatabase` returns the launched app, not the one in front. To tell whether the app is open, use a feature (`BgSetAppOpen`). - The channel and contact databases open lazily. `ChannelsOpen` is only called by `ChannelsRefresh` and `ConvosBuild`. Paths that skip those must open the databases themselves, or every lookup quietly fails. -- With no module in the slot, accessing the Springboard slot's address space is a bus error that resets the Visor. Check `HsCardAttrGet(hsCardAttrHwInstalled)` first. Slot is deliberately not restored at launch. +- With no module in the slot, accessing the Springboard slot's address space is a bus error that resets the Visor. Check `HsCardAttrGet(hsCardAttrHwInstalled)` first (`SbSlotState`). A saved Slot link is only restored at launch while the OS reports a module. - `StrPrintF` hex output printed zeros. Use `TxtHex` (ui/text.c). - The Visor's clock is local time with no time zone. Everything stored and sent is UTC via the app's UTC-offset preference (`SessionNow`, `SessionLocalPalm`). - 68k is big-endian; the companion protocol is little-endian. Assemble LE fields byte by byte (see `protocol.c`). diff --git a/palm-client/src/app.c b/palm-client/src/app.c index 415f583..77261f9 100644 --- a/palm-client/src/app.c +++ b/palm-client/src/app.c @@ -28,6 +28,7 @@ void AppLoadPrefs(void) AppPrefs prefs; UInt16 size = sizeof(prefs); Int32 west; + UInt32 base, csSize; SoundsLoad(); MutesLoad(); @@ -36,11 +37,12 @@ void AppLoadPrefs(void) if (PrefGetAppPreferences(VM_CREATOR, VM_PREFS_ID, &prefs, &size, true) != noPreferenceFound && size == sizeof(prefs) && prefs.version == VM_PREFS_VERSION) { /* - * Slot isn't restored: with no module in the slot, the first bus read - * at csSlot0 is a bus error and resets the Visor, and the Home form - * auto-connects at launch, so a saved Slot made every launch reset. + * Slot only while the OS reports a module: with the slot empty, the + * first bus read at csSlot0 is a bus error that resets the Visor, and + * the Home form auto-connects at launch. SbSlotState doesn't touch the + * bus. The closed-app check needs Slot restored to use the module. */ - if (prefs.port != VM_PORT_SBLORA) + if (prefs.port != VM_PORT_SBLORA || SbSlotState(&base, &csSize) == SB_SLOT_READY) TransportSetPort(prefs.port); SessionSetUtcOffset(prefs.utcOffset); return;