Ejemplo n.º 1
0
void parse_cmdline (int argc, char **argv, int game_index)
{
	static float f_beam, f_flicker;
	char *resolution;
	char *joyname;
	char tmpres[10];
	int i;
	char *tmpstr;

	mame_argc = argc;
	mame_argv = argv;
	game = game_index;

	/* read graphic configuration */
	options.use_artwork = get_bool   ("config", "artwork",	NULL,  1);
	options.use_samples = get_bool   ("config", "samples",	NULL,  1);
	video_sync  = get_bool   ("config", "vsync",        NULL,  0);
	wait_vsync  = get_bool   ("config", "waitvsync",    NULL,  0);
	use_dirty	= get_bool	 ("config", "dirty",	NULL,	-1);
	options.antialias   = get_bool   ("config", "antialias",    NULL,  1);
	options.translucency = get_bool    ("config", "translucency", NULL, 1);

	tmpstr             = get_string ("config", "depth", NULL, "auto");
	options.color_depth = atoi(tmpstr);
	if (options.color_depth != 8 && options.color_depth != 16) options.color_depth = 0;	/* auto */

	skiplines   = get_int    ("config", "skiplines",    NULL, 0);
	skipcolumns = get_int    ("config", "skipcolumns",  NULL, 0);
	f_beam      = get_float  ("config", "beam",         NULL, 1.0);
	if (f_beam < 1.0) f_beam = 1.0;
	if (f_beam > 16.0) f_beam = 16.0;
	f_flicker   = get_float  ("config", "flicker",      NULL, 0.0);
	if (f_flicker < 0.0) f_flicker = 0.0;
	if (f_flicker > 100.0) f_flicker = 100.0;
	osd_gamma_correction = get_float ("config", "gamma",   NULL, 1.0);
	if (osd_gamma_correction < 0.5) osd_gamma_correction = 0.5;
	if (osd_gamma_correction > 2.0) osd_gamma_correction = 2.0;

	tmpstr = get_string ("config", "frameskip", "fs", "auto");
	if (!strcasecmp(tmpstr,"auto"))
	{
		frameskip = 0;
		autoframeskip = 1;
	}
	else
	{
		frameskip = atoi(tmpstr);
		autoframeskip = 0;
	}
	options.norotate  = get_bool ("config", "norotate",  NULL, 0);
	options.ror       = get_bool ("config", "ror",       NULL, 0);
	options.rol       = get_bool ("config", "rol",       NULL, 0);
	options.flipx     = get_bool ("config", "flipx",     NULL, 0);
	options.flipy     = get_bool ("config", "flipy",     NULL, 0);

	/* read sound configuration */
	soundcard           = get_int  ("config", "soundcard",  NULL, -1);

	options.use_emulated_ym3812 = !get_bool ("config", "ym3812opl",  NULL,  0);
	options.samplerate = get_int  ("config", "samplerate", "sr", 22050);
	if (options.samplerate < 5000) options.samplerate = 5000;
	if (options.samplerate > 44100) options.samplerate = 44100;
	usestereo           = get_bool ("config", "stereo",  NULL,  0);
	attenuation         = get_int  ("config", "volume",  NULL,  0);
	if (attenuation < -32) attenuation = -32;
	if (attenuation > 0) attenuation = 0;

	/* read input configuration */
	use_mouse = get_bool   ("config", "mouse",   NULL,  1);
	joyname   = get_string ("config", "joystick", "joy", "standard");

	/* misc configuration */
	options.cheat      = get_bool ("config", "cheat", NULL, 0);
	options.mame_debug = get_bool ("config", "debug", NULL, 0);

	cheatfile  = get_string ("config", "cheatfile", "cf", "cheat.dat");

 	history_filename  = get_string ("config", "historyfile", NULL, "history.dat");    /* JCK 980917 */

	mameinfo_filename  = get_string ("config", "mameinfofile", NULL, "mameinfo.dat");    /* JCK 980917 */

	/* get resolution */
	resolution  = get_string ("config", "resolution", NULL, "auto");

	/* set default subdirectories */
	nvdir      = get_string ("directory", "nvram",   NULL, "/var/mobile/Media/ROMs/iMAME4all/nvram" );
	hidir      = get_string ("directory", "hi",      NULL, "/var/mobile/Media/ROMs/iMAME4all/hi");
	cfgdir     = get_string ("directory", "cfg",     NULL, "/var/mobile/Media/ROMs/iMAME4all/cfg");
	screenshotdir = get_string ("directory", "snap",     NULL, "/var/mobile/Media/ROMs/iMAME4all/snap");
	memcarddir = get_string ("directory", "memcard", NULL, "/var/mobile/Media/ROMs/iMAME4all/memcard");
	stadir     = get_string ("directory", "sta",     NULL, "/var/mobile/Media/ROMs/iMAME4all/sta");
	artworkdir = get_string ("directory", "artwork", NULL, "/var/mobile/Media/ROMs/iMAME4all/artwork");
	cheatdir = get_string ("directory", "cheat", NULL, "/var/mobile/Media/ROMs/iMAME4all");

	logerror("cheatfile = %s - cheatdir = %s\n",cheatfile,cheatdir);

	//printf("cheatfile = %s - cheatdir = %s\n",cheatfile,cheatdir);
	//printf("cfgdir = %s\n",cfgdir);

	tmpstr = get_string ("config", "language", NULL, "english");
	options.language_file = osd_fopen(0,tmpstr,OSD_FILETYPE_LANGUAGE,0);

	/* this is handled externally cause the audit stuff needs it, too */
	get_rom_sample_path (argc, argv, game_index);

	/* process some parameters */
	options.beam = (int)(f_beam * 0x00010000);
	if (options.beam < 0x00010000)
		options.beam = 0x00010000;
	if (options.beam > 0x00100000)
		options.beam = 0x00100000;

	options.flicker = (int)(f_flicker * 2.55);
	if (options.flicker < 0)
		options.flicker = 0;
	if (options.flicker > 255)
		options.flicker = 255;

	/* any option that starts with a digit is taken as a resolution option */
	/* this is to handle the old "-wxh" commandline option. */
	for (i = 1; i < argc; i++)
	{
		if (argv[i][0] == '-' && isdigit(argv[i][1]) &&
				(strstr(argv[i],"x") || strstr(argv[i],"X")))
			resolution = &argv[i][1];
	}

	/* break up resolution into gfx_width and gfx_height */
	gfx_height = gfx_width = 0;
	if (strcasecmp (resolution, "auto") != 0)
	{
		char *tmp;
		strncpy (tmpres, resolution, 10);
		tmp = strtok (tmpres, "xX");
		gfx_width = atoi (tmp);
		tmp = strtok (0, "xX");
		if (tmp)
			gfx_height = atoi (tmp);

		options.vector_width = gfx_width;
		options.vector_height = gfx_height;
	}

	/* convert joystick name into an Allegro-compliant joystick signature */
	joystick = -2; /* default to invalid value */

	for (i = 0; joy_table[i].name != NULL; i++)
	{
		if (strcasecmp (joy_table[i].name, joyname) == 0)
		{
			joystick = joy_table[i].id;
			logerror("using joystick %s = %08x\n",
						joyname,joy_table[i].id);
			break;
		}
	}

	if (joystick == -2)
	{
		logerror("%s is not a valid entry for a joystick\n",
					joyname);
		joystick = JOY_TYPE_NONE;
	}

	/* Underclock settings */
	underclock_sound = get_int ("config", "uclocks",   NULL, 0);
	underclock_cpu   = get_int ("config", "uclock",    NULL, 0);

	/* Fast sound setting */
	fast_sound       = get_bool("config", "fastsound", NULL, 0);

	/* Rotate controls */
	rotate_controls       = get_bool("config", "rotatecontrols", NULL, 0);
}
Ejemplo n.º 2
0
void parse_cmdline (int argc, char **argv, int game_index)
{
	static float f_beam, f_flicker;
	char *resolution;
	char *vesamode;
	char *joyname;
	char tmpres[10];
	int i;
	char *tmpstr;
	char *monitorname;

	mame_argc = argc;
	mame_argv = argv;
	game = game_index;


	/* force third mouse button emulation to "no" otherwise Allegro will default to "yes" */
	set_config_string(0,"emulate_three","no");

	/* read graphic configuration */
	scanlines   = get_bool   ("config", "scanlines",    NULL,  1);
	stretch     = get_bool   ("config", "stretch",		NULL,  1);
	options.use_artwork = get_bool   ("config", "artwork",	NULL,  1);
	options.use_samples = get_bool   ("config", "samples",	NULL,  1);
	video_sync  = get_bool   ("config", "vsync",        NULL,  0);
	wait_vsync  = get_bool   ("config", "waitvsync",    NULL,  0);
	use_triplebuf = get_bool ("config", "triplebuffer",	NULL,  0);
	use_tweaked = get_bool   ("config", "tweak",		NULL,  0);
	vesamode    = get_string ("config", "vesamode",	NULL,	"vesa3");
	use_mmx		= get_bool   ("config", "mmx", 		NULL,	-1);
	use_dirty	= get_bool	 ("config", "dirty",	NULL,	-1);
	options.antialias   = get_bool   ("config", "antialias",    NULL,  1);
	options.translucency = get_bool    ("config", "translucency", NULL, 1);

	vgafreq     = get_int    ("config", "vgafreq",      NULL,  -1);
	always_synced = get_bool ("config", "alwayssynced", NULL, 0);

	tmpstr             = get_string ("config", "depth", NULL, "auto");
	options.color_depth = atoi(tmpstr);
	if (options.color_depth != 8 && options.color_depth != 16) options.color_depth = 0;	/* auto */

	skiplines   = get_int    ("config", "skiplines",    NULL, 0);
	skipcolumns = get_int    ("config", "skipcolumns",  NULL, 0);
	f_beam      = get_float  ("config", "beam",         NULL, 1.0);
	if (f_beam < 1.0) f_beam = 1.0;
	if (f_beam > 16.0) f_beam = 16.0;
	f_flicker   = get_float  ("config", "flicker",      NULL, 0.0);
	if (f_flicker < 0.0) f_flicker = 0.0;
	if (f_flicker > 100.0) f_flicker = 100.0;
	osd_gamma_correction = get_float ("config", "gamma",   NULL, 1.0);
	if (osd_gamma_correction < 0.5) osd_gamma_correction = 0.5;
	if (osd_gamma_correction > 2.0) osd_gamma_correction = 2.0;

	tmpstr             = get_string ("config", "frameskip", "fs", "auto");
	if (!stricmp(tmpstr,"auto"))
	{
		frameskip = 0;
		autoframeskip = 1;
	}
	else
	{
		frameskip = atoi(tmpstr);
		autoframeskip = 0;
	}
	options.norotate  = get_bool ("config", "norotate",  NULL, 0);
	options.ror       = get_bool ("config", "ror",       NULL, 0);
	options.rol       = get_bool ("config", "rol",       NULL, 0);
	options.flipx     = get_bool ("config", "flipx",     NULL, 0);
	options.flipy     = get_bool ("config", "flipy",     NULL, 0);

	/* read sound configuration */
	soundcard           = get_int  ("config", "soundcard",  NULL, -1);
	options.use_emulated_ym3812 = !get_bool ("config", "ym3812opl",  NULL,  0);
	options.samplerate = get_int  ("config", "samplerate", "sr", 22050);
	if (options.samplerate < 5000) options.samplerate = 5000;
	if (options.samplerate > 50000) options.samplerate = 50000;
	usestereo           = get_bool ("config", "stereo",  NULL,  1);
	attenuation         = get_int  ("config", "volume",  NULL,  0);
	if (attenuation < -32) attenuation = -32;
	if (attenuation > 0) attenuation = 0;

	/* read input configuration */
	use_mouse = get_bool   ("config", "mouse",   NULL,  1);
	joyname   = get_string ("config", "joystick", "joy", "none");
	use_hotrod = 0;
	if (get_bool  ("config", "hotrod",   NULL,  0)) use_hotrod = 1;
	if (get_bool  ("config", "hotrodse",   NULL,  0)) use_hotrod = 2;

	/* misc configuration */
	options.cheat      = get_bool ("config", "cheat", NULL, 0);
	options.mame_debug = get_bool ("config", "debug", NULL, 0);
	cheatfile  = get_string ("config", "cheatfile", "cf", "CHEAT.DAT");    /* JCK 980917 */

 	#ifndef MESS
 	history_filename  = get_string ("config", "historyfile", NULL, "HISTORY.DAT");    /* JCK 980917 */
 	#else
 	history_filename  = get_string ("config", "historyfile", NULL, "SYSINFO.DAT");
 	#endif

	mameinfo_filename  = get_string ("config", "mameinfofile", NULL, "MAMEINFO.DAT");    /* JCK 980917 */

	/* get resolution */
	resolution  = get_string ("config", "resolution", NULL, "auto");

	/* set default subdirectories */
	nvdir      = get_string ("directory", "nvram",   NULL, "NVRAM");
	hidir      = get_string ("directory", "hi",      NULL, "HI");
	cfgdir     = get_string ("directory", "cfg",     NULL, "CFG");
	screenshotdir = get_string ("directory", "snap",     NULL, "SNAP");
	memcarddir = get_string ("directory", "memcard", NULL, "MEMCARD");
	stadir     = get_string ("directory", "sta",     NULL, "STA");
	artworkdir = get_string ("directory", "artwork", NULL, "ARTWORK");
 	#ifdef MESS
 		crcdir = get_string ("directory", "crc", NULL, "CRC");
 	#endif

	/* get tweaked modes info */
	tw224x288_h			= get_int ("tweaked", "224x288_h",              NULL, 0x5f);
	tw224x288_v     	= get_int ("tweaked", "224x288_v",              NULL, 0x54);
	tw240x256_h     = get_int ("tweaked", "240x256_h",              NULL, 0x67);
	tw240x256_v     = get_int ("tweaked", "240x256_v",              NULL, 0x23);
	tw256x240_h     = get_int ("tweaked", "256x240_h",              NULL, 0x55);
	tw256x240_v     = get_int ("tweaked", "256x240_v",              NULL, 0x43);
	tw256x256_h     = get_int ("tweaked", "256x256_h",              NULL, 0x6c);
	tw256x256_v     = get_int ("tweaked", "256x256_v",              NULL, 0x23);
	tw256x256_hor_h = get_int ("tweaked", "256x256_hor_h",  NULL, 0x55);
	tw256x256_hor_v = get_int ("tweaked", "256x256_hor_v",  NULL, 0x60);
	tw288x224_h     = get_int ("tweaked", "288x224_h",              NULL, 0x5f);
	tw288x224_v     = get_int ("tweaked", "288x224_v",              NULL, 0x0c);
	tw240x320_h             = get_int ("tweaked", "240x320_h",              NULL, 0x5a);
	tw240x320_v             = get_int ("tweaked", "240x320_v",              NULL, 0x8c);
	tw320x240_h             = get_int ("tweaked", "320x240_h",              NULL, 0x5f);
	tw320x240_v             = get_int ("tweaked", "320x240_v",              NULL, 0x0c);
	tw336x240_h             = get_int ("tweaked", "336x240_h",              NULL, 0x5f);
	tw336x240_v             = get_int ("tweaked", "336x240_v",              NULL, 0x0c);
	tw384x224_h             = get_int ("tweaked", "384x224_h",              NULL, 0x6c);
	tw384x224_v             = get_int ("tweaked", "384x224_v",              NULL, 0x0c);
	tw384x240_h             = get_int ("tweaked", "384x240_h",              NULL, 0x6c);
	tw384x240_v             = get_int ("tweaked", "384x240_v",              NULL, 0x0c);
	tw384x256_h             = get_int ("tweaked", "384x256_h",              NULL, 0x6c);
	tw384x256_v             = get_int ("tweaked", "384x256_v",              NULL, 0x23);

	/* Get 15.75KHz tweak values */
	tw224x288arc_h          = get_int ("tweaked", "224x288arc_h",   NULL, 0x5d);
	tw224x288arc_v          = get_int ("tweaked", "224x288arc_v",   NULL, 0x38);
	tw288x224arc_h          = get_int ("tweaked", "288x224arc_h",   NULL, 0x5d);
	tw288x224arc_v          = get_int ("tweaked", "288x224arc_v",   NULL, 0x09);
	tw256x240arc_h          = get_int ("tweaked", "256x240arc_h",   NULL, 0x5d);
	tw256x240arc_v          = get_int ("tweaked", "256x240arc_v",   NULL, 0x09);
	tw256x256arc_h          = get_int ("tweaked", "256x256arc_h",   NULL, 0x5d);
	tw256x256arc_v          = get_int ("tweaked", "256x256arc_v",   NULL, 0x17);
	tw320x240arc_h          = get_int ("tweaked", "320x240arc_h",   NULL, 0x69);
	tw320x240arc_v          = get_int ("tweaked", "320x240arc_v",   NULL, 0x09);
	tw320x256arc_h          = get_int ("tweaked", "320x256arc_h",   NULL, 0x69);
	tw320x256arc_v          = get_int ("tweaked", "320x256arc_v",   NULL, 0x17);
	tw352x240arc_h          = get_int ("tweaked", "352x240arc_h",   NULL, 0x6a);
	tw352x240arc_v          = get_int ("tweaked", "352x240arc_v",   NULL, 0x09);
	tw352x256arc_h          = get_int ("tweaked", "352x256arc_h",   NULL, 0x6a);
	tw352x256arc_v          = get_int ("tweaked", "352x256arc_v",   NULL, 0x17);
	tw368x224arc_h          = get_int ("tweaked", "368x224arc_h",   NULL, 0x6a);
	tw368x224arc_v          = get_int ("tweaked", "368x224arc_v",   NULL, 0x09);
	tw368x240arc_h          = get_int ("tweaked", "368x240arc_h",   NULL, 0x6a);
	tw368x240arc_v          = get_int ("tweaked", "368x240arc_v",   NULL, 0x09);
	tw368x256arc_h          = get_int ("tweaked", "368x256arc_h",   NULL, 0x6a);
	tw368x256arc_v          = get_int ("tweaked", "368x256arc_v",   NULL, 0x17);
	tw512x224arc_h          = get_int ("tweaked", "512x224arc_h",   NULL, 0xbf);
	tw512x224arc_v          = get_int ("tweaked", "512x224arc_v",   NULL, 0x09);
	tw512x256arc_h          = get_int ("tweaked", "512x256arc_h",   NULL, 0xbf);
	tw512x256arc_v          = get_int ("tweaked", "512x256arc_v",   NULL, 0x17);
	tw512x448arc_h          = get_int ("tweaked", "512x448arc_h",   NULL, 0xbf);
	tw512x448arc_v          = get_int ("tweaked", "512x448arc_v",   NULL, 0x09);
	tw512x512arc_h          = get_int ("tweaked", "512x512arc_h",   NULL, 0xbf);
	tw512x512arc_v          = get_int ("tweaked", "512x512arc_v",   NULL, 0x17);
	tw640x480arc_h          = get_int ("tweaked", "640x480arc_h",   NULL, 0xc1);
	tw640x480arc_v          = get_int ("tweaked", "640x480arc_v",   NULL, 0x09);

	/* this is handled externally cause the audit stuff needs it, too */
	get_rom_sample_path (argc, argv, game_index);

	/* get the monitor type */
	monitorname = get_string ("config", "monitor", NULL, "standard");
	/* get -centerx */
	center_x = get_int ("config", "centerx", NULL,  0);
	/* get -centery */
	center_y = get_int ("config", "centery", NULL,  0);
	/* get -waitinterlace */
	wait_interlace = get_bool ("config", "waitinterlace", NULL,  0);

	/* process some parameters */
	options.beam = (int)(f_beam * 0x00010000);
	if (options.beam < 0x00010000)
		options.beam = 0x00010000;
	if (options.beam > 0x00100000)
		options.beam = 0x00100000;

	options.flicker = (int)(f_flicker * 2.55);
	if (options.flicker < 0)
		options.flicker = 0;
	if (options.flicker > 255)
		options.flicker = 255;

	if (stricmp (vesamode, "vesa1") == 0)
		gfx_mode = GFX_VESA1;
	else if (stricmp (vesamode, "vesa2b") == 0)
		gfx_mode = GFX_VESA2B;
	else if (stricmp (vesamode, "vesa2l") == 0)
		gfx_mode = GFX_VESA2L;
	else if (stricmp (vesamode, "vesa3") == 0)
		gfx_mode = GFX_VESA3;
	else
	{
		if (errorlog)
			fprintf (errorlog, "%s is not a valid entry for vesamode\n",
					vesamode);
		gfx_mode = GFX_VESA3; /* default to VESA2L */
	}

	/* any option that starts with a digit is taken as a resolution option */
	/* this is to handle the old "-wxh" commandline option. */
	for (i = 1; i < argc; i++)
	{
		if (argv[i][0] == '-' && isdigit(argv[i][1]) &&
				(strstr(argv[i],"x") || strstr(argv[i],"X")))
			resolution = &argv[i][1];
	}

	/* break up resolution into gfx_width and gfx_height */
	gfx_height = gfx_width = 0;
	if (stricmp (resolution, "auto") != 0)
	{
		char *tmp;
		strncpy (tmpres, resolution, 10);
		tmp = strtok (tmpres, "xX");
		gfx_width = atoi (tmp);
		tmp = strtok (0, "xX");
		if (tmp)
			gfx_height = atoi (tmp);
	}

	/* convert joystick name into an Allegro-compliant joystick signature */
	joystick = -2; /* default to invalid value */

	for (i = 0; joy_table[i].name != NULL; i++)
	{
		if (stricmp (joy_table[i].name, joyname) == 0)
		{
			joystick = joy_table[i].id;
			if (errorlog)
				fprintf (errorlog, "using joystick %s = %08x\n",
						joyname,joy_table[i].id);
			break;
		}
	}

	if (joystick == -2)
	{
		if (errorlog)
			fprintf (errorlog, "%s is not a valid entry for a joystick\n",
					joyname);
		joystick = JOY_TYPE_NONE;
	}

	/* get monitor type from supplied name */
	monitor_type = MONITOR_TYPE_STANDARD; /* default to PC monitor */

	for (i = 0; monitor_table[i].name != NULL; i++)
	{
		if ((stricmp (monitor_table[i].name, monitorname) == 0))
		{
			monitor_type = monitor_table[i].id;
			break;
		}
	}
}