Example #1
0
void retro_reset(void)
{
   init_cpu();
   init_roms();
   init_vpp();
   clearscr();
}
Example #2
0
/*============================================================================*/
void init_system()
{
	int i, j, k;
	#ifdef __O2EM_DEBUG__
	printf("%s()\n", __func__);
	#endif
	last_line = 0;
	dbstick1 = 0x00;
	dbstick2 = 0x00;
	mstate = 0;
	master_clk = 0;
	h_clk = 0;
	line_count = 0;
	itimer = 0;
	clk_counter = 0;

	init_roms();
	init_rams();

	for (i = 0; i < MAXLINES; i++)
		AudioVector[i] = ColorVector[i] = 0;

	for (i = 0; i < MAXLINES + 2 * MAXSNAP; i++)
		for (j = 0; j < 256; j++)
			for (k = 0; k < 2; k++)
				snapedlines[i][j][k]=0;

	if (app_data.stick[0] == 2 || app_data.stick[1] == 2) {
		#ifdef __O2EM_DEBUG__
		printf("%s() install_joystick()\n", __func__);
		#endif
		i = install_joystick(JOY_TYPE_AUTODETECT);
		if (i || (num_joysticks < 1)) {
			fprintf(stderr, "Error: no joystick detected\n");
			o2em_clean_quit(EXIT_FAILURE);
		}
	}
	for (i = 0; i < KEY_MAX; i++)
		key2[i] = 0;
	key2vcnt = 0;

	if (app_data.euro)
		setvideomode(1);
	else
		setvideomode(0);

	do_kluges();
	init_vpp();
	clear_collision();
	#ifdef __O2EM_DEBUG__
	printf("end of %s()\n", __func__);
	#endif
}
Example #3
0
void init_system(void){
	int i,j,k;

	last_line=0;
	dbstick1=0x00;
	dbstick2=0x00;
	mstate=0;
	master_clk=0;
	h_clk=0;
	line_count=0;
	itimer=0;
	clk_counter=0;
	init_roms();
	for(i=0; i<256; i++) {
		VDCwrite[i]=0;
		extRAM[i]=0;
	}
	for(i=0; i<64; i++) {
		intRAM[i]=0;
	}
	for (i=0; i<MAXLINES; i++) AudioVector[i] = ColorVector[i] = 0;
	
	for (i=0; i<MAXLINES+2*MAXSNAP; i++)
		for (j=0; j<256; j++)
			for (k=0; k<2; k++)
				snapedlines[i][j][k]=0;

	if (app_data.stick[0] == 2 || app_data.stick[1] == 2) {
		i = install_joystick(JOY_TYPE_AUTODETECT);
		if (i || (num_joysticks<1)) {
			fprintf(stderr,"Error: no joystick detected\n");
			exit(EXIT_FAILURE);
		}
	}
	for (i=0; i<128; i++) key2[i] = 0;
	key2vcnt=0;
	if (app_data.euro)
		setvideomode(1);
	else
		setvideomode(0);
	do_kluges();
	init_vpp();
	clear_collision();
}
Example #4
0
void handle_key(void){
	if (NeedsPoll) poll_keyboard();


	if (key[syskeys[0]] || key[KEY_ESC]) {
		do {
			rest(5);
			if (NeedsPoll) poll_keyboard();
		} while (key[syskeys[0]] || key[KEY_ESC]);
		key_done=1;
	}

if (key[syskeys[1]]) {
		do {
			rest(5);
			if (NeedsPoll) poll_keyboard();
		} while (key[syskeys[1]]);

		mute_audio();
		mute_voice();
		abaut();

		do {
			rest(5);
			if (NeedsPoll) poll_keyboard();

			if (key[KEY_ALT] && key[KEY_ENTER]) {
				app_data.fullscreen = app_data.fullscreen ? 0 : 1;
				grmode();
				abaut();
				do {
					rest(5);
					if (NeedsPoll) poll_keyboard();
				} while (key[KEY_ENTER]);
			}		

		} while ((!key[syskeys[1]]) && (!key[KEY_ESC]) && (!key[syskeys[0]]));
		do {
			rest(5);
			if (NeedsPoll) poll_keyboard();
		} while (key[syskeys[1]]);
		
		init_sound_stream();
	}		

if (key[syskeys[5]])
	{
		if (savestate(app_data.statefile)==0)
		{
			display_msg("Savefile saved.",5);
		}
		do {
			rest(5);
			if (NeedsPoll) poll_keyboard();
		} while (key[syskeys[5]]);

	}

	/* LOAD STATE */
	if (key[syskeys[6]])
	{
		int stateError;
		if ((stateError=loadstate(app_data.statefile))==0)
		{
			display_msg("Savefile loaded.",5);
		}
		else if (stateError>=199)
		{
			if (stateError==199) display_msg("Wrong ROM-File for Savefile.",5);
			else if (stateError==200+ROM_O2) display_msg("Wrong BIOS for Savefile: O2ROM needed.",5);
			else if (stateError==200+ROM_G7400) display_msg("Wrong BIOS for Savefile: G7400 ROM needed.",5);
			else if (stateError==200+ROM_C52) display_msg("Wrong BIOS for Savefile: C52 ROM needed.",5);
			else if (stateError==200+ROM_JOPAC) display_msg("Wrong BIOS for Savefile: JOPAC ROM needed.",5);
			else display_msg("Wrong BIOS for Savefile: UNKNOWN ROM needed.",5);
		}
		do {
			rest(5);
			if (NeedsPoll) poll_keyboard();
		} while (key[syskeys[6]]);
	}

	if (key[syskeys[2]]) key_debug=1;

	if (key[syskeys[3]]) {
		init_cpu();
		init_roms();
		init_vpp();
		clearscr();
		do {
			rest(5);
			if (NeedsPoll) poll_keyboard();
		} while (key[syskeys[3]]);
	}

    /* SET HIGHSCORE */
	if (key[syskeys[7]])
	{
		set_score(app_data.scoretype, app_data.scoreaddress, app_data.default_highscore);
	}


	if (key[syskeys[4]]) {
		BITMAP *bmp;
		PALETTE pal;
		char *p;
		static char name[1024];
		static int scshot_counter = 0;

		if (strlen(app_data.scshot)>0){
			if ((p=strchr(app_data.scshot,'@'))) {
				*p = 0;
				sprintf(name, "%s%02d%s", app_data.scshot, scshot_counter++, p+1);
				*p = '@';
			} else {
				strcpy(name, app_data.scshot);
			}
			get_palette(pal);
			bmp = create_sub_bitmap(screen, 0, 0, SCREEN_W, SCREEN_H);
			save_bitmap(name, bmp, pal);
			destroy_bitmap(bmp);
			do {
				rest(5);
				if (NeedsPoll) poll_keyboard();
			} while (key[syskeys[4]]);
		}
	}

	// switch joystick
	if (key[syskeys[8]]) {
		joyswitch = joyswitch ? 0 : 1;

		set_defjoykeys(0,joyswitch);
		set_defjoykeys(1,joyswitch ? 0 : 1);
		int tmp = app_data.stick[0];
		app_data.stick[0] = app_data.stick[1];
		app_data.stick[1] = tmp;

		do {
			rest(5);
			if (NeedsPoll) poll_keyboard();
		} while (key[syskeys[8]]);

	}

	if (key[KEY_ALT] && key[KEY_ENTER]) {
		app_data.fullscreen = app_data.fullscreen ? 0 : 1;
		grmode();
		do {
			rest(5);
			if (NeedsPoll) poll_keyboard();
		} while (key[KEY_ENTER]);
	}		

}