Commit acfb34f
sim: Persist calculator state on exit
The simulator already saves its state on EXIT_PGM (see src/dmcp/main.cc),
but only when a state-file path has previously been configured by the
user via the SETUP > State > Save menu. On a fresh install the path is
empty, so closing the window silently discards all settings (Beep mode,
display options, etc.) and stack contents.
Default the persisted state-file path to "state/<PROGRAM_NAME>.48S" on
first launch, so that exit reliably writes a state file and the next
launch reliably restores it.
Also honor STATE_IO_SILENT in state_load_callback. With the default path
set, the first launch (when no state file exists yet) was popping up a
"State load failed: No such file or directory" dialog; silent loads
should be silent on missing files too.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Alex Sergeev <alexander.sergeev@live.com>
Reviewed-by: Christophe de Dinechin <christophe@dinechin.org>1 parent 7b4fd1b commit acfb34f
6 files changed
Lines changed: 22 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
843 | 843 | | |
844 | 844 | | |
845 | 845 | | |
846 | | - | |
| 846 | + | |
| 847 | + | |
847 | 848 | | |
848 | 849 | | |
849 | 850 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
785 | 785 | | |
786 | 786 | | |
787 | 787 | | |
788 | | - | |
| 788 | + | |
| 789 | + | |
789 | 790 | | |
790 | 791 | | |
791 | 792 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
794 | 794 | | |
795 | 795 | | |
796 | 796 | | |
797 | | - | |
| 797 | + | |
| 798 | + | |
798 | 799 | | |
799 | 800 | | |
800 | 801 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
109 | 119 | | |
110 | 120 | | |
111 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
398 | | - | |
399 | | - | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
400 | 403 | | |
401 | 404 | | |
402 | 405 | | |
| |||
0 commit comments