예제 #1
0
void osd_init(running_machine *machine)
{

	//add_exit_callback(machine, osd_exit);
	machine->add_notifier(MACHINE_NOTIFY_EXIT, osd_exit);

	our_target = render_target_alloc(machine, NULL, 0);
	if (our_target == NULL)
		fatalerror("Error creating render target");

	myosd_inGame = !(machine->gamedrv == &GAME_NAME(empty));
    
	options_set_bool(mame_options(), OPTION_CHEAT,myosd_cheat,OPTION_PRIORITY_CMDLINE);
    options_set_bool(mame_options(), OPTION_AUTOSAVE,myosd_autosave,OPTION_PRIORITY_CMDLINE);
    options_set_bool(mame_options(), OPTION_SOUND,myosd_sound_value != -1,OPTION_PRIORITY_CMDLINE);
    if(myosd_sound_value!=-1)
       options_set_int(mame_options(), OPTION_SAMPLERATE,myosd_sound_value,OPTION_PRIORITY_CMDLINE);
    
    options_set_float(mame_options(), OPTION_BEAM,myosd_vector_bean2x ? 2.5 : 1.0, OPTION_PRIORITY_CMDLINE);
    options_set_float(mame_options(), OPTION_FLICKER,myosd_vector_flicker ? 0.4 : 0.0, OPTION_PRIORITY_CMDLINE);
    options_set_bool(mame_options(), OPTION_ANTIALIAS,myosd_vector_antialias,OPTION_PRIORITY_CMDLINE);
    
	droid_ios_init_input(machine);
	droid_ios_init_sound(machine);
	droid_ios_init_video(machine);
    
    netplay_t *handle = netplay_get_handle();
        
    if(handle->has_connection)
    {
        handle->has_begun_game = 1;
    }
}
예제 #2
0
파일: osdmain.c 프로젝트: i-willh/imame4all
void osd_init(running_machine *machine)
{

	//add_exit_callback(machine, osd_exit);
	machine->add_notifier(MACHINE_NOTIFY_EXIT, osd_exit);

	our_target = render_target_alloc(machine, NULL, 0);
	if (our_target == NULL)
		fatalerror("Error creating render target");

	myosd_inGame = !(machine->gamedrv == &GAME_NAME(empty));


	options_set_bool(mame_options(), OPTION_CHEAT,myosd_cheat,OPTION_PRIORITY_CMDLINE);
    options_set_bool(mame_options(), OPTION_AUTOSAVE,myosd_autosave,OPTION_PRIORITY_CMDLINE);
    options_set_bool(mame_options(), OPTION_SOUND,myosd_sound_value != -1,OPTION_PRIORITY_CMDLINE);
    if(myosd_sound_value!=-1)
       options_set_int(mame_options(), OPTION_SAMPLERATE,myosd_sound_value,OPTION_PRIORITY_CMDLINE);

	droid_ios_init_input(machine);
	droid_ios_init_sound(machine);
	droid_ios_init_video(machine);
}
예제 #3
0
void image_add_device_options(core_options *opts, const game_driver *driver)
{
	int index = 0;
	machine_config *config;
	const device_config_image_interface *image = NULL;

	/* create the configuration */
	config = global_alloc(machine_config(driver->machine_config));

	/* enumerate our callback for every device */
	/* loop on each device instance */
	for (bool gotone = config->m_devicelist.first(image); gotone; gotone = image->next(image))
	{
		options_entry entry[2];
		astring dev_full_name;

		/* first device? add the header as to be pretty */
		if (index == 0)
		{
			memset(entry, 0, sizeof(entry));
			entry[0].description = "IMAGE DEVICES";
			entry[0].flags = OPTION_HEADER;
			options_add_entries(opts, entry);
		}

		/* retrieve info about the device instance */
		dev_full_name.printf("%s;%s", image->instance_name(), image->brief_instance_name());

		/* add the option */
		memset(entry, 0, sizeof(entry));
		entry[0].name = dev_full_name;
		options_add_entries(opts, entry);

		index++;
	}

	/* record that we've added device options */
	options_set_bool(opts, OPTION_ADDED_DEVICE_OPTIONS, TRUE, OPTION_PRIORITY_CMDLINE);

	/* free the configuration */
	global_free(config);
}
예제 #4
0
파일: server.c 프로젝트: jonsafari/mocp
/* Get and set an option from the client. Return 1 on error. */
static int get_set_option (struct client *cli)
{
	char *name;
	int val;

	if (!(name = get_str (cli->socket)))
		return 0;
	if (!valid_sync_option (name)) {
		logit ("Client requested setting invalid option '%s'", name);
		return 0;
	}
	if (!get_int (cli->socket, &val)) {
		free (name);
		return 0;
	}

	options_set_bool (name, val ? true : false);
	free (name);

	add_event_all (EV_OPTIONS, NULL);

	return 1;
}
예제 #5
0
running_machine::~running_machine()
{
	/* clear flag for added devices */
	options_set_bool(&m_options, OPTION_ADDED_DEVICE_OPTIONS, FALSE, OPTION_PRIORITY_CMDLINE);
}
예제 #6
0
static messtest_result_t run_test(int flags, messtest_results *results)
{
	const game_driver *driver;
	messtest_result_t rc;
	clock_t begin_time;
	double real_run_time;
	astring *fullpath = NULL;
	const char *device_opt;
	const char *fake_argv[2];
	core_options *opts;

	/* lookup driver */
	driver = driver_get_name(current_testcase.driver);

	/* cannot find driver? */
	if (driver == NULL)
	{
		report_message(MSG_FAILURE, "Cannot find driver '%s'", current_testcase.driver);
		return MESSTEST_RESULT_STARTFAILURE;
	}

	/* prepare testing state */
	current_command = current_testcase.commands;
	state = STATE_READY;
	test_flags = flags;
	screenshot_num = 0;
	runtime_hash = 0;
	had_failure = FALSE;
	//videoram = NULL;
	//videoram_size = 0;

	/* set up options */
	opts = mame_options_init(win_mess_opts);
	options_set_string(opts, OPTION_GAMENAME, driver->name, OPTION_PRIORITY_CMDLINE);
	if( current_testcase.bios )
		options_set_string(opts, OPTION_BIOS, current_testcase.bios, OPTION_PRIORITY_CMDLINE);
	options_set_bool(opts, OPTION_SKIP_GAMEINFO, TRUE, OPTION_PRIORITY_CMDLINE);
	options_set_bool(opts, OPTION_THROTTLE, FALSE, OPTION_PRIORITY_CMDLINE);
	options_set_bool(opts, OPTION_DEBUG, FALSE, OPTION_PRIORITY_CMDLINE);
	options_set_bool(opts, OPTION_DEBUG_INTERNAL, FALSE, OPTION_PRIORITY_CMDLINE);
	options_set_bool(opts, OPTION_WRITECONFIG, FALSE, OPTION_PRIORITY_CMDLINE);

	if (current_testcase.ram != 0)
	{
		options_set_int(opts, OPTION_RAMSIZE, current_testcase.ram, OPTION_PRIORITY_CMDLINE);
	}

	/* ugh... hideous ugly fake arguments */
	fake_argv[0] = "MESSTEST";
	fake_argv[1] = driver->name;
	options_parse_command_line(opts, ARRAY_LENGTH(fake_argv), (char **) fake_argv, OPTION_PRIORITY_CMDLINE,TRUE);

	/* preload any needed images */
	while(current_command->command_type == MESSTEST_COMMAND_IMAGE_PRELOAD)
	{
		/* get the path */
		fullpath = assemble_software_path(astring_alloc(), driver, current_command->u.image_args.filename);

		/* get the option name */
		device_opt = device_config_image_interface::device_typename(current_command->u.image_args.device_ident.type);

		/* set the option */
		options_set_string(opts, device_opt, astring_c(fullpath), OPTION_PRIORITY_CMDLINE);

		/* cleanup */
		astring_free(fullpath);
		fullpath = NULL;

		/* next command */
		current_command++;
	}

	/* perform the test */
	report_message(MSG_INFO, "Beginning test (driver '%s')", current_testcase.driver);
	begin_time = clock();
	mame_set_output_channel(OUTPUT_CHANNEL_ERROR, messtest_output_error, NULL, NULL, NULL);
	mame_set_output_channel(OUTPUT_CHANNEL_WARNING, mame_null_output_callback, NULL, NULL, NULL);
	mame_set_output_channel(OUTPUT_CHANNEL_INFO, mame_null_output_callback, NULL, NULL, NULL);
	mame_set_output_channel(OUTPUT_CHANNEL_DEBUG, mame_null_output_callback, NULL, NULL, NULL);
	mame_set_output_channel(OUTPUT_CHANNEL_LOG, mame_null_output_callback, NULL, NULL, NULL);
	test_osd_interface osd;
	mame_execute(osd, opts);
	real_run_time = ((double) (clock() - begin_time)) / CLOCKS_PER_SEC;

	/* what happened? */
	switch(state)
	{
		case STATE_ABORTED:
			report_message(MSG_FAILURE, "Test aborted");
			rc = MESSTEST_RESULT_RUNTIMEFAILURE;
			break;

		case STATE_DONE:
			if (had_failure)
			{
				report_message(MSG_FAILURE, "Test failed (real time %.2f; emu time %.2f [%i%%])",
					real_run_time, final_time.as_double(), (int) ((final_time.as_double() / real_run_time) * 100));
				rc = MESSTEST_RESULT_RUNTIMEFAILURE;
			}
			else
			{
				report_message(MSG_INFO, "Test succeeded (real time %.2f; emu time %.2f [%i%%])",
					real_run_time, final_time.as_double(), (int) ((final_time.as_double() / real_run_time) * 100));
				rc = MESSTEST_RESULT_SUCCESS;
			}
			break;

		default:
			state = STATE_ABORTED;
			report_message(MSG_FAILURE, "Abnormal termination");
			rc = MESSTEST_RESULT_STARTFAILURE;
			break;
	}

	if (results)
	{
		results->rc = rc;
		results->runtime_hash = runtime_hash;
	}

	options_free(opts);
	return rc;
}
예제 #7
0
파일: main.c 프로젝트: fdgonthier/tbxsosd
/** Parse command line options. */ 
static int kd_options_parse(int argc, char * argv[]) {
    int c;
    char *oarg;

    opterr = 0;

    /* Parse command-line */
    while (1) {
        c = getopt(argc, argv, "P:v:p:VdfD");
		
        if (c == -1)
            break;

        switch (c) {
            /* Listening port */
        case 'p':
            oarg = optarg;
            if (oarg != NULL) {
                uint16_t port;
                if (sscanf(oarg, "%hd", &port) < 1) {
                    fprintf(stderr, "Invalid port number: %s", oarg);
                    exit(1);
                }

                options_set_uint16("server.port", port);
            } 
            else {
                fprintf(stderr, "The -p option requires a parameter.");
                exit(1);
            }
            break;
			
            /* Verbosity */
        case 'v':
            oarg = optarg;
            if (oarg != NULL) {
                uint32_t v;
                if (sscanf(oarg, "%d", &v) < 1) {
                    fprintf(stderr, "Invalid value for logging verbosity: %s", oarg);
                    exit(1);
                }

                options_set_uint32("server.log_verbosity", v);
            } 
            else {
                fprintf(stderr, "The -v option requires a parameter.");
                exit(1);
            }
            break;
      
            /* Create PID file. */
        case 'P':
            oarg = optarg;
            if (oarg != NULL) 
                options_set_str("server.pid_path", oarg);
            else {
                fprintf(stderr, "The -P option requires a parameter.");
                exit(1);
            }
            break;

            /* Version */
        case 'V':
            kd_info();
            return -1;
					
        case 'D':
            /* DEBUG mode, don't detach nor fork and log to stderr. */
            options_set_bool("server.detach", 0);
            options_set_bool("server.fork", 0);
            options_set_str("server.log_driver", "stderr");
            break;

        case 'd':
            /* Detach from controlling terminal? */
            options_set_bool("server.detach", 1);
            break;

        case 'f':
        case '1':
            /* Fork new clients? */
            options_set_bool("server.fork", 1);
            break;
		
        default:
            kd_options_print();
            return -1;
        }
    }

    return 0;
}