-
Notifications
You must be signed in to change notification settings - Fork 8
/
menu_selectdrive.c
96 lines (77 loc) · 2.98 KB
/
menu_selectdrive.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
/*
//
// Copyright (C) 2009-2023 Jean-François DEL NERO
//
// This file is part of the HxCFloppyEmulator file selector.
//
// HxCFloppyEmulator file selector may be used and distributed without restriction
// provided that this copyright statement is not removed from the file and that any
// derivative work contains the original copyright notice and the associated
// disclaimer.
//
// HxCFloppyEmulator file selector 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.
//
// HxCFloppyEmulator file selector 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 HxCFloppyEmulator file selector; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
*/
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include "keysfunc_defs.h"
#include "cfg_file.h"
#include "ui_context.h"
#include "gui_utils.h"
#include "menu.h"
#include "hal.h"
#include "fectrl.h"
#include "errors_def.h"
extern unsigned char cfgfile_header[512];
static int selectdrive_menu_cb(ui_context * ctx, int event, int xpos, int ypos, int parameter)
{
int drive,ret;
if(event)
{
drive = parameter;
hxc_printf_box(ctx,"Init emulator I/O...");
deinit_fdc();
ret = mount_drive(ctx, drive);
if( ret != ERR_NO_ERROR )
goto mounterror;
ui_loadfilelistpage(ctx);
}
return MENU_LEAVEMENU;
mounterror:
deinit_fdc();
error_message_box(ctx, ret);
// Fall back to the boot device...
ret = mount_drive(ctx, ctx->bootdev);
if( ret != ERR_NO_ERROR )
{
error_message_box(ctx, ret);
lockup();
}
return MENU_REDRAWMENU;
}
const menu selectdrive_menu[]=
{
{"", 0, 0, 0, CENTER_ALIGNED},
{"Select Drive:", 0, 0, 0, CENTER_ALIGNED},
{"", 0, 0, 0, CENTER_ALIGNED},
{"A: / DF0", selectdrive_menu_cb, 0, 0, CENTER_ALIGNED},
{"B: / DF1", selectdrive_menu_cb, 1, 0, CENTER_ALIGNED},
{"DF2", selectdrive_menu_cb, 2, 0, CENTER_ALIGNED},
{"DF3", selectdrive_menu_cb, 3, 0, CENTER_ALIGNED},
{"", 0, 0, 0, CENTER_ALIGNED},
{"--- Exit ---", 0, 0, (struct menu * )-1, CENTER_ALIGNED},
{0, 0 , 0 ,0}
};