diff --git a/release.mk.in b/release.mk.in index 296b004..4398f45 100644 --- a/release.mk.in +++ b/release.mk.in @@ -1,4 +1,4 @@ MAJOR = 1 -MINOR = 4 -PATCH = 2 +MINOR = 6 +PATCH = 1 diff --git a/src/c64emu/c64emu.c b/src/c64emu/c64emu.c index 54b3939..7ed757b 100644 --- a/src/c64emu/c64emu.c +++ b/src/c64emu/c64emu.c @@ -151,6 +151,7 @@ core_start() static void _configure_video_50hz() { + ntsc_clks_second = NTSC_FRAME_CLKS * 50; pal_clks_second = PAL_FRAME_CLKS * 50; @@ -228,6 +229,7 @@ emu_sound_scale_enable( int e ) static void set_model_ntsc( emu_screen_t *sc ) { + // This will cause a HARD reset resources_set_int("MachineVideoStandard", MACHINE_SYNC_NTSC ); @@ -245,6 +247,7 @@ set_model_ntsc( emu_screen_t *sc ) static void set_model_pal( emu_screen_t *sc ) { + // This will cause a HARD reset resources_set_int("MachineVideoStandard", MACHINE_SYNC_PAL ); diff --git a/src/ui/usb.h b/src/ui/usb.h index d97caa6..f19813e 100644 --- a/src/ui/usb.h +++ b/src/ui/usb.h @@ -18,7 +18,8 @@ #include #include -# define _BASE_USB_MOUNT_POINT "/mnt" +#define _BASE_USB_MOUNT_POINT "/mnt" + # define USB_MOUNT_POINT _BASE_USB_MOUNT_POINT #endif diff --git a/src/viceport/bind.c b/src/viceport/bind.c index 0c6cdc1..b32853b 100644 --- a/src/viceport/bind.c +++ b/src/viceport/bind.c @@ -19,6 +19,7 @@ #include "datasette.h" #include "c64/c64-snapshot.h" #include "vicii.h" +#include "emumousedrv.h" // Import emu_load_params_t definition #include "emu_bind_decl.h" @@ -293,3 +294,44 @@ emu_cassette_control( emu_media_cassette_command_t command ) } return r; } + +void emu_joystick_enable( int count ) +{ + // If more than 2 ports are being set up, then enable user-port joystick support + resources_set_int("ExtraJoy", count > 2 ); +} + +void emu_mouse_enable( int port, int state ) +{ + resources_set_int("Mousetype", MOUSE_TYPE_1351 ); + resources_set_int("Mouseport", port == 2 ? 2 : 1 ); + resources_set_int("Mouse", state == 1 ); +} + +void emu_mouse_position( int x, int y ) +{ + mouse_move( x, y ); +} + +void emu_mouse_button( emu_mouse_control b, int state ) +{ + switch(b) { + case EMU_MOUSE_BUTTON_LEFT: + mouse_button_left( state != 0 ); + break; + case EMU_MOUSE_BUTTON_RIGHT: + mouse_button_right( state != 0 ); + break; + case EMU_MOUSE_BUTTON_MIDDLE: + mouse_button_middle( state != 0 ); + break; + case EMU_MOUSE_BUTTON_WHEEL_UP: + mouse_button_up( state != 0 ); + break; + case EMU_MOUSE_BUTTON_WHEEL_DOWN: + mouse_button_down( state != 0 ); + break; + default: + break; + } +} diff --git a/src/viceport/emucore.h b/src/viceport/emucore.h index 88066b4..083afb0 100644 --- a/src/viceport/emucore.h +++ b/src/viceport/emucore.h @@ -20,6 +20,8 @@ #include "autostart.h" #include "joystick.h" +#include "mouse.h" +#include "emumousedrv.h" #include "videoarch.h" @@ -38,6 +40,7 @@ void emu_start_frame(); void emu_core_reset( emu_reset_type_t rt ); void emu_set_vertical_shift( int adjust ); +void emu_mouse_enable( int port, int state ); void core_cartridge_attach_image( const char *filename ); void core_cartridge_trigger_freeze(); diff --git a/src/viceport/emumousedrv.h b/src/viceport/emumousedrv.h new file mode 100644 index 0000000..0cbc1b8 --- /dev/null +++ b/src/viceport/emumousedrv.h @@ -0,0 +1,33 @@ +/* + * THEC64 Mini + * Copyright (C) 2021 Chris Smith + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef EMU_CORE_MOUSEDRV_H +#define EMU_CORE_MOUSEDRV_H + +typedef enum { + EMU_MOUSE_NONE, + EMU_MOUSE_AXIS, + EMU_MOUSE_BUTTON_LEFT, + EMU_MOUSE_BUTTON_RIGHT, + EMU_MOUSE_BUTTON_MIDDLE, + EMU_MOUSE_BUTTON_WHEEL_UP, + EMU_MOUSE_BUTTON_WHEEL_DOWN, +} emu_mouse_control; + +void mouse_move( int x, int y ); + +#endif diff --git a/src/viceport/mousedrv.c b/src/viceport/mousedrv.c index 3b81e5e..5e6b1db 100644 --- a/src/viceport/mousedrv.c +++ b/src/viceport/mousedrv.c @@ -15,17 +15,40 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + +#include "mouse.h" +#include "vsyncapi.h" +#include "emumousedrv.h" + +int mouse_x = 0, mouse_y = 0; +int mouse_accelx = 2, mouse_accely = 2; +static unsigned long mouse_timestamp = 0; + void mousedrv_mouse_changed(void) { } int mousedrv_resources_init(void) { return 0; } int mousedrv_cmdline_options_init(void) { return 0; } -void mousedrv_init(void) { } +void mousedrv_init(void) { } -void mouse_button(int bnumber, int state) { } +int mousedrv_get_x(void) +{ + return mouse_x; +} -int mousedrv_get_x(void) { return 0; } +int mousedrv_get_y(void) +{ + return mouse_y; +} -int mousedrv_get_y(void) { return 0; } +void mouse_move( int dx, int dy ) +{ + mouse_x += dx; + mouse_y -= dy; + mouse_x &= 65535; + mouse_y &= 65535; + mouse_timestamp = vsyncarch_gettime(); +} -void mouse_move(float dx, float dy) { } - -unsigned long mousedrv_get_timestamp(void) { return 0; } +unsigned long mousedrv_get_timestamp(void) +{ + return mouse_timestamp; +}