int StartMenu(void) { int state = 1; //int x = 0; scr_printf(" CN-Cheat Shell Menu.\n Press (X) to boot, Press SELECT for credits, SQUARE to load cheats, Press UP to go into server mode\n"); while (1) { if (padRead(0, 0, &buttons)); { checkPadConnected(); //read pad 1 buttonStatts(0, 0); if (new_pad & PAD_SELECT) { state = 2; scr_clear(); scr_printf("\n\n CREDITS:\n"); scr_printf("\n Gtlcpimp: Basic Hook Concept (From His Sources), Code Designer (Tool Used For MIPS)"); scr_printf("\n Pyriel: Help On All The Troubleshooting With The Hook"); scr_printf("\n Badger41: Teaching Me MIPS Assembly"); scr_printf("\n cYs Driver: Source code For Cora Dumper (Initializing The Pad)\n"); scr_printf("\n END OF CREDITS\n Press (X) To Return To Menu\n"); } if (state == 2) { if (new_pad & PAD_CROSS) { scr_clear(); state = 1; StartMenu(); } } if (new_pad & PAD_SQUARE) { WriteCheats(); } if (new_pad & PAD_CROSS) { ExecGame(); } } } return 0; }
/* * Set up screen mode. */ void scr_set(void) { winsize_t ws; Rows = 0; Cols = 0; if (get_display_size(&ws) == 0) { Rows = ws.ws_row; Cols = ws.ws_col; } use_color = get_display_color_sup(); if ((Rows < MINROWS) || (Cols < MINCOLS)) { char smallscr[55]; snprintf(smallscr, sizeof(smallscr), "the screen is too small (must be at least %dx%d)", MINROWS, MINCOLS); stop(smallscr); } isset = 1; scr_clear(); }
void screen_init(void) { vidmem = (u16int *)VID_MEM; scr_clear(); }
/* gdb_input: Handles user input to the GDB window. * ---------- * * key: Keystroke received. * * Return Value: 0 if internal key was used, * 1 if input to gdb or ... * -1 : Error resizing terminal -- terminal too small */ static int gdb_input(int key, int *last_key) { int result = 0; if (gdb_scroller->in_search_mode) return gdb_input_regex_input(gdb_scroller, key); if (gdb_scroller->in_scroll_mode) { /* Handle setting (mX) and going ('X) to gdb buffer marks */ if (last_key_pressed == 'm' || last_key_pressed == '\'') { int ret = 0; if (last_key_pressed == 'm') ret = scr_set_mark(gdb_scroller, key); else if(last_key_pressed == '\'') ret = scr_goto_mark(gdb_scroller, key); if (ret) { *last_key = 0; if_draw(); } return 0; } /* In scroll mode, all extra characters are not passed to * the active GDB command. result = 0 above ensures that. */ switch (key) { case 'm': case '\'': /* Mark keys - ignore them */ break; case CGDB_KEY_CTRL_U: scr_up(gdb_scroller, get_gdb_height() / 2); break; case CGDB_KEY_PPAGE: scr_up(gdb_scroller, get_gdb_height() - 1); break; case CGDB_KEY_CTRL_D: scr_down(gdb_scroller, get_gdb_height() / 2); break; case CGDB_KEY_NPAGE: scr_down(gdb_scroller, get_gdb_height() - 1); break; case CGDB_KEY_HOME: case CGDB_KEY_F11: scr_home(gdb_scroller); break; case 'G': case CGDB_KEY_END: case CGDB_KEY_F12: scr_end(gdb_scroller); break; case 'k': case CGDB_KEY_UP: case CGDB_KEY_CTRL_P: scr_up(gdb_scroller, 1); break; case 'j': case CGDB_KEY_DOWN: case CGDB_KEY_CTRL_N: scr_down(gdb_scroller, 1); break; case 'g': if (last_key_pressed == 'g') { scr_home(gdb_scroller); } break; case 'q': case 'i': case '\r': case '\n': case CGDB_KEY_CTRL_M: scr_end(gdb_scroller); gdb_scroller->in_scroll_mode = 0; break; case 'n': scr_search_regex(gdb_scroller, ibuf_get(regex_last), 2, regex_direction_last, cgdbrc_get_int(CGDBRC_IGNORECASE)); break; case 'N': scr_search_regex(gdb_scroller, ibuf_get(regex_last), 2, !regex_direction_last, cgdbrc_get_int(CGDBRC_IGNORECASE)); break; case '/': case '?': /* Capturing regular expressions */ regex_cur = ibuf_init(); regex_direction_cur = ('/' == key); orig_line_regex = gdb_scroller->current.r; sbc_kind = SBC_REGEX; scr_search_regex_init(gdb_scroller); break; } } else { switch (key) { case CGDB_KEY_PPAGE: scr_up(gdb_scroller, get_gdb_height() - 1); break; case CGDB_KEY_CTRL_L: scr_clear(gdb_scroller); /* The return 1 tells readline that gdb did not handle the * Ctrl-l. That way readline will handle it. Because * readline uses TERM=dumb, that means that it will clear * a single line and put out the prompt. */ result = 1; break; default: /* This tells the input to go to active GDB command */ result = 1; } } if_draw(); return result; }
/* * Set up screen */ void scr_init(void) { console_cursor_visibility(console, 0); resume_normal(); scr_clear(); }