static void poweroffCallback(void *arg) { #if 0 /* Close all files and unmount all partitions. */ close(fd); /* If you use PFS, close all files and unmount all partitions. */ fileXioDevctl("pfs:", PDIOC_CLOSEALL, NULL, 0, NULL, 0) /* Shut down DEV9, if you used it. */ while(fileXioDevctl("dev9x:", DDIOC_OFF, NULL, 0, NULL, 0) < 0){}; #endif printf("Shutdown!"); poweroffShutdown(); }
/** 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; } } } }
void poweroffps2(int i) { poweroffShutdown(); }