From 2f552b15aa9e0aa80488c00c2190e9a25b578f87 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Wed, 17 Jun 2020 17:34:54 +0200 Subject: refactoring --- src/assets.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/assets.c') diff --git a/src/assets.c b/src/assets.c index e693d7f..e2452fb 100644 --- a/src/assets.c +++ b/src/assets.c @@ -33,8 +33,38 @@ inline static bool is_big_endian() return !((*((uint8_t*)(&i))) == 0x67); } +void assets_stop_if_done() +{ + if (global_asset_collection.queue.queue.length == 0 && !global_asset_collection.done_loading_assets) + { + global_asset_collection.done_loading_assets = true; + +#ifdef MODE_TIMESTARTUP + abort(); +#endif + +#if defined(MODE_DEBUGMEM) && !defined(MODE_TEST) + printf("allocated at startup: %dkb\n", __total_allocated/1000); + printf("reallocated at startup: %dkb\n", __total_reallocated/1000); +#endif + +#if defined(MODE_DEVELOPER) && !defined(MODE_TEST) + printf("frames drawn with missing assets: %d\n", __frames_drawn_with_missing_assets); +#endif + } + +#ifdef MODE_DEVELOPER + if (global_asset_collection.queue.queue.length != 0 && !global_asset_collection.done_loading_assets) + { + __frames_drawn_with_missing_assets++; + } +#endif +} + bool assets_do_post_process() { + assets_stop_if_done(); + bool result = false; mutex_lock(&asset_mutex); -- cgit v1.2.3-70-g09d2