From e6c5e00908044e44799a0916f1c346fe5c341c81 Mon Sep 17 00:00:00 2001 From: condret Date: Mon, 21 Oct 2024 01:54:19 +0200 Subject: [PATCH] bla --- include/gb.h | 19 ++++++++++++++++--- io/joypad.c | 4 ++-- io/timers.c | 4 ++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/include/gb.h b/include/gb.h index d836b9d..ca1f0b3 100644 --- a/include/gb.h +++ b/include/gb.h @@ -22,7 +22,7 @@ typedef struct gb_timers_t { GBTimers *gb_timers_open(RIO *io); void gb_timers_update(GBTimers *timers, ut32 cycles); -void gb_timers_close(RIO *io, GBTimers *timers); +void gb_timers_close(GBTimers *timers, RIO *io); typedef struct gb_joypad_t { ut8 *keys; @@ -41,9 +41,22 @@ typedef struct gb_joypad_t { GBJoypad *gb_joypad_open(RIO *io); void gb_joypad_update(GBJoypad *joypad); -void gb_joypad_close(RIO *io, GBJoypad *joypad); +void gb_joypad_close(GBJoypad *joypad, RIO *io); -//int gb_mbc1_open(RIO *io, char *path); +typedef struct gb_dma_t { + int dma_fd; //fd representing the dma register + int dma_bus_fd; //fd representing the memory bus while dma occupies it + ut16 bus_occupancy_size; + ut8 buf[0xa0]; + ut8 dst; //current dst addr low byte + ut8 todo; //cycles todo + ut8 frontrun; //cycles that read/write ops had frontrun the dma copy + ut8 val; +} GBDMA; + +GBDMA *gb_dma_open(RIO *io); +void gb_dma_update(GBDMA *dma, RIO *io, ut32 cycles); +void gb_dma_close(GBDMA *dma, RIO *io); extern RIOPlugin r_io_plugin_gb_timers; extern RIOPlugin r_io_plugin_gb_mbc1; diff --git a/io/joypad.c b/io/joypad.c index 24e2b27..308b23d 100644 --- a/io/joypad.c +++ b/io/joypad.c @@ -135,8 +135,8 @@ void gb_joypad_update(GBJoypad *joypad) { } } -void gb_joypad_close (RIO *io, GBJoypad *joypad) { - if (!io || !joypad) { +void gb_joypad_close (GBJoypad *joypad, RIO *io) { + if (!joypad || !io) { return; } r_io_fd_close (io, joypad->fd); diff --git a/io/timers.c b/io/timers.c index a0b44c9..e1bfcf0 100644 --- a/io/timers.c +++ b/io/timers.c @@ -122,8 +122,8 @@ GBTimers *gb_timers_open (RIO *io) { return timers; } -void gb_timers_close (RIO *io, GBTimers *timers) { - if (!io || !timers) { +void gb_timers_close (GBTimers *timers, RIO *io) { + if (!timers || !io) { return; } r_io_fd_close (io, timers->fd);