This commit is contained in:
condret 2024-10-21 01:54:19 +02:00
parent dda0cf5006
commit e6c5e00908
3 changed files with 20 additions and 7 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);