Example #1
0
// ============================================================================================
// ============================================================================================
// SWARM DYNAMICS 2 --- two rhythms ---
// ============================================================================================
// ============================================================================================
void swarm_initialization2()
{
	init_common();
	mchip.px = 1.0;
	mchip.py = 0.0; 
	mchip.hd = 0.0;
}
Example #2
0
File: atmain.c Project: hww3/pexts
void pike_module_init(void)
{
#ifdef HAVE_SHADOW_H
#ifndef RUNNING_BSD
    init_interleave_mutex(&at_shadow_mutex);
#endif /* RUNNING_BSD */
#endif /* HAVE_SHADOW_H */

    init_common("AdminTools");

#ifdef PEXTS_VERSION
    pexts_init();
#endif
    
    /* Shadow stuff */
#ifdef HAVE_SHADOW_H
#ifndef RUNNING_BSD
    shadow_program = _at_shadow_init();
#endif /* RUNNING_BSD */
#endif /* HAVE_SHADOW_H */
    
    /* Dir stuff */
    dir_program = _at_directory_init();
    
    /* Quota stuff */
    quota_program = _at_quota_init();
    
    /* System stuff */
    system_program = _at_system_init();

    /* PAM stuff */
#ifdef HAVE_PAM
    pam_program = _at_pam_init();
#endif
}
Example #3
0
status_t
vesa_clone_accelerant(void *info)
{
	TRACE(("vesa_clone_accelerant()\n"));

	// create full device name
	char path[MAXPATHLEN];
	strcpy(path, "/dev/");
	strcat(path, (const char *)info);

	int fd = open(path, B_READ_WRITE);
	if (fd < 0)
		return errno;

	status_t status = init_common(fd, true);
	if (status != B_OK)
		goto err1;

	// get read-only clone of supported display modes
	status = gInfo->mode_list_area = clone_area(
		"vesa cloned modes", (void **)&gInfo->mode_list,
		B_ANY_ADDRESS, B_READ_AREA, gInfo->shared_info->mode_list_area);
	if (status < B_OK)
		goto err2;

	return B_OK;

err2:
	uninit_common();
err1:
	close(fd);
	return status;
}
Example #4
0
static long init_record(mbbiRecord *prec, int pass)
{
    struct mbbidset *pdset;
    long status;

    if (pass==0) return(0);

    if (prec->siml.type == CONSTANT) {
	recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm);
    }
    if (prec->siol.type == CONSTANT) {
	recGblInitConstantLink(&prec->siol,DBF_USHORT,&prec->sval);
    }
    if(!(pdset = (struct mbbidset *)(prec->dset))) {
	recGblRecordError(S_dev_noDSET,(void *)prec,"mbbi: init_record");
	return(S_dev_noDSET);
    }
    /* must have read_mbbi function defined */
    if( (pdset->number < 5) || (pdset->read_mbbi == NULL) ) {
	recGblRecordError(S_dev_missingSup,(void *)prec,"mbbi: init_record");
	return(S_dev_missingSup);
    }
    /* initialize mask*/
    prec->mask = (1 << prec->nobt) - 1;

    if( pdset->init_record ) {
	if((status=(*pdset->init_record)(prec))) return(status);
    }
    init_common(prec);
    prec->mlst = prec->val;
    prec->lalm = prec->val;
    prec->oraw = prec->rval;
    return(0);
}
Example #5
0
krb5_error_code KRB5_CALLCONV
krb5_init_secure_context(krb5_context *context)
{

        /* This is to make gcc -Wall happy */
        if(0) krb5_brand[0] = krb5_brand[0];
	return init_common (context, TRUE, FALSE);
}
Example #6
0
// ============================================================================================
// ============================================================================================
// SWARM DYNAMICS 2 --- propagation ---
// ============================================================================================
// ============================================================================================
void swarm_initialization2()
{
	init_common();

	mchip.tim1 = 3.0*PI;
	mchip.tim2 = 3.0*PI;
	mchip.flag = false;
}
Example #7
0
VIDEO_START_MEMBER(fromance_state,nekkyoku)
{
	/* allocate tilemaps */
	m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(fromance_state::get_nekkyoku_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 4, 64, 64);
	m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(fromance_state::get_nekkyoku_fg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 4, 64, 64);

	init_common();
}
Example #8
0
static void init_cd32(amiga_config *c, const char *id, const char *name,
                      int quickstart_config)
{
    init_common(c, id, name, MODEL_CD32, 8, quickstart_config);
    c->enhanced_audio_filter = 1;
#ifndef NEW_ACCURACY_SYSTEM
    c->fast_on_accuracy_level = 0;
#endif
}
Example #9
0
static void init_once(void)
{
	if ((init_error = git_mutex_init(&git__mwindow_mutex)) != 0)
		return;

	pthread_key_create(&_tls_key, &cb__free_status);

	init_error = init_common();
}
Example #10
0
// ############################################################################################
// ============================================================================================
// ============================================================================================
// SWARM DYNAMICS 1 --- Ken's Swarm Dynamics ---
// ============================================================================================
// ============================================================================================
void swarm_initialization1()
{
	init_common();

	mchip.px = 0.0;
	mchip.py = 0.0;
	mchip.vx = 1.0;
	mchip.vy = 1.0;
	mchip.hd = PI/2.0;
}
Example #11
0
krb5_error_code KRB5_CALLCONV
krb5_init_secure_context(krb5_context *context)
{

#if 0 /* Solaris Kerberos */
        /* This is to make gcc -Wall happy */
        if(0) krb5_brand[0] = krb5_brand[0];
#endif
	return init_common (context, TRUE, FALSE);
}
Example #12
0
static void init_a3000(amiga_config *c, const char *id, const char *name,
                       int quickstart_config)
{
    init_common(c, id, name, MODEL_A3000, 5, quickstart_config);
    c->fast_on_accuracy_level = 1;
    c->no_accuracy_adjustment = 1;
    c->allow_z3_memory = 1;
    // c->enhanced_audio_filter = 1;
    c->wb_disk = wb_disk_3_1_0;
}
Example #13
0
// ============================================================================================
// ============================================================================================
// SWARM DYNAMICS 1 --- Ken's Swarm Dynamics ---
// ============================================================================================
// ============================================================================================
void swarm_initialization1()
{
	init_common();

	mchip.px = 2.7;
	mchip.py = 75.6;
	mchip.vx = 3.8;
	mchip.vy = 1.3;
	mchip.hd = 0.0;
	mchip.hd_diff = 0;
}
Example #14
0
static void init_a4000(amiga_config *c, const char *id, const char *name,
                       int quickstart_config)
{
    init_common(c, id, name, MODEL_A4000, 6, quickstart_config);
    c->fast_on_accuracy_level = 1;
    c->no_accuracy_adjustment = 1;
    c->allow_z3_memory = 1;
    c->enhanced_audio_filter = 1;
    c->wb_disk = wb_disk_3_1_0;
    c->default_floppy_drive_type = 1; // 3.5" HD
}
Example #15
0
static void init_a1200(amiga_config *c, const char *id, const char *name,
                       int quickstart_config)
{
    init_common(c, id, name, MODEL_A1200, 4, quickstart_config);
    c->enhanced_audio_filter = 1;
#ifndef NEW_ACCURACY_SYSTEM
#error do not use
    c->fast_on_accuracy_level = 0;
#endif
    c->wb_disk = wb_disk_3_1_0;
}
Example #16
0
/*! Init primary accelerant */
status_t
intel_init_accelerant(int device)
{
	TRACE(("intel_init_accelerant()\n"));

	status_t status = init_common(device, false);
	if (status != B_OK)
		return status;

	intel_shared_info &info = *gInfo->shared_info;

	init_lock(&info.accelerant_lock, "intel extreme accelerant");
	init_lock(&info.engine_lock, "intel extreme engine");

	setup_ring_buffer(info.primary_ring_buffer, "intel primary ring buffer");

	// determine head depending on what's already enabled from the BIOS
	// TODO: it would be nicer to retrieve this data via DDC - else the
	//	display is gone for good if the BIOS decides to only show the
	//	picture on the connected analog monitor!
	gInfo->head_mode = 0;
	if (read32(INTEL_DISPLAY_B_PIPE_CONTROL) & DISPLAY_PIPE_ENABLED)
		gInfo->head_mode |= HEAD_MODE_B_DIGITAL;
	if (read32(INTEL_DISPLAY_A_PIPE_CONTROL) & DISPLAY_PIPE_ENABLED)
		gInfo->head_mode |= HEAD_MODE_A_ANALOG;

	uint32 lvds = read32(INTEL_DISPLAY_LVDS_PORT);

	// If we have an enabled display pipe we save the passed information and
	// assume it is the valid panel size..
	// Later we query for proper EDID info if it exists, or figure something
	// else out. (Default modes, etc.)
	bool hasPCH = gInfo->shared_info->device_type.HasPlatformControlHub();
	if ((hasPCH && (lvds & PCH_LVDS_DETECTED) != 0)
		|| (!hasPCH && (lvds & DISPLAY_PIPE_ENABLED) != 0)) {
		save_lvds_mode();
		gInfo->head_mode |= HEAD_MODE_LVDS_PANEL;
	}

	TRACE(("head detected: %#x\n", gInfo->head_mode));
	TRACE(("adpa: %08lx, dova: %08lx, dovb: %08lx, lvds: %08lx\n",
		read32(INTEL_DISPLAY_A_ANALOG_PORT),
		read32(INTEL_DISPLAY_A_DIGITAL_PORT),
		read32(INTEL_DISPLAY_B_DIGITAL_PORT), read32(INTEL_DISPLAY_LVDS_PORT)));

	status = create_mode_list();
	if (status != B_OK) {
		uninit_common();
		return status;
	}

	return B_OK;
}
Example #17
0
static int encode_init(AVCodecContext *avctx) {
	MscEncoderContext * mscEncoderContext;
	MscCodecContext * mscContext;
	const int scale = 1;

	mscEncoderContext	= avctx->priv_data;
	mscContext			= &mscEncoderContext->mscContext;

	init_common(avctx, &mscEncoderContext->mscContext);

	if(avctx->global_quality == 0) avctx->global_quality= 4*FF_QUALITY_SCALE;

	mscContext->inv_qscale = (32*scale*FF_QUALITY_SCALE +  avctx->global_quality/2) / avctx->global_quality;

	for(int i = 0; i < 64; i++) {
		int q= 32*scale * quant_intra_matrix[i];
		int qNonIntra= 32*scale * ff_mpeg1_default_non_intra_matrix[i];
		mscContext->q_intra_matrix[i]= ((mscContext->inv_qscale << 16) + q/2) / q;
		mscContext->q_non_intra_matrix[i]= ((mscContext->inv_qscale << 16) + qNonIntra/2) / qNonIntra;
	}

	avctx->extradata= av_mallocz(8);
	avctx->extradata_size=8;
	((uint32_t*)avctx->extradata)[0]= av_le2ne32(mscContext->inv_qscale);
	((uint32_t*)avctx->extradata)[1]= av_le2ne32(AV_RL32("MSC0"));

	//check TODO
	ff_init_scantable(mscContext->dsp.idct_permutation, &mscContext->scantable, scantab);
	for(int i = 0; i < 64; i++){
			int index= scantab[i];
			mscContext->intra_matrix[i]= 64 * scale * quant_intra_matrix[index] / mscContext->inv_qscale;
			mscContext->non_intra_matrix[i]= 64 * scale * ff_mpeg1_default_non_intra_matrix[index] / mscContext->inv_qscale;
		}

	// allocate frame
	avctx->coded_frame = avcodec_alloc_frame();
	if (!avctx->coded_frame) {
		av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
		return AVERROR(ENOMEM);
	}

	// allocate buffers
	mscEncoderContext->arithBuffSize	= 6 * avctx->coded_width * avctx->coded_height;
	mscEncoderContext->arithBuff		= av_malloc(mscEncoderContext->arithBuffSize);

	if (mscEncoderContext->arithBuff == NULL) {
		av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n");
		return AVERROR(ENOMEM);
	}

	return 0;
}
Example #18
0
int git_libgit2_init(void)
{
	int ret;

	/* Only init subsystems the first time */
	if ((ret = git_atomic_inc(&git__n_inits)) != 1)
		return ret;

	if ((ret = init_common()) < 0)
		return ret;

	return 1;
}
Example #19
0
static DRIVER_INIT( relief )
{
	static const UINT16 default_eeprom[] =
	{
		0x0001,0x0166,0x0128,0x01E6,0x0100,0x012C,0x0300,0x0144,
		0x0700,0x01C0,0x2F00,0x01EC,0x0B00,0x0148,0x0140,0x0100,
		0x0124,0x0188,0x0120,0x0600,0x0196,0x013C,0x0192,0x0150,
		0x0166,0x0128,0x01E6,0x0100,0x012C,0x0300,0x0144,0x0700,
		0x01C0,0x2F00,0x01EC,0x0B00,0x0148,0x0140,0x0100,0x0124,
		0x0188,0x0120,0x0600,0x0196,0x013C,0x0192,0x0150,0xFF00,
		0x9500,0x0000
	};
	init_common(machine, default_eeprom);
}
Example #20
0
static int synchronized_threads_init(void)
{
	int error;

	_tls_index = TlsAlloc();

	git_threads_init();

	if (git_mutex_init(&git__mwindow_mutex))
		return -1;

	error = init_common();

	return error;
}
Example #21
0
/*!	Init primary accelerant */
status_t
vesa_init_accelerant(int device)
{
	TRACE(("vesa_init_accelerant()\n"));

	status_t status = init_common(device, false);
	if (status != B_OK)
		return status;

	status = create_mode_list();
	if (status != B_OK) {
		uninit_common();
		return status;
	}

	// Initialize current mode completely from the mode list
	vesa_propose_display_mode(&gInfo->shared_info->current_mode, NULL, NULL);
	return B_OK;
}
Example #22
0
/*! Init primary accelerant */
status_t
intel_init_accelerant(int device)
{
	CALLED();

	status_t status = init_common(device, false);
	if (status != B_OK)
		return status;

	intel_shared_info &info = *gInfo->shared_info;

	init_lock(&info.accelerant_lock, "intel extreme accelerant");
	init_lock(&info.engine_lock, "intel extreme engine");

	setup_ring_buffer(info.primary_ring_buffer, "intel primary ring buffer");

	TRACE("pipe control for: 0x%" B_PRIx32 " 0x%" B_PRIx32 "\n",
		read32(INTEL_PIPE_CONTROL), read32(INTEL_PIPE_CONTROL));

	// Probe all ports
	status = probe_ports();

	// On TRACE, dump ports and states
	dump_ports();

	if (status != B_OK)
		ERROR("Warning: zero active displays were found!\n");

	status = assign_pipes();

	if (status != B_OK)
		ERROR("Warning: error while assigning pipes!\n");

	status = create_mode_list();
	if (status != B_OK) {
		uninit_common();
		return status;
	}

	return B_OK;
}
Example #23
0
krb5_error_code KRB5_CALLCONV
krb5_get_init_creds_opt_alloc(krb5_context context,
			      krb5_get_init_creds_opt **opt)
{
    krb5_gic_opt_ext *opte;

    if (NULL == opt)
	return EINVAL;
    *opt = NULL;

    /*
     * We return a new extended structure cast as a krb5_get_init_creds_opt
     */
    opte = krb5int_gic_opte_alloc(context);
    if (NULL == opte)
	return ENOMEM;

    *opt = (krb5_get_init_creds_opt *) opte;
    init_common(*opt);
    return 0;
}
Example #24
0
static DRIVER_INIT( relief2 )
{
	static const UINT16 default_eeprom[] =
	{
		0x0001,0x01FD,0x019F,0x015E,0x01FF,0x019E,0x03FF,0x015F,
		0x07FF,0x01FD,0x12FF,0x01FC,0x01FB,0x07FF,0x01F7,0x01FF,
		0x01DF,0x02FF,0x017F,0x03FF,0x0300,0x0110,0x0300,0x0140,
		0x0300,0x018E,0x0400,0x0180,0x0101,0x0300,0x0180,0x0204,
		0x0120,0x0182,0x0100,0x0102,0x0600,0x01D5,0x0138,0x0192,
		0x0150,0x01FD,0x019F,0x015E,0x01FF,0x019E,0x03FF,0x015F,
		0x07FF,0x01FD,0x12FF,0x01FC,0x01FB,0x07FF,0x01F7,0x01FF,
		0x01DF,0x02FF,0x017F,0x03FF,0x0300,0x0110,0x0300,0x0140,
		0x0300,0x018E,0x0400,0x0180,0x0101,0x0300,0x0180,0x0204,
		0x0120,0x0182,0x0100,0x0102,0x0600,0x01D5,0x0138,0x0192,
		0x0150,0xE600,0x01C3,0x019D,0x0131,0x0100,0x0116,0x0100,
		0x010A,0x0190,0x010E,0x014A,0x0200,0x010B,0x018D,0x0121,
		0x0100,0x0145,0x0100,0x0109,0x0184,0x012C,0x0200,0x0107,
		0x01AA,0x0149,0x60FF,0x3300,0x0000
	};
	init_common(machine, default_eeprom);
}
Example #25
0
static int decode_init(AVCodecContext *avctx) {
	MscDecoderContext * mscDecoderContext;
	MscCodecContext * mscContext;
	AVFrame * p;
	const int scale = 1;

	mscDecoderContext	= avctx->priv_data;
	mscContext			= &mscDecoderContext->mscContext;

	init_common(avctx, &mscDecoderContext->mscContext);

	ff_init_scantable(mscContext->dsp.idct_permutation, &mscContext->scantable, scantab);
	avctx->pix_fmt = PIX_FMT_YUV420P;

	if(avctx->extradata_size < 1 || (mscContext->inv_qscale= avctx->extradata[0]) == 0) {
		av_log(avctx, AV_LOG_ERROR, "illegal qscale 0\n");
		mscContext->inv_qscale = 8;
	}

	for(int i = 0; i < 64; i++){
		int index= scantab[i];

		mscContext->intra_matrix[i]= 64 * scale * quant_intra_matrix[index] / mscContext->inv_qscale;
		mscContext->non_intra_matrix[i]= 64 * scale * ff_mpeg1_default_non_intra_matrix[index] / mscContext->inv_qscale;
	}

	// allocate frame
	p = avctx->coded_frame = avcodec_alloc_frame();
	if (!avctx->coded_frame) {
		av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
		return AVERROR(ENOMEM);
	}

	p->qstride		= mscContext->mb_width;
	p->qscale_table	= av_malloc( p->qstride * mscContext->mb_height);
	p->quality		= (32 * scale + mscContext->inv_qscale / 2) / mscContext->inv_qscale;
	memset(p->qscale_table, p->quality, p->qstride * mscContext->mb_height);

	return 0;
}
Example #26
0
status_t
intel_clone_accelerant(void* info)
{
	CALLED();

	// create full device name
	char path[B_PATH_NAME_LENGTH];
	strcpy(path, "/dev/");
#ifdef __HAIKU__
	strlcat(path, (const char*)info, sizeof(path));
#else
	strcat(path, (const char*)info);
#endif

	int fd = open(path, B_READ_WRITE);
	if (fd < 0)
		return errno;

	status_t status = init_common(fd, true);
	if (status != B_OK)
		goto err1;

	// get read-only clone of supported display modes
	status = gInfo->mode_list_area = clone_area(
		"intel extreme cloned modes", (void**)&gInfo->mode_list,
		B_ANY_ADDRESS, B_READ_AREA, gInfo->shared_info->mode_list_area);
	if (status < B_OK)
		goto err2;

	return B_OK;

err2:
	uninit_common();
err1:
	close(fd);
	return status;
}
Example #27
0
int main(int argc, char *argv[])
{
	int retval;

	debug_set_exception_handler();

	log_add_output_maxlev(&main_stderr_log_out, LMT_ACTION);
	log_add_output_all_levs(&main_dstream_no_stderr_log_out);

	log_register_thread("main");

	Settings cmd_args;
	bool cmd_args_ok = get_cmdline_opts(argc, argv, &cmd_args);
	if (!cmd_args_ok
			|| cmd_args.getFlag("help")
			|| cmd_args.exists("nonopt1")) {
		print_help(allowed_options);
		return cmd_args_ok ? 0 : 1;
	}

	if (cmd_args.getFlag("version")) {
		print_version();
		return 0;
	}

	setup_log_params(cmd_args);

	porting::signal_handler_init();
	porting::initializePaths();

	if (!create_userdata_path()) {
		errorstream << "Cannot create user data directory" << std::endl;
		return 1;
	}

	// Initialize debug stacks
	debug_stacks_init();
	DSTACK(__FUNCTION_NAME);

	// Debug handler
	BEGIN_DEBUG_EXCEPTION_HANDLER

	// List gameids if requested
	if (cmd_args.exists("gameid") && cmd_args.get("gameid") == "list") {
		list_game_ids();
		return 0;
	}

	// List worlds if requested
	if (cmd_args.exists("world") && cmd_args.get("world") == "list") {
		list_worlds();
		return 0;
	}

	GameParams game_params;
	if (!init_common(&game_params.log_level, cmd_args, argc, argv))
		return 1;

#ifndef __ANDROID__
	// Run unit tests
	if (cmd_args.getFlag("run-unittests")) {
		run_tests();
		return 0;
	}
#endif

#ifdef SERVER
	game_params.is_dedicated_server = true;
#else
	game_params.is_dedicated_server = cmd_args.getFlag("server");
#endif

	if (!game_configure(&game_params, cmd_args))
		return 1;

	sanity_check(game_params.world_path != "");

	infostream << "Using commanded world path ["
	           << game_params.world_path << "]" << std::endl;

	//Run dedicated server if asked to or no other option
	g_settings->set("server_dedicated",
			game_params.is_dedicated_server ? "true" : "false");

	if (game_params.is_dedicated_server)
		return run_dedicated_server(game_params, cmd_args) ? 0 : 1;

#ifndef SERVER
	ClientLauncher launcher;
	retval = launcher.run(game_params, cmd_args) ? 0 : 1;
#else
	retval = 0;
#endif

	// Update configuration file
	if (g_settings_path != "")
		g_settings->updateConfigFile(g_settings_path.c_str());

	print_modified_quicktune_values();

	// Stop httpfetch thread (if started)
	httpfetch_cleanup();

	END_DEBUG_EXCEPTION_HANDLER(errorstream)

	return retval;
}
Example #28
0
int main(int argc, char *argv[])
{
	int retval = 0;

#if USE_ENET
	if (enet_initialize() != 0) {
		std::cerr << "enet failed to initialize\n";
		return EXIT_FAILURE;
	}
	atexit(enet_deinitialize);
#endif

	debug_set_exception_handler();

	g_logger.registerThread("Main");
	g_logger.addOutputMaxLevel(&stderr_output, LL_ACTION);

	Settings cmd_args;
	bool cmd_args_ok = get_cmdline_opts(argc, argv, &cmd_args);
	if (!cmd_args_ok
			|| cmd_args.getFlag("help")
			|| cmd_args.exists("nonopt1")) {
		print_help(allowed_options);
		return cmd_args_ok ? 0 : 1;
	}

	if (cmd_args.getFlag("version")) {
		print_version();
		return 0;
	}

	setup_log_params(cmd_args);

	porting::signal_handler_init();

#ifdef __ANDROID__
	porting::initAndroid();
	porting::initializePathsAndroid();
#else
	porting::initializePaths();
#endif

	if (!create_userdata_path()) {
		errorstream << "Cannot create user data directory "<< porting::path_user << std::endl;
		//return 1;
	}

	// Initialize debug stacks
	DSTACK(FUNCTION_NAME);

	// Debug handler
	BEGIN_DEBUG_EXCEPTION_HANDLER

	// List gameids if requested
	if (cmd_args.exists("gameid") && cmd_args.get("gameid") == "list") {
		list_game_ids();
		return 0;
	}

	// List worlds if requested
	if (cmd_args.exists("world") && cmd_args.get("world") == "list") {
		list_worlds();
		return 0;
	}

	if (!init_common(cmd_args, argc, argv))
		return 1;

	// parse settings from cmdline. must be after loading settings. maybe better to move
	for (int i = 1; i < argc; i++) {
		std::string arg_name = argv[i];
		if (arg_name.substr(0, 2) == "--" || arg_name[0] != '-')
			continue;
		std::string name = arg_name.substr(1);
		std::string value;
		auto vpos = name.find('=');
		if (vpos != std::string::npos && name.size() > vpos) {
			value = name.substr(vpos+1);
			name.resize(vpos);
		} else {
			value = "1";
		}
		g_settings->set(name, value);
		continue;
	}

#if !defined(__ANDROID__) && !defined(_MSC_VER)
	// Run unit tests
	if (cmd_args.getFlag("run-unittests")) {
		return run_tests();
	}
#endif

	GameParams game_params;
#ifdef SERVER
	game_params.is_dedicated_server = true;
#else
	game_params.is_dedicated_server = cmd_args.getFlag("server");
#endif

	if (!game_configure(&game_params, cmd_args))
		return 1;

	sanity_check(!game_params.world_path.empty());

	infostream << "Using commanded world path ["
	           << game_params.world_path << "]" << std::endl;

	//Run dedicated server if asked to or no other option
	g_settings->set("server_dedicated",
			game_params.is_dedicated_server ? "true" : "false");

	if (game_params.is_dedicated_server)
		return run_dedicated_server(game_params, cmd_args) ? 0 : 1;

#ifndef SERVER
	ClientLauncher launcher;
	retval = launcher.run(game_params, cmd_args) ? 0 : 1;
#else
	retval = 0;
#endif

	// Update configuration file
	if (g_settings_path != "")
		g_settings->updateConfigFile(g_settings_path.c_str());

	print_modified_quicktune_values();

	// Stop httpfetch thread (if started)
	httpfetch_cleanup();

	END_DEBUG_EXCEPTION_HANDLER

	return retval;
}
Example #29
0
static DRIVER_INIT( daikaiju ) {
    init_common();
}
Example #30
0
static DRIVER_INIT( storming ) {
    lsasquad_invertcoin = 0x0c;
    init_common();
}