Added a bunch of parameters (including one to specify custom ROM path), fixed a warnings, removed excess commented out code from video/vid_voodoo.c, and made Makefile.mingw quiet again.
This commit is contained in:
100
src/86box.c
100
src/86box.c
@@ -109,6 +109,7 @@ int confirm_exit_cmdl = 1; /* (O) do not ask for confirmation on quit if set t
|
|||||||
uint64_t unique_id = 0;
|
uint64_t unique_id = 0;
|
||||||
uint64_t source_hwnd = 0;
|
uint64_t source_hwnd = 0;
|
||||||
#endif
|
#endif
|
||||||
|
char rom_path[1024] = { '\0'}; /* (O) full path to ROMs */
|
||||||
char log_path[1024] = { '\0'}; /* (O) full path of logfile */
|
char log_path[1024] = { '\0'}; /* (O) full path of logfile */
|
||||||
char vm_name[1024] = { '\0'}; /* (O) display name of the VM */
|
char vm_name[1024] = { '\0'}; /* (O) display name of the VM */
|
||||||
|
|
||||||
@@ -379,12 +380,13 @@ pc_log(const char *fmt, ...)
|
|||||||
int
|
int
|
||||||
pc_init(int argc, char *argv[])
|
pc_init(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char path[2048];
|
char path[2048], path2[2048];
|
||||||
char *cfg = NULL, *p;
|
char *cfg = NULL, *p;
|
||||||
char temp[128];
|
char temp[128];
|
||||||
struct tm *info;
|
struct tm *info;
|
||||||
time_t now;
|
time_t now;
|
||||||
int c;
|
int c, ng;
|
||||||
|
int lvmp;
|
||||||
uint32_t *uid, *shwnd;
|
uint32_t *uid, *shwnd;
|
||||||
|
|
||||||
/* Grab the executable's full path. */
|
/* Grab the executable's full path. */
|
||||||
@@ -401,7 +403,10 @@ pc_init(int argc, char *argv[])
|
|||||||
* could have been set to something else.
|
* could have been set to something else.
|
||||||
*/
|
*/
|
||||||
plat_getcwd(usr_path, sizeof(usr_path) - 1);
|
plat_getcwd(usr_path, sizeof(usr_path) - 1);
|
||||||
|
plat_getcwd(rom_path, sizeof(rom_path) - 1);
|
||||||
|
|
||||||
memset(path, 0x00, sizeof(path));
|
memset(path, 0x00, sizeof(path));
|
||||||
|
memset(path2, 0x00, sizeof(path));
|
||||||
|
|
||||||
for (c=1; c<argc; c++) {
|
for (c=1; c<argc; c++) {
|
||||||
if (argv[c][0] != '-') break;
|
if (argv[c][0] != '-') break;
|
||||||
@@ -411,30 +416,45 @@ usage:
|
|||||||
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");
|
||||||
printf("-C or --dumpcfg - dump config file after loading\n");
|
#ifdef _WIN32
|
||||||
|
printf("-A or --crashdump - enables crashdump on exception\n");
|
||||||
|
#endif
|
||||||
|
printf("-C or --config path - set 'path' to be config file\n");
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
printf("-D or --debug - force debug output logging\n");
|
printf("-D or --debug - force debug output logging\n");
|
||||||
|
printf("-E or --nographic - forces the old behavior\n");
|
||||||
#endif
|
#endif
|
||||||
printf("-F or --fullscreen - start in fullscreen mode\n");
|
printf("-F or --fullscreen - start in fullscreen mode\n");
|
||||||
printf("-L or --logfile path - set 'path' to be the logfile\n");
|
|
||||||
printf("-P or --vmpath path - set 'path' to be root for vm\n");
|
|
||||||
printf("-V or --vmname name - overrides the name of the running VM.\n");
|
|
||||||
printf("-S or --settings - show only the settings dialog\n");
|
|
||||||
printf("-N or --noconfirm - do not ask for confirmation on quit\n");
|
|
||||||
#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("-R or --crashdump - enables crashdump on exception\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("-O or --dumpcfg - dump config file after loading\n");
|
||||||
|
printf("-P or --vmpath path - set 'path' to be root for vm\n");
|
||||||
|
printf("-R or --rompath path - set 'path' to be ROM path\n");
|
||||||
|
printf("-S or --settings - show only the settings dialog\n");
|
||||||
|
printf("-V or --vmname name - overrides the name of the running VM\n");
|
||||||
|
printf("-Z or --lastvmpath - the last parameter is VM path rather than config\n");
|
||||||
printf("\nA config file can be specified. If none is, the default file will be used.\n");
|
printf("\nA config file can be specified. If none is, the default file will be used.\n");
|
||||||
return(0);
|
return(0);
|
||||||
|
} else if (!strcasecmp(argv[c], "--lastvmpath") ||
|
||||||
|
!strcasecmp(argv[c], "-Z")) {
|
||||||
|
lvmp = 1;
|
||||||
} else if (!strcasecmp(argv[c], "--dumpcfg") ||
|
} else if (!strcasecmp(argv[c], "--dumpcfg") ||
|
||||||
!strcasecmp(argv[c], "-C")) {
|
!strcasecmp(argv[c], "-O")) {
|
||||||
do_dump_config = 1;
|
do_dump_config = 1;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
} else if (!strcasecmp(argv[c], "--debug") ||
|
} else if (!strcasecmp(argv[c], "--debug") ||
|
||||||
!strcasecmp(argv[c], "-D")) {
|
!strcasecmp(argv[c], "-D")) {
|
||||||
force_debug = 1;
|
force_debug = 1;
|
||||||
#endif
|
#endif
|
||||||
|
} else if (!strcasecmp(argv[c], "--nographic") ||
|
||||||
|
!strcasecmp(argv[c], "-E")) {
|
||||||
|
/* Currently does nothing, but if/when we implement a built-in manager,
|
||||||
|
it's going to force the manager not to run, allowing the old usage
|
||||||
|
without parameter. */
|
||||||
|
ng = 1;
|
||||||
} else if (!strcasecmp(argv[c], "--fullscreen") ||
|
} else if (!strcasecmp(argv[c], "--fullscreen") ||
|
||||||
!strcasecmp(argv[c], "-F")) {
|
!strcasecmp(argv[c], "-F")) {
|
||||||
start_in_fullscreen = 1;
|
start_in_fullscreen = 1;
|
||||||
@@ -448,6 +468,16 @@ usage:
|
|||||||
if ((c+1) == argc) goto usage;
|
if ((c+1) == argc) goto usage;
|
||||||
|
|
||||||
strcpy(path, argv[++c]);
|
strcpy(path, argv[++c]);
|
||||||
|
} else if (!strcasecmp(argv[c], "--rompath") ||
|
||||||
|
!strcasecmp(argv[c], "-R")) {
|
||||||
|
if ((c+1) == argc) goto usage;
|
||||||
|
|
||||||
|
strcpy(path2, argv[++c]);
|
||||||
|
} else if (!strcasecmp(argv[c], "--config") ||
|
||||||
|
!strcasecmp(argv[c], "-C")) {
|
||||||
|
if ((c+1) == argc) goto usage;
|
||||||
|
|
||||||
|
cfg = argv[++c];
|
||||||
} else if (!strcasecmp(argv[c], "--vmname") ||
|
} else if (!strcasecmp(argv[c], "--vmname") ||
|
||||||
!strcasecmp(argv[c], "-V")) {
|
!strcasecmp(argv[c], "-V")) {
|
||||||
if ((c+1) == argc) goto usage;
|
if ((c+1) == argc) goto usage;
|
||||||
@@ -459,10 +489,10 @@ usage:
|
|||||||
} else if (!strcasecmp(argv[c], "--noconfirm") ||
|
} else if (!strcasecmp(argv[c], "--noconfirm") ||
|
||||||
!strcasecmp(argv[c], "-N")) {
|
!strcasecmp(argv[c], "-N")) {
|
||||||
confirm_exit_cmdl = 0;
|
confirm_exit_cmdl = 0;
|
||||||
} else if (!strcasecmp(argv[c], "--crashdump") ||
|
|
||||||
!strcasecmp(argv[c], "-R")) {
|
|
||||||
enable_crashdump = 1;
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
} else if (!strcasecmp(argv[c], "--crashdump") ||
|
||||||
|
!strcasecmp(argv[c], "-A")) {
|
||||||
|
enable_crashdump = 1;
|
||||||
} else if (!strcasecmp(argv[c], "--hwnd") ||
|
} else if (!strcasecmp(argv[c], "--hwnd") ||
|
||||||
!strcasecmp(argv[c], "-H")) {
|
!strcasecmp(argv[c], "-H")) {
|
||||||
|
|
||||||
@@ -484,18 +514,25 @@ usage:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* One argument (config file) allowed. */
|
/* One argument (config file) allowed. */
|
||||||
if (c < argc)
|
if (c < argc) {
|
||||||
cfg = argv[c++];
|
if (lvmp)
|
||||||
|
strcpy(path, argv[c++]);
|
||||||
|
else
|
||||||
|
cfg = argv[c++];
|
||||||
|
}
|
||||||
|
|
||||||
if (c != argc) goto usage;
|
if (c != argc) goto usage;
|
||||||
|
|
||||||
|
plat_path_slash(usr_path);
|
||||||
|
plat_path_slash(rom_path);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the user provided a path for files, use that
|
* If the user provided a path for files, use that
|
||||||
* instead of the current working directory. We do
|
* instead of the current working directory. We do
|
||||||
* make sure that if that was a relative path, we
|
* make sure that if that was a relative path, we
|
||||||
* make it absolute.
|
* make it absolute.
|
||||||
*/
|
*/
|
||||||
if (path[0] != L'\0') {
|
if (path[0] != '\0') {
|
||||||
if (! plat_path_abs(path)) {
|
if (! plat_path_abs(path)) {
|
||||||
/*
|
/*
|
||||||
* This looks like a relative path.
|
* This looks like a relative path.
|
||||||
@@ -503,7 +540,6 @@ usage:
|
|||||||
* Add it to the current working directory
|
* Add it to the current working directory
|
||||||
* to convert it (back) to an absolute path.
|
* to convert it (back) to an absolute path.
|
||||||
*/
|
*/
|
||||||
plat_path_slash(usr_path);
|
|
||||||
strcat(usr_path, path);
|
strcat(usr_path, path);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
@@ -519,6 +555,36 @@ usage:
|
|||||||
plat_dir_create(usr_path);
|
plat_dir_create(usr_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the user provided a path for ROMs, use that
|
||||||
|
* instead of the current working directory. We do
|
||||||
|
* make sure that if that was a relative path, we
|
||||||
|
* make it absolute.
|
||||||
|
*/
|
||||||
|
if (path2[0] != '\0') {
|
||||||
|
if (! plat_path_abs(path2)) {
|
||||||
|
/*
|
||||||
|
* This looks like a relative path.
|
||||||
|
*
|
||||||
|
* Add it to the current working directory
|
||||||
|
* to convert it (back) to an absolute path.
|
||||||
|
*/
|
||||||
|
strcat(rom_path, path2);
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* The user-provided path seems like an
|
||||||
|
* absolute path, so just use that.
|
||||||
|
*/
|
||||||
|
strcpy(rom_path, path2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If the specified path does not yet exist,
|
||||||
|
create it. */
|
||||||
|
if (! plat_dir_check(rom_path))
|
||||||
|
plat_dir_create(rom_path);
|
||||||
|
} else
|
||||||
|
rom_path[0] = '\0';
|
||||||
|
|
||||||
/* Grab the name of the configuration file. */
|
/* Grab the name of the configuration file. */
|
||||||
if (cfg == NULL)
|
if (cfg == NULL)
|
||||||
cfg = CONFIG_FILE;
|
cfg = CONFIG_FILE;
|
||||||
|
@@ -2578,12 +2578,12 @@ save_storage_controllers(void)
|
|||||||
else
|
else
|
||||||
config_set_int(cat, "cassette_enabled", cassette_enable);
|
config_set_int(cat, "cassette_enabled", cassette_enable);
|
||||||
|
|
||||||
if (cassette_fname == NULL)
|
if (strlen(cassette_fname) == 0)
|
||||||
config_delete_var(cat, "cassette_file");
|
config_delete_var(cat, "cassette_file");
|
||||||
else
|
else
|
||||||
config_set_string(cat, "cassette_file", cassette_fname);
|
config_set_string(cat, "cassette_file", cassette_fname);
|
||||||
|
|
||||||
if (cassette_mode == NULL)
|
if (strlen(cassette_mode) == 0)
|
||||||
config_delete_var(cat, "cassette_mode");
|
config_delete_var(cat, "cassette_mode");
|
||||||
else
|
else
|
||||||
config_set_string(cat, "cassette_mode", cassette_mode);
|
config_set_string(cat, "cassette_mode", cassette_mode);
|
||||||
|
@@ -79,6 +79,7 @@ extern int confirm_exit_cmdl; /* (O) do not ask for confirmation on quit if set
|
|||||||
extern uint64_t unique_id;
|
extern uint64_t unique_id;
|
||||||
extern uint64_t source_hwnd;
|
extern uint64_t source_hwnd;
|
||||||
#endif
|
#endif
|
||||||
|
extern char rom_path[1024]; /* (O) full path to ROMs */
|
||||||
extern char log_path[1024]; /* (O) full path of logfile */
|
extern char log_path[1024]; /* (O) full path of logfile */
|
||||||
extern char vm_name[1024]; /* (O) display name of the VM */
|
extern char vm_name[1024]; /* (O) display name of the VM */
|
||||||
|
|
||||||
|
@@ -62,10 +62,35 @@ FILE *
|
|||||||
rom_fopen(char *fn, char *mode)
|
rom_fopen(char *fn, char *mode)
|
||||||
{
|
{
|
||||||
char temp[1024];
|
char temp[1024];
|
||||||
|
char *fn2;
|
||||||
|
|
||||||
plat_append_filename(temp, exe_path, fn);
|
if ((strstr(fn, "roms/") == fn) || (strstr(fn, "roms\\") == fn)) {
|
||||||
|
/* Relative path */
|
||||||
|
fn2 = (char *) malloc(strlen(fn) + 1);
|
||||||
|
memcpy(fn2, fn, strlen(fn) + 1);
|
||||||
|
|
||||||
return(plat_fopen(temp, mode));
|
if (rom_path[0] != '\0') {
|
||||||
|
memset(fn2, 0x00, strlen(fn) + 1);
|
||||||
|
memcpy(fn2, &(fn[5]), strlen(fn) - 4);
|
||||||
|
|
||||||
|
plat_append_filename(temp, rom_path, fn2);
|
||||||
|
} else {
|
||||||
|
/* Make sure to make it a backslash, just in case there's malformed
|
||||||
|
code calling us that assumes Windows. */
|
||||||
|
if (fn2[4] == '\\')
|
||||||
|
fn2[4] = '/';
|
||||||
|
|
||||||
|
plat_append_filename(temp, exe_path, fn2);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(fn2);
|
||||||
|
fn2 = NULL;
|
||||||
|
|
||||||
|
return(plat_fopen(temp, mode));
|
||||||
|
} else {
|
||||||
|
/* Absolute path */
|
||||||
|
return(plat_fopen(fn, mode));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1237,23 +1237,7 @@ void *voodoo_init()
|
|||||||
|
|
||||||
void voodoo_card_close(voodoo_t *voodoo)
|
void voodoo_card_close(voodoo_t *voodoo)
|
||||||
{
|
{
|
||||||
/* #ifndef RELEASE_BUILD
|
|
||||||
FILE *f;
|
|
||||||
#endif */
|
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
/* #ifndef RELEASE_BUILD
|
|
||||||
f = rom_fopen("texram.dmp", "wb");
|
|
||||||
fwrite(voodoo->tex_mem[0], voodoo->texture_size*1024*1024, 1, f);
|
|
||||||
fclose(f);
|
|
||||||
if (voodoo->dual_tmus)
|
|
||||||
{
|
|
||||||
f = rom_fopen("texram2.dmp", "wb");
|
|
||||||
fwrite(voodoo->tex_mem[1], voodoo->texture_size*1024*1024, 1, f);
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
#endif */
|
|
||||||
|
|
||||||
|
|
||||||
voodoo->fifo_thread_run = 0;
|
voodoo->fifo_thread_run = 0;
|
||||||
thread_set_event(voodoo->wake_fifo_thread);
|
thread_set_event(voodoo->wake_fifo_thread);
|
||||||
|
@@ -838,7 +838,7 @@ LIBS += -static
|
|||||||
ifeq ($(AUTODEP), y)
|
ifeq ($(AUTODEP), y)
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
@echo $<
|
@echo $<
|
||||||
$(CC) $(CFLAGS) $(DEPS) -c $<
|
@$(CC) $(CFLAGS) $(DEPS) -c $<
|
||||||
|
|
||||||
%.o: %.cc
|
%.o: %.cc
|
||||||
@echo $<
|
@echo $<
|
||||||
|
Reference in New Issue
Block a user