Example #1
0
R_API void r_cons_visual_flush() {
	if (I.noflush)
		return;
	r_cons_highlight (I.highlight);
	if (!I.null) {
/* TODO: this ifdef must go in the function body */
#if __WINDOWS__ && !__CYGWIN__
		r_cons_w32_print ((const ut8*)I.buffer, I.buffer_len, 1);
#else
		r_cons_visual_write (I.buffer);
#endif
	}
	r_cons_reset ();
	if (I.fps) {
		int w = r_cons_get_size (NULL);
		int fps = 0;
		static ut64 prev = 0LL; //r_sys_now ();
		fps = 0;
		if (prev) {
			ut64 now = r_sys_now ();
			ut64 diff = now-prev;
			fps = (diff<1000000)? (1000000/diff): 0;
			prev = now;
		} else prev = r_sys_now ();
		eprintf ("\x1b[0;%dH[%d FPS] \n", w-10, fps);
	}
}
Example #2
0
R_API bool r_cons_is_breaked() {
	if (I.timeout) {
		if (r_sys_now () > I.timeout) {
			I.breaked = true;
			eprintf ("\nTimeout!\n");
			I.timeout = 0;
		}
	}
	return I.breaked;
}
Example #3
0
R_API void r_cons_break_timeout(int timeout) {
	if (!timeout && I.timeout) {
		I.timeout = 0;
	} else {
		if (timeout) {
			I.timeout = r_sys_now () + (timeout * 1000000);
		} else {
			I.timeout = 0;
		}
	}
}
Example #4
0
R_API void r_num_irand() {
	srand (r_sys_now ());
}