5
* Andreas Boose <viceteam@t-online.de>
7
* This file is part of VICE, the Versatile Commodore Emulator.
8
* See README for copyright notice.
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
31
#include "c64exp-resources.h"
36
#include "resources.h"
40
static char *profdos_1571_name = NULL;
43
static void set_drive_ram(unsigned int dnr)
45
drive_t *drive = drive_context[dnr]->drive;
47
if (drive->type != DRIVE_TYPE_1570 && drive->type != DRIVE_TYPE_1571
48
&& drive->type != DRIVE_TYPE_1571CR)
51
drivemem_init(drive_context[dnr], drive->type);
56
static int set_drive_parallel_cable(int val, void *param)
58
drive_t *drive = drive_context[(unsigned int)param]->drive;
60
if (val != DRIVE_PC_NONE && val != DRIVE_PC_STANDARD
61
&& val != DRIVE_PC_DD3)
64
drive->parallel_cable = val;
65
set_drive_ram((unsigned int)param);
70
static int set_drive_profdos(int val, void *param)
72
drive_t *drive = drive_context[(unsigned int)param]->drive;;
75
set_drive_ram((unsigned int)param);
80
static int set_profdos_1571_name(const char *val, void *param)
82
if (util_string_set(&profdos_1571_name, val))
85
return profdos_load_1571(profdos_1571_name);
88
static resource_int_t res_drive[] = {
89
{ NULL, 0, RES_EVENT_SAME, NULL,
90
NULL, set_drive_parallel_cable, NULL },
91
{ NULL, 0, RES_EVENT_SAME, NULL,
92
NULL, set_drive_profdos, NULL },
96
static const resource_string_t resources_string[] =
98
{ "DriveProfDOS1571Name", "", RES_EVENT_NO, NULL,
99
&profdos_1571_name, set_profdos_1571_name, NULL },
103
int c64exp_resources_init(void)
108
for (dnr = 0; dnr < DRIVE_NUM; dnr++) {
109
drive = drive_context[dnr]->drive;
111
res_drive[0].name = lib_msprintf("Drive%iParallelCable", dnr + 8);
112
res_drive[0].value_ptr = &(drive->parallel_cable);
113
res_drive[0].param = (void *)dnr;
114
res_drive[1].name = lib_msprintf("Drive%iProfDOS", dnr + 8);
115
res_drive[1].value_ptr = &(drive->profdos);
116
res_drive[1].param = (void *)dnr;
118
if (resources_register_int(res_drive) < 0)
121
lib_free((char *)(res_drive[0].name));
122
lib_free((char *)(res_drive[1].name));
125
return resources_register_string(resources_string);
128
void c64exp_resources_shutdown(void)
130
lib_free(profdos_1571_name);