Attempt #2 to implement CD-ROM passthrough.

Still Windows only on the QT side.
This commit is contained in:
TC1995
2024-05-18 19:42:00 +02:00
parent dd9f6f8bd4
commit 4fdb339407
12 changed files with 356 additions and 247 deletions

View File

@@ -246,6 +246,8 @@ typedef struct cdrom {
int audio_op;
int audio_muted_soft;
int sony_msf;
int host;
int letter;
const cdrom_ops_t *ops;
@@ -309,7 +311,7 @@ extern void cdrom_image_reset(cdrom_t *dev);
extern void cdrom_ioctl_eject(void);
extern void cdrom_ioctl_load(void);
extern int cdrom_ioctl_open(cdrom_t *dev, const char d);
extern int cdrom_ioctl_open(cdrom_t *dev, char *path, int letter);
extern void cdrom_update_cdb(uint8_t *cdb, int lba_pos,
int number_of_blocks);

View File

@@ -0,0 +1,32 @@
/*
* 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.
*
* CD-ROM image file handling module header, translated to C
* from cdrom_dosbox.h.
*
* Authors: RichardG,
* Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2016-2022 RichardG.
* Copyright 2016-2022 Miran Grca.
*/
#ifndef CDROM_IOCTL_H
#define CDROM_IOCTL_H
/* this header file lists the functions provided by
various platform specific cdrom-ioctl files */
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /*CDROM_IOCTL_H*/

View File

@@ -0,0 +1,66 @@
/*
* 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.
*
* Definitions for platform specific serial to host passthrough.
*
*
* Authors: Andreas J. Reichel <webmaster@6th-dimension.com>,
* Jasmine Iwanek <jasmine@iwanek.co.uk>
*
* Copyright 2021 Andreas J. Reichel.
* Copyright 2021-2022 Jasmine Iwanek.
*/
#ifndef PLAT_CDROM_H
#define PLAT_CDROM_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define RAW_SECTOR_SIZE 2352
#define COOKED_SECTOR_SIZE 2048
#define DATA_TRACK 0x14
#define AUDIO_TRACK 0x10
#define CD_FPS 75
#define FRAMES_TO_MSF(f, M, S, F) \
{ \
uint64_t value = f; \
*(F) = (value % CD_FPS) & 0xff; \
value /= CD_FPS; \
*(S) = (value % 60) & 0xff; \
value /= 60; \
*(M) = value & 0xff; \
}
#define MSF_TO_FRAMES(M, S, F) ((M) *60 * CD_FPS + (S) *CD_FPS + (F))
typedef struct SMSF {
uint16_t min;
uint8_t sec;
uint8_t fr;
} TMSF;
extern int plat_cdrom_is_track_audio(uint32_t sector);
extern int plat_cdrom_get_last_block(void);
extern void plat_cdrom_get_audio_tracks(int *st_track, int *end, TMSF *lead_out);
extern int plat_cdrom_get_audio_track_info(int end, int track, int *track_num, TMSF *start, uint8_t *attr);
extern int plat_cdrom_get_audio_sub(uint32_t sector, uint8_t *attr, uint8_t *track, uint8_t *index, TMSF *rel_pos, TMSF *abs_pos);
extern int plat_cdrom_get_sector_size(uint32_t sector);
extern int plat_cdrom_read_sector(uint8_t *buffer, int raw, uint32_t sector);
extern void plat_cdrom_close(void);
extern int plat_cdrom_open(char *path, int letter);
#ifdef __cplusplus
}
#endif
#endif