static void conio_display(caca_display_t *dp) { char *screen = dp->drv.p->screen; uint32_t const *chars = caca_get_canvas_chars(dp->cv); uint32_t const *attrs = caca_get_canvas_attrs(dp->cv); int width = caca_get_canvas_width(dp->cv); int height = caca_get_canvas_height(dp->cv); int n; for(n = height * width; n--; ) { char ch = caca_utf32_to_cp437(*chars++); if(n && *chars == CACA_MAGIC_FULLWIDTH) { *screen++ = '['; *screen++ = caca_attr_to_ansi(*attrs++); ch = ']'; chars++; n--; } *screen++ = ch; *screen++ = caca_attr_to_ansi(*attrs++); } # if defined(SCREENUPDATE_IN_PC_H) ScreenUpdate(dp->drv.p->screen); # else /* FIXME */ # endif }
void retro_run(void) { static int mfirst=1; bool updated = false; if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated) update_variables(); if(mfirst==1) { mfirst++; printf("MAIN FIRST\n"); retro_load_ok=true; Emu_init(); return; } if(pauseg==0) { retro_loop(); ScreenUpdate(); //update_input(); retro_poll_event(0); retro_blit(); if(SHOWKEY==1)app_render(0); } else if (pauseg==1)app_render(1); //app_render(pauseg); video_cb(Retro_Screen,retrow,retroh,retrow<<PIXEL_BYTES); if(want_quit)retro_shutdown_core(); }
void TIM2_IRQHandler() { // Checks whether the TIM2 interrupt has occurred or not if (TIM_GetITStatus(TIM2, TIM_IT_Update)) { // Scan 1 row every 1ms timer interrupt ScreenUpdate(); // Clears the TIM2 interrupt pending bit TIM_ClearITPendingBit(TIM2, TIM_IT_Update); } }
/* Read the key press using ncurses, and perform the requested action */ void ScreenHandleInput(Screen *s) { /* this is non-blocking */ int c = getch(); switch(c) { case KEY_UP: screen_scroll_up(s); break; case KEY_DOWN: screen_scroll_down(s); break; case KEY_LEFT: screen_scroll_left(s); break; case KEY_RIGHT: screen_scroll_right(s); break; case KEY_NPAGE: screen_page_down(s); break; case KEY_HOME: screen_home(s); break; case KEY_END: screen_end(s); break; case KEY_PPAGE: screen_page_up(s); break; case KEY_RESIZE: break; case 9: /* TAB */ screen_next_col(s); break; case 353: /* SHIFT+TAB */ screen_prev_col(s); break; case 'p': screen_toggle_pause(s); break; case ERR: break; default: break; } ScreenUpdate(s); }
int main(int argc, char *argv[]) { char *function, *file; int lineno; #ifdef __DJGPP__ int r, c; short *sc; char buf[1024]; int i; #endif int diff = 0; unsigned v; FILE *ofile = 0; FILE *ifile = 0; if (argc < 2) { fprintf(stderr, "Usage: gsymify [-o <outfile>] [-i <tracefile>] [-a <adjust>] <program>\n"); fprintf(stderr, "This program adds debug information to DJGPP program call frame tracebacks\n"); return 1; } while (argv[1][0] == '-') { if ((strcmp(argv[1], "-a") == 0) && (argc > 3)) { diff = atoi(argv[2]); argc -= 2; argv += 2; } if ((strcmp(argv[1], "-o") == 0) && (argc > 3)) { ofile = fopen(argv[2], "w"); if (ofile == 0) fprintf(stderr, "Error: unable to open file %s\n", argv[2]); argc -= 2; argv += 2; } if ((strcmp(argv[1], "-i") == 0) && (argc > 3)) { ifile = fopen(argv[2], "r"); if (ifile == 0) fprintf(stderr, "Error: unable to open file %s\n", argv[2]); argc -= 2; argv += 2; } } progname = argv[1]; _GetProgName = GetProgName; InitRHGDB(); if (!isatty(0) && !ifile) ifile = stdin; if (!isatty(1) && !ofile) ofile = stdout; if (ifile) { char line[1000]; if (ofile == 0) ofile = stdout; while (fgets(line, 1000, ifile)) { if (strncmp(line, " 0x", 4) == 0) { sscanf(line + 4, "%x", &v); symify(line + 4, &function, &file, &lineno, diff); fprintf(ofile, " 0x%08x", v); if (function) { fprintf(ofile, " %s", function); free(function); if (file) { fprintf(ofile, ", line %d of %s", lineno, file); free(file); } } fprintf(ofile, "\n"); } else fputs(line, ofile); } fclose(ifile); fclose(ofile); return 0; } #ifdef __DJGPP__ sc = (short *) malloc(ScreenRows() * ScreenCols() * 2); ScreenRetrieve(sc); for (r = 0; r < ScreenRows(); r++) { if (SC(r, 0) == ' ' && SC(r, 1) == ' ' && SC(r, 2) == '0' && SC(r, 3) == 'x') { buf[8] = 0; for (i = 0; i < 8; i++) buf[i] = SC(r, i + 4); sscanf(buf, "%x", &v); symify(buf, &function, &file, &lineno, diff); buf[0] = 0; if (function) { strcpy(buf, function); free(function); } if (file) { if (buf[0]) strcat(buf, ", "); sprintf(buf + strlen(buf), "line %d of %s", lineno, file); free(file); } if (buf[0]) for (i = 0; buf[i]; i++) SW(r, 15 + i) = 0x0f00 + buf[i]; } } if (ofile) { for (r = 0; r < ScreenRows(); r++) { c = 0; for (i = 0; i < ScreenCols(); i++) if (SC(r, i) != ' ') c = i; for (i = 0; i <= c; i++) fputc(SC(r, i), ofile); fputc('\n', ofile); } fclose(ofile); } else ScreenUpdate(sc); #endif return 0; }
void display_cycle(void) { unsigned long counter; int ch; counter = loopDelay; while (--counter); if (!(cycle & keyDelay)) { #if defined(DJGPP) || defined(WATCOM) #if defined(DOSALLGRAPHX) if (displayMode == TEXT) #ifdef CONIOGRAPHX CacheScreenUpdate(Screen[CORE_PAGE]); #else ScreenUpdate((void *) Screen[CORE_PAGE]); #endif #else #if defined(DOSTXTGRAPHX) #ifdef CONIOGRAPHX CacheScreenUpdate(Screen[CORE_PAGE]); #else ScreenUpdate((void *) Screen[CORE_PAGE]); #endif #endif /* DOSTXTGRAPHX */ #endif /* DOSALLGRAPHX */ #endif /* DJGPP */ #if defined(DOSALLGRAPHX) if (displayMode != TEXT) bgi_update_cycle_meter(); #else #if defined(DOSGRXGRAPHX) bgi_update_cycle_meter(); #endif #endif if (KEYPRESSED && !inputRedirection) { switch (ch = getch()) { case '0': displayLevel = 0; break; case '1': displayLevel = 1; break; case '2': displayLevel = 2; break; case '3': displayLevel = 3; break; case '4': displayLevel = 4; break; case 'd': debugState = STEP; /* stepping = FALSE; */ break; case '>': if (displaySpeed > 0) { --displaySpeed; loopDelay = loopDelayAr[displaySpeed]; keyDelay = keyDelayAr[displaySpeed]; } break; case '<': if (displaySpeed < SPEEDLEVELS - 1) { ++displaySpeed; loopDelay = loopDelayAr[displaySpeed]; keyDelay = keyDelayAr[displaySpeed]; } break; case ' ': case 'r': #if defined(DOSALLGRAPHX) if (displayMode == TEXT) text_display_clear(); else bgi_clear_arena(); #else #if defined(DOSTXTGRAPHX) text_display_clear(); #else bgi_clear_arena(); #endif #endif break; case 27: /* escape */ case 'q': display_close(); Exit(USERABORT); #if defined(DOSALLGRAPHX) case 'v': if (displayMode == TEXT) displayMode = GRX; else bgi_display_close(NOWAIT); display_init(); break; #endif #if 0 #if defined(DOSALLGRAPHX) case '?': case 'h': if (displayMode == TEXT) disp_help(); break; #else #if defined(DOSTXTGRAPHX) case '?': case 'h': disp_help(); break; #endif #endif #endif /* 0 */ default: if (ch > 32 && ch < 128) ch += 128; ungetch(ch); debugState = STEP; break; } #if defined(DOSALLGRAPHX) if (displayMode != TEXT) write_menu(); #else #if defined(DOSGRXGRAPHX) write_menu(); #endif #endif } } }