Some fixes and implemented the --image/-I command line parameter to load an image to the specified floppy drive.
This commit is contained in:
40
src/86box.c
40
src/86box.c
@@ -403,10 +403,12 @@ pc_init(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
char *ppath = NULL, *rpath = NULL;
|
char *ppath = NULL, *rpath = NULL;
|
||||||
char *cfg = NULL, *p;
|
char *cfg = NULL, *p;
|
||||||
char temp[2048];
|
char temp[2048], *fn[FDD_NUM] = { NULL };
|
||||||
|
char drive = 0, *temp2 = NULL;
|
||||||
struct tm *info;
|
struct tm *info;
|
||||||
time_t now;
|
time_t now;
|
||||||
int c, lvmp = 0;
|
int c, lvmp = 0;
|
||||||
|
int i;
|
||||||
#ifdef ENABLE_NG
|
#ifdef ENABLE_NG
|
||||||
int ng = 0;
|
int ng = 0;
|
||||||
#endif
|
#endif
|
||||||
@@ -456,6 +458,13 @@ pc_init(int argc, char *argv[])
|
|||||||
|
|
||||||
if (!strcasecmp(argv[c], "--help") || !strcasecmp(argv[c], "-?")) {
|
if (!strcasecmp(argv[c], "--help") || !strcasecmp(argv[c], "-?")) {
|
||||||
usage:
|
usage:
|
||||||
|
for (i = 0; i < FDD_NUM; i++) {
|
||||||
|
if (fn[i] != NULL) {
|
||||||
|
free(fn[i]);
|
||||||
|
fn[i] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
printf("\nUsage: 86box [options] [cfg-file]\n\n");
|
printf("\nUsage: 86box [options] [cfg-file]\n\n");
|
||||||
printf("Valid options are:\n\n");
|
printf("Valid options are:\n\n");
|
||||||
printf("-? or --help - show this information\n");
|
printf("-? or --help - show this information\n");
|
||||||
@@ -471,6 +480,7 @@ usage:
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
printf("-H or --hwnd id,hwnd - sends back the main dialog's hwnd\n");
|
printf("-H or --hwnd id,hwnd - sends back the main dialog's hwnd\n");
|
||||||
#endif
|
#endif
|
||||||
|
printf("-I or --image d:path - load 'path' as floppy image on drive d\n");
|
||||||
printf("-L or --logfile path - set 'path' to be the logfile\n");
|
printf("-L or --logfile path - set 'path' to be the logfile\n");
|
||||||
printf("-N or --noconfirm - do not ask for confirmation on quit\n");
|
printf("-N or --noconfirm - do not ask for confirmation on quit\n");
|
||||||
printf("-O or --dumpcfg - dump config file after loading\n");
|
printf("-O or --dumpcfg - dump config file after loading\n");
|
||||||
@@ -519,6 +529,25 @@ usage:
|
|||||||
goto usage;
|
goto usage;
|
||||||
|
|
||||||
cfg = argv[++c];
|
cfg = argv[++c];
|
||||||
|
} else if (!strcasecmp(argv[c], "--image") || !strcasecmp(argv[c], "-I")) {
|
||||||
|
if ((c + 1) == argc)
|
||||||
|
goto usage;
|
||||||
|
|
||||||
|
temp2 = (char *) calloc(2048, 1);
|
||||||
|
sscanf(argv[++c], "%c:%s", &drive, temp2);
|
||||||
|
if (drive > 0x40)
|
||||||
|
drive = (drive & 0x1f) - 1;
|
||||||
|
else
|
||||||
|
drive = drive & 0x1f;
|
||||||
|
if (drive < 0)
|
||||||
|
drive = 0;
|
||||||
|
if (drive >= FDD_NUM)
|
||||||
|
drive = FDD_NUM - 1;
|
||||||
|
fn[(int) drive] = (char *) calloc(2048, 1);
|
||||||
|
strcpy(fn[(int) drive], temp2);
|
||||||
|
pclog("Drive %c: %s\n", drive + 0x41, fn[(int) drive]);
|
||||||
|
free(temp2);
|
||||||
|
temp2 = NULL;
|
||||||
} else if (!strcasecmp(argv[c], "--vmname") || !strcasecmp(argv[c], "-V")) {
|
} else if (!strcasecmp(argv[c], "--vmname") || !strcasecmp(argv[c], "-V")) {
|
||||||
if ((c + 1) == argc)
|
if ((c + 1) == argc)
|
||||||
goto usage;
|
goto usage;
|
||||||
@@ -738,6 +767,15 @@ usage:
|
|||||||
/* Load the configuration file. */
|
/* Load the configuration file. */
|
||||||
config_load();
|
config_load();
|
||||||
|
|
||||||
|
for (i = 0; i < FDD_NUM; i++) {
|
||||||
|
if (fn[i] != NULL) {
|
||||||
|
if (strlen(fn[i]) <= 511)
|
||||||
|
strncpy(floppyfns[i], fn[i], 511);
|
||||||
|
free(fn[i]);
|
||||||
|
fn[i] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Load the desired language */
|
/* Load the desired language */
|
||||||
if (lang_init)
|
if (lang_init)
|
||||||
lang_id = lang_init;
|
lang_id = lang_init;
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include <math.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -594,7 +595,7 @@ scsi_cdrom_update_request_length(scsi_cdrom_t *dev, int len, int block_len)
|
|||||||
that a media access comand does not DRQ in the middle of a sector. One of the drivers that
|
that a media access comand does not DRQ in the middle of a sector. One of the drivers that
|
||||||
relies on the correctness of this behavior is MTMCDAI.SYS (the Mitsumi CD-ROM driver) for DOS
|
relies on the correctness of this behavior is MTMCDAI.SYS (the Mitsumi CD-ROM driver) for DOS
|
||||||
which uses the READ CD command to read data on some CD types. */
|
which uses the READ CD command to read data on some CD types. */
|
||||||
if (dev->current_cdb[0] == 0xb9) || (dev->current_cdb[0] == 0xbe) {
|
if ((dev->current_cdb[0] == 0xb9) || (dev->current_cdb[0] == 0xbe)) {
|
||||||
/* Round to sector length. */
|
/* Round to sector length. */
|
||||||
dlen = ((double) dev->request_length) / ((double) block_len);
|
dlen = ((double) dev->request_length) / ((double) block_len);
|
||||||
dev->request_length = ((uint16_t) floor(dlen)) * block_len;
|
dev->request_length = ((uint16_t) floor(dlen)) * block_len;
|
||||||
|
Reference in New Issue
Block a user