From 4b45de9d7c959e1e328fa5b3c97e08dadd3c73ba Mon Sep 17 00:00:00 2001 From: Anthony Pesch Date: Tue, 18 Jul 2017 00:07:37 -0400 Subject: [PATCH] removed inter-frame input polling --- src/emulator.c | 7 ------- src/guest/dreamcast.c | 8 -------- src/guest/dreamcast.h | 3 --- src/guest/maple/controller.c | 8 -------- src/host/host.h | 1 - src/host/retro_host.c | 6 +++--- 6 files changed, 3 insertions(+), 30 deletions(-) diff --git a/src/emulator.c b/src/emulator.c index a30dabcc..96a484b0 100644 --- a/src/emulator.c +++ b/src/emulator.c @@ -335,12 +335,6 @@ static void emu_start_tracing(struct emu *emu) { /* * dreamcast guest interface */ -static void emu_guest_poll_input(void *userdata) { - struct emu *emu = userdata; - - input_poll(emu->host); -} - static void emu_guest_vertical_blank(void *userdata) { struct emu *emu = userdata; @@ -759,7 +753,6 @@ struct emu *emu_create(struct host *host) { emu->dc->start_render = &emu_guest_start_render; emu->dc->finish_render = &emu_guest_finish_render; emu->dc->vertical_blank = &emu_guest_vertical_blank; - emu->dc->poll_input = &emu_guest_poll_input; /* add all textures to free list by default */ for (int i = 0; i < array_size(emu->textures); i++) { diff --git a/src/guest/dreamcast.c b/src/guest/dreamcast.c index a4a45283..9d0fcf65 100644 --- a/src/guest/dreamcast.c +++ b/src/guest/dreamcast.c @@ -16,14 +16,6 @@ #include "guest/scheduler.h" #include "guest/sh4/sh4.h" -void dc_poll_input(struct dreamcast *dc) { - if (!dc->poll_input) { - return; - } - - dc->poll_input(dc->userdata); -} - void dc_vertical_blank(struct dreamcast *dc) { if (!dc->vertical_blank) { return; diff --git a/src/guest/dreamcast.h b/src/guest/dreamcast.h index 84a8fe45..ff71713d 100644 --- a/src/guest/dreamcast.h +++ b/src/guest/dreamcast.h @@ -126,7 +126,6 @@ typedef void (*push_audio_cb)(void *, const int16_t *, int); typedef void (*start_render_cb)(void *, struct tile_context *); typedef void (*finish_render_cb)(void *); typedef void (*vertical_blank_cb)(void *); -typedef void (*poll_input_cb)(void *); struct dreamcast { int running; @@ -156,7 +155,6 @@ struct dreamcast { start_render_cb start_render; finish_render_cb finish_render; vertical_blank_cb vertical_blank; - poll_input_cb poll_input; }; struct dreamcast *dc_create(); @@ -195,6 +193,5 @@ void dc_push_audio(struct dreamcast *dc, const int16_t *data, int frames); void dc_start_render(struct dreamcast *dc, struct tile_context *ctx); void dc_finish_render(struct dreamcast *dc); void dc_vertical_blank(struct dreamcast *dc); -void dc_poll_input(struct dreamcast *dc); #endif diff --git a/src/guest/maple/controller.c b/src/guest/maple/controller.c index 3f95a30c..bc740124 100644 --- a/src/guest/maple/controller.c +++ b/src/guest/maple/controller.c @@ -33,12 +33,6 @@ struct controller { struct maple_cond cnd; }; -static void controller_update(struct controller *ctrl) { - /* dc_poll_input will call into controller_input if new values are - available */ - dc_poll_input(ctrl->dc); -} - static int controller_input(struct maple_device *dev, int button, int16_t value) { struct controller *ctrl = (struct controller *)dev; @@ -101,8 +95,6 @@ static int controller_frame(struct maple_device *dev, } case MAPLE_REQ_GETCOND: { - controller_update(ctrl); - res->header.command = MAPLE_RES_TRANSFER; res->header.recv_addr = frame->header.send_addr; res->header.send_addr = frame->header.recv_addr; diff --git a/src/host/host.h b/src/host/host.h index 4e3896b3..3febc549 100644 --- a/src/host/host.h +++ b/src/host/host.h @@ -30,7 +30,6 @@ struct render_backend *video_create_renderer(struct host *host); void video_destroy_renderer(struct host *host, struct render_backend *r); /* input */ -void input_poll(struct host *host); int16_t input_get(struct host *host, int port, int button); #endif diff --git a/src/host/retro_host.c b/src/host/retro_host.c index eda9581e..11ab8f5c 100644 --- a/src/host/retro_host.c +++ b/src/host/retro_host.c @@ -112,9 +112,7 @@ int video_width(struct host *base) { /* * input */ -void input_poll(struct host *base) { - struct retro_host *host = (struct retro_host *)base; - +static void input_poll(struct retro_host *host) { input_poll_cb(); /* send updates for any inputs that've changed */ @@ -265,6 +263,8 @@ void retro_set_controller_port_device(unsigned port, unsigned device) {} void retro_reset() {} void retro_run() { + input_poll(g_host); + /* bind the framebuffer provided by retroarch before calling into the emulator */ uintptr_t fb = hw_render.get_current_framebuffer();