Skip to content

Commit

Permalink
Fixed broken libretro frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-jonsson committed Nov 10, 2023
1 parent 6611c64 commit 78872a9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion modules/cga/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static struct vxt_pirepheral *cga_module_create(vxt_allocator *alloc, void *fron
return NULL;

struct frontend_interface *fi = (struct frontend_interface*)frontend;
if (fi->set_video_adapter) {
if (fi && fi->set_video_adapter) {
struct frontend_video_adapter a = {
p,
&cga_border_color,
Expand Down
20 changes: 11 additions & 9 deletions modules/chipset/pcxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,17 @@ static struct vxt_pirepheral *ppi_create(vxt_allocator *alloc, void *frontend, c
if (!p)
return NULL;

struct frontend_interface *fi = (struct frontend_interface*)frontend;
if (fi->set_keyboard_controller) {
struct frontend_keyboard_controller controller = { p, &vxtu_ppi_key_event };
fi->set_keyboard_controller(&controller);
}
if (fi->set_audio_adapter) {
struct frontend_audio_adapter adapter = { p, &vxtu_ppi_generate_sample };
fi->set_audio_adapter(&adapter);
}
if (frontend) {
struct frontend_interface *fi = (struct frontend_interface*)frontend;
if (fi->set_keyboard_controller) {
struct frontend_keyboard_controller controller = { p, &vxtu_ppi_key_event };
fi->set_keyboard_controller(&controller);
}
if (fi->set_audio_adapter) {
struct frontend_audio_adapter adapter = { p, &vxtu_ppi_generate_sample };
fi->set_audio_adapter(&adapter);
}
}

p->config = &ppi_config;
return p;
Expand Down
6 changes: 4 additions & 2 deletions modules/disk/disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@

static struct vxt_pirepheral *disk_create(vxt_allocator *alloc, void *frontend, const char *args) {
(void)args;

struct frontend_interface *fi = (struct frontend_interface*)frontend;
if (!fi) return NULL;

struct vxt_pirepheral *p = vxtu_disk_create(alloc, &fi->disk.di);
if (!p)
return NULL;
if (!p) return NULL;

if (fi->set_disk_controller) {
struct frontend_disk_controller c = {
Expand Down
2 changes: 1 addition & 1 deletion modules/mouse/mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static struct vxt_pirepheral *create(vxt_allocator *alloc, void *frontend, const
}

struct frontend_interface *fi = (struct frontend_interface*)frontend;
if (fi->set_mouse_adapter) {
if (fi && fi->set_mouse_adapter) {
struct frontend_mouse_adapter a;
a.device = (struct vxt_pirepheral*)PIREPHERAL;
a.push_event = &push_event;
Expand Down

0 comments on commit 78872a9

Please sign in to comment.