Пример #1
0
static int osint_defaults (void)
{
	unsigned b;
	//FILE *rom_file;

	screen_x = DEFAULT_WIDTH;
	screen_y = DEFAULT_HEIGHT;

	osint_updatescale ();

	/* load up the rom */
/*
	rom_file = fopen (romname, "rb");

	if (rom_file == NULL) {
		sprintf (gbuffer, "cannot open '%s'", romname);
		MessageBox (NULL, gbuffer, NULL, MB_OK);
		return 1;
	}

	b = fread (rom, 1, sizeof (rom), rom_file);

	if (b < sizeof (rom)) {
		sprintf (gbuffer, "read %d bytes from '%s'. need %d bytes.",
			b, romname, sizeof (rom));
		MessageBox (NULL, gbuffer, NULL, MB_OK);
		return 1;
	}

	fclose (rom_file);
*/
	// JH - built-in bios
	memcpy(rom, bios_data, bios_data_size);

	/* the cart is empty by default */
	for (b = 0; b < sizeof (cart); b++) {
		cart[b] = 0;
	}

	return 0;
}
Пример #2
0
Файл: gui.c Проект: nop90/Vex3DS
void gui_ConfigMenuRun()
{
	gui_MainMenuRun(&gui_ConfigMenu);
	osint_updatescale();
	osint_gencolors();
}
Пример #3
0
// Set emulator options from command line arguments
static void osint_parse_cmdline (int argc, char *argv[])
{
	// Most of this code from Thomas Mathys' vecxsdl
	int index;
	char *arg;
	int have_xres = 0;
	int have_yres = 0;

	// scan for -h first
	index = 0;
	while (arg = getnextarg(&index, argc, argv)) {
		if ( 0 == strcmp(arg, "-h") ) {
			osint_print_usage(stderr);
			exit(0);
		}
	}

	// parse other arguments
	index = 1;
	while (arg = getnextarg(&index, argc, argv)) {

		// -b
		if ( 0 == strcmp(arg, "-b") ) {
			arg = getnextarg(&index, argc, argv);
			if (!arg) {
				osint_print_usage(stderr);
				fprintf(stderr, "\nError : No filename given for -b.\n");
				exit(1);
			} else {
				//args->biosname = arg;
				osint_load_bios(arg);
			}
		}
		// -l
		else if ( 0 == strcmp(arg, "-l") ) {
			arg = getnextarg(&index, argc, argv);
			if (!arg) {
				osint_print_usage(stderr);
				fprintf(stderr, "\nError : No line width given for -l.\n");
				exit(1);
			} else {
				line_width = (float) atof(arg);
				if (line_width < 0) {
					osint_print_usage(stderr);
					fprintf(stderr, "\nError : Line width must be positive.\n");
					exit(1);
				}
			}
		}
		// -o
		else if ( 0 == strcmp(arg, "-o") ) {
			arg = getnextarg(&index, argc, argv);
			if (!arg) {
				osint_print_usage(stderr);
				fprintf(stderr, "\nError : no filename given for -o.\n");
				exit(1);
			} else {
				overlayname = arg;
			}
		}
		// -t
		else if( 0 == strcmp(arg, "-t") ) {
			arg = getnextarg(&index, argc, argv);
			if (!arg) {
				osint_print_usage(stderr);
				fprintf(stderr, "\nError : no transparency given for -t.\n");
				exit(1);
			} else {
				float v = (float) atof(arg);
				if ( (v < 0) || (v > 1) ) {
					osint_print_usage(stderr);
					fprintf(stderr, "\nError : overlay transparency must be in the range [0.0,1.0].\n");
					exit(1);
				} else {
					overlay_transparency = v;
				}
			}
		}
/*		// -v
		else if ( 0 == strcmp(arg, "-v") ) {
			arg = getnextarg(&index, argc, argv);
			if (!arg) {
				printusage(stderr);
				fprintf(stderr, "\nError : no color given for -v.\n");
				quit(1);
			} else {
				unsigned long v;
				char *c;
				v = strtoul(arg, &c, 16);
				if ( (strlen(arg) != 6) || (*c != 0) ) {
					printusage(stderr);
					fprintf(stderr, "\nError : invalid format for vector color.\n");
					quit(1);
				} else {
					args->vectorcolor[0] = (unsigned char) ((v >> 16) & 255);
					args->vectorcolor[1] = (unsigned char) ((v >> 8) & 255);
					args->vectorcolor[2] = (unsigned char) (v & 255);
				}
			}
		}
*/		// -x
		else if ( 0 == strcmp(arg, "-x") ) {
			arg = getnextarg(&index, argc, argv);
			if (!arg) {
				osint_print_usage(stderr);
				fprintf(stderr, "\nError : no window width given for -x.\n");
				exit(1);
			} else {
				screen_x = atoi(arg);
				have_xres = 1;
				if (screen_x < 0) {
					osint_print_usage(stderr);
					fprintf(stderr, "\nError : window width must be positive.\n");
					exit(1);
				}
			}
		}
		// -y
		else if ( 0 == strcmp(arg, "-y") ) {
			arg = getnextarg(&index, argc, argv);
			if (!arg) {
				osint_print_usage(stderr);
				fprintf(stderr, "\nError : no window height given for -y.\n");
				exit(1);
			} else {
				screen_y = atoi(arg);
				have_yres = 1;
				if (screen_y < 0) {
					osint_print_usage(stderr);
					fprintf(stderr, "\nError : window height must be positive.\n");
					exit(1);
				}
			}
		}
		else {
			cartname = arg;
		}
	}

	// if only x or only y given, calculate the other,
	// so that the window gets a sane aspect ratio.
	if ( (have_xres) && (!have_yres) ) {
		screen_y = screen_x*DEFAULT_HEIGHT/DEFAULT_WIDTH;
	}
	else if ( (!have_xres) && (have_yres) ) {
		screen_x = screen_y*DEFAULT_WIDTH/DEFAULT_HEIGHT;
	}
	// screen width or height may have changed, so need to update scale
	osint_updatescale();
}