Skip to content

Commit

Permalink
Merge branch '86Box:master' into usb-bochs
Browse files Browse the repository at this point in the history
  • Loading branch information
Cacodemon345 authored Jan 10, 2025
2 parents 713960c + 5d71b81 commit eeacbed
Show file tree
Hide file tree
Showing 63 changed files with 3,795 additions and 2,297 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cmake_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build
- name: Run sonar-scanner
# if: 0
if: 0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand Down
10 changes: 6 additions & 4 deletions src/86box.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ int video_fullscreen_scale_maximized = 0; /* (C) Whether
also apply when maximized. */
int do_auto_pause = 0; /* (C) Auto-pause the emulator on focus
loss */
int raw_input = 0; /* (C) Use raw input */
int hook_enabled = 1; /* (C) Keyboard hook is enabled */
char uuid[MAX_UUID_LEN] = { '\0' }; /* (C) UUID or machine identifier */

int other_ide_present = 0; /* IDE controllers from non-IDE cards are
Expand Down Expand Up @@ -454,6 +454,8 @@ delete_nvr_file(uint8_t flash)
fn = NULL;
}

extern void device_find_all_descs(void);

/*
* Perform initial startup of the PC.
*
Expand Down Expand Up @@ -563,7 +565,7 @@ pc_init(int argc, char *argv[])
printf("-S or --settings - show only the settings dialog\n");
#endif
printf("-V or --vmname name - overrides the name of the running VM\n");
printf("-W or --raw - uses raw input (compatibility-only outside Windows)\n");
printf("-W or --nohook - disables keyboard hook (compatibility-only outside Windows)\n");
printf("-X or --clear what - clears the 'what' (cmos/flash/both)\n");
printf("-Y or --donothing - do not show any UI or run the emulation\n");
printf("-Z or --lastvmpath - the last parameter is VM path rather than config\n");
Expand Down Expand Up @@ -639,8 +641,8 @@ pc_init(int argc, char *argv[])
dump_missing = 1;
} else if (!strcasecmp(argv[c], "--donothing") || !strcasecmp(argv[c], "-Y")) {
do_nothing = 1;
} else if (!strcasecmp(argv[c], "--raw") || !strcasecmp(argv[c], "-W")) {
raw_input = 1;
} else if (!strcasecmp(argv[c], "--nohook") || !strcasecmp(argv[c], "-W")) {
hook_enabled = 0;
} else if (!strcasecmp(argv[c], "--keycodes") || !strcasecmp(argv[c], "-K")) {
if ((c + 1) == argc)
goto usage;
Expand Down
30 changes: 4 additions & 26 deletions src/cdrom/cdrom.c
Original file line number Diff line number Diff line change
Expand Up @@ -1426,33 +1426,11 @@ cdrom_get_track_buffer(cdrom_t *dev, uint8_t *buf)
buf[8] = 0x00;
}

/* TODO: Actually implement this properly. */
void
cdrom_get_q(cdrom_t *dev, uint8_t *buf, int *curtoctrk, uint8_t mode)
{
track_info_t ti;
int first_track;
int last_track;

if (dev != NULL) {
dev->ops->get_tracks(dev, &first_track, &last_track);
dev->ops->get_track_info(dev, *curtoctrk, 0, &ti);
buf[0] = (ti.attr << 4) & 0xf0;
buf[1] = ti.number;
buf[2] = bin2bcd(*curtoctrk + 1);
buf[3] = ti.m;
buf[4] = ti.s;
buf[5] = ti.f;
buf[6] = 0x00;
dev->ops->get_track_info(dev, 1, 0, &ti);
buf[7] = ti.m;
buf[8] = ti.s;
buf[9] = ti.f;
if (*curtoctrk >= (last_track + 1))
*curtoctrk = 0;
else if (mode)
*curtoctrk = *curtoctrk + 1;
} else
memset(buf, 0x00, 10);
memset(buf, 0x00, 10);
}

uint8_t
Expand Down Expand Up @@ -2196,7 +2174,7 @@ cdrom_exit(uint8_t id)

memset(dev->image_path, 0, sizeof(dev->image_path));

pclog("cdrom_exit(%i): cdrom_insert(%i)\n", id, id);
cdrom_log("cdrom_exit(%i): cdrom_insert(%i)\n", id, id);
cdrom_insert(id);
}

Expand Down Expand Up @@ -2274,7 +2252,7 @@ cdrom_reload(uint8_t id)
#endif

/* Signal media change to the emulated machine. */
pclog("cdrom_reload(%i): cdrom_insert(%i)\n", id, id);
cdrom_log("cdrom_reload(%i): cdrom_insert(%i)\n", id, id);
cdrom_insert(id);

/* The drive was previously empty, transition directly to UNIT ATTENTION. */
Expand Down
83 changes: 35 additions & 48 deletions src/cdrom/cdrom_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,32 @@ cdrom_image_log(const char *fmt, ...)
of the audio while audio still plays. With an absolute conversion, the counter is fine. */
#define MSFtoLBA(m, s, f) ((((m * 60) + s) * 75) + f)

static void
image_get_tracks(cdrom_t *dev, int *first, int *last)
{
cd_img_t *img = (cd_img_t *) dev->local;
TMSF tmsf;

cdi_get_audio_tracks(img, first, last, &tmsf);
}

static void
image_get_track_info(cdrom_t *dev, uint32_t track, int end, track_info_t *ti)
{
cd_img_t *img = (cd_img_t *) dev->local;
TMSF tmsf;
track_t *ct = NULL;

cdi_get_audio_track_info(img, end, track, &ti->number, &tmsf, &ti->attr);
for (int i = 0; i < img->tracks_num; i++) {
ct = &(img->tracks[i]);
if (ct->point == track)
break;
}

ti->m = tmsf.min;
ti->s = tmsf.sec;
ti->f = tmsf.fr;
ti->number = ct->point;

if (ct == NULL) {
ti->attr = 0x14;
ti->m = 0;
ti->s = 2;
ti->f = 0;
} else {
uint32_t pos = end ? ct->idx[1].start : (ct->idx[1].start + ct->idx[1].length);
ti->attr = ct->attr;
ti->m = (pos / 75) / 60;
ti->s = (pos / 75) % 60;
ti->f = pos % 75;
}
}

static void
Expand Down Expand Up @@ -113,38 +119,32 @@ static int
image_get_capacity(cdrom_t *dev)
{
cd_img_t *img = (cd_img_t *) dev->local;
int first_track;
int last_track;
int number;
unsigned char attr;
uint32_t address = 0;
uint32_t lb = 0;
track_t *lo = NULL;

if (!img)
return 0;

cdi_get_audio_tracks_lba(img, &first_track, &last_track, &lb);

for (int c = 0; c <= last_track; c++) {
cdi_get_audio_track_info_lba(img, 0, c + 1, &number, &address, &attr);
if (address > lb)
lb = address;
for (int i = (img->tracks_num - 1); i >= 0; i--) {
if (img->tracks[i].point == 0xa2) {
lo = &(img->tracks[i]);
break;
}
}

if (lo != NULL)
lb = lo->idx[1].start - 1;

return lb;
}

static int
image_is_track_audio(cdrom_t *dev, uint32_t pos, int ismsf)
{
cd_img_t *img = (cd_img_t *) dev->local;
uint8_t attr;
TMSF tmsf;
int m;
int s;
int f;
int number;
int track;

if (!img || (dev->cd_status == CD_STATUS_DATA_ONLY))
return 0;
Expand All @@ -156,29 +156,18 @@ image_is_track_audio(cdrom_t *dev, uint32_t pos, int ismsf)
pos = MSFtoLBA(m, s, f) - 150;
}

/* GetTrack requires LBA. */
track = cdi_get_track(img, pos);
if (track == -1)
return 0;
else {
cdi_get_audio_track_info(img, 0, track, &number, &tmsf, &attr);
return attr == AUDIO_TRACK;
}
return cdi_is_audio(img, pos);
}

static int
image_is_track_pre(cdrom_t *dev, uint32_t lba)
{
cd_img_t *img = (cd_img_t *) dev->local;
int track;

/* GetTrack requires LBA. */
track = cdi_get_track(img, lba);

if (track != -1)
return cdi_get_audio_track_pre(img, track);
if (!img || (dev->cd_status == CD_STATUS_DATA_ONLY))
return 0;

return 0;
return cdi_is_pre(img, lba);
}

static int
Expand Down Expand Up @@ -238,7 +227,6 @@ image_exit(cdrom_t *dev)
}

static const cdrom_ops_t cdrom_image_ops = {
image_get_tracks,
image_get_track_info,
image_get_raw_track_info,
image_get_subchannel,
Expand Down Expand Up @@ -270,14 +258,13 @@ cdrom_image_open(cdrom_t *dev, const char *fn)
strcpy(dev->image_path, fn);

/* Create new instance of the CDROM_Image class. */
img = (cd_img_t *) malloc(sizeof(cd_img_t));
img = (cd_img_t *) calloc(1, sizeof(cd_img_t));

/* This guarantees that if ops is not NULL, then
neither is the image pointer. */
if (!img)
if (img == NULL)
return image_open_abort(dev);

memset(img, 0, sizeof(cd_img_t));
dev->local = img;

/* Open the image. */
Expand Down
Loading

0 comments on commit eeacbed

Please sign in to comment.