2017-05-30 03:38:38 +02:00
|
|
|
/*
|
|
|
|
|
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
|
|
|
|
* running old operating systems and software designed for IBM
|
|
|
|
|
* PC systems and compatibles from 1981 through fairly recent
|
|
|
|
|
* system designs based on the PCI bus.
|
|
|
|
|
*
|
|
|
|
|
* This file is part of the 86Box distribution.
|
|
|
|
|
*
|
|
|
|
|
* Implementation of the CD-ROM null interface for unmounted
|
|
|
|
|
* guest CD-ROM drives.
|
|
|
|
|
*
|
2017-11-05 01:57:04 -05:00
|
|
|
* Version: @(#)cdrom_null.c 1.0.6 2017/11/04
|
2017-05-30 03:38:38 +02:00
|
|
|
*
|
2017-06-04 02:11:19 -04:00
|
|
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
2017-05-30 03:38:38 +02:00
|
|
|
* Miran Grca, <mgrca8@gmail.com>
|
2017-10-10 03:07:29 -04:00
|
|
|
*
|
2017-05-30 03:38:38 +02:00
|
|
|
* Copyright 2008-2016 Sarah Walker.
|
2017-09-25 04:31:20 -04:00
|
|
|
* Copyright 2016,2017 Miran Grca.
|
2017-05-30 03:38:38 +02:00
|
|
|
*/
|
2017-09-25 04:31:20 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <wchar.h>
|
2017-10-17 01:59:09 -04:00
|
|
|
#include "../86box.h"
|
2017-05-18 14:03:43 -04:00
|
|
|
#include "cdrom.h"
|
|
|
|
|
|
2017-06-04 02:11:19 -04:00
|
|
|
|
2017-05-18 14:03:43 -04:00
|
|
|
static CDROM null_cdrom;
|
|
|
|
|
|
2017-06-04 02:11:19 -04:00
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
static int
|
|
|
|
|
null_ready(uint8_t id)
|
2017-05-18 14:03:43 -04:00
|
|
|
{
|
2017-10-10 03:07:29 -04:00
|
|
|
return(0);
|
2017-05-18 14:03:43 -04:00
|
|
|
}
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
|
2017-05-18 14:03:43 -04:00
|
|
|
/* Always return 0, the contents of a null CD-ROM drive never change. */
|
2017-10-10 03:07:29 -04:00
|
|
|
static int
|
|
|
|
|
null_medium_changed(uint8_t id)
|
2017-05-18 14:03:43 -04:00
|
|
|
{
|
2017-10-10 03:07:29 -04:00
|
|
|
return(0);
|
2017-05-18 14:03:43 -04:00
|
|
|
}
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
|
|
|
|
|
static uint8_t
|
|
|
|
|
null_getcurrentsubchannel(uint8_t id, uint8_t *b, int msf)
|
2017-05-18 14:03:43 -04:00
|
|
|
{
|
2017-10-10 03:07:29 -04:00
|
|
|
return(0x13);
|
2017-05-18 14:03:43 -04:00
|
|
|
}
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
null_eject(uint8_t id)
|
2017-05-18 14:03:43 -04:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
null_load(uint8_t id)
|
2017-05-18 14:03:43 -04:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
static int
|
|
|
|
|
null_readsector_raw(uint8_t id, uint8_t *buffer, int sector, int ismsf, int cdrom_sector_type, int cdrom_sector_flags, int *len)
|
2017-05-18 14:03:43 -04:00
|
|
|
{
|
2017-10-10 03:07:29 -04:00
|
|
|
*len = 0;
|
|
|
|
|
|
|
|
|
|
return(0);
|
2017-05-18 14:03:43 -04:00
|
|
|
}
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
null_readtoc(uint8_t id, uint8_t *b, uint8_t starttrack, int msf, int maxlen, int single)
|
2017-05-18 14:03:43 -04:00
|
|
|
{
|
2017-10-10 03:07:29 -04:00
|
|
|
return(0);
|
2017-05-18 14:03:43 -04:00
|
|
|
}
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
null_readtoc_session(uint8_t id, uint8_t *b, int msf, int maxlen)
|
2017-05-18 14:03:43 -04:00
|
|
|
{
|
2017-10-10 03:07:29 -04:00
|
|
|
return(0);
|
2017-05-18 14:03:43 -04:00
|
|
|
}
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
null_readtoc_raw(uint8_t id, uint8_t *b, int maxlen)
|
2017-05-18 14:03:43 -04:00
|
|
|
{
|
2017-10-10 03:07:29 -04:00
|
|
|
return(0);
|
2017-05-18 14:03:43 -04:00
|
|
|
}
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
|
|
|
|
|
static uint32_t
|
|
|
|
|
null_size(uint8_t id)
|
2017-05-18 14:03:43 -04:00
|
|
|
{
|
2017-10-10 03:07:29 -04:00
|
|
|
return(0);
|
2017-05-18 14:03:43 -04:00
|
|
|
}
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
null_status(uint8_t id)
|
2017-05-18 14:03:43 -04:00
|
|
|
{
|
2017-10-10 03:07:29 -04:00
|
|
|
return(CD_STATUS_EMPTY);
|
2017-05-18 14:03:43 -04:00
|
|
|
}
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cdrom_null_reset(uint8_t id)
|
2017-05-18 14:03:43 -04:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
|
2017-05-18 14:03:43 -04:00
|
|
|
void cdrom_set_null_handler(uint8_t id);
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
int
|
|
|
|
|
cdrom_null_open(uint8_t id, char d)
|
2017-05-18 14:03:43 -04:00
|
|
|
{
|
2017-10-10 03:07:29 -04:00
|
|
|
cdrom_set_null_handler(id);
|
|
|
|
|
|
|
|
|
|
return(0);
|
2017-05-18 14:03:43 -04:00
|
|
|
}
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
null_close(uint8_t id)
|
2017-05-18 14:03:43 -04:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
|
|
|
|
|
static
|
|
|
|
|
void null_exit(uint8_t id)
|
2017-05-18 14:03:43 -04:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
null_is_track_audio(uint8_t id, uint32_t pos, int ismsf)
|
2017-05-18 14:03:43 -04:00
|
|
|
{
|
2017-10-10 03:07:29 -04:00
|
|
|
return(0);
|
2017-05-18 14:03:43 -04:00
|
|
|
}
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
null_pass_through(uint8_t id, uint8_t *in_cdb, uint8_t *b, uint32_t *len)
|
2017-05-18 14:03:43 -04:00
|
|
|
{
|
2017-10-10 03:07:29 -04:00
|
|
|
return(0);
|
2017-05-18 14:03:43 -04:00
|
|
|
}
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
null_media_type_id(uint8_t id)
|
2017-05-18 14:03:43 -04:00
|
|
|
{
|
2017-10-10 03:07:29 -04:00
|
|
|
return(0x70);
|
2017-05-18 14:03:43 -04:00
|
|
|
}
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cdrom_set_null_handler(uint8_t id)
|
2017-05-18 14:03:43 -04:00
|
|
|
{
|
2017-10-10 03:07:29 -04:00
|
|
|
cdrom_drives[id].handler = &null_cdrom;
|
|
|
|
|
cdrom_drives[id].host_drive = 0;
|
|
|
|
|
memset(cdrom_image[id].image_path, 0, sizeof(cdrom_image[id].image_path));
|
2017-05-18 14:03:43 -04:00
|
|
|
}
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
|
|
|
|
|
static CDROM null_cdrom = {
|
|
|
|
|
null_ready,
|
|
|
|
|
null_medium_changed,
|
|
|
|
|
null_media_type_id,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
null_readtoc,
|
|
|
|
|
null_readtoc_session,
|
|
|
|
|
null_readtoc_raw,
|
|
|
|
|
null_getcurrentsubchannel,
|
|
|
|
|
null_pass_through,
|
|
|
|
|
null_readsector_raw,
|
|
|
|
|
NULL,
|
|
|
|
|
null_load,
|
|
|
|
|
null_eject,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
null_size,
|
|
|
|
|
null_status,
|
|
|
|
|
null_is_track_audio,
|
|
|
|
|
NULL,
|
|
|
|
|
null_exit
|
2017-05-18 14:03:43 -04:00
|
|
|
};
|