2019-09-19 21:07:16 +02:00
|
|
|
#include <fxengine/fxengine.h>
|
|
|
|
#include <fxengine/zbuffer.h>
|
|
|
|
|
|
|
|
#include <gint/std/stdio.h>
|
|
|
|
#include <gint/display.h>
|
|
|
|
|
|
|
|
#include <gint/exc.h>
|
|
|
|
#include <gint/defs/attributes.h>
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef USE_LIBPROF
|
|
|
|
|
|
|
|
#include <libprof.h>
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef USE_LIBLOG
|
|
|
|
|
|
|
|
#include <liblog.h>
|
|
|
|
|
|
|
|
GNORETURN void system_error(uint32_t code)
|
|
|
|
{
|
2019-09-26 19:09:59 +02:00
|
|
|
ll_display();
|
2019-09-19 21:07:16 +02:00
|
|
|
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
|
2019-09-26 19:09:59 +02:00
|
|
|
ll_send("VRAM contents sent.");
|
2019-09-19 21:07:16 +02:00
|
|
|
#endif
|
|
|
|
dclear(C_WHITE);
|
|
|
|
|
|
|
|
#ifdef USE_LIBLOG
|
2019-09-26 19:09:59 +02:00
|
|
|
ll_send("VRAM cleared.");
|
2019-09-19 21:07:16 +02:00
|
|
|
#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_interval<frame_interval_min)
|
|
|
|
frame_interval_min = frame_interval;
|
|
|
|
if (frame_interval>frame_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);
|
2019-09-26 19:09:59 +02:00
|
|
|
ll_send(fps_str);
|
2019-09-19 21:07:16 +02:00
|
|
|
#else
|
2019-09-26 19:09:59 +02:00
|
|
|
ll_send(">> FPS not available");
|
2019-09-19 21:07:16 +02:00
|
|
|
#endif
|
|
|
|
//dclear(C_WHITE);
|
|
|
|
}
|
|
|
|
|