From 9cf5044430cb8f86044bb19c2f865a5878f97a10 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 26 Feb 2015 00:50:34 +0100 Subject: [PATCH] Add frame_count to nbio and image --- general.h | 4 +++- runloop_data.c | 25 +++++++++++++++---------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/general.h b/general.h index 31e57ba452..9f9e854283 100644 --- a/general.h +++ b/general.h @@ -403,9 +403,10 @@ typedef struct nbio_image_handle bool is_blocking; bool is_finished; transfer_cb_t cb; - msg_queue_t *msg_queue; struct rpng_t *handle; unsigned pos_increment; + uint64_t frame_count; + msg_queue_t *msg_queue; } nbio_image_handle_t; typedef struct nbio_handle @@ -416,6 +417,7 @@ typedef struct nbio_handle transfer_cb_t cb; struct nbio_t *handle; unsigned pos_increment; + uint64_t frame_count; msg_queue_t *msg_queue; } nbio_handle_t; diff --git a/runloop_data.c b/runloop_data.c index 06490c9594..cfb08d9763 100644 --- a/runloop_data.c +++ b/runloop_data.c @@ -248,18 +248,19 @@ static int rarch_main_iterate_image_transfer(nbio_handle_t *nbio) for (i = 0; i < nbio->image.pos_increment; i++) { - if (rpng_nbio_load_image_argb_iterate( + if (!rpng_nbio_load_image_argb_iterate( nbio->image.handle->buff_data, nbio->image.handle)) - { - nbio->image.handle->buff_data += - 4 + 4 + nbio->image.handle->chunk.size + 4; - return 0; - } - else - break; + goto error; + + nbio->image.handle->buff_data += + 4 + 4 + nbio->image.handle->chunk.size + 4; } + nbio->image.frame_count++; + return 0; + +error: return -1; } @@ -383,10 +384,14 @@ static int rarch_main_iterate_nbio_transfer(nbio_handle_t *nbio) for (i = 0; i < nbio->pos_increment; i++) { - if (!nbio_iterate(nbio->handle)) - return 0; + if (nbio_iterate(nbio->handle)) + goto error; } + nbio->frame_count++; + return 0; + +error: return -1; }