void Draw_All(void) { int i,col; pgFillvram(0); strncpy(path_tmp, doomwaddir2, 128); mh_print(5, 5, "Please choose a game to launch (Press Circle to select)", rgb2col(255, 255, 255), 0, 0); mh_print(310, 245, "Vita Doom - Release 1", rgb2col(255, 0, 0), 0, 0); mh_print(245, 270, "based on DoomPSP-0.04 S.S. b5", rgb2col(255, 255, 0), 0, 0); /*char errtext[64]; sprintf(errtext, "Error: 0x%x", res); mh_print(10, 300, errtext, RGBA8(255, 0, 0, 2555), 0, 0);*/ if (dlist_num == 0) { mh_print(32, 40, "No WADs found... Put WADs in:", rgb2col(255, 0, 0), 0, 0); mh_print(32, 60, path_tmp, rgb2col(255, 0, 0), 0, 0); } else { i = dlist_start; while (i < (dlist_start + PATHLIST_H)) { if (i < dlist_num) { col = rgb2col(255, 255, 255); if (dlist[i].type & TYPE_DIR) { col = rgb2col(255, 255, 0); } if (i == dlist_curpos) { col = rgb2col(255, 0, 0); } strncpy(path_tmp, dlist[i].name, 40); mh_print(32, ((i - dlist_start) + 2) * 20, path_tmp, col, 0, 0); } i++; } } pgScreenFlipV(); }
void ButtonChange(char tempstring[][MAX_TEMP_STRING], const char* buttons[], const char* tempkeystring[]) { pgFillvram(0); int i = 0; int die = 0; int col; int tempact = 0; char tempselect[27]; for (i=0; i<MAX_CONTROL; i++) { if (d_controls[i] == CKEY_WEAPON) die = 0; else if (d_controls[i] == KEY_ENTER) die = 1; else if (d_controls[i] == KEY_ESCAPE) die = 2; else if (d_controls[i] == ' ') die = 3; else if (d_controls[i] == CKEY_MOVE) die = 4; else if (d_controls[i] == KEY_TAB) die = 5; else if (d_controls[i] == KEY_RSHIFT) die = 6; else if (d_controls[i] == KEY_RCTRL) die = 7; else if (d_controls[i] == ',') die = 8; else if (d_controls[i] == '.') die = 9; else if (d_controls[i] == 222) die = 10; else if (d_controls[i] == 266) die = 11; else if (d_controls[i] == 333) die = 12; col = rgb2col(255,255,255); if (i==d_clist_curpos) { col = rgb2col(255,0,0); } sprintf(tempstring[i], "%s = %s", buttons[i], tempkeystring[die]); mh_print(5, ((i + 1) * 20), tempstring[i], col, 0, 0); } if (d_controls[d_clist_curpos] == CKEY_WEAPON) die = 0; else if (d_controls[d_clist_curpos] == KEY_ENTER) die = 1; else if (d_controls[d_clist_curpos] == KEY_ESCAPE) die = 2; else if (d_controls[d_clist_curpos] == ' ') die = 3; else if (d_controls[d_clist_curpos] == CKEY_MOVE) die = 4; else if (d_controls[d_clist_curpos] == KEY_TAB) die = 5; else if (d_controls[d_clist_curpos] == KEY_RSHIFT) die = 6; else if (d_controls[d_clist_curpos] == KEY_RCTRL) die = 7; else if (d_controls[d_clist_curpos] == ',') die = 8; else if (d_controls[d_clist_curpos] == '.') die = 9; else if (d_controls[d_clist_curpos] == 222) die = 10; else if (d_controls[d_clist_curpos] == 266) die = 11; else if (d_controls[d_clist_curpos] == 333) die = 12; sprintf(tempselect, "Make selection for %s", tempkeystring[die]); mh_print(5, 255, tempselect, rgb2col(50, 255, 50), 0, 0); pgScreenFlipV(); unsigned long key; control_bef_ctl = now_pad; while (1) { key = Read_Key3(); if (key != 0) break; pgWaitV(); } if (d_controls[die] == CKEY_WEAPON || d_controls[die] == CKEY_MOVE) { tempact = d_controls[4]; d_controls[4] = d_controls[0]; d_controls[0] = tempact; if (d_controls[0] == CKEY_MOVE) { analog = 1; } else { analog = 0; } } else if (key & SCE_CTRL_START) { tempact = d_controls[1]; d_controls[1] = d_controls[d_clist_curpos]; d_controls[d_clist_curpos] = tempact; } else if (key & SCE_CTRL_SELECT) { tempact = d_controls[2]; d_controls[2] = d_controls[d_clist_curpos]; d_controls[d_clist_curpos] = tempact; } else if (key & SCE_CTRL_CROSS) { tempact = d_controls[3]; d_controls[3] = d_controls[d_clist_curpos]; d_controls[d_clist_curpos] = tempact; } else if (key & SCE_CTRL_TRIANGLE) { tempact = d_controls[5]; d_controls[5] = d_controls[d_clist_curpos]; d_controls[d_clist_curpos] = tempact; } else if (key & SCE_CTRL_SQUARE) { tempact = d_controls[6]; d_controls[6] = d_controls[d_clist_curpos]; d_controls[d_clist_curpos] = tempact; } else if (key & SCE_CTRL_CIRCLE) { tempact = d_controls[7]; d_controls[7] = d_controls[d_clist_curpos]; d_controls[d_clist_curpos] = tempact; } else if (key & SCE_CTRL_LTRIGGER) { tempact = d_controls[8]; d_controls[8] = d_controls[d_clist_curpos]; d_controls[d_clist_curpos] = tempact; } else if (key & SCE_CTRL_RTRIGGER) { tempact = d_controls[9]; d_controls[9] = d_controls[d_clist_curpos]; d_controls[d_clist_curpos] = tempact; } control_bef_ctl = key; }
void NewPrompter() { char* buttons[MAX_CONTROL]; char tempstring[MAX_CONTROL][MAX_TEMP_STRING]; char* tempkeystring[MAX_CONTROL+2]; tempkeystring[0] = "WEAPON"; tempkeystring[1] = "ENTER"; tempkeystring[2] = "ESC"; tempkeystring[3] = "USE"; tempkeystring[4] = "MOVE"; tempkeystring[5] = "MAP"; tempkeystring[6] = "RUN"; tempkeystring[7] = "FIRE"; tempkeystring[8] = "M_LEFT"; tempkeystring[9] = "M_RIGHT"; //tempkeystring[10] = "222"; //tempkeystring[11] = "266"; //tempkeystring[12] = "333"; buttons[0] = "ANALOG "; buttons[1] = "START "; buttons[2] = "SELECT "; buttons[3] = "CROSS "; buttons[4] = "DPAD "; buttons[5] = "TRIANGLE "; buttons[6] = "SQUARE "; buttons[7] = "CIRCLE "; buttons[8] = "L_TRIG "; buttons[9] = "R_TRIG "; //buttons[10] = "CPU_CLOCK"; control_bef_ctl = 0; pgScreenFrame(2,0); pgFillvram(0); pgScreenFlipV(); while (1) { pgFillvram(0); int i = 0; int die = 0; int col; for (i=0; i<MAX_CONTROL; i++) { if (d_controls[i] == CKEY_WEAPON) die = 0; else if (d_controls[i] == KEY_ENTER) die = 1; else if (d_controls[i] == KEY_ESCAPE) die = 2; else if (d_controls[i] == ' ') die = 3; else if (d_controls[i] == CKEY_MOVE) die = 4; else if (d_controls[i] == KEY_TAB) die = 5; else if (d_controls[i] == KEY_RSHIFT) die = 6; else if (d_controls[i] == KEY_RCTRL) die = 7; else if (d_controls[i] == ',') die = 8; else if (d_controls[i] == '.') die = 9; else if (d_controls[i] == 222) die = 10; else if (d_controls[i] == 266) die = 11; else if (d_controls[i] == 333) die = 12; col = rgb2col(255,255,255); if (i==d_clist_curpos) { col = rgb2col(255,0,0); } sprintf(tempstring[i], "%s = %s",buttons[i],tempkeystring[die]); mh_print(5, ((i + 2) * 20), tempstring[i], col, 0, 0); } if (d_clist_curpos != 10) { mh_print(5,255,"X: Exit | O: Change | Triangle: Save To File",rgb2col(50,255,50),0,0); } else { mh_print(5,255,"X: Exit | O: Increment | Square: Decrement | Triangle: Save To File",rgb2col(50,255,50),0,0); } pgScreenFlipV(); if (control_bef_ctl == 0) { Read_Key2(); pgWaitV(); } else { unsigned long ankey; while (1) { ankey = Read_Key3(); if (ankey != 0) break; pgWaitV(); } new_pad = old_pad = now_pad = ankey; control_bef_ctl = 0; } if (new_pad & SCE_CTRL_UP) { if (d_clist_curpos > 0) { d_clist_curpos--; if (d_clist_curpos < d_clist_start) { d_clist_start = d_clist_curpos; } } } else if (new_pad & SCE_CTRL_DOWN) { if (d_clist_curpos < (MAX_CONTROL-1)) { d_clist_curpos++; if (d_clist_curpos >= (d_clist_start+MAX_CONTROL-1)) { d_clist_start++; } } } else if (new_pad & SCE_CTRL_CIRCLE) { if (d_clist_curpos != 10) { ButtonChange(tempstring, buttons, tempkeystring); } else { change_cpu_clock(1); // increment } } else if (new_pad & SCE_CTRL_TRIANGLE) { SaveToFile(tempstring, buttons, tempkeystring); } else if (new_pad & SCE_CTRL_SQUARE) { if (d_clist_curpos == 10) change_cpu_clock(0); // decrement } else if (new_pad & SCE_CTRL_CROSS) { break; } } }
unsigned int char2col(char *s) { if (s[0] == '#') return rgb2col(s); else return name2col(s); }