vice-emu-commit Mailing List for VICE (Page 9)
Versatile Commodore Emulator
Brought to you by:
blackystardust,
gpz
You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
(38) |
May
(60) |
Jun
(122) |
Jul
(148) |
Aug
(178) |
Sep
(151) |
Oct
(131) |
Nov
(208) |
Dec
(129) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(193) |
Feb
(209) |
Mar
(221) |
Apr
(243) |
May
(165) |
Jun
(168) |
Jul
(198) |
Aug
(161) |
Sep
(103) |
Oct
(98) |
Nov
(168) |
Dec
(99) |
2010 |
Jan
(263) |
Feb
(156) |
Mar
(57) |
Apr
(93) |
May
(85) |
Jun
(124) |
Jul
(57) |
Aug
(58) |
Sep
(113) |
Oct
(148) |
Nov
(114) |
Dec
(193) |
2011 |
Jan
(200) |
Feb
(207) |
Mar
(91) |
Apr
(91) |
May
(142) |
Jun
(104) |
Jul
(115) |
Aug
(137) |
Sep
(266) |
Oct
(91) |
Nov
(85) |
Dec
(186) |
2012 |
Jan
(98) |
Feb
(146) |
Mar
(160) |
Apr
(99) |
May
(59) |
Jun
(257) |
Jul
(84) |
Aug
(103) |
Sep
(169) |
Oct
(206) |
Nov
(90) |
Dec
(296) |
2013 |
Jan
(294) |
Feb
(130) |
Mar
(36) |
Apr
(14) |
May
(51) |
Jun
(74) |
Jul
(180) |
Aug
(85) |
Sep
(26) |
Oct
(45) |
Nov
(29) |
Dec
(21) |
2014 |
Jan
(56) |
Feb
(40) |
Mar
(57) |
Apr
(30) |
May
(31) |
Jun
(11) |
Jul
(107) |
Aug
(135) |
Sep
(142) |
Oct
(195) |
Nov
(139) |
Dec
(133) |
2015 |
Jan
(293) |
Feb
(161) |
Mar
(146) |
Apr
(85) |
May
(139) |
Jun
(51) |
Jul
(21) |
Aug
(24) |
Sep
(29) |
Oct
(136) |
Nov
(212) |
Dec
(118) |
2016 |
Jan
(119) |
Feb
(165) |
Mar
(229) |
Apr
(219) |
May
(134) |
Jun
(119) |
Jul
(134) |
Aug
(236) |
Sep
(203) |
Oct
(215) |
Nov
(300) |
Dec
(140) |
2017 |
Jan
(188) |
Feb
(20) |
Mar
(147) |
Apr
(198) |
May
(26) |
Jun
(21) |
Jul
(67) |
Aug
(219) |
Sep
(209) |
Oct
(194) |
Nov
(144) |
Dec
(99) |
2018 |
Jan
(139) |
Feb
(122) |
Mar
(116) |
Apr
(85) |
May
(232) |
Jun
(181) |
Jul
(190) |
Aug
(105) |
Sep
(92) |
Oct
(178) |
Nov
(105) |
Dec
(86) |
2019 |
Jan
(119) |
Feb
(79) |
Mar
(74) |
Apr
(117) |
May
(115) |
Jun
(307) |
Jul
(107) |
Aug
(131) |
Sep
(103) |
Oct
(60) |
Nov
(118) |
Dec
(70) |
2020 |
Jan
(114) |
Feb
(103) |
Mar
(77) |
Apr
(121) |
May
(193) |
Jun
(110) |
Jul
(214) |
Aug
(210) |
Sep
(179) |
Oct
(260) |
Nov
(237) |
Dec
(334) |
2021 |
Jan
(163) |
Feb
(186) |
Mar
(58) |
Apr
(81) |
May
(108) |
Jun
(175) |
Jul
(154) |
Aug
(180) |
Sep
(217) |
Oct
(204) |
Nov
(232) |
Dec
(190) |
2022 |
Jan
(253) |
Feb
(134) |
Mar
(229) |
Apr
(190) |
May
(125) |
Jun
(70) |
Jul
(8) |
Aug
(22) |
Sep
(19) |
Oct
(33) |
Nov
(94) |
Dec
(164) |
2023 |
Jan
(158) |
Feb
(366) |
Mar
(272) |
Apr
(109) |
May
(198) |
Jun
(226) |
Jul
(200) |
Aug
(94) |
Sep
(108) |
Oct
(62) |
Nov
(175) |
Dec
(116) |
2024 |
Jan
(35) |
Feb
(40) |
Mar
(51) |
Apr
(89) |
May
(24) |
Jun
(26) |
Jul
(53) |
Aug
(71) |
Sep
(23) |
Oct
(11) |
Nov
(22) |
Dec
(58) |
2025 |
Jan
(26) |
Feb
(40) |
Mar
(107) |
Apr
(39) |
May
(35) |
Jun
(20) |
Jul
(11) |
Aug
(24) |
Sep
(35) |
Oct
(18) |
Nov
|
Dec
|
From: <gp...@us...> - 2025-03-28 18:04:17
|
Revision: 45598 http://sourceforge.net/p/vice-emu/code/45598 Author: gpz Date: 2025-03-28 18:04:09 +0000 (Fri, 28 Mar 2025) Log Message: ----------- third step of 3-way commit in order to rename the via functions, this one renames via3->via1 in code. Modified Paths: -------------- trunk/vice/src/vic20/vic20-snapshot.c trunk/vice/src/vic20/vic20.c trunk/vice/src/vic20/vic20.h trunk/vice/src/vic20/vic20datasette.c trunk/vice/src/vic20/vic20rsuser.c trunk/vice/src/vic20/vic20via.h trunk/vice/src/vic20/vic20via2.c Modified: trunk/vice/src/vic20/vic20-snapshot.c =================================================================== --- trunk/vice/src/vic20/vic20-snapshot.c 2025-03-28 17:58:37 UTC (rev 45597) +++ trunk/vice/src/vic20/vic20-snapshot.c 2025-03-28 18:04:09 UTC (rev 45598) @@ -79,7 +79,7 @@ if (maincpu_snapshot_write_module(s) < 0 || vic20_snapshot_write_module(s, save_roms) < 0 || vic_snapshot_write_module(s) < 0 - || viacore_snapshot_write_module(machine_context.via3, s) < 0 + || viacore_snapshot_write_module(machine_context.via1, s) < 0 || viacore_snapshot_write_module(machine_context.via2, s) < 0 || drive_snapshot_write_module(s, save_disks, save_roms) < 0 || fsdrive_snapshot_write_module(s) < 0 @@ -129,7 +129,7 @@ if (maincpu_snapshot_read_module(s) < 0 || vic20_snapshot_read_module(s) < 0 || vic_snapshot_read_module(s) < 0 - || viacore_snapshot_read_module(machine_context.via3, s) < 0 + || viacore_snapshot_read_module(machine_context.via1, s) < 0 || viacore_snapshot_read_module(machine_context.via2, s) < 0 || drive_snapshot_read_module(s) < 0 || fsdrive_snapshot_read_module(s) < 0 Modified: trunk/vice/src/vic20/vic20.c =================================================================== --- trunk/vice/src/vic20/vic20.c 2025-03-28 17:58:37 UTC (rev 45597) +++ trunk/vice/src/vic20/vic20.c 2025-03-28 18:04:09 UTC (rev 45598) @@ -287,9 +287,9 @@ /* ------------------------------------------------------------------------ */ -static int via3_dump(void) +static int via1_dump(void) { - return viacore_dump(machine_context.via3); + return viacore_dump(machine_context.via1); } static int via2_dump(void) @@ -300,7 +300,7 @@ static void vic_via1_via2_store(uint16_t addr, uint8_t data) { if (addr & 0x10) { - via3_store(addr, data); + via1_store(addr, data); } if (addr & 0x20) { via2_store(addr, data); @@ -313,7 +313,7 @@ uint8_t retval = vic_read(addr); if (addr & 0x10) { - retval &= via3_read(addr); + retval &= via1_read(addr); } if (addr & 0x20) { @@ -328,7 +328,7 @@ uint8_t retval = vic_peek(addr); if (addr & 0x10) { - retval &= via3_peek(addr); + retval &= via1_peek(addr); } if (addr & 0x20) { @@ -341,7 +341,7 @@ static void via1_via2_store(uint16_t addr, uint8_t data) { if (addr & 0x10) { - via3_store(addr, data); + via1_store(addr, data); } if (addr & 0x20) { via2_store(addr, data); @@ -353,7 +353,7 @@ uint8_t retval = 0xff; if (addr & 0x10) { - retval &= via3_read(addr); + retval &= via1_read(addr); } if (addr & 0x20) { @@ -368,7 +368,7 @@ uint8_t retval = 0xff; if (addr & 0x10) { - retval &= via3_peek(addr); + retval &= via1_peek(addr); } if (addr & 0x20) { @@ -404,8 +404,8 @@ /* FIXME: the upper 4 bits of the mask are used to indicate the register size if not equal to the mask, this is done as a temporary HACK to keep mirrors working and still get the correct register size, this needs to be fixed properly after the 3.6 release */ -static io_source_t via3_device = { - "VIA3", /* name of the chip */ +static io_source_t via1_device = { + "VIA1", /* name of the chip */ IO_DETACH_NEVER, /* chip is never involved in collisions, so no detach */ IO_DETACH_NO_RESOURCE, /* does not use a resource for detach */ #if 0 @@ -417,7 +417,7 @@ NULL, /* NO poke function */ via1_via2_read, /* read function */ via1_via2_peek, /* peek function */ - via3_dump, /* chip state information dump function */ + via1_dump, /* chip state information dump function */ IO_CART_ID_NONE, /* not a cartridge */ IO_PRIO_HIGH, /* high priority, chip and mirrors never involved in collisions */ 0, /* insertion order, gets filled in by the registration function */ @@ -448,13 +448,13 @@ }; static io_source_list_t *vic_list_item = NULL; -static io_source_list_t *via3_list_item = NULL; +static io_source_list_t *via1_list_item = NULL; static io_source_list_t *via2_list_item = NULL; static void vic20io0_init(void) { vic_list_item = io_source_register(&vic_device); - via3_list_item = io_source_register(&via3_device); + via1_list_item = io_source_register(&via1_device); via2_list_item = io_source_register(&via2_device); } @@ -892,7 +892,7 @@ void machine_setup_context(void) { - vic20via3_setup_context(&machine_context); + vic20via1_setup_context(&machine_context); vic20via2_setup_context(&machine_context); vic20ieeevia1_setup_context(&machine_context); vic20ieeevia2_setup_context(&machine_context); @@ -960,7 +960,7 @@ return -1; } - via3_init(machine_context.via3); + via1_init(machine_context.via1); via2_init(machine_context.via2); ieeevia1_init(machine_context.ieeevia1); @@ -1028,7 +1028,7 @@ #endif /* Register joystick callback (for lightpen triggering via fire button) */ - joystick_register_machine(via3_check_lightpen); + joystick_register_machine(via1_check_lightpen); #ifdef HAVE_MIDI midi_init(); @@ -1046,7 +1046,7 @@ serial_traps_reset(); - viacore_reset(machine_context.via3); + viacore_reset(machine_context.via1); viacore_reset(machine_context.via2); vic_reset(); sid_reset(); @@ -1090,7 +1090,7 @@ /* and cartridge */ cartridge_detach_image(-1); - viacore_shutdown(machine_context.via3); + viacore_shutdown(machine_context.via1); viacore_shutdown(machine_context.via2); viacore_shutdown(machine_context.ieeevia1); viacore_shutdown(machine_context.ieeevia2); @@ -1121,7 +1121,7 @@ void machine_set_restore_key(int v) { - viacore_signal(machine_context.via3, + viacore_signal(machine_context.via1, VIA_SIG_CA1, v ? VIA_SIG_FALL : VIA_SIG_RISE); } @@ -1285,7 +1285,7 @@ static void vic20_userport_set_flag(uint8_t b) { - viacore_signal(machine_context.via3, VIA_SIG_CB1, b ? VIA_SIG_RISE : VIA_SIG_FALL); + viacore_signal(machine_context.via1, VIA_SIG_CB1, b ? VIA_SIG_RISE : VIA_SIG_FALL); } static userport_port_props_t userport_props = { Modified: trunk/vice/src/vic20/vic20.h =================================================================== --- trunk/vice/src/vic20/vic20.h 2025-03-28 17:58:37 UTC (rev 45597) +++ trunk/vice/src/vic20/vic20.h 2025-03-28 18:04:09 UTC (rev 45598) @@ -78,7 +78,7 @@ struct via_context_s; typedef struct machine_context_s { - struct via_context_s *via3; + struct via_context_s *via1; struct via_context_s *via2; struct via_context_s *ieeevia1; struct via_context_s *ieeevia2; Modified: trunk/vice/src/vic20/vic20datasette.c =================================================================== --- trunk/vice/src/vic20/vic20datasette.c 2025-03-28 17:58:37 UTC (rev 45597) +++ trunk/vice/src/vic20/vic20datasette.c 2025-03-28 18:04:09 UTC (rev 45598) @@ -44,7 +44,7 @@ void machine_set_tape_sense(int port, int sense) { if (port == TAPEPORT_PORT_1) { - via3_set_tape_sense(sense); + via1_set_tape_sense(sense); } } @@ -51,7 +51,7 @@ void machine_set_tape_write_in(int port, int val) { if (port == TAPEPORT_PORT_1) { - via3_set_tape_write_in(val); + via1_set_tape_write_in(val); } } @@ -58,6 +58,6 @@ void machine_set_tape_motor_in(int port, int val) { if (port == TAPEPORT_PORT_1) { - via3_set_tape_motor_in(val); + via1_set_tape_motor_in(val); } } Modified: trunk/vice/src/vic20/vic20rsuser.c =================================================================== --- trunk/vice/src/vic20/vic20rsuser.c 2025-03-28 17:58:37 UTC (rev 45597) +++ trunk/vice/src/vic20/vic20rsuser.c 2025-03-28 18:04:09 UTC (rev 45598) @@ -46,8 +46,8 @@ static void vic20_trigger_start(void) { - viacore_signal(machine_context.via3, VIA_SIG_CB1, VIA_SIG_FALL); - viacore_signal(machine_context.via3, VIA_SIG_CB1, VIA_SIG_RISE); + viacore_signal(machine_context.via1, VIA_SIG_CB1, VIA_SIG_FALL); + viacore_signal(machine_context.via1, VIA_SIG_CB1, VIA_SIG_RISE); } void vic20_rsuser_init(void) Modified: trunk/vice/src/vic20/vic20via.h =================================================================== --- trunk/vice/src/vic20/vic20via.h 2025-03-28 17:58:37 UTC (rev 45597) +++ trunk/vice/src/vic20/vic20via.h 2025-03-28 18:04:09 UTC (rev 45598) @@ -33,11 +33,11 @@ struct machine_context_s; struct via_context_s; -void vic20via3_setup_context(struct machine_context_s *machine_context); -void via3_init(struct via_context_s *via_context); -void via3_store(uint16_t addr, uint8_t byte); -uint8_t via3_read(uint16_t addr); -uint8_t via3_peek(uint16_t addr); +void vic20via1_setup_context(struct machine_context_s *machine_context); +void via1_init(struct via_context_s *via_context); +void via1_store(uint16_t addr, uint8_t byte); +uint8_t via1_read(uint16_t addr); +uint8_t via1_peek(uint16_t addr); void vic20via2_setup_context(struct machine_context_s *machine_context); void via2_init(struct via_context_s *via_context); @@ -45,10 +45,10 @@ uint8_t via2_read(uint16_t addr); uint8_t via2_peek(uint16_t addr); -void via3_set_tape_sense(int v); -void via3_set_tape_write_in(int v); -void via3_set_tape_motor_in(int v); -void via3_check_lightpen(void); +void via1_set_tape_sense(int v); +void via1_set_tape_write_in(int v); +void via1_set_tape_motor_in(int v); +void via1_check_lightpen(void); extern int vic20_vflihack_userport; Modified: trunk/vice/src/vic20/vic20via2.c =================================================================== --- trunk/vice/src/vic20/vic20via2.c 2025-03-28 17:58:37 UTC (rev 45597) +++ trunk/vice/src/vic20/vic20via2.c 2025-03-28 18:04:09 UTC (rev 45598) @@ -59,19 +59,19 @@ store_userport_pbx(userport_pb, userport_pa6 ? USERPORT_NO_PULSE : USERPORT_PULSE); } -void via3_store(uint16_t addr, uint8_t data) +void via1_store(uint16_t addr, uint8_t data) { - viacore_store(machine_context.via3, addr, data); + viacore_store(machine_context.via1, addr, data); } -uint8_t via3_read(uint16_t addr) +uint8_t via1_read(uint16_t addr) { - return viacore_read(machine_context.via3, addr); + return viacore_read(machine_context.via1, addr); } -uint8_t via3_peek(uint16_t addr) +uint8_t via1_peek(uint16_t addr) { - return viacore_peek(machine_context.via3, addr); + return viacore_peek(machine_context.via1, addr); } static void set_ca2(via_context_t *via_context, int state) @@ -100,23 +100,23 @@ static int tape_write_in = 0; static int tape_motor_in = 0; -void via3_set_tape_sense(int v) +void via1_set_tape_sense(int v) { tape_sense = v; } /* FIXME: find out how to set the write in and motor in lines */ -void via3_set_tape_write_in(int v) +void via1_set_tape_write_in(int v) { tape_write_in = v; } -void via3_set_tape_motor_in(int v) +void via1_set_tape_motor_in(int v) { tape_motor_in = v; } -static void via3_internal_lightpen_check(uint8_t pa) +static void via1_internal_lightpen_check(uint8_t pa) { uint8_t b = read_joyport_dig(JOYPORT_1); @@ -125,11 +125,11 @@ vic_set_light_pen(maincpu_clk, !(b & 0x20)); } -void via3_check_lightpen(void) +void via1_check_lightpen(void) { - uint8_t pa = machine_context.via3->via[VIA_PRA] | ~(machine_context.via3->via[VIA_DDRA]); + uint8_t pa = machine_context.via1->via[VIA_PRA] | ~(machine_context.via1->via[VIA_DDRA]); - via3_internal_lightpen_check(pa); + via1_internal_lightpen_check(pa); } static void undump_pra(via_context_t *via_context, uint8_t byte) @@ -142,7 +142,7 @@ { uint8_t joy_bits = 0; - via3_internal_lightpen_check(byte); + via1_internal_lightpen_check(byte); iec_pa_write(byte); joy_bits = ((byte & 0x20) >> 1) | ((byte & 0x1c) >> 2); @@ -262,18 +262,18 @@ return byte; } -void via3_init(via_context_t *via_context) +void via1_init(via_context_t *via_context) { - viacore_init(machine_context.via3, maincpu_alarm_context, + viacore_init(machine_context.via1, maincpu_alarm_context, maincpu_int_status); } -void vic20via3_setup_context(machine_context_t *machinecontext) +void vic20via1_setup_context(machine_context_t *machinecontext) { via_context_t *via; - machinecontext->via3 = lib_malloc(sizeof(via_context_t)); - via = machinecontext->via3; + machinecontext->via1 = lib_malloc(sizeof(via_context_t)); + via = machinecontext->via1; via->prv = NULL; via->context = NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-03-28 17:58:50
|
Revision: 45597 http://sourceforge.net/p/vice-emu/code/45597 Author: gpz Date: 2025-03-28 17:58:37 +0000 (Fri, 28 Mar 2025) Log Message: ----------- second step of 3-way commit in order to rename the via functions, this one renames via1->via2 in code Modified Paths: -------------- trunk/vice/src/vic20/vic20-snapshot.c trunk/vice/src/vic20/vic20.c trunk/vice/src/vic20/vic20.h trunk/vice/src/vic20/vic20datasette.c trunk/vice/src/vic20/vic20via.h trunk/vice/src/vic20/vic20via1.c Modified: trunk/vice/src/vic20/vic20-snapshot.c =================================================================== --- trunk/vice/src/vic20/vic20-snapshot.c 2025-03-28 17:47:13 UTC (rev 45596) +++ trunk/vice/src/vic20/vic20-snapshot.c 2025-03-28 17:58:37 UTC (rev 45597) @@ -58,7 +58,7 @@ #define SNAP_MAJOR 3 -#define SNAP_MINOR 0 +#define SNAP_MINOR 1 int vic20_snapshot_write(const char *name, int save_roms, int save_disks, @@ -79,8 +79,8 @@ if (maincpu_snapshot_write_module(s) < 0 || vic20_snapshot_write_module(s, save_roms) < 0 || vic_snapshot_write_module(s) < 0 - || viacore_snapshot_write_module(machine_context.via1, s) < 0 || viacore_snapshot_write_module(machine_context.via3, s) < 0 + || viacore_snapshot_write_module(machine_context.via2, s) < 0 || drive_snapshot_write_module(s, save_disks, save_roms) < 0 || fsdrive_snapshot_write_module(s) < 0 || event_snapshot_write_module(s, event_mode) < 0 @@ -129,8 +129,8 @@ if (maincpu_snapshot_read_module(s) < 0 || vic20_snapshot_read_module(s) < 0 || vic_snapshot_read_module(s) < 0 - || viacore_snapshot_read_module(machine_context.via1, s) < 0 || viacore_snapshot_read_module(machine_context.via3, s) < 0 + || viacore_snapshot_read_module(machine_context.via2, s) < 0 || drive_snapshot_read_module(s) < 0 || fsdrive_snapshot_read_module(s) < 0 || event_snapshot_read_module(s, event_mode) < 0 Modified: trunk/vice/src/vic20/vic20.c =================================================================== --- trunk/vice/src/vic20/vic20.c 2025-03-28 17:47:13 UTC (rev 45596) +++ trunk/vice/src/vic20/vic20.c 2025-03-28 17:58:37 UTC (rev 45597) @@ -292,9 +292,9 @@ return viacore_dump(machine_context.via3); } -static int via1_dump(void) +static int via2_dump(void) { - return viacore_dump(machine_context.via1); + return viacore_dump(machine_context.via2); } static void vic_via1_via2_store(uint16_t addr, uint8_t data) @@ -303,7 +303,7 @@ via3_store(addr, data); } if (addr & 0x20) { - via1_store(addr, data); + via2_store(addr, data); } vic_store(addr, data); } @@ -317,7 +317,7 @@ } if (addr & 0x20) { - retval &= via1_read(addr); + retval &= via2_read(addr); } return retval; @@ -332,7 +332,7 @@ } if (addr & 0x20) { - retval &= via1_peek(addr); + retval &= via2_peek(addr); } return retval; @@ -344,7 +344,7 @@ via3_store(addr, data); } if (addr & 0x20) { - via1_store(addr, data); + via2_store(addr, data); } } @@ -357,7 +357,7 @@ } if (addr & 0x20) { - retval &= via1_read(addr); + retval &= via2_read(addr); } return retval; @@ -372,7 +372,7 @@ } if (addr & 0x20) { - retval &= via1_peek(addr); + retval &= via2_peek(addr); } return retval; @@ -427,8 +427,8 @@ /* FIXME: the upper 4 bits of the mask are used to indicate the register size if not equal to the mask, this is done as a temporary HACK to keep mirrors working and still get the correct register size, this needs to be fixed properly after the 3.6 release */ -static io_source_t via1_device = { - "VIA1", /* name of the chip */ +static io_source_t via2_device = { + "VIA2", /* name of the chip */ IO_DETACH_NEVER, /* chip is never involved in collisions, so no detach */ IO_DETACH_NO_RESOURCE, /* does not use a resource for detach */ #if 0 @@ -440,7 +440,7 @@ NULL, /* NO poke function */ via1_via2_read, /* read function */ via1_via2_peek, /* peek function */ - via1_dump, /* chip state information dump function */ + via2_dump, /* chip state information dump function */ IO_CART_ID_NONE, /* not a cartridge */ IO_PRIO_HIGH, /* high priority, chip and mirrors never involved in collisions */ 0, /* insertion order, gets filled in by the registration function */ @@ -448,14 +448,14 @@ }; static io_source_list_t *vic_list_item = NULL; -static io_source_list_t *via1_list_item = NULL; static io_source_list_t *via3_list_item = NULL; +static io_source_list_t *via2_list_item = NULL; static void vic20io0_init(void) { vic_list_item = io_source_register(&vic_device); - via1_list_item = io_source_register(&via1_device); via3_list_item = io_source_register(&via3_device); + via2_list_item = io_source_register(&via2_device); } /* ------------------------------------------------------------------------ */ @@ -892,8 +892,8 @@ void machine_setup_context(void) { - vic20via1_setup_context(&machine_context); vic20via3_setup_context(&machine_context); + vic20via2_setup_context(&machine_context); vic20ieeevia1_setup_context(&machine_context); vic20ieeevia2_setup_context(&machine_context); machine_printer_setup_context(&machine_context); @@ -960,8 +960,8 @@ return -1; } - via1_init(machine_context.via1); via3_init(machine_context.via3); + via2_init(machine_context.via2); ieeevia1_init(machine_context.ieeevia1); ieeevia2_init(machine_context.ieeevia2); @@ -1046,8 +1046,8 @@ serial_traps_reset(); - viacore_reset(machine_context.via1); viacore_reset(machine_context.via3); + viacore_reset(machine_context.via2); vic_reset(); sid_reset(); @@ -1090,8 +1090,8 @@ /* and cartridge */ cartridge_detach_image(-1); - viacore_shutdown(machine_context.via1); viacore_shutdown(machine_context.via3); + viacore_shutdown(machine_context.via2); viacore_shutdown(machine_context.ieeevia1); viacore_shutdown(machine_context.ieeevia2); Modified: trunk/vice/src/vic20/vic20.h =================================================================== --- trunk/vice/src/vic20/vic20.h 2025-03-28 17:47:13 UTC (rev 45596) +++ trunk/vice/src/vic20/vic20.h 2025-03-28 17:58:37 UTC (rev 45597) @@ -78,8 +78,8 @@ struct via_context_s; typedef struct machine_context_s { - struct via_context_s *via1; struct via_context_s *via3; + struct via_context_s *via2; struct via_context_s *ieeevia1; struct via_context_s *ieeevia2; struct printer_context_s *printer[3]; Modified: trunk/vice/src/vic20/vic20datasette.c =================================================================== --- trunk/vice/src/vic20/vic20datasette.c 2025-03-28 17:47:13 UTC (rev 45596) +++ trunk/vice/src/vic20/vic20datasette.c 2025-03-28 17:58:37 UTC (rev 45597) @@ -37,7 +37,7 @@ void machine_trigger_flux_change(int port, unsigned int on) { if (port == TAPEPORT_PORT_1) { - viacore_signal(machine_context.via1, VIA_SIG_CA1, VIA_SIG_FALL); + viacore_signal(machine_context.via2, VIA_SIG_CA1, VIA_SIG_FALL); } } Modified: trunk/vice/src/vic20/vic20via.h =================================================================== --- trunk/vice/src/vic20/vic20via.h 2025-03-28 17:47:13 UTC (rev 45596) +++ trunk/vice/src/vic20/vic20via.h 2025-03-28 17:58:37 UTC (rev 45597) @@ -33,12 +33,6 @@ struct machine_context_s; struct via_context_s; -void vic20via1_setup_context(struct machine_context_s *machine_context); -void via1_init(struct via_context_s *via_context); -void via1_store(uint16_t addr, uint8_t byte); -uint8_t via1_read(uint16_t addr); -uint8_t via1_peek(uint16_t addr); - void vic20via3_setup_context(struct machine_context_s *machine_context); void via3_init(struct via_context_s *via_context); void via3_store(uint16_t addr, uint8_t byte); @@ -45,6 +39,12 @@ uint8_t via3_read(uint16_t addr); uint8_t via3_peek(uint16_t addr); +void vic20via2_setup_context(struct machine_context_s *machine_context); +void via2_init(struct via_context_s *via_context); +void via2_store(uint16_t addr, uint8_t byte); +uint8_t via2_read(uint16_t addr); +uint8_t via2_peek(uint16_t addr); + void via3_set_tape_sense(int v); void via3_set_tape_write_in(int v); void via3_set_tape_motor_in(int v); Modified: trunk/vice/src/vic20/vic20via1.c =================================================================== --- trunk/vice/src/vic20/vic20via1.c 2025-03-28 17:47:13 UTC (rev 45596) +++ trunk/vice/src/vic20/vic20via1.c 2025-03-28 17:58:37 UTC (rev 45597) @@ -44,19 +44,19 @@ #include "vic20via.h" -void via1_store(uint16_t addr, uint8_t data) +void via2_store(uint16_t addr, uint8_t data) { - viacore_store(machine_context.via1, addr, data); + viacore_store(machine_context.via2, addr, data); } -uint8_t via1_read(uint16_t addr) +uint8_t via2_read(uint16_t addr) { - return viacore_read(machine_context.via1, addr); + return viacore_read(machine_context.via2, addr); } -uint8_t via1_peek(uint16_t addr) +uint8_t via2_peek(uint16_t addr) { - return viacore_peek(machine_context.via1, addr); + return viacore_peek(machine_context.via2, addr); } static void set_ca2(via_context_t *via_context, int state) @@ -188,18 +188,18 @@ return byte; } -void via1_init(via_context_t *via_context) +void via2_init(via_context_t *via_context) { - viacore_init(machine_context.via1, maincpu_alarm_context, + viacore_init(machine_context.via2, maincpu_alarm_context, maincpu_int_status); } -void vic20via1_setup_context(machine_context_t *machinecontext) +void vic20via2_setup_context(machine_context_t *machinecontext) { via_context_t *via; - machinecontext->via1 = lib_malloc(sizeof(via_context_t)); - via = machinecontext->via1; + machinecontext->via2 = lib_malloc(sizeof(via_context_t)); + via = machinecontext->via2; via->prv = NULL; via->context = NULL; @@ -207,8 +207,8 @@ via->rmw_flag = &maincpu_rmw_flag; via->clk_ptr = &maincpu_clk; - via->myname = lib_msprintf("Via1"); - via->my_module_name = lib_msprintf("VIA1"); + via->myname = lib_msprintf("Via2"); + via->my_module_name = lib_msprintf("VIA2"); viacore_setup_context(via); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-03-28 17:47:22
|
Revision: 45596 http://sourceforge.net/p/vice-emu/code/45596 Author: gpz Date: 2025-03-28 17:47:13 +0000 (Fri, 28 Mar 2025) Log Message: ----------- first step of 3-way commit in order to rename the via functions, this one renames via2->via3 in code, and swaps via1<>via2 in comments Modified Paths: -------------- trunk/vice/src/vic20/vic20-snapshot.c trunk/vice/src/vic20/vic20.c trunk/vice/src/vic20/vic20.h trunk/vice/src/vic20/vic20datasette.c trunk/vice/src/vic20/vic20iec.c trunk/vice/src/vic20/vic20rsuser.c trunk/vice/src/vic20/vic20via.h trunk/vice/src/vic20/vic20via1.c trunk/vice/src/vic20/vic20via2.c Modified: trunk/vice/src/vic20/vic20-snapshot.c =================================================================== --- trunk/vice/src/vic20/vic20-snapshot.c 2025-03-27 19:02:17 UTC (rev 45595) +++ trunk/vice/src/vic20/vic20-snapshot.c 2025-03-28 17:47:13 UTC (rev 45596) @@ -80,7 +80,7 @@ || vic20_snapshot_write_module(s, save_roms) < 0 || vic_snapshot_write_module(s) < 0 || viacore_snapshot_write_module(machine_context.via1, s) < 0 - || viacore_snapshot_write_module(machine_context.via2, s) < 0 + || viacore_snapshot_write_module(machine_context.via3, s) < 0 || drive_snapshot_write_module(s, save_disks, save_roms) < 0 || fsdrive_snapshot_write_module(s) < 0 || event_snapshot_write_module(s, event_mode) < 0 @@ -130,7 +130,7 @@ || vic20_snapshot_read_module(s) < 0 || vic_snapshot_read_module(s) < 0 || viacore_snapshot_read_module(machine_context.via1, s) < 0 - || viacore_snapshot_read_module(machine_context.via2, s) < 0 + || viacore_snapshot_read_module(machine_context.via3, s) < 0 || drive_snapshot_read_module(s) < 0 || fsdrive_snapshot_read_module(s) < 0 || event_snapshot_read_module(s, event_mode) < 0 Modified: trunk/vice/src/vic20/vic20.c =================================================================== --- trunk/vice/src/vic20/vic20.c 2025-03-27 19:02:17 UTC (rev 45595) +++ trunk/vice/src/vic20/vic20.c 2025-03-28 17:47:13 UTC (rev 45596) @@ -287,9 +287,9 @@ /* ------------------------------------------------------------------------ */ -static int via2_dump(void) +static int via3_dump(void) { - return viacore_dump(machine_context.via2); + return viacore_dump(machine_context.via3); } static int via1_dump(void) @@ -300,7 +300,7 @@ static void vic_via1_via2_store(uint16_t addr, uint8_t data) { if (addr & 0x10) { - via2_store(addr, data); + via3_store(addr, data); } if (addr & 0x20) { via1_store(addr, data); @@ -313,7 +313,7 @@ uint8_t retval = vic_read(addr); if (addr & 0x10) { - retval &= via2_read(addr); + retval &= via3_read(addr); } if (addr & 0x20) { @@ -328,7 +328,7 @@ uint8_t retval = vic_peek(addr); if (addr & 0x10) { - retval &= via2_peek(addr); + retval &= via3_peek(addr); } if (addr & 0x20) { @@ -341,7 +341,7 @@ static void via1_via2_store(uint16_t addr, uint8_t data) { if (addr & 0x10) { - via2_store(addr, data); + via3_store(addr, data); } if (addr & 0x20) { via1_store(addr, data); @@ -353,7 +353,7 @@ uint8_t retval = 0xff; if (addr & 0x10) { - retval &= via2_read(addr); + retval &= via3_read(addr); } if (addr & 0x20) { @@ -368,7 +368,7 @@ uint8_t retval = 0xff; if (addr & 0x10) { - retval &= via2_peek(addr); + retval &= via3_peek(addr); } if (addr & 0x20) { @@ -404,8 +404,8 @@ /* FIXME: the upper 4 bits of the mask are used to indicate the register size if not equal to the mask, this is done as a temporary HACK to keep mirrors working and still get the correct register size, this needs to be fixed properly after the 3.6 release */ -static io_source_t via2_device = { - "VIA2", /* name of the chip */ +static io_source_t via3_device = { + "VIA3", /* name of the chip */ IO_DETACH_NEVER, /* chip is never involved in collisions, so no detach */ IO_DETACH_NO_RESOURCE, /* does not use a resource for detach */ #if 0 @@ -417,7 +417,7 @@ NULL, /* NO poke function */ via1_via2_read, /* read function */ via1_via2_peek, /* peek function */ - via2_dump, /* chip state information dump function */ + via3_dump, /* chip state information dump function */ IO_CART_ID_NONE, /* not a cartridge */ IO_PRIO_HIGH, /* high priority, chip and mirrors never involved in collisions */ 0, /* insertion order, gets filled in by the registration function */ @@ -449,13 +449,13 @@ static io_source_list_t *vic_list_item = NULL; static io_source_list_t *via1_list_item = NULL; -static io_source_list_t *via2_list_item = NULL; +static io_source_list_t *via3_list_item = NULL; static void vic20io0_init(void) { vic_list_item = io_source_register(&vic_device); via1_list_item = io_source_register(&via1_device); - via2_list_item = io_source_register(&via2_device); + via3_list_item = io_source_register(&via3_device); } /* ------------------------------------------------------------------------ */ @@ -893,7 +893,7 @@ void machine_setup_context(void) { vic20via1_setup_context(&machine_context); - vic20via2_setup_context(&machine_context); + vic20via3_setup_context(&machine_context); vic20ieeevia1_setup_context(&machine_context); vic20ieeevia2_setup_context(&machine_context); machine_printer_setup_context(&machine_context); @@ -961,7 +961,7 @@ } via1_init(machine_context.via1); - via2_init(machine_context.via2); + via3_init(machine_context.via3); ieeevia1_init(machine_context.ieeevia1); ieeevia2_init(machine_context.ieeevia2); @@ -1028,7 +1028,7 @@ #endif /* Register joystick callback (for lightpen triggering via fire button) */ - joystick_register_machine(via2_check_lightpen); + joystick_register_machine(via3_check_lightpen); #ifdef HAVE_MIDI midi_init(); @@ -1047,7 +1047,7 @@ serial_traps_reset(); viacore_reset(machine_context.via1); - viacore_reset(machine_context.via2); + viacore_reset(machine_context.via3); vic_reset(); sid_reset(); @@ -1091,7 +1091,7 @@ cartridge_detach_image(-1); viacore_shutdown(machine_context.via1); - viacore_shutdown(machine_context.via2); + viacore_shutdown(machine_context.via3); viacore_shutdown(machine_context.ieeevia1); viacore_shutdown(machine_context.ieeevia2); @@ -1121,7 +1121,7 @@ void machine_set_restore_key(int v) { - viacore_signal(machine_context.via2, + viacore_signal(machine_context.via3, VIA_SIG_CA1, v ? VIA_SIG_FALL : VIA_SIG_RISE); } @@ -1285,7 +1285,7 @@ static void vic20_userport_set_flag(uint8_t b) { - viacore_signal(machine_context.via2, VIA_SIG_CB1, b ? VIA_SIG_RISE : VIA_SIG_FALL); + viacore_signal(machine_context.via3, VIA_SIG_CB1, b ? VIA_SIG_RISE : VIA_SIG_FALL); } static userport_port_props_t userport_props = { Modified: trunk/vice/src/vic20/vic20.h =================================================================== --- trunk/vice/src/vic20/vic20.h 2025-03-27 19:02:17 UTC (rev 45595) +++ trunk/vice/src/vic20/vic20.h 2025-03-28 17:47:13 UTC (rev 45596) @@ -79,7 +79,7 @@ typedef struct machine_context_s { struct via_context_s *via1; - struct via_context_s *via2; + struct via_context_s *via3; struct via_context_s *ieeevia1; struct via_context_s *ieeevia2; struct printer_context_s *printer[3]; Modified: trunk/vice/src/vic20/vic20datasette.c =================================================================== --- trunk/vice/src/vic20/vic20datasette.c 2025-03-27 19:02:17 UTC (rev 45595) +++ trunk/vice/src/vic20/vic20datasette.c 2025-03-28 17:47:13 UTC (rev 45596) @@ -44,7 +44,7 @@ void machine_set_tape_sense(int port, int sense) { if (port == TAPEPORT_PORT_1) { - via2_set_tape_sense(sense); + via3_set_tape_sense(sense); } } @@ -51,7 +51,7 @@ void machine_set_tape_write_in(int port, int val) { if (port == TAPEPORT_PORT_1) { - via2_set_tape_write_in(val); + via3_set_tape_write_in(val); } } @@ -58,6 +58,6 @@ void machine_set_tape_motor_in(int port, int val) { if (port == TAPEPORT_PORT_1) { - via2_set_tape_motor_in(val); + via3_set_tape_motor_in(val); } } Modified: trunk/vice/src/vic20/vic20iec.c =================================================================== --- trunk/vice/src/vic20/vic20iec.c 2025-03-27 19:02:17 UTC (rev 45595) +++ trunk/vice/src/vic20/vic20iec.c 2025-03-28 17:47:13 UTC (rev 45596) @@ -129,16 +129,16 @@ /* The VIC20 has a strange bus layout for the serial IEC bus. - VIA1 CA2 CLK out - VIA1 CB1 SRQ in - VIA1 CB2 DATA out - VIA2 PA0 CLK in - VIA2 PA1 DATA in - VIA2 PA7 ATN out + VIA1 PA0 CLK in + VIA1 PA1 DATA in + VIA1 PA7 ATN out + VIA2 CA2 CLK out + VIA2 CB1 SRQ in + VIA2 CB2 DATA out */ -/* These two routines are called for VIA2 Port A. */ +/* These two routines are called for VIA1 Port A. */ uint8_t iec_pa_read(void) { @@ -213,7 +213,7 @@ } -/* This routine is called for VIA1 PCR (= CA2 and CB2). +/* This routine is called for VIA2 PCR (= CA2 and CB2). Although Cx2 uses three bits for control, we assume the calling routine has set bit 5 and bit 1 to the real output value for CB2 (DATA out) and CA2 (CLK out) resp. (25apr1997 AF) */ Modified: trunk/vice/src/vic20/vic20rsuser.c =================================================================== --- trunk/vice/src/vic20/vic20rsuser.c 2025-03-27 19:02:17 UTC (rev 45595) +++ trunk/vice/src/vic20/vic20rsuser.c 2025-03-28 17:47:13 UTC (rev 45596) @@ -46,8 +46,8 @@ static void vic20_trigger_start(void) { - viacore_signal(machine_context.via2, VIA_SIG_CB1, VIA_SIG_FALL); - viacore_signal(machine_context.via2, VIA_SIG_CB1, VIA_SIG_RISE); + viacore_signal(machine_context.via3, VIA_SIG_CB1, VIA_SIG_FALL); + viacore_signal(machine_context.via3, VIA_SIG_CB1, VIA_SIG_RISE); } void vic20_rsuser_init(void) Modified: trunk/vice/src/vic20/vic20via.h =================================================================== --- trunk/vice/src/vic20/vic20via.h 2025-03-27 19:02:17 UTC (rev 45595) +++ trunk/vice/src/vic20/vic20via.h 2025-03-28 17:47:13 UTC (rev 45596) @@ -39,16 +39,16 @@ uint8_t via1_read(uint16_t addr); uint8_t via1_peek(uint16_t addr); -void vic20via2_setup_context(struct machine_context_s *machine_context); -void via2_init(struct via_context_s *via_context); -void via2_store(uint16_t addr, uint8_t byte); -uint8_t via2_read(uint16_t addr); -uint8_t via2_peek(uint16_t addr); +void vic20via3_setup_context(struct machine_context_s *machine_context); +void via3_init(struct via_context_s *via_context); +void via3_store(uint16_t addr, uint8_t byte); +uint8_t via3_read(uint16_t addr); +uint8_t via3_peek(uint16_t addr); -void via2_set_tape_sense(int v); -void via2_set_tape_write_in(int v); -void via2_set_tape_motor_in(int v); -void via2_check_lightpen(void); +void via3_set_tape_sense(int v); +void via3_set_tape_write_in(int v); +void via3_set_tape_motor_in(int v); +void via3_check_lightpen(void); extern int vic20_vflihack_userport; Modified: trunk/vice/src/vic20/vic20via1.c =================================================================== --- trunk/vice/src/vic20/vic20via1.c 2025-03-27 19:02:17 UTC (rev 45595) +++ trunk/vice/src/vic20/vic20via1.c 2025-03-28 17:47:13 UTC (rev 45596) @@ -1,5 +1,5 @@ /* - * vic20via1.c - VIA1 emulation in the VIC20. + * vic20via1.c - VIA2 emulation in the VIC20. * * Written by * Andre Fachat <fa...@ph...> Modified: trunk/vice/src/vic20/vic20via2.c =================================================================== --- trunk/vice/src/vic20/vic20via2.c 2025-03-27 19:02:17 UTC (rev 45595) +++ trunk/vice/src/vic20/vic20via2.c 2025-03-28 17:47:13 UTC (rev 45596) @@ -1,5 +1,5 @@ /* - * vic20via2.c - VIA2 emulation in the VIC20. + * vic20via2.c - VIA1 emulation in the VIC20. * * Written by * Andre Fachat <fa...@ph...> @@ -59,19 +59,19 @@ store_userport_pbx(userport_pb, userport_pa6 ? USERPORT_NO_PULSE : USERPORT_PULSE); } -void via2_store(uint16_t addr, uint8_t data) +void via3_store(uint16_t addr, uint8_t data) { - viacore_store(machine_context.via2, addr, data); + viacore_store(machine_context.via3, addr, data); } -uint8_t via2_read(uint16_t addr) +uint8_t via3_read(uint16_t addr) { - return viacore_read(machine_context.via2, addr); + return viacore_read(machine_context.via3, addr); } -uint8_t via2_peek(uint16_t addr) +uint8_t via3_peek(uint16_t addr) { - return viacore_peek(machine_context.via2, addr); + return viacore_peek(machine_context.via3, addr); } static void set_ca2(via_context_t *via_context, int state) @@ -100,23 +100,23 @@ static int tape_write_in = 0; static int tape_motor_in = 0; -void via2_set_tape_sense(int v) +void via3_set_tape_sense(int v) { tape_sense = v; } /* FIXME: find out how to set the write in and motor in lines */ -void via2_set_tape_write_in(int v) +void via3_set_tape_write_in(int v) { tape_write_in = v; } -void via2_set_tape_motor_in(int v) +void via3_set_tape_motor_in(int v) { tape_motor_in = v; } -static void via2_internal_lightpen_check(uint8_t pa) +static void via3_internal_lightpen_check(uint8_t pa) { uint8_t b = read_joyport_dig(JOYPORT_1); @@ -125,11 +125,11 @@ vic_set_light_pen(maincpu_clk, !(b & 0x20)); } -void via2_check_lightpen(void) +void via3_check_lightpen(void) { - uint8_t pa = machine_context.via2->via[VIA_PRA] | ~(machine_context.via2->via[VIA_DDRA]); + uint8_t pa = machine_context.via3->via[VIA_PRA] | ~(machine_context.via3->via[VIA_DDRA]); - via2_internal_lightpen_check(pa); + via3_internal_lightpen_check(pa); } static void undump_pra(via_context_t *via_context, uint8_t byte) @@ -142,7 +142,7 @@ { uint8_t joy_bits = 0; - via2_internal_lightpen_check(byte); + via3_internal_lightpen_check(byte); iec_pa_write(byte); joy_bits = ((byte & 0x20) >> 1) | ((byte & 0x1c) >> 2); @@ -262,18 +262,18 @@ return byte; } -void via2_init(via_context_t *via_context) +void via3_init(via_context_t *via_context) { - viacore_init(machine_context.via2, maincpu_alarm_context, + viacore_init(machine_context.via3, maincpu_alarm_context, maincpu_int_status); } -void vic20via2_setup_context(machine_context_t *machinecontext) +void vic20via3_setup_context(machine_context_t *machinecontext) { via_context_t *via; - machinecontext->via2 = lib_malloc(sizeof(via_context_t)); - via = machinecontext->via2; + machinecontext->via3 = lib_malloc(sizeof(via_context_t)); + via = machinecontext->via3; via->prv = NULL; via->context = NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-03-27 19:02:20
|
Revision: 45595 http://sourceforge.net/p/vice-emu/code/45595 Author: gpz Date: 2025-03-27 19:02:17 +0000 (Thu, 27 Mar 2025) Log Message: ----------- plus4 and cbm2 keymap fixes Modified Paths: -------------- trunk/vice/data/CBM-II/Makefile.am trunk/vice/data/CBM-II/sdl_pos.vkm trunk/vice/data/CBM-II/sdl_sym.vkm trunk/vice/data/PLUS4/gtk3_pos.vkm trunk/vice/data/PLUS4/gtk3_pos_de.vkm trunk/vice/data/PLUS4/gtk3_sym.vkm trunk/vice/data/PLUS4/gtk3_sym_de.vkm trunk/vice/data/PLUS4/sdl_pos.vkm trunk/vice/data/PLUS4/sdl_sym.vkm trunk/vice/data/PLUS4/sdl_sym_de.vkm Added Paths: ----------- trunk/vice/data/CBM-II/sdl_sym_de.vkm Modified: trunk/vice/data/CBM-II/Makefile.am =================================================================== --- trunk/vice/data/CBM-II/Makefile.am 2025-03-27 15:08:19 UTC (rev 45594) +++ trunk/vice/data/CBM-II/Makefile.am 2025-03-27 19:02:17 UTC (rev 45595) @@ -56,6 +56,7 @@ sdl_keymaps = \ sdl_sym.vkm \ + sdl_sym_de.vkm \ sdl_pos.vkm if USE_SDLUI Modified: trunk/vice/data/CBM-II/sdl_pos.vkm =================================================================== --- trunk/vice/data/CBM-II/sdl_pos.vkm 2025-03-27 15:08:19 UTC (rev 45594) +++ trunk/vice/data/CBM-II/sdl_pos.vkm 2025-03-27 19:02:17 UTC (rev 45595) @@ -178,7 +178,7 @@ 91 1 4 8 /* [ -> [ */ 93 2 3 8 /* ] -> ] */ 13 2 5 8 /* Return -> pi */ -306 8 5 8 /* Left Ctrl -> CTRL */ +306 8 5 0x4008 /* Left Ctrl -> CTRL */ 97 9 3 8 /* A -> A */ 115 10 3 8 /* S -> S */ 100 11 3 8 /* D -> D */ @@ -225,7 +225,7 @@ 19 2 5 8 /* Pause/Break -> Pi */ 280 5 0 8 /* PgUp -> Rev/Off */ 279 5 1 8 /* End -> CE */ -305 3 4 8 /* Right Ctrl -> C= */ +305 3 4 0x2008 /* Right Ctrl -> C= */ 271 7 4 8 /* Numpad Enter -> Numpad Enter */ 267 7 1 8 /* Numpad / -> Numpad / */ 263 4 2 8 /* Numpad 7 -> Numpad 7 */ Modified: trunk/vice/data/CBM-II/sdl_sym.vkm =================================================================== --- trunk/vice/data/CBM-II/sdl_sym.vkm 2025-03-27 15:08:19 UTC (rev 45594) +++ trunk/vice/data/CBM-II/sdl_sym.vkm 2025-03-27 19:02:17 UTC (rev 45595) @@ -180,7 +180,7 @@ 91 1 4 8 /* [ -> [ */ 93 2 3 8 /* ] -> ] */ 13 2 4 8 /* Return -> Return */ -306 8 5 8 /* Left Ctrl -> CTRL */ +306 8 5 0x4008 /* Left Ctrl -> CTRL */ 97 9 3 8 /* A -> A */ 115 10 3 8 /* S -> S */ 100 11 3 8 /* D -> D */ @@ -203,9 +203,13 @@ 109 14 4 8 /* M -> M */ 44 15 4 8 /* , -> , */ 46 15 5 8 /* . -> . */ -47 0 5 8 /* / -> / */ + +47 0 5 0x28 /* / -> / */ +47 4 1 0x201 /* ctrl / -> / */ + 303 8 4 4 /* Right Shift -> Shift */ 32 14 5 8 /* Space -> Space */ + 282 8 0 8 /* F1 -> F1 */ 283 9 0 8 /* F2 -> F2 */ 284 10 0 8 /* F3 -> F3 */ @@ -216,20 +220,27 @@ 289 15 0 8 /* F8 -> F8 */ 290 0 0 8 /* F9 -> F9 */ 291 1 0 8 /* F10 -> F10 */ -278 4 0 8 /* Home -> CLR/HOME */ +292 2 5 8 /* F11 -> pi */ +#293 1 0 8 /* F12 -> run/stop */ + + 273 3 0 8 /* Up -> CRSR UP */ 276 3 1 8 /* Left -> CRSR LEFT */ 275 3 2 8 /* Right -> CRSR RIGHT */ 274 2 0 8 /* Down -> CRSR DOWN */ -277 2 2 8 /* Ins -> Pound */ -127 4 1 8 /* Del -> ? */ + +277 6 5 8 /* Ins -> KP 00 */ +127 5 1 8 /* Del -> KP CE */ +278 4 0 8 /* Home -> CLR/HOME */ +279 5 0 8 /* End -> Rev/Off */ +280 7 0 8 /* PgUp -> Run/Stop */ 281 6 0 8 /* PgDown -> Norm/Graph */ -19 2 5 8 /* Pause/Break -> Pi */ -280 5 0 8 /* PgUp -> Rev/Off */ -279 5 1 8 /* End -> CE */ -305 3 4 8 /* Right Ctrl -> C= */ + +305 3 4 0x2008 /* Right Ctrl -> C= */ + 271 7 4 8 /* Numpad Enter -> Numpad Enter */ 267 7 1 8 /* Numpad / -> Numpad / */ +268 6 1 8 /* Numpad * -> Numpad * */ 263 4 2 8 /* Numpad 7 -> Numpad 7 */ 264 5 2 8 /* Numpad 8 -> Numpad 8 */ 265 6 2 8 /* Numpad 9 -> Numpad 9 */ Added: trunk/vice/data/CBM-II/sdl_sym_de.vkm =================================================================== --- trunk/vice/data/CBM-II/sdl_sym_de.vkm (rev 0) +++ trunk/vice/data/CBM-II/sdl_sym_de.vkm 2025-03-27 19:02:17 UTC (rev 45595) @@ -0,0 +1,288 @@ +# VICE keyboard mapping file +# +# A Keyboard map is read in as patch to the current map. +# +# File format: +# - comment lines start with '#' +# - keyword lines start with '!keyword' +# - normal lines have 'keysym/scancode row column shiftflag' +# +# Keywords and their lines are: +# '!CLEAR' clear whole table +# '!INCLUDE filename' read file as mapping file +# '!LSHIFT row col' left shift keyboard row/column +# '!RSHIFT row col' right shift keyboard row/column +# '!VSHIFT shiftkey' virtual shift key (RSHIFT or LSHIFT) +# '!SHIFTL shiftkey' shift lock key (RSHIFT or LSHIFT) +# for emulated keyboards that have only one shift key, set both LSHIFT +# and RSHIFT to the same row/col and use RSHIFT for VSHIFT and SHIFTL. +# '!LCTRL row col' left control keyboard row/column +# '!VCTRL ctrlkey' virtual control key (LCTRL) +# '!LCBM row col' left CBM keyboard row/column +# '!VCBM cbmkey' virtual CBM key (LCBM) +# '!UNDEF keysym' remove keysym from table +# +# Shiftflag can have these values, flags can be ORed to combine them: +# 0x0000 0 key is not shifted for this keysym/scancode +# 0x0001 1 key is combined with shift for this keysym/scancode +# 0x0002 2 key is left shift on emulated machine +# 0x0004 4 key is right shift on emulated machine (use only this one +# for emulated keyboards that have only one shift key) +# 0x0008 8 key can be shifted or not with this keysym/scancode +# 0x0010 16 deshift key for this keysym/scancode +# 0x0020 32 another definition for this keysym/scancode follows +# 0x0040 64 key is shift-lock on emulated machine +# 0x0080 128 shift modifier required on host +# 0x0100 256 key is used for an alternative keyboard mapping, e.g. C64 mode in x128 +# 0x0200 512 alt-r (alt-gr) modifier required on host +# 0x0400 1024 ctrl modifier required on host +# 0x0800 2048 key is combined with cbm for this keysym/scancode +# 0x1000 4096 key is combined with ctrl for this keysym/scancode +# 0x2000 8192 key is (left) cbm on emulated machine +# 0x4000 16384 key is (left) ctrl on emulated machine +# +# Negative row values: +# 'keysym -1 n' joystick keymap A, direction n +# 'keysym -2 n' joystick keymap B, direction n +# 'keysym -3 0' first RESTORE key +# 'keysym -3 1' second RESTORE key +# 'keysym -4 0' 40/80 column key (x128) +# 'keysym -4 1' CAPS (ASCII/DIN) key (x128) +# 'keysym -5 n' joyport keypad, key n (not supported in x128) +# +# Joystick direction values: +# 0 Fire +# 1 South/West +# 2 South +# 3 South/East +# 4 West +# 5 East +# 6 North/West +# 7 North +# 8 North/East +# +# Joyport keypad key layout: +# -------------------------- +# | 0 | 1 | 2 | 3 | 4 | +# -------------------------- +# | 5 | 6 | 7 | 8 | 9 | +# -------------------------- +# | 10 | 11 | 12 | 13 | 14 | +# -------------------------- +# | 15 | 16 | 17 | 18 | 19 | +# -------------------------- +# +# When a bigger spaced key is used, +# it uses the upper left most key value. + +# Symbolic Mapping, DE Layout, CBM2, SDL + +# note: For some reason SDL does not get keyboard events for "dead keys" at all, +# so a "nodeadkeys" layout must be used. CAUTION: apparently SDL generates +# some tables internally at startup - switching the host layout while +# the emulator is running produces unpredictable results (broken keycodes) + +# Commodore cbm2 keyboard matrix: +# +# references: +# http://www.zimmers.net/anonftp/pub/cbm/b/documents/de/keyboard-matrix.gif +# http://www.zimmers.net/anonftp/pub/cbm/b/documents/keymap-us.gif +# http://www.zimmers.net/anonftp/pub/cbm/schematics/computers/b/p500-keyboard.txt +# http://www.floodgap.com/retrobits/ckb/secret/cbm-610-keyboard.jpg +# +# Keys starting with 'KP' are on the number pad. Both shifts and shift lock +# are in parallel at one point in matrix. +# +# 0 1 2 3 4 5 +# +--------+--------+--------+--------+--------+--------+ +# 0 | F9 | 9 ( | O | L | ; : | / ? | +# +--------+--------+--------+--------+--------+--------+ +# 1 | F10 | 0 ) | - | P | [ | ' " | +# +--------+--------+--------+--------+--------+--------+ +# 2 | c.down | = + |<- pound| ] | return | pi | +# +--------+--------+--------+--------+--------+--------+ +# 3 | c.up | c.left | c.right|del ins | CBM |########| +# +--------+--------+--------+--------+--------+--------+ +# 4 |home/clr|KP ? |KP 7 |KP 4 |KP 1 |KP 0 | +# +--------+--------+--------+--------+--------+--------+ +# 5 |rvs/off |KP CE |KP 8 |KP 5 |KP 2 |KP . | +# +--------+--------+--------+--------+--------+--------+ +# 6 | graph |KP * |KP 9 |KP 6 |KP 3 |KP 00 | +# +--------+--------+--------+--------+--------+--------+ +# 7 |run/stop|KP / |KP - |KP + |KP enter|########| +# +--------+--------+--------+--------+--------+--------+ +# 8 | F1 | escape | TAB |########| Shift | CTRL | +# +--------+--------+--------+--------+--------+--------+ +# 9 | F2 | 1 ! | Q | A | Z |########| +# +--------+--------+--------+--------+--------+--------+ +#10 | F3 | 2 @ | W | S | X | C | +# +--------+--------+--------+--------+--------+--------+ +#11 | F4 | 3 # | E | D | F | V | +# +--------+--------+--------+--------+--------+--------+ +#12 | F5 | 4 $ | R | T | G | B | +# +--------+--------+--------+--------+--------+--------+ +#13 | F6 | 5 % | 6 ^ | Y | H | N | +# +--------+--------+--------+--------+--------+--------+ +#14 | F7 | 7 & | U | J | M | space | +# +--------+--------+--------+--------+--------+--------+ +#15 | F8 | 8 * | I | K | , < | . > | +# +--------+--------+--------+--------+--------+--------+ + +# CBM2 Keyboard layout: +# +# F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 down up left right clr rvs graph r/s +# +# ESC 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) - =+ arrow/pound del ? CE * / +# TAB q w e r t y u i o p [ ] return 7 8 9 - +# SL a s d f g h j k l ;: '" pi 4 5 6 + +# LS z x c v b n m ,< .> /? RS CBM 1 2 3 +# CTRL SPACE 0 . 00 enter + +!CLEAR +!LSHIFT 8 4 +!RSHIFT 8 4 +!VSHIFT RSHIFT +!SHIFTL RSHIFT +!LCBM 3 4 +!VCBM LCBM +!LCTRL 8 5 +!VCTRL LCTRL + +27 8 1 8 /* ESC -> ESC */ + +49 9 1 8 /* 1 -> 1 */ +50 10 1 0x20 /* 2 -> 2 */ +50 1 5 0x80 /* shift 2 -> " */ +51 11 1 8 /* 3 -> 3 */ +52 12 1 8 /* 4 -> 4 */ +53 13 1 8 /* 5 -> 5 */ +54 13 2 0x20 /* 6 -> 6 */ +54 14 1 0x81 /* shift 6 -> & shift+7 */ +55 14 1 0x20 /* 7 -> 7 */ +55 0 5 0x90 /* shift 7 -> / */ +56 15 1 0x20 /* 8 -> 8 */ +56 0 1 0x80 /* shift 8 -> ( shift+9 */ +57 0 1 0x20 /* 9 -> 9 */ +57 1 1 0x80 /* shift 9 -> ) shift+0 */ +48 1 1 0x20 /* 0 -> 0 */ +48 2 1 0x90 /* shift 0 -> = */ + +223 4 1 0x00b0 /* shift ? -> ? */ +223 4 1 0x0201 /* ctrl ? -> ctrl+ */ + +180 2 2 8 /* ´ ` -> pound */ + +45 1 2 0x20 /* Minus -> Minus */ +45 2 2 0x90 /* shift+Minus -> left arrow */ + +306 8 5 0x4008 /* Left Ctrl -> CTRL */ +305 3 4 0x2008 /* Right Ctrl -> CBM */ + +304 8 4 4 /* Left Shift -> Shift */ +301 8 4 64 /* Caps Lock -> Shift Lock */ +303 8 4 4 /* Right Shift -> Shift */ + +32 14 5 8 /* Space -> Space */ +8 3 3 8 /* Backspace -> Del */ +9 8 2 8 /* TAB -> TAB */ +13 2 4 8 /* Return -> Return */ + +44 15 4 0x20 /* , -> , */ +44 0 4 0x90 /* shift , -> ; */ + +46 15 5 0x20 /* . -> . */ +46 0 4 0x420 /* ctrl . -> . */ +46 0 4 0x80 /* shift . -> : */ + +#47 0 5 8 /* / -> / */ + +60 15 4 0x021 /* < -> ,+shift */ +60 15 5 0x080 /* shift > -> .+shift */ + +43 2 1 0x21 /* + -> Plus */ +43 15 1 0x80 /* shift++ -> * */ + +252 10 1 1 /* ue -> @ */ +246 1 4 8 /* oe -> [ */ +228 2 3 8 /* ae -> ] */ + +35 11 1 33 /* # -> 3+shift */ +35 1 5 0x420 /* ctrl # -> '+ctrl */ +35 1 5 0x90 /* ' -> 7+shift */ + +94 13 2 0x021 /* ^ -> shift+6 (arrow up) */ +94 2 5 0x420 /* ctrl ^ -> pi */ +94 2 5 0x8b0 /* shift ^ -> pi */ + +113 9 2 0x28 /* Q -> Q */ +113 10 1 0x201 /* altgr Q -> @ */ + +119 10 2 8 /* W -> W */ +101 11 2 8 /* E -> E */ +114 12 2 8 /* R -> R */ +116 12 3 8 /* T -> T */ +121 13 3 8 /* Y -> Y */ +117 14 2 8 /* U -> U */ +105 15 2 8 /* I -> I */ +111 0 2 8 /* O -> O */ +112 1 3 8 /* P -> P */ +97 9 3 8 /* A -> A */ +115 10 3 8 /* S -> S */ +100 11 3 8 /* D -> D */ +102 11 4 8 /* F -> F */ +103 12 4 8 /* G -> G */ +104 13 4 8 /* H -> H */ +106 14 3 8 /* J -> J */ +107 15 3 8 /* K -> K */ +108 0 3 8 /* L -> L */ +122 9 4 8 /* Z -> Z */ +120 10 4 8 /* X -> X */ +99 10 5 8 /* C -> C */ +118 11 5 8 /* V -> V */ +98 12 5 8 /* B -> B */ +110 13 5 8 /* N -> N */ +109 14 4 8 /* M -> M */ + + +282 8 0 8 /* F1 -> F1 */ +283 9 0 8 /* F2 -> F2 */ +284 10 0 8 /* F3 -> F3 */ +285 11 0 8 /* F4 -> F4 */ +286 12 0 8 /* F5 -> F5 */ +287 13 0 8 /* F6 -> F6 */ +288 14 0 8 /* F7 -> F7 */ +289 15 0 8 /* F8 -> F8 */ +290 0 0 8 /* F9 -> F9 */ +291 1 0 8 /* F10 -> F10 */ + +#292 1 0 8 /* F11 -> (unused) */ +#293 1 0 8 /* F12 -> run/stop */ + +273 3 0 8 /* Up -> CRSR UP */ +276 3 1 8 /* Left -> CRSR LEFT */ +275 3 2 8 /* Right -> CRSR RIGHT */ +274 2 0 8 /* Down -> CRSR DOWN */ + +277 6 5 8 /* Ins -> KP 00 */ +127 5 1 8 /* Del -> KP CE */ +278 4 0 8 /* Home -> CLR/HOME */ +279 5 0 8 /* End -> Rev/Off */ +280 7 0 8 /* PgUp -> Run/Stop */ +281 6 0 8 /* PgDown -> Norm/Graph */ + +271 7 4 8 /* Numpad Enter -> Numpad Enter */ +267 7 1 8 /* Numpad / -> Numpad / */ +268 6 1 8 /* Numpad * -> Numpad * */ +263 4 2 8 /* Numpad 7 -> Numpad 7 */ +264 5 2 8 /* Numpad 8 -> Numpad 8 */ +265 6 2 8 /* Numpad 9 -> Numpad 9 */ +269 7 2 8 /* Numpad - -> Numpad - */ +260 4 3 8 /* Numpad 4 -> Numpad 4 */ +261 5 3 8 /* Numpad 5 -> Numpad 5 */ +262 6 3 8 /* Numpad 6 -> Numpad 6 */ +270 7 3 8 /* Numpad + -> Numpad + */ +257 4 4 8 /* Numpad 1 -> Numpad 1 */ +258 5 4 8 /* Numpad 2 -> Numpad 2 */ +259 6 4 8 /* Numpad 3 -> Numpad 3 */ +256 4 5 8 /* Numpad 0 -> Numpad 0 */ +266 5 5 8 /* Numpad . -> Numpad . */ Modified: trunk/vice/data/PLUS4/gtk3_pos.vkm =================================================================== --- trunk/vice/data/PLUS4/gtk3_pos.vkm 2025-03-27 15:08:19 UTC (rev 45594) +++ trunk/vice/data/PLUS4/gtk3_pos.vkm 2025-03-27 19:02:17 UTC (rev 45595) @@ -93,7 +93,7 @@ # +--------+--------+--------+--------+--------+--------+--------+--------+ # 5 |DOWN |P |L |UP |. > |: [ |- |, < | # +--------+--------+--------+--------+--------+--------+--------+--------+ -# 6 |LEFT |* |; ] |RIGHT |ESC |= |+ |/ ? | +# 6 |LEFT |* |; ] |RIGHT |ESC |= <- pi |+ |/ ? | # +--------+--------+--------+--------+--------+--------+--------+--------+ # 7 |1 ! |CLR/HOME| CTRLs |2 " |SPACE |CBM |Q |RUN/STOP| # +--------+--------+--------+--------+--------+--------+--------+--------+ @@ -338,5 +338,7 @@ Print -5 15 KP_0 -5 16 KP_Delete -5 17 +KP_Decimal -5 17 +KP_Separator -5 17 KP_Enter -5 18 KP_Add -5 19 Modified: trunk/vice/data/PLUS4/gtk3_pos_de.vkm =================================================================== --- trunk/vice/data/PLUS4/gtk3_pos_de.vkm 2025-03-27 15:08:19 UTC (rev 45594) +++ trunk/vice/data/PLUS4/gtk3_pos_de.vkm 2025-03-27 19:02:17 UTC (rev 45595) @@ -93,7 +93,7 @@ # +--------+--------+--------+--------+--------+--------+--------+--------+ # 5 |DOWN |P |L |UP |. > |: [ |- |, < | # +--------+--------+--------+--------+--------+--------+--------+--------+ -# 6 |LEFT |* |; ] |RIGHT |ESC |= |+ |/ ? | +# 6 |LEFT |* |; ] |RIGHT |ESC |= <- pi |+ |/ ? | # +--------+--------+--------+--------+--------+--------+--------+--------+ # 7 |1 ! |CLR/HOME| CTRLs |2 " |SPACE |CBM |Q |RUN/STOP| # +--------+--------+--------+--------+--------+--------+--------+--------+ @@ -344,5 +344,6 @@ KP_0 -5 16 KP_Delete -5 17 KP_Decimal -5 17 +KP_Separator -5 17 KP_Enter -5 18 KP_Add -5 19 Modified: trunk/vice/data/PLUS4/gtk3_sym.vkm =================================================================== --- trunk/vice/data/PLUS4/gtk3_sym.vkm 2025-03-27 15:08:19 UTC (rev 45594) +++ trunk/vice/data/PLUS4/gtk3_sym.vkm 2025-03-27 19:02:17 UTC (rev 45595) @@ -93,7 +93,7 @@ # +--------+--------+--------+--------+--------+--------+--------+--------+ # 5 |DOWN |P |L |UP |. > |: [ |- |, < | # +--------+--------+--------+--------+--------+--------+--------+--------+ -# 6 |LEFT |* |; ] |RIGHT |ESC |= |+ |/ ? | +# 6 |LEFT |* |; ] |RIGHT |ESC |= <- pi |+ |/ ? | # +--------+--------+--------+--------+--------+--------+--------+--------+ # 7 |1 ! |CLR/HOME| CTRLs |2 " |SPACE |CBM |Q |RUN/STOP| # +--------+--------+--------+--------+--------+--------+--------+--------+ @@ -204,8 +204,8 @@ at 0 7 16 # \ = Pound Sterling backslash 0 2 8 -# | = Shift-minus -bar 5 6 1 +# | = Shift-Pound +bar 0 2 1 # { -> CBM-W graphic braceleft 1 1 2064 @@ -350,5 +350,7 @@ Print -5 15 KP_0 -5 16 KP_Delete -5 17 +KP_Decimal -5 17 +KP_Separator -5 17 KP_Enter -5 18 KP_Add -5 19 Modified: trunk/vice/data/PLUS4/gtk3_sym_de.vkm =================================================================== --- trunk/vice/data/PLUS4/gtk3_sym_de.vkm 2025-03-27 15:08:19 UTC (rev 45594) +++ trunk/vice/data/PLUS4/gtk3_sym_de.vkm 2025-03-27 19:02:17 UTC (rev 45595) @@ -93,7 +93,7 @@ # +--------+--------+--------+--------+--------+--------+--------+--------+ # 5 |DOWN |P |L |UP |. > |: [ |- |, < | # +--------+--------+--------+--------+--------+--------+--------+--------+ -# 6 |LEFT |* |; ] |RIGHT |ESC |= |+ |/ ? | +# 6 |LEFT |* |; ] |RIGHT |ESC |= <- pi |+ |/ ? | # +--------+--------+--------+--------+--------+--------+--------+--------+ # 7 |1 ! |CLR-HOME|CTRL |2 " |SPACE |CBM |Q |RUN-STOP| # +--------+--------+--------+--------+--------+--------+--------+--------+ @@ -322,5 +322,6 @@ KP_0 -5 16 KP_Delete -5 17 KP_Decimal -5 17 +KP_Separator -5 17 KP_Enter -5 18 KP_Add -5 19 Modified: trunk/vice/data/PLUS4/sdl_pos.vkm =================================================================== --- trunk/vice/data/PLUS4/sdl_pos.vkm 2025-03-27 15:08:19 UTC (rev 45594) +++ trunk/vice/data/PLUS4/sdl_pos.vkm 2025-03-27 19:02:17 UTC (rev 45595) @@ -98,7 +98,7 @@ # +--------+--------+--------+--------+--------+--------+--------+--------+ # 5 |DOWN |P |L |UP |. > |: [ |- |, < | # +--------+--------+--------+--------+--------+--------+--------+--------+ -# 6 |LEFT |* |; ] |RIGHT |ESC |= |+ |/ ? | +# 6 |LEFT |* |; ] |RIGHT |ESC |= <- pi |+ |/ ? | # +--------+--------+--------+--------+--------+--------+--------+--------+ # 7 |1 ! |CLR/HOME| CTRLs |2 " |SPACE |CBM |Q |RUN/STOP| # +--------+--------+--------+--------+--------+--------+--------+--------+ @@ -196,14 +196,20 @@ 287 0 6 1 /* F6 -> F6 */ 288 0 3 1 /* F7 -> F7 */ 289 0 3 8 /* F8 -> HELP */ + 278 7 1 8 /* Home -> CLR/HOME */ 273 5 3 8 /* Up -> CRSR UP */ 276 6 0 8 /* Left -> CRSR LEFT */ 275 6 3 8 /* Right -> CRSR RIGHT */ 274 5 0 8 /* Down -> CRSR DOWN */ + 277 6 5 8 /* Ins -> = */ 127 6 1 8 /* Del -> * */ +# Restore key mappings +#280 -3 0 /* Page Up -> RESTORE */ +280 6 4 8 /* Page Up -> Escape */ + # Joyport-attached keypad key mappings 300 -5 0 /* NumLock -> keypad x0 */ 263 -5 1 /* NumPad 7 -> keypad 7 */ Modified: trunk/vice/data/PLUS4/sdl_sym.vkm =================================================================== --- trunk/vice/data/PLUS4/sdl_sym.vkm 2025-03-27 15:08:19 UTC (rev 45594) +++ trunk/vice/data/PLUS4/sdl_sym.vkm 2025-03-27 19:02:17 UTC (rev 45595) @@ -98,7 +98,7 @@ # +--------+--------+--------+--------+--------+--------+--------+--------+ # 5 |DOWN |P |L |UP |. > |: [ |- |, < | # +--------+--------+--------+--------+--------+--------+--------+--------+ -# 6 |LEFT |* |; ] |RIGHT |ESC |= |+ |/ ? | +# 6 |LEFT |* |; ] |RIGHT |ESC |= <- pi |+ |/ ? | # +--------+--------+--------+--------+--------+--------+--------+--------+ # 7 |1 ! |CLR/HOME| CTRLs |2 " |SPACE |CBM |Q |RUN/STOP| # +--------+--------+--------+--------+--------+--------+--------+--------+ @@ -133,6 +133,10 @@ !VCTRL LCTRL 27 7 7 8 /* ESC -> Run/Stop */ + +96 3 0 0x21 /* ` -> shift+7 */ +96 6 5 0x81 /* shift ` -> arrow left */ + 49 7 0 8 /* 1 -> 1 */ 50 7 3 32 /* 2 -> 2 */ 50 0 7 0x90 /* @ -> @ */ @@ -154,6 +158,7 @@ 61 6 5 32 /* Equal -> Equal */ 61 6 6 0x90 /* + -> + */ 8 0 0 8 /* Backspace -> Del */ + 9 7 5 8200 /* TAB -> CBM */ 113 7 6 8 /* Q -> Q */ 119 1 1 8 /* W -> W */ @@ -168,6 +173,7 @@ 91 5 5 1 /* [ -> [ */ 93 6 2 1 /* ] -> ] */ 13 0 1 8 /* Return -> Return */ + 306 7 2 16392 /* Left Ctrl -> CTRL */ 97 1 2 8 /* A -> A */ 115 1 5 8 /* S -> S */ @@ -182,8 +188,8 @@ 59 5 5 0x90 /* : -> : */ 39 3 0 33 /* ' -> ' */ 39 7 3 0x80 /* " -> " */ -96 6 4 8 /* ` -> Esc */ -92 6 1 8 /* \ -> * */ + +92 0 2 8 /* \ -> pound */ 301 1 7 64 /* Caps Lock -> Shift Lock */ 304 1 7 4 /* Left Shift -> Left Shift */ 122 1 4 8 /* Z -> Z */ @@ -206,14 +212,24 @@ 287 0 6 1 /* F6 -> F6 */ 288 0 3 1 /* F7 -> F7 */ 289 0 3 8 /* F8 -> HELP */ -278 7 1 8 /* Home -> CLR/HOME */ + 273 5 3 8 /* Up -> CRSR UP */ 276 6 0 8 /* Left -> CRSR LEFT */ 275 6 3 8 /* Right -> CRSR RIGHT */ 274 5 0 8 /* Down -> CRSR DOWN */ -277 6 5 8 /* Ins -> = */ -127 6 1 8 /* Del -> * */ +277 0 0 1 /* Ins -> Insert */ +127 0 0 8 /* Del -> Delete */ +278 7 1 8 /* Home -> CLR/HOME */ +279 6 5 1 /* End -> arrow left */ + +281 6 5 0x820 /* page down -> pi */ +281 4 3 0x81 /* shift page down -> arrow up */ + +# Restore key mappings +#280 -3 0 /* Page Up -> RESTORE */ +280 6 4 8 /* Page Up -> Escape */ + # Joyport-attached keypad key mappings 300 -5 0 /* NumLock -> keypad x0 */ 263 -5 1 /* NumPad 7 -> keypad 7 */ Modified: trunk/vice/data/PLUS4/sdl_sym_de.vkm =================================================================== --- trunk/vice/data/PLUS4/sdl_sym_de.vkm 2025-03-27 15:08:19 UTC (rev 45594) +++ trunk/vice/data/PLUS4/sdl_sym_de.vkm 2025-03-27 19:02:17 UTC (rev 45595) @@ -98,7 +98,7 @@ # +--------+--------+--------+--------+--------+--------+--------+--------+ # 5 |DOWN |P |L |UP |. > |: [ |- |, < | # +--------+--------+--------+--------+--------+--------+--------+--------+ -# 6 |LEFT |* |; ] |RIGHT |ESC |= |+ |/ ? | +# 6 |LEFT |* |; ] |RIGHT |ESC |= <- pi |+ |/ ? | # +--------+--------+--------+--------+--------+--------+--------+--------+ # 7 |1 ! |CLR/HOME| CTRLs |2 " |SPACE |CBM |Q |RUN/STOP| # +--------+--------+--------+--------+--------+--------+--------+--------+ @@ -142,8 +142,11 @@ 286 0 5 1 /* F5 -> F5 */ 284 0 6 8 /* F3 -> F3 */ 287 0 6 1 /* F6 -> F6 */ + 113 7 6 40 /* Q -> Q */ 113 0 7 512 /* altgr + q -> @ */ +109 4 4 0x0028 /* M -> M */ +109 6 5 0x0a00 /* altgr + M -> pi */ 301 1 7 64 /* Caps Lock -> Shift Lock */ 304 1 7 4 /* Left Shift -> Left Shift */ @@ -152,11 +155,10 @@ 27 7 7 8 /* ESC -> Run/Stop */ 9 7 5 8200 /* TAB -> CBM */ +252 0 7 8 /* ue -> @ */ +246 5 5 8 /* oe -> [ */ +228 6 2 8 /* ae -> ] */ -252 0 7 8 /* (de) ue -> @ */ -246 5 5 8 /* (de) oe -> [ */ -228 6 2 8 /* (de) ae -> ] */ - 274 5 0 8 /* Down -> CRSR DOWN */ 273 5 3 8 /* Up -> CRSR UP */ 276 6 0 8 /* Left -> CRSR LEFT */ @@ -164,9 +166,13 @@ 46 5 4 32 /* . -> . */ 46 5 5 144 /* shift+. -> : */ -60 5 7 33 /* < -> ,+shift */ -60 5 4 128 /* > -> .+shift */ +60 5 7 0x021 /* < -> ,+shift */ +60 5 4 0x0a0 /* > -> .+shift */ +60 0 2 0x210 /* altgr + < -> pound */ + +180 0 2 8 /* ´ ` -> pound */ + 43 6 6 32 /* + -> Plus */ 43 6 1 144 /* shift++ -> * */ @@ -177,9 +183,15 @@ 45 6 5 128 /* shift+- -> shift+= */ 96 6 4 8 /* ` -> Esc */ -223 6 7 1 /* ? -> ? */ +223 6 5 0x0021 /* ß -> arrow left */ +223 6 7 0x00a0 /* shift ? -> ? */ +223 6 5 0x0a00 /* altgr \ -> pi */ 278 7 1 8 /* Home -> CLR/HOME */ +279 6 5 1 /* End -> arrow left */ +277 0 0 1 /* Ins -> Insert */ +127 0 0 8 /* Del -> Delete */ + 32 7 4 8 /* Space -> Space */ 35 1 0 33 /* # -> 3+shift */ @@ -211,8 +223,10 @@ 48 4 3 32 /* 0 -> 0 */ # 128+16 shifted on host, deshifted on C16 48 6 5 144 /* = -> = */ -94 4 3 1 /* ^ -> shift+0 (arrow up) */ +94 4 3 0x021 /* ^ -> shift+0 (arrow up) */ +94 6 5 0x890 /* shift ^ -> pi */ + 97 1 2 8 /* A -> A */ 98 3 4 8 /* B -> B */ 99 2 4 8 /* C -> C */ @@ -225,7 +239,7 @@ 106 4 2 8 /* J -> J */ 107 4 5 8 /* K -> K */ 108 5 2 8 /* L -> L */ -109 4 4 8 /* M -> M */ +#109 4 4 8 /* M -> M */ 110 4 7 8 /* N -> N */ 111 4 6 8 /* O -> O */ 112 5 1 8 /* P -> P */ @@ -241,7 +255,8 @@ 122 1 4 8 /* Z -> Z */ # Restore key mappings -280 -3 0 /* Page Up -> RESTORE */ +#280 -3 0 /* Page Up -> RESTORE */ +280 6 4 8 /* Page Up -> Escape */ # Joyport-attached keypad key mappings 300 -5 0 /* NumLock -> keypad x0 */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-03-27 15:08:21
|
Revision: 45594 http://sourceforge.net/p/vice-emu/code/45594 Author: compyx Date: 2025-03-27 15:08:19 +0000 (Thu, 27 Mar 2025) Log Message: ----------- Joystick: fix headless build Modified Paths: -------------- branches/compyx/joymap-001/vice/src/joyport/joystick.c branches/compyx/joymap-001/vice/src/machine.c Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c =================================================================== --- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-27 14:01:49 UTC (rev 45593) +++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-27 15:08:19 UTC (rev 45594) @@ -2724,21 +2724,7 @@ #endif /* Initialize arch-specific driver: registers driver and devices */ -#if 0 -#if defined(LINUX_JOYSTICK) && !defined(HAVE_LINUX_EVDEV) - linux_joystick_init(); -#elif defined(HAVE_LINUX_EVDEV) - linux_joystick_evdev_init(); -#elif defined HAS_USB_JOYSTICK - bsd_joystick_init(); -#elif defined MAC_JOYSTICK - joy_hidlib_init(); -#elif defined HAVE_DINPUT - win32_joystick_init(); -#elif defined HAVE_SDL_NUMJOYSTICKS - joy_sdl_init(); -#endif -#else +#if !defined(USE_HEADLESSUI) joystick_arch_init(); #endif Modified: branches/compyx/joymap-001/vice/src/machine.c =================================================================== --- branches/compyx/joymap-001/vice/src/machine.c 2025-03-27 14:01:49 UTC (rev 45593) +++ branches/compyx/joymap-001/vice/src/machine.c 2025-03-27 15:08:19 UTC (rev 45594) @@ -378,8 +378,9 @@ #ifdef MAC_JOYSTICK joy_hidlib_exit(); #endif +#if !defined(USE_HEADLESSUI) joystick_arch_shutdown(); - +#endif sound_close(); printer_shutdown(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-03-27 14:02:01
|
Revision: 45593 http://sourceforge.net/p/vice-emu/code/45593 Author: compyx Date: 2025-03-27 14:01:49 +0000 (Thu, 27 Mar 2025) Log Message: ----------- Merge trunk (r45582:HEAD) into branch Modified Paths: -------------- branches/compyx/joymap-001/vice/src/arch/gtk3/linenoise.c branches/compyx/joymap-001/vice/src/monitor/monitor_binary.c Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/linenoise.c =================================================================== --- branches/compyx/joymap-001/vice/src/arch/gtk3/linenoise.c 2025-03-27 13:59:36 UTC (rev 45592) +++ branches/compyx/joymap-001/vice/src/arch/gtk3/linenoise.c 2025-03-27 14:01:49 UTC (rev 45593) @@ -5,9 +5,14 @@ * * Modified for the VICE project by Fabrizio Gennari, * for use in combination with a terminal - * not represented by a couple of file descrptors + * not represented by a couple of file descriptors * (abstracted buy the opaque struct console_private_s) * + * NOTE: Due to the above, it is not possible to share this modified library + * with anything else. Also due to how the GTK monitor works, we can not replace + * this modified library by a standard linenoise (or -ng), which works on top + * of file descriptors. + * * You can find the latest source code at: * * http://github.com/antirez/linenoise Modified: branches/compyx/joymap-001/vice/src/monitor/monitor_binary.c =================================================================== --- branches/compyx/joymap-001/vice/src/monitor/monitor_binary.c 2025-03-27 13:59:36 UTC (rev 45592) +++ branches/compyx/joymap-001/vice/src/monitor/monitor_binary.c 2025-03-27 14:01:49 UTC (rev 45593) @@ -1455,7 +1455,7 @@ unsigned char *response_cursor; uint8_t instruction_length = 4; uint16_t requested_count, count = 0; - uint32_t response_size; + uint64_t response_size; int item_size = 2 + registers_per_row * (MON_REGISTER_ITEM_SIZE + 1) + 8 + 1 + instruction_length; cpuhistory_t *current; @@ -1495,9 +1495,16 @@ } response_size = 4 + count * (item_size + 1); + if (response_size > UINT32_MAX) { + monitor_binary_error(e_MON_ERR_INVALID_PARAMETER, command->request_id); + log_message(LOG_DEFAULT, "monitor binary cpuhistory: Response too long %lu", response_size); + return; + } + response = lib_malloc(response_size); response_cursor = response; + regs = lib_calloc(1, sizeof(mon_reg_list_t) * (registers_per_row + 1)); templates = mon_register_list_get(memspace); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-03-27 13:59:39
|
Revision: 45592 http://sourceforge.net/p/vice-emu/code/45592 Author: compyx Date: 2025-03-27 13:59:36 +0000 (Thu, 27 Mar 2025) Log Message: ----------- mkdoxy.sh: add `src/arch/gtk3/joystickdrv/ and `src/joyport/` to INPUT Also delete a few directories that no longer exist in the current tree. Modified Paths: -------------- branches/compyx/joymap-001/vice/doc/mkdoxy.sh branches/compyx/joymap-001/vice/src/joyport/joystick.c Modified: branches/compyx/joymap-001/vice/doc/mkdoxy.sh =================================================================== --- branches/compyx/joymap-001/vice/doc/mkdoxy.sh 2025-03-27 07:14:16 UTC (rev 45591) +++ branches/compyx/joymap-001/vice/doc/mkdoxy.sh 2025-03-27 13:59:36 UTC (rev 45592) @@ -73,6 +73,7 @@ ARCH_GTK3_INPUT=" ../src/arch/gtk3" ARCH_GTK3_INPUT+=" ../src/arch/gtk3/widgets" ARCH_GTK3_INPUT+=" ../src/arch/gtk3/widgets/base" +ARCH_GTK3_INPUT+=" ../src/arch/gtk3/joystickdrv" ARCH_SDL_INPUT=" ../src/arch/sdl" @@ -87,6 +88,7 @@ INPUT+=" ../src/hwsiddrv" INPUT+=" ../src/iecbus" INPUT+=" ../src/imagecontents" +INPUT+=" ../src/joyport" INPUT+=" ../src/monitor" INPUT+=" ../src/parallel" INPUT+=" ../src/printerdrv" Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c =================================================================== --- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-27 07:14:16 UTC (rev 45591) +++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-27 13:59:36 UTC (rev 45592) @@ -3711,6 +3711,7 @@ return (int)num_joystick_devices; } + /** \brief Set joystick device name * * Set name of \a joydev to \a name, deallocating the old name if present. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-03-27 07:14:19
|
Revision: 45591 http://sourceforge.net/p/vice-emu/code/45591 Author: compyx Date: 2025-03-27 07:14:16 +0000 (Thu, 27 Mar 2025) Log Message: ----------- Joystick: Add `joystick_device_set_name()` and `joystick_device_set_node()` Using these functions makes sure `lib_malloc()` is used to allocate memory for the name and node strings of a device. Might avoid possible pitfalls for future joystick driver writers. Modified Paths: -------------- branches/compyx/joymap-001/vice/src/joyport/joystick.c branches/compyx/joymap-001/vice/src/joyport/joystick.h Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c =================================================================== --- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-27 06:54:00 UTC (rev 45590) +++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-27 07:14:16 UTC (rev 45591) @@ -3711,7 +3711,42 @@ return (int)num_joystick_devices; } +/** \brief Set joystick device name + * + * Set name of \a joydev to \a name, deallocating the old name if present. + * + * \param[in] joydev joystick device + * \param[in] name joystick name + */ +void joystick_device_set_name(joystick_device_t *joydev, const char *name) +{ + lib_free(joydev->name); + if (name != NULL) { + joydev->name = lib_strdup(name); + } else { + joydev->name = NULL; + } +} + +/** \brief Set joystick device node + * + * Set node of \a joydev to \a node, deallocating the old node if present. + * + * \param[in] joydev joystick device + * \param[in] node joystick node + */ +void joystick_device_set_node(joystick_device_t *joydev, const char *node) +{ + lib_free(joydev->node); + if (node != NULL) { + joydev->node = lib_strdup(node); + } else { + joydev->node = NULL; + } +} + + /** \brief Initialize joystick mapping * * \param[in] mapping joystick mapping Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.h =================================================================== --- branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-27 06:54:00 UTC (rev 45590) +++ branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-27 07:14:16 UTC (rev 45591) @@ -444,6 +444,11 @@ joystick_device_t *joystick_device_by_index (int index); int joystick_device_count (void); +void joystick_device_set_name (joystick_device_t *joydev, + const char *name); +void joystick_device_set_node (joystick_device_t *joydev, + const char *node); + void joystick_device_add_axis (joystick_device_t *joydev, joystick_axis_t *axis); void joystick_device_add_button(joystick_device_t *joydev, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-03-27 06:54:03
|
Revision: 45590 http://sourceforge.net/p/vice-emu/code/45590 Author: compyx Date: 2025-03-27 06:54:00 +0000 (Thu, 27 Mar 2025) Log Message: ----------- Joystick: implement inverting button and axis values if requested Use the calibration struct's `invert` member to determine if we need to invert the value of a button or an axis event. Can be used if our assumptions on axis (low = left/up, high = right/down) and button (0 = released, non-0 = pressed) don't hold. Modified Paths: -------------- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c branches/compyx/joymap-001/vice/src/joyport/joystick.c Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c =================================================================== --- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-03-26 13:02:33 UTC (rev 45589) +++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-03-27 06:54:00 UTC (rev 45590) @@ -249,8 +249,15 @@ */ static void linux_joystick_customize(joystick_device_t *joydev) { +#if 0 printf("%s() called for device %04x:%04x\n", __func__, (unsigned int)joydev->vendor, (unsigned int)joydev->product); + + if (joydev->vendor == 0x46d && joydev->product == 0xc21f) { + printf("%s(): inverting Y axis for F710\n", __func__); + joydev->axes[1]->calibration.invert = true; + } +#endif } /** \brief Filter callback for scandir(3) Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c =================================================================== --- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-26 13:02:33 UTC (rev 45589) +++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-27 06:54:00 UTC (rev 45590) @@ -3013,6 +3013,10 @@ /* digital axes don't require calibration: */ if (axis->digital) { + /* calibration: invert value? */ + if (axis->calibration.invert) { + value *= -1; + } if (value < 0) { direction = JOY_AXIS_NEGATIVE; } else if (value > 0) { @@ -3020,6 +3024,25 @@ } } else { /* here we apply calibration */ + if (axis->calibration.invert) { + /* invert value by calculating the distance from center and taking + * the opposite side of the center */ + uint32_t range = axis->maximum - axis->minimum; + int32_t center; + + /* integer range: add 1 but avoid overflow (unlikely since HID + * axis values appear to be 16-bit signed integers) */ + if (range < UINT32_MAX) { + range++; + } + + center = axis->maximum - (range / 2); +#if 0 + printf("%s(): inverting %d: [%d-%d] -> %d\n", + __func__, value, axis->minimum, axis->maximum, center - value); +#endif + value = center - value; + } if (value <= axis->calibration.threshold.negative) { direction = JOY_AXIS_NEGATIVE; } else if (value >= axis->calibration.threshold.positive) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emp...@us...> - 2025-03-26 13:02:45
|
Revision: 45589 http://sourceforge.net/p/vice-emu/code/45589 Author: empathicqubit Date: 2025-03-26 13:02:33 +0000 (Wed, 26 Mar 2025) Log Message: ----------- Make sure the CPU history response isn't too long before sending. Modified Paths: -------------- trunk/vice/src/monitor/monitor_binary.c Modified: trunk/vice/src/monitor/monitor_binary.c =================================================================== --- trunk/vice/src/monitor/monitor_binary.c 2025-03-26 07:36:35 UTC (rev 45588) +++ trunk/vice/src/monitor/monitor_binary.c 2025-03-26 13:02:33 UTC (rev 45589) @@ -1455,7 +1455,7 @@ unsigned char *response_cursor; uint8_t instruction_length = 4; uint16_t requested_count, count = 0; - uint32_t response_size; + uint64_t response_size; int item_size = 2 + registers_per_row * (MON_REGISTER_ITEM_SIZE + 1) + 8 + 1 + instruction_length; cpuhistory_t *current; @@ -1495,9 +1495,16 @@ } response_size = 4 + count * (item_size + 1); + if (response_size > UINT32_MAX) { + monitor_binary_error(e_MON_ERR_INVALID_PARAMETER, command->request_id); + log_message(LOG_DEFAULT, "monitor binary cpuhistory: Response too long %lu", response_size); + return; + } + response = lib_malloc(response_size); response_cursor = response; + regs = lib_calloc(1, sizeof(mon_reg_list_t) * (registers_per_row + 1)); templates = mon_register_list_get(memspace); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-03-26 07:36:49
|
Revision: 45588 http://sourceforge.net/p/vice-emu/code/45588 Author: compyx Date: 2025-03-26 07:36:35 +0000 (Wed, 26 Mar 2025) Log Message: ----------- Joystick: BSD: only trigger events when values actually changed Avoid floods of callbacks to `joy_foo_event()` in common code by checking if the raw value of an input has actually changed before calling a joystick event handler in common code. Modified Paths: -------------- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c =================================================================== --- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-26 07:15:13 UTC (rev 45587) +++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-26 07:36:35 UTC (rev 45588) @@ -98,11 +98,14 @@ /** \brief Driver-specific data */ typedef struct joy_priv_s { - void *buffer; /**< buffer for reading HID data */ - report_desc_t rep_desc; /**< HID report descriptor */ - int rep_size; /**< size of \c rep_desc */ - int rep_id; /**< report ID */ - int fd; /**< file descriptor associated with a HID device */ + void *buffer; /**< buffer for reading HID data */ + report_desc_t rep_desc; /**< HID report descriptor */ + int rep_size; /**< size of \c rep_desc */ + int rep_id; /**< report ID */ + int fd; /**< file descriptor of HID device */ + int *prev_axes; /**< previous raw value of axes */ + int *prev_buttons; /**< previous raw value of buttons */ + int *prev_hats; /**< previous raw value of hats */ } joy_priv_t; @@ -140,6 +143,9 @@ priv->rep_size = 0; priv->fd = -1; priv->rep_id = 0; + priv->prev_axes = NULL; + priv->prev_buttons = NULL; + priv->prev_hats = NULL; return priv; } @@ -158,12 +164,13 @@ if (p->fd >= 0) { close(p->fd); } - if (p->buffer != NULL) { - lib_free(p->buffer); - } + lib_free(p->buffer); if (p->rep_desc != NULL) { hid_dispose_report_desc(p->rep_desc); } + lib_free(p->prev_axes); + lib_free(p->prev_buttons); + lib_free(p->prev_hats); lib_free(p); } } @@ -204,6 +211,7 @@ int value = hid_get_data(priv->buffer, &item); int usage = HID_USAGE(item.usage); unsigned int page = HID_PAGE(item.usage); + int prev; switch (page) { case HUP_GENERIC_DESKTOP: @@ -223,7 +231,11 @@ * So for FreeBSD we'd need calibration to be * implemented for the F710 to work. */ - joy_axis_event(joydev, axis, (int32_t)value); + prev = priv->prev_axes[axis->index]; + if (value != prev) { + priv->prev_axes[axis->index] = value; + joy_axis_event(joydev, axis, (int32_t)value); + } } break; @@ -231,7 +243,11 @@ /* hat */ hat = joystick_hat_from_code(joydev, (uint32_t)usage); if (hat != NULL) { - joy_hat_event(joydev, hat, (int32_t)value); + prev = priv->prev_hats[hat->index]; + if (prev != value) { + priv->prev_hats[hat->index] = value; + joy_hat_event(joydev, hat, (int32_t)value); + } } break; @@ -242,7 +258,11 @@ /* D-Pad is mapped as buttons */ button = joystick_button_from_code(joydev, (uint32_t)usage); if (button != NULL) { - joy_button_event(joydev, button, (int32_t)value); + prev = priv->prev_buttons[button->index]; + if (prev != value) { + priv->prev_buttons[button->index] = value; + joy_button_event(joydev, button, (int32_t)value); + } } break; default: @@ -253,7 +273,11 @@ /* button event */ button = joystick_button_from_code(joydev, (uint32_t)usage); if (button != NULL) { - joy_button_event(joydev, button, (int32_t)value); + prev = priv->prev_buttons[button->index]; + if (prev != value) { + priv->prev_buttons[button->index] = value; + joy_button_event(joydev, button, (int32_t)value); + } } break; default: @@ -602,8 +626,19 @@ "failed to register device %s (\"%s\")", joydev->node, joydev->name); joystick_device_free(joydev); + } else { + /* allocate arrays for previous values of inputs */ + joy_priv_t *priv = joydev->priv; + + priv->prev_axes = lib_malloc((size_t)joydev->num_axes * + sizeof *priv->prev_axes); + priv->prev_buttons = lib_malloc((size_t)joydev->num_buttons * + sizeof *priv->prev_buttons); + priv->prev_hats = lib_malloc((size_t)joydev->num_hats * + sizeof *priv->prev_hats); } } else { + /* failure while scanning: log and free invalid device */ log_warning(bsd_joy_log, "failed to scan inputs for device %s (\"%s\")", joydev->node, joydev->name); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-03-26 07:15:16
|
Revision: 45587 http://sourceforge.net/p/vice-emu/code/45587 Author: compyx Date: 2025-03-26 07:15:13 +0000 (Wed, 26 Mar 2025) Log Message: ----------- Joystick: make sure to regenerate indexes of inputs after sorting Modified Paths: -------------- branches/compyx/joymap-001/vice/src/joyport/joystick.c Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c =================================================================== --- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-26 07:09:00 UTC (rev 45586) +++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-26 07:15:13 UTC (rev 45587) @@ -3565,6 +3565,8 @@ */ static void order_inputs_on_code(joystick_device_t *joydev) { + int i; + #if 0 printf("%s(): == BEFORE SORTING ==\n", __func__); dump_axes(joydev); @@ -3580,6 +3582,18 @@ if (joydev->num_hats > 1) { qsort(joydev->hats, (size_t)(joydev->num_hats), sizeof joydev->hats[0], cmp_hats); } + + /* regenerate indexes of inputs */ + for (i = 0; i < joydev->num_axes; i++) { + joydev->axes[i]->index = i; + } + for (i = 0; i < joydev->num_buttons; i++) { + joydev->buttons[i]->index = i; + } + for (i = 0; i < joydev->num_hats; i++) { + joydev->hats[i]->index = i; + } + #if 0 printf("%s(): == AFTER SORTING ==\n", __func__); dump_axes(joydev); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-03-26 07:09:07
|
Revision: 45586 http://sourceforge.net/p/vice-emu/code/45586 Author: compyx Date: 2025-03-26 07:09:00 +0000 (Wed, 26 Mar 2025) Log Message: ----------- Joystick: BSD: add missing Doxygen docblocks Modified Paths: -------------- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c =================================================================== --- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-25 21:28:12 UTC (rev 45585) +++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-26 07:09:00 UTC (rev 45586) @@ -78,18 +78,31 @@ #include "types.h" #include "util.h" +/* Constants used when calling scandir(3) and (re)constructing nodes in the + * file system of HID devices + */ + +/** \brief Root directory of \c uhid* files */ #define ROOT_NODE "/dev" + +/** \brief Length of the #ROOT_NODE */ #define ROOT_NODE_LEN 4 + +/** \brief Prefix of HID files in the \c /dev virtual file system */ #define NODE_PREFIX "uhid" + +/** \brief Length of the #NODE_PREIFX */ #define NODE_PREFIX_LEN 4 +/** \brief Driver-specific data + */ typedef struct joy_priv_s { - void *buffer; - report_desc_t rep_desc; - int rep_size; - int rep_id; - int fd; + void *buffer; /**< buffer for reading HID data */ + report_desc_t rep_desc; /**< HID report descriptor */ + int rep_size; /**< size of \c rep_desc */ + int rep_id; /**< report ID */ + int fd; /**< file descriptor associated with a HID device */ } joy_priv_t; @@ -155,11 +168,19 @@ } } +/** \brief Open joystick device for polling + * + * \param[in] joydev joystick device + */ static bool bsd_joy_open (joystick_device_t *joydev) { return true; /* NOP */ } +/** \brief Poll joystick device + * + * \param[in] joydev joystick device + */ static void bsd_joy_poll(joystick_device_t *joydev) { joy_priv_t *priv = joydev->priv; @@ -250,6 +271,10 @@ } } +/** \brief Close joystick device + * + * \param[in] joydev joystick device + */ static void bsd_joy_close(joystick_device_t *joydev) { if (joydev != NULL && joydev->priv != NULL) { @@ -593,6 +618,10 @@ } +/** \brief Driver-specific cleanup + * + * Currently doesn't do anything, just here to satisfy the API + */ void joystick_arch_shutdown(void) { /* NOP */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-03-25 21:28:29
|
Revision: 45585 http://sourceforge.net/p/vice-emu/code/45585 Author: compyx Date: 2025-03-25 21:28:12 +0000 (Tue, 25 Mar 2025) Log Message: ----------- Joystick: rename `bsd_joystick_init()` to `joystick_arch_init()` Also implement `joystick_arch_shutdown()`, which currently does nothing. Modified Paths: -------------- branches/compyx/joymap-001/vice/doc/html/index.html branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c Modified: branches/compyx/joymap-001/vice/doc/html/index.html =================================================================== --- branches/compyx/joymap-001/vice/doc/html/index.html 2025-03-25 18:58:50 UTC (rev 45584) +++ branches/compyx/joymap-001/vice/doc/html/index.html 2025-03-25 21:28:12 UTC (rev 45585) @@ -371,7 +371,24 @@ <!--teamstart--> <p> Current VICE team members: -. +Pottendo, +Marco van den Heuvel, +Fabrizio Gennari, +Groepaz, +Errol Smith, +Ingo Korb, +Olaf Seibert, +Marcus Sutton, +Kajtar Zsolt, +AreaScout, +Bas Wassink, +Michael C. Martin, +Christopher Phillips, +David Hogan, +Empathic Qubit, +Roberto Muscedere, +June Tate-Gans, +Pablo Roldan. </p> <p>Of course our warm thanks go to everyone who has helped us in developing @@ -385,7 +402,60 @@ <p> The VICE is copyrighted to: -. +Pottendo, +Marco van den Heuvel, +Fabrizio Gennari, +Groepaz, +Errol Smith, +Ingo Korb, +Olaf Seibert, +Marcus Sutton, +Kajtar Zsolt, +AreaScout, +Bas Wassink, +Michael C. Martin, +Christopher Phillips, +David Hogan, +Empathic Qubit, +Roberto Muscedere, +June Tate-Gans, +Pablo Roldan, +Stefan Haubenthal, +BSzili, +Andreas Matthies, +Daniel Kahlin, +Benjamin 'BeRo' Rosseaux, +Ulrich Schulz, +Thomas Giesel, +Antti S. Lankila, +Christian Vogelgsang, +Dag Lem, +Spiro Trikaliotis, +Hannu Nuotio, +Andreas Boose, +Tibor Biczo, +M. Kiesel, +Andreas Dehmel, +David Hansel, +Markus Brenner, +Thomas Bretz, +Daniel Sladic, +Andre Fachat, +Ettore Perazzoli, +Teemu Rantanen, +Jouko Valta, +Jarkko Sonninen, +Mikkel Holm Olsen, +Manuel Antonio Rodriguez Bas, +Paul Dube, +Czirkos Zoltan, +Karai Csaba, +Andrea Musuruane, +Jesse Lee, +Jarek Sobolewski, +Michael Litvinov, +Peter Krefting, +Emir Akaydin. <!--teamend--> </p><p> <b>VICE</b> is free software; you can redistribute it and/or modify it Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c =================================================================== --- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-25 18:58:50 UTC (rev 45584) +++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-25 21:28:12 UTC (rev 45585) @@ -529,7 +529,7 @@ /** \brief Initialize BSD joystick driver and add available devices */ -void bsd_joystick_init(void) +void joystick_arch_init(void) { struct dirent **namelist = NULL; int nl_count; @@ -542,6 +542,7 @@ /* Initialize HID library so we can retrieve strings for page and usage; * without this button names will be "0x00001" etc, not very informative. + * (Parses /usr/share/misc/ubs_hid_usages on FreeBSD) */ hid_init(NULL); @@ -590,3 +591,9 @@ free(namelist); } + + +void joystick_arch_shutdown(void) +{ + /* NOP */ +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-03-25 18:58:59
|
Revision: 45584 http://sourceforge.net/p/vice-emu/code/45584 Author: compyx Date: 2025-03-25 18:58:50 +0000 (Tue, 25 Mar 2025) Log Message: ----------- Joystick: rename `win32_joystick_init()` to `joystick_arch_init()` Modified Paths: -------------- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c =================================================================== --- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-03-25 18:15:13 UTC (rev 45583) +++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-03-25 18:58:50 UTC (rev 45584) @@ -455,7 +455,7 @@ /** \brief Initialize driver and enumerate and register devices */ -void win32_joystick_init(void) +void joystick_arch_init(void) { HRESULT result; @@ -491,3 +491,8 @@ log_err_helper("IDirectInput8::EnumDevices() failed", result); } } + + +void joystick_arch_shutdown(void) +{ +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-03-25 18:15:26
|
Revision: 45583 http://sourceforge.net/p/vice-emu/code/45583 Author: compyx Date: 2025-03-25 18:15:13 +0000 (Tue, 25 Mar 2025) Log Message: ----------- Joystick: add `joystick_arch_init()` and `joystick_arch_shutdown()` Instead of the individual `linux_joystick_evdev_init()`, `win32_joystick_init()` etc arch-specific joystick initialization functions we now use a single name `joystick_arch_init()`. Also add `joystick_arch_shutdown()`, which is called after `joystick_close()` closes joystick devices and frees their associated resources. This function can be used to clean up arch-specific resources allocated by `joystick_arch_init()`: at least MacOS appears to need this with `joy_hidlib_exit()` in `src/machine.c`'. Modified Paths: -------------- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c branches/compyx/joymap-001/vice/src/arch/sdl/joy.c branches/compyx/joymap-001/vice/src/joyport/joystick.c branches/compyx/joymap-001/vice/src/joyport/joystick.h branches/compyx/joymap-001/vice/src/machine.c Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c =================================================================== --- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-03-25 15:37:55 UTC (rev 45582) +++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-03-25 18:15:13 UTC (rev 45583) @@ -241,6 +241,18 @@ } } +/** \brief Custom mapping/calibration callback + * + * Just for debugging/testing right now. + * + * \param[in] joydev joystick device + */ +static void linux_joystick_customize(joystick_device_t *joydev) +{ + printf("%s() called for device %04x:%04x\n", + __func__, (unsigned int)joydev->vendor, (unsigned int)joydev->product); +} + /** \brief Filter callback for scandir(3) * * \param[in] de dirent instance @@ -353,8 +365,6 @@ } -static void linux_joystick_customize(joystick_device_t *joydev); - /** \brief Object used to register driver for devices * * The address of this object is used in the joystick code, it isn't copied, @@ -372,9 +382,8 @@ /** \brief Initialize Linux evdev joystick driver * * Scan device nodes in \c /dev/input/ for supported joysticks/gamepads. - * Devices with less than one button or less than two axes are rejected. */ -void linux_joystick_evdev_init(void) +void joystick_arch_init(void) { struct dirent **namelist = NULL; int sd_result; @@ -397,24 +406,10 @@ //log_message(joy_evdev_log, "Possible device '%s'", namelist[i]->d_name); joydev = scan_device(namelist[i]->d_name); if (joydev != NULL) { - if (joydev->num_axes < 2u || joydev->num_buttons < 1u) { - /* reject device */ - //log_message(joy_evdev_log, - // "Invalid geometry for %s: axes: %d, buttons: %d", - // joydev->name, joydev->num_axes, joydev->num_buttons); + if (!joystick_device_register(joydev)) { + log_message(joy_evdev_log, + "Failed to add device, continuing with next device."); joystick_device_free(joydev); - } else { - //log_message(joy_evdev_log, - // "Adding device: %s [%04x:%04x] (%d axes, %d buttons)", - // joydev->name, - // (unsigned int)joydev->vendor, (unsigned int)joydev->product, - // joydev->num_axes, joydev->num_buttons); - - if (!joystick_device_register(joydev)) { - log_message(joy_evdev_log, - "Failed to add device, continuing with next device."); - joystick_device_free(joydev); - } } } } @@ -422,14 +417,11 @@ } -/** \brief Custom mapping/calibration callback +/** \brief Linux evdev-specific shutdown * - * Just for debugging/testing right now. - * - * \param[in] joydev joystick device + * Runs after `joystick_close()` closed and freed all devices. */ -static void linux_joystick_customize(joystick_device_t *joydev) +void joystick_arch_shutdown(void) { - printf("%s() called for device %04x:%04x\n", - __func__, (unsigned int)joydev->vendor, (unsigned int)joydev->product); + printf("%s(): called\n", __func__); } Modified: branches/compyx/joymap-001/vice/src/arch/sdl/joy.c =================================================================== --- branches/compyx/joymap-001/vice/src/arch/sdl/joy.c 2025-03-25 15:37:55 UTC (rev 45582) +++ branches/compyx/joymap-001/vice/src/arch/sdl/joy.c 2025-03-25 18:15:13 UTC (rev 45583) @@ -226,25 +226,21 @@ static bool sdljoy_get_devices(void); -int joy_sdl_init(void) + +void joystick_arch_init(void) { sdljoy_log = log_open("SDLJoystick"); if (SDL_InitSubSystem(SDL_INIT_JOYSTICK)) { log_error(sdljoy_log, "Subsystem init failed!"); - return -1; } joystick_driver_register(&sdl_joystick_driver); - sdljoy_get_devices(); - - // sdljoy_rescan(); - - return 0; } + static joystick_device_t *scan_device(SDL_Joystick *sdldev, int index) { joystick_device_t *joydev = joystick_device_new(); @@ -879,6 +875,11 @@ return _sdljoy_swap_ports; } +void joystick_arch_shutdown(void) +{ +} + + /* ------------------------------------------------------------------------- */ #else Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c =================================================================== --- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-25 15:37:55 UTC (rev 45582) +++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-25 18:15:13 UTC (rev 45583) @@ -2723,6 +2723,8 @@ kbd_initialize_numpad_joykeys(joykeys[0]); #endif + /* Initialize arch-specific driver: registers driver and devices */ +#if 0 #if defined(LINUX_JOYSTICK) && !defined(HAVE_LINUX_EVDEV) linux_joystick_init(); #elif defined(HAVE_LINUX_EVDEV) @@ -2736,6 +2738,9 @@ #elif defined HAVE_SDL_NUMJOYSTICKS joy_sdl_init(); #endif +#else + joystick_arch_init(); +#endif int i; for (i = 0; i < JOYPORT_MAX_PORTS; i++) { Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.h =================================================================== --- branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-25 15:37:55 UTC (rev 45582) +++ branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-25 18:15:13 UTC (rev 45583) @@ -372,6 +372,8 @@ int joystick_joyport_register(void); +/* Replaced with joystick_arch_init()` */ +#if 0 void linux_joystick_init(void); void linux_joystick_evdev_init(void); void bsd_joystick_init(void); @@ -378,7 +380,9 @@ void joy_hidlib_init(void); void joy_hidlib_exit(void); void win32_joystick_init(void); +#endif + uint16_t get_joystick_value(int index); typedef void (*joystick_machine_func_t)(void); @@ -422,6 +426,15 @@ #endif +/* + * Arch-specific functions + */ + +void joystick_arch_init (void); +void joystick_arch_shutdown(void); + + + void joystick_driver_register (const joystick_driver_t *driver); joystick_device_t *joystick_device_new (void); Modified: branches/compyx/joymap-001/vice/src/machine.c =================================================================== --- branches/compyx/joymap-001/vice/src/machine.c 2025-03-25 15:37:55 UTC (rev 45582) +++ branches/compyx/joymap-001/vice/src/machine.c 2025-03-25 18:15:13 UTC (rev 45583) @@ -378,6 +378,7 @@ #ifdef MAC_JOYSTICK joy_hidlib_exit(); #endif + joystick_arch_shutdown(); sound_close(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-03-25 15:38:14
|
Revision: 45582 http://sourceforge.net/p/vice-emu/code/45582 Author: gpz Date: 2025-03-25 15:37:55 +0000 (Tue, 25 Mar 2025) Log Message: ----------- make comment more clear Modified Paths: -------------- trunk/vice/src/arch/gtk3/linenoise.c Modified: trunk/vice/src/arch/gtk3/linenoise.c =================================================================== --- trunk/vice/src/arch/gtk3/linenoise.c 2025-03-25 14:14:52 UTC (rev 45581) +++ trunk/vice/src/arch/gtk3/linenoise.c 2025-03-25 15:37:55 UTC (rev 45582) @@ -5,9 +5,14 @@ * * Modified for the VICE project by Fabrizio Gennari, * for use in combination with a terminal - * not represented by a couple of file descrptors + * not represented by a couple of file descriptors * (abstracted buy the opaque struct console_private_s) * + * NOTE: Due to the above, it is not possible to share this modified library + * with anything else. Also due to how the GTK monitor works, we can not replace + * this modified library by a standard linenoise (or -ng), which works on top + * of file descriptors. + * * You can find the latest source code at: * * http://github.com/antirez/linenoise This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-03-25 14:14:57
|
Revision: 45581 http://sourceforge.net/p/vice-emu/code/45581 Author: compyx Date: 2025-03-25 14:14:52 +0000 (Tue, 25 Mar 2025) Log Message: ----------- Merge trunk (r45560:HEAD) into branch Modified Paths: -------------- branches/compyx/joymap-001/vice/doc/vice.texi branches/compyx/joymap-001/vice/src/arch/gtk3/uicart.c branches/compyx/joymap-001/vice/src/arch/sdl/menu_vic20cart.c branches/compyx/joymap-001/vice/src/c128/cart/magicdesk128.c branches/compyx/joymap-001/vice/src/c128/cart/partner128.c branches/compyx/joymap-001/vice/src/c64/cart/c64cart.c branches/compyx/joymap-001/vice/src/c64/vsid-stubs.c branches/compyx/joymap-001/vice/src/c64dtv/c64dtv-stubs.c branches/compyx/joymap-001/vice/src/cartridge.h branches/compyx/joymap-001/vice/src/cbm2/cart/cbm2cart.c branches/compyx/joymap-001/vice/src/monitor/mon_memmap.c branches/compyx/joymap-001/vice/src/monitor/mon_memmap.h branches/compyx/joymap-001/vice/src/monitor/monitor_binary.c branches/compyx/joymap-001/vice/src/pet/pet-stubs.c branches/compyx/joymap-001/vice/src/plus4/cart/plus4cart.c branches/compyx/joymap-001/vice/src/vic20/cart/vic20cart.c Modified: branches/compyx/joymap-001/vice/doc/vice.texi =================================================================== --- branches/compyx/joymap-001/vice/doc/vice.texi 2025-03-25 09:08:38 UTC (rev 45580) +++ branches/compyx/joymap-001/vice/doc/vice.texi 2025-03-25 14:14:52 UTC (rev 45581) @@ -21472,6 +21472,7 @@ * MON_CMD_REGISTERS_AVAILABLE:: * MON_CMD_DISPLAY_GET:: * MON_CMD_VICE_INFO:: +* MON_CMD_CPUHISTORY_GET:: * MON_CMD_PALETTE_GET:: * MON_CMD_JOYPORT_SET:: * MON_CMD_USERPORT_SET:: @@ -21490,15 +21491,20 @@ Command body: +@example +FX | SA SA | EA EA | MS | BI BI +@end example +@* + @table @strong -@item byte 0: side effects? +@item FX: 1 byte: side effects? Should the read cause side effects? -@item byte 1-2: start address +@item SA: 2 bytes: start address -@item byte 3-4: end address +@item EA: 2 bytes: end address -@item byte 5: memspace +@item MS: 1 byte: memspace Describes which part of the computer you want to read: @itemize @@ -21509,7 +21515,7 @@ @item 0x04: drive 11 @end itemize -@item byte 6-7: bank ID +@item BI: 2 bytes: bank ID Describes which bank you want. This is dependent on your machine. @xref{MON_CMD_BANKS_AVAILABLE}. If the memspace selected doesn't support banks, this value is ignored. @@ -21522,10 +21528,16 @@ Response body: +@example +ML ML | MM[0] MM[1] ... MM[ML-1] +@end example +@* + @table @strong -@item byte 0-1: The length of the memory segment. Will be zero for start 0x0000, end 0xffff. +@item ML: 2 bytes: Memory segment length. + Will be zero for start 0x0000, end 0xffff. -@item byte 2+: The memory at the address. +@item MM: ML bytes: The memory at the address. @end table @@ -21538,15 +21550,20 @@ Command body: +@example +FX | SA SA | EA EA | MS | BI BI | MM[0] MM[1] ... MM[EA-SA] +@end example +@* + @table @strong -@item byte 0: side effects? +@item FX: 1 byte: side effects? Should the write cause side effects? -@item byte 1-2: start address +@item SA: 2 bytes: start address -@item byte 3-4: end address +@item EA: 2 bytes: end address -@item byte 5: memspace +@item MS: 1 byte: memspace Describes which part of the computer you want to write: @itemize @@ -21557,12 +21574,12 @@ @item 0x04: drive 11 @end itemize -@item byte 6-7: bank ID +@item BI: 2 bytes: bank ID Describes which bank you want. This is dependent on your machine. @xref{MON_CMD_BANKS_AVAILABLE}. If the memspace selected doesn't support banks, this byte is ignored. -@item byte 8+: Memory contents to write +@item MM: 1+EA-SA bytes: Memory contents to write @end table @@ -21572,7 +21589,10 @@ Response body: +@example Currently empty. +@end example +@* @node MON_CMD_CHECKPOINT_GET @subsection Checkpoint get (0x11) @@ -21583,8 +21603,13 @@ Command body: +@example +CN CN CN CN +@end example +@* + @table @strong -@item byte 0-3: checkpoint number +@item CN: 4 bytes: checkpoint number @end table @@ -21600,25 +21625,30 @@ Command body: +@example +SA SA | EA EA | ST | EN | OP | TM | MS? +@end example +@* + @table @strong -@item byte 0-1: start address +@item SA: 2 bytes: start address -@item byte 2-3: end address +@item EA: 2 bytes: end address -@item byte 4: stop when hit +@item ST: 1 byte: stop when hit >=0x01: true, 0x00: false -@item byte 5: enabled +@item EN: 1 byte: enabled >=0x01: true, 0x00: false -@item byte 6: CPU operation +@item OP: 1 byte: CPU operation >=0x01: load, 0x02: store, 0x04: exec -@item byte 7: temporary +@item TM: 1 byte: temporary Deletes the checkpoint after it has been hit once. This is similar to "until" command, but it will not resume the emulator. -@item byte 8 (optional): memspace +@item MS: 1 byte (optional): memspace Describes which part of the computer to checkpoint: @itemize @@ -21642,8 +21672,13 @@ Command body: +@example +CN CN CN CN +@end example +@* + @table @strong -@item byte 0-3: checkpoint number +@item CN: 4 bytes: checkpoint number @end table @@ -21653,7 +21688,10 @@ Response body: +@example Currently empty. +@end example +@* @node MON_CMD_CHECKPOINT_LIST @subsection Checkpoint list (0x14) @@ -21662,7 +21700,10 @@ Command body: +@example Currently empty. +@end example +@* Response type: @@ -21673,8 +21714,13 @@ Response body: +@example +CC CC CC CC +@end example +@* + @table @strong -@item byte 0-3: The total number of checkpoints +@item CC: 4 bytes: The total count of checkpoints @end table @@ -21685,10 +21731,15 @@ Command body: +@example +CN CN CN CN | EN +@end example +@* + @table @strong -@item byte 0-3: Checkpoint number +@item CN: 4 bytes: Checkpoint number -@item byte 4: Enabled? +@item EN: 1 byte: Enabled? 0x00: disabled, 0x01: enabled @end table @@ -21699,7 +21750,10 @@ Response body: +@example Currently empty. +@end example +@* @node MON_CMD_CONDITION_SET @subsection Condition set (0x22) @@ -21711,13 +21765,18 @@ Command body: +@example +CN CN CN CN | EL | ES[0] ES[1] ... ES[EL-1] +@end example +@* + @table @strong -@item byte 0-3: checkpoint number +@item CN: 4 bytes: checkpoint number -@item byte 4: condition expression length +@item EL: 1 byte: condition expression length -@item byte 5+: condition expression string -This is the same format used on the command line. Not null terminated. +@item ES: EL bytes: condition expression string +This is the same format used in the text monitor. Not null terminated. @end table @@ -21727,7 +21786,10 @@ Response body: +@example Currently empty. +@end example +@* @node MON_CMD_REGISTERS_GET @subsection Registers get (0x31) @@ -21738,8 +21800,13 @@ Command body: +@example +MS +@end example +@* + @table @strong -@item byte 0: memspace +@item MS: 1 byte: memspace Describes which part of the computer you want to read: @itemize @@ -21763,8 +21830,17 @@ Command body: +@example +MS | RC RC [ + IS[0] @{ RI[0] | RV[0] RV[0] @} + ... + IS[RC-1] @{ RI[RC-1] | RV[RC-1] RV[RC-1] @} +] +@end example +@* + @table @strong -@item byte 0: memspace +@item MS: 1 byte: memspace Describes which part of the computer you want to write: @itemize @@ -21775,14 +21851,24 @@ @item 0x04: drive 11 @end itemize -@item byte 1-2: The count of the array items +@item RC: 2 bytes: Register count -@item byte 3+: An array with items of structure: +@item Array: RC*(IS+1) bytes: An array with items of structure: @table @strong -@item byte 0: Size of the item, excluding this byte -@item byte 1: ID of the register -@item byte 2-3: register value + +@item + +[ + +@item IS: 1 byte: Item size, excluding this byte +@item RI: 1 byte: Register ID +@item RV: 2 bytes: Register value + +@item + +] + @end table @end table @@ -21798,16 +21884,21 @@ Command body: +@example +SR | SD | FL | FN[0] FN[1] ... FN[FL-1] +@end example +@* + @table @strong -@item byte 0: Save ROMs to snapshot file? +@item SR: 1 byte: Save ROMs to snapshot file? >=0x01: true, 0x00: false -@item byte 1: Save disks to snapshot file? +@item SD: 1 byte: Save disks to snapshot file? >=0x01: true, 0x00: false -@item byte 2: Length of filename +@item FL: 1 byte: Length of filename -@item byte 3+: Filename +@item FN: FL bytes: Filename The filename to save the snapshot to. @end table @@ -21818,7 +21909,10 @@ Response body: +@example Currently empty. +@end example +@* @node MON_CMD_UNDUMP @subsection Undump (0x42) @@ -21829,10 +21923,15 @@ Command body: +@example +FL | FN[0] FN[1] ... FN[FL-1] +@end example +@* + @table @strong -@item byte 0: Length of filename +@item FL: 1 byte: Length of filename -@item byte 1+: Filename +@item FN: FL bytes: Filename The filename to load the snapshot from. @end table @@ -21843,8 +21942,13 @@ Response body: +@example +PC PC +@end example +@* + @table @strong -@item byte 0-1: The current program counter position +@item PC: 2 bytes: The current program counter position @end table @@ -21857,10 +21961,15 @@ Command body: +@example +NL | RN[0] RN[1] ... RN[NL-1] +@end example +@* + @table @strong -@item byte 0: Length of resource name +@item NL: 1 byte: Resource name length -@item byte 1+: Resource name +@item RN: NL bytes: Resource name @end table @@ -21870,13 +21979,18 @@ Response body: +@example +RT | VL | RV[0] RV[1] ... RV[VL-1] +@end example +@* + @table @strong -@item byte 0: Type of the resource +@item RT: 1 byte: Resource type 0x00: String, 0x01: Integer -@item byte 1: Length of the value +@item VL: 1 byte: Resource value length -@item byte 2+: The value +@item RV: VL bytes: The resource value @end table @@ -21889,18 +22003,23 @@ Command body: +@example +RT | NL | RN[0] RN[1] ... RN[NL-1] | VL | RV[0] RV[1] ... RV[VL-1] +@end example +@* + @table @strong -@item 1 byte: Type of the resource value +@item RT: 1 byte: Type of the resource value 0x00: String, 0x01: Integer@* Strings will be interpreted if the destination is an Integer. -@item 1 byte: Resource name length = (&name) +@item NL: 1 byte: Resource name length -@item (*name) bytes: The resource name +@item RN: NL bytes: The resource name -@item 1 byte: Resource value length = (&value) +@item VL: 1 byte: Resource value length -@item (*value) bytes: The resource value +@item RV: VL bytes: The resource value @end table @@ -21910,7 +22029,10 @@ Response body: +@example Currently empty. +@end example +@* @node MON_CMD_ADVANCE_INSTRUCTIONS @subsection Advance Instructions (0x71) @@ -21921,11 +22043,16 @@ Command body: +@example +SO | IC IC +@end example +@* + @table @strong -@item byte 0: Step over subroutines? +@item SO: 1 byte: Step over subroutines? Should subroutines count as a single instruction? -@item byte 1-2: How many instructions to step over. +@item IC: 2 bytes: How many instructions to step over. @end table @@ -21935,7 +22062,10 @@ Response body: +@example Currently empty. +@end example +@* @node MON_CMD_KEYBOARD_FEED @subsection Keyboard feed (0x72) @@ -21948,10 +22078,15 @@ Command body: +@example +TL | TC[0] TC[1] ... TC[TL-1] +@end example +@* + @table @strong -@item byte 0: Length of text +@item TL: 1 byte: Text Length -@item byte 1+: The text, in PETSCII +@item TC: TL bytes: The text content, in PETSCII @end table @@ -21961,7 +22096,10 @@ Response body: +@example Currently empty. +@end example +@* @node MON_CMD_EXECUTE_UNTIL_RETURN @subsection Execute until return (0x73) @@ -21974,7 +22112,10 @@ Command body: +@example Currently empty. +@end example +@* Response type: @@ -21982,7 +22123,10 @@ Response body: +@example Currently empty. +@end example +@* @node MON_CMD_PING @subsection Ping (0x81) @@ -21993,7 +22137,10 @@ Command body: +@example Always empty +@end example +@* Response type: @@ -22001,7 +22148,10 @@ Response body: +@example Always empty +@end example +@* @node MON_CMD_BANKS_AVAILABLE @subsection Banks available (0x82) @@ -22012,7 +22162,10 @@ Command body: +@example Currently empty. +@end example +@* Response type: @@ -22020,19 +22173,37 @@ Response body: +@example +BC BC [ + IS[0] @{ BI[0] BI[0] | NL[0] | BN[0][0] BN[0][1] ... BN[0][NL[0]-1] @} + ... + IS[BC-1] @{ ... @} +] +@end example +@* + @table @strong -@item byte 0-1: The count of the array items -@item byte 2+: An array with items of structure: +@item BC: 2 bytes: Bank item count +@item Array 1+BC*IS bytes: An array with items of structure: @table @strong -@item byte 0: Size of the item, excluding this byte -@item byte 1-2: bank ID +@item -@item byte 3: Name length +[ -@item byte 4+: Name +@item IS: 1 byte: Item size, excluding this byte +@item BI: 2 bytes: Bank ID + +@item NL: 1 byte: Name Length + +@item BN: NL bytes: Name + +@item + +] + @end table @end table @@ -22046,9 +22217,14 @@ Command body: +@example +MS +@end example +@* + @table @strong -@item byte 0: memspace +@item MS: 1 byte: memspace Describes which part of the computer you want to read: @itemize @@ -22063,25 +22239,30 @@ Response type: -0x82: MON_RESPONSE_REGISTERS_AVAILABLE +0x83: MON_RESPONSE_REGISTERS_AVAILABLE Response body: +@example +RC RC [ IS[0] @{ RI[0] | RS[0] | NL[0] | RN[0][0] RN[0][1] ... RN[0][NL[0]-1] @} ... IS[RC-1] @{ ... @} ] +@end example +@* + @table @strong -@item byte 0-1: The count of the array items -@item byte 2+: An array with items of structure: +@item RC: 2 bytes: Register item count +@item Array: RC*(IS+1) bytes: An array with items of structure: @table @strong -@item byte 0: Size of the item, excluding this byte +@item IS: 1 byte: Item Size, excluding this byte -@item byte 1: ID of the register +@item RI: 1 byte: Register ID -@item byte 2: Size of the register in bits +@item RS: 1 byte: Register Size in bits -@item byte 3: Length of name +@item NL: 1 byte: Length of name -@item byte 4+: Name +@item RN: NL bytes : Register name @end table @@ -22098,12 +22279,17 @@ Command body: +@example +VC | FM +@end example +@* + @table @strong -@item byte 0: USE VIC-II? +@item VC: 1 byte: USE VIC-II? Must be included, but ignored for all but the C128. If true, (>=0x01) the screen returned will be from the VIC-II. If false (0x00), it will be from the VDC. -@item byte 1: Format +@item FM: 1 byte: Format 0x00: Indexed, 8 bit@* @end table @@ -22114,32 +22300,37 @@ Response body: +@example +FL FL FL FL | DW DW | DH DH | XO XO | YO YO | IW IW | IH IH | BP | + BL BL BL BL | BD[0] BD[1] ... BD[BL-1] +@end example +@* + @table @strong -@item 4 bytes: Length of the fields before the display buffer +@item FL: 4 bytes: Length of the fields before the display buffer -@item 2 bytes: Debug width of display buffer (uncropped) +@item DW: 2 bytes: Debug width of display buffer (uncropped) The largest width the screen gets. -@item 2 bytes: Debug height of display buffer (uncropped) +@item DH: 2 bytes: Debug height of display buffer (uncropped) The largest height the screen gets. -@item 2 bytes: X offset +@item XO: 2 bytes: X offset X offset to the inner part of the screen. -@item 2 bytes: Y offset +@item YO: 2 bytes: Y offset Y offset to the inner part of the screen. -@item 2 bytes: Width of the inner part of the screen. +@item IW: 2 bytes: Width of the inner part of the screen. -@item 2 bytes: Height of the inner part of the screen. +@item IH: 2 bytes: Height of the inner part of the screen. -@item 1 byte: Bits per pixel of display buffer, 8 +@item BP: 1 byte: Bits per pixel of display buffer, 8 +@item BL: 4 bytes: Length of display buffer -@item 4 bytes: Length of display buffer = (&buffer) +@item BD: BL bytes: Display buffer data -@item (*buffer) bytes: Display buffer data - @end table @node MON_CMD_VICE_INFO @@ -22151,7 +22342,10 @@ Command body: +@example Always empty +@end example +@* Response type: @@ -22159,19 +22353,122 @@ Response body: +@example +ML | MV[0] MV[1] ... MV[ML-1] | SL | SV[0] SV[1] ... SV[SL-1] +@end example +@* + @table @strong -@item 1 byte: Length of main version = (&main) +@item ML: 1 byte: Length of main version -@item (*main) bytes: Main version +@item MV: ML bytes: Main version In linear format. For example 0x03, 0x05, 0x00, 0x00 for 3.5.0.0 -@item 1 byte: Length of SVN revision = (&rev) +@item SL: 1 byte: Length of SVN revision -@item (*rev) bytes: SVN revision +@item SV: SL bytes: SVN revision In little endian format. Returns zero if it's not an SVN build. @end table +@node MON_CMD_CPUHISTORY_GET +@subsection CPU History (0x86) + +Gets records of every instruction executed by an emulated CPU. + +Minimum VICE version: 3.10 + +Command body: + +@example +MS | HC HC HC HC +@end example +@* + +@table @strong +@item MS: 1 byte: memspace + +@itemize +@item 0x00: main memory +@item 0x01: drive 8 +@item 0x02: drive 9 +@item 0x03: drive 10 +@item 0x04: drive 11 +@end itemize + +@item HC: 4 bytes: count of items to retrieve + +@end table + +Response type: + +0x86: MON_RESPONSE_CPUHISTORY_GET + +Response body: + +@example +HC HC HC HC [ + IS[0] @{ + RC[0] RC[0] [ + RS[0][0] @{ ... @} + ... + RS[0][RC-1] @{ ... @} + ] + @} + ... + IS[HC-1] @{ ... @} +] +CL CL CL CL CL CL CL CL | IL | IB[0] IB[1] ... IB[IL-1] +@end example +@* + +@table @strong +@item HC: 4 bytes: CPU history item count + +@item Array: HC*(IS+1) bytes: +An array with items of structure: + +@table @strong +@item + +[ + +@item IS: 1 bytes: Item size, excluding this byte + +@item RC: 2 bytes: Register item count + +@item Array: RC*(RS+1) bytes: Array items of structure: + +@table @strong +@item + +[ + +@item RS: 1 byte: Item size, excluding this byte + +@item @{...@}: RS bytes: The array item body from @ref{MON_RESPONSE_REGISTER_INFO} + +@item + +] + +@end table + +@item CL: 8 bytes: The CPU clock + +@item IL: 1 bytes: instruction bytes length + +@item IB: IL bytes: Instruction byte string. +This is a fixed length and must be interpreted by the client. + +@end table + +@item + +] + +@end table + @node MON_CMD_PALETTE_GET @subsection Palette get (0x91) @@ -22181,8 +22478,13 @@ Command body: +@example +VC +@end example +@* + @table @strong -@item byte 0: USE VIC-II? +@item VC: 1 byte: USE VIC-II? Must be included, but ignored for all but the C128. If true, (>=0x01) the screen returned will be from the VIC-II. If false (0x00), it will be from the VDC. @@ -22194,20 +22496,37 @@ Response body: +@example +PC PC [ + IS[0] { RR[0] | GG[0] | BB[0] } + ... + IS[PC-1] { RR[PC-1] | GG[PC-1] | BB[PC-1] } +] +@end example +@* + @table @strong -@item byte 0-1: The number of palette items. +@item PC: 2 bytes: The palette item count -@item byte 2+: An array with items of structure: +@item Array : PC*(IS+1): An array with items of structure: @table @strong -@item byte 0: Size of the item, excluding this byte +@item -@item byte 1: Red +[ -@item byte 2: Green +@item IS: 1 byte: Item size, excluding this byte -@item byte 3: Blue +@item RR: 1 byte: Red +@item GG: 1 byte: Green + +@item BB: 1 byte: Blue + +@item + +] + @end table @end table @@ -22221,9 +22540,14 @@ Command body: +@example +PN PN | PV PV +@end example +@* + @table @strong -@item byte 0-1: The port to set the value on -@item byte 2-3: The value to set +@item PN: 2 bytes: The port to set the value on +@item PV: 2 bytes: The value to set @end table @@ -22233,9 +22557,11 @@ Response body: +@example Currently empty. +@end example +@* - @node MON_CMD_USERPORT_SET @subsection Userport set (0xb2) @@ -22245,8 +22571,13 @@ Command body: +@example +UV UV +@end example +@* + @table @strong -@item byte 0-1: The value to set +@item UV: 2 bytes: The value to set @end table @@ -22256,7 +22587,10 @@ Response body: +@example Currently empty. +@end example +@* @node MON_CMD_EXIT @subsection Exit (0xaa) @@ -22267,7 +22601,10 @@ Command body: +@example Currently empty. +@end example +@* Response type: @@ -22275,7 +22612,10 @@ Response body: +@example Currently empty. +@end example +@* @node MON_CMD_QUIT @subsection Quit (0xbb) @@ -22286,7 +22626,10 @@ Command body: +@example Currently empty. +@end example +@* Response type: @@ -22294,7 +22637,10 @@ Response body: +@example Currently empty. +@end example +@* @node MON_CMD_RESET @subsection Reset (0xcc) @@ -22305,8 +22651,13 @@ Command body: +@example +RS +@end example +@* + @table @strong -@item byte 0: What to reset +@item RS: 1 byte: What to reset @itemize @item 0x00: Reset system @@ -22322,7 +22673,10 @@ Response body: +@example Currently empty. +@end example +@* @node MON_CMD_AUTOSTART @subsection Autostart / autoload (0xdd) @@ -22333,16 +22687,21 @@ Command body: +@example +RL | FI FI | FL | FN[0] FN[1] ... FN[FL-1] +@end example +@* + @table @strong -@item byte 0: Run after loading? +@item RL: 1 byte: Run after loading? >=0x01: true, 0x00: false -@item byte 1-2: File index +@item FI: 2 bytes: File index The index of the file to execute, if a disk image. 0x00 is the default value. -@item byte 3: Length of filename +@item FL: byte 3: Length of filename -@item byte 4+: Filename +@item FN: FL bytes: Filename The filename to autoload. @end table @@ -22353,7 +22712,10 @@ Response body: +@example Currently empty. +@end example +@* @node Binary Responses @section Responses @@ -22382,7 +22744,10 @@ Response body: +@example Usually empty +@end example +@* @node MON_RESPONSE_CHECKPOINT_INFO @subsection Checkpoint Response (0x11) @@ -22402,37 +22767,44 @@ Response body: +@example +CN CN CN CN | CH | SA SA | EA EA | ST | EN | OP | TM | + HC HC HC HC | IC IC IC IC | CE | MS +@end example +@* + @table @strong -@item byte 0-3: Checkpoint number +@item CN: 4 bytes: Checkpoint number -@item byte 4: Currently hit? +@item CH: 1 byte: Currently hit? >=0x01: true, 0x00: false -@item byte 5-6: start address +@item SA: 2 bytes: start address -@item byte 7-8: end address +@item EA: 2 bytes: end address -@item byte 9: stop when hit +@item ST: 1 byte: stop when hit >=0x01: true, 0x00: false -@item byte 10: enabled +@item EN: 1 byte: enabled >=0x01: true, 0x00: false -@item byte 11: CPU operation +@item OP: 1 byte: CPU operation 0x01: load, 0x02: store, 0x04: exec -@item byte 12: temporary -Deletes the checkpoint after it has been hit once. This is similar to -"until" command, but it will not resume the emulator. +@item TM: 1 byte: temporary + Deletes the checkpoint after it has been hit once. This is similar to + "until" command, but it will not resume the emulator. -@item byte 13-16: hit count +@item HC: 4 bytes: hit count -@item byte 17-20: ignore count +@item IC: 4 bytes: ignore count -@item byte 21: Has condition? +@item CE: 1 byte: Has condition? >=0x01: true, 0x00: false -@item byte 22: memspace +@item MS: 1 byte: memspace +Describes which part of the computer to checkpoint: @itemize @item 0x00: main memory @@ -22453,18 +22825,35 @@ Response body: +@example +RC RC [ + IS[0] @{ RI[0] | RV[0] RV[0] @} + ... + IS[RC-1] @{ RI[RC-1] | RV[RC-1] RV[RC-1] @} +] +@end example +@* + @table @strong -@item byte 0-1: The count of the array items +@item RC: 2 bytes: The count of the array items -@item byte 2+: An array with items of structure: +@item Array: RC*(IS+1): An array with items of structure: @table @strong -@item byte 0: Size of the item, excluding this byte +@item -@item byte 1: ID of the register +[ -@item byte 2-3: register value +@item IS: 1 byte: Item size, excluding this byte +@item RI: 1 byte: ID of the register + +@item RV: 2 bytes: register value + +@item + +] + @end table @end table @@ -22481,8 +22870,13 @@ Response body: +@example +PC PC +@end example +@* + @table @strong -@item byte 0-1: The current program counter position +@item PC: 2 bytes: The current program counter position @end table @@ -22498,8 +22892,13 @@ Response body: +@example +PC PC +@end example +@* + @table @strong -@item byte 0-1: The current program counter position +@item PC: 2 bytes: The current program counter position @end table @@ -22514,8 +22913,13 @@ Response body: +@example +PC PC +@end example +@* + @table @strong -@item byte 0-1: The current program counter position +@item PC: 2 bytes: The current program counter position @end table Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/uicart.c =================================================================== --- branches/compyx/joymap-001/vice/src/arch/gtk3/uicart.c 2025-03-25 09:08:38 UTC (rev 45580) +++ branches/compyx/joymap-001/vice/src/arch/gtk3/uicart.c 2025-03-25 14:14:52 UTC (rev 45581) @@ -140,13 +140,10 @@ /** \brief List of VIC-20 'main' cart types - * - * The generic type will use the generic carts list in #vic20_cart_types_generic */ static const cart_type_list_t vic20_cart_types[] = { { "Smart-attach", UICART_VIC20_SMART }, { "Generic", UICART_VIC20_GENERIC }, -/* { "Add to generic cartridge", UICART_VIC20_ADD_GENERIC }, */ { "Freezer", UICART_VIC20_FREEZER }, { "Games", UICART_VIC20_GAME }, { "Utilities", UICART_VIC20_UTIL }, @@ -177,20 +174,6 @@ { NULL, -1 } }; -#if 0 -/** \brief List of VIC-20 cart types of the 'generic' variety - */ -static const cart_type_list_t vic20_cart_types_generic[] = { - { "Smart-attach cartridge image", CARTRIDGE_VIC20_DETECT }, - { "32KiB cartridge at $2000", CARTRIDGE_VIC20_32KB_2000 }, - { "4/8/16KiB cartridge at $2000", CARTRIDGE_VIC20_16KB_2000 }, - { "4/8/16KiB cartridge at $4000", CARTRIDGE_VIC20_16KB_4000 }, - { "4/8/16KiB cartridge at $6000", CARTRIDGE_VIC20_16KB_6000 }, - { "4/8KiB cartridge at $A000", CARTRIDGE_VIC20_8KB_A000 }, - { "4KiB cartridge at $B000", CARTRIDGE_VIC20_4KB_B000 }, - { NULL, -1 } -}; -#endif /** \brief File filter pattern for CRT images */ static const char *pattern_crt[] = { "*.crt", NULL }; @@ -247,7 +230,10 @@ /** \brief Reference to the cart-set-default widget */ static GtkWidget *cart_set_default_widget = NULL; +/** \brief Reference to the cart add widget */ +static GtkWidget *cart_add_widget = NULL; + /** \brief Reference to the cart ID widget */ static GtkWidget *cart_id_label = NULL; @@ -433,6 +419,7 @@ if ((pattern == UICART_PATTERN_CRT) || (mask == 0x0)) { gtk_widget_hide(GTK_WIDGET(cart_id_widget)); gtk_widget_hide(GTK_WIDGET(cart_id_label)); + gtk_widget_hide(GTK_WIDGET(cart_add_widget)); } else { gtk_widget_show(GTK_WIDGET(cart_id_widget)); gtk_widget_show(GTK_WIDGET(cart_id_label)); @@ -442,26 +429,7 @@ set_pattern(pattern); break; -#if 0 - case VICE_MACHINE_VIC20: - if ((crt_type == UICART_VIC20_GENERIC) || - (crt_type == UICART_VIC20_ADD_GENERIC)) { - id_model = create_cart_id_model_vic20(); - /* gtk_widget_set_sensitive(cart_id_widget, TRUE); */ - gtk_widget_show(GTK_WIDGET(cart_id_widget)); - gtk_widget_show(GTK_WIDGET(cart_id_label)); - } else { - /* empty model */ - id_model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); - /* gtk_widget_set_sensitive(cart_id_widget, FALSE); */ - gtk_widget_hide(GTK_WIDGET(cart_id_widget)); - gtk_widget_hide(GTK_WIDGET(cart_id_label)); - } - gtk_combo_box_set_model(GTK_COMBO_BOX(cart_id_widget), GTK_TREE_MODEL(id_model)); - gtk_combo_box_set_active(GTK_COMBO_BOX(cart_id_widget), 0); - break; -#endif default: break; } @@ -491,6 +459,46 @@ } +/** \brief Handler for the "changed" event of the cart ID combo box + * + * \param[in] combo cart ID combo + * \param[in] data extra event data (unused) + */ +static void on_cart_id_changed(GtkComboBox *combo, gpointer data) +{ + int lasttype = cartridge_get_id(0); + int id = get_cart_id(); + int generic_add = 0; + + /* enable the "add to generic cartridge" checkbox only when a generic + cartridge is selected AND currently inserted! */ + switch (machine_class) { + case VICE_MACHINE_C64: /* fall through */ + case VICE_MACHINE_C64SC: /* fall through */ + case VICE_MACHINE_C128: /* fall through */ + case VICE_MACHINE_SCPU64: /* fall through */ + case VICE_MACHINE_PLUS4: /* fall through */ + case VICE_MACHINE_CBM5x0: /* fall through */ + case VICE_MACHINE_CBM6x0: + break; + /* currently we only use this on vic20 */ + case VICE_MACHINE_VIC20: + if (id >= CARTRIDGE_VIC20_DETECT) { + if (lasttype == CARTRIDGE_VIC20_GENERIC) { + generic_add = 1; + } + } + break; + } + + if (generic_add) { + gtk_widget_show(cart_add_widget); + } else { + gtk_widget_hide(cart_add_widget); + } +} + + /** \brief Get the ID of the model for the 'cart ID' combo box * * \return ID or -1 on error @@ -671,6 +679,15 @@ return 0; break; } + + /* add to cartridge */ + if ((cart_add_widget != NULL) && + (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cart_add_widget)))) { + if ((cartridge_attach_add_image(id, path) == 0)) { + return 1; + } + } + /* printf("call cartridge_attach_image(id:%d path:%s)\n", id, path); */ if ((cartridge_attach_image(id, path) == 0)) { /* check 'set default' */ @@ -765,32 +782,7 @@ return model; } -#if 0 -/** \brief Create a list of cartridges for VIC-20 - * - * Only valid for VIC-20 - * - * \return Two-column list store (name, id) - */ -static GtkListStore *create_cart_id_model_vic20(void) -{ - GtkListStore *model; - GtkTreeIter iter; - int i; - model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); - - for (i = 0; vic20_cart_types_generic[i].name != NULL; i++) { - gtk_list_store_append(model, &iter); - gtk_list_store_set(model, &iter, - 0, vic20_cart_types_generic[i].name, /* cart name */ - 1, vic20_cart_types_generic[i].id, /* cart ID */ - -1); - } - return model; -} -#endif - /** \brief Create combo box with main cartridge types * * \return GtkComboBox @@ -850,37 +842,15 @@ "text", 0, NULL); gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0); + + g_signal_connect_unlocked(G_OBJECT(combo), + "changed", + G_CALLBACK(on_cart_id_changed), + NULL); return combo; } -#if 0 -/** \brief Create combo box with generic VIC-20 cartridges - * - * \return GtkComboBox - */ -static GtkWidget *create_cart_id_combo_box_vic20(void) -{ - GtkWidget *combo; - GtkListStore *model; - GtkCellRenderer *renderer; - model = create_cart_id_model_vic20(); - if (model == NULL) { - return gtk_combo_box_new(); - } - combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(model)); - g_object_unref(model); - - renderer = gtk_cell_renderer_text_new(); - gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, TRUE); - gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer, - "text", 0, NULL); - - gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0); - return combo; -} -#endif - /** \brief Create the 'extra' widget for the dialog * * \param[in] set_default initial state of the 'set as default' checkbox @@ -954,7 +924,30 @@ break; } + /* create "Set cartridge as default" check button */ + switch (machine_class) { + case VICE_MACHINE_C64: /* fall through */ + case VICE_MACHINE_C64SC: /* fall through */ + case VICE_MACHINE_C128: /* fall through */ + case VICE_MACHINE_SCPU64: /* fall through */ + case VICE_MACHINE_PLUS4: /* fall through */ + case VICE_MACHINE_CBM5x0: /* fall through */ + case VICE_MACHINE_CBM6x0: /* fall through */ + case VICE_MACHINE_VIC20: + cart_add_widget = gtk_check_button_new_with_label( + "add to cartridge"); + gtk_toggle_button_set_active( + GTK_TOGGLE_BUTTON(cart_add_widget), 0); + + gtk_grid_attach(GTK_GRID(grid), cart_add_widget, 4, 0, 1, 1); + break; + default: + /* Set cart as default is not supported for the current machine */ + break; + } + gtk_widget_show_all(grid); + gtk_widget_hide(cart_add_widget); return grid; } Modified: branches/compyx/joymap-001/vice/src/arch/sdl/menu_vic20cart.c =================================================================== --- branches/compyx/joymap-001/vice/src/arch/sdl/menu_vic20cart.c 2025-03-25 09:08:38 UTC (rev 45580) +++ branches/compyx/joymap-001/vice/src/arch/sdl/menu_vic20cart.c 2025-03-25 14:14:52 UTC (rev 45581) @@ -204,6 +204,7 @@ return NULL; } +/* FIXME: this should be dynamic, like in x64 */ static UI_MENU_CALLBACK(attach_cart_callback) { const char *title; @@ -276,11 +277,60 @@ return NULL; } +/* FIXME: this should be dynamic, like in x64 */ +static UI_MENU_CALLBACK(add_cart_callback) +{ + const char *title; + char *name = NULL; + int action = ACTION_NONE; + + if (activated) { + switch (vice_ptr_to_int(param)) { + case CARTRIDGE_VIC20_DETECT: /* fall through */ + case CARTRIDGE_VIC20_GENERIC: + title = "Select cartridge image"; + break; + case CARTRIDGE_VIC20_16KB_2000: + title = "Select 4/8/16KiB image"; + action = ACTION_CART_ATTACH_RAW_2000; + break; + case CARTRIDGE_VIC20_16KB_4000: + title = "Select 4/8/16KiB image"; + action = ACTION_CART_ATTACH_RAW_4000; + break; + case CARTRIDGE_VIC20_16KB_6000: + title = "Select 4/8/16KiB image"; + action = ACTION_CART_ATTACH_RAW_6000; + break; + case CARTRIDGE_VIC20_8KB_A000: + title = "Select 4/8KiB image"; + action = ACTION_CART_ATTACH_RAW_A000; + break; + case CARTRIDGE_VIC20_4KB_B000: + action = ACTION_CART_ATTACH_RAW_B000; /* fall through */ + default: + title = "Select 4KiB image"; + break; + } + name = sdl_ui_file_selection_dialog(title, FILEREQ_MODE_CHOOSE_FILE); + if (name != NULL) { + if (cartridge_attach_add_image(vice_ptr_to_int(param), name) < 0) { + ui_error("Cannot load cartridge image."); + } + lib_free(name); + } + if (action > ACTION_NONE) { + ui_action_finish(action); + } + } + return NULL; +} + /* TODO: Create UI action IDs/names for these items * Smart-attach can probably use `ACTION_CART_ATTACH`, the rest needs * new IDs like `ACTION_CART_ATTACH_2000`. */ -static const ui_menu_entry_t add_to_generic_cart_submenu[] = { +static const ui_menu_entry_t attach_generic_cart_submenu[] = { { .string = "Smart-attach cartridge image", .type = MENU_ENTRY_DIALOG, .callback = attach_cart_callback, @@ -319,6 +369,49 @@ SDL_MENU_LIST_END }; +/* TODO: Create UI action IDs/names for these items + * Smart-attach can probably use `ACTION_CART_ATTACH_ADD`, the rest needs + * new IDs like `ACTION_CART_ATTACH_ADD_2000`. + */ +static const ui_menu_entry_t add_to_generic_cart_submenu[] = { + { .string = "Smart-attach cartridge image", + .type = MENU_ENTRY_DIALOG, + .callback = add_cart_callback, + .data = (ui_callback_data_t)CARTRIDGE_VIC20_DETECT + }, + { .action = ACTION_CART_ATTACH_RAW_2000, + .string = "Attach 4/8/16KiB image at $2000", + .type = MENU_ENTRY_DIALOG, + .callback = add_cart_callback, + .data = (ui_callback_data_t)CARTRIDGE_VIC20_16KB_2000 + }, + { .action = ACTION_CART_ATTACH_RAW_4000, + .string = "Attach 4/8/16KiB image at $4000", + .type = MENU_ENTRY_DIALOG, + .callback = add_cart_callback, + .data = (ui_callback_data_t)CARTRIDGE_VIC20_16KB_4000 + }, + { .action = ACTION_CART_ATTACH_RAW_6000, + .string = "Attach 4/8/16KiB image at $6000", + .type = MENU_ENTRY_DIALOG, + .callback = add_cart_callback, + .data = (ui_callback_data_t)CARTRIDGE_VIC20_16KB_6000 + }, + { .action = ACTION_CART_ATTACH_RAW_A000, + .string = "Attach 4/8KiB image at $A000", + .type = MENU_ENTRY_DIALOG, + .callback = add_cart_callback, + .data = (ui_callback_data_t)CARTRIDGE_VIC20_8KB_A000 + }, + { .action = ACTION_CART_ATTACH_RAW_B000, + .string = "Attach 4KiB image at $B000", + .type = MENU_ENTRY_DIALOG, + .callback = add_cart_callback, + .data = (ui_callback_data_t)CARTRIDGE_VIC20_4KB_B000 + }, + SDL_MENU_LIST_END +}; + static UI_MENU_CALLBACK(set_cart_default_callback) { if (activated) { @@ -755,9 +848,9 @@ SDL_MENU_ITEM_SEPARATOR, { .string = "Attach generic cartridge image", - .type = MENU_ENTRY_DIALOG, - .callback = attach_cart_callback, - .data = (ui_callback_data_t)CARTRIDGE_VIC20_GENERIC + .type = MENU_ENTRY_SUBMENU, + .callback = submenu_callback, + .data = (ui_callback_data_t)attach_generic_cart_submenu }, { .action = ACTION_CART_ATTACH_RAW_BEHRBONZ, .string = "Attach " CARTRIDGE_VIC20_NAME_BEHRBONZ " image", Modified: branches/compyx/joymap-001/vice/src/c128/cart/magicdesk128.c =================================================================== --- branches/compyx/joymap-001/vice/src/c128/cart/magicdesk128.c 2025-03-25 09:08:38 UTC (rev 45580) +++ branches/compyx/joymap-001/vice/src/c128/cart/magicdesk128.c 2025-03-25 14:14:52 UTC (rev 45581) @@ -262,7 +262,7 @@ static char snap_module_name[] = "MAGICDESK128"; #define SNAP_MAJOR 0 -#define SNAP_MINOR 0 +#define SNAP_MINOR 1 int magicdesk128_snapshot_write_module(snapshot_t *s) { @@ -274,7 +274,14 @@ return -1; } - /* FIXME */ + if (0 + || SMW_B(m, (uint8_t)md128reg) < 0 + || SMW_B(m, (uint8_t)rombank) < 0 + || SMW_B(m, (uint8_t)bankmask) < 0 + || (SMW_BA(m, ext_function_rom, MD128_ROM_SIZE) < 0)) { + snapshot_module_close(m); + return -1; + } return snapshot_module_close(m); } @@ -296,7 +303,13 @@ goto fail; } - /* FIXME */ + if (0 + || SMR_B_UINT(m, &md128reg) < 0 + || SMR_B_UINT(m, &rombank) < 0 + || SMR_B_UINT(m, &bankmask) < 0 + || (SMR_BA(m, ext_function_rom, MD128_ROM_SIZE) < 0)) { + goto fail; + } snapshot_module_close(m); Modified: branches/compyx/joymap-001/vice/src/c128/cart/partner128.c =================================================================== --- branches/compyx/joymap-001/vice/src/c128/cart/partner128.c 2025-03-25 09:08:38 UTC (rev 45580) +++ branches/compyx/joymap-001/vice/src/c128/cart/partner128.c 2025-03-25 14:14:52 UTC (rev 45581) @@ -362,7 +362,7 @@ static char snap_module_name[] = "PARTNER128"; #define SNAP_MAJOR 0 -#define SNAP_MINOR 0 +#define SNAP_MINOR 1 int partner128_snapshot_write_module(snapshot_t *s) { @@ -375,6 +375,16 @@ } /* FIXME */ + if (0 + || SMW_B(m, regvalue) < 0 + || SMW_B(m, rambank) < 0 + || SMW_B(m, isdefreezing) < 0 + || (SMW_BA(m, nmivector, 2) < 0) + || (SMW_BA(m, ext_function_rom, PARTNER_ROM_SIZE) < 0) + || (SMW_BA(m, rambanks, PARTNER_RAM_SIZE) < 0)) { + snapshot_module_close(m); + return -1; + } return snapshot_module_close(m); } @@ -397,6 +407,15 @@ } /* FIXME */ + if (0 + || SMR_B(m, ®value) < 0 + || SMR_B(m, &rambank) < 0 + || SMR_B(m, &isdefreezing) < 0 + || (SMR_BA(m, nmivector, 2) < 0) + || (SMR_BA(m, ext_function_rom, PARTNER_ROM_SIZE) < 0) + || (SMR_BA(m, rambanks, PARTNER_RAM_SIZE) < 0)) { + goto fail; + } snapshot_module_close(m); Modified: branches/compyx/joymap-001/vice/src/c64/cart/c64cart.c =================================================================== --- branches/compyx/joymap-001/vice/src/c64/cart/c64cart.c 2025-03-25 09:08:38 UTC (rev 45580) +++ branches/compyx/joymap-001/vice/src/c64/cart/c64cart.c 2025-03-25 14:14:52 UTC (rev 45581) @@ -349,11 +349,14 @@ return &cartlist[0]; } -/* FIXME: this only works in slot 0 right now */ +/* FIXME: slot arg is ignored right now. + this should return a valid cartridge ID for a given slot, or CARTRIDGE_NONE + FIXME: should we return CARTRIDGE_CRT(0) or not? +*/ int cartridge_get_id(int slot) { int type = cart_getid_slotmain(); - /*DBG(("cartridge_get_id(slot:%d): type:%d\n", slot, type));*/ + /* DBG(("cartridge_get_id(slot:%d): type:%d\n", slot, type)); */ return type; } @@ -1178,6 +1181,12 @@ return -1; } +/* FIXME: add additional image to standard cartridge */ +int cartridge_attach_add_image(int type, const char *filename) +{ + return -1; +} + void cart_power_off(void) { if (c64cartridge_reset) { Modified: branches/compyx/joymap-001/vice/src/c64/vsid-stubs.c =================================================================== --- branches/compyx/joymap-001/vice/src/c64/vsid-stubs.c 2025-03-25 09:08:38 UTC (rev 45580) +++ branches/compyx/joymap-001/vice/src/c64/vsid-stubs.c 2025-03-25 14:14:52 UTC (rev 45581) @@ -200,6 +200,11 @@ return -1; } +int cartridge_attach_add_image(int type, const char *filename) +{ + return -1; +} + void cartridge_detach_image(int type) { } Modified: branches/compyx/joymap-001/vice/src/c64dtv/c64dtv-stubs.c =================================================================== --- branches/compyx/joymap-001/vice/src/c64dtv/c64dtv-stubs.c 2025-03-25 09:08:38 UTC (rev 45580) +++ branches/compyx/joymap-001/vice/src/c64dtv/c64dtv-stubs.c 2025-03-25 14:14:52 UTC (rev 45581) @@ -153,6 +153,11 @@ return -1; } +int cartridge_attach_add_image(int type, const char *filename) +{ + return -1; +} + void cartridge_detach_image(int type) { } Modified: branches/compyx/joymap-001/vice/src/cartridge.h =================================================================== --- branches/compyx/joymap-001/vice/src/cartridge.h 2025-03-25 09:08:38 UTC (rev 45580) +++ branches/compyx/joymap-001/vice/src/cartridge.h 2025-03-25 14:14:52 UTC (rev 45581) @@ -50,9 +50,14 @@ /* detect cartridge type (takes crt and bin files) */ int cartridge_detect(const char *filename); -/* attach (and enable) a cartridge by type and filename (takes crt and bin files) */ +/* attach (and enable) a cartridge by type and filename (takes crt and bin files) + this function detaches previously attached image(s) in the (all) main slot(s) */ int cartridge_attach_image(int type, const char *filename); +/* attach (and enable) a cartridge by type and filename (takes crt and bin files) + this function ADDs one (or more) images (usually to the generic cartridge) */ +int cartridge_attach_add_image(int type, const char *filename); + /* enable cartridge by type. loads default image if any. should be used by the UI instead of using the resources directly */ int cartridge_enable(int type); @@ -65,6 +70,7 @@ /* FIXME: slot arg is ignored right now. this should return a valid cartridge ID for a given slot, or CARTRIDGE_NONE + (it does NOT return CARTRIDGE_CRT) */ int cartridge_get_id(int slot); Modified: branches/compyx/joymap-001/vice/src/cbm2/cart/cbm2cart.c =================================================================== --- branches/compyx/joymap-001/vice/src/cbm2/cart/cbm2cart.c 2025-03-25 09:08:38 UTC (rev 45580) +++ branches/compyx/joymap-001/vice/src/cbm2/cart/cbm2cart.c 2025-03-25 14:14:52 UTC (rev 45581) @@ -790,6 +790,12 @@ return -1; } +/* FIXME: add additional image to standard cartridge */ +int cartridge_attach_add_image(int type, const char *filename) +{ + return -1; +} + void cartridge_trigger_freeze(void) { } @@ -849,8 +855,10 @@ return 0; } -/* return cartridge type of main slot - returns 0 (CARTRIDGE_CRT) if crt file */ +/* FIXME: slot arg is ignored right now. + this should return a valid cartridge ID for a given slot, or CARTRIDGE_NONE + (it does NOT return CARTRIDGE_CRT) +*/ int cartridge_get_id(int slot) { DBG(("cartridge_get_id(slot:%d): type:%d", slot, cbm2cart_type)); Modified: branches/compyx/joymap-001/vice/src/monitor/mon_memmap.c =================================================================== --- branches/compyx/joymap-001/vice/src/monitor/mon_memmap.c 2025-03-25 09:08:38 UTC (rev 45580) +++ branches/compyx/joymap-001/vice/src/monitor/mon_memmap.c 2025-03-25 14:14:52 UTC (rev 45581) @@ -68,21 +68,6 @@ #define MEMMAP_ELEM uint16_t -struct cpuhistory_s { - CLOCK cycle; - uint16_t addr; - uint16_t reg_st; - uint8_t op; - uint8_t p1; - uint8_t p2; - uint8_t reg_a; - uint8_t reg_x; - uint8_t reg_y; - uint8_t reg_sp; - MEMSPACE origin; -}; -typedef struct cpuhistory_s cpuhistory_t; - /* CPU history variables */ static cpuhistory_t *cpuhistory = NULL; static int cpuhistory_buffer_lines = 0; /* actual size of the cyclic buffer */ @@ -122,7 +107,7 @@ if (lines < 10140) { lines = 10140; } - lines *= 5; + lines = lines * 5 + 1; cpuhistory = lib_realloc(cpuhistory, (size_t)lines * sizeof(cpuhistory_t)); @@ -181,40 +166,19 @@ cpuhistory[cpuhistory_i].p2 = p2; } -void mon_cpuhistory(int count, MEMSPACE filter1, MEMSPACE filter2, MEMSPACE filter3, - MEMSPACE filter4, MEMSPACE filter5) -{ - uint8_t op, p1, p2, p3 = 0; - MEMSPACE mem; - uint16_t loc, addr; - int hex_mode = 1; - const char *dis_inst; - unsigned opc_size; +cpuhistory_t *mon_cpuhistory_seek(int count, MEMSPACE filter1, MEMSPACE filter2, + MEMSPACE filter3, MEMSPACE filter4, MEMSPACE filter5) { int i, pos; - CLOCK cycle; - char otext[10]; - /* if nothing passed, set the first filter to the default device */ - if ((filter1 == e_invalid_space) && - (filter2 == e_invalid_space) && - (filter3 == e_invalid_space) && - (filter4 == e_invalid_space) && - (filter5 == e_invalid_space)) { - filter1 = default_memspace; - } - - /* determine the actual maximum records to go through */ - if (count < 1) { - count = cpuhistory_show_lines; - } else if (count > cpuhistory_buffer_lines) { - count = cpuhistory_buffer_lines; - } - /* 'i' is the actual counter */ i = 0; /* start looking at last entry */ pos = cpuhistory_i; + if (count >= cpuhistory_buffer_lines) { + count = cpuhistory_buffer_lines - 1; + } + /* find out where we need to start */ while (i < count) { /* make sure the record matches */ @@ -234,51 +198,94 @@ /* this is totally possible since the emulation runs each CPU in chunks and eventually syncs up. Syncing is more aggressive when talking between devices. */ - if (pos == cpuhistory_i) { + if (pos == (cpuhistory_i + 1) % cpuhistory_buffer_lines) { break; } } + return &cpuhistory[pos]; +} + +cpuhistory_t *mon_cpuhistory_next(cpuhistory_t *current, MEMSPACE filter1, MEMSPACE filter2, + MEMSPACE filter3, MEMSPACE filter4, MEMSPACE filter5) { + cpuhistory_t *wrap = &cpuhistory[cpuhistory_buffer_lines]; + cpuhistory_t *head = &cpuhistory[(cpuhistory_i + 1) % cpuhistory_buffer_lines]; + do { + current += 1; + if (current >= wrap) { + current = &cpuhistory[0]; + } else if (current == head) { + return NULL; + } + /* make sure the record matches */ + } while (!((current->origin != e_invalid_space) + && ((filter1 == current->origin) + || (filter2 == current->origin) + || (filter3 == current->origin) + || (filter4 == current->origin) + || (filter5 == current->origin)))); + + return current; +} + +void mon_cpuhistory(int count, MEMSPACE filter1, MEMSPACE filter2, MEMSPACE filter3, + MEMSPACE filter4, MEMSPACE filter5) +{ + uint8_t op, p1, p2, p3 = 0; + MEMSPACE mem; + uint16_t loc, addr; + int hex_mode = 1; + const char *dis_inst; + cpuhistory_t *current; + unsigned opc_size; + CLOCK cycle; + char otext[10]; + + /* if nothing passed, set the first filter to the default device */ + if ((filter1 == e_invalid_space) && + (filter2 == e_invalid_space) && + (filter3 == e_invalid_space) && + (filter4 == e_invalid_space) && + (filter5 == e_invalid_space)) { + filter1 = default_memspace; + } + + /* determine the actual maximum records to go through */ + if (count < 1) { + count = cpuhistory_show_lines; + } + + current = mon_cpuhistory_seek(count, filter1, filter2, filter3, filter4, filter5); + /* loop through all entries until we find the number records requested */ - while (i > 0) { - /* adjust our buffer circular reference */ - pos = ( pos + 1) % cpuhistory_buffer_lines; - /* make sure the record matches */ - if ((cpuhistory[pos].origin != e_invalid_space) - && ((filter1 == cpuhistory[pos].origin) - || (filter2 == cpuhistory[pos].origin) - || (filter3 == cpuhistory[pos].origin) - || (filter4 == cpuhistory[pos].origin) - || (filter5 == cpuhistory[pos].origin))) { - cycle = cpuhistory[pos].cycle; - addr = cpuhistory[pos].addr; - op = cpuhistory[pos].op; - p1 = cpuhistory[pos].p1; - p2 = cpuhistory[pos].p2; + while ((current = mon_cpuhistory_next(current, filter1, filter2, filter3, filter4, filter5))) { + cycle = current->cycle; + addr = current->addr; + op = current->op; + p1 = current->p1; + p2 = current->p2; - mem = cpuhistory[pos].origin; - loc = addr_location(addr); + mem = current->origin; + loc = addr_location(addr); - dis_inst = mon_disassemble_to_string_ex(mem, loc, op, p1, p2, p3, hex_mode, &opc_size); + dis_inst = mon_disassemble_to_string_ex(mem, loc, op, p1, p2, p3, hex_mode, &opc_size); - strncpy(otext, mon_memspace_string[mem], 4); + strncpy(otext, mon_memspace_string[mem], 4); - /* Print the disassembled instruction */ - mon_out(".%s:%04x %-26s A:%02x X:%02x Y:%02x SP:%02x %c%c-%c%c%c%c%c %12"PRIu64"\n", - otext, loc, dis_inst, - cpuhistory[pos].reg_a, cpuhistory[pos].reg_x, - cpuhistory[pos].reg_y, cpuhistory[pos].reg_sp, - ((cpuhistory[pos].reg_st & (1 << 7)) != 0) ? 'N' : '.', - ((cpuhistory[pos].reg_st & (1 << 6)) != 0) ? 'V' : '.', - ((cpuhistory[pos].reg_st & (1 << 4)) != 0) ? 'B' : '.', - ((cpuhistory[pos].reg_st & (1 << 3)) != 0) ? 'D' : '.', - ((cpuhistory[pos].reg_st & (1 << 2)) != 0) ? 'I' : '.', - ((cpuhistory[pos].reg_st & (1 << 1)) != 0) ? 'Z' : '.', - ((cpuhistory[pos].reg_st & (1 << 0)) != 0) ? 'C' : '.', - cycle - ); - i--; - } + /* Print the disassembled instruction */ + mon_out(".%s:%04x %-26s A:%02x X:%02x Y:%02x SP:%02x %c%c-%c%c%c%c%c %12"PRIu64"\n", + otext, loc, dis_inst, + current->reg_a, current->reg_x, + current->reg_y, current->reg_sp, + ((current->reg_st & (1 << 7)) != 0) ? 'N' : '.', + ((current->reg_st & (1 << 6)) != 0) ? 'V' : '.', + ((current->reg_st & (1 << 4)) != 0) ? 'B' : '.', + ((current->reg_st & (1 << 3)) != 0) ? 'D' : '.', + ((current->reg_st & (1 << 2)) != 0) ? 'I' : '.', + ((current->reg_st & (1 << 1)) != 0) ? 'Z' : '.', + ((current->reg_st & (1 << 0)) != 0) ? 'C' : '.', + cycle + ); } } Modified: branches/compyx/joymap-001/vice/src/monitor/mon_memmap.h =================================================================== --- branches/compyx/joymap-001/vice/src/monitor/mon_memmap.h 2025-03-25 09:08:38 UTC (rev 45580) +++ branches/compyx/joymap-001/vice/src/monitor/mon_memmap.h 2025-03-25 14:14:52 UTC (rev 45581) @@ -30,6 +30,21 @@ #include "montypes.h" #include "types.h" +struct cpuhistory_s { + CLOCK cycle; + uint16_t addr; + uint16_t reg_st; + uint8_t op; + uint8_t p1; + uint8_t p2; + uint8_t reg_a; + uint8_t reg_x; + uint8_t reg_y; + uint8_t reg_sp; + MEMSPACE origin; +}; +typedef struct cpuhistory_s cpuhistory_t; + void mon_memmap_init(void); void mon_memmap_shutdown(void); @@ -36,9 +51,14 @@ int monitor_cpuhistory_allocate(int lines); void mon_cpuhistory(int count, MEMSPACE filter1, MEMSPACE filter2, MEMSPACE filter3, MEMSPACE filter4, MEMSPACE filter5); +cpuhistory_t *mon_cpuhistory_seek(int count, MEMSPACE filter1, MEMSPACE filter2, + MEMSPACE filter3, MEMSPACE filter4, MEMSPACE filter5); +cpuhistory_t *mon_cpuhistory_next(cpuhistory_t *current, MEMSPACE filter1, MEMSPACE filter2, + MEMSPACE filter3, MEMSPACE filter4, MEMSPACE filter5); void mon_memmap_zap(void); void mon_memmap_show(int mask, MON_ADDR start_addr, MON_ADDR end_addr); void mon_memmap_save(const char* filename, int format); + #endif Modified: branches/compyx/joymap-001/vice/src/monitor/monitor_binary.c =================================================================== --- branches/compyx/joymap-001/vice/src/monitor/monitor_binary.c 2025-03-25 09:08:38 UTC (rev 45580) +++ branches/compyx/joymap-001/vice/src/monitor/monitor_binary.c 2025-03-25 14:14:52 UTC (rev 45581) @@ -52,6 +52,7 @@ #include "machine-video.h" #include "palette.h" +#include "mon_memmap.h" #include "mon_breakpoint.h" #include "mon_file.h" #include "mon_register.h" @@ -110,6 +111,7 @@ e_MON_CMD_REGISTERS_AVAILABLE = 0x83, e_MON_CMD_DISPLAY_GET = 0x84, e_MON_CMD_VICE_INFO = 0x85, + e_MON_CMD_CPUHISTORY_GET = 0x86, e_MON_CMD_PALETTE_GET = 0x91, @@ -158,6 +160,7 @@ e_MON_RESPONSE_REGISTERS_AVAILABLE = 0x83, e_MON_RESPONSE_DISPLAY_GET = 0x84, e_MON_RESPONSE_VICE_INFO = 0x85, + e_MON_RESPONSE_CPUHISTORY_GET = 0x86, e_MON_RESPONSE_PALETTE_GET = 0x91, @@ -306,6 +309,15 @@ return output + 4; } +/*! \internal \brief Write uint64 to buffer and return pointer to byte after */ +static unsigned char *write_uint64(uint64_t input, unsigned char *output) { + for (int i = 0 ; i < 8 ; i++) { + output[i] = (uint8_t)(input >> (8 * i)) & 0xFFu; + } + + return output + 8; +} + /*! \internal \brief Write string to buffer and return pointer to byte after */ static unsigned char *write_string(uint8_t length, unsigned char *input, unsigned char *output) { output[0] = length; @@ -416,47 +428,58 @@ } } -static void monitor_binary_response_register_info(uint32_t request_id, MEMSPACE memspace) -{ - mon_reg_list_t *regs; - mon_reg_list_t *regs_cursor; - unsigned char *response; - unsigned char *response_cursor; - uint32_t response_size = 2; +#define MON_REGISTER_ITEM_SIZE 3 + +static uint16_t count_registers(mon_reg_list_t *regs) { uint16_t count = 0; - uint8_t item_size = 3; - regs = mon_register_list_get(memspace); - regs_cursor = regs; - - for( ; regs_cursor->name ; regs_cursor++) { - if (!ignore_fake_register(regs_cursor)) { + for( ; regs->name ; regs++) { + if (!ignore_fake_register(regs)) { ++count; } } - response_size += count * (item_size + 1); - response = lib_malloc(response_size); - response_cursor = response; + return count; +} - regs_cursor = regs; - +static unsigned char *write_registers(mon_reg_list_t *regs, uint16_t count, unsigned char *response_cursor) { response_cursor = write_uint16(count, response_cursor); - for( ; regs_cursor->name ; regs_cursor++) { - if (ignore_fake_register(regs_cursor)) { + for( ; regs->name ; regs++) { + if (ignore_fake_register(regs)) { continue; } - *response_cursor = item_size; + *response_cursor = MON_REGISTER_ITEM_SIZE; ++response_cursor; - *response_cursor = regs_cursor->id; + *response_cursor = regs->id; ++response_cursor; - response_cursor = write_uint16((uint16_t)regs_cursor->val, response_cursor); + response_cursor = write_uint16((uint16_t)regs->val, response_cursor); } + return response_cursor; +} + +static void monitor_binary_response_register_info(uint32_t request_id, MEMSPACE memspace) +{ + mon_reg_list_t *regs; + unsigned char *response; + unsigned char *response_cursor; + uint16_t count; + uint32_t response_size = 2; + + regs = mon_register_list_get(memspace); + + count = count_registers(regs); + + response_size += count * (MON_REGISTER_ITEM_SIZE + 1); + response = lib_malloc(response_size); + response_cursor = response; + + response_cursor = write_registers(regs, count, response_cursor); + monitor_binary_response(response_size, e_MON_RESPONSE_REGISTER_INFO, e_MON_ERR_OK, request_id, response); lib_free(response); @@ -782,7 +805,7 @@ if(memspace == e_invalid_space) { monitor_binary_error(e_MON_ERR_INVALID_MEMSPACE, command->request_id); - log_message(LOG_DEFAULT, "monitor binary memset: Unknown memspace %u", requested_memspace); + log_message(LOG_DEFAULT, "monitor binary registers get: Unknown memspace %u", requested_memspace); return; } @@ -1413,6 +1436,177 @@ monitor_binary_response(sizeof(response), e_MON_RESPONSE_VICE_INFO, e_MON_ERR_OK, command->request_id, response); } +#ifdef FEATURE_CPUMEMHISTORY +static void monitor_binary_process_cpuhistory(binary_command_t *command) +{ + mon_reg_list_t *regs; + mon_reg_list_t *templates; + mon_reg_list_t *reg_a = NULL; + mon_reg_list_t *reg_x = NULL; + mon_reg_list_t *reg_y = NULL; + mon_reg_list_t *reg_sp = NULL; + mon_reg_list_t *reg_flags = NULL; + mon_reg_list_t *reg_pc = NULL; + mon_reg_list_t *reg_lin = NULL; + mon_reg_list_t *reg_cyc = NULL; + int i, j; + int registers_per_row = 8; + unsigned char *response; + unsigned char *response_cursor; + uint8_t instruction_length = 4; + uint16_t requested_count, count = 0; + uint32_t response_size; + int item_size = 2 + registers_per_row * (MON_REGISTER_ITEM_SIZE + 1) + 8 + 1 + instruction_length; + + cpuhistory_t *current; + + uint8_t requested_memspace = command->body[0]; + + MEMSPACE memspace; + if (command->length < 5) { + monitor_binary_error(e_MON_ERR_CMD_INVALID_LENGTH, command->request_id); + return; + } + + memspace = get_requested_memspace(requested_memspace); + + if (memspace == e_invalid_space) { + monitor_binary_error(e_MON_ERR_INVALID_MEMSPACE, command->request_id); + log_message(LOG_DEFAULT, "monitor binary cpuhistory: Unknown memspace %u", requested_memspace); + return; + } + + requested_count = little_endian_to_uint32(&command->body[1]); + + if (req... [truncated message content] |
From: <co...@us...> - 2025-03-25 09:08:45
|
Revision: 45580 http://sourceforge.net/p/vice-emu/code/45580 Author: compyx Date: 2025-03-25 09:08:38 +0000 (Tue, 25 Mar 2025) Log Message: ----------- Joystick: add optional `customize()` callback to customize default mapping/calibration Add driver method `customize()` that is called after `joystick_device_register()` has run the default mapper and set up default calibration. This allows drivers to tweak mappings and calibrations if required, while keeping any device- or OS-specific logic out of the common code. Modified Paths: -------------- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c branches/compyx/joymap-001/vice/src/joyport/joystick.c branches/compyx/joymap-001/vice/src/joyport/joystick.h Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c =================================================================== --- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-03-24 13:56:34 UTC (rev 45579) +++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-03-25 09:08:38 UTC (rev 45580) @@ -353,6 +353,8 @@ } +static void linux_joystick_customize(joystick_device_t *joydev); + /** \brief Object used to register driver for devices * * The address of this object is used in the joystick code, it isn't copied, @@ -359,10 +361,11 @@ * so we cannot move this into `linux_joystick_init()` to use for registration. */ static joystick_driver_t driver = { - .open = linux_joystick_evdev_open, - .poll = linux_joystick_evdev_poll, - .close = linux_joystick_evdev_close, - .priv_free = joy_priv_free + .open = linux_joystick_evdev_open, + .poll = linux_joystick_evdev_poll, + .close = linux_joystick_evdev_close, + .priv_free = joy_priv_free, + .customize = linux_joystick_customize }; @@ -417,3 +420,16 @@ } free(namelist); } + + +/** \brief Custom mapping/calibration callback + * + * Just for debugging/testing right now. + * + * \param[in] joydev joystick device + */ +static void linux_joystick_customize(joystick_device_t *joydev) +{ + printf("%s() called for device %04x:%04x\n", + __func__, (unsigned int)joydev->vendor, (unsigned int)joydev->product); +} Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c =================================================================== --- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-24 13:56:34 UTC (rev 45579) +++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-25 09:08:38 UTC (rev 45580) @@ -3621,6 +3621,10 @@ /* Now we can try to apply a default mapping */ joystick_device_apply_default_mapping(joydev); + /* Call custom mapping/calibration function if defined */ + if (joy_driver.customize != NULL) { + joy_driver.customize(joydev); + } joystick_devices[num_joystick_devices] = joydev; joystick_devices[++num_joystick_devices] = NULL; @@ -4033,3 +4037,64 @@ } return NULL; } + + +/** \brief Clear axis mappings + * + * \param[in] axis joystick axis + */ +void joystick_axis_clear_mappings(joystick_axis_t *axis) +{ + joystick_mapping_init(&axis->mapping.negative); + joystick_mapping_init(&axis->mapping.positive); + axis->mapping.pot = 0; +} + + +/** \brief Clear button mapping + * + * \param[in] button joystick button + * + * \note Using plural "mappings" in the name to be consistent with the + * axis and hat functions. + */ +void joystick_button_clear_mappings(joystick_button_t *button) +{ + joystick_mapping_init(&button->mapping); +} + + +/** \brief Clear hat mappings + * + * \param[in] hat joystick hat + */ +void joystick_hat_clear_mappings(joystick_hat_t *hat) +{ + joystick_mapping_init(&hat->mapping.up); + joystick_mapping_init(&hat->mapping.down); + joystick_mapping_init(&hat->mapping.left); + joystick_mapping_init(&hat->mapping.right); +} + + +/** \brief Clear all mappings assigned to a joystick device + * + * Clear all axis, button and hats mappings of \a joydev. + * + * \param[in] joydev joystick device + */ +void joystick_device_clear_mappings(joystick_device_t *joydev) +{ + int i; + + for (i = 0; i < joydev->num_axes; i++) { + joystick_axis_clear_mappings(joydev->axes[i]); + } + for (i = 0; i < joydev->num_buttons; i++) { + joystick_button_clear_mappings(joydev->buttons[i]); + } + for (i = 0; i < joydev->num_hats; i++) { + joystick_hat_clear_mappings(joydev->hats[i]); + } + +} Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.h =================================================================== --- branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-24 13:56:34 UTC (rev 45579) +++ branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-25 09:08:38 UTC (rev 45580) @@ -331,6 +331,15 @@ /** \brief Optional method to free arch-specific device data */ void (*priv_free)(void *); + + /** \brief Function to call after registering a device + * + * This function is called after #joystick_device_register has processed + * its argument. It can be used to customize mappings or calibration if so + * required. + */ + void (*customize)(joystick_device_t *); + } joystick_driver_t; @@ -428,6 +437,7 @@ joystick_button_t *button); void joystick_device_add_hat (joystick_device_t *joydev, joystick_hat_t *hat); +void joystick_device_clear_mappings(joystick_device_t *joydev); void joystick_mapping_init (joystick_mapping_t *mapping); void joystick_calibration_init (joystick_calibration_t *calibration); @@ -436,15 +446,18 @@ joystick_axis_t *joystick_axis_from_code (joystick_device_t *joydev, uint32_t code); void joystick_axis_free (joystick_axis_t *axis); +void joystick_axis_clear_mappings(joystick_axis_t *axis); joystick_button_t *joystick_button_new (const char *name); joystick_button_t *joystick_button_from_code (joystick_device_t *joydev, uint32_t code); void joystick_button_free (joystick_button_t *button); +void joystick_button_clear_mappings(joystick_button_t *button); joystick_hat_t *joystick_hat_new (const char *name); joystick_hat_t *joystick_hat_from_code (joystick_device_t *joydev, uint32_t code); void joystick_hat_free (joystick_hat_t *hat); +void joystick_hat_clear_mappings(joystick_hat_t *hat); #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-03-24 13:56:37
|
Revision: 45579 http://sourceforge.net/p/vice-emu/code/45579 Author: compyx Date: 2025-03-24 13:56:34 +0000 (Mon, 24 Mar 2025) Log Message: ----------- Joystick: make SDL use raw axis values for `joy_axis_event()` Also make sure to initialize pot mapping of axes to 0 (unassigned). Modified Paths: -------------- branches/compyx/joymap-001/vice/src/arch/sdl/joy.c branches/compyx/joymap-001/vice/src/joyport/joystick.c branches/compyx/joymap-001/vice/src/joyport/joystick.h Modified: branches/compyx/joymap-001/vice/src/arch/sdl/joy.c =================================================================== --- branches/compyx/joymap-001/vice/src/arch/sdl/joy.c 2025-03-24 09:51:03 UTC (rev 45578) +++ branches/compyx/joymap-001/vice/src/arch/sdl/joy.c 2025-03-24 13:56:34 UTC (rev 45579) @@ -683,13 +683,12 @@ { joystick_device_t *joydev = joystick_device_by_index(joynum); joystick_axis_t *axis = joydev->axes[axisnum]; - joystick_axis_value_t cur, prev; - +#if 0 prev = joy_axis_prev(joynum, axisnum); cur = sdljoy_axis_direction(value, prev); - - joy_axis_event(joydev, axis, cur); +#endif + joy_axis_event(joydev, axis, value); } static ui_menu_action_t sdljoy_perform_event_for_menu_action(joystick_mapping_t* event, Sint16 value) Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c =================================================================== --- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-24 09:51:03 UTC (rev 45578) +++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-24 13:56:34 UTC (rev 45579) @@ -857,7 +857,7 @@ joystick_axis_t *axis = joydev->axes[axis_idx]; if ((joydev->joyport == 0 || joydev->joyport == 1) && (axis->mapping.pot > 0)) { - joystick_axis_value[joydev->joyport][axis->mapping.pot- 1] = value; + joystick_axis_value[joydev->joyport][axis->mapping.pot - 1] = value; } } } @@ -3066,11 +3066,11 @@ } } #endif - if (pressed != button->prev) { + if (value != button->prev) { DBG(("joy_button_event: joy: %s, button: %d (%s) pressed: %d\n", joydev->name, button->index, button->name, pressed)); joy_perform_event(&button->mapping, joydev->joyport, pressed); - button->prev = pressed; + button->prev = value; } } @@ -3119,7 +3119,7 @@ } #ifdef HAVE_SDL_NUMJOYSTICKS -joystick_axis_value_t joy_axis_prev(uint8_t joynum, uint8_t axis) +int32_t joy_axis_prev(uint8_t joynum, uint8_t axis) { return joystick_devices[joynum]->axes[axis]->prev; } @@ -3736,6 +3736,7 @@ axis->digital = false; joystick_mapping_init(&axis->mapping.negative); joystick_mapping_init(&axis->mapping.positive); + axis->mapping.pot = 0; /* no POT mapped */ joystick_calibration_init(&axis->calibration); } Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.h =================================================================== --- branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-24 09:51:03 UTC (rev 45578) +++ branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-24 13:56:34 UTC (rev 45579) @@ -217,7 +217,7 @@ struct { joystick_mapping_t negative; /**< negative direction */ joystick_mapping_t positive; /**< positive direction */ - unsigned int pot; /**< pot index (0 or 1) */ + unsigned int pot; /**< pot number (1 or 2, 0 means unmapped) */ } mapping; /**< mapping for negative and positive directions, and pot. TODO: support pot values other than on/off so emulated paddles and mice can be mapped to axes. */ @@ -342,12 +342,13 @@ int joy_sdl_init(void); int joy_sdl_resources_init(void); int joy_sdl_cmdline_options_init(void); +void joystick_set_axis_value(unsigned int index, unsigned int axis, uint8_t value); + int joystick_check_set(signed long key, int keysetnum, unsigned int joyport); int joystick_check_clr(signed long key, int keysetnum, unsigned int joyport); void joystick_joypad_clear(void); -void joystick_set_axis_value(unsigned int index, unsigned int axis, uint8_t value); uint8_t joystick_get_axis_value(unsigned int port, unsigned int pot); void joystick_set_value_absolute(unsigned int joyport, uint16_t value); @@ -391,7 +392,9 @@ const char *joystick_ui_get_next_device_name(int *id); int joy_arch_mapping_dump(const char *filename); int joy_arch_mapping_load(const char *filename); -joystick_axis_value_t joy_axis_prev(uint8_t joynum, uint8_t axis); + +int32_t joy_axis_prev(uint8_t joynum, uint8_t axis); + char *get_joy_pot_mapping_string(int joystick_device_num, int pot); char *get_joy_pin_mapping_string(int joystick_device, int pin); char *get_joy_extra_mapping_string(int which); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-03-24 09:51:10
|
Revision: 45578 http://sourceforge.net/p/vice-emu/code/45578 Author: compyx Date: 2025-03-24 09:51:03 +0000 (Mon, 24 Mar 2025) Log Message: ----------- Joystick: update BSD driver to pass raw values to `joy_axis_event()` Modified Paths: -------------- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c =================================================================== --- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-24 07:25:18 UTC (rev 45577) +++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-24 09:51:03 UTC (rev 45578) @@ -197,23 +197,12 @@ /* axis */ axis = joystick_axis_from_code(joydev, (uint32_t)usage); if (axis != NULL) { - joystick_axis_value_t direction = JOY_AXIS_MIDDLE; - int32_t range = axis->maximum - axis->minimum; -#if 0 - printf("%s(): AXIS: index = %d, usage = %d, value = %d\n", - __func__, index, usage, value); -#endif /* XXX: On my Logitech F710 the Y axis is inverted by * FreeBSD, NetBSD just reports insane values. * So for FreeBSD we'd need calibration to be * implemented for the F710 to work. */ - if (value <= (axis->minimum + (range / 4))) { - direction = JOY_AXIS_NEGATIVE; - } else if (value >= (axis->maximum - (range / 4))) { - direction = JOY_AXIS_POSITIVE; - } - joy_axis_event(joydev, axis, direction); + joy_axis_event(joydev, axis, (int32_t)value); } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-03-24 07:25:26
|
Revision: 45577 http://sourceforge.net/p/vice-emu/code/45577 Author: compyx Date: 2025-03-24 07:25:18 +0000 (Mon, 24 Mar 2025) Log Message: ----------- Joystick: update DirectInput driver to pass raw axis values Modified Paths: -------------- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c =================================================================== --- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-03-24 07:05:56 UTC (rev 45576) +++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-03-24 07:25:18 UTC (rev 45577) @@ -187,25 +187,12 @@ LONG prev = priv->prev_axes[i]; if (code < sizeof axis_map / sizeof axis_map[0]) { - int32_t minimum = axis->minimum; - int32_t maximum = axis->maximum; - int32_t range = maximum - minimum; - int32_t value = *(axis_map[code]); + LONG value = *(axis_map[code]); - if (value == prev) { - continue; + if (value != prev) { + priv->prev_axes[i] = value; + joy_axis_event(joydev, axis, (int32_t)value); } - priv->prev_axes[i] = value; - - //printf("axis %d raw value = %d\n", i, value); - - if (value <= minimum + (range / 4)) { - joy_axis_event(joydev, axis, JOY_AXIS_NEGATIVE); - } else if (value >= maximum - (range / 4)) { - joy_axis_event(joydev, axis, JOY_AXIS_POSITIVE); - } else { - joy_axis_event(joydev, axis, JOY_AXIS_MIDDLE); - } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-03-24 07:06:09
|
Revision: 45576 http://sourceforge.net/p/vice-emu/code/45576 Author: compyx Date: 2025-03-24 07:05:56 +0000 (Mon, 24 Mar 2025) Log Message: ----------- Joystick: make `joy_axis_event()` accept raw values Drivers can pass their raw axis values to `joy_axis_event()`, interpretation of the value is done in common code by applying calibration (thresholds) and then determining direction of axis. Linux evdev has been updated. SDL, Win32 and BSD will follow shortly. Modified Paths: -------------- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c branches/compyx/joymap-001/vice/src/joyport/joystick.c branches/compyx/joymap-001/vice/src/joyport/joystick.h Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c =================================================================== --- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-03-24 06:45:21 UTC (rev 45575) +++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-03-24 07:05:56 UTC (rev 45576) @@ -157,24 +157,7 @@ #endif axis = joystick_axis_from_code(joydev, event->code); if (axis != NULL) { - int32_t minimum = axis->minimum; - int32_t maximum = axis->maximum; - int32_t range = maximum - minimum; - joystick_axis_value_t direction = JOY_AXIS_MIDDLE; - - /* ABS_HAT[0-3]XY axes return -1, 0 or 1: */ - if (minimum == -1 && maximum == 1) { - if (event->value < 0) { - direction = JOY_AXIS_NEGATIVE; - } else if (event->value > 0) { - direction = JOY_AXIS_POSITIVE; - } - } else if (event->value < (minimum + (range / 4))) { - direction = JOY_AXIS_NEGATIVE; - } else if (event->value > (maximum - (range / 4))) { - direction = JOY_AXIS_POSITIVE; - } - joy_axis_event(joydev, axis, direction); + joy_axis_event(joydev, axis, event->value); } } } Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c =================================================================== --- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-24 06:45:21 UTC (rev 45575) +++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-24 07:05:56 UTC (rev 45576) @@ -2999,17 +2999,35 @@ void joy_axis_event(joystick_device_t *joydev, joystick_axis_t *axis, - joystick_axis_value_t value) + int32_t value) { - joystick_axis_value_t prev = axis->prev; - int joyport = joydev->joyport; + joystick_axis_value_t direction = JOY_AXIS_MIDDLE; + joystick_axis_value_t prev = axis->prev; + int joyport = joydev->joyport; - if (value == prev) { + + /* digital axes don't require calibration: */ + if (axis->digital) { + if (value < 0) { + direction = JOY_AXIS_NEGATIVE; + } else if (value > 0) { + direction = JOY_AXIS_POSITIVE; + } + } else { + /* here we apply calibration */ + if (value <= axis->calibration.threshold.negative) { + direction = JOY_AXIS_NEGATIVE; + } else if (value >= axis->calibration.threshold.positive) { + direction = JOY_AXIS_POSITIVE; + } + } + + if (direction == prev) { return; } - DBG(("joy_axis_event: joy: %s axis: %d value: %d prev: %u\n", - joydev->name, axis->index, value, prev)); + DBG(("joy_axis_event: joy: %s axis: %d value: %d: direction: %d prev: %d\n", + joydev->name, axis->index, value, direction, prev)); /* release directions first if needed */ if (prev == JOY_AXIS_POSITIVE) { @@ -3020,14 +3038,14 @@ } /* press new direction if needed */ - if (value == JOY_AXIS_POSITIVE) { + if (direction == JOY_AXIS_POSITIVE) { joy_perform_event(&axis->mapping.positive, joyport, 1); } - if (value == JOY_AXIS_NEGATIVE) { + if (direction == JOY_AXIS_NEGATIVE) { joy_perform_event(&axis->mapping.negative, joyport, 1); } - axis->prev = value; + axis->prev = direction; } void joy_button_event(joystick_device_t *joydev, Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.h =================================================================== --- branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-24 06:45:21 UTC (rev 45575) +++ branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-24 07:05:56 UTC (rev 45576) @@ -179,7 +179,8 @@ */ typedef struct joystick_calibration_s { bool invert; /**< invert value */ - struct { + struct + { int32_t negative; /**< axis threshold: V <= T: active input */ int32_t positive; /**< axis threshold: V >= T: active input */ } threshold; @@ -379,15 +380,9 @@ void joystick_set_snes_mapping(int port); -/* TODO: Pass raw value to joy_axis_event(), let the joystick code figure out - * what the axis value should be, based on limits and calibration data - * inside the axis object. - * Same for buttons and hats: let the joystick code decide what to do, - * not the driver. - */ -void joy_axis_event (joystick_device_t *joydev, joystick_axis_t *axis, joystick_axis_value_t value); -void joy_button_event(joystick_device_t *joydev, joystick_button_t *button, int32_t value); -void joy_hat_event (joystick_device_t *joydev, joystick_hat_t *hat, int32_t value); +void joy_axis_event (joystick_device_t *joydev, joystick_axis_t *axis, int32_t value); +void joy_button_event(joystick_device_t *joydev, joystick_button_t *button, int32_t value); +void joy_hat_event (joystick_device_t *joydev, joystick_hat_t *hat, int32_t value); void joystick(void); void joystick_close(void); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-03-24 06:45:23
|
Revision: 45575 http://sourceforge.net/p/vice-emu/code/45575 Author: compyx Date: 2025-03-24 06:45:21 +0000 (Mon, 24 Mar 2025) Log Message: ----------- Joystick: add simple calibration data struct Add `joystick_calibration_t` members to axes, buttons and hats. Right now just containing an `invert` flag and thresholds for axes. When we decide to support using axes for mice, paddles etc we can add deadzones. Modified Paths: -------------- branches/compyx/joymap-001/vice/src/joyport/joystick.c branches/compyx/joymap-001/vice/src/joyport/joystick.h Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c =================================================================== --- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-23 17:33:32 UTC (rev 45574) +++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-24 06:45:21 UTC (rev 45575) @@ -3658,6 +3658,45 @@ } +/** \brief Initialize joystick host input calibration + * + * \param[in] calibration calibration for an input + */ +void joystick_calibration_init(joystick_calibration_t *calibration) +{ + calibration->invert = false; + calibration->threshold.negative = 0; + calibration->threshold.positive = 0; +} + + +/** \brief Apply default calibration parameters on an axis + * + * Set thresholds for \a axis just like the old drivers interpreted axis values. + * For an entire range (minimum to maximum) that would be 0-25%: negative, + * 25-75%: neutral, 75-100%: positive. + * + * \param[in] axis joystick axis + */ +static void joystick_calibration_default_for_axis(joystick_axis_t *axis) +{ + if (!axis->digital) { + int32_t range = axis->maximum - axis->minimum; + + /* add one to get proper range, but only if the result fits */ + if (range < INT32_MAX) { + range++; + } + /* default: 0-25% negative, 25-75% neutral, 75-100% positive */ + axis->calibration.threshold.negative = axis->minimum + (range / 4); + axis->calibration.threshold.positive = axis->minimum + ((range / 4) * 3); + } else { + axis->calibration.threshold.negative = -1; + axis->calibration.threshold.positive = +1; + } +} + + /** \brief Initialize joystick axis * * Intialize \a axis to default values, including its \c positive and \c negative @@ -3679,6 +3718,7 @@ axis->digital = false; joystick_mapping_init(&axis->mapping.negative); joystick_mapping_init(&axis->mapping.positive); + joystick_calibration_init(&axis->calibration); } /** \brief Initialize joystick button @@ -3695,6 +3735,7 @@ button->prev = 0; button->index = -1; joystick_mapping_init(&button->mapping); + joystick_calibration_init(&button->calibration); } /** \brief Initialize joystick hat @@ -3714,6 +3755,7 @@ joystick_mapping_init(&hat->mapping.down); joystick_mapping_init(&hat->mapping.left); joystick_mapping_init(&hat->mapping.right); + joystick_calibration_init(&hat->calibration); } @@ -3840,6 +3882,14 @@ joydev->axes = lib_realloc(joydev->axes, sizeof *joydev->axes * (size_t)joydev->max_axes); } + + /* set default calibration */ + joystick_calibration_default_for_axis(axis); + printf("AXIS %d: min: %d, N-threshold: %d, P-threshold: %d, max: %d\n", + joydev->num_axes, + axis->minimum, axis->calibration.threshold.negative, + axis->calibration.threshold.positive, axis->maximum); + joydev->axes[joydev->num_axes++] = axis; } Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.h =================================================================== --- branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-23 17:33:32 UTC (rev 45574) +++ branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-24 06:45:21 UTC (rev 45575) @@ -175,6 +175,15 @@ } value; } joystick_mapping_t; +/** \brief Calibration for a host input + */ +typedef struct joystick_calibration_s { + bool invert; /**< invert value */ + struct { + int32_t negative; /**< axis threshold: V <= T: active input */ + int32_t positive; /**< axis threshold: V >= T: active input */ + } threshold; +} joystick_calibration_t; /** \brief Joystick button object * @@ -181,12 +190,12 @@ * Information on a host device button input. */ typedef struct joystick_button_s { - uint32_t code; /**< event code */ - char *name; /**< button name */ - int32_t prev; /**< previous polled value */ - int32_t index; /**< index in buttons array */ - joystick_mapping_t mapping; /**< button mapping */ - /* TODO: add calibration data struct */ + uint32_t code; /**< event code */ + char *name; /**< button name */ + int32_t prev; /**< previous polled value */ + int32_t index; /**< index in buttons array */ + joystick_mapping_t mapping; /**< button mapping */ + joystick_calibration_t calibration; /**< button calibration */ } joystick_button_t; @@ -212,7 +221,7 @@ pot. TODO: support pot values other than on/off so emulated paddles and mice can be mapped to axes. */ - /* TODO: add calibration data */ + joystick_calibration_t calibration; /**< axis calibration */ } joystick_axis_t; @@ -232,6 +241,8 @@ joystick_mapping_t left; /**< mapping for 'left' direction */ joystick_mapping_t right; /**< mapping for 'right' direction */ } mapping; /**< mappings per direction */ + joystick_calibration_t calibration; /* XXX: no idea if this makes sense + for hats */ } joystick_hat_t; @@ -421,6 +432,7 @@ joystick_hat_t *hat); void joystick_mapping_init (joystick_mapping_t *mapping); +void joystick_calibration_init (joystick_calibration_t *calibration); joystick_axis_t *joystick_axis_new (const char *name); joystick_axis_t *joystick_axis_from_code (joystick_device_t *joydev, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-03-23 17:33:34
|
Revision: 45574 http://sourceforge.net/p/vice-emu/code/45574 Author: compyx Date: 2025-03-23 17:33:32 +0000 (Sun, 23 Mar 2025) Log Message: ----------- Joystick: simplify BSD driver a lot Get rid of custom insertion sort for axes, buttons and hats, the common code takes care of sorting inputs. Get rid of custom event-code-to-[axis|button|hat] functions: again implemented in common code. Modified Paths: -------------- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c =================================================================== --- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-23 16:59:00 UTC (rev 45573) +++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-23 17:33:32 UTC (rev 45574) @@ -92,139 +92,7 @@ int fd; } joy_priv_t; -/** \brief Function to free data in a input node list - * - * Function to call on the \c data member of an #input_node_t if #input_list_free() - * is called with \c with_data set to <tt>true</tt>. - * This typedef allows us to cast #joystick_axis_free(). #joystick_button_free() - * and #joystick_hat_free() to the type expected by #input_list_init(), avoiding - * wrapper functions. - */ -typedef void (*data_free_t)(void*); -/** \brief Node in an ordered linked list of inputs - */ -typedef struct input_node_s { - struct input_node_s *next; /**< next node */ - void *data; /**< data (axis/button/hat object pointer) */ -} input_node_t; - -/** \brief Ordered list of inputs - */ -typedef struct input_list_s { - /** \brief Head node */ - input_node_t *head; - - /** \brief Function to call to free the data of a node - * - * This function is called on the \c data member of a node if #input_list_free() - * is called with its \c with_data argument set to <tt>true</tt>. This - * allows cleaning up the list and its data when an error occurs during - * scanning. - */ - void (*data_free)(void *); - - /** \brief Comparison function for ordered insertion - * - * Return 0 when the codes of both arguments are equal, return < 0 when - * \c arg1->code < \c arg2->code, return > 0 when \c arg1->code - * > \c arg2->code. - */ - int (*data_comp)(const void *, const void *); -} input_list_t; - - -/** \brief Initialize ordered input list - * - * \param[in] list input list - * \param[in] data_free function to free the \c data member of the list nodes - * \param[in] data_comp function to compare two \c data members - */ -static void input_list_init(input_list_t *list, - void (*data_free)(void *), - int (*data_comp)(const void *, const void *)) -{ - list->head = NULL; - list->data_free = data_free; - list->data_comp = data_comp; -} - -/** \brief Free input list - * - * Free input list node and optionally free each node's \c data member. - * - * \param[in] list input list - * \param[in] with_data also free the \c data member of each node - */ -static void input_list_free(input_list_t *list, bool with_data) -{ - input_node_t *node = list->head; - while (node != NULL) { - input_node_t *next = node->next; - if (with_data) { - list->data_free(node->data); - } - lib_free(node); - node = next; - } - list->head = NULL; -} - -/** \brief Insert data into input list in-order - * - * Insert \a data into \a list, using the \c data_comp function specified in - * #input_list_init() to determine its location in the list. - * - * \param[in] list input list - * \param[in] data input object to insert into \a list - * - * \return <tt>true</tt> on success, <tt>false</tt> if an input with the same - * code is already present (which should not happen) - */ -static bool input_list_insert(input_list_t *list, void *data) -{ - input_node_t *node = lib_malloc(sizeof *node); - - node->next = NULL; - node->data = data; - - if (list->head == NULL) { - list->head = node; - return true; - } else { - input_node_t *curr = list->head; - input_node_t *prev = NULL; - - while (curr != NULL) { - int cmp = list->data_comp(node->data, curr->data); - - if (cmp == 0) { - /* error: duplicate code */ - return false; - } else if (cmp < 0) { - /* insert before curr */ - if (prev == NULL) { - /* no previous items */ - node->next = curr; - list->head = node; - } else { - prev->next = node; - node->next = curr; - } - return true; - } else { - /* keep going */ - prev = curr; - curr = curr->next; - } - } - /* append to tail of list */ - prev->next = node; - return true; - } -} - - /* Forward declarations */ static bool bsd_joy_open (joystick_device_t *joydev); static void bsd_joy_poll (joystick_device_t *joydev); @@ -235,16 +103,6 @@ /** \brief Log for BSD joystick driver */ static log_t bsd_joy_log; -/** \brief Temporary ordered list of axes */ -static input_list_t axis_list; - -/** \brief Temporary ordered list of buttons */ -static input_list_t button_list; - -/** \brief Temporary ordered list of hats */ -static input_list_t hat_list; - - /** \brief BSD joystick driver declaration */ static joystick_driver_t driver = { .open = bsd_joy_open, @@ -297,56 +155,11 @@ } } - static bool bsd_joy_open (joystick_device_t *joydev) { return true; /* NOP */ } - -static int joy_axis_index(joystick_device_t *joydev, uint32_t code) -{ - int i; - - for (i = 0; i < joydev->num_axes; i++) { - if (joydev->axes[i]->code == code) { - return i; - } else if (joydev->axes[i]->code > code) { - return -1; - } - } - return -1; -} - -static int joy_button_index(joystick_device_t *joydev, uint32_t code) -{ - int i; - - for (i = 0; i < joydev->num_buttons; i++) { - if (joydev->buttons[i]->code == code) { - return i; - } else if (joydev->buttons[i]->code > code) { - return -1; - } - } - return -1; -} - -static int joy_hat_index(joystick_device_t *joydev, uint32_t code) -{ - int i; - - for (i = 0; i < joydev->num_hats; i++) { - if (joydev->hats[i]->code == code) { - return i; - } else if (joydev->hats[i]->code > code) { - return -1; - } - } - return -1; -} - - static void bsd_joy_poll(joystick_device_t *joydev) { joy_priv_t *priv = joydev->priv; @@ -357,7 +170,6 @@ while ((rsize = read(priv->fd, priv->buffer, (size_t)priv->rep_size)) == priv->rep_size) { struct hid_data *data; struct hid_item item; - int index; data = hid_start_parse(priv->rep_desc, 1 << hid_input, priv->rep_id); if (data == NULL) { @@ -364,11 +176,13 @@ return; } - while (hid_get_item(data, &item) > 0) { - int value = hid_get_data(priv->buffer, &item); - int usage = HID_USAGE(item.usage); - unsigned int page = HID_PAGE(item.usage); + joystick_axis_t *axis; + joystick_button_t *button; + joystick_hat_t *hat; + int value = hid_get_data(priv->buffer, &item); + int usage = HID_USAGE(item.usage); + unsigned int page = HID_PAGE(item.usage); switch (page) { case HUP_GENERIC_DESKTOP: @@ -381,11 +195,10 @@ case HUG_RZ: /* fall through */ case HUG_SLIDER: /* axis */ - index = joy_axis_index(joydev, (uint32_t)usage); - if (index >= 0) { - joystick_axis_t *axis = joydev->axes[index]; - joystick_axis_value_t direction = JOY_AXIS_MIDDLE; - int32_t range = axis->maximum - axis->minimum; + axis = joystick_axis_from_code(joydev, (uint32_t)usage); + if (axis != NULL) { + joystick_axis_value_t direction = JOY_AXIS_MIDDLE; + int32_t range = axis->maximum - axis->minimum; #if 0 printf("%s(): AXIS: index = %d, usage = %d, value = %d\n", __func__, index, usage, value); @@ -406,11 +219,9 @@ case HUG_HAT_SWITCH: /* hat */ - index = joy_hat_index(joydev, (uint32_t)usage); - if (index >= 0) { - joy_hat_event(joydev, - joydev->hats[index], - (int32_t)value); + hat = joystick_hat_from_code(joydev, (uint32_t)usage); + if (hat != NULL) { + joy_hat_event(joydev, hat, (int32_t)value); } break; @@ -419,11 +230,9 @@ case HUG_D_PAD_LEFT: /* fall through */ case HUG_D_PAD_RIGHT: /* D-Pad is mapped as buttons */ - index = joy_button_index(joydev, (uint32_t)usage); - if (index >= 0) { - joy_button_event(joydev, - joydev->buttons[index], - (int32_t)value); + button = joystick_button_from_code(joydev, (uint32_t)usage); + if (button != NULL) { + joy_button_event(joydev, button, (int32_t)value); } break; default: @@ -432,11 +241,9 @@ break; case HUP_BUTTON: /* button event */ - index = joy_button_index(joydev, (uint32_t)usage); - if (index >= 0) { - joy_button_event(joydev, - joydev->buttons[index], - (int32_t)value); + button = joystick_button_from_code(joydev, (uint32_t)usage); + if (button != NULL) { + joy_button_event(joydev, button, (int32_t)value); } break; default: @@ -511,11 +318,11 @@ */ static joy_priv_t *joy_hid_open(const char *node) { - joy_priv_t *priv; - report_desc_t rep_desc; - int rep_id; - int rep_size; - int fd; + joy_priv_t *priv; + report_desc_t rep_desc; + int rep_id; + int rep_size; + int fd; fd = open(node, O_RDONLY|O_NONBLOCK); if (fd < 0) { @@ -583,7 +390,7 @@ axis->maximum = item->logical_maximum; log_message(bsd_joy_log, "axis %u: %s", axis->code, axis->name); - input_list_insert(&axis_list, axis); + joystick_device_add_axis(joydev, axis); } /** \brief Add button to joystick device @@ -600,7 +407,7 @@ button->code = (uint32_t)HID_USAGE(item->usage); log_message(bsd_joy_log, "button %u: %s", button->code, button->name); - input_list_insert(&button_list, button); + joystick_device_add_button(joydev, button); } /** \brief Add hat to joystick device @@ -617,7 +424,7 @@ hat->code = (uint32_t)HID_USAGE(item->usage); log_message(bsd_joy_log, "hat %u: %s", hat->code, hat->name); - input_list_insert(&hat_list, hat); + joystick_device_add_hat(joydev, hat); } /** \brief Scan device for inputs @@ -730,113 +537,7 @@ return joydev; } -/** \brief Ordered list comparison callback for axes - * - * Compare code of axis \a a1 with code of axis \a a2. - * - * \param[in] a1 joystick axis object - * \param[in] a2 joystick axis object - * - * \return 0 if equal, < 0 if \a a1 < \a a2, > 0 if \a a1 > \a a2 - */ -static int axis_comp(const void *a1, const void *a2) -{ - const joystick_axis_t *axis1 = a1; - const joystick_axis_t *axis2 = a2; - if (axis1->code == axis2->code) { - return 0; - } else if (axis1->code < axis2->code) { - return -1; - } else { - return 1; - } -} - -/** \brief Ordered list comparison callback for buttons - * - * Compare code of button \a b1 with code of button \a b2. - * - * \param[in] b1 joystick button object - * \param[in] b2 joystick button object - * - * \return 0 if equal, < 0 if \a b1 < \a b2, > 0 if \a b1 > \a b2 - */ -static int button_comp(const void *b1, const void *b2) -{ - const joystick_button_t *btn1 = b1; - const joystick_button_t *btn2 = b2; - - if (btn1->code == btn2->code) { - return 0; - } else if (btn1->code < btn2->code) { - return -1; - } else { - return 1; - } -} - -/** \brief Ordered list comparison callback for hats - * - * Compare code of hat \a h1 with code of hat \a h2. - * - * \param[in] h1 joystick hat object - * \param[in] h2 joystick hat object - * - * \return 0 if equal, < 0 if \a h1 < \a h2, > 0 if \a h1 > \a h2 - */ -static int hat_comp(const void *h1, const void *h2) -{ - const joystick_hat_t *hat1 = h1; - const joystick_hat_t *hat2 = h2; - - if (hat1->code == hat2->code) { - return 0; - } else if (hat1->code < hat2->code) { - return -1; - } else { - return 1; - } -} - -/* kept for debugging */ -#if 0 -static void add_ordered_buttons(joystick_device_t *joydev) -{ - input_node_t *node; - int num = 0; - - for (node = button_list.head; node != NULL; node = node->next) { - joystick_button_t *button = node->data; - - printf("BUTTON LIST: %d: 0x%04x \"%s\"\n", num++, button->code, button->name); - joystick_device_add_button(joydev, node->data); - } -} -#endif - -/** \brief Add inputs ordered by code - * - * Add axes, buttons and hats ordered by their code (hid usage) to \a joydev. - * - * \param[in] joydev joystick device - */ -static void add_ordered_inputs(joystick_device_t *joydev) -{ - input_node_t *node; - - for (node = axis_list.head; node != NULL; node = node->next) { - joystick_device_add_axis(joydev, node->data); - } - for (node = button_list.head; node != NULL; node = node->next) { - joystick_device_add_button(joydev, node->data); - } - for (node = hat_list.head; node != NULL; node = node->next) { - joystick_device_add_hat(joydev, node->data); - } -} - - /** \brief Initialize BSD joystick driver and add available devices */ void bsd_joystick_init(void) @@ -877,16 +578,8 @@ if (joydev != NULL) { log_message(bsd_joy_log, "%s: %s", joydev->node, joydev->name); - /* initialize lists to sort inputs on code */ - input_list_init(&axis_list, (data_free_t)joystick_axis_free, axis_comp); - input_list_init(&button_list, (data_free_t)joystick_button_free, button_comp); - input_list_init(&hat_list, (data_free_t)joystick_hat_free, hat_comp); - /* scan axes, buttons and hats */ if (scan_inputs(joydev)) { - /* add inputs to device in-order */ - add_ordered_inputs(joydev); - /* OK: try to register */ if (!joystick_device_register(joydev)) { /* failure */ @@ -895,11 +588,6 @@ joydev->node, joydev->name); joystick_device_free(joydev); } - - /* free lists, but not their data */ - input_list_free(&axis_list, false); - input_list_free(&button_list, false); - input_list_free(&hat_list, false); } else { log_warning(bsd_joy_log, "failed to scan inputs for device %s (\"%s\")", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |