public static void parse_cmdline(int argc, String[] argv, int game_index) {
        try {
            load_ini("arcadeflex.cfg");
        } catch (IOException ex) {
            //try create a new file if not found
            File config = new File("arcadeflex.cfg");
            try {
                config.createNewFile();
                //and reload the file
                load_ini("arcadeflex.cfg");
            } catch (IOException ex1) {
                System.out.println("Can't create an configuration file!");
            }
        }
        /*TODO*///	static float f_beam, f_flicker;
            /*TODO*///	char *resolution;
            /*TODO*///	char *vesamode;
            /*TODO*///	char *joyname;
            /*TODO*///	char tmpres[10];
            /*TODO*///	int i;
            String tmpstr;
            /*TODO*///	char *monitorname;
            /*TODO*///
            /*TODO*///	mame_argc = argc;
            /*TODO*///	mame_argv = argv;
            /*TODO*///	game = game_index;
            /*TODO*///
            /*TODO*///
            /*TODO*///	/* force third mouse button emulation to "no" otherwise Allegro will default to "yes" */
            /*TODO*///	set_config_string(0,"emulate_three","no");
            /*TODO*///
            /*TODO*///	/* read graphic configuration */
            /*TODO*///	scanlines   = get_bool   ("config", "scanlines",    NULL,  1);
  /*temphack!!!! */              scanlines = 1;
  /*temphack!!!! */              stretch =1;
            /*TODO*///	stretch     = get_bool   ("config", "stretch",		NULL,  1);
            /*TODO*///	options.use_artwork = get_bool   ("config", "artwork",	NULL,  1);
            	options.use_samples = 1;//get_bool   ("config", "samples",	NULL,  1);
            /*TODO*///	video_sync  = get_bool   ("config", "vsync",        NULL,  0);
  /*temphack!!!! */            video_sync = 0;
            /*TODO*///	wait_vsync  = get_bool   ("config", "waitvsync",    NULL,  0);
            /*TODO*///	use_triplebuf = get_bool ("config", "triplebuffer",	NULL,  0);
            /*TODO*///	use_tweaked = get_bool   ("config", "tweak",		NULL,  0);
            /*TODO*///	vesamode    = get_string ("config", "vesamode",	NULL,	"vesa3");
            /*TODO*///	use_mmx		= get_bool   ("config", "mmx", 		NULL,	-1);
            /*TODO*///	use_dirty	= get_bool	 ("config", "dirty",	NULL,	-1);
 /*temphack!!!! */           use_dirty=-1;
            /*TODO*///	options.antialias   = get_bool   ("config", "antialias",    NULL,  1);
            /*TODO*///	options.translucency = get_bool    ("config", "translucency", NULL, 1);
            /*TODO*///
            /*TODO*///	vgafreq     = get_int    ("config", "vgafreq",      NULL,  -1);
            /*TODO*///	always_synced = get_bool ("config", "alwayssynced", NULL, 0);
            /*TODO*///
            /*TODO*///	tmpstr             = get_string ("config", "depth", NULL, "auto");
            /*TODO*///	options.color_depth = atoi(tmpstr);
            /*TODO*///	if (options.color_depth != 8 && options.color_depth != 16) options.color_depth = 0;	/* auto */
            /*TODO*///
                        options.color_depth=8;
            /*TODO*///	skiplines   = get_int    ("config", "skiplines",    NULL, 0);
            /*TODO*///	skipcolumns = get_int    ("config", "skipcolumns",  NULL, 0);
            /*TODO*///	f_beam      = get_float  ("config", "beam",         NULL, 1.0);
            /*TODO*///	if (f_beam < 1.0) f_beam = 1.0;
            /*TODO*///	if (f_beam > 16.0) f_beam = 16.0;
            /*TODO*///	f_flicker   = get_float  ("config", "flicker",      NULL, 0.0);
            /*TODO*///	if (f_flicker < 0.0) f_flicker = 0.0;
            /*TODO*///	if (f_flicker > 100.0) f_flicker = 100.0;
            /*TODO*///	osd_gamma_correction = get_float ("config", "gamma",   NULL, 1.0);
            /*TODO*///	if (osd_gamma_correction < 0.5) osd_gamma_correction = 0.5;
            /*TODO*///	if (osd_gamma_correction > 2.0) osd_gamma_correction = 2.0;
            /*TODO*///
            	tmpstr             = get_string ("config", "frameskip", "fs", "auto");
            	if (tmpstr.compareTo("auto")==0)//(!stricmp(tmpstr,"auto"))
            	{
            		frameskip = 0;
            		autoframeskip = 1;
            	}
            /*TODO*///	else
            /*TODO*///	{
            /*TODO*///		frameskip = atoi(tmpstr);
            /*TODO*///		autoframeskip = 0;
            /*TODO*///	}
            /*TODO*///	options.norotate  = get_bool ("config", "norotate",  NULL, 0);
            /*TODO*///	options.ror       = get_bool ("config", "ror",       NULL, 0);
            /*TODO*///	options.rol       = get_bool ("config", "rol",       NULL, 0);
            /*TODO*///	options.flipx     = get_bool ("config", "flipx",     NULL, 0);
            /*TODO*///	options.flipy     = get_bool ("config", "flipy",     NULL, 0);
            /*TODO*///
            /*TODO*///	/* read sound configuration */
            /*TODO*///	soundcard           = get_int  ("config", "soundcard",  NULL, -1);
            /*TODO*///	options.use_emulated_ym3812 = !get_bool ("config", "ym3812opl",  NULL,  0);
            /*TODO*///	options.samplerate = get_int  ("config", "samplerate", "sr", 22050);
/*temphack*/            options.samplerate = 22050;
            /*TODO*///	if (options.samplerate < 5000) options.samplerate = 5000;
            /*TODO*///	if (options.samplerate > 50000) options.samplerate = 50000;
            /*TODO*///	usestereo           = get_bool ("config", "stereo",  NULL,  1);
            /*TODO*///	attenuation         = get_int  ("config", "volume",  NULL,  0);
            /*TODO*///	if (attenuation < -32) attenuation = -32;
            /*TODO*///	if (attenuation > 0) attenuation = 0;
            /*TODO*///
            /*TODO*///	/* read input configuration */
            /*TODO*///	use_mouse = get_bool   ("config", "mouse",   NULL,  1);
            /*TODO*///	joyname   = get_string ("config", "joystick", "joy", "none");
            /*TODO*///	use_hotrod = 0;
            /*TODO*///	if (get_bool  ("config", "hotrod",   NULL,  0)) use_hotrod = 1;
            /*TODO*///	if (get_bool  ("config", "hotrodse",   NULL,  0)) use_hotrod = 2;
            /*TODO*///
            /*TODO*///	/* misc configuration */
            /*TODO*///	options.cheat      = get_bool ("config", "cheat", NULL, 0);
            /*TODO*///	options.mame_debug = get_bool ("config", "debug", NULL, 0);
            /*TODO*///	cheatfile  = get_string ("config", "cheatfile", "cf", "CHEAT.DAT");    /* JCK 980917 */
            /*TODO*///
            /*TODO*/// 	#ifndef MESS
            /*TODO*/// 	history_filename  = get_string ("config", "historyfile", NULL, "HISTORY.DAT");    /* JCK 980917 */
            /*TODO*/// 	#else
            /*TODO*/// 	history_filename  = get_string ("config", "historyfile", NULL, "SYSINFO.DAT");
            /*TODO*/// 	#endif
            /*TODO*///
            /*TODO*///	mameinfo_filename  = get_string ("config", "mameinfofile", NULL, "MAMEINFO.DAT");    /* JCK 980917 */
            /*TODO*///
            /*TODO*///	/* get resolution */
            /*TODO*///	resolution  = get_string ("config", "resolution", NULL, "auto");
            /*TODO*///
            /*TODO*///	/* set default subdirectories */
            /*TODO*///	nvdir      = get_string ("directory", "nvram",   NULL, "NVRAM");
            /*TODO*///	hidir      = get_string ("directory", "hi",      NULL, "HI");
            /*TODO*///	cfgdir     = get_string ("directory", "cfg",     NULL, "CFG");
            /*TODO*///	screenshotdir = get_string ("directory", "snap",     NULL, "SNAP");
            /*TODO*///	memcarddir = get_string ("directory", "memcard", NULL, "MEMCARD");
            /*TODO*///	stadir     = get_string ("directory", "sta",     NULL, "STA");
            /*TODO*///	artworkdir = get_string ("directory", "artwork", NULL, "ARTWORK");
            /*TODO*/// 	#ifdef MESS
            /*TODO*/// 		crcdir = get_string ("directory", "crc", NULL, "CRC");
            /*TODO*/// 	#endif
            /*TODO*///
            /*TODO*///	/* get tweaked modes info */
            /*TODO*///	tw224x288_h			= get_int ("tweaked", "224x288_h",              NULL, 0x5f);
            /*TODO*///	tw224x288_v     	= get_int ("tweaked", "224x288_v",              NULL, 0x54);
            /*TODO*///	tw240x256_h     = get_int ("tweaked", "240x256_h",              NULL, 0x67);
            /*TODO*///	tw240x256_v     = get_int ("tweaked", "240x256_v",              NULL, 0x23);
            /*TODO*///	tw256x240_h     = get_int ("tweaked", "256x240_h",              NULL, 0x55);
            /*TODO*///	tw256x240_v     = get_int ("tweaked", "256x240_v",              NULL, 0x43);
            /*TODO*///	tw256x256_h     = get_int ("tweaked", "256x256_h",              NULL, 0x6c);
            /*TODO*///	tw256x256_v     = get_int ("tweaked", "256x256_v",              NULL, 0x23);
            /*TODO*///	tw256x256_hor_h = get_int ("tweaked", "256x256_hor_h",  NULL, 0x55);
            /*TODO*///	tw256x256_hor_v = get_int ("tweaked", "256x256_hor_v",  NULL, 0x60);
            /*TODO*///	tw288x224_h     = get_int ("tweaked", "288x224_h",              NULL, 0x5f);
            /*TODO*///	tw288x224_v     = get_int ("tweaked", "288x224_v",              NULL, 0x0c);
            /*TODO*///	tw240x320_h             = get_int ("tweaked", "240x320_h",              NULL, 0x5a);
            /*TODO*///	tw240x320_v             = get_int ("tweaked", "240x320_v",              NULL, 0x8c);
            /*TODO*///	tw320x240_h             = get_int ("tweaked", "320x240_h",              NULL, 0x5f);
            /*TODO*///	tw320x240_v             = get_int ("tweaked", "320x240_v",              NULL, 0x0c);
            /*TODO*///	tw336x240_h             = get_int ("tweaked", "336x240_h",              NULL, 0x5f);
            /*TODO*///	tw336x240_v             = get_int ("tweaked", "336x240_v",              NULL, 0x0c);
            /*TODO*///	tw384x224_h             = get_int ("tweaked", "384x224_h",              NULL, 0x6c);
            /*TODO*///	tw384x224_v             = get_int ("tweaked", "384x224_v",              NULL, 0x0c);
            /*TODO*///	tw384x240_h             = get_int ("tweaked", "384x240_h",              NULL, 0x6c);
            /*TODO*///	tw384x240_v             = get_int ("tweaked", "384x240_v",              NULL, 0x0c);
            /*TODO*///	tw384x256_h             = get_int ("tweaked", "384x256_h",              NULL, 0x6c);
            /*TODO*///	tw384x256_v             = get_int ("tweaked", "384x256_v",              NULL, 0x23);
            /*TODO*///
            /*TODO*///	/* Get 15.75KHz tweak values */
            /*TODO*///	tw224x288arc_h          = get_int ("tweaked", "224x288arc_h",   NULL, 0x5d);
            /*TODO*///	tw224x288arc_v          = get_int ("tweaked", "224x288arc_v",   NULL, 0x38);
            /*TODO*///	tw288x224arc_h          = get_int ("tweaked", "288x224arc_h",   NULL, 0x5d);
            /*TODO*///	tw288x224arc_v          = get_int ("tweaked", "288x224arc_v",   NULL, 0x09);
            /*TODO*///	tw256x240arc_h          = get_int ("tweaked", "256x240arc_h",   NULL, 0x5d);
            /*TODO*///	tw256x240arc_v          = get_int ("tweaked", "256x240arc_v",   NULL, 0x09);
            /*TODO*///	tw256x256arc_h          = get_int ("tweaked", "256x256arc_h",   NULL, 0x5d);
            /*TODO*///	tw256x256arc_v          = get_int ("tweaked", "256x256arc_v",   NULL, 0x17);
            /*TODO*///	tw320x240arc_h          = get_int ("tweaked", "320x240arc_h",   NULL, 0x69);
            /*TODO*///	tw320x240arc_v          = get_int ("tweaked", "320x240arc_v",   NULL, 0x09);
            /*TODO*///	tw320x256arc_h          = get_int ("tweaked", "320x256arc_h",   NULL, 0x69);
            /*TODO*///	tw320x256arc_v          = get_int ("tweaked", "320x256arc_v",   NULL, 0x17);
            /*TODO*///	tw352x240arc_h          = get_int ("tweaked", "352x240arc_h",   NULL, 0x6a);
            /*TODO*///	tw352x240arc_v          = get_int ("tweaked", "352x240arc_v",   NULL, 0x09);
            /*TODO*///	tw352x256arc_h          = get_int ("tweaked", "352x256arc_h",   NULL, 0x6a);
            /*TODO*///	tw352x256arc_v          = get_int ("tweaked", "352x256arc_v",   NULL, 0x17);
            /*TODO*///	tw368x224arc_h          = get_int ("tweaked", "368x224arc_h",   NULL, 0x6a);
            /*TODO*///	tw368x224arc_v          = get_int ("tweaked", "368x224arc_v",   NULL, 0x09);
            /*TODO*///	tw368x240arc_h          = get_int ("tweaked", "368x240arc_h",   NULL, 0x6a);
            /*TODO*///	tw368x240arc_v          = get_int ("tweaked", "368x240arc_v",   NULL, 0x09);
            /*TODO*///	tw368x256arc_h          = get_int ("tweaked", "368x256arc_h",   NULL, 0x6a);
            /*TODO*///	tw368x256arc_v          = get_int ("tweaked", "368x256arc_v",   NULL, 0x17);
            /*TODO*///	tw512x224arc_h          = get_int ("tweaked", "512x224arc_h",   NULL, 0xbf);
            /*TODO*///	tw512x224arc_v          = get_int ("tweaked", "512x224arc_v",   NULL, 0x09);
            /*TODO*///	tw512x256arc_h          = get_int ("tweaked", "512x256arc_h",   NULL, 0xbf);
            /*TODO*///	tw512x256arc_v          = get_int ("tweaked", "512x256arc_v",   NULL, 0x17);
            /*TODO*///	tw512x448arc_h          = get_int ("tweaked", "512x448arc_h",   NULL, 0xbf);
            /*TODO*///	tw512x448arc_v          = get_int ("tweaked", "512x448arc_v",   NULL, 0x09);
            /*TODO*///	tw512x512arc_h          = get_int ("tweaked", "512x512arc_h",   NULL, 0xbf);
            /*TODO*///	tw512x512arc_v          = get_int ("tweaked", "512x512arc_v",   NULL, 0x17);
            /*TODO*///	tw640x480arc_h          = get_int ("tweaked", "640x480arc_h",   NULL, 0xc1);
            /*TODO*///	tw640x480arc_v          = get_int ("tweaked", "640x480arc_v",   NULL, 0x09);
            /*TODO*///
            /*TODO*///	/* this is handled externally cause the audit stuff needs it, too */
            /*TODO*///	get_rom_sample_path (argc, argv, game_index);
            /*TODO*///
            /*TODO*///	/* get the monitor type */
            /*TODO*///	monitorname = get_string ("config", "monitor", NULL, "standard");
            /*TODO*///	/* get -centerx */
            /*TODO*///	center_x = get_int ("config", "centerx", NULL,  0);
            /*TODO*///	/* get -centery */
            /*TODO*///	center_y = get_int ("config", "centery", NULL,  0);
            /*TODO*///	/* get -waitinterlace */
            /*TODO*///	wait_interlace = get_bool ("config", "waitinterlace", NULL,  0);
            /*TODO*///
            /*TODO*///	/* process some parameters */
            /*TODO*///	options.beam = (int)(f_beam * 0x00010000);
            /*TODO*///	if (options.beam < 0x00010000)
            /*TODO*///		options.beam = 0x00010000;
            /*TODO*///	if (options.beam > 0x00100000)
            /*TODO*///		options.beam = 0x00100000;
            /*TODO*///
            /*TODO*///	options.flicker = (int)(f_flicker * 2.55);
            /*TODO*///	if (options.flicker < 0)
            /*TODO*///		options.flicker = 0;
            /*TODO*///	if (options.flicker > 255)
            /*TODO*///		options.flicker = 255;
            /*TODO*///
            /*TODO*///	if (stricmp (vesamode, "vesa1") == 0)
            /*TODO*///		gfx_mode = GFX_VESA1;
            /*TODO*///	else if (stricmp (vesamode, "vesa2b") == 0)
            /*TODO*///		gfx_mode = GFX_VESA2B;
            /*TODO*///	else if (stricmp (vesamode, "vesa2l") == 0)
            /*TODO*///		gfx_mode = GFX_VESA2L;
            /*TODO*///	else if (stricmp (vesamode, "vesa3") == 0)
            /*TODO*///		gfx_mode = GFX_VESA3;
            /*TODO*///	else
            /*TODO*///	{
            /*TODO*///		if (errorlog)
            /*TODO*///			fprintf (errorlog, "%s is not a valid entry for vesamode\n",
            /*TODO*///					vesamode);
            /*TODO*///		gfx_mode = GFX_VESA3; /* default to VESA2L */
            /*TODO*///	}
            /*TODO*///
            /*TODO*///	/* any option that starts with a digit is taken as a resolution option */
            /*TODO*///	/* this is to handle the old "-wxh" commandline option. */
            /*TODO*///	for (i = 1; i < argc; i++)
            /*TODO*///	{
            /*TODO*///		if (argv[i][0] == '-' && isdigit(argv[i][1]) &&
            /*TODO*///				(strstr(argv[i],"x") || strstr(argv[i],"X")))
            /*TODO*///			resolution = &argv[i][1];
            /*TODO*///	}
            /*TODO*///
            	/* break up resolution into gfx_width and gfx_height */
            	gfx_height = gfx_width = 0;
            /*TODO*///	if (stricmp (resolution, "auto") != 0)
            /*TODO*///	{
            /*TODO*///		char *tmp;
            /*TODO*///		strncpy (tmpres, resolution, 10);
            /*TODO*///		tmp = strtok (tmpres, "xX");
            /*TODO*///		gfx_width = atoi (tmp);
            /*TODO*///		tmp = strtok (0, "xX");
            /*TODO*///		if (tmp)
            /*TODO*///			gfx_height = atoi (tmp);
            /*TODO*///	}
            /*TODO*///
            /*TODO*///	/* convert joystick name into an Allegro-compliant joystick signature */
            /*TODO*///	joystick = -2; /* default to invalid value */
            /*TODO*///
            /*TODO*///	for (i = 0; joy_table[i].name != NULL; i++)
            /*TODO*///	{
            /*TODO*///		if (stricmp (joy_table[i].name, joyname) == 0)
            /*TODO*///		{
            /*TODO*///			joystick = joy_table[i].id;
            /*TODO*///			if (errorlog)
            /*TODO*///				fprintf (errorlog, "using joystick %s = %08x\n",
            /*TODO*///						joyname,joy_table[i].id);
            /*TODO*///			break;
            /*TODO*///		}
            /*TODO*///	}
            /*TODO*///
            /*TODO*///	if (joystick == -2)
            /*TODO*///	{
            /*TODO*///		if (errorlog)
            /*TODO*///			fprintf (errorlog, "%s is not a valid entry for a joystick\n",
            /*TODO*///					joyname);
            /*TODO*///		joystick = JOY_TYPE_NONE;
            /*TODO*///	}
            /*TODO*///
            /*TODO*///	/* get monitor type from supplied name */
            /*TODO*///	monitor_type = MONITOR_TYPE_STANDARD; /* default to PC monitor */
            /*TODO*///
            /*TODO*///	for (i = 0; monitor_table[i].name != NULL; i++)
            /*TODO*///	{
            /*TODO*///		if ((stricmp (monitor_table[i].name, monitorname) == 0))
            /*TODO*///		{
            /*TODO*///			monitor_type = monitor_table[i].id;
            /*TODO*///			break;
            /*TODO*///		}
            /*TODO*///	}


    }