5
* Andreas Boose <viceteam@t-online.de>
6
* Ettore Perazzoli <ettore@comm2000.it>
8
* This file is part of VICE, the Versatile Commodore Emulator.
9
* See README for copyright notice.
11
* This program is free software; you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation; either version 2 of the License, or
14
* (at your option) any later version.
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU General Public License for more details.
21
* You should have received a copy of the GNU General Public License
22
* along with this program; if not, write to the Free Software
23
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
35
#include "resources.h"
43
UI_CALLBACK(ui_set_romset)
45
machine_romset_file_load(UI_MENU_CB_PARAM);
49
UI_CALLBACK(ui_load_rom_file)
53
static char *last_dir;
55
vsync_suspend_speed_eval();
57
filename = ui_select_file(_("Load ROM file"),
58
NULL, 0, False, last_dir, "*", &button,
63
if (resources_set_value(UI_MENU_CB_PARAM,
64
(resource_value_t)filename) < 0)
65
ui_error(_("Could not load ROM file\n'%s'"), filename);
68
util_fname_split(filename, &last_dir, NULL);
71
/* Do nothing special. */
79
UI_CALLBACK(ui_unload_rom_file)
81
resources_set_value((char*)UI_MENU_CB_PARAM, (resource_value_t)NULL);
84
UI_MENU_DEFINE_RADIO(RomsetSourceFile)
86
ui_menu_entry_t uiromset_type_submenu[] = {
87
{ "*Archive", (ui_callback_t)radio_RomsetSourceFile,
88
(ui_callback_data_t)0, NULL },
89
{ "*File", (ui_callback_t)radio_RomsetSourceFile,
90
(ui_callback_data_t)1, NULL },
94
static UI_CALLBACK(uiromset_archive_load)
98
static char *last_dir;
100
vsync_suspend_speed_eval();
102
filename = ui_select_file(_("Load custom ROM set archive"),
103
NULL, 0, False, last_dir, "*.vra",
104
&button, False, NULL);
108
if (romset_archive_load(filename, 0) < 0)
109
ui_error(_("Could not load ROM set archive\n'%s'"), filename);
112
util_fname_split(filename, &last_dir, NULL);
115
/* Do nothing special. */
121
if (filename != NULL)
125
static UI_CALLBACK(uiromset_archive_save)
131
vsync_suspend_speed_eval();
133
new_value = lib_malloc(len + 1);
134
strcpy(new_value, "");
136
button = ui_input_string(_("File to save ROM set archive to"),
137
_("ROM set archive:"), new_value, len);
139
if (button == UI_BUTTON_OK)
140
romset_archive_save(new_value);
145
static UI_CALLBACK(uiromset_archive_list)
149
list = romset_archive_list();
151
ui_show_text(_("Current ROM set archive"), list, -1, -1);
156
static UI_CALLBACK(uiromset_archive_item_create)
162
vsync_suspend_speed_eval();
164
new_value = lib_malloc(len + 1);
165
strcpy(new_value, "");
167
button = ui_input_string(_("ROM set item name to create"),
168
_("ROM set name:"), new_value, len);
170
if (button == UI_BUTTON_OK)
171
machine_romset_archive_item_create(new_value);
176
static UI_CALLBACK(uiromset_archive_item_delete)
178
static char input_string[32];
182
vsync_suspend_speed_eval();
183
button = ui_input_string(_("Delete configuration"), _("Enter name"),
185
if (button == UI_BUTTON_OK) {
186
romset_archive_item_delete(input_string);
192
static UI_CALLBACK(uiromset_archive_item_select)
194
static char input_string[32];
199
resources_get_value("RomsetArchiveActive", (void *)&active);
202
sprintf(input_string, "%s", active);
204
vsync_suspend_speed_eval();
205
button = ui_input_string(_("Active configuration"), _("Enter name"),
207
if (button == UI_BUTTON_OK) {
208
resources_set_value("RomsetArchiveActive",
209
(resource_value_t)input_string);
215
ui_menu_entry_t uiromset_archive_submenu[] = {
216
{ N_("Load ROM set archive"),
217
(ui_callback_t)uiromset_archive_load, NULL, NULL },
218
{ N_("Save ROM set archive"),
219
(ui_callback_t)uiromset_archive_save, NULL, NULL },
220
{ N_("List current ROM set archive"),
221
(ui_callback_t)uiromset_archive_list, NULL, NULL },
223
{ N_("Create ROM set item"),
224
(ui_callback_t)uiromset_archive_item_create, NULL, NULL },
225
{ N_("Delete ROM set item"),
226
(ui_callback_t)uiromset_archive_item_delete, NULL, NULL },
227
{ N_("Select ROM set item"),
228
(ui_callback_t)uiromset_archive_item_select, NULL, NULL },
232
void uiromset_menu_init(void)
236
static UI_CALLBACK(uiromset_file_load)
240
static char *last_dir;
242
vsync_suspend_speed_eval();
244
filename = ui_select_file(_("Load custom ROM set file"),
245
NULL, 0, False, last_dir, "*.vrs",
246
&button, False, NULL);
250
if (machine_romset_file_load(filename) < 0)
251
ui_error(_("Could not load ROM set file\n'%s'"), filename);
254
util_fname_split(filename, &last_dir, NULL);
257
/* Do nothing special. */
263
if (filename != NULL)
267
static UI_CALLBACK(uiromset_file_save)
273
vsync_suspend_speed_eval();
275
new_value = lib_malloc(len + 1);
276
strcpy(new_value, "");
278
button = ui_input_string(_("File to save ROM set definition to"),
279
_("ROM set file:"), new_value, len);
281
if (button == UI_BUTTON_OK)
282
machine_romset_file_save(new_value);
287
static UI_CALLBACK(uiromset_file_list)
291
list = machine_romset_file_list();
293
ui_show_text(_("Current ROM set"), list, -1, -1);
298
ui_menu_entry_t uiromset_file_submenu[] = {
299
{ N_("Load custom ROM set from file"),
300
(ui_callback_t)uiromset_file_load, NULL, NULL },
301
{ N_("Dump ROM set definition to file"),
302
(ui_callback_t)uiromset_file_save, NULL, NULL },
303
{ N_("List current ROM set"),
304
(ui_callback_t)uiromset_file_list, NULL, NULL },