/*! This works only after console_init() was called. */ extern "C" void panic(const char* format, ...) { const char hint[] = "*** PANIC ***"; char buffer[512]; va_list list; int length; platform_switch_to_text_mode(); serial_puts(hint, sizeof(hint)); serial_puts("\n", 1); //fprintf(stderr, "%s", hint); puts(hint); va_start(list, format); length = vsnprintf(buffer, sizeof(buffer), format, list); va_end(list); if (length >= (int)sizeof(buffer)) length = sizeof(buffer) - 1; serial_puts(buffer, length); //fprintf(stderr, "%s", buffer); puts(buffer); puts("\nPress key to reboot."); clear_key_buffer(); wait_for_key(); platform_exit(); }
void install_new_key_handler(void) { keybuf = farmalloc(KEY_WAS_PRESSED * 2); clear_key_buffer(); old_int09_handler = getvect(9); setvect(9, new_int09_handler); new_key_handler_installed = TRUE; }
/*! This works only after console_init() was called. */ extern "C" void panic(const char* format, ...) { va_list list; platform_switch_to_text_mode(); puts("*** PANIC ***"); va_start(list, format); vprintf(format, list); va_end(list); puts("\nPress key to reboot."); clear_key_buffer(); wait_for_key(); platform_exit(); }
void check_keybuf(int *movep, int *finishp, int *upp, int *downp, int *jumpp) { int move=*movep; int finish=*finishp; int up=*upp; int down=*downp; int jumploop=*jumpp; if (keybuf[KEY_RIGHT] && !keybuf[KEY_LEFT]) { if (keybuf[KEY_CTRL]) { if (move<16) move++; } else { if (move>8) move--; if (move<8) move++; } if (landed) data.direction=0; } if (keybuf[KEY_LEFT] && !keybuf[KEY_RIGHT]) { if (keybuf[KEY_CTRL]) { if (move>-16) move--; } else { if (move<-8) move++; if (move>-8) move--; } if (landed) data.direction=1; } if (keybuf[KEY_UP] && !down) { up=-17; data.sprite=12; jumploop++; if (jumploop>10) { down=1; jumploop=0; } } if ((!keybuf[KEY_RIGHT] && !keybuf[KEY_LEFT]) || (keybuf[KEY_RIGHT] && keybuf[KEY_LEFT])) { if (move>0) move--; if (move<0) move++; } if(keybuf[KEY_Q]) { graphstring(130,100,"Quit(Y/N)",TEXTCOLOR); clear_key_buffer(); while(!keybuf[KEY_Y] && !keybuf[KEY_N]); if (keybuf[KEY_Y] && !keybuf[KEY_N]) exitgame(); clear_key_buffer(); graphstring(130,100,"Quit(Y/N)",BACKGROUND); } *movep=move; *finishp=finish; *upp=up; *downp=down; *jumpp=jumploop; }