Updates for 1351 mouse support and to enable multi joysticks.
This commit is contained in:
parent
45fe94a125
commit
10923fef43
7 changed files with 115 additions and 10 deletions
|
@ -1,4 +1,4 @@
|
|||
MAJOR = 1
|
||||
MINOR = 4
|
||||
PATCH = 2
|
||||
MINOR = 6
|
||||
PATCH = 1
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
# define _BASE_USB_MOUNT_POINT "/mnt"
|
||||
#define _BASE_USB_MOUNT_POINT "/mnt"
|
||||
|
||||
# define USB_MOUNT_POINT _BASE_USB_MOUNT_POINT
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
33
src/viceport/emumousedrv.h
Normal file
33
src/viceport/emumousedrv.h
Normal file
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#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
|
|
@ -15,17 +15,40 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue