25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: dev_dreamcast_gdrom.c,v 1.4 2007/02/03 20:14:23 debug Exp $ |
* $Id: dev_dreamcast_gdrom.c,v 1.5 2007/06/15 19:11:15 debug Exp $ |
29 |
* |
* |
30 |
* Dreamcast GD-ROM. |
* COMMENT: Dreamcast GD-ROM |
31 |
* |
* |
32 |
* TODO: This is just a dummy so far. |
* TODO: This is just a dummy so far. |
33 |
*/ |
*/ |
78 |
static void alloc_data(struct dreamcast_gdrom_data *d) |
static void alloc_data(struct dreamcast_gdrom_data *d) |
79 |
{ |
{ |
80 |
d->data_len = d->cnt; |
d->data_len = d->cnt; |
81 |
d->data = malloc(d->data_len); |
|
82 |
if (d->data == NULL) { |
CHECK_ALLOCATION(d->data = malloc(d->data_len)); |
|
fprintf(stderr, "GDROM alloc_data: out of memory\n"); |
|
|
exit(1); |
|
|
} |
|
83 |
memset(d->data, 0, d->data_len); |
memset(d->data, 0, d->data_len); |
84 |
} |
} |
85 |
|
|
329 |
|
|
330 |
DEVINIT(dreamcast_gdrom) |
DEVINIT(dreamcast_gdrom) |
331 |
{ |
{ |
332 |
struct machine *machine = devinit->machine; |
struct dreamcast_gdrom_data *d; |
333 |
struct dreamcast_gdrom_data *d = |
|
334 |
malloc(sizeof(struct dreamcast_gdrom_data)); |
CHECK_ALLOCATION(d = malloc(sizeof(struct dreamcast_gdrom_data))); |
|
if (d == NULL) { |
|
|
fprintf(stderr, "out of memory\n"); |
|
|
exit(1); |
|
|
} |
|
335 |
memset(d, 0, sizeof(struct dreamcast_gdrom_data)); |
memset(d, 0, sizeof(struct dreamcast_gdrom_data)); |
336 |
|
|
337 |
memory_device_register(machine->memory, devinit->name, |
memory_device_register(devinit->machine->memory, devinit->name, |
338 |
0x005f7000, 0x100, dev_dreamcast_gdrom_access, d, |
0x005f7000, 0x100, dev_dreamcast_gdrom_access, d, |
339 |
DM_DEFAULT, NULL); |
DM_DEFAULT, NULL); |
340 |
|
|