Add frame_count to nbio and image

This commit is contained in:
twinaphex 2015-02-26 00:50:34 +01:00
parent ea99f00016
commit 9cf5044430
2 changed files with 18 additions and 11 deletions

View File

@ -403,9 +403,10 @@ typedef struct nbio_image_handle
bool is_blocking; bool is_blocking;
bool is_finished; bool is_finished;
transfer_cb_t cb; transfer_cb_t cb;
msg_queue_t *msg_queue;
struct rpng_t *handle; struct rpng_t *handle;
unsigned pos_increment; unsigned pos_increment;
uint64_t frame_count;
msg_queue_t *msg_queue;
} nbio_image_handle_t; } nbio_image_handle_t;
typedef struct nbio_handle typedef struct nbio_handle
@ -416,6 +417,7 @@ typedef struct nbio_handle
transfer_cb_t cb; transfer_cb_t cb;
struct nbio_t *handle; struct nbio_t *handle;
unsigned pos_increment; unsigned pos_increment;
uint64_t frame_count;
msg_queue_t *msg_queue; msg_queue_t *msg_queue;
} nbio_handle_t; } nbio_handle_t;

View File

@ -248,18 +248,19 @@ static int rarch_main_iterate_image_transfer(nbio_handle_t *nbio)
for (i = 0; i < nbio->image.pos_increment; i++) 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->buff_data,
nbio->image.handle)) nbio->image.handle))
{ goto error;
nbio->image.handle->buff_data +=
4 + 4 + nbio->image.handle->chunk.size + 4; nbio->image.handle->buff_data +=
return 0; 4 + 4 + nbio->image.handle->chunk.size + 4;
}
else
break;
} }
nbio->image.frame_count++;
return 0;
error:
return -1; 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++) for (i = 0; i < nbio->pos_increment; i++)
{ {
if (!nbio_iterate(nbio->handle)) if (nbio_iterate(nbio->handle))
return 0; goto error;
} }
nbio->frame_count++;
return 0;
error:
return -1; return -1;
} }