Esempio n. 1
0
void replayview_menu_input(MenuData *m) {
	if(m->context)
		menu_input((MenuData*)m->context);
	else
		menu_input(m);
	
	if(m->selected >= 0)
		m->instantselect = m->selected != m->ecount-1 && (((Replay*)m->entries[m->selected].arg)->stgcount > 1);
}
Esempio n. 2
0
void _event(state_stack *stack, SDL_Event *evt) {
	state_desc *top = (state_desc*) table_ind(stack, stack->m_len-1);
	_talk_state *st = (_talk_state*) top->m_pData;
	
	input_event mapped;
	int i, err;
	
	switch (st->m_iState) {
	case _STARTED:
		err = lua_resume(st->m_pThread, nullptr, 0);
		if (_util_lua_done(err, top)) { return; }
		_event(stack, evt);
		break;
	
	case _WAIT_CHOICE:
		i = menu_input(st->m_pChoices, evt);
		if (i == -1) { return; }
		lua_pushnumber(st->m_pThread, i + 1);
		err = lua_resume(st->m_pThread, nullptr, 1);
		if (_util_lua_done(err, top)) { return; }
		break;
	
	case _WAIT_ANY:
		input_get_event(evt, &mapped);
		if (mapped.m_iType == IN_OFF || evt->type == SDL_MOUSEBUTTONUP) {
			err = lua_resume(st->m_pThread, nullptr, 0);			
			if (_util_lua_done(err, top)) { return; }
		}
		break;
	
	case _STOPPED:
		top->m_isDead = true;
		break;
	}
}
Esempio n. 3
0
void _event(state_stack* stack, SDL_Event *sdlEvent) {
	state_desc *top = (state_desc*) table_ind(stack, stack->m_len-1);
	_settings_menu *data = (_settings_menu*) top->m_pData;
	menu *pMenu = (menu*) data->m_menu;
	settings *pSettings = (settings*) data->m_settings;
	
	if (sdlEvent->type == SDL_QUIT) {
		state_stack_kill(stack);
		return;
	}
	
	switch (menu_input(pMenu, sdlEvent)) {
	case 0:
		// Controls
		top->m_fnPushChild = &_controls_push;
		break;
	case 1:
		// (empty)
		break;
	case 2:
		// < Save Settings
		settings_save(pSettings, settings_file_path);
		top->m_isDead = true;
		break;
	case 3:
		// < Discard Settings
		settings_load(pSettings, settings_file_path);
		top->m_isDead = true;
		break;
	default:
		break;
	}
}
Esempio n. 4
0
static void _event_controls(state_stack* stack, SDL_Event *sdlEvent) {
	state_desc *top = (state_desc*) table_ind(stack, stack->m_len-1);
	_controls_menu *data = (_controls_menu*) top->m_pData;
	
	if (sdlEvent->type == SDL_QUIT) {
		state_stack_kill(stack);
		return;
	}
	
	if (data->m_capturingBindings) {
		_bind(data, sdlEvent);
		_update_bind_desc(data);
		
		if (data->m_iWhichBinding > 4) {
			data->m_iWhichBinding = -1;
			data->m_cmdMenu->m_iCursorPos = 0;
			data->m_capturingBindings = false;
			if (! data->m_bindingsConflict) { _apply_bindings(data); }
		}
		return;
	}
	
	switch (menu_input(data->m_cmdMenu, sdlEvent)) {
	case 0:
		// Set Controls
		data->m_iWhichBinding = 0;
		data->m_capturingBindings = true;
		break;
	case 1:
		// Restore Defaults
		data->m_aControls[0] = _event_create_input_control(IN_TYPE_KEYBOARD, 0, 0, SDLK_UP,     IN_DIRUP);
		data->m_aControls[1] = _event_create_input_control(IN_TYPE_KEYBOARD, 0, 0, SDLK_DOWN,   IN_DIRDOWN);
		data->m_aControls[2] = _event_create_input_control(IN_TYPE_KEYBOARD, 0, 0, SDLK_LEFT,   IN_DIRLEFT);
		data->m_aControls[3] = _event_create_input_control(IN_TYPE_KEYBOARD, 0, 0, SDLK_RIGHT,  IN_DIRRIGHT);
		data->m_aControls[4] = _event_create_input_control(IN_TYPE_KEYBOARD, 0, 0, SDLK_RETURN, IN_OK);
		_update_bind_desc(data);
		_apply_bindings(data);
		break;
	case 2:
		// < Back
		if (data->m_bindingsConflict) { break; }
		_apply_bindings(data);
		top->m_isDead = true;
		break;
	default:
		break;
	}
}
Esempio n. 5
0
main()
{
	MYDATA data = {"",""};
	LPMYDATA lp = &data;
	while(1) {
		switch(menu_input()) {
			case 1:
				meibo_input(lp);
				break;
			case 2:
				meibo_output(lp);
				break;
			default:
				printf("bye\n");
				return;
		}
	}
}
Esempio n. 6
0
main()
{
	MYDATA data[10];
	memset(data,'\0', sizeof(MYDATA[10]));
	LPMYDATA lp = &data[0];
	while(1) {
		switch(menu_input()) {
			case 1:
				meibo_input(lp);
				break;
			case 2:
				meibo_output(lp);
				break;
			default:
				printf("bye\n");
				return;
		}
	}
}
Esempio n. 7
0
void mouse_event_handle(AGI_EVENT *event)
{
	POS pos;
	int id;
	
	switch (c_game_mouse)
	{
		case M_BRIAN:
			mstack_push(event->data, event->x, event->y);
			break;
		
		case M_SIERRA_V2:
			if ( (picbuff_prev != state.window_row_min) ||
				(status_prev != state.status_line_row) )
				mouse_init();
			pos.x = event->x;
			pos.y = event->y;
			id = mouse_area_check(&pos);
			//printf("Mouse Button! x=%d y=%d\n", pos.x, pos.y);
			pos.x = pos.x / c_vid_scale / rend_drv->scale_x;
			pos.y = pos.y / c_vid_scale / rend_drv->scale_y;
			switch (id)
			{
				case 0:	// status bar
					menu_input();
					break;
				case 1:	// picture buffer
					ego_move(pos.x, pos.y);
					break;
				case 2:	// lower area
					ego_move(pos.x, 169);	// 1 pixel past
					break;
			}
			break;
		
		case M_SIERRA_V3:
		case M_NICK:
		default:
			break;
	}
	
}
Esempio n. 8
0
void ex_input(Keyarg *ca)
{
  log_msg("EXCMD", "input");
  if (menu_hints_enabled(ex.menu)) {
    if (menu_input(ex.menu, ca->key))
      ex_car();
  }

  int idx = find_command(&key_tbl, ca->key);
  ca->arg = key_defaults[idx].cmd_arg;

  if (idx >= 0)
    key_defaults[idx].cmd_func(NULL, ca);
  else
    ex_getchar(ca);

  if (ex.state & EX_QUIT)
    stop_ex_cmd();
  else
    ex_onkey();
}
Esempio n. 9
0
File: view.c Progetto: prophile/dim3
void view_loop_input(int tick)
{
		// timing
		
	if (tick<view.time.input_tick) return;
	view.time.input_tick=tick+input_tick_rate;
	
		// pump input
		
	input_event_pump();

		// player input
	
	player_get_input(tick);
	
		// system input
	
	console_input();
	menu_input();
	file_input();
	debug_input();
}
Esempio n. 10
0
void Ingame_Menu(void)
{
    char *temp;
    int i,selection = 0;
    oldselect = -1;
    char stateoption[16];
    strcpy(stateoption,"State number: ");

    int option_changed = 0;

    int menu_x1 = gsGlobal->Width*0.25;
    int menu_y1 = gsGlobal->Height*0.15;
    int menu_x2 = gsGlobal->Width*0.75;
    int menu_y2 = gsGlobal->Height*0.85+FONT_HEIGHT;

    int text_line = menu_y1 + 4;

    char options[14][23] = {
        { "State number: " },
        { "Save State" },
        { "Load State" },
        { "Filtering: "},
        { "LowPass: "******"Configure Input" },
        { "Rapidfire Switch: "},
        { "RapidFire P1: " },
        { "RapidFire P2: " },
        { "Reset Game" },
        { "Exit Game" },
        { "Exit Menu" },
        { "Palette:" },
        { "" }
    };

    for(i=0;i<14;i++) {
        switch(i) {
            case 0:
                sprintf(options[i],"%s%d",options[i],statenum);
                break;
            case 3:
                if(!Settings.filter)
                    sprintf(options[i],"%s%s",options[i],"Off");
                else
                    sprintf(options[i],"%s%s",options[i],"On");
                break;
            case 4:
                if(!Settings.lowpass)
                    sprintf(options[i],"%s%s",options[i],"Off");
                else
                    sprintf(options[i],"%s%s",options[i],"On");
                break;
            case 6:
                if(!Settings.turbo) {
                    sprintf(options[i],"%s%s",options[i],"Off");
                }
                else {
                    sprintf(options[i],"%s%s",options[i],"On");
                }
                break;
            case 7:
                switch(aorborab[0]) {
                    case 0:
                        sprintf(options[i],"%s%s",options[i],"Off");
                        break;
                    case 1:
                        sprintf(options[i],"%s%s",options[i],"A");
                        break;
                    case 2:
                        sprintf(options[i],"%s%s",options[i],"B");
                        break;
                    case 3:
                        sprintf(options[i],"%s%s",options[i],"AB");
                        break;
                }
                break;
            case 8:
                switch(aorborab[1]) {
                    case 0:
                        sprintf(options[i],"%s%s",options[i],"Off");
                        break;
                    case 1:
                        sprintf(options[i],"%s%s",options[i],"A");
                        break;
                    case 2:
                        sprintf(options[i],"%s%s",options[i],"B");
                        break;
                    case 3:
                        sprintf(options[i],"%s%s",options[i],"AB");
                        break;
                }
				break;
            case 13:
				sprintf(options[i],"%s%s",options[i],palette_names[Settings.current_palette - 1].name);
                break;
        }
    }

#ifdef SOUND_ON
    audsrv_stop_audio();
#endif
    gsKit_mode_switch(gsGlobal, GS_ONESHOT);
    gsGlobal->DrawOrder = GS_PER_OS;

    while(1) {
        selected = 0; //clear selected flag
        selection += menu_input(0,0);

		if(selection == 12 && oldselect == 11) { selection++; } //12 is palette
        if(selection == 12 && oldselect == 13) { selection--; }
        if(selection > 13) { selection = 0; }
        if(selection < 0) { selection = 13; }

        if(oldselect != selection || option_changed) {
            i = 0x10000;
            while(i--) asm("nop\nnop\nnop\nnop");
            gsKit_queue_reset(gsGlobal->Os_Queue);

            option_changed = 0;

            menu_primitive("Options", &MENU_TEX, menu_x1, menu_y1, menu_x2, menu_y2);

            for(i=0;i<14;i++) {
                if(selection == i) {
                    //font_print(gsGlobal, menu_x1+10.0f, text_line + i*FONT_HEIGHT, 2, DarkYellowFont, options[i]);
                    printXY(options[i],menu_x1+10,text_line + i*FONT_HEIGHT, 4, FCEUSkin.highlight, 1, 0);
                }
                else {
                    //font_print(gsGlobal, menu_x1+10.0f, text_line + i*FONT_HEIGHT, 2, WhiteFont, options[i]);
                    printXY(options[i],menu_x1+10,text_line + i*FONT_HEIGHT, 4, FCEUSkin.textcolor, 1, 0);
                }
            }

            DrawScreen(gsGlobal);
        }

        oldselect = selection;

        if(selected) {
            if(selected == 2) { //menu combo pressed again
                selection = 11;
            }
            i = selection;
            switch(i) {
                case 0: //State Number
                    statenum++;
                    if(statenum > 9) {statenum = 0;}
                    sprintf(options[i],"%s%d",stateoption,statenum);
                    FCEUI_SelectState(statenum);
                    option_changed = 1;
                    break;
                case 1:
                    FCEUI_SaveState(NULL);
                    SetupNESGS();
                    return;
                case 2:
                    FCEUI_LoadState(NULL);
                    SetupNESGS();
                    return;
                case 3:
                    Settings.filter ^= 1;
                    if(Settings.filter) {
                        temp = strstr(options[i],"Off");
                        *temp = 0;
                        strcat(options[i],"On");
                    }
                    else {
                        temp = strstr(options[i],"On");
                        *temp = 0;
                        strcat(options[i],"Off");
                    }
                    option_changed = 1;
                    break;
                case 4:
                    Settings.lowpass ^= 1;
                    if(Settings.lowpass) {
                        FCEUI_SetLowPass(Settings.lowpass);
                        temp = strstr(options[i],"Off");
                        *temp = 0;
                        strcat(options[i],"On");
                    }
                    else {
                        FCEUI_SetLowPass(Settings.lowpass);
                        temp = strstr(options[i],"On");
                        *temp = 0;
                        strcat(options[i],"Off");
                    }
                    option_changed = 1;
                    break;
                case 6:
                    Settings.turbo ^= 1;
                    if(Settings.turbo) {
                        temp = strstr(options[i],"Off");
                        *temp = 0;
                        strcat(options[i],"On");
                    }
                    else {
                        temp = strstr(options[i],"On");
                        *temp = 0;
                        strcat(options[i],"Off");
                    }
                    option_changed = 1;
                    break;
                case 7:
                    aorborab[0]++;
                    if(aorborab[0] > 3)
                        aorborab[0] = 0;
                    switch(aorborab[0]) {
                        case 0: //Off
                            rapidfire_a[0] = 0;
                            rapidfire_b[0] = 0;
                            temp = strstr(options[i],"AB");
                            *temp = 0;
                            strcat(options[i],"Off");
                            break;
                        case 1: //A
                            rapidfire_a[0] = 1;
                            rapidfire_b[0] = 0;
                            temp = strstr(options[i],"Off");
                            *temp = 0;
                            strcat(options[i],"A");
                            break;
                        case 2: //B
                            rapidfire_a[0] = 0;
                            rapidfire_b[0] = 1;
                            temp = strstr(options[i]," A");
                            *temp = 0;
                            strcat(options[i]," B");
                            break;
                        case 3: //AB
                            rapidfire_a[0] = 1;
                            rapidfire_b[0] = 1;
                            temp = strstr(options[i]," B");
                            *temp = 0;
                            strcat(options[i]," AB");
                            break;
                    }
                    option_changed = 1;
                    break;
                case 8:
                    aorborab[1]++;
                    if(aorborab[1] > 3)
                        aorborab[1] = 0;
                    switch(aorborab[1]) {
                        case 0: //Off
                            rapidfire_a[1] = 0;
                            rapidfire_b[1] = 0;
                            temp = strstr(options[i],"AB");
                            *temp = 0;
                            strcat(options[i],"Off");
                            break;
                        case 1: //A
                            rapidfire_a[1] = 1;
                            rapidfire_b[1] = 0;
                            temp = strstr(options[i],"Off");
                            *temp = 0;
                            strcat(options[i],"A");
                            break;
                        case 2: //B
                            rapidfire_a[1] = 0;
                            rapidfire_b[1] = 1;
                            temp = strstr(options[i]," A");
                            *temp = 0;
                            strcat(options[i]," B");
                            break;
                        case 3: //AB
                            rapidfire_a[1] = 1;
                            rapidfire_b[1] = 1;
                            temp = strstr(options[i]," B");
                            *temp = 0;
                            strcat(options[i]," AB");
                            break;
                    }
                    option_changed = 1;
                    break;
                case 9:
                    FCEUI_ResetNES();
                    SetupNESGS();
                    return;
                case 10:
                    fdsswap = 0;
                    statenum = 0;
                    exitgame = 1;
                    selected = 0;
                    return;
                case 11:
                    SetupNESGS();
                    return;
                case 13:
                    Settings.current_palette++;
                    if(Settings.current_palette > MAXPAL) {Settings.current_palette = 1;}
					sprintf(options[i],"%s",palette_names[Settings.current_palette - 1].name);
					SetupNESTexture();
					option_changed = 1;
                    break;
            }
        }
    }
}
Esempio n. 11
0
/** Browser Menu
        Display:         PAL/NTSC
        Emulated System: PAL/NTSC
        Center Screen
        Configure Save Path: (browse to path)
        Configure Elf Path: (browse to path)
        Exit to Elf Path
        Exit to PS2Browser
**/
int Browser_Menu(void)
{
    char *temp;
    char cnfpath[2048];
    int i,selection = 0;
    oldselect = -1;
    int option_changed = 0;

    int menu_x1 = gsGlobal->Width*0.25;
    int menu_y1 = gsGlobal->Height*0.15;
    int menu_x2 = gsGlobal->Width*0.75;
    int menu_y2 = gsGlobal->Height*0.85+FONT_HEIGHT;
    int text_line = menu_y1 + 4;

    char options[12][39] = {
        { "Display: " },
        { "Interlacing: " },
        { "Emulated System: " },
        { "Center Screen" },
        { "Configure Save Path: " },
        { "" },
        { "Configure ELF Path:  " },
        { "" },
        { "Save FCEUltra.cnf"},
        { "Power Off" },
        { "Exit to ELF" },
        { "Exit Options Menu" }
    };

    //fill lines with values
    for(i=0;i<12;i++) {
        switch(i) {
            case 0:
                if(!Settings.display) {
                    sprintf(options[i],"%s%s",options[i],"NTSC");
                }
                else {
                    sprintf(options[i],"%s%s",options[i],"PAL");
                }
                break;
            case 1:
                if(Settings.interlace) {
                    sprintf(options[i],"%s%s",options[i],"On");
                }
                else {
                    sprintf(options[i],"%s%s",options[i],"Off");
                }
                break;
            case 2:
                if(!Settings.emulation) {
                    sprintf(options[i],"%s%s",options[i],"NTSC");
                }
                else {
                    sprintf(options[i],"%s%s",options[i],"PAL");
                }
                break;
            case 5:
                strzncpy(options[5],Settings.savepath,38);
                break;
            case 7:
                strzncpy(options[7],Settings.elfpath,38);
                break;
        }
    }



    while(1) {
        selected = 0; //clear selected flag
        selection += menu_input(0,0);

        if(selection > 11) { selection = 0; }
        if(selection < 0) { selection = 11; }
        if(selection == 5 && oldselect == 4) { selection++; } //5 is savepath
        if(selection == 5 && oldselect == 6) { selection--; }
        if(selection == 7 && oldselect == 6) { selection++; } //7 is elfpath
        if(selection == 7 && oldselect == 8) { selection--; }


        if((oldselect != selection) || option_changed) {

            gsKit_clear(gsGlobal,GS_SETREG_RGBAQ(0x00,0x00,0x00,0x80,0x00));

            menu_primitive("Options", &MENU_TEX, menu_x1, menu_y1, menu_x2, menu_y2);

            for(i=0;i<12;i++) {
                if(selection == i) {
                    //font_print(gsGlobal, menu_x1+10.0f, text_line + i*FONT_HEIGHT, 2, DarkYellowFont, options[i]);
                    printXY(options[i],menu_x1+10,text_line+i*FONT_HEIGHT, 4, FCEUSkin.highlight, 1, 0);
                }
                else {
                    //font_print(gsGlobal, menu_x1+10.0f, text_line + i*FONT_HEIGHT, 2, WhiteFont, options[i]);
                    printXY(options[i],menu_x1+10,text_line + i*FONT_HEIGHT, 4, FCEUSkin.textcolor, 1, 0);
                }
            }

            DrawScreen(gsGlobal);

            if(power_off)
                option_changed = 1;
                power_off--;
                if(!power_off) {
                    strcpy(cnfpath,"xyz:/imaginary/hypothetical/doesn't.exist");
                    FILE *File;
                    File = fopen(cnfpath,"r");
                    if(File != NULL)
                        fclose(File);
                }
        }

        oldselect = selection;
        option_changed = 0;

        if(selected) {
            if(selected == 2) {
                selection = 11;
            }
            i = selection;
            switch(i) {
                case 0: //Display PAL/NTSC
                    Settings.display ^= 1;
                    if(Settings.display) {
                        gsGlobal->Mode = GS_MODE_PAL;
                        gsGlobal->Height = 512;
                        defaulty = 72;
                        temp = strstr(options[i],"NTSC");
                        *temp = 0;
                        strcat(options[i],"PAL");
                    }
                    else {
                        gsGlobal->Mode = GS_MODE_NTSC;
                        gsGlobal->Height = 448;
                        defaulty = 50;
                        temp = strstr(options[i],"PAL");
                        *temp = 0;
                        strcat(options[i],"NTSC");
                    }
					gsGlobal->Width = 640;
					gsGlobal->Field = GS_FIELD;
					if (gsGlobal->Interlace == GS_NONINTERLACED) {
						gsGlobal->Height = gsGlobal->Height/2;
						gsGlobal->StartY = gsGlobal->StartY/2 -1 ;
					}

                    gsGlobal->StartY = gsGlobal->StartY + Settings.offset_y;
                    //if(Settings.interlace && (gsGlobal->Mode == GS_MODE_NTSC))
                        //gsGlobal->StartY = gsGlobal->StartY + 22;
                    //else
                        //gsGlobal->StartY = gsGlobal->StartY + 11;
                    //normalize_screen();
					gsKit_init_screen(gsGlobal);	/* Apply settings. */
					gsKit_mode_switch(gsGlobal, GS_ONESHOT);

                    menu_x1 = gsGlobal->Width*0.25;
                    menu_y1 = gsGlobal->Height*0.15;
                    menu_x2 = gsGlobal->Width*0.75;
                    menu_y2 = gsGlobal->Height*0.85+FONT_HEIGHT;
					text_line = menu_y1 + 4;
					    
                    option_changed = 1;
                    //SetGsCrt(gsGlobal->Interlace,gsGlobal->Mode,gsGlobal->Field);
                    break;
                case 1: //Interlacing Off/On
                    Settings.interlace ^= 1;
                    if (gsGlobal->Mode == GS_MODE_PAL)
						gsGlobal->Height = 512;
					else
						gsGlobal->Height = 448;
                    if(Settings.interlace) {
                        gsGlobal->Interlace = GS_INTERLACED;
                        //gsGlobal->StartY = (gsGlobal->StartY-1)*2;
                        temp = strstr(options[i],"Off");
                        *temp = 0;
                        strcat(options[i],"On");
                    }
                    else {
                        gsGlobal->Interlace = GS_NONINTERLACED;
                        gsGlobal->StartY = gsGlobal->StartY/2 + 1;
						gsGlobal->Height = gsGlobal->Height/2;
                        temp = strstr(options[i],"On");
                        *temp = 0;
                        strcat(options[i],"Off");
                    }
					gsGlobal->Width = 640;
					gsGlobal->Field = GS_FIELD;
                    //normalize_screen();
					gsKit_init_screen(gsGlobal);	/* Apply settings. */
					gsKit_mode_switch(gsGlobal, GS_ONESHOT);
					
                    menu_x1 = gsGlobal->Width*0.25;
                    menu_y1 = gsGlobal->Height*0.15;
                    menu_x2 = gsGlobal->Width*0.75;
                    menu_y2 = gsGlobal->Height*0.85+FONT_HEIGHT;
					text_line = menu_y1 + 4;
                    option_changed = 1;
                    //SetGsCrt(gsGlobal->Interlace,gsGlobal->Mode,gsGlobal->Field);
                    break;
                case 2: //Emulated System
                    Settings.emulation ^= 1;
                    if(Settings.emulation) {
                        temp = strstr(options[i],"NTSC");
                        *temp = 0;
                        strcat(options[i],"PAL");
                    }
                    else {
                        temp = strstr(options[i],"PAL");
                        *temp = 0;
                        strcat(options[i],"NTSC");
                    }
                    FCEUI_SetVidSystem(Settings.emulation);
                    option_changed = 1;
                    break;
                case 3: //Center Screen
                    while(menu_input(0,2) != 2) {}
                    i = 0x10000;
                    while(i--) asm("nop\nnop\nnop\nnop");
                    option_changed = 1;
                    break;
                case 4: //Configure Save Path
                    h = 0; //reset browser
                    selection = 0;
                    oldselect = -1;
                    selected = 0;
                    strcpy(path,"path"); //end reset browser
                    strcpy(Settings.savepath,Browser(0,1));
                    printf("%s",Settings.savepath);
                    strzncpy(options[5],Settings.savepath,38);
                    selected_dir = 0;
                    h = 0;
                    selection = 0;
                    oldselect = -1;
                    strcpy(path,"path");
                    option_changed = 1;
                    selected = 0;
                    break;
                case 6: //Configure ELF Path
                    h = 0;
                    selection = 0;
                    oldselect = -1;
                    selected = 0;
                    strcpy(path,"path");
                    strcpy(Settings.elfpath,Browser(1,2));
                    strzncpy(options[7],Settings.elfpath,38);
                    h = 0;
                    selection = 0;
                    oldselect = -1;
                    strcpy(path,"path");
                    option_changed = 1;
                    selected = 0;
                    break;
                case 8: //Save CNF
                    fioMkdir("mc0:FCEUMM");
                    Save_Global_CNF("mc0:/FCEUMM/FCEUltra.cnf");
                    break;
                case 9: //Power Off
                    poweroffShutdown();
                    if(Settings.display)
                        power_off = 50/4;
                    else
                        power_off = 60/4;
                    option_changed = 1;
                    break;
                case 10: //Exit to ELF
                    return 2;
                case 11: //Exit Options Menu
                    selected = 0;
                    return 1;

            }
        }
    }
}
Esempio n. 12
0
bool menu_iterate(retro_input_t input,
      retro_input_t old_input, retro_input_t trigger_input)
{
   unsigned action = MENU_ACTION_NOOP;
   static bool initial_held = true;
   static bool first_held = false;
   uint64_t input_state = 0;
   int32_t ret = 0;

   if (!driver.menu)
      return false;

#ifdef HAVE_OVERLAY
   if (BIND_PRESSED(trigger_input, RARCH_OVERLAY_NEXT))
         input_overlay_next(driver.overlay);
#endif
   check_fullscreen_func(trigger_input);

   driver.retro_ctx.poll_cb();

   input_state = menu_input();

   if (driver.menu->do_held)
   {
      if (!first_held)
      {
         first_held = true;
         driver.menu->delay_timer = initial_held ? 12 : 6;
         driver.menu->delay_count = 0;
      }

      if (driver.menu->delay_count >= driver.menu->delay_timer)
      {
         first_held = false;
         driver.menu->trigger_state = input_state;
         driver.menu->scroll_accel = min(driver.menu->scroll_accel + 1, 64);
      }

      initial_held = false;
   }
   else
   {
      first_held = false;
      initial_held = true;
      driver.menu->scroll_accel = 0;
   }

   driver.menu->delay_count++;
   driver.menu->old_input_state = input_state;

   if (driver.block_input)
      driver.menu->trigger_state = 0;

   /* don't run anything first frame, only capture held inputs
    * for old_input_state.
    */
   action = input_frame(driver.menu->trigger_state);

   if (driver.menu_ctx && driver.menu_ctx->backend
         && driver.menu_ctx->backend->iterate) 
      ret = driver.menu_ctx->backend->iterate(action);

   draw_frame(true);
   throttle_frame();
   draw_frame(false);

   if (driver.menu_ctx && driver.menu_ctx->input_postprocess)
      driver.menu_ctx->input_postprocess(driver.menu->old_input_state);

#if 0
   /* Go back to Main Menu when exiting */
   if (ret < 0)
      menu_flush_stack_type(driver.menu->menu_stack, MENU_SETTINGS);
#endif

   if (ret)
      return false;

   return true;
}
Esempio n. 13
0
bool menu_iterate(void *data)
{
   unsigned action;
   static bool initial_held = true;
   static bool first_held = false;
   uint64_t input_state;
   int32_t input_entry_ret, ret;
   rgui_handle_t *rgui;

   input_state = 0;
   input_entry_ret = 0;
   ret = 0;
   rgui = (rgui_handle_t*)data;

   if (!rgui)
      return false;

   if (g_extern.lifecycle_state & (1ULL << MODE_MENU_PREINIT))
   {
      rgui->need_refresh = true;
      g_extern.lifecycle_state &= ~(1ULL << MODE_MENU_PREINIT);
      rgui->old_input_state |= 1ULL << RARCH_MENU_TOGGLE;
   }

   rarch_input_poll();
   rarch_check_block_hotkey();
#ifdef HAVE_OVERLAY
   rarch_check_overlay();
#endif
   rarch_check_fullscreen();

   if (input_key_pressed_func(RARCH_QUIT_KEY) || !video_alive_func())
   {
      g_extern.lifecycle_state |= (1ULL << MODE_GAME);
      return false;
   }

   input_state = menu_input(rgui);

   if (rgui->do_held)
   {
      if (!first_held)
      {
         first_held = true;
         rgui->delay_timer = initial_held ? 12 : 6;
         rgui->delay_count = 0;
      }

      if (rgui->delay_count >= rgui->delay_timer)
      {
         first_held = false;
         rgui->trigger_state = input_state;
         rgui->scroll_accel = min(rgui->scroll_accel + 1, 64);
      }

      initial_held = false;
   }
   else
   {
      first_held = false;
      initial_held = true;
      rgui->scroll_accel = 0;
   }

   rgui->delay_count++;
   rgui->old_input_state = input_state;

   if (driver.block_input)
      rgui->trigger_state = 0;

   action = RGUI_ACTION_NOOP;

   // don't run anything first frame, only capture held inputs for old_input_state
   if (rgui->trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_UP))
      action = RGUI_ACTION_UP;
   else if (rgui->trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_DOWN))
      action = RGUI_ACTION_DOWN;
   else if (rgui->trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_LEFT))
      action = RGUI_ACTION_LEFT;
   else if (rgui->trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_RIGHT))
      action = RGUI_ACTION_RIGHT;
   else if (rgui->trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_L))
      action = RGUI_ACTION_SCROLL_UP;
   else if (rgui->trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_R))
      action = RGUI_ACTION_SCROLL_DOWN;
   else if (rgui->trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_B))
      action = RGUI_ACTION_CANCEL;
   else if (rgui->trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_A))
      action = RGUI_ACTION_OK;
   else if (rgui->trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_START))
      action = RGUI_ACTION_START;

   if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->iterate) 
      input_entry_ret = driver.menu_ctx->backend->iterate(rgui, action);

   if (driver.video_data && driver.video_poke && driver.video_poke->set_texture_enable)
      driver.video_poke->set_texture_enable(driver.video_data, rgui->frame_buf_show, MENU_TEXTURE_FULLSCREEN);

   rarch_render_cached_frame();

   // Throttle in case VSync is broken (avoid 1000+ FPS RGUI).
   rgui->time = rarch_get_time_usec();
   rgui->delta = (rgui->time - rgui->last_time) / 1000;
   rgui->target_msec = 750 / g_settings.video.refresh_rate; // Try to sleep less, so we can hopefully rely on FPS logger.
   rgui->sleep_msec = rgui->target_msec - rgui->delta;

   if (rgui->sleep_msec > 0)
      rarch_sleep((unsigned int)rgui->sleep_msec);
   rgui->last_time = rarch_get_time_usec();

   if (driver.video_data && driver.video_poke && driver.video_poke->set_texture_enable)
      driver.video_poke->set_texture_enable(driver.video_data, false,
            MENU_TEXTURE_FULLSCREEN);

   if (driver.menu_ctx && driver.menu_ctx->input_postprocess)
      ret = driver.menu_ctx->input_postprocess(rgui, rgui->old_input_state);

   if (ret < 0)
   {
      unsigned type = 0;
      file_list_get_last(rgui->menu_stack, NULL, &type);
      while (type != RGUI_SETTINGS)
      {
         file_list_pop(rgui->menu_stack, &rgui->selection_ptr);
         file_list_get_last(rgui->menu_stack, NULL, &type);
      }
   }

   if (ret || input_entry_ret)
      return false;

   return true;
}