#include #include #include #include #include #include #ifdef USE_LIBPROF #include #endif #ifdef USE_LIBLOG #include GNORETURN void system_error(uint32_t code) { ll_display(); while(1) getkey(); } #endif void fe_custom_panic() { #ifdef USE_LIBLOG gint_panic_set(system_error); #endif } #ifdef USE_LIBPROF static uint32_t frame_interval_min=1000000; static uint32_t frame_interval_max=1; static uint32_t fps=0; #endif int32_t fe_get_fps() { #ifdef USE_LIBPROF return fps; #else return -1; #endif } void fe_display(const uint32_t libprof_channel) { fe_update(libprof_channel); dupdate(); #ifdef USE_LIBLOG ll_send("VRAM contents sent."); #endif dclear(C_WHITE); #ifdef USE_LIBLOG ll_send("VRAM cleared."); #endif } void fe_update(const uint32_t libprof_channel) { ///dupdate(); #ifdef USE_LIBPROF // gestion du temps avec libprof if (prof_elapsed) { prof_leave(libprof_channel); uint32_t frame_interval = prof_time(libprof_channel); //sleep_us(0, MINIMUM_FRAME_DELAY-frame_interval); if (frame_intervalframe_interval_max) frame_interval_max = frame_interval; fps=1000000/frame_interval; } else { prof_init(libprof_channel+1, 0); } //dupdate(); prof_clear(libprof_channel); prof_enter(libprof_channel); #endif fe_zbuffer_clear(); #ifdef USE_LIBLOG char fps_str[10]; sprintf(fps_str, ">> FPS = %d", fps); ll_send(fps_str); #else ll_send(">> FPS not available"); #endif //dclear(C_WHITE); }