static int r_core_visual_hud(RCore *core) { const char *f = R2_LIBDIR"/radare2/"R2_VERSION"/hud/main"; char *homehud = r_str_home (R2_HOMEDIR"/hud"); char *res = NULL; char *p = 0; showcursor (core, R_TRUE); if (homehud) res = r_cons_hud_file (homehud); if (!res) { if (r_file_exists (f)) res = r_cons_hud_file (f); else r_cons_message ("Cannot find hud file"); } r_cons_clear (); if (res) { p = strchr (res, '\t'); core->printidx = 1; r_cons_printf ("%s\n", res); r_cons_flush (); if (p) r_core_cmd0 (core, p+1); free (res); } showcursor (core, R_FALSE); r_cons_flush (); free (homehud); return (int)(size_t)p; }
R_API int r_core_visual_hud(RCore *core) { const char *c = r_config_get (core->config, "hud.path"); const char *f = R2_LIBDIR"/radare2/"R2_VERSION"/hud/main"; char *homehud = r_str_home (R2_HOMEDIR"/hud"); char *res = NULL; char *p = 0; showcursor (core, true); if (c && *c && r_file_exists (c)) res = r_cons_hud_file (c); if (!res && homehud) res = r_cons_hud_file (homehud); if (!res && r_file_exists (f)) res = r_cons_hud_file (f); if (!res) r_cons_message ("Cannot find hud file"); r_cons_clear (); if (res) { p = strchr (res, '\t'); r_cons_printf ("%s\n", res); r_cons_flush (); if (p) r_core_cmd0 (core, p+1); free (res); } showcursor (core, false); r_cons_flush (); free (homehud); return (int)(size_t)p; }
R_API int r_core_visual_prompt (RCore *core) { char buf[1024]; int ret; #if __UNIX__ r_line_set_prompt (Color_RESET":> "); #else r_line_set_prompt (":> "); #endif showcursor (core, true); r_cons_fgets (buf, sizeof (buf), 0, NULL); if (!strcmp (buf, "q")) { ret = false; } else if (*buf) { r_line_hist_add (buf); r_core_cmd (core, buf, 0); r_cons_flush (); ret = true; } else { ret = false; //r_cons_any_key (NULL); r_cons_clear00 (); showcursor (core, false); } return ret; }
R_API int r_core_visual_prompt (RCore *core) { char buf[1024]; int ret; ut64 oseek = core->offset; #if __UNIX__ r_line_set_prompt (Color_RESET":> "); #else r_line_set_prompt (":> "); #endif showcursor (core, R_TRUE); r_cons_fgets (buf, sizeof (buf), 0, NULL); if (*buf) { r_line_hist_add (buf); r_core_cmd (core, buf, 0); r_cons_flush (); ret = R_TRUE; } else { ret = R_FALSE; //r_cons_any_key (); r_cons_clear00 (); showcursor (core, R_FALSE); } if (curset) r_core_seek (core, oseek, 1); return ret; }
/// Main loop and input handling int main() { hidecursor(); gen(level); setColor(2); printf("Welcome! Use WASD to move.\n"); setColor(6); printf("Hit any key to start.\n"); anykey(); draw(); while (1) { // Input if (kbhit()) { char k = getch(); int oldx = x, oldy = y; if (k == 'a') { --x; ++moves; } else if (k == 'd') { ++x; ++moves; } else if (k == 'w') { --y; ++moves; } else if (k == 's') { ++y; ++moves; } else if (k == 27) break; // Collisions if (lvl[x][y] & WALL) { x = oldx; y = oldy; } else if (lvl[x][y] & COIN) { coins++; lvl[x][y] ^= COIN; } else if (lvl[x][y] & TORCH) { torch+=20; lvl[x][y] ^= TORCH; } else if (lvl[x][y] & STAIRS_DOWN) gen(++level); // Drawing draw(); // Die if (--torch <= 0) break; } } showcursor(); return 0; }
void cursor_stay() { if ((cursor_shown == FALSE) || (in_startup_mode == TRUE)) { cursor_shown = TRUE; showcursor(TRUE); } }
/** * progress - Advanced ASCII progress bar with spinner * @percent: Start first call with this set to 0, end with 100 * @max_width: Max width of progress bar, in total characters. * * This function draws an advanced ASCII progressbar at the current * line. It always start from the first column. * * The progress bar will hide the cursor if started with @percent 0 and * show it again at the end, when called with @percent 100. * * While being called with the same percentage the spinner will spin, * to show the user the process hasn't frozen. * * If the output TTY cannot interpret control characters, like \r, it is * advised to instead used the progress_simple() function. */ void progress(int percent, int max_width) { int i, bar; /* Adjust for progress bar overhead */ max_width -= 10; if (0 == percent) hidecursor(); fprintf(stderr, "\r%3d%% %c [", percent, spinner(NULL)); bar = percent * max_width / 100; for (i = 0; i < max_width; i++) { if (i > bar) fputc(' ', stderr); else if (i == bar) fputc('>', stderr); else fputc('=', stderr); } fprintf(stderr, "]"); if (100 == percent) { showcursor(); fputc('\n', stderr); } }
void fatal(const char *s, ...) // failure exit { if(++errors <= 2) // print up to one extra recursive error { defvformatbigstring(msg, s, s); if(logfile) logoutf("%s", msg); #ifndef WIN32 fprintf(stderr, "%s\n", msg); #endif if(errors <= 1) // avoid recursion { if(SDL_WasInit(SDL_INIT_VIDEO)) { showcursor(true); SDL_WM_GrabInput(SDL_GRAB_OFF); cleargamma(); } #ifdef WIN32 defformatstring(cap, "%s: Error", VERSION_NAME); MessageBox(NULL, msg, cap, MB_OK|MB_SYSTEMMODAL); #endif SDL_Quit(); } } exit(EXIT_FAILURE); }
// TODO: integrate in '/' command with search.inblock ? static void visual_search (RCore *core) { const ut8 *p; int len, d = cursor; char str[128], buf[258]; r_line_set_prompt ("search byte/string in block: "); r_cons_fgets (str, sizeof (str), 0, NULL); len = r_hex_str2bin (str, (ut8*)buf); if (*str=='"') { char *e = strncpy (buf, str+1, sizeof (buf)-1); if (e) { --e; if (*e=='"') *e=0; } len = strlen (buf); } else if (len<1) { strncpy (buf, str, sizeof (buf)-1); len = strlen (str); } p = r_mem_mem (core->block+d, core->blocksize-d, (const ut8*)buf, len); if (p) { cursor = (int)(size_t)(p-core->block); if (len>1) { ocursor = cursor+len-1; } else ocursor = -1; showcursor (core, true); eprintf ("FOUND IN %d\n", cursor); r_cons_any_key (NULL); } else { eprintf ("Cannot find bytes\n"); r_cons_any_key (NULL); r_cons_clear00 (); } }
void cursor_stay() { if ((cursor_shown == false) || (in_startup_mode == true)) { cursor_shown = true; showcursor(true); } }
void cursor_go() { if (in_startup_mode == TRUE) return; if (cursor_shown == TRUE) { cursor_shown = FALSE; showcursor(FALSE); } }
void quit(World *world) { //cls(); locate(1, 1); setColor(WHITE); printf("GAME OVER\nRESULTS:[LEVEL: %d HP:%d LIFE:%d]\n", world->level.level, world->player.hp, world->player.life); showcursor(); exit(EXIT_SUCCESS); }
void inputgrab(bool on) { #ifndef WIN32 if(!(screen->flags & SDL_FULLSCREEN)) SDL_WM_GrabInput(SDL_GRAB_OFF); else #endif SDL_WM_GrabInput(on ? SDL_GRAB_ON : SDL_GRAB_OFF); showcursor(!on); }
void cursor_go() { if (in_startup_mode == true) return; if (cursor_shown == true) { cursor_shown = false; showcursor(false); } }
void check_game_done() { through_sending(); if (All_Done == true) { lose_graphics(); showcursor(true); PostQuitMessage(0); } }
int tty_fix (void) { if (!havemodes) { return 0; } showcursor(); /* "stty sane" */ return tcsetattr(fileno(stdin), TCSANOW, &savemodes); }
void max_window(HWND window) { RECT main_rect,wind_rect; short width,height; cursor_shown = true; showcursor(true); GetWindowRect(GetDesktopWindow(),&main_rect); GetWindowRect(window,&wind_rect); width = main_rect.right - main_rect.left; height = main_rect.bottom - main_rect.top; MoveWindow(window,0,0,width,height,true); }
static void findNextWord (RCore *core) { int i, d = curset? cursor: 0; for (i = d+1; i<core->blocksize; i++) { switch (core->block[i]) { case ' ': case '.': case '\t': case '\n': if (curset) { cursor = i+1; ocursor = -1; showcursor (core, true); } else { r_core_seek (core, core->offset + i + 1, 1); } return; } } }
void cleanup() { recorder::stop(); cleanupserver(); showcursor(true); //#ifdef FAKESHOWCURSOR // if(scursor) SDL_FreeCursor(scursor); // scursor = ncursor = NULL; //#endif SDL_WM_GrabInput(SDL_GRAB_OFF); cleargamma(); freeocta(worldroot); extern void clear_command(); clear_command(); extern void clear_console(); clear_console(); extern void clear_mdls(); clear_mdls(); stopsound(); closelogfile(); SDL_Quit(); }
static void findPrevWord (RCore *core) { int i = curset? cursor: 0; while (i>1) { if (isSpace (core->block[i])) i--; else if (isSpace (core->block[i-1])) i-=2; else break; } for (; i>=0; i--) { if (isSpace (core->block[i])) { if (curset) { cursor = i+1; ocursor = -1; showcursor (core, true); } else { // r_core_seek (core, core->offset + i + 1, 1); } break; } } }
static void findPair (RCore *core) { ut8 buf[256]; int i, len, d = cursor+1; int delta = 0; const ut8 *p, *q = NULL; const char *keys = "{}[]()<>"; ut8 ch = core->block[cursor]; p = (const ut8*)strchr (keys, ch); if (p) { delta = (size_t)(p-(const ut8*)keys); ch = (delta%2)? p[-1]: p[1]; } len = 1; buf[0] = ch; if (p && (delta%2)) { for (i = d-1; i>=0; i--) { if (core->block[i] == ch) { q = core->block + i; break; } } } else { q = r_mem_mem (core->block+d, core->blocksize-d, (const ut8*)buf, len); if (!q) { q = r_mem_mem (core->block, R_MIN (core->blocksize, d), (const ut8*)buf, len); } } if (q) { cursor = (int)(size_t)(q-core->block); ocursor = -1; showcursor (core, true); } }
static void bye(void) { showcursor(); }
void resetall() { setrgb(COLOR_RESET, COLOR_RESET); clrscr(); gotoxy(0, 0); showcursor(true); }
/* moves the cursor using global cursor_x and cursor_y */ void move(void) { showcursor(cursor_x,cursor_y); }
static void prompt_read (const char *p, char *buf, int buflen) { r_line_set_prompt (p); showcursor (NULL, true); r_cons_fgets (buf, buflen, 0, NULL); showcursor (NULL, false); }
int main(int argc, char *argv[]) { char inkey=0, *prgdir, *curdir, *program_name; bool ext, validcfg, quit = false, bkgply = false, batchply = false; unsigned int opt, prgdrive, i; CWindow *focus; #ifdef DEBUG f_log = fopen(DEBUG_FILE,"wt"); #endif std::cout << ADPLAYVERS << ", Copyright (c) 2000 - 2006 Simon Peter <*****@*****.**>" << std::endl << std::endl; // check that no other instance is running { char *adplayenv = getenv("ADPLAY"); if(adplayenv && !strcmp(adplayenv,"S")) { std::cout << "AdPlay already running!" << std::endl; exit(EXIT_FAILURE); } else setenv("ADPLAY","S",1); // flag our instance } // Build program executable name program_name = strrchr(argv[0], '\\') ? strrchr(argv[0], '\\') + 1 : argv[0]; CAdPlug::debug_output("debug.log"); // Redirect AdPlug's debug to file // Build path to default configuration file (in program's directory) SPLITPATH(argv[0],configfile,configfile+2,NULL,NULL); strcat(configfile,CONFIGFILE); loadconfig(configfile,DEFCONFIG); // load default configuration // parse commandline for general options while((opt = getopt(argc,argv))) switch(opt) { case 1: // display help case 2: std::cout << "Usage: " << program_name << " [options]" << std::endl << std::endl; std::cout << "Options can be set with '-' or '/' respectively." << std::endl << std::endl; std::cout << " -?, -h Display commandline help" << std::endl << " -p port Set OPL2 port" << std::endl << " -o Force OPL2 port" << std::endl << " -f file Use alternate configuration file" << std::endl << " -c section Load another configuration section" << std::endl << " -b file Immediate background playback using " << "specified file" << std::endl << " -q files Immediate (batch mode) playback using " << "specified files" << std::endl; showcursor(); exit(EXIT_SUCCESS); case 3: // set OPL2 port opl.setport(atoi(argv[myoptind++])); break; case 4: // force OPL2 port oplforce = true; break; case 7: // background playback bkgply = true; break; case 8: // batch mode playback batchply = true; break; } // Bail out if OPL2 not detected and not force if(!opl.detect() && !oplforce) { std::cout << "No OPL2 detected!" << std::endl; showcursor(); exit(EXIT_FAILURE); } // Hand our database to AdPlug CAdPlug::set_database(&mydb); /*** Background playback mode ***/ if(bkgply) if(!(p = CAdPlug::factory(argv[myoptind],&opl))) { std::cout << "[" << argv[myoptind] << "]: unsupported file type!" << std::endl; exit(EXIT_FAILURE); } else { std::cout << "Background playback... (type EXIT to stop)" << std::endl; #ifdef HAVE_WCC_TIMER_H tmInit(poll_player,0xffff,DEFSTACK); #elif defined HAVE_GCC_TIMER_H timer_init(poll_player); #endif dopoll = true; #ifdef __WATCOMC__ _heapshrink(); #endif system(getenv("COMSPEC")); #ifdef HAVE_WCC_TIMER_H tmClose(); #elif defined HAVE_GCC_TIMER_H timer_deinit(); #endif stop(); exit(EXIT_SUCCESS); } /*** Batch playback mode ***/ if(batchply) { #ifdef HAVE_WCC_TIMER_H tmInit(poll_player,0xffff,DEFSTACK); #elif defined HAVE_GCC_TIMER_H timer_init(poll_player); #endif for(i = myoptind; i < argc; i++) if(!(p = CAdPlug::factory(argv[i],&opl))) { std::cout << "[" << argv[i] << "]: unsupported file type!" << std::endl; #ifdef HAVE_WCC_TIMER_H tmClose(); #elif defined HAVE_GCC_TIMER_H timer_deinit(); #endif exit(EXIT_FAILURE); } else { dopoll = firsttime = true; std::cout << "Playing [" << argv[i] << "] ..." << std::endl; while(firsttime) ; // busy waiting stop(); dopoll = false; } #ifdef HAVE_WCC_TIMER_H tmClose(); #elif defined HAVE_GCC_TIMER_H timer_deinit(); #endif exit(EXIT_SUCCESS); } /*** interactive (GUI) mode ***/ getvideoinfo(&dosvideo); // Save previous video state // register our windows with the window manager wnds.reg(titlebar); wnds.reg(filesel); wnds.reg(songwnd); wnds.reg(instwnd); wnds.reg(volbars); wnds.reg(mastervol); wnds.reg(infownd); // load default GUI layout validcfg = loadcolors(configfile,DEFCONFIG); // reparse commandline for GUI options myoptind = 1; // reset option parser while((opt = getopt(argc,argv))) switch(opt) { case 5: // set config file strcpy(configfile,argv[myoptind++]); if(loadcolors(configfile,DEFCONFIG)) validcfg = true; break; case 6: // load config section loadcolors(configfile,argv[myoptind++]); break; } // bail out if no configfile could be loaded if(!validcfg) { std::cout << "No valid default GUI layout could be loaded!" << std::endl; exit(EXIT_FAILURE); } // init GUI if((tmpfn = TEMPNAM(getenv("TEMP"),"_AP"))) #ifdef __WATCOMC__ mkdir(tmpfn); #else mkdir(tmpfn, S_IWUSR); #endif prgdir = getcwd(NULL, PATH_MAX); _dos_getdrive(&prgdrive); setadplugvideo(); #ifdef HAVE_WCC_TIMER_H tmInit(poll_player,0xffff,DEFSTACK); #elif defined HAVE_GCC_TIMER_H timer_init(poll_player); #endif songwnd.setcaption("Song Info"); volbars.setcaption("VBars"); titlebar.setcaption(ADPLAYVERS); filesel.setcaption("Directory"); mastervol.setcaption("Vol"); filesel.refresh(); mastervol.set(63); display_help(infownd); filesel.setfocus(); reset_windows(); // main loop do { if(p) { // auto-update windows // wait_retrace(); idle_ms(1000/70); refresh_songinfo(songwnd); refresh_volbars(volbars,opl); if(onsongend && !firsttime) { // song ended switch(onsongend) { case 1: // auto-rewind dopoll = false; while(inpoll) ; // critical section... p->rewind(subsong); last_ms = time_ms = 0.0f; dopoll = true; // ...End critical section break; case 2: // stop playback stop(); reset_windows(); break; } } } // Check for keypress and read in, if any if(kbhit()) { if(!(inkey = toupper(getch()))) { ext = true; inkey = toupper(getch()); } else ext = false; focus = CWindow::getfocus(); // cache focused window dbg_printf("main(): Key pressed: %d %s\n", inkey, ext ? "(Ext)" : "(Norm)"); } else inkey = 0; if(ext) // handle all extended keys switch(inkey) { case 15: // [Shift]+[TAB] - Back cycle windows window_cycle(true); break; case 59: // [F1] - display help display_help(infownd); infownd.setfocus(); wnds.update(); break; case 60: // [F2] - change screen layout curdir = getcwd(NULL, PATH_MAX); chdir(prgdir); select_colors(); chdir(curdir); free(curdir); clearscreen(backcol); filesel.refresh(); wnds.update(); break; case 72: // [Up Arrow] - scroll up if(focus == &filesel) { filesel.select_prev(); filesel.update(); } else if(focus == &infownd) { infownd.scroll_up(); infownd.update(); } else if(focus == &instwnd) { instwnd.scroll_up(); instwnd.update(); } break; case 80: // [Down Arrow] - scroll down if(focus == &filesel) { filesel.select_next(); filesel.update(); } else if(focus == &infownd) { infownd.scroll_down(); infownd.update(); } else if(focus == &instwnd) { instwnd.scroll_down(); instwnd.update(); } break; case 75: // [Left Arrow] - previous subsong if(p && subsong) { subsong--; dopoll = false; while(inpoll) ; // critical section... totaltime = p->songlength(subsong); p->rewind(subsong); last_ms = time_ms = 0.0f; dopoll = true; // ...End critical section } break; case 77: // [Right Arrow] - next subsong if(p && subsong < p->getsubsongs()-1) { subsong++; dopoll = false; while(inpoll) ; // critical section... totaltime = p->songlength(subsong); p->rewind(subsong); last_ms = time_ms = 0.0f; dopoll = true; // ...End critical section } break; case 73: // [Page Up] - scroll up half window if(focus == &filesel) { filesel.select_prev(filesel.getsizey() / 2); filesel.update(); } else if(focus == &infownd) { infownd.scroll_up(infownd.getsizey() / 2); infownd.update(); } else if(focus == &instwnd) { instwnd.scroll_up(instwnd.getsizey() / 2); instwnd.update(); } break; case 81: // [Page Down] - scroll down half window if(focus == &filesel) { filesel.select_next(filesel.getsizey() / 2); filesel.update(); } else if(focus == &infownd) { infownd.scroll_down(infownd.getsizey() / 2); infownd.update(); } else if(focus == &instwnd) { instwnd.scroll_down(instwnd.getsizey() / 2); instwnd.update(); } break; case 71: // [Home] - scroll to start if(focus == &filesel) { filesel.setselection(0); filesel.update(); } else if(focus == &infownd) { infownd.scroll_set(0); infownd.update(); } else if(focus == &instwnd) { instwnd.scroll_set(0); instwnd.update(); } break; case 79: // [End] - scroll to end if(focus == &filesel) { filesel.setselection(0xffff); filesel.update(); } else if(focus == &infownd) { infownd.scroll_set(0xffff); infownd.update(); } else if(focus == &instwnd) { instwnd.scroll_set(0xffff); instwnd.update(); } break; } else // handle all normal keys switch(inkey) { case 9: // [TAB] - Cycle through windows window_cycle(); break; case 13: // [Return] - Activate if(focus == &filesel) activate(); break; case 27: // [ESC] - Stop music / Exit to DOS if(p) { stop(); reset_windows(); } else quit = true; break; case ' ': // [Space] - fast forward fast_forward(FF_MSEC); break; case 'M': // refresh song info refresh_songdesc(infownd); break; case 'D': // shell to DOS dosshell(getenv("COMSPEC")); filesel.refresh(); wnds.update(); break; case '+': // [+] - Increase volume adjust_volume(-1); break; case '-': // [-] - Decrease volume adjust_volume(+1); break; } } while(!quit); // deinit #ifdef HAVE_WCC_TIMER_H tmClose(); #elif defined HAVE_GCC_TIMER_H timer_deinit(); #endif stop(); setvideoinfo(&dosvideo); { unsigned int dummy; _dos_setdrive(prgdrive, &dummy); } chdir(prgdir); free(prgdir); if(tmpfn) { rmdir(tmpfn); free(tmpfn); } #ifdef DEBUG dbg_printf("main(): clean shutdown.\n"); fclose(f_log); #endif return EXIT_SUCCESS; }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR, int nCmdShow) { MSG msg; WNDCLASS wndclass, wndclass2; RECT windRECT; HINSTANCE boeSoundsDLL; wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW; wndclass.lpfnWndProc = WndProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = hInstance; wndclass.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(10)); wndclass.hCursor = NULL; wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wndclass.lpszMenuName = MAKEINTRESOURCE(1); wndclass.lpszClassName = szAppName; RegisterClass(&wndclass); wndclass2.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW; wndclass2.lpfnWndProc = WndProc; wndclass2.cbClsExtra = 0; wndclass2.cbWndExtra = 0; wndclass2.hInstance = hInstance; wndclass2.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(10)); wndclass2.hCursor = NULL; wndclass2.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wndclass2.lpszMenuName = NULL; wndclass2.lpszClassName = szWinName; RegisterClass(&wndclass2); mainPtr = CreateWindow (szAppName, "Classic Blades of Exile", WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, 0, 0, 588, 478, NULL, NULL, hInstance, NULL); if (!hPrevInstance) { // initialize Get_Path(file_path_name); store_hInstance = hInstance; accel = LoadAccelerators(hInstance, MAKEINTRESOURCE(1)); boeSoundsDLL = LoadLibrary("./boesounds.dll"); if (!boeSoundsDLL) { MessageBox(mainPtr, "BOESOUNDS.DLL not found", "Error", MB_OK | MB_ICONEXCLAMATION); return (-1); } load_sounds(boeSoundsDLL); loadFonts(); loadCursors(); SetCursor(sword_curs); current_cursor = 124; /* cursors loaded */ data_store = new piles_of_stuff_dumping_type; data_store3 = new piles_of_stuff_dumping_type3; data_store4 = new piles_of_stuff_dumping_type4; data_store5 = new piles_of_stuff_dumping_type5; scen_item_list = new scen_item_data_type; srand(GetCurrentTime()); get_reg_data(); if (display_mode != 5) max_window(mainPtr); else { GetWindowRect(GetDesktopWindow(),&windRECT); MoveWindow(mainPtr,(windRECT.right - (588 + 10)) / 2, (windRECT.bottom - (425 + 52)) / 2 , 588 + 10,425 + 52,true); } shop_sbar = CreateWindow("scrollbar",NULL, WS_CHILD | WS_TABSTOP | SBS_VERT, shop_sbar_rect.left,shop_sbar_rect.top,shop_sbar_rect.right,shop_sbar_rect.bottom, mainPtr,(HMENU) 3, store_hInstance,NULL); lpsi.fMask = SIF_RANGE; lpsi.nMax = 16; SetScrollInfo(shop_sbar,SB_CTL,&lpsi,false); // SetScrollRange(shop_sbar,SB_CTL,0,16,false); ShowWindow(mainPtr, nCmdShow); plop_fancy_startup(); init_screen_locs(); FlushEvents(2); SetTimer(mainPtr,1,620,NULL); SetTimer(mainPtr,2,200,NULL); file_initialize(); if (GetDeviceCaps(main_dc,BITSPIXEL) * GetDeviceCaps(main_dc,PLANES) < 8) { MessageBox(mainPtr,"Blades of Exile is designed for 256 colors. The current graphics device is set for less. Exile 3 is playable with less colors, but will look somewhat odd." , "Not 256 colors!",MB_OK | MB_ICONEXCLAMATION); MessageBox(mainPtr,"For tips on how to get 256 colors, hit F1 for help, and then select 'Getting 256 Colors' from the table of contents." , "Not 256 colors!",MB_OK | MB_ICONEXCLAMATION); } menu_activate(0); cursor_stay(); showcursor(true); reset_text_bar(); adjust_window_mode(); cd_init_dialogs(); if (game_run_before == false) { FCD(986,0); WritePrivateProfileString("Blades of Exile", "game_run_before", "1", "./blades.ini"); } else if (give_intro_hint == true) tip_of_day(); } event_handled = false; while(GetMessage(&msg,NULL,0,0)) { if (event_handled == false) { if (!TranslateAccelerator(mainPtr, accel, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } } delete scen_item_list; delete data_store5; delete data_store4; delete data_store3; if(data_store2 != NULL) delete[] data_store2; if(scen_headers != NULL) delete[] scen_headers; delete data_store; lose_graphics(); FreeLibrary((HMODULE) boeSoundsDLL); return msg.wParam; }
void ingresoDeDatos() { /* Variables locales */ int salir = 0; /* Mientras sea 1, se mantiene en el bucle */ int entrada = 1; /* Variable donde se almacenan las entradas del teclado */ /* Pide ingresar el nombre de la variable */ setColor(WHITE); system("cls"); printf("\n\t\t\tPrograma estadistico"); printf("\n\nIngrese el nombre de la variable: "); gets(NombreVariable); printf("Variable \"%s\" registrada!\n\n", NombreVariable); Sleep(500); gotoxy(60, 1); setColor(CYAN); printf("Iniciando...", o); gotoxy(3, 10); setColor(YELLOW); printf("Cargando programa"); puntitos(200, 5); printf("\n\n Programa listo, presiona enter para continuar!"); gotoxy(1, 20); setColor(RED); hidecursor(); printf("si deseas cancelar, presiona: CONTROL+C"); entrada = _getche(); if (entrada == 3) { main(); } int indiceDato = 0; do { setColor(WHITE); char Dato_cadena[MAX_LENGHT] = { '\0' }; system("cls"); setColor(CYAN); printf("Variable: %s", NombreVariable); gotoxy(60, 1); setColor(GREEN); printf("En ejecuci%cn.", o); gotoxy(0, 0); setColor(WHITE); printf("\n\t\t\tPrograma estadistico\n\n"); showcursor(); printf("Ingresa el dato cuantitativo a registrar:"); gets(Dato_cadena); if (validarDatos(Dato_cadena)) { /* Convierte el Dato_cadena a entero*/ Datos[indiceDato] = atoi(Dato_cadena); indiceDato++; /* Muestra los datos ingresados en pantalla */ for (int i = 0; i < (int)sizeof(Datos) / (int)sizeof(Datos[0]); i++) { if (Datos[i] != 0) { printf(" %d, ", Datos[i]); } } gotoxy(4, 15); printf("ESCAPE para terminar"); printf("\t\t\tENTER para continuar"); /* Lee las 'teclas' del teclado */ for (;;) { hidecursor(); entrada = getkey(); /*printf("%d\n", entrada);*/ if (entrada == 0) /* ESCAPE 0*/ { salir = 0; break; } if (entrada == 1) /* ENTER 1*/ { salir = 1; break; } } } else { salir = 1; } showcursor(); } while (salir == 1); }
void start_terminal() { char c; byte echo = 1, cnt = 0; write_inverse(6, 30, " SELECT BAUD RATE "); write_inverse(7, 30, " 1: 1200 "); write_inverse(8, 30, " 2: 2400 "); write_inverse(9, 30, " 3: 4800 "); write_inverse(10, 30, " 4: 9600 "); write_inverse(11, 30, " 5: 19200 "); write_inverse(12, 30, " 6: 38400 "); write_inverse(13, 30, " 7: 57600 "); write_inverse(14, 30, " 8: 115200 "); do { c = getchar(); } while (!(c >= '1' && c <= '8')); // set baud rate io_write(170, c - '0'); switch (c) { case '1': write_inverse(0, 20, "1200 BAUD"); break; case '2': write_inverse(0, 20, "2400 BAUD"); break; case '3': write_inverse(0, 20, "4800 BAUD"); break; case '4': write_inverse(0, 20, "9600 BAUD"); break; case '5': write_inverse(0, 20, "19200 BAUD"); break; case '6': write_inverse(0, 20, "38400 BAUD"); break; case '7': write_inverse(0, 20, "57600 BAUD"); break; case '8': write_inverse(0, 20, "115200 BAUD"); break; } clrscr(); showcursor(); while (1) { c = getchar(); cnt = 0; if (c == 0) { // special key c = getchar(); switch (c) { case 60: // F2 echo = 1 - echo; if (echo) write_inverse(0, 0, " F2: ECHO ON "); else write_inverse(0, 0, " F2: ECHO OFF"); break; case 66: // F8 clrscr(); break; case 68: // F10 quit_app(); break; } // switch (c) } // if (c == 0) else { io_write(171, c); if (echo) putchar(c); } // if (c == 0) else if (io_read(174)) { hidecursor(); do { c = io_read(173); if (c) putchar(c); } while (c); showcursor(); } } // while (1) } // start_terminal
R_API int r_core_visual_cmd(RCore *core, int ch) { RAsmOp op; ut64 offset = core->offset; char buf[4096]; int i, ret, offscreen, cols = core->print->cols, delta = 0; ch = r_cons_arrow_to_hjkl (ch); ch = visual_nkey (core, ch); if (ch<2) return 1; // do we need hotkeys for data references? not only calls? if (ch>='0'&& ch<='9') { ut64 off = core->asmqjmps[ch-'0']; if (off != UT64_MAX) { int delta = R_ABS ((st64)off-(st64)offset); r_io_sundo_push (core->io, offset); if (curset && delta<100) { cursor = delta; } else { r_core_visual_seek_animation (core, off); //r_core_seek (core, off, 1); } r_core_block_read (core, 1); } } else switch (ch) { case 0x0d: { r_cons_enable_mouse (R_TRUE); RAnalOp *op = r_core_anal_op (core, core->offset+cursor); if (op) { if (op->type == R_ANAL_OP_TYPE_JMP || op->type == R_ANAL_OP_TYPE_CJMP || op->type == R_ANAL_OP_TYPE_CALL) { r_io_sundo_push (core->io, offset); r_core_visual_seek_animation(core, op->jump); } } r_anal_op_free (op); } break; case 90: // shift+tab if (!strcmp (printfmt[0], "x")) printfmt[0] = "pxa"; else printfmt[0] = "x"; break; case 9: // tab { // XXX: unify diff mode detection ut64 f = r_config_get_i (core->config, "diff.from"); ut64 t = r_config_get_i (core->config, "diff.to"); if (f == t && f == 0) { core->print->col = core->print->col==1? 2: 1; } else { ut64 delta = offset - f; r_core_seek (core, t+delta, 1); r_config_set_i (core->config, "diff.from", t); r_config_set_i (core->config, "diff.to", f); } } break; case 'a': if (core->file && !(core->file->rwx & 2)) { r_cons_printf ("\nFile has been opened in read-only mode. Use -w flag\n"); r_cons_any_key (); return R_TRUE; } r_cons_printf ("Enter assembler opcodes separated with ';':\n"); showcursor (core, R_TRUE); r_cons_flush (); r_cons_set_raw (R_FALSE); strcpy (buf, "wa "); r_line_set_prompt (":> "); if (r_cons_fgets (buf+3, 1000, 0, NULL) <0) buf[0]='\0'; if (*buf) { if (curset) r_core_seek (core, core->offset + cursor, 0); r_core_cmd (core, buf, R_TRUE); if (curset) r_core_seek (core, core->offset - cursor, 1); } showcursor (core, R_FALSE); r_cons_set_raw (R_TRUE); break; case '!': r_cons_2048(); break; case 'o': visual_offset (core); break; case 'A': { int oc = curset; ut64 off = curset? core->offset+cursor : core->offset; curset = 0; r_core_visual_asm (core, off); curset = oc; } break; case 'c': setcursor (core, curset?0:1); break; case 'C': color = color? 0: 1; r_config_set_i (core->config, "scr.color", color); break; case 'd': r_core_visual_define (core); break; case 'D': setdiff (core); break; case 'f': { int range, min, max; char name[256], *n; r_line_set_prompt ("flag name: "); showcursor (core, R_TRUE); if (r_cons_fgets (name, sizeof (name), 0, NULL) >=0 && *name) { n = r_str_chop (name); if (*name=='-') { if (*n) r_flag_unset (core->flags, n+1, NULL); } else { if (ocursor != -1) { min = R_MIN (cursor, ocursor); max = R_MAX (cursor, ocursor); } else { min = max = cursor; } range = max-min+1; if (range<1) range = 1; if (*n) r_flag_set (core->flags, n, core->offset + min, range, 1); } } } showcursor (core, R_FALSE); break; case 'F': r_flag_unset_i (core->flags, core->offset + cursor, NULL); break; case 'n': r_core_seek_next (core, r_config_get (core->config, "scr.nkey")); break; case 'N': r_core_seek_previous (core, r_config_get (core->config, "scr.nkey")); break; case 'i': case 'I': if (core->file && !(core->file->rwx & 2)) { r_cons_printf ("\nFile has been opened in read-only mode. Use -w flag\n"); r_cons_any_key (); return R_TRUE; } showcursor (core, R_TRUE); r_cons_flush (); r_cons_set_raw (0); if (ch=='I') { strcpy (buf, "wow "); r_line_set_prompt ("insert hexpair block: "); if (r_cons_fgets (buf+4, sizeof (buf)-5, 0, NULL) <0) buf[0]='\0'; char *p = strdup (buf); int cur = core->print->cur; if (cur>=core->blocksize) cur = core->print->cur-1; snprintf (buf, sizeof (buf), "%s @ $$0!%i", p, core->blocksize-cursor); r_core_cmd (core, buf, 0); free (p); break; } delta = (ocursor!=-1)? R_MIN (cursor, ocursor): cursor; if (core->print->col==2) { strcpy (buf, "\"w "); r_line_set_prompt ("insert string: "); if (r_cons_fgets (buf+3, sizeof (buf)-4, 0, NULL) <0) buf[0]='\0'; strcat (buf, "\""); } else { r_line_set_prompt ("insert hex: "); if (ocursor != -1) { int bs = R_ABS (cursor-ocursor)+1; core->blocksize = bs; strcpy (buf, "wow "); } else { strcpy (buf, "wx "); } if (r_cons_fgets (buf+strlen (buf), sizeof (buf)-strlen (buf), 0, NULL) <0) buf[0]='\0'; } if (curset) r_core_seek (core, core->offset + delta, 0); r_core_cmd (core, buf, 1); if (curset) r_core_seek (core, offset, 1); r_cons_set_raw (1); showcursor (core, R_FALSE); break; case 'R': r_core_cmd0 (core, "ecr"); break; case 'e': r_core_visual_config (core); break; case 'E': r_core_visual_colors (core); break; case 'M': r_core_visual_mounts (core); break; case 't': r_core_visual_trackflags (core); break; case 'x': { int count = 0; RList *xrefs = NULL; RAnalRef *refi; RListIter *iter; RAnalFunction *fun; if ((xrefs = r_anal_xref_get (core->anal, core->offset))) { r_cons_gotoxy (1, 1); r_cons_printf ("[GOTO XREF]> \n"); if (r_list_empty (xrefs)) { r_cons_printf ("\tNo XREF found at 0x%"PFMT64x"\n", core->offset); r_cons_any_key (); r_cons_clear00 (); } else { r_list_foreach (xrefs, iter, refi) { fun = r_anal_fcn_find (core->anal, refi->addr, R_ANAL_FCN_TYPE_NULL); r_cons_printf (" [%i] 0x%08"PFMT64x" %s XREF 0x%08"PFMT64x" (%s) \n", count, refi->at, refi->type==R_ANAL_REF_TYPE_CODE?"CODE (JMP)": refi->type==R_ANAL_REF_TYPE_CALL?"CODE (CALL)":"DATA", refi->addr, fun?fun->name:"unk"); if (++count > 9) break; } } } else xrefs = NULL;