-
Notifications
You must be signed in to change notification settings - Fork 1
/
ui.c
645 lines (479 loc) · 18 KB
/
ui.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
/* ui.c: User interface routines, but those which are independent of any UI
Copyright (c) 2002 Philip Kendall
$Id: ui.c 3584 2008-03-25 10:27:30Z fredm $
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Author contact information:
E-mail: [email protected]
*/
#include <config.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <libspectrum.h>
#include "fuse.h"
#include "ui/ui.h"
#include "if1.h"
#include "kempmouse.h"
#include "settings.h"
#include "tape.h"
#define MESSAGE_MAX_LENGTH 256
static char last_message[ MESSAGE_MAX_LENGTH ] = "";
static size_t frames_since_last_message = 0;
static int
print_error_to_stderr( ui_error_level severity, const char *message );
int
ui_error( ui_error_level severity, const char *format, ... )
{
int error;
va_list ap;
va_start( ap, format );
error = ui_verror( severity, format, ap );
va_end( ap );
return error;
}
int
ui_verror( ui_error_level severity, const char *format, va_list ap )
{
char message[ MESSAGE_MAX_LENGTH ];
vsnprintf( message, MESSAGE_MAX_LENGTH, format, ap );
/* Skip the message if the same message was displayed recently */
if( frames_since_last_message < 50 && !strcmp( message, last_message ) ) {
frames_since_last_message = 0;
return 0;
}
/* And store the 'last message' */
strncpy( last_message, message, MESSAGE_MAX_LENGTH );
#ifndef UI_WIN32
print_error_to_stderr( severity, message );
#endif /* #ifndef UI_WIN32 */
/* Do any UI-specific bits as well */
ui_error_specific( severity, message );
return 0;
}
ui_confirm_save_t
ui_confirm_save( const char *format, ... )
{
va_list ap;
char message[ MESSAGE_MAX_LENGTH ];
ui_confirm_save_t confirm;
va_start( ap, format );
vsnprintf( message, MESSAGE_MAX_LENGTH, format, ap );
confirm = ui_confirm_save_specific( message );
va_end( ap );
return confirm;
}
static int
print_error_to_stderr( ui_error_level severity, const char *message )
{
/* Print the error to stderr if it's more significant than just
informational */
if( severity > UI_ERROR_INFO ) {
/* For the fb and svgalib UIs, we don't want to write to stderr if
it's a terminal, as it's then likely to be what we're currently
using for graphics output, and writing text to it isn't a good
idea. Things are OK if we're exiting though */
#if defined( UI_FB ) || defined( UI_SVGA )
if( isatty( STDERR_FILENO ) && !fuse_exiting ) return 1;
#endif /* #if defined( UI_FB ) || defined( UI_SVGA ) */
fprintf( stderr, "%s: ", fuse_progname );
switch( severity ) {
case UI_ERROR_INFO: break; /* Shouldn't happen */
case UI_ERROR_WARNING: fprintf( stderr, "warning: " ); break;
case UI_ERROR_ERROR: fprintf( stderr, "error: " ); break;
}
fprintf( stderr, "%s\n", message );
}
return 0;
}
libspectrum_error
ui_libspectrum_error( libspectrum_error error GCC_UNUSED, const char *format,
va_list ap )
{
char new_format[ 257 ];
snprintf( new_format, 256, "libspectrum: %s", format );
ui_verror( UI_ERROR_ERROR, new_format, ap );
return LIBSPECTRUM_ERROR_NONE;
}
void
ui_error_frame( void )
{
frames_since_last_message++;
}
int ui_mouse_present = 0;
int ui_mouse_grabbed = 0;
static int mouse_grab_suspended = 0;
void
ui_mouse_button( int button, int down )
{
if( !ui_mouse_grabbed && !mouse_grab_suspended ) button = 2;
/* Possibly we'll end up handling _more_ than one mouse interface... */
switch( button ) {
case 1: if( ui_mouse_grabbed ) kempmouse_update( 0, 0, 1, down ); break;
case 3: if( ui_mouse_grabbed ) kempmouse_update( 0, 0, 0, down ); break;
case 2:
if( ui_mouse_present && settings_current.kempston_mouse
&& !down && !mouse_grab_suspended )
ui_mouse_grabbed =
ui_mouse_grabbed ? ui_mouse_release( 1 ) : ui_mouse_grab( 0 );
break;
}
}
void
ui_mouse_motion( int x, int y )
{
if( ui_mouse_grabbed ) kempmouse_update( x, y, -1, 0 );
}
void
ui_mouse_suspend( void )
{
mouse_grab_suspended = ui_mouse_grabbed ? 2 : 1;
ui_mouse_grabbed = ui_mouse_release( 1 );
}
void
ui_mouse_resume( void )
{
if( mouse_grab_suspended == 2) ui_mouse_grabbed = ui_mouse_grab( 0 );
mouse_grab_suspended = 0;
}
struct menu_item_entries {
ui_menu_item item;
const char *string1;
const char *string2; int string2_inverted;
const char *string3; int string3_inverted;
const char *string4; int string4_inverted;
const char *string5; int string5_inverted;
const char *string6; int string6_inverted;
const char *string7; int string7_inverted;
};
static const struct menu_item_entries menu_item_lookup[] = {
{ UI_MENU_ITEM_FILE_MOVIES_RECORDING, "/File/Movies/Stop Movie Recording",
"/File/Movies/Record Movie as SCR...", 1,
#ifdef USE_LIBPNG
"/File/Movies/Record Movie as PNG...", 1,
#endif
},
{ UI_MENU_ITEM_MACHINE_PROFILER, "/Machine/Profiler/Stop",
"/Machine/Profiler/Start", 1 },
{ UI_MENU_ITEM_MEDIA_CARTRIDGE, "/Media/Cartridge" },
{ UI_MENU_ITEM_MEDIA_CARTRIDGE_DOCK, "/Media/Cartridge/Timex Dock" },
{ UI_MENU_ITEM_MEDIA_CARTRIDGE_DOCK_EJECT,
"/Media/Cartridge/Timex Dock/Eject" },
{ UI_MENU_ITEM_MEDIA_IF1, "/Media/Interface I" },
{ UI_MENU_ITEM_MEDIA_IF1_M1_EJECT,
"/Media/Interface I/Microdrive 1/Eject",
"/Media/Interface I/Microdrive 1/Eject and write...", 0,
"/Media/Interface I/Microdrive 1/Write protect", 0 },
{ UI_MENU_ITEM_MEDIA_IF1_M1_WP_SET,
"/Media/Interface I/Microdrive 1/Write protect/Enable",
"/Media/Interface I/Microdrive 1/Write protect/Disable", 1 },
{ UI_MENU_ITEM_MEDIA_IF1_M2_EJECT,
"/Media/Interface I/Microdrive 2/Eject",
"/Media/Interface I/Microdrive 2/Eject and write...", 0,
"/Media/Interface I/Microdrive 2/Write protect", 0 },
{ UI_MENU_ITEM_MEDIA_IF1_M2_WP_SET,
"/Media/Interface I/Microdrive 2/Write protect/Enable",
"/Media/Interface I/Microdrive 2/Write protect/Disable", 1 },
{ UI_MENU_ITEM_MEDIA_IF1_M3_EJECT,
"/Media/Interface I/Microdrive 3/Eject",
"/Media/Interface I/Microdrive 3/Eject and write...", 0,
"/Media/Interface I/Microdrive 3/Write protect", 0 },
{ UI_MENU_ITEM_MEDIA_IF1_M3_WP_SET,
"/Media/Interface I/Microdrive 3/Write protect/Enable",
"/Media/Interface I/Microdrive 3/Write protect/Disable", 1 },
{ UI_MENU_ITEM_MEDIA_IF1_M4_EJECT,
"/Media/Interface I/Microdrive 4/Eject",
"/Media/Interface I/Microdrive 4/Eject and write...", 0,
"/Media/Interface I/Microdrive 4/Write protect", 0 },
{ UI_MENU_ITEM_MEDIA_IF1_M4_WP_SET,
"/Media/Interface I/Microdrive 4/Write protect/Enable",
"/Media/Interface I/Microdrive 4/Write protect/Disable", 1 },
{ UI_MENU_ITEM_MEDIA_IF1_M5_EJECT,
"/Media/Interface I/Microdrive 5/Eject",
"/Media/Interface I/Microdrive 5/Eject and write...", 0,
"/Media/Interface I/Microdrive 5/Write protect", 0 },
{ UI_MENU_ITEM_MEDIA_IF1_M5_WP_SET,
"/Media/Interface I/Microdrive 5/Write protect/Enable",
"/Media/Interface I/Microdrive 5/Write protect/Disable", 1 },
{ UI_MENU_ITEM_MEDIA_IF1_M6_EJECT,
"/Media/Interface I/Microdrive 6/Eject",
"/Media/Interface I/Microdrive 6/Eject and write...", 0,
"/Media/Interface I/Microdrive 6/Write protect", 0 },
{ UI_MENU_ITEM_MEDIA_IF1_M6_WP_SET,
"/Media/Interface I/Microdrive 6/Write protect/Enable",
"/Media/Interface I/Microdrive 6/Write protect/Disable", 1 },
{ UI_MENU_ITEM_MEDIA_IF1_M7_EJECT,
"/Media/Interface I/Microdrive 7/Eject",
"/Media/Interface I/Microdrive 7/Eject and write...", 0,
"/Media/Interface I/Microdrive 7/Write protect", 0 },
{ UI_MENU_ITEM_MEDIA_IF1_M7_WP_SET,
"/Media/Interface I/Microdrive 7/Write protect/Enable",
"/Media/Interface I/Microdrive 7/Write protect/Disable", 1 },
{ UI_MENU_ITEM_MEDIA_IF1_M8_EJECT,
"/Media/Interface I/Microdrive 8/Eject",
"/Media/Interface I/Microdrive 8/Eject and write...", 0,
"/Media/Interface I/Microdrive 8/Write protect", 0 },
{ UI_MENU_ITEM_MEDIA_IF1_M8_WP_SET,
"/Media/Interface I/Microdrive 8/Write protect/Enable",
"/Media/Interface I/Microdrive 8/Write protect/Disable", 1 },
{ UI_MENU_ITEM_MEDIA_IF1_RS232_UNPLUG_R,
"/Media/Interface I/RS232/Unplug RxD" },
{ UI_MENU_ITEM_MEDIA_IF1_RS232_UNPLUG_T,
"/Media/Interface I/RS232/Unplug TxD" },
{ UI_MENU_ITEM_MEDIA_IF1_SNET_UNPLUG,
"/Media/Interface I/Sinclair NET/Unplug" },
{ UI_MENU_ITEM_MEDIA_CARTRIDGE_IF2, "/Media/Cartridge/Interface II" },
{ UI_MENU_ITEM_MEDIA_CARTRIDGE_IF2_EJECT,
"/Media/Cartridge/Interface II/Eject" },
{ UI_MENU_ITEM_MEDIA_DISK, "/Media/Disk" },
{ UI_MENU_ITEM_MEDIA_DISK_PLUS3, "/Media/Disk/+3" },
{ UI_MENU_ITEM_MEDIA_DISK_PLUS3_A_EJECT,
"/Media/Disk/+3/Drive A:/Eject",
"/Media/Disk/+3/Drive A:/Eject and write...", 0,
"/Media/Disk/+3/Drive A:/Write protect", 0 },
{ UI_MENU_ITEM_MEDIA_DISK_PLUS3_A_WP_SET,
"/Media/Disk/+3/Drive A:/Write protect/Enable",
"/Media/Disk/+3/Drive A:/Write protect/Disable", 1 },
{ UI_MENU_ITEM_MEDIA_DISK_PLUS3_B_EJECT,
"/Media/Disk/+3/Drive B:/Eject",
"/Media/Disk/+3/Drive B:/Eject and write...", 0,
"/Media/Disk/+3/Drive B:/Write protect", 0 },
{ UI_MENU_ITEM_MEDIA_DISK_PLUS3_B_WP_SET,
"/Media/Disk/+3/Drive B:/Write protect/Enable",
"/Media/Disk/+3/Drive B:/Write protect/Disable", 1 },
{ UI_MENU_ITEM_MEDIA_DISK_BETA, "/Media/Disk/Beta" },
{ UI_MENU_ITEM_MEDIA_DISK_BETA_A_EJECT,
"/Media/Disk/Beta/Drive A:/Eject",
"/Media/Disk/Beta/Drive A:/Eject and write...", 0,
"/Media/Disk/Beta/Drive A:/Write protect", 0 },
{ UI_MENU_ITEM_MEDIA_DISK_BETA_A_WP_SET,
"/Media/Disk/Beta/Drive A:/Write protect/Enable",
"/Media/Disk/Beta/Drive A:/Write protect/Disable", 1 },
{ UI_MENU_ITEM_MEDIA_DISK_BETA_B_EJECT,
"/Media/Disk/Beta/Drive B:/Eject",
"/Media/Disk/Beta/Drive B:/Eject and write...", 0,
"/Media/Disk/Beta/Drive B:/Write protect", 0 },
{ UI_MENU_ITEM_MEDIA_DISK_BETA_B_WP_SET,
"/Media/Disk/Beta/Drive B:/Write protect/Enable",
"/Media/Disk/Beta/Drive B:/Write protect/Disable", 1 },
{ UI_MENU_ITEM_MEDIA_DISK_BETA_C_EJECT,
"/Media/Disk/Beta/Drive C:/Eject",
"/Media/Disk/Beta/Drive C:/Eject and write...", 0,
"/Media/Disk/Beta/Drive C:/Write protect", 0 },
{ UI_MENU_ITEM_MEDIA_DISK_BETA_C_WP_SET,
"/Media/Disk/Beta/Drive C:/Write protect/Enable",
"/Media/Disk/Beta/Drive C:/Write protect/Disable", 1 },
{ UI_MENU_ITEM_MEDIA_DISK_BETA_D_EJECT,
"/Media/Disk/Beta/Drive D:/Eject",
"/Media/Disk/Beta/Drive D:/Eject and write...", 0,
"/Media/Disk/Beta/Drive D:/Write protect", 0 },
{ UI_MENU_ITEM_MEDIA_DISK_BETA_D_WP_SET,
"/Media/Disk/Beta/Drive D:/Write protect/Enable",
"/Media/Disk/Beta/Drive D:/Write protect/Disable", 1 },
{ UI_MENU_ITEM_MEDIA_DISK_PLUSD, "/Media/Disk/+D" },
{ UI_MENU_ITEM_MEDIA_DISK_PLUSD_1_EJECT,
"/Media/Disk/+D/Drive 1/Eject",
"/Media/Disk/+D/Drive 1/Eject and write...", 0,
"/Media/Disk/+D/Drive 1/Write protect", 0 },
{ UI_MENU_ITEM_MEDIA_DISK_PLUSD_1_WP_SET,
"/Media/Disk/+D/Drive 1/Write protect/Enable",
"/Media/Disk/+D/Drive 1/Write protect/Disable", 1 },
{ UI_MENU_ITEM_MEDIA_DISK_PLUSD_2_EJECT,
"/Media/Disk/+D/Drive 2/Eject",
"/Media/Disk/+D/Drive 2/Eject and write...", 0,
"/Media/Disk/+D/Drive 2/Write protect", 0 },
{ UI_MENU_ITEM_MEDIA_DISK_PLUSD_2_WP_SET,
"/Media/Disk/+D/Drive 2/Write protect/Enable",
"/Media/Disk/+D/Drive 2/Write protect/Disable", 1 },
{ UI_MENU_ITEM_MEDIA_IDE, "/Media/IDE" },
{ UI_MENU_ITEM_MEDIA_IDE_SIMPLE8BIT, "/Media/IDE/Simple 8-bit" },
{ UI_MENU_ITEM_MEDIA_IDE_SIMPLE8BIT_MASTER_EJECT,
"/Media/IDE/Simple 8-bit/Master/Commit",
"/Media/IDE/Simple 8-bit/Master/Eject", 0 },
{ UI_MENU_ITEM_MEDIA_IDE_SIMPLE8BIT_SLAVE_EJECT,
"/Media/IDE/Simple 8-bit/Slave/Commit",
"/Media/IDE/Simple 8-bit/Slave/Eject", 0 },
{ UI_MENU_ITEM_MEDIA_IDE_ZXATASP, "/Media/IDE/ZXATASP" },
{ UI_MENU_ITEM_MEDIA_IDE_ZXATASP_MASTER_EJECT,
"/Media/IDE/ZXATASP/Master/Commit",
"/Media/IDE/ZXATASP/Master/Eject", 0 },
{ UI_MENU_ITEM_MEDIA_IDE_ZXATASP_SLAVE_EJECT,
"/Media/IDE/ZXATASP/Slave/Commit",
"/Media/IDE/ZXATASP/Slave/Eject", 0 },
{ UI_MENU_ITEM_MEDIA_IDE_ZXCF, "/Media/IDE/ZXCF CompactFlash" },
{ UI_MENU_ITEM_MEDIA_IDE_ZXCF_EJECT,
"/Media/IDE/ZXCF CompactFlash/Commit",
"/Media/IDE/ZXCF CompactFlash/Eject", 0 },
{ UI_MENU_ITEM_MEDIA_IDE_DIVIDE, "/Media/IDE/DivIDE" },
{ UI_MENU_ITEM_MEDIA_IDE_DIVIDE_MASTER_EJECT,
"/Media/IDE/DivIDE/Master/Commit",
"/Media/IDE/DivIDE/Master/Eject", 0 },
{ UI_MENU_ITEM_MEDIA_IDE_DIVIDE_SLAVE_EJECT,
"/Media/IDE/DivIDE/Slave/Commit",
"/Media/IDE/DivIDE/Slave/Eject", 0 },
{ UI_MENU_ITEM_RECORDING,
"/File/Recording/Stop",
"/File/Recording/Record...", 1,
"/File/Recording/Record from snapshot...", 1,
"/File/Recording/Play...", 1 },
{ UI_MENU_ITEM_RECORDING_ROLLBACK,
"/File/Recording/Insert snapshot",
"/File/Recording/Rollback", 0,
"/File/Recording/Rollback to...", 0 },
{ UI_MENU_ITEM_AY_LOGGING,
"/File/AY Logging/Stop",
"/File/AY Logging/Record...", 1, },
{ UI_MENU_ITEM_TAPE_RECORDING,
"/Media/Tape/Record Stop",
"/Media/Tape/Record Start", 1,
"/Media/Tape/Open...", 1,
"/Media/Tape/Play", 1,
"/Media/Tape/Rewind", 1,
"/Media/Tape/Clear", 1,
"/Media/Tape/Write...", 1 },
{ UI_MENU_ITEM_TAPE_RECORDING, NULL }, /* End marker */
};
int
ui_menu_activate( ui_menu_item item, int active )
{
const struct menu_item_entries *ptr;
for( ptr = menu_item_lookup; ptr->string1; ptr++ ) {
if( item == ptr->item ) {
ui_menu_item_set_active( ptr->string1, active );
if( ptr->string2 )
ui_menu_item_set_active( ptr->string2,
ptr->string2_inverted ? !active : active );
if( ptr->string3 )
ui_menu_item_set_active( ptr->string3,
ptr->string3_inverted ? !active : active );
if( ptr->string4 )
ui_menu_item_set_active( ptr->string4,
ptr->string4_inverted ? !active : active );
if( ptr->string5 )
ui_menu_item_set_active( ptr->string5,
ptr->string5_inverted ? !active : active );
if( ptr->string6 )
ui_menu_item_set_active( ptr->string6,
ptr->string6_inverted ? !active : active );
if( ptr->string7 )
ui_menu_item_set_active( ptr->string7,
ptr->string7_inverted ? !active : active );
return 0;
}
}
ui_error( UI_ERROR_ERROR, "ui_menu_activate: unknown item %d", item );
return 1;
}
void
ui_menu_disk_update( void )
{
int plus3, beta, plusd;
int capabilities;
capabilities = machine_current->capabilities;
/* Set the disk menu items and statusbar appropriately */
plus3 = capabilities & LIBSPECTRUM_MACHINE_CAPABILITY_PLUS3_DISK;
beta = beta_available;
plusd = plusd_available;
if( plus3 || beta || plusd ) {
ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK, 1 );
ui_statusbar_update( UI_STATUSBAR_ITEM_DISK, UI_STATUSBAR_STATE_INACTIVE );
} else {
ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK, 0 );
ui_statusbar_update( UI_STATUSBAR_ITEM_DISK,
UI_STATUSBAR_STATE_NOT_AVAILABLE );
}
ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_PLUS3, plus3 );
ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_BETA, beta );
ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_PLUSD, plusd );
}
int
ui_tape_write( void )
{
char *filename;
fuse_emulation_pause();
filename = ui_get_save_filename( "Fuse - Write Tape" );
if( !filename ) { fuse_emulation_unpause(); return 1; }
tape_write( filename );
free( filename );
fuse_emulation_unpause();
return 0;
}
int
ui_plus3_disk_write( specplus3_drive_number which )
{
char drive, *filename, title[80];
switch( which ) {
case SPECPLUS3_DRIVE_A: drive = 'A'; break;
case SPECPLUS3_DRIVE_B: drive = 'B'; break;
default: drive = '?'; break;
}
fuse_emulation_pause();
snprintf( title, 80, "Fuse - Write +3 Disk %c:", drive );
filename = ui_get_save_filename( title );
if( !filename ) { fuse_emulation_unpause(); return 1; }
specplus3_disk_write( which, filename );
free( filename );
fuse_emulation_unpause();
return 0;
}
int
ui_beta_disk_write( beta_drive_number which )
{
char drive, *filename, title[80];
switch( which ) {
case BETA_DRIVE_A: drive = 'A'; break;
case BETA_DRIVE_B: drive = 'B'; break;
case BETA_DRIVE_C: drive = 'C'; break;
case BETA_DRIVE_D: drive = 'D'; break;
default: drive = '?'; break;
}
fuse_emulation_pause();
snprintf( title, 80, "Fuse - Write Beta Disk %c:", drive );
filename = ui_get_save_filename( title );
if( !filename ) { fuse_emulation_unpause(); return 1; }
beta_disk_write( which, filename );
free( filename );
fuse_emulation_unpause();
return 0;
}
int
ui_plusd_disk_write( plusd_drive_number which )
{
char drive, *filename, title[80];
switch( which ) {
case PLUSD_DRIVE_1: drive = '1'; break;
case PLUSD_DRIVE_2: drive = '2'; break;
default: drive = '?'; break;
}
fuse_emulation_pause();
snprintf( title, 80, "Fuse - Write +D Disk %c", drive );
filename = ui_get_save_filename( title );
if( !filename ) { fuse_emulation_unpause(); return 1; }
plusd_disk_write( which, filename );
free( filename );
fuse_emulation_unpause();
return 0;
}
int
ui_mdr_write( int which )
{
char *filename, title[80];
fuse_emulation_pause();
snprintf( title, 80, "Fuse - Write Microdrive Cartridge %i", which + 1 );
filename = ui_get_save_filename( title );
if( !filename ) { fuse_emulation_unpause(); return 1; }
if1_mdr_write( which, filename );
free( filename );
fuse_emulation_unpause();
return 0;
}