vice-emu-commit Mailing List for VICE (Page 22)
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
(28) |
Nov
|
Dec
|
|
From: <gp...@us...> - 2024-08-07 19:14:38
|
Revision: 45280
http://sourceforge.net/p/vice-emu/code/45280
Author: gpz
Date: 2024-08-07 19:14:32 +0000 (Wed, 07 Aug 2024)
Log Message:
-----------
enable userport printer in xplus4
Modified Paths:
--------------
trunk/vice/src/arch/gtk3/widgets/settings_printer.c
trunk/vice/src/arch/sdl/xplus4_ui.c
trunk/vice/src/c64/c64.c
trunk/vice/src/cbm2/cbm2.c
trunk/vice/src/cbm2/cbm5x0.c
trunk/vice/src/pet/pet.c
trunk/vice/src/plus4/plus4.c
trunk/vice/src/plus4/plus4acia.c
trunk/vice/src/plus4/plus4printer.c
trunk/vice/src/printerdrv/drv-ascii.c
trunk/vice/src/printerdrv/drv-raw.c
trunk/vice/src/printerdrv/interface-userport.c
trunk/vice/src/printerdrv/output-select.c
trunk/vice/src/printerdrv/output-text.c
trunk/vice/src/printerdrv/printer-userport.c
trunk/vice/src/printerdrv/printer.c
trunk/vice/src/scpu64/scpu64.c
trunk/vice/src/userport/userport.c
trunk/vice/src/vic20/vic20.c
Modified: trunk/vice/src/arch/gtk3/widgets/settings_printer.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_printer.c 2024-08-07 17:39:33 UTC (rev 45279)
+++ trunk/vice/src/arch/gtk3/widgets/settings_printer.c 2024-08-07 19:14:32 UTC (rev 45280)
@@ -24,7 +24,7 @@
* $VICERES Printer5TextDevice -vsid
* $VICERES Printer6TextDevice -vsid
* $VICERES Printer7TextDevice -vsid
- * $VICERES PrinterUserport x64 x64sc xscpu64 x128 xvic xpet xcbm2
+ * $VICERES PrinterUserport x64 x64sc xscpu64 x128 xvic xpet xcbm2 xplus4
*/
/*
@@ -223,11 +223,11 @@
case VICE_MACHINE_C128: /* fall through */
case VICE_MACHINE_VIC20: /* fall through */
case VICE_MACHINE_PET: /* fall through */
+ case VICE_MACHINE_PLUS4: /* fall through */
case VICE_MACHINE_CBM6x0:
return true;
default:
- /* No userport (C64DTV, CBM-II 5x0/P, VSID) or not usable for
- * printer (Plus/4) */
+ /* No userport (C64DTV, CBM-II 5x0/P, VSID) */
return false;
}
}
Modified: trunk/vice/src/arch/sdl/xplus4_ui.c
===================================================================
--- trunk/vice/src/arch/sdl/xplus4_ui.c 2024-08-07 17:39:33 UTC (rev 45279)
+++ trunk/vice/src/arch/sdl/xplus4_ui.c 2024-08-07 19:14:32 UTC (rev 45280)
@@ -105,7 +105,7 @@
{ .string = "Printer",
.type = MENU_ENTRY_SUBMENU,
.callback = submenu_callback,
- .data = (ui_callback_data_t)printer_iec_nouserport_menu
+ .data = (ui_callback_data_t)printer_iec_menu
},
{ .string = "Machine settings",
.type = MENU_ENTRY_SUBMENU,
Modified: trunk/vice/src/c64/c64.c
===================================================================
--- trunk/vice/src/c64/c64.c 2024-08-07 17:39:33 UTC (rev 45279)
+++ trunk/vice/src/c64/c64.c 2024-08-07 19:14:32 UTC (rev 45280)
@@ -725,6 +725,7 @@
init_resource_fail("serial");
return -1;
}
+ /* CAUTION: must come after userport and serial */
if (printer_resources_init() < 0) {
init_resource_fail("printer");
return -1;
Modified: trunk/vice/src/cbm2/cbm2.c
===================================================================
--- trunk/vice/src/cbm2/cbm2.c 2024-08-07 17:39:33 UTC (rev 45279)
+++ trunk/vice/src/cbm2/cbm2.c 2024-08-07 19:14:32 UTC (rev 45280)
@@ -345,6 +345,7 @@
init_resource_fail("userport devices");
return -1;
}
+ /* CAUTION: must come after userport and serial */
if (printer_resources_init() < 0) {
init_resource_fail("printer");
return -1;
Modified: trunk/vice/src/cbm2/cbm5x0.c
===================================================================
--- trunk/vice/src/cbm2/cbm5x0.c 2024-08-07 17:39:33 UTC (rev 45279)
+++ trunk/vice/src/cbm2/cbm5x0.c 2024-08-07 19:14:32 UTC (rev 45280)
@@ -357,6 +357,7 @@
init_resource_fail("rs232drv");
return -1;
}
+ /* CAUTION: must come after userport and serial */
if (printer_resources_init() < 0) {
init_resource_fail("printer");
return -1;
Modified: trunk/vice/src/pet/pet.c
===================================================================
--- trunk/vice/src/pet/pet.c 2024-08-07 17:39:33 UTC (rev 45279)
+++ trunk/vice/src/pet/pet.c 2024-08-07 19:14:32 UTC (rev 45280)
@@ -355,6 +355,7 @@
init_resource_fail("userport devices");
return -1;
}
+ /* CAUTION: must come after userport and serial */
if (printer_resources_init() < 0) {
init_resource_fail("printer");
return -1;
Modified: trunk/vice/src/plus4/plus4.c
===================================================================
--- trunk/vice/src/plus4/plus4.c 2024-08-07 17:39:33 UTC (rev 45279)
+++ trunk/vice/src/plus4/plus4.c 2024-08-07 19:14:32 UTC (rev 45280)
@@ -514,14 +514,15 @@
init_resource_fail("serial");
return -1;
}
+ if (userport_resources_init() < 0) {
+ init_resource_fail("userport devices");
+ return -1;
+ }
+ /* CAUTION: must come after userport and serial */
if (printer_resources_init() < 0) {
init_resource_fail("printer");
return -1;
}
- if (userport_resources_init() < 0) {
- init_resource_fail("userport devices");
- return -1;
- }
if (init_joyport_ports() < 0) {
init_resource_fail("joyport ports");
return -1;
@@ -663,6 +664,10 @@
init_cmdline_options_fail("acia");
return -1;
}
+ if (userport_cmdline_options_init() < 0) {
+ init_cmdline_options_fail("userport");
+ return -1;
+ }
if (rs232drv_cmdline_options_init() < 0) {
init_cmdline_options_fail("rs232drv");
return -1;
@@ -683,10 +688,6 @@
init_cmdline_options_fail("joystick");
return -1;
}
- if (userport_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport");
- return -1;
- }
if (sampler_cmdline_options_init() < 0) {
init_cmdline_options_fail("samplerdrv");
return -1;
Modified: trunk/vice/src/plus4/plus4acia.c
===================================================================
--- trunk/vice/src/plus4/plus4acia.c 2024-08-07 17:39:33 UTC (rev 45279)
+++ trunk/vice/src/plus4/plus4acia.c 2024-08-07 19:14:32 UTC (rev 45280)
@@ -30,6 +30,7 @@
#include "vice.h"
#include "plus4acia.h"
+#include "userport.h"
#define mycpu maincpu
#define myclk maincpu_clk
@@ -82,6 +83,23 @@
/* ------------------------------------------------------------------------- */
+static void wrap_acia_store(uint16_t addr, uint8_t value)
+{
+ if ((addr & 3) == 2) {
+ /* ACIA command register:
+ bits 2,3 control RTS
+ 0, 0 -> RTS high
+ any other -> RTS low
+ */
+ if ((value & 0x0c) == 0) {
+ store_userport_pa2(1); /* Userport pin D */
+ } else {
+ store_userport_pa2(0); /* Userport pin D */
+ }
+ }
+ acia_store(addr, value);
+}
+
static io_source_t acia_device = {
"ACIA", /* name of the device */
IO_DETACH_RESOURCE, /* use resource to detach the device when involved in a read-collision */
@@ -88,7 +106,7 @@
"Acia1Enable", /* resource to set to '0' */
0xfd00, 0xfd0f, 0x03, /* range for the device, regs:$fd00-$fd03, mirrors:$df04-$fd0f */
1, /* read is always valid */
- acia_store, /* store function */
+ wrap_acia_store, /* store function */
NULL, /* NO poke function */
acia_read, /* read function */
acia_peek, /* peek function */
Modified: trunk/vice/src/plus4/plus4printer.c
===================================================================
--- trunk/vice/src/plus4/plus4printer.c 2024-08-07 17:39:33 UTC (rev 45279)
+++ trunk/vice/src/plus4/plus4printer.c 2024-08-07 19:14:32 UTC (rev 45280)
@@ -29,8 +29,16 @@
#include "machine-printer.h"
#include "plus4.h"
#include "printer.h"
+#include "log.h"
+/* #define DEBUG_PRINTER */
+#ifdef DEBUG_PRINTER
+#define DBG(x) log_printf x
+#else
+#define DBG(x)
+#endif
+
void machine_printer_setup_context(struct machine_context_s *machine_ctx)
{
}
@@ -37,7 +45,8 @@
int machine_printer_resources_init(void)
{
- if (printer_serial_init_resources() < 0) {
+ DBG(("machine_printer_resources_init"));
+ if (printer_serial_init_resources() < 0 || printer_userport_init_resources() < 0) {
return -1;
}
return 0;
@@ -49,6 +58,7 @@
int machine_printer_cmdline_options_init(void)
{
+ DBG(("machine_printer_cmdline_options_init"));
if (printer_serial_init_cmdline_options() < 0) {
return -1;
}
Modified: trunk/vice/src/printerdrv/drv-ascii.c
===================================================================
--- trunk/vice/src/printerdrv/drv-ascii.c 2024-08-07 17:39:33 UTC (rev 45279)
+++ trunk/vice/src/printerdrv/drv-ascii.c 2024-08-07 19:14:32 UTC (rev 45280)
@@ -178,8 +178,8 @@
static int drv_ascii_putc(unsigned int prnr, unsigned int secondary, uint8_t b)
{
#ifdef DEBUG_PRINTER
- log_message(drv_ascii_log, "Print device #%u secondary %u data %02x.",
- prnr + 4, secondary, b);
+ log_message(drv_ascii_log, "drv_ascii_putc(prnr:%u secondary:%u data %02x) device:%u",
+ prnr, secondary, b, prnr + 4);
#endif
if (print_char(&drv_ascii[prnr], prnr, b) < 0) {
Modified: trunk/vice/src/printerdrv/drv-raw.c
===================================================================
--- trunk/vice/src/printerdrv/drv-raw.c 2024-08-07 17:39:33 UTC (rev 45279)
+++ trunk/vice/src/printerdrv/drv-raw.c 2024-08-07 19:14:32 UTC (rev 45280)
@@ -71,7 +71,7 @@
static int drv_raw_putc(unsigned int prnr, unsigned int secondary, uint8_t b)
{
- DBG(("Print device #%u secondary %u data %02x.", prnr + 4, secondary, b));
+ DBG(("drv_raw_putc(prnr:%u) secondary %u data %02x.", prnr + 4, secondary, b));
if (output_select_putc(prnr, b) < 0) {
return -1;
Modified: trunk/vice/src/printerdrv/interface-userport.c
===================================================================
--- trunk/vice/src/printerdrv/interface-userport.c 2024-08-07 17:39:33 UTC (rev 45279)
+++ trunk/vice/src/printerdrv/interface-userport.c 2024-08-07 19:14:32 UTC (rev 45280)
@@ -34,6 +34,7 @@
#include "driver-select.h"
#include "interface-userport.h"
#include "log.h"
+#include "machine.h"
#include "output-select.h"
#include "printer.h"
#include "resources.h"
@@ -54,15 +55,28 @@
C64/C128 | CBM2 | PET | VIC20 | CENTRONICS | NOTES
---------------------------------------------------
B | 6 | B | B | 11 | FLAG2 <- BUSY
- C | 14 | C | C | 2 | PB0 -> DATA0
- D | 13 | D | D | 3 | PB1 -> DATA1
- E | 12 | E | E | 4 | PB2 -> DATA2
- F | 11 | F | F | 5 | PB3 -> DATA3
- H | 10 | H | H | 6 | PB4 -> DATA4
- J | 9 | J | J | 7 | PB5 -> DATA5
- K | 8 | K | K | 8 | PB6 -> DATA6
- L | 7 | L | L | 9 | PB7 -> DATA7
- M | 2 | M | M | 1 | PA2 -> STROBE
+ C | 14 | C | C | 2 | PB0 -> DATA0
+ D | 13 | D | D | 3 | PB1 -> DATA1
+ E | 12 | E | E | 4 | PB2 -> DATA2
+ F | 11 | F | F | 5 | PB3 -> DATA3
+ H | 10 | H | H | 6 | PB4 -> DATA4
+ J | 9 | J | J | 7 | PB5 -> DATA5
+ K | 8 | K | K | 8 | PB6 -> DATA6
+ L | 7 | L | L | 9 | PB7 -> DATA7
+ M | 2 | M | M | 1 | PA2 -> STROBE
+
+ Plus4 | CENTRONICS | NOTES
+---------------------------------------------------
+ H | 11 | DCD (ACIA) <- Busy
+ B | 2 | PB0 -> D0
+ K | 3 | PB1 -> D1
+ 4 | 4 | PB2 -> D2
+ 5 | 5 | PB3 -> D3
+ 6 | 6 | PB4 -> D4
+ 7 | 7 | PB5 -> D5
+ J | 8 | PB6 -> D6
+ F | 9 | PB7 -> D7
+ D | 1 | RTS (ACIA) -> Strobe
*/
/* ------------------------------------------------------------------------- */
@@ -124,6 +138,7 @@
return 0;
}
+/* called via printer-userport.c:printer_userport_init_resources */
int interface_userport_init_resources(void)
{
DBG(("interface_userport_init_resources()"));
@@ -138,15 +153,21 @@
static void userport_printer_store_pbx(uint8_t b, int pulse)
{
value = b;
+ DBG(("userport_printer_store_pbx(0x%02x)", b));
}
static void userport_printer_store_pa2(uint8_t s)
{
+ DBG(("userport_printer_store_pa2(%d) output:%d value: 0x%02x", s, userport_printer_enabled && strobe && !s, value));
if (userport_printer_enabled && strobe && !s) { /* hi->lo on strobe */
driver_select_putc(USERPORT_OUTPUT, 4, (uint8_t)value);
- set_userport_flag(1); /* signal lo->hi */
- set_userport_flag(0); /* signal hi->lo */
+ if (machine_class == VICE_MACHINE_PLUS4) {
+ /* FIXME: not sure what to do here */
+ } else {
+ set_userport_flag(1); /* signal lo->hi */
+ set_userport_flag(0); /* signal hi->lo */
+ }
}
strobe = s;
}
Modified: trunk/vice/src/printerdrv/output-select.c
===================================================================
--- trunk/vice/src/printerdrv/output-select.c 2024-08-07 17:39:33 UTC (rev 45279)
+++ trunk/vice/src/printerdrv/output-select.c 2024-08-07 19:14:32 UTC (rev 45280)
@@ -255,6 +255,7 @@
int output_select_putc(unsigned int prnr, uint8_t b)
{
+ DBG(("output_select_putc(prnr:%u) value:0x%02x", prnr, b));
return output_select[prnr].output_putc(prnr, b);
}
Modified: trunk/vice/src/printerdrv/output-text.c
===================================================================
--- trunk/vice/src/printerdrv/output-text.c 2024-08-07 17:39:33 UTC (rev 45279)
+++ trunk/vice/src/printerdrv/output-text.c 2024-08-07 19:14:32 UTC (rev 45280)
@@ -135,8 +135,7 @@
int output_text_init_cmdline_options(void)
{
- if (machine_class != VICE_MACHINE_C64DTV
- && machine_class != VICE_MACHINE_PLUS4) {
+ if (machine_class != VICE_MACHINE_C64DTV) {
if (cmdline_register_options(cmdline_options_userport) < 0) {
return -1;
}
@@ -218,6 +217,8 @@
static int output_text_putc(unsigned int prnr, uint8_t b)
{
+ DBG(("output_text_putc(prnr:%u) byte:0x%02x fd:%s", prnr, b,
+ (output_fd[printer_device[prnr]] == NULL) ? "NULL" : "ok"));
if (output_fd[printer_device[prnr]] == NULL) {
return -1;
}
@@ -272,8 +273,7 @@
return -1;
}
- if (machine_class != VICE_MACHINE_C64DTV
- && machine_class != VICE_MACHINE_PLUS4) {
+ if (machine_class != VICE_MACHINE_C64DTV) {
if (resources_register_int(resources_int_userport) < 0) {
return -1;
}
Modified: trunk/vice/src/printerdrv/printer-userport.c
===================================================================
--- trunk/vice/src/printerdrv/printer-userport.c 2024-08-07 17:39:33 UTC (rev 45279)
+++ trunk/vice/src/printerdrv/printer-userport.c 2024-08-07 19:14:32 UTC (rev 45280)
@@ -1,5 +1,5 @@
/*
- * printer-uerport.c - Userport printer interface.
+ * printer-userport.c - Userport printer interface.
*
* Written by
* Andreas Boose <vic...@t-...>
@@ -29,9 +29,19 @@
#include "interface-userport.h"
#include "printer.h"
#include "types.h"
+#include "log.h"
+#define DEBUG_PRINTER
+#ifdef DEBUG_PRINTER
+#define DBG(x) log_printf x
+#else
+#define DBG(x)
+#endif
+
+/* called via machine_printer_resources_init() */
int printer_userport_init_resources(void)
{
+ DBG(("printer_userport_init_resources"));
return interface_userport_init_resources();
}
Modified: trunk/vice/src/printerdrv/printer.c
===================================================================
--- trunk/vice/src/printerdrv/printer.c 2024-08-07 17:39:33 UTC (rev 45279)
+++ trunk/vice/src/printerdrv/printer.c 2024-08-07 19:14:32 UTC (rev 45280)
@@ -72,8 +72,10 @@
DBG(("printer_userport_resources_init"));
if (output_select_userport_init_resources() < 0
|| driver_select_userport_init_resources() < 0) {
+ DBG(("printer_userport_resources_init (failed)"));
return -1;
}
+ DBG(("printer_userport_resources_init (ok)"));
return 0;
}
Modified: trunk/vice/src/scpu64/scpu64.c
===================================================================
--- trunk/vice/src/scpu64/scpu64.c 2024-08-07 17:39:33 UTC (rev 45279)
+++ trunk/vice/src/scpu64/scpu64.c 2024-08-07 19:14:32 UTC (rev 45280)
@@ -542,6 +542,7 @@
init_resource_fail("serial");
return -1;
}
+ /* CAUTION: must come after userport and serial */
if (printer_resources_init() < 0) {
init_resource_fail("printer");
return -1;
Modified: trunk/vice/src/userport/userport.c
===================================================================
--- trunk/vice/src/userport/userport.c 2024-08-07 17:39:33 UTC (rev 45279)
+++ trunk/vice/src/userport/userport.c 2024-08-07 19:14:32 UTC (rev 45280)
@@ -112,6 +112,8 @@
PB0
*/
+#define DEBUG_UP
+
#include "vice.h"
#include <stdio.h>
@@ -156,6 +158,11 @@
#include "util.h"
#include "init.h"
+#ifdef DEBUG_UP
+#define DBG(x) log_printf x
+#else
+#define DBG(x)
+#endif
typedef struct type2text_s {
int type;
@@ -609,13 +616,13 @@
#define UP_CBM2 (VICE_MACHINE_CBM5x0 | VICE_MACHINE_CBM6x0)
static userport_init_t userport_devices_init[] = {
-/* FIXME: Add userport printer support to xplus4 */
{ USERPORT_DEVICE_PRINTER, /* device id */
- UP_C64 | UP_VIC20 | UP_PET | UP_CBM2, /* emulators this device works on */
- printer_userport_resources_init, /* resources init function */
- NULL, /* resources shutdown function */
- printer_userport_cmdline_options_init /* cmdline options init function */
+ UP_C64 | UP_VIC20 | UP_PET | UP_CBM2 | UP_PLUS4, /* emulators this device works on */
+ printer_userport_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ printer_userport_cmdline_options_init /* cmdline options init function */
},
+ /* NOTE: technically ACIA is also userport with a Plus4 */
{ USERPORT_DEVICE_RS232_MODEM, /* device id */
UP_C64 | UP_VIC20, /* emulators this device works on */
rsuser_resources_init, /* resources init function */
@@ -782,8 +789,10 @@
if (userport_devices_init[i].emu_mask & machine_class) {
if (userport_devices_init[i].userport_device_resources_init) {
if (userport_devices_init[i].userport_device_resources_init() < 0) {
+ DBG(("userport_devices_resources_init failed for id %d", userport_devices_init[i].device_id));
return -1;
}
+ DBG(("userport_devices_resources_init registered id %d", userport_devices_init[i].device_id));
}
}
i++;
Modified: trunk/vice/src/vic20/vic20.c
===================================================================
--- trunk/vice/src/vic20/vic20.c 2024-08-07 17:39:33 UTC (rev 45279)
+++ trunk/vice/src/vic20/vic20.c 2024-08-07 19:14:32 UTC (rev 45280)
@@ -618,6 +618,7 @@
init_resource_fail("serial");
return -1;
}
+ /* CAUTION: must come after userport and serial */
if (printer_resources_init() < 0) {
init_resource_fail("printer");
return -1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rh...@us...> - 2024-08-07 17:39:37
|
Revision: 45279
http://sourceforge.net/p/vice-emu/code/45279
Author: rhialto
Date: 2024-08-07 17:39:33 +0000 (Wed, 07 Aug 2024)
Log Message:
-----------
petreu: adjust comments. VIAs have only 16 registers.
Modified Paths:
--------------
trunk/vice/src/pet/petreu.c
Modified: trunk/vice/src/pet/petreu.c
===================================================================
--- trunk/vice/src/pet/petreu.c 2024-08-06 22:50:57 UTC (rev 45278)
+++ trunk/vice/src/pet/petreu.c 2024-08-07 17:39:33 UTC (rev 45279)
@@ -123,7 +123,7 @@
"PETREU REG 1", /* name of the device */
IO_DETACH_RESOURCE, /* use resource to detach the device when involved in a read-collision */
"PETREU", /* resource to set to '0' */
- 0x8800, 0x88ff, 0x0f, /* range for the device, regs:$8800-$881f, mirrors:$8820-$88ff */
+ 0x8800, 0x88ff, 0x0f, /* range for the device, regs:$8800-$880f, mirrors:$8810-$88ff */
1, /* read is always valid */
store_petreu_reg, /* store function */
store_petreu_reg, /* poke function */
@@ -140,7 +140,7 @@
"PETREU REG 2", /* name of the device */
IO_DETACH_RESOURCE, /* use resource to detach the device when involved in a read-collision */
"PETREU", /* resource to set to '0' */
- 0x8a00, 0x8aff, 0x0f, /* range for the device, regs:$8a00-$8a1f, mirrors:$8a20-$8aff */
+ 0x8a00, 0x8aff, 0x0f, /* range for the device, regs:$8a00-$8a0f, mirrors:$8a10-$8aff */
1, /* read is always valid */
store_petreu2_reg, /* store function */
store_petreu2_reg, /* poke function */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-08-06 22:50:58
|
Revision: 45278
http://sourceforge.net/p/vice-emu/code/45278
Author: gpz
Date: 2024-08-06 22:50:57 +0000 (Tue, 06 Aug 2024)
Log Message:
-----------
just kill the old logic that tries to determine a valid userport device
Modified Paths:
--------------
trunk/vice/src/userport/userport.c
Modified: trunk/vice/src/userport/userport.c
===================================================================
--- trunk/vice/src/userport/userport.c 2024-08-06 22:35:02 UTC (rev 45277)
+++ trunk/vice/src/userport/userport.c 2024-08-06 22:50:57 UTC (rev 45278)
@@ -207,32 +207,6 @@
/* ---------------------------------------------------------------------------------------------------------- */
-/* FIXME: the device_init table has the info on what works on what emu, we can
- remove all other checks */
-static int valid_device(userport_device_t *device)
-{
-#if 0
- if ((device->read_pa2 || device->store_pa2) && !userport_props.has_pa2) {
- return 0;
- }
-
- if ((device->read_pa3 || device->store_pa3) && !userport_props.has_pa3) {
- return 0;
- }
-
- if (device->needs_pc && !userport_props.has_pc) {
- return 0;
- }
-
- if ((device->store_sp1 || device->read_sp1 || device->store_sp2 || device->read_sp2) && !userport_props.has_sp12) {
- return 0;
- }
-#endif
- return 1;
-}
-
-/* ---------------------------------------------------------------------------------------------------------- */
-
void userport_port_register(userport_port_props_t *props)
{
userport_props.has_pa2 = props->has_pa2;
@@ -250,29 +224,26 @@
return -1;
}
- if (valid_device(device)) {
- userport_device[id].name = device->name;
- userport_device[id].joystick_adapter_id = device->joystick_adapter_id;
- userport_device[id].device_type = device->device_type;
- userport_device[id].enable = device->enable;
- userport_device[id].read_pbx = device->read_pbx;
- userport_device[id].store_pbx = device->store_pbx;
- userport_device[id].read_pa2 = device->read_pa2;
- userport_device[id].store_pa2 = device->store_pa2;
- userport_device[id].read_pa3 = device->read_pa3;
- userport_device[id].store_pa3 = device->store_pa3;
- userport_device[id].needs_pc = device->needs_pc;
- userport_device[id].store_sp1 = device->store_sp1;
- userport_device[id].read_sp1 = device->read_sp1;
- userport_device[id].store_sp2 = device->store_sp2;
- userport_device[id].read_sp2 = device->read_sp2;
- userport_device[id].reset = device->reset;
- userport_device[id].powerup = device->powerup;
- userport_device[id].write_snapshot = device->write_snapshot;
- userport_device[id].read_snapshot = device->read_snapshot;
- return 0;
- }
- return -1;
+ userport_device[id].name = device->name;
+ userport_device[id].joystick_adapter_id = device->joystick_adapter_id;
+ userport_device[id].device_type = device->device_type;
+ userport_device[id].enable = device->enable;
+ userport_device[id].read_pbx = device->read_pbx;
+ userport_device[id].store_pbx = device->store_pbx;
+ userport_device[id].read_pa2 = device->read_pa2;
+ userport_device[id].store_pa2 = device->store_pa2;
+ userport_device[id].read_pa3 = device->read_pa3;
+ userport_device[id].store_pa3 = device->store_pa3;
+ userport_device[id].needs_pc = device->needs_pc;
+ userport_device[id].store_sp1 = device->store_sp1;
+ userport_device[id].read_sp1 = device->read_sp1;
+ userport_device[id].store_sp2 = device->store_sp2;
+ userport_device[id].read_sp2 = device->read_sp2;
+ userport_device[id].reset = device->reset;
+ userport_device[id].powerup = device->powerup;
+ userport_device[id].write_snapshot = device->write_snapshot;
+ userport_device[id].read_snapshot = device->read_snapshot;
+ return 0;
}
/* ---------------------------------------------------------------------------------------------------------- */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-08-06 22:35:06
|
Revision: 45277
http://sourceforge.net/p/vice-emu/code/45277
Author: gpz
Date: 2024-08-06 22:35:02 +0000 (Tue, 06 Aug 2024)
Log Message:
-----------
make the pet userport diag pin an actual user port device
Modified Paths:
--------------
trunk/vice/doc/vice.texi
trunk/vice/src/arch/gtk3/uistatusbar.c
trunk/vice/src/arch/gtk3/uistatusbar.h
trunk/vice/src/arch/gtk3/widgets/settings_userport.c
trunk/vice/src/arch/gtk3/widgets/statusbarspeedwidget.c
trunk/vice/src/c64/vsid-stubs.c
trunk/vice/src/pet/petpia1.c
trunk/vice/src/userport/Makefile.am
trunk/vice/src/userport/userport.c
trunk/vice/src/userport/userport.h
Added Paths:
-----------
trunk/vice/src/userport/userport_diag_pin.c
trunk/vice/src/userport/userport_diag_pin.h
Modified: trunk/vice/doc/vice.texi
===================================================================
--- trunk/vice/doc/vice.texi 2024-08-06 20:38:45 UTC (rev 45276)
+++ trunk/vice/doc/vice.texi 2024-08-06 22:35:02 UTC (rev 45277)
@@ -8683,6 +8683,9 @@
@item 25
@tab Userport Stupid Pet Tricks joystick adapter
@tab x64, x64sc, x128, xscpu64, xcbm2, xpet, xvic
+@item 26
+@tab PET Userport diagnostic pin
+@tab xpet
@end multitable
@table @code
Modified: trunk/vice/src/arch/gtk3/uistatusbar.c
===================================================================
--- trunk/vice/src/arch/gtk3/uistatusbar.c 2024-08-06 20:38:45 UTC (rev 45276)
+++ trunk/vice/src/arch/gtk3/uistatusbar.c 2024-08-06 22:35:02 UTC (rev 45277)
@@ -2191,6 +2191,16 @@
}
}
+void diagnosticpin_led_set_visible(int bar, gboolean active)
+{
+ GtkWidget *led = allocated_bars[bar].diagnosticpin_led;
+
+ if (led != NULL) {
+ gtk_widget_set_visible(led, active);
+ gtk_widget_set_sensitive(led, active);
+ }
+}
+
/** \brief Callback for the SuperCPU turbo LED
*
* Set resource "SpeedSwitch" to \a active.
Modified: trunk/vice/src/arch/gtk3/uistatusbar.h
===================================================================
--- trunk/vice/src/arch/gtk3/uistatusbar.h 2024-08-06 20:38:45 UTC (rev 45276)
+++ trunk/vice/src/arch/gtk3/uistatusbar.h 2024-08-06 22:35:02 UTC (rev 45277)
@@ -67,6 +67,7 @@
void mode4080_led_set_active (int bar, gboolean active);
void capslock_led_set_active (int bar, gboolean active);
void diagnosticpin_led_set_active (int bar, gboolean active);
+void diagnosticpin_led_set_visible(int bar, gboolean active);
void supercpu_turbo_led_set_active(int bar, gboolean active);
void supercpu_jiffy_led_set_active(int bar, gboolean active);
Modified: trunk/vice/src/arch/gtk3/widgets/settings_userport.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_userport.c 2024-08-06 20:38:45 UTC (rev 45276)
+++ trunk/vice/src/arch/gtk3/widgets/settings_userport.c 2024-08-06 22:35:02 UTC (rev 45277)
@@ -84,6 +84,9 @@
/** \brief ds1307 save enable toggle button */
static GtkWidget *rtc_ds1307_save = NULL;
+/** \brief diag pin enable toggle button */
+static GtkWidget *diag_pin_active = NULL;
+
#ifdef HAVE_LIBCURL
/** \brief WiC64 save enable settigns */
static GtkWidget *wic64_save = NULL;
@@ -129,6 +132,16 @@
"Enable RTC (DS1307) saving");
}
+/** \brief Create widget for the "DiagPin" resource
+ *
+ * \return GtkCheckButton
+ */
+static GtkWidget *create_diag_pin_active_widget(void)
+{
+ return vice_gtk3_resource_check_button_new("DiagPin",
+ "Enable diagnostic pin");
+}
+
/** \brief Set the RTC checkboxes' or WiC64 settings sensitivity based on device ID
*
* Use userport device \a id to determine which widget to 'grey-out'.
@@ -143,6 +156,9 @@
if (rtc_ds1307_save != NULL) {
gtk_widget_set_sensitive(rtc_ds1307_save, id == USERPORT_DEVICE_RTC_DS1307);
}
+ if (diag_pin_active != NULL) {
+ gtk_widget_set_sensitive(diag_pin_active, id == USERPORT_DEVICE_DIAGNOSTIC_PIN);
+ }
#ifdef HAVE_LIBCURL
if (wic64_save != NULL) {
gtk_widget_set_sensitive(wic64_save, id == USERPORT_DEVICE_WIC64);
@@ -613,9 +629,8 @@
/* PET userport diagnostic pin */
if (machine_class == VICE_MACHINE_PET) {
- gtk_grid_attach(GTK_GRID(grid),
- pet_diagnosticpin_widget_create(),
- 0, row, 2, 1);
+ diag_pin_active = create_diag_pin_active_widget();
+ gtk_grid_attach(GTK_GRID(grid), diag_pin_active, 0, row, 2, 1);
row++;
}
#ifdef HAVE_LIBCURL
Modified: trunk/vice/src/arch/gtk3/widgets/statusbarspeedwidget.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/statusbarspeedwidget.c 2024-08-06 20:38:45 UTC (rev 45276)
+++ trunk/vice/src/arch/gtk3/widgets/statusbarspeedwidget.c 2024-08-06 22:35:02 UTC (rev 45277)
@@ -51,6 +51,7 @@
#include "uiactions.h"
#include "uimenu.h"
#include "uistatusbar.h"
+#include "userport.h"
#include "vsync.h"
#include "vsyncapi.h"
@@ -549,6 +550,7 @@
bool is_mode4080 = false;
bool is_capslock = false;
bool is_diagnostic_pin = false;
+ int updev = userport_get_device();
if (machine_class == VICE_MACHINE_C128) {
is_mode4080 = keyboard_custom_key_get(KBD_CUSTOM_4080);
@@ -555,7 +557,7 @@
is_capslock = keyboard_custom_key_get(KBD_CUSTOM_CAPS);
}
- if (machine_class == VICE_MACHINE_PET) {
+ if ((machine_class == VICE_MACHINE_PET) && (updev == USERPORT_DEVICE_DIAGNOSTIC_PIN)) {
is_diagnostic_pin = pia1_get_diagnostic_pin();
}
@@ -627,8 +629,13 @@
capslock_led_set_active(window_identity, is_capslock);
state->last_capslock = is_capslock;
/* userport diagnostic pin */
- diagnosticpin_led_set_active(window_identity, is_diagnostic_pin);
- state->last_diagnostic_pin = is_diagnostic_pin;
+ if (updev == USERPORT_DEVICE_DIAGNOSTIC_PIN) {
+ diagnosticpin_led_set_visible(window_identity, 1);
+ diagnosticpin_led_set_active(window_identity, is_diagnostic_pin);
+ state->last_diagnostic_pin = is_diagnostic_pin;
+ } else {
+ diagnosticpin_led_set_visible(window_identity, 0);
+ }
#endif
if (window_identity == PRIMARY_WINDOW) {
Modified: trunk/vice/src/c64/vsid-stubs.c
===================================================================
--- trunk/vice/src/c64/vsid-stubs.c 2024-08-06 20:38:45 UTC (rev 45276)
+++ trunk/vice/src/c64/vsid-stubs.c 2024-08-06 22:35:02 UTC (rev 45277)
@@ -1281,3 +1281,8 @@
/*******************************************************************************
UI
*******************************************************************************/
+
+int userport_get_device(void)
+{
+ return 0;
+}
Modified: trunk/vice/src/pet/petpia1.c
===================================================================
--- trunk/vice/src/pet/petpia1.c 2024-08-06 20:38:45 UTC (rev 45276)
+++ trunk/vice/src/pet/petpia1.c 2024-08-06 22:35:02 UTC (rev 45277)
@@ -45,6 +45,7 @@
#include "resources.h"
#include "tapeport.h"
#include "types.h"
+#include "userport.h"
/* ------------------------------------------------------------------------- */
/* Renaming exported functions */
@@ -84,20 +85,10 @@
/* ------------------------------------------------------------------------- */
/* PIA resources. */
-/* Flag: is the diagnostic pin enabled? */
+/* Flag: is the diagnostic pin enabled? (read only!) */
static int diagnostic_pin_enabled;
-static int set_diagnostic_pin_enabled(int val, void *param)
-{
- diagnostic_pin_enabled = val ? 1 : 0;
-
- return 0;
-}
-
-
static const resource_int_t resources_int[] = {
- { "DiagPin", 0, RES_EVENT_SAME, NULL,
- &diagnostic_pin_enabled, set_diagnostic_pin_enabled, NULL },
RESOURCE_INT_LIST_END
};
@@ -109,12 +100,6 @@
static const cmdline_option_t cmdline_options[] =
{
- { "-diagpin", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
- NULL, NULL, "DiagPin", (resource_value_t)1,
- NULL, "Enable userport diagnostic pin" },
- { "+diagpin", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
- NULL, NULL, "DiagPin", (resource_value_t)1,
- NULL, "Disable userport diagnostic pin" },
CMDLINE_LIST_END
};
@@ -173,7 +158,7 @@
* interface and thus obtaining and releasing the main lock is too expensive.
* This function avoids that performance hit.
*
- * \return state of DiagPin resource
+ * \return state of DiagPin resource (only for display)
*/
bool pia1_get_diagnostic_pin(void)
{
@@ -259,6 +244,9 @@
drive_cpu_execute_all(maincpu_clk);
+ diagnostic_pin_enabled = read_userport_sp1(0); /* pin 5 */
+ /*printf("diag:%d\n", diagnostic_pin_enabled);*/
+
byte = 0xff
- (tape1_sense ? 16 : 0)
- (tape2_sense ? 32 : 0)
Modified: trunk/vice/src/userport/Makefile.am
===================================================================
--- trunk/vice/src/userport/Makefile.am 2024-08-06 20:38:45 UTC (rev 45276)
+++ trunk/vice/src/userport/Makefile.am 2024-08-06 22:35:02 UTC (rev 45277)
@@ -35,6 +35,8 @@
userport_dac.h \
userport_diag_586220_harness.c \
userport_diag_586220_harness.h \
+ userport_diag_pin.c \
+ userport_diag_pin.h \
userport_digimax.c \
userport_digimax.h \
userport_hks_joystick.c \
Modified: trunk/vice/src/userport/userport.c
===================================================================
--- trunk/vice/src/userport/userport.c 2024-08-06 20:38:45 UTC (rev 45276)
+++ trunk/vice/src/userport/userport.c 2024-08-06 22:35:02 UTC (rev 45277)
@@ -32,32 +32,32 @@
A B C D E F H J K L M N
- C64/C128 C64DTV VIC20 Plus4 PET CBM2 (internal)
+ C64/C128 C64DTV VIC20 Plus4 PET CBM2 (internal)
1 GND GND GND GND
2 +5V DC +5V DC +5V DC TV Video
- 3 !RESET !RESET !RESET IEEE-SRQ
- 4 CNT1 (CIA1) JOY0 P2 IEEE-EOI
- 5 SP1 JOY1 P3 Diagnostic Sense
- 6 CNT2 (CIA2) JOY2 P4 Tape#2 Read
- 7 SP2 Lightpen Fire P5 Cass Write
- 8 PC2 PA6, Tape Sense RS232 clock Tape#1 Read 5 (?)
- 9 Serial ATN in Serial ATN in ATN (Cpu Port) TV Vertical 4 (?)
+ 3 !RESET !RESET !RESET CB1 (PIA2) IEEE-SRQ IN
+ 4 CNT1 (CIA1) JOY0 P2 PA6 (PIA1) IEEE-EOI
+ 5 SP1 JOY1 P3 PA7 (PIA1) Diag Pin
+ 6 CNT2 (CIA2) JOY2 P4 CB1 (VIA) Tape#2 Read
+ 7 SP2 Lightpen Fire P5 PB3 (VIA) Tape Write
+ 8 PC2 PA6, Tape Sense RS232 clock CA1 (PIA1) Tape#1 Read 5 (?)
+ 9 Serial ATN in Serial ATN in ATN (Cpu Port) PB5 (VIA); CB1 (PIA1) TV Vertical 4 (?)
10 9V AC 9V AC 9V AC TV Horizontal
- 11 9V AC 9V AC 9V AC Graphic
+ 11 9V AC 9V AC 9V AC CA2 (VIA) Graphic
12 GND GND GND GND
A GND GND GND GND
- B !FLAG2 CB1 P0 CA1
- C PB0 (CIA2) PB0 PB0 RXD (ACIA) PA0 14 (?)
- D PB1 PB1 PB1 RTS (ACIA) PA1 13 (?)
- E PB2 PB2 PB2 DTR (ACIA) PA2 12 (?)
- F PB3 PB3 PB3 P7 PA3 11 (?)
- H PB4 PB4 PB4 DCD (ACIA) PA4 10 (?)
- J PB5 PB5 PB5 P6 PA5 9 (?)
- K PB6 PB6 PB6 P1 PA6 8 (?)
- L PB7 PB7 PB7 DSR (ACIA) PA7 7 (?)
- M PA2 (CIA2) PA2 CB2 TXD (ACIA) CB2 2 (?)
+ B !FLAG2 CB1 P0 CA1 (VIA)
+ C PB0 (CIA2) PB0 PB0 RXD (ACIA) PA0 (VIA) 14 (?)
+ D PB1 PB1 PB1 RTS (ACIA) PA1 (VIA) 13 (?)
+ E PB2 PB2 PB2 DTR (ACIA) PA2 (VIA) 12 (?)
+ F PB3 PB3 PB3 P7 PA3 (VIA) 11 (?)
+ H PB4 PB4 PB4 DCD (ACIA) PA4 (VIA) 10 (?)
+ J PB5 PB5 PB5 P6 PA5 (VIA) 9 (?)
+ K PB6 PB6 PB6 P1 PA6 (VIA) 8 (?)
+ L PB7 PB7 PB7 DSR (ACIA) PA7 (VIA) 7 (?)
+ M PA2 (CIA2) PA2 CB2 TXD (ACIA) CB2 (VIA) 2 (?)
N GND GND GND GND
CBM2 (internal)
@@ -138,6 +138,7 @@
#include "userport_8bss.h"
#include "userport_dac.h"
#include "userport_diag_586220_harness.h"
+#include "userport_diag_pin.h"
#include "userport_digimax.h"
#include "userport_hummer_joystick.h"
#include "userport_io_sim.h"
@@ -206,8 +207,11 @@
/* ---------------------------------------------------------------------------------------------------------- */
+/* FIXME: the device_init table has the info on what works on what emu, we can
+ remove all other checks */
static int valid_device(userport_device_t *device)
{
+#if 0
if ((device->read_pa2 || device->store_pa2) && !userport_props.has_pa2) {
return 0;
}
@@ -223,7 +227,7 @@
if ((device->store_sp1 || device->read_sp1 || device->store_sp2 || device->read_sp2) && !userport_props.has_sp12) {
return 0;
}
-
+#endif
return 1;
}
@@ -789,6 +793,12 @@
NULL, /* resources shutdown function */
NULL /* cmdline options init function */
},
+ { USERPORT_DEVICE_DIAGNOSTIC_PIN, /* device id */
+ UP_PET, /* emulators this device works on */
+ userport_diag_pin_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ userport_diag_pin_cmdline_options_init /* cmdline options init function */
+ },
{ USERPORT_DEVICE_NONE, VICE_MACHINE_NONE, NULL, NULL, NULL }, /* end of the devices list */
};
Modified: trunk/vice/src/userport/userport.h
===================================================================
--- trunk/vice/src/userport/userport.h 2024-08-06 20:38:45 UTC (rev 45276)
+++ trunk/vice/src/userport/userport.h 2024-08-06 22:35:02 UTC (rev 45277)
@@ -69,6 +69,7 @@
USERPORT_DEVICE_WIC64,
USERPORT_DEVICE_SPACEBALLS, /* CAUTION: also connects to the controller port(s) */
USERPORT_DEVICE_SPT_JOYSTICK,
+ USERPORT_DEVICE_DIAGNOSTIC_PIN,
/* This item always needs to be at the end */
USERPORT_MAX_DEVICES
@@ -89,7 +90,8 @@
#ifdef HAVE_LIBCURL
USERPORT_DEVICE_TYPE_WIFI,
#endif
- USERPORT_DEVICE_TYPE_IO_SIMULATION
+ USERPORT_DEVICE_TYPE_IO_SIMULATION,
+ USERPORT_DEVICE_TYPE_DIAGNOSTIC
};
/* 24 pin userport pin defines */
Added: trunk/vice/src/userport/userport_diag_pin.c
===================================================================
--- trunk/vice/src/userport/userport_diag_pin.c (rev 0)
+++ trunk/vice/src/userport/userport_diag_pin.c 2024-08-06 22:35:02 UTC (rev 45277)
@@ -0,0 +1,169 @@
+/*
+ * userport_diag_pin.c: Userport PET diag pin
+ *
+ * Written by
+ * groepaz <gr...@gm...>
+ *
+ * This file is part of VICE, the Versatile Commodore Emulator.
+ * See README for copyright notice.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307 USA.
+ *
+ */
+
+#include "vice.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "cmdline.h"
+#include "resources.h"
+#include "joyport.h"
+#include "userport.h"
+#include "userport_diag_pin.h"
+
+static int userport_diag_pin_read_snapshot_module(snapshot_t *s);
+static int userport_diag_pin_write_snapshot_module(snapshot_t *s);
+
+static int diagnostic_pin_enabled = 0;
+
+static uint8_t userport_diag_pin_read_sp1(uint8_t orig)
+{
+ /*printf("userport_diag_pin_read_sp1: %d\n", diagnostic_pin_enabled);*/
+ return diagnostic_pin_enabled;
+}
+
+static userport_device_t diag_pin_device = {
+ "PET diagnostic pin", /* device name */
+ JOYSTICK_ADAPTER_ID_NONE, /* NOT a joystick adapter */
+ USERPORT_DEVICE_TYPE_DIAGNOSTIC, /* device is a diagnostic device */
+ NULL, /* NO enable function */
+ NULL, /* NO read pb0-pb7 function */
+ NULL, /* NO store pb0-pb7 function */
+ NULL, /* NO read pa2 pin function */
+ NULL, /* NO store pa2 pin function */
+ NULL, /* NO read pa3 pin function */
+ NULL, /* NO store pa3 pin function */
+ 0, /* pc pin is NOT needed */
+ NULL, /* NO store sp1 pin function */
+ userport_diag_pin_read_sp1, /* read sp1 pin function */
+ NULL, /* NO store sp2 pin function */
+ NULL, /* NO read sp2 pin function */
+ NULL, /* NO reset function */
+ NULL, /* NO powerup function */
+ userport_diag_pin_write_snapshot_module, /* snapshot write function */
+ userport_diag_pin_read_snapshot_module /* snapshot read function */
+};
+
+static int set_diagnostic_pin_enabled(int val, void *param)
+{
+ diagnostic_pin_enabled = val ? 1 : 0;
+
+ return 0;
+}
+
+static const resource_int_t resources_int[] = {
+ { "DiagPin", 0, RES_EVENT_SAME, NULL,
+ &diagnostic_pin_enabled, set_diagnostic_pin_enabled, NULL },
+ RESOURCE_INT_LIST_END
+};
+
+int userport_diag_pin_resources_init(void)
+{
+ if (resources_register_int(resources_int) < 0) {
+ return -1;
+ }
+ return userport_device_register(USERPORT_DEVICE_DIAGNOSTIC_PIN, &diag_pin_device);
+}
+
+static const cmdline_option_t cmdline_options[] =
+{
+ { "-diagpin", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
+ NULL, NULL, "DiagPin", (resource_value_t)1,
+ NULL, "Enable userport diagnostic pin" },
+ { "+diagpin", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
+ NULL, NULL, "DiagPin", (resource_value_t)1,
+ NULL, "Disable userport diagnostic pin" },
+ CMDLINE_LIST_END
+};
+
+int userport_diag_pin_cmdline_options_init(void)
+{
+ return cmdline_register_options(cmdline_options);
+}
+
+/* ---------------------------------------------------------------------*/
+
+/* USERPORT_DIGIMAX snapshot module format:
+
+ type | name | description
+ -----------------------------
+ BYTE | address | current state of the diag pin
+ */
+
+static const char snap_module_name[] = "UPDIAGPIN";
+#define SNAP_MAJOR 0
+#define SNAP_MINOR 1
+
+static int userport_diag_pin_write_snapshot_module(snapshot_t *s)
+{
+ snapshot_module_t *m;
+
+ m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR);
+
+ if (m == NULL) {
+ return -1;
+ }
+
+ if (0
+ || (SMW_B(m, (uint8_t)diagnostic_pin_enabled) < 0)
+ ) {
+ snapshot_module_close(m);
+ return -1;
+ }
+ return snapshot_module_close(m);
+}
+
+static int userport_diag_pin_read_snapshot_module(snapshot_t *s)
+{
+ uint8_t major_version, minor_version;
+ snapshot_module_t *m;
+
+ m = snapshot_module_open(s, snap_module_name, &major_version, &minor_version);
+
+ if (m == NULL) {
+ return -1;
+ }
+
+ /* Do not accept versions higher than current */
+ if (snapshot_version_is_bigger(major_version, minor_version, SNAP_MAJOR, SNAP_MINOR)) {
+ snapshot_set_error(SNAPSHOT_MODULE_HIGHER_VERSION);
+ goto fail;
+ }
+
+ if (0
+ || (SMR_B_INT(m, &diagnostic_pin_enabled) < 0)
+ ) {
+ goto fail;
+ }
+ return snapshot_module_close(m);
+
+fail:
+ snapshot_module_close(m);
+ return -1;
+}
+
Added: trunk/vice/src/userport/userport_diag_pin.h
===================================================================
--- trunk/vice/src/userport/userport_diag_pin.h (rev 0)
+++ trunk/vice/src/userport/userport_diag_pin.h 2024-08-06 22:35:02 UTC (rev 45277)
@@ -0,0 +1,37 @@
+
+/*
+ * userport_diag_pin.h: Userport PET diag pin
+ *
+ * Written by
+ * groepaz <gr...@gm...>
+ *
+ * This file is part of VICE, the Versatile Commodore Emulator.
+ * See README for copyright notice.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307 USA.
+ *
+ */
+
+#ifndef VICE_USERPORT_DIAG_PIN_H
+#define VICE_USERPORT_DIAG_PIN_H
+
+#include "types.h"
+
+int userport_diag_pin_resources_init(void);
+int userport_diag_pin_cmdline_options_init(void);
+
+#endif
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rh...@us...> - 2024-08-06 20:38:49
|
Revision: 45276
http://sourceforge.net/p/vice-emu/code/45276
Author: rhialto
Date: 2024-08-06 20:38:45 +0000 (Tue, 06 Aug 2024)
Log Message:
-----------
petmem: add the range 8800-8fff to mem_bank_peek().
This is for the monitor's IO command.
Modified Paths:
--------------
trunk/vice/src/pet/petmem.c
Modified: trunk/vice/src/pet/petmem.c
===================================================================
--- trunk/vice/src/pet/petmem.c 2024-08-06 20:15:48 UTC (rev 45275)
+++ trunk/vice/src/pet/petmem.c 2024-08-06 20:38:45 UTC (rev 45276)
@@ -324,6 +324,30 @@
return last_access;
}
+static uint8_t peek_io_88_8f(uint16_t addr)
+{
+ switch (addr & 0xff00) {
+ case 0x8800:
+ return petio_8800_peek(addr);
+ case 0x8900:
+ return petio_8900_peek(addr);
+ case 0x8a00:
+ return petio_8a00_peek(addr);
+ case 0x8b00:
+ return petio_8b00_peek(addr);
+ case 0x8c00:
+ return petio_8c00_peek(addr);
+ case 0x8d00:
+ return petio_8d00_peek(addr);
+ case 0x8e00:
+ return petio_8e00_peek(addr);
+ case 0x8f00:
+ return petio_8f00_peek(addr);
+ }
+
+ return last_access;
+}
+
static uint8_t read_io_e9_ef(uint16_t addr)
{
switch (addr & 0xff00) {
@@ -1962,6 +1986,9 @@
/* is_peek_access = 0; FIXME */
return result;
}
+ if (addr >= 0x8800 && addr < 0x9000) {
+ return peek_io_88_8f(addr);
+ }
/* FALLS THROUGH TO normal read with side effects */
}
/* For extram, rom, cpu/cpu6809 when not accessing I/O, and ram: */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rh...@us...> - 2024-08-06 20:15:51
|
Revision: 45275
http://sourceforge.net/p/vice-emu/code/45275
Author: rhialto
Date: 2024-08-06 20:15:48 +0000 (Tue, 06 Aug 2024)
Log Message:
-----------
petreu.c: fix bug #2061
The masking of the memory bank number allowed too many bank address bits,
overflowing the allocated memory.
Further improvements:
Added some comments and link to hardware description.
Completely hide the second VIA for the 128 KiB model.
Adjusted register sizes and masking so that the monitor IO command shows
a reasonable number of bytes.
TODO: The monitor's IO command prints nonsense values.
Modified Paths:
--------------
trunk/vice/src/pet/petreu.c
Modified: trunk/vice/src/pet/petreu.c
===================================================================
--- trunk/vice/src/pet/petreu.c 2024-08-06 18:33:38 UTC (rev 45274)
+++ trunk/vice/src/pet/petreu.c 2024-08-06 20:15:48 UTC (rev 45275)
@@ -45,19 +45,42 @@
#include "util.h"
/*
+ * "PET REU (RAM AND EXPANSION UNIT)"
+ *
+ * This expansion seems to be documented at
+ * http://www.cbmhardware.de/show.php?r=14&id=73/PET%20REU%20(RAM%20AND%20EXPANSION%20UNIT)
+ * and http://www.cbmhardware.de/show.php?r=14&id=72
+ *
+ * There are 2 models:
+ *
+ * Model 1: 128 KiB RAM, 1 VIA ($8800).
+ * Port A and B supply 15 of the address bits.
+ * CA2 and CB2 supply the other 2.
+ *
+ * Model 2: 256+ KiB RAM, 2 VIAs ($8800 and $8A00).
+ * VIA 1 Port A and B supply 16 of the address bits.
+ * VIA 2 Port A supplies the remaining address bits.
+ * Maximum size would be 16 MB but we allow 2 MB max.
+ *
+ * In both cases, the selected byte can be read at $8900.
+ *
+ * The VIAs are emulated in a super-minimalist way.
+ */
+
+/*
Offsets of the different PET REU registers
*/
-#define PETREU_REGISTER_B 0x00
-#define PETREU_REGISTER_A 0x01
-#define PETREU_DIRECTION_B 0x02
-#define PETREU_DIRECTION_A 0x03
-#define PETREU_CONTROL 0x0c
+#define PETREU_REGISTER_B 0x00 /* VIA_PRB */
+#define PETREU_REGISTER_A 0x01 /* VIA_PRA */
+#define PETREU_DIRECTION_B 0x02 /* VIA_DDRB */
+#define PETREU_DIRECTION_A 0x03 /* VIA_DDRA */
+#define PETREU_CONTROL 0x0c /* VIA_PCR */
/* PET REU registers */
static uint8_t petreu[16];
static uint8_t petreu2[16];
-static uint8_t petreu_bank;
+static uint8_t petreu_bank; /* 0-3, for Model 1 */
/* PET REU image. */
static uint8_t *petreu_ram = NULL;
@@ -76,12 +99,12 @@
/* Flag: Do we enable the PET REU? */
int petreu_enabled;
-/* PET REU size, unused for now but reserved for
- the future 512kb/1mb/2mb versions */
+/* PET REU size */
static int petreu_size = 0;
-/* Size of the PET REU in KB. */
+/* Size of the PET REU in KiB. */
static int petreu_size_kb = 0;
+static uint8_t petreu_bank_mask; /* for Model 2 */
/* Filename of the PET REU image. */
static char *petreu_filename = NULL;
@@ -100,12 +123,12 @@
"PETREU REG 1", /* name of the device */
IO_DETACH_RESOURCE, /* use resource to detach the device when involved in a read-collision */
"PETREU", /* resource to set to '0' */
- 0x8800, 0x88ff, 0x1f, /* range for the device, regs:$8800-$881f, mirrors:$8820-$88ff */
+ 0x8800, 0x88ff, 0x0f, /* range for the device, regs:$8800-$881f, mirrors:$8820-$88ff */
1, /* read is always valid */
store_petreu_reg, /* store function */
- NULL, /* NO poke function */
+ store_petreu_reg, /* poke function */
read_petreu_reg, /* read function */
- NULL, /* TODO: peek function */
+ read_petreu_reg, /* peek function */
petreu_dump, /* device state information dump function */
IO_CART_ID_NONE, /* not a cartridge */
IO_PRIO_NORMAL, /* normal priority, device read needs to be checked for collisions */
@@ -117,12 +140,12 @@
"PETREU REG 2", /* name of the device */
IO_DETACH_RESOURCE, /* use resource to detach the device when involved in a read-collision */
"PETREU", /* resource to set to '0' */
- 0x8a00, 0x8aff, 0x1f, /* range for the device, regs:$8a00-$8a1f, mirrors:$8a20-$8aff */
+ 0x8a00, 0x8aff, 0x0f, /* range for the device, regs:$8a00-$8a1f, mirrors:$8a20-$8aff */
1, /* read is always valid */
store_petreu2_reg, /* store function */
- NULL, /* NO poke function */
+ store_petreu2_reg, /* poke function */
read_petreu2_reg, /* read function */
- NULL, /* TODO: peek function */
+ read_petreu2_reg, /* peek function */
petreu_dump, /* device state information dump function */
IO_CART_ID_NONE, /* not a cartridge */
IO_PRIO_NORMAL, /* normal priority, device read needs to be checked for collisions */
@@ -134,12 +157,12 @@
"PETREU RAM", /* name of the device */
IO_DETACH_RESOURCE, /* use resource to detach the device when involved in a read-collision */
"PETREU", /* resource to set to '0' */
- 0x8900, 0x89ff, 0xff, /* range for the device, regs:$8900-$89ff */
+ 0x8900, 0x89ff, 0x00, /* range for the device, regs:$8900-$8900 */
1, /* read is always valid */
store_petreu_ram, /* store function */
- NULL, /* NO poke function */
+ store_petreu_ram, /* poke function */
read_petreu_ram, /* read function */
- NULL, /* TODO: peek function */
+ read_petreu_ram, /* peek function */
petreu_dump, /* device state information dump function */
IO_CART_ID_NONE, /* not a cartridge */
IO_PRIO_NORMAL, /* normal priority, device read needs to be checked for collisions */
@@ -151,6 +174,29 @@
static io_source_list_t *petreu_reg_2_list_item = NULL;
static io_source_list_t *petreu_ram_list_item = NULL;
+static void petreu_enable_io(void)
+{
+ petreu_reg_1_list_item = io_source_register(&petreureg1_device);
+ if (petreu_size_kb > 128) {
+ petreu_reg_2_list_item = io_source_register(&petreureg2_device);
+ } else {
+ petreu_reg_2_list_item = NULL;
+ }
+ petreu_ram_list_item = io_source_register(&petreuram_device);
+}
+
+static void petreu_disable_io(void)
+{
+ io_source_unregister(petreu_reg_1_list_item);
+ petreu_reg_1_list_item = NULL;
+ if (petreu_reg_2_list_item) {
+ io_source_unregister(petreu_reg_2_list_item);
+ petreu_reg_2_list_item = NULL;
+ }
+ io_source_unregister(petreu_ram_list_item);
+ petreu_ram_list_item = NULL;
+}
+
static int set_petreu_enabled(int value, void *param)
{
int val = value ? 1 : 0;
@@ -165,13 +211,8 @@
return -1;
}
}
+ petreu_disable_io();
petreu_enabled = 0;
- io_source_unregister(petreu_reg_1_list_item);
- petreu_reg_1_list_item = NULL;
- io_source_unregister(petreu_reg_2_list_item);
- petreu_reg_2_list_item = NULL;
- io_source_unregister(petreu_ram_list_item);
- petreu_ram_list_item = NULL;
} else {
if (!petreu_enabled) {
if (petreu_activate() < 0) {
@@ -178,10 +219,8 @@
return -1;
}
}
+ petreu_enable_io();
petreu_enabled = 1;
- petreu_reg_1_list_item = io_source_register(&petreureg1_device);
- petreu_reg_2_list_item = io_source_register(&petreureg2_device);
- petreu_ram_list_item = io_source_register(&petreuram_device);
}
return 0;
}
@@ -205,14 +244,19 @@
if (petreu_enabled) {
petreu_deactivate();
+ petreu_disable_io();
petreu_size_kb = val;
- petreu_size = petreu_size_kb << 10;
+ petreu_size = petreu_size_kb * 1024;
petreu_activate();
+ petreu_enable_io();
} else {
petreu_size_kb = val;
- petreu_size = petreu_size_kb << 10;
+ petreu_size = petreu_size_kb * 1024;
}
+ /* Only used for Model 2: banks are 64 KiB */
+ petreu_bank_mask = (petreu_size_kb / 64) - 1;
+
return 0;
}
@@ -316,7 +360,7 @@
/* Clear newly allocated RAM. */
if (petreu_size > old_petreu_ram_size) {
- memset(petreu_ram, 0, (size_t)(petreu_size - old_petreu_ram_size));
+ memset(petreu_ram + old_petreu_ram_size, 0, (size_t)(petreu_size - old_petreu_ram_size));
}
old_petreu_ram_size = petreu_size;
@@ -390,9 +434,10 @@
{
uint8_t retval;
- if (petreu_size_kb != 128) {
+ if (petreu_size_kb > 128) {
retval = petreu2[addr & 0xf];
} else {
+ /* Read empty space */
retval = (addr >> 8) & 0xff;
}
@@ -465,7 +510,7 @@
real_bank_value = petreu2[PETREU_REGISTER_A];
}
- real_bank_value = (real_bank_value & ((petreu_size_kb >> 4) - 1));
+ real_bank_value = real_bank_value & petreu_bank_mask;
retval = petreu_ram[(real_bank_value << 16) + (real_register_b_value << 8) + real_register_a_value];
@@ -484,11 +529,13 @@
static void store_petreu_reg(uint16_t addr, uint8_t byte)
{
petreu[addr & 0xf] = byte;
+ /* CA2 - assume 0 if set to output and 1 if set to input */
if ((petreu[PETREU_CONTROL] & 0xe) != 0xc) {
petreu_bank = 2;
} else {
petreu_bank = 0;
}
+ /* CB2 - assume 0 if set to output and 1 if set to input */
if ((petreu[PETREU_CONTROL] & 0xe0) != 0xc0) {
petreu_bank++;
}
@@ -550,7 +597,7 @@
real_bank_value = petreu2[PETREU_REGISTER_A];
}
- real_bank_value = (real_bank_value & ((petreu_size_kb >> 4) - 1));
+ real_bank_value = real_bank_value & petreu_bank_mask;
petreu_ram[(real_bank_value << 16) + (real_register_b_value << 8) + real_register_a_value] = byte;
}
@@ -576,7 +623,7 @@
} else {
real_bank = petreu2[PETREU_REGISTER_A];
}
- real_bank = (real_bank & ((petreu_size_kb >> 4) - 1));
+ real_bank = real_bank & petreu_bank_mask;
}
mon_out("RAM size: %dKiB, Bank: %d\n", petreu_size_kb, real_bank);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-08-06 18:33:41
|
Revision: 45274
http://sourceforge.net/p/vice-emu/code/45274
Author: gpz
Date: 2024-08-06 18:33:38 +0000 (Tue, 06 Aug 2024)
Log Message:
-----------
register userport devices via a centralized function, like in the joyport system.
Modified Paths:
--------------
trunk/vice/doc/vice.texi
trunk/vice/src/Makefile.am
trunk/vice/src/c128/c128.c
trunk/vice/src/c64/c64.c
trunk/vice/src/c64dtv/c64dtv-stubs.c
trunk/vice/src/c64dtv/c64dtv.c
trunk/vice/src/cbm2/cbm2-stubs.c
trunk/vice/src/cbm2/cbm2.c
trunk/vice/src/cbm2/cbm5x0.c
trunk/vice/src/joyport/spaceballs.c
trunk/vice/src/joyport/spaceballs.h
trunk/vice/src/pet/pet-stubs.c
trunk/vice/src/pet/pet.c
trunk/vice/src/plus4/plus4-stubs.c
trunk/vice/src/plus4/plus4.c
trunk/vice/src/printerdrv/printer.c
trunk/vice/src/scpu64/scpu64.c
trunk/vice/src/userport/Makefile.am
trunk/vice/src/userport/userport.c
trunk/vice/src/userport/userport.h
trunk/vice/src/vic20/vic20-stubs.c
trunk/vice/src/vic20/vic20.c
Modified: trunk/vice/doc/vice.texi
===================================================================
--- trunk/vice/doc/vice.texi 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/doc/vice.texi 2024-08-06 18:33:38 UTC (rev 45274)
@@ -8619,13 +8619,13 @@
@tab x64, x64sc, x128, xscpu64, xvic, xpet, xcbm2
@item 4
@tab PET userport joy adapter
-@tab x64, x64sc, x128, xscpu64, xvic, xplus4, xpet, xcbm2
+@tab x64, x64sc, x128, xscpu64, xvic, xpet, xcbm2
@item 5
@tab Hummer userport joy adapter
-@tab x64, x64sc, x128, xscpu64, x64dtv, xvic, xplus4, xpet, xcbm2
+@tab x64dtv
@item 6
@tab OEM userport joy adapter
-@tab x64, x64sc, x128, xscpu64, xvic, xplus4, xpet, xcbm2
+@tab x64, x64sc, x128, xscpu64, xvic, xpet, xcbm2
@item 7
@tab HIT userport joy adapter
@tab x64, x64sc, x128, xscpu64
@@ -8637,13 +8637,13 @@
@tab x64, x64sc, x128, xscpu64
@item 10
@tab Synergy userport joy adapter
-@tab x64, x64sc, x128, xscpu64, xvic, xplus4, xpet, xcbm2
+@tab xplus4
@item 11
@tab Wheel of joystick 8-joy userport joy adapter
@tab x64, x64sc, x128, xscpu64, xvic, xplus4, xpet, xcbm2
@item 12
@tab Userport DAC
-@tab x64, x64sc, x128, xscpu64, xvic, xplus4, xpet, xcbm2
+@tab x64, x64sc, x128, xscpu64, xvic, xpet, xcbm2
@item 13
@tab Userport DigiMAX
@tab x64, x64sc, x128, xscpu64, xcbm2
Modified: trunk/vice/src/Makefile.am
===================================================================
--- trunk/vice/src/Makefile.am 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/src/Makefile.am 2024-08-06 18:33:38 UTC (rev 45274)
@@ -1107,6 +1107,7 @@
$(plus4_lib) \
$(plus4cart_lib) \
$(diag_lib) \
+ $(userport_lib) \
$(driveiec_lib) \
$(driveiecieee_lib) \
$(driveiecplus4exp_lib) \
@@ -1125,7 +1126,6 @@
$(rtc_lib) \
$(video_lib) \
$(common_libs) \
- $(userport_lib) \
$(imagecontents_lib) \
$(joyport_lib) \
$(joystickdrv_lib) \
@@ -1133,8 +1133,13 @@
$(hvsc_lib) \
$(hotkeys_lib) \
$(zmbv_lib) \
- $(plus4stubs_lib)
+ $(plus4stubs_lib) \
+ \
+ $(plus4_lib)
+# NOTE: ^^^ link a second time against plus4_lib to solve a nasty problem with
+# unresolved symbols
+
xplus4_SOURCES = $(base_sources)
xplus4_LDADD = $(xplus4_libs) $(emu_extlibs) @TFE_LIBS@ @NETPLAY_LIBS@ $(XPLUS4_RES)
xplus4_DEPENDENCIES = $(xplus4_libs)
Modified: trunk/vice/src/c128/c128.c
===================================================================
--- trunk/vice/src/c128/c128.c 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/src/c128/c128.c 2024-08-06 18:33:38 UTC (rev 45274)
@@ -761,14 +761,6 @@
init_resource_fail("userport devices");
return -1;
}
- if (parallel_cable_cpu_resources_init() < 0) {
- init_resource_fail("userport parallel drive cable");
- return -1;
- }
- if (rsuser_resources_init() < 0) {
- init_resource_fail("rsuser");
- return -1;
- }
if (serial_resources_init() < 0) {
init_resource_fail("serial");
return -1;
@@ -777,10 +769,6 @@
init_resource_fail("printer");
return -1;
}
- if (printer_userport_resources_init() < 0) {
- init_resource_fail("userport printer");
- return -1;
- }
if (init_joyport_ports() < 0) {
init_resource_fail("joyport ports");
return -1;
@@ -860,86 +848,6 @@
init_resource_fail("mmu");
return -1;
}
- if (userport_joystick_cga_resources_init() < 0) {
- init_resource_fail("userport cga joystick");
- return -1;
- }
- if (userport_joystick_pet_resources_init() < 0) {
- init_resource_fail("userport pet joystick");
- return -1;
- }
- if (userport_joystick_oem_resources_init() < 0) {
- init_resource_fail("userport oem joystick");
- return -1;
- }
- if (userport_joystick_hit_resources_init() < 0) {
- init_resource_fail("userport hit joystick");
- return -1;
- }
- if (userport_joystick_kingsoft_resources_init() < 0) {
- init_resource_fail("userport kingsoft joystick");
- return -1;
- }
- if (userport_joystick_starbyte_resources_init() < 0) {
- init_resource_fail("userport starbyte joystick");
- return -1;
- }
- if (userport_joystick_woj_resources_init() < 0) {
- init_resource_fail("userport woj joystick");
- return -1;
- }
- if (userport_spt_joystick_resources_init() < 0) {
- init_resource_fail("userport stupid pet tricks joystick");
- return -1;
- }
- if (userport_dac_resources_init() < 0) {
- init_resource_fail("userport dac");
- return -1;
- }
- if (userport_digimax_resources_init() < 0) {
- init_resource_fail("userport digimax");
- return -1;
- }
- if (userport_rtc_58321a_resources_init() < 0) {
- init_resource_fail("userport rtc (58321a)");
- return -1;
- }
- if (userport_rtc_ds1307_resources_init() < 0) {
- init_resource_fail("userport rtc (ds1307)");
- return -1;
- }
- if (userport_4bit_sampler_resources_init() < 0) {
- init_resource_fail("userport 4bit sampler");
- return -1;
- }
- if (userport_8bss_resources_init() < 0) {
- init_resource_fail("userport 8bit stereo sampler");
- return -1;
- }
- if (userport_petscii_snespad_resources_init() < 0) {
- init_resource_fail("userport petscii snes pad");
- return -1;
- }
- if (userport_superpad64_resources_init() < 0) {
- init_resource_fail("userport superpad64");
- return -1;
- }
-#ifdef USERPORT_EXPERIMENTAL_DEVICES
- if (userport_diag_586220_harness_resources_init() < 0) {
- init_resource_fail("userport diag 586220 harness");
- return -1;
- }
-#endif
-#ifdef HAVE_LIBCURL
- if (userport_wic64_resources_init() < 0) {
- init_resource_fail("userport wic64");
- return -1;
- }
-#endif
- if (userport_io_sim_resources_init() < 0) {
- init_resource_fail("userport I/O simulation");
- return -1;
- }
if (cartio_resources_init() < 0) {
init_resource_fail("cartio");
return -1;
@@ -970,11 +878,7 @@
cartridge_resources_shutdown();
functionrom_resources_shutdown();
rombanks_resources_shutdown();
- userport_rtc_58321a_resources_shutdown();
- userport_rtc_ds1307_resources_shutdown();
-#ifdef HAVE_LIBCURL
- userport_wic64_resources_shutdown();
-#endif
+ userport_resources_shutdown();
cartio_shutdown();
fsdevice_resources_shutdown();
disk_image_resources_shutdown();
@@ -1011,10 +915,6 @@
init_cmdline_options_fail("rs232drv");
return -1;
}
- if (rsuser_cmdline_options_init() < 0) {
- init_cmdline_options_fail("rsuser");
- return -1;
- }
if (serial_cmdline_options_init() < 0) {
init_cmdline_options_fail("serial");
return -1;
@@ -1023,10 +923,6 @@
init_cmdline_options_fail("printer");
return -1;
}
- if (printer_userport_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport printer");
- return -1;
- }
if (joyport_cmdline_options_init() < 0) {
init_cmdline_options_fail("joyport");
return -1;
@@ -1113,20 +1009,6 @@
init_cmdline_options_fail("functionrom");
return -1;
}
- if (userport_rtc_58321a_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport rtc (58321a)");
- return -1;
- }
- if (userport_rtc_ds1307_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport rtc (ds1307)");
- return -1;
- }
-#ifdef HAVE_LIBCURL
- if (userport_wic64_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport wic64");
- return -1;
- }
-#endif
if (cartio_cmdline_options_init() < 0) {
init_cmdline_options_fail("cartio");
return -1;
Modified: trunk/vice/src/c64/c64.c
===================================================================
--- trunk/vice/src/c64/c64.c 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/src/c64/c64.c 2024-08-06 18:33:38 UTC (rev 45274)
@@ -721,14 +721,6 @@
init_resource_fail("userport devices");
return -1;
}
- if (parallel_cable_cpu_resources_init() < 0) {
- init_resource_fail("userport parallel drive cable");
- return -1;
- }
- if (rsuser_resources_init() < 0) {
- init_resource_fail("rsuser");
- return -1;
- }
if (serial_resources_init() < 0) {
init_resource_fail("serial");
return -1;
@@ -737,10 +729,6 @@
init_resource_fail("printer");
return -1;
}
- if (printer_userport_resources_init() < 0) {
- init_resource_fail("userport printer");
- return -1;
- }
if (init_joyport_ports() < 0) {
init_resource_fail("joyport ports");
return -1;
@@ -812,86 +800,6 @@
init_resource_fail("c64 glue");
return -1;
}
- if (userport_joystick_cga_resources_init() < 0) {
- init_resource_fail("userport cga joystick");
- return -1;
- }
- if (userport_joystick_pet_resources_init() < 0) {
- init_resource_fail("userport pet joystick");
- return -1;
- }
- if (userport_joystick_oem_resources_init() < 0) {
- init_resource_fail("userport oem joystick");
- return -1;
- }
- if (userport_joystick_hit_resources_init() < 0) {
- init_resource_fail("userport hit joystick");
- return -1;
- }
- if (userport_joystick_kingsoft_resources_init() < 0) {
- init_resource_fail("userport kingsoft joystick");
- return -1;
- }
- if (userport_joystick_starbyte_resources_init() < 0) {
- init_resource_fail("userport starbyte joystick");
- return -1;
- }
- if (userport_joystick_woj_resources_init() < 0) {
- init_resource_fail("userport woj joystick");
- return -1;
- }
- if (userport_spt_joystick_resources_init() < 0) {
- init_resource_fail("userport stupid pet tricks joystick");
- return -1;
- }
- if (userport_dac_resources_init() < 0) {
- init_resource_fail("userport dac");
- return -1;
- }
- if (userport_digimax_resources_init() < 0) {
- init_resource_fail("userport dac");
- return -1;
- }
- if (userport_rtc_58321a_resources_init() < 0) {
- init_resource_fail("userport rtc (58321a)");
- return -1;
- }
- if (userport_rtc_ds1307_resources_init() < 0) {
- init_resource_fail("userport rtc (ds1307)");
- return -1;
- }
- if (userport_4bit_sampler_resources_init() < 0) {
- init_resource_fail("userport 4bit sampler");
- return -1;
- }
- if (userport_8bss_resources_init() < 0) {
- init_resource_fail("userport 8bit stereo sampler");
- return -1;
- }
- if (userport_petscii_snespad_resources_init() < 0) {
- init_resource_fail("userport petscii snes pad");
- return -1;
- }
- if (userport_superpad64_resources_init() < 0) {
- init_resource_fail("userport superpad64");
- return -1;
- }
-#ifdef USERPORT_EXPERIMENTAL_DEVICES
- if (userport_diag_586220_harness_resources_init() < 0) {
- init_resource_fail("userport diag 586220 harness");
- return -1;
- }
-#endif
-#ifdef HAVE_LIBCURL
- if (userport_wic64_resources_init() < 0) {
- init_resource_fail("userport wic64");
- return -1;
- }
-#endif
- if (userport_io_sim_resources_init() < 0) {
- init_resource_fail("userport I/O simulation");
- return -1;
- }
if (cartio_resources_init() < 0) {
init_resource_fail("cartio");
return -1;
@@ -924,11 +832,7 @@
drive_resources_shutdown();
cartridge_resources_shutdown();
rombanks_resources_shutdown();
- userport_rtc_58321a_resources_shutdown();
- userport_rtc_ds1307_resources_shutdown();
-#ifdef HAVE_LIBCURL
- userport_wic64_resources_shutdown();
-#endif
+ userport_resources_shutdown();
cartio_shutdown();
fsdevice_resources_shutdown();
disk_image_resources_shutdown();
@@ -982,10 +886,6 @@
init_cmdline_options_fail("rs232drv");
return -1;
}
- if (rsuser_cmdline_options_init() < 0) {
- init_cmdline_options_fail("rsuser");
- return -1;
- }
if (serial_cmdline_options_init() < 0) {
init_cmdline_options_fail("serial");
return -1;
@@ -994,10 +894,6 @@
init_cmdline_options_fail("printer");
return -1;
}
- if (printer_userport_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport printer");
- return -1;
- }
if (joyport_cmdline_options_init() < 0) {
init_cmdline_options_fail("joyport");
return -1;
@@ -1072,20 +968,6 @@
init_cmdline_options_fail("c64 glue");
return -1;
}
- if (userport_rtc_58321a_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport rtc (58321a)");
- return -1;
- }
- if (userport_rtc_ds1307_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport rtc (ds1307)");
- return -1;
- }
-#ifdef HAVE_LIBCURL
- if (userport_wic64_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport wic64");
- return -1;
- }
-#endif
if (cartio_cmdline_options_init() < 0) {
init_cmdline_options_fail("cartio");
return -1;
Modified: trunk/vice/src/c64dtv/c64dtv-stubs.c
===================================================================
--- trunk/vice/src/c64dtv/c64dtv-stubs.c 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/src/c64dtv/c64dtv-stubs.c 2024-08-06 18:33:38 UTC (rev 45274)
@@ -33,6 +33,10 @@
#include "cart/clockport.h"
#include "cartridge.h"
+#include "ds1307.h"
+#include "rtc-58321a.h"
+#include "rsuser.h"
+#include "c64parallel.h"
#include "c64cart.h"
#include "c64/cart/c64cartmem.h"
#include "machine.h"
@@ -228,7 +232,82 @@
{
}
+/*******************************************************************************
+ userport devices
+*******************************************************************************/
+
bool pia1_get_diagnostic_pin(void)
{
return false;
}
+
+int ds1307_write_snapshot(rtc_ds1307_t *context, snapshot_t *s)
+{
+ return -1;
+}
+int ds1307_read_snapshot(rtc_ds1307_t *context, snapshot_t *s)
+{
+ return -1;
+}
+rtc_ds1307_t *ds1307_init(char *device)
+{
+ return NULL;
+}
+void ds1307_destroy(rtc_ds1307_t *context, int save)
+{
+}
+void ds1307_set_clk_line(rtc_ds1307_t *context, uint8_t data)
+{
+}
+void ds1307_set_data_line(rtc_ds1307_t *context, uint8_t data)
+{
+}
+uint8_t ds1307_read_data_line(rtc_ds1307_t *context)
+{
+ return 0;
+}
+
+int rtc58321a_read_snapshot(rtc_58321a_t *context, snapshot_t *s)
+{
+ return -1;
+}
+int rtc58321a_write_snapshot(rtc_58321a_t *context, snapshot_t *s)
+{
+ return -1;
+}
+rtc_58321a_t *rtc58321a_init(char *device)
+{
+ return NULL;
+}
+void rtc58321a_destroy(rtc_58321a_t *context, int save)
+{
+}
+uint8_t rtc58321a_read(rtc_58321a_t *context)
+{
+ return 0;
+}
+void rtc58321a_write_address(rtc_58321a_t *context, uint8_t address)
+{
+}
+void rtc58321a_write_data(rtc_58321a_t *context, uint8_t data)
+{
+}
+void rtc58321a_stop_clock(rtc_58321a_t *context)
+{
+}
+void rtc58321a_start_clock(rtc_58321a_t *context)
+{
+}
+
+int rsuser_resources_init(void)
+{
+ return -1;
+}
+int rsuser_cmdline_options_init(void)
+{
+ return -1;
+}
+int parallel_cable_cpu_resources_init(void)
+{
+ return -1;
+}
Modified: trunk/vice/src/c64dtv/c64dtv.c
===================================================================
--- trunk/vice/src/c64dtv/c64dtv.c 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/src/c64dtv/c64dtv.c 2024-08-06 18:33:38 UTC (rev 45274)
@@ -513,18 +513,11 @@
init_resource_fail("drive");
return -1;
}
- if (userport_joystick_hummer_resources_init() < 0) {
- init_resource_fail("userport hummer joystick");
- return -1;
- }
- if (userport_io_sim_resources_init() < 0) {
- init_resource_fail("userport I/O simulation");
- return -1;
- }
if (debugcart_resources_init() < 0) {
init_resource_fail("debug cart");
return -1;
}
+
return 0;
}
@@ -543,6 +536,7 @@
sampler_resources_shutdown();
debugcart_resources_shutdown();
joyport_resources_shutdown();
+ userport_resources_shutdown();
}
/* C64DTV-specific command-line option initialization. */
Modified: trunk/vice/src/cbm2/cbm2-stubs.c
===================================================================
--- trunk/vice/src/cbm2/cbm2-stubs.c 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/src/cbm2/cbm2-stubs.c 2024-08-06 18:33:38 UTC (rev 45274)
@@ -37,6 +37,8 @@
#ifdef HAVE_LIBCURL
#include "userport_wic64.h"
#endif
+#include "rsuser.h"
+#include "c64/c64parallel.h" /* FIXME: use CBM2 specific header once it exists */
#ifdef WINDOWS_COMPILE
void mididrv_ui_reset_device_list(int device)
@@ -55,8 +57,25 @@
clockport_supported_devices_t clockport_supported_devices[] = { { 0, NULL } };
+/*******************************************************************************
+ userport devices
+*******************************************************************************/
bool pia1_get_diagnostic_pin(void)
{
return false;
}
+
+int parallel_cable_cpu_resources_init(void)
+{
+ return -1;
+}
+
+int rsuser_cmdline_options_init(void)
+{
+ return -1;
+}
+int rsuser_resources_init(void)
+{
+ return -1;
+}
Modified: trunk/vice/src/cbm2/cbm2.c
===================================================================
--- trunk/vice/src/cbm2/cbm2.c 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/src/cbm2/cbm2.c 2024-08-06 18:33:38 UTC (rev 45274)
@@ -349,10 +349,6 @@
init_resource_fail("printer");
return -1;
}
- if (printer_userport_resources_init() < 0) {
- init_resource_fail("userport printer");
- return -1;
- }
if (init_joyport_ports() < 0) {
init_resource_fail("joyport ports");
return -1;
@@ -416,62 +412,6 @@
return -1;
}
#endif
- if (userport_joystick_cga_resources_init() < 0) {
- init_resource_fail("userport cga joystick");
- return -1;
- }
- if (userport_joystick_pet_resources_init() < 0) {
- init_resource_fail("userport pet joystick");
- return -1;
- }
- if (userport_joystick_oem_resources_init() < 0) {
- init_resource_fail("userport oem joystick");
- return -1;
- }
- if (userport_joystick_woj_resources_init() < 0) {
- init_resource_fail("userport woj joystick");
- return -1;
- }
- if (userport_spt_joystick_resources_init() < 0) {
- init_resource_fail("userport stupid pet tricks joystick");
- return -1;
- }
- if (userport_dac_resources_init() < 0) {
- init_resource_fail("userport dac");
- return -1;
- }
- if (userport_digimax_resources_init() < 0) {
- init_resource_fail("userport digimax");
- return -1;
- }
- if (userport_petscii_snespad_resources_init() < 0) {
- init_resource_fail("userport petscii snes pad");
- return -1;
- }
- if (userport_superpad64_resources_init() < 0) {
- init_resource_fail("userport userpad64");
- return -1;
- }
- if (userport_rtc_58321a_resources_init() < 0) {
- init_resource_fail("userport rtc (58321a)");
- return -1;
- }
- if (userport_rtc_ds1307_resources_init() < 0) {
- init_resource_fail("userport rtc (ds1307)");
- return -1;
- }
- if (userport_4bit_sampler_resources_init() < 0) {
- init_resource_fail("userport 4bit sampler");
- return -1;
- }
- if (userport_8bss_resources_init() < 0) {
- init_resource_fail("userport 8bit stereo sampler");
- return -1;
- }
- if (userport_io_sim_resources_init() < 0) {
- init_resource_fail("userport I/O simulation");
- return -1;
- }
if (debugcart_resources_init() < 0) {
init_resource_fail("debug cart");
return -1;
@@ -490,8 +430,7 @@
disk_image_resources_shutdown();
sampler_resources_shutdown();
cartio_shutdown();
- userport_rtc_58321a_resources_shutdown();
- userport_rtc_ds1307_resources_shutdown();
+ userport_resources_shutdown();
tapeport_resources_shutdown();
debugcart_resources_shutdown();
cartridge_resources_shutdown();
@@ -545,10 +484,6 @@
init_cmdline_options_fail("printer");
return -1;
}
- if (printer_userport_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport printer");
- return -1;
- }
if (joyport_cmdline_options_init() < 0) {
init_cmdline_options_fail("joyport");
return -1;
@@ -611,14 +546,6 @@
return -1;
}
#endif
- if (userport_rtc_58321a_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport rtc (58321a)");
- return -1;
- }
- if (userport_rtc_ds1307_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport rtc (ds1307)");
- return -1;
- }
if (debugcart_cmdline_options_init() < 0) {
init_cmdline_options_fail("debug cart");
return -1;
Modified: trunk/vice/src/cbm2/cbm5x0.c
===================================================================
--- trunk/vice/src/cbm2/cbm5x0.c 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/src/cbm2/cbm5x0.c 2024-08-06 18:33:38 UTC (rev 45274)
@@ -361,10 +361,6 @@
init_resource_fail("printer");
return -1;
}
- if (printer_userport_resources_init() < 0) {
- init_resource_fail("userport printer");
- return -1;
- }
if (init_joyport_ports() < 0) {
init_resource_fail("joyport ports");
return -1;
@@ -498,10 +494,6 @@
init_cmdline_options_fail("printer");
return -1;
}
- if (printer_userport_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport printer");
- return -1;
- }
if (joyport_cmdline_options_init() < 0) {
init_cmdline_options_fail("joyport");
return -1;
Modified: trunk/vice/src/joyport/spaceballs.c
===================================================================
--- trunk/vice/src/joyport/spaceballs.c 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/src/joyport/spaceballs.c 2024-08-06 18:33:38 UTC (rev 45274)
@@ -153,9 +153,11 @@
int joyport_spaceballs_resources_init(void)
{
- if (joyport_device_register(JOYPORT_ID_SPACEBALLS, &joyport_spaceballs_device) < 0) {
- return -1;
- }
+ return joyport_device_register(JOYPORT_ID_SPACEBALLS, &joyport_spaceballs_device);
+}
+
+int userport_spaceballs_resources_init(void)
+{
return userport_device_register(USERPORT_DEVICE_SPACEBALLS, &userport_spaceballs_device);
}
Modified: trunk/vice/src/joyport/spaceballs.h
===================================================================
--- trunk/vice/src/joyport/spaceballs.h 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/src/joyport/spaceballs.h 2024-08-06 18:33:38 UTC (rev 45274)
@@ -30,5 +30,6 @@
#include "types.h"
int joyport_spaceballs_resources_init(void);
+int userport_spaceballs_resources_init(void);
#endif
Modified: trunk/vice/src/pet/pet-stubs.c
===================================================================
--- trunk/vice/src/pet/pet-stubs.c 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/src/pet/pet-stubs.c 2024-08-06 18:33:38 UTC (rev 45274)
@@ -35,6 +35,8 @@
#ifdef HAVE_LIBCURL
#include "userport_wic64.h"
#endif
+#include "rsuser.h"
+#include "c64/c64parallel.h" /* FIXME: use pet specific header once it exists */
/* dummy function to satisfy the global cartridge system */
int cartridge_attach_image(int type, const char *name)
@@ -152,3 +154,20 @@
*******************************************************************************/
clockport_supported_devices_t clockport_supported_devices[] = { { 0, NULL } };
+
+/*******************************************************************************
+ userport devices
+*******************************************************************************/
+
+int parallel_cable_cpu_resources_init(void)
+{
+ return -1;
+}
+int rsuser_cmdline_options_init(void)
+{
+ return -1;
+}
+int rsuser_resources_init(void)
+{
+ return -1;
+}
Modified: trunk/vice/src/pet/pet.c
===================================================================
--- trunk/vice/src/pet/pet.c 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/src/pet/pet.c 2024-08-06 18:33:38 UTC (rev 45274)
@@ -359,10 +359,6 @@
init_resource_fail("printer");
return -1;
}
- if (printer_userport_resources_init() < 0) {
- init_resource_fail("userport printer");
- return -1;
- }
if (init_joyport_ports() < 0) {
init_resource_fail("joyport ports");
return -1;
@@ -426,46 +422,6 @@
return -1;
}
#endif
- if (userport_joystick_cga_resources_init() < 0) {
- init_resource_fail("userport cga joystick");
- return -1;
- }
- if (userport_joystick_pet_resources_init() < 0) {
- init_resource_fail("userport pet joystick");
- return -1;
- }
- if (userport_joystick_oem_resources_init() < 0) {
- init_resource_fail("userport oem joystick");
- return -1;
- }
- if (userport_joystick_woj_resources_init() < 0) {
- init_resource_fail("userport woj joystick");
- return -1;
- }
- if (userport_spt_joystick_resources_init() < 0) {
- init_resource_fail("userport stupid pet tricks joystick");
- return -1;
- }
- if (userport_dac_resources_init() < 0) {
- init_resource_fail("userport dac");
- return -1;
- }
- if (userport_rtc_58321a_resources_init() < 0) {
- init_resource_fail("userport rtc (58321a)");
- return -1;
- }
- if (userport_rtc_ds1307_resources_init() < 0) {
- init_resource_fail("userport rtc (ds1307)");
- return -1;
- }
- if (userport_petscii_snespad_resources_init() < 0) {
- init_resource_fail("userport petscii snes pad");
- return -1;
- }
- if (userport_io_sim_resources_init() < 0) {
- init_resource_fail("userport I/O simulation");
- return -1;
- }
if (debugcart_resources_init() < 0) {
init_resource_fail("debug cart");
return -1;
@@ -486,8 +442,7 @@
disk_image_resources_shutdown();
sampler_resources_shutdown();
cartio_shutdown();
- userport_rtc_58321a_resources_shutdown();
- userport_rtc_ds1307_resources_shutdown();
+ userport_resources_shutdown();
tapeport_resources_shutdown();
debugcart_resources_shutdown();
joyport_resources_shutdown();
@@ -552,10 +507,6 @@
init_cmdline_options_fail("printer");
return -1;
}
- if (printer_userport_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport printer");
- return -1;
- }
if (joyport_cmdline_options_init() < 0) {
init_cmdline_options_fail("joyport");
return -1;
@@ -618,14 +569,6 @@
return -1;
}
#endif
- if (userport_rtc_58321a_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport rtc (58321a)");
- return -1;
- }
- if (userport_rtc_ds1307_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport rtc (ds1307)");
- return -1;
- }
if (debugcart_cmdline_options_init() < 0) {
init_cmdline_options_fail("debug cart");
return -1;
Modified: trunk/vice/src/plus4/plus4-stubs.c
===================================================================
--- trunk/vice/src/plus4/plus4-stubs.c 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/src/plus4/plus4-stubs.c 2024-08-06 18:33:38 UTC (rev 45274)
@@ -32,6 +32,8 @@
#include "c64/cart/clockport.h"
#include "cartridge.h"
+#include "ds1307.h"
+#include "rtc-58321a.h"
#include "mididrv.h"
#include "pet/petpia.h"
#ifdef HAVE_LIBCURL
@@ -59,3 +61,77 @@
{
return false;
}
+
+/*******************************************************************************
+ userport devices
+*******************************************************************************/
+#if 0
+int ds1307_write_snapshot(rtc_ds1307_t *context, snapshot_t *s)
+{
+ return -1;
+}
+int ds1307_read_snapshot(rtc_ds1307_t *context, snapshot_t *s)
+{
+ return -1;
+}
+rtc_ds1307_t *ds1307_init(char *device)
+{
+ return NULL;
+}
+void ds1307_destroy(rtc_ds1307_t *context, int save)
+{
+}
+void ds1307_set_clk_line(rtc_ds1307_t *context, uint8_t data)
+{
+}
+void ds1307_set_data_line(rtc_ds1307_t *context, uint8_t data)
+{
+}
+uint8_t ds1307_read_data_line(rtc_ds1307_t *context)
+{
+ return 0;
+}
+
+int rtc58321a_read_snapshot(rtc_58321a_t *context, snapshot_t *s)
+{
+ return -1;
+}
+int rtc58321a_write_snapshot(rtc_58321a_t *context, snapshot_t *s)
+{
+ return -1;
+}
+rtc_58321a_t *rtc58321a_init(char *device)
+{
+ return NULL;
+}
+void rtc58321a_destroy(rtc_58321a_t *context, int save)
+{
+}
+uint8_t rtc58321a_read(rtc_58321a_t *context)
+{
+ return 0;
+}
+void rtc58321a_write_address(rtc_58321a_t *context, uint8_t address)
+{
+}
+void rtc58321a_write_data(rtc_58321a_t *context, uint8_t data)
+{
+}
+void rtc58321a_stop_clock(rtc_58321a_t *context)
+{
+}
+void rtc58321a_start_clock(rtc_58321a_t *context)
+{
+}
+#endif
+
+#if 0
+int rsuser_cmdline_options_init(void)
+{
+ return -1;
+}
+int rsuser_resources_init(void)
+{
+ return -1;
+}
+#endif
Modified: trunk/vice/src/plus4/plus4.c
===================================================================
--- trunk/vice/src/plus4/plus4.c 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/src/plus4/plus4.c 2024-08-06 18:33:38 UTC (rev 45274)
@@ -522,17 +522,6 @@
init_resource_fail("userport devices");
return -1;
}
- if (parallel_cable_cpu_resources_init() < 0) {
- init_resource_fail("userport drive parallel cable");
- return -1;
- }
-/* FIXME: Add userport printer support to xplus4 */
-#if 0
- if (printer_userport_resources_init() < 0) {
- init_resource_fail("userport printer");
- return -1;
- }
-#endif
if (init_joyport_ports() < 0) {
init_resource_fail("joyport ports");
return -1;
@@ -545,22 +534,6 @@
init_resource_fail("joystick");
return -1;
}
- if (userport_joystick_synergy_resources_init() < 0) {
- init_resource_fail("userport synergy joystick");
- return -1;
- }
- if (userport_joystick_woj_resources_init() < 0) {
- init_resource_fail("userport woj joystick");
- return -1;
- }
- if (userport_petscii_snespad_resources_init() < 0) {
- init_resource_fail("userport petscii snes pad");
- return -1;
- }
- if (userport_io_sim_resources_init() < 0) {
- init_resource_fail("userport I/O simulation");
- return -1;
- }
if (sampler_resources_init() < 0) {
init_resource_fail("samplerdrv");
return -1;
@@ -644,6 +617,7 @@
fsdevice_resources_shutdown();
disk_image_resources_shutdown();
sampler_resources_shutdown();
+ userport_resources_shutdown();
cartio_shutdown();
tapeport_resources_shutdown();
debugcart_resources_shutdown();
@@ -701,13 +675,6 @@
init_cmdline_options_fail("printer");
return -1;
}
-/* FIXME: Add userport printer support to xplus4 */
-#if 0
- if (printer_userport_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport printer");
- return -1;
- }
-#endif
if (joyport_cmdline_options_init() < 0) {
init_cmdline_options_fail("joyport");
return -1;
Modified: trunk/vice/src/printerdrv/printer.c
===================================================================
--- trunk/vice/src/printerdrv/printer.c 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/src/printerdrv/printer.c 2024-08-06 18:33:38 UTC (rev 45274)
@@ -51,6 +51,7 @@
int printer_resources_init(void)
{
+ DBG(("printer_resources_init"));
if (output_graphics_init_resources() < 0
|| output_text_init_resources() < 0
|| output_select_init_resources() < 0
@@ -68,6 +69,7 @@
int printer_userport_resources_init(void)
{
+ DBG(("printer_userport_resources_init"));
if (output_select_userport_init_resources() < 0
|| driver_select_userport_init_resources() < 0) {
return -1;
@@ -82,6 +84,7 @@
int printer_cmdline_options_init(void)
{
+ DBG(("printer_cmdline_options_init"));
if (output_text_init_cmdline_options() < 0
|| output_select_init_cmdline_options() < 0
|| driver_select_init_cmdline_options() < 0
@@ -93,6 +96,7 @@
int printer_userport_cmdline_options_init(void)
{
+ DBG(("printer_userport_cmdline_options_init"));
if (driver_select_userport_init_cmdline_options() < 0
|| output_select_userport_init_cmdline_options() < 0) {
return -1;
Modified: trunk/vice/src/scpu64/scpu64.c
===================================================================
--- trunk/vice/src/scpu64/scpu64.c 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/src/scpu64/scpu64.c 2024-08-06 18:33:38 UTC (rev 45274)
@@ -538,14 +538,6 @@
init_resource_fail("userport devices");
return -1;
}
- if (parallel_cable_cpu_resources_init() < 0) {
- init_resource_fail("userport parallel drive cable");
- return -1;
- }
- if (rsuser_resources_init() < 0) {
- init_resource_fail("rsuser");
- return -1;
- }
if (serial_resources_init() < 0) {
init_resource_fail("serial");
return -1;
@@ -554,10 +546,6 @@
init_resource_fail("printer");
return -1;
}
- if (printer_userport_resources_init() < 0) {
- init_resource_fail("userport printer");
- return -1;
- }
if (init_joyport_ports() < 0) {
init_resource_fail("joyport ports");
return -1;
@@ -625,80 +613,6 @@
init_resource_fail("scpu64 glue");
return -1;
}
- if (userport_joystick_cga_resources_init() < 0) {
- init_resource_fail("userport cga joystick");
- return -1;
- }
- if (userport_joystick_pet_resources_init() < 0) {
- init_resource_fail("userport pet joystick");
- return -1;
- }
- if (userport_joystick_oem_resources_init() < 0) {
- init_resource_fail("userport oem joystick");
- return -1;
- }
- if (userport_joystick_hit_resources_init() < 0) {
- init_resource_fail("userport hit joystick");
- return -1;
- }
- if (userport_joystick_kingsoft_resources_init() < 0) {
- init_resource_fail("userport kingsoft joystick");
- return -1;
- }
- if (userport_joystick_starbyte_resources_init() < 0) {
- init_resource_fail("userport starbyte joystick");
- return -1;
- }
- if (userport_joystick_woj_resources_init() < 0) {
- init_resource_fail("userport woj joystick");
- return -1;
- }
- if (userport_spt_joystick_resources_init() < 0) {
- init_resource_fail("userport stupid pet tricks joystick");
- return -1;
- }
- if (userport_dac_resources_init() < 0) {
- init_resource_fail("userport dac");
- return -1;
- }
- if (userport_digimax_resources_init() < 0) {
- init_resource_fail("userport digimax");
- return -1;
- }
- if (userport_rtc_58321a_resources_init() < 0) {
- init_resource_fail("userport rtc (58321a)");
- return -1;
- }
- if (userport_rtc_ds1307_resources_init() < 0) {
- init_resource_fail("userport rtc (ds1307)");
- return -1;
- }
- if (userport_4bit_sampler_resources_init() < 0) {
- init_resource_fail("userport 4bit sampler");
- return -1;
- }
- if (userport_8bss_resources_init() < 0) {
- init_resource_fail("userport 8bit stereo sampler");
- return -1;
- }
- if (userport_superpad64_resources_init() < 0) {
- init_resource_fail("userport superpad64");
- return -1;
- }
- if (userport_petscii_snespad_resources_init() < 0) {
- init_resource_fail("userport petscii snes pad");
- return -1;
- }
-#ifdef HAVE_LIBCURL
- if (userport_wic64_resources_init() < 0) {
- init_resource_fail("userport wic64");
- return -1;
- }
-#endif
- if (userport_io_sim_resources_init() < 0) {
- init_resource_fail("userport I/O simulation");
- return -1;
- }
if (cartio_resources_init() < 0) {
init_resource_fail("cartio");
return -1;
@@ -728,11 +642,7 @@
drive_resources_shutdown();
cartridge_resources_shutdown();
rombanks_resources_shutdown();
- userport_rtc_58321a_resources_shutdown();
- userport_rtc_ds1307_resources_shutdown();
-#ifdef HAVE_LIBCURL
- userport_wic64_resources_shutdown();
-#endif
+ userport_resources_shutdown();
cartio_shutdown();
fsdevice_resources_shutdown();
disk_image_resources_shutdown();
@@ -763,10 +673,6 @@
init_cmdline_options_fail("rs232drv");
return -1;
}
- if (rsuser_cmdline_options_init() < 0) {
- init_cmdline_options_fail("rsuser");
- return -1;
- }
if (serial_cmdline_options_init() < 0) {
init_cmdline_options_fail("serial");
return -1;
@@ -775,10 +681,6 @@
init_cmdline_options_fail("printer");
return -1;
}
- if (printer_userport_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport printer");
- return -1;
- }
if (joyport_cmdline_options_init() < 0) {
init_cmdline_options_fail("joyport");
return -1;
@@ -849,20 +751,6 @@
init_cmdline_options_fail("scpu64 glue");
return -1;
}
- if (userport_rtc_58321a_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport rtc (58321a)");
- return -1;
- }
- if (userport_rtc_ds1307_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport rtc (ds1307)");
- return -1;
- }
-#ifdef HAVE_LIBCURL
- if (userport_wic64_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport wic64");
- return -1;
- }
-#endif
if (cartio_cmdline_options_init() < 0) {
init_cmdline_options_fail("cartio");
return -1;
Modified: trunk/vice/src/userport/Makefile.am
===================================================================
--- trunk/vice/src/userport/Makefile.am 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/src/userport/Makefile.am 2024-08-06 18:33:38 UTC (rev 45274)
@@ -9,6 +9,10 @@
-I$(top_srcdir)/src/joyport \
-I$(top_srcdir)/src/samplerdrv \
-I$(top_srcdir)/src/diag \
+ -I$(top_srcdir)/src/printerdrv \
+ -I$(top_srcdir)/src/rs232drv \
+ -I$(top_srcdir)/src/c64 \
+ -I$(top_srcdir)/src/plus4 \
-I$(top_srcdir)/src/drive
AM_CFLAGS = @VICE_CFLAGS@
Modified: trunk/vice/src/userport/userport.c
===================================================================
--- trunk/vice/src/userport/userport.c 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/src/userport/userport.c 2024-08-06 18:33:38 UTC (rev 45274)
@@ -124,10 +124,34 @@
#include "lib.h"
#include "log.h"
#include "machine.h"
+#include "printer.h"
#include "resources.h"
+#include "rsuser.h"
#include "snapshot.h"
+#include "spaceballs.h"
#include "uiapi.h"
#include "userport.h"
+#include "userport_joystick.h"
+#include "userport_hks_joystick.h"
+#include "userport_woj_joystick.h"
+#include "userport_4bit_sampler.h"
+#include "userport_8bss.h"
+#include "userport_dac.h"
+#include "userport_diag_586220_harness.h"
+#include "userport_digimax.h"
+#include "userport_hummer_joystick.h"
+#include "userport_io_sim.h"
+#include "userport_petscii_snespad.h"
+#include "userport_rtc_58321a.h"
+#include "userport_rtc_ds1307.h"
+#include "userport_spt_joystick.h"
+#include "userport_superpad64.h"
+#include "userport_synergy_joystick.h"
+#include "userport_wic64.h"
+
+#include "c64parallel.h"
+#include "plus4parallel.h"
+
#include "util.h"
#include "init.h"
@@ -601,6 +625,206 @@
/* ---------------------------------------------------------------------------------------------------------- */
+/* All machines that are 100% compatible */
+#define UP_C64 (VICE_MACHINE_C64 | VICE_MACHINE_C128 | VICE_MACHINE_C64SC | VICE_MACHINE_SCPU64)
+#define UP_PLUS4 (VICE_MACHINE_PLUS4)
+#define UP_VIC20 (VICE_MACHINE_VIC20)
+#define UP_DTV (VICE_MACHINE_C64DTV)
+#define UP_PET (VICE_MACHINE_PET)
+#define UP_CBM2 (VICE_MACHINE_CBM5x0 | VICE_MACHINE_CBM6x0)
+
+static userport_init_t userport_devices_init[] = {
+/* FIXME: Add userport printer support to xplus4 */
+ { USERPORT_DEVICE_PRINTER, /* device id */
+ UP_C64 | UP_VIC20 | UP_PET | UP_CBM2, /* emulators this device works on */
+ printer_userport_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ printer_userport_cmdline_options_init /* cmdline options init function */
+ },
+ { USERPORT_DEVICE_RS232_MODEM, /* device id */
+ UP_C64 | UP_VIC20, /* emulators this device works on */
+ rsuser_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ rsuser_cmdline_options_init /* cmdline options init function */
+ },
+ { USERPORT_DEVICE_JOYSTICK_CGA, /* device id */
+ UP_C64 | UP_VIC20 | UP_PET | UP_CBM2, /* emulators this device works on */
+ userport_joystick_cga_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
+ { USERPORT_DEVICE_JOYSTICK_PET, /* device id */
+ UP_C64 | UP_VIC20 | UP_PET | UP_CBM2, /* emulators this device works on */
+ userport_joystick_pet_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
+ { USERPORT_DEVICE_JOYSTICK_HUMMER, /* device id */
+ UP_DTV, /* emulators this device works on */
+ userport_joystick_hummer_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
+ { USERPORT_DEVICE_JOYSTICK_OEM, /* device id */
+ UP_C64 | UP_VIC20 | UP_PET | UP_CBM2, /* emulators this device works on */
+ userport_joystick_oem_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
+ { USERPORT_DEVICE_JOYSTICK_HIT, /* device id */
+ UP_C64, /* emulators this device works on */
+ userport_joystick_hit_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
+ { USERPORT_DEVICE_JOYSTICK_KINGSOFT, /* device id */
+ UP_C64, /* emulators this device works on */
+ userport_joystick_kingsoft_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
+ { USERPORT_DEVICE_JOYSTICK_STARBYTE, /* device id */
+ UP_C64, /* emulators this device works on */
+ userport_joystick_starbyte_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
+ { USERPORT_DEVICE_JOYSTICK_SYNERGY, /* device id */
+ UP_PLUS4, /* emulators this device works on */
+ userport_joystick_synergy_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
+ { USERPORT_DEVICE_JOYSTICK_WOJ, /* device id */
+ UP_C64 | UP_VIC20 | UP_PLUS4 | UP_PET | UP_CBM2, /* emulators this device works on */
+ userport_joystick_woj_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
+ { USERPORT_DEVICE_DAC, /* device id */
+ UP_C64 | UP_VIC20 | UP_PET | UP_CBM2, /* emulators this device works on */
+ userport_dac_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
+ { USERPORT_DEVICE_DIGIMAX, /* device id */
+ UP_C64 | UP_CBM2, /* emulators this device works on */
+ userport_digimax_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
+ { USERPORT_DEVICE_4BIT_SAMPLER, /* device id */
+ UP_C64 | UP_CBM2, /* emulators this device works on */
+ userport_4bit_sampler_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
+ { USERPORT_DEVICE_8BSS, /* device id */
+ UP_C64 | UP_CBM2, /* emulators this device works on */
+ userport_8bss_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
+ { USERPORT_DEVICE_RTC_58321A, /* device id */
+ UP_C64 | UP_VIC20 | UP_PET | UP_CBM2, /* emulators this device works on */
+ userport_rtc_58321a_resources_init, /* resources init function */
+ userport_rtc_58321a_resources_shutdown, /* resources shutdown function */
+ userport_rtc_58321a_cmdline_options_init /* cmdline options init function */
+ },
+ { USERPORT_DEVICE_RTC_DS1307, /* device id */
+ UP_C64 | UP_VIC20 | UP_PET | UP_CBM2, /* emulators this device works on */
+ userport_rtc_ds1307_resources_init, /* resources init function */
+ userport_rtc_ds1307_resources_shutdown, /* resources shutdown function */
+ userport_rtc_ds1307_cmdline_options_init /* cmdline options init function */
+ },
+ { USERPORT_DEVICE_PETSCII_SNESPAD, /* device id */
+ UP_C64 | UP_VIC20 | UP_PLUS4 | UP_PET | UP_CBM2, /* emulators this device works on */
+ userport_petscii_snespad_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
+ { USERPORT_DEVICE_SUPERPAD64, /* device id */
+ UP_C64 | UP_CBM2, /* emulators this device works on */
+ userport_superpad64_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
+#ifdef USERPORT_EXPERIMENTAL_DEVICES
+ { USERPORT_DEVICE_DIAG_586220_HARNESS, /* device id */
+ UP_C64, /* emulators this device works on */
+ userport_diag_586220_harness_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
+#endif
+ { USERPORT_DEVICE_DRIVE_PAR_CABLE, /* device id */
+ UP_C64 | UP_PLUS4, /* emulators this device works on */
+ parallel_cable_cpu_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
+ { USERPORT_DEVICE_IO_SIMULATION, /* device id */
+ UP_C64 | UP_VIC20 | UP_PLUS4 | UP_DTV | UP_PET | UP_CBM2, /* emulators this device works on */
+ userport_io_sim_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
+#ifdef HAVE_LIBCURL
+ { USERPORT_DEVICE_WIC64, /* device id */
+ UP_C64 | UP_VIC20, /* emulators this device works on */
+ userport_wic64_resources_init, /* resources init function */
+ userport_wic64_resources_shutdown, /* resources shutdown function */
+ userport_wic64_cmdline_options_init /* cmdline options init function */
+ },
+#endif
+ { USERPORT_DEVICE_SPACEBALLS, /* device id */
+ UP_C64 | UP_VIC20, /* emulators this device works on */
+ userport_spaceballs_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
+ { USERPORT_DEVICE_SPT_JOYSTICK, /* device id */
+ UP_C64 | UP_VIC20 | UP_PET | UP_CBM2, /* emulators this device works on */
+ userport_spt_joystick_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
+
+ { USERPORT_DEVICE_NONE, VICE_MACHINE_NONE, NULL, NULL, NULL }, /* end of the devices list */
+};
+
+static int userport_devices_resources_init(void)
+{
+ int i = 0;
+
+ while (userport_devices_init[i].device_id != USERPORT_DEVICE_NONE) {
+ if (userport_devices_init[i].emu_mask & machine_class) {
+ if (userport_devices_init[i].userport_device_resources_init) {
+ if (userport_devices_init[i].userport_device_resources_init() < 0) {
+ return -1;
+ }
+ }
+ }
+ i++;
+ }
+ return 0;
+}
+
+static void userport_devices_resources_shutdown(void)
+{
+ int i = 0;
+
+ while (userport_devices_init[i].device_id != USERPORT_DEVICE_NONE) {
+ if (userport_devices_init[i].emu_mask & machine_class) {
+ if (userport_devices_init[i].userport_device_resources_shutdown) {
+ userport_devices_init[i].userport_device_resources_shutdown();
+ }
+ }
+ i++;
+ }
+}
+
+
static int set_userport_device(int val, void *param)
{
return userport_set_device(val);
@@ -622,9 +846,18 @@
return -1;
}
- return machine_register_userport();
+ if (machine_register_userport() < 0) {
+ return -1;
+ }
+
+ return userport_devices_resources_init();
}
+void userport_resources_shutdown(void)
+{
+ userport_devices_resources_shutdown();
+}
+
struct userport_opt_s {
const char *name;
int id;
Modified: trunk/vice/src/userport/userport.h
===================================================================
--- trunk/vice/src/userport/userport.h 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/src/userport/userport.h 2024-08-06 18:33:38 UTC (rev 45274)
@@ -41,9 +41,9 @@
/* IMPORTANT: Do NOT put #ifdef's in this enum,
Do NOT change the order of the ID's,
- Add new devices at the end, before JOYPORT_MAX_DEVICES */
+ Add new devices at the end, before USERPORT_MAX_DEVICES */
enum {
- USERPORT_DEVICE_NONE = 0,
+ USERPORT_DEVICE_NONE = 0, /* CAUTION: some code relies on this being 0 */
USERPORT_DEVICE_PRINTER,
USERPORT_DEVICE_RS232_MODEM,
USERPORT_DEVICE_JOYSTICK_CGA,
@@ -67,7 +67,7 @@
USERPORT_DEVICE_DRIVE_PAR_CABLE,
USERPORT_DEVICE_IO_SIMULATION,
USERPORT_DEVICE_WIC64,
- USERPORT_DEVICE_SPACEBALLS,
+ USERPORT_DEVICE_SPACEBALLS, /* CAUTION: also connects to the controller port(s) */
USERPORT_DEVICE_SPT_JOYSTICK,
/* This item always needs to be at the end */
@@ -258,6 +258,15 @@
#define USERPORT26_CBM2_PIN_NIRQ USERPORT26_PIN_25
#define USERPORT26_CBM2_PIN_SP USERPORT26_PIN_26
+/* this structure is used to init all the userport devices */
+typedef struct userport_init_s {
+ int device_id; /* device ID */
+ int emu_mask; /* which emulator does the device work on */
+ int (*userport_device_resources_init)(void); /* device resources init function */
+ void (*userport_device_resources_shutdown)(void); /* device resources shutdown function */
+ int (*userport_device_cmdline_options_init)(void); /* device cmdline init function */
+} userport_init_t;
+
/* this structure is used by userport devices */
typedef struct userport_device_s {
/* Name of the device */
@@ -360,6 +369,7 @@
int userport_resources_init(void);
int userport_cmdline_options_init(void);
+void userport_resources_shutdown(void);
userport_desc_t *userport_get_valid_devices(int sort);
const char *userport_get_device_type_desc(int type);
Modified: trunk/vice/src/vic20/vic20-stubs.c
===================================================================
--- trunk/vice/src/vic20/vic20-stubs.c 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/src/vic20/vic20-stubs.c 2024-08-06 18:33:38 UTC (rev 45274)
@@ -33,6 +33,7 @@
#include "cartridge.h"
#include "pet/petpia.h"
#include "vic20.h"
+#include "c64/c64parallel.h" /* FIXME: use vic20 specific header once it exists */
/*******************************************************************************
clockport
@@ -44,3 +45,12 @@
{
return false;
}
+
+/*******************************************************************************
+ userport devices
+*******************************************************************************/
+
+int parallel_cable_cpu_resources_init(void)
+{
+ return -1;
+}
Modified: trunk/vice/src/vic20/vic20.c
===================================================================
--- trunk/vice/src/vic20/vic20.c 2024-08-06 18:17:12 UTC (rev 45273)
+++ trunk/vice/src/vic20/vic20.c 2024-08-06 18:33:38 UTC (rev 45274)
@@ -614,10 +614,6 @@
init_resource_fail("userport devices");
return -1;
}
- if (rsuser_resources_init() < 0) {
- init_resource_fail("rsuser");
- return -1;
- }
if (serial_resources_init() < 0) {
init_resource_fail("serial");
return -1;
@@ -626,16 +622,6 @@
init_resource_fail("printer");
return -1;
}
- if (printer_userport_resources_init() < 0) {
- init_resource_fail("userport printer");
- return -1;
- }
-#ifdef HAVE_LIBCURL
- if (userport_wic64_resources_init() < 0) {
- init_resource_fail("userport wic20");
- return -1;
- }
-#endif
if (init_joyport_ports() < 0) {
init_resource_fail("joyport ports");
return -1;
@@ -717,46 +703,6 @@
init_resource_fail("vic20 ieee488");
return -1;
}
- if (userport_joystick_cga_resources_init() < 0) {
- init_resource_fail("userport cga joystick");
- return -1;
- }
- if (userport_joystick_pet_resources_init() < 0) {
- init_resource_fail("userport pet joystick");
- return -1;
- }
- if (userport_joystick_oem_resources_init() < 0) {
- init_resource_fail("userport oem joystick");
- return -1;
- }
- if (userport_joystick_woj_resources_init() < 0) {
- init_resource_fail("userport woj joystick");
- return -1;
- }
- if (userport_spt_joystick_resources_init() < 0) {
- init_resource_fail("userport stupid pet tricks joystick");
- return -1;
- }
- if (userport_dac_resources_init() < 0) {
- init_resource_fail("userport dac");
- return -1;
- }
- if (userport_rtc_58321a_resources_init() < 0) {
- init_resource_fail("userport rtc (58321a)");
- return -1;
- }
- if (userport_rtc_ds1307_resources_init() < 0) {
- init_resource_fail("userport rtc (ds1307)");
- return -1;
- }
- if (userport_petscii_snespad_resources_init() < 0) {
- init_resource_fail("userport petscii snes pad");
- return -1;
- }
- if (userport_io_sim_resources_init() < 0) {
- init_resource_fail("userport I/O simulation");
- return -1;
- }
if (cartio_resources_init() < 0) {
init_resource_fail("cartio");
return -1;
@@ -788,11 +734,7 @@
fsdevice_resources_shutdown();
disk_image_resources_shutdown();
sampler_resources_shutdown();
- userport_rtc_58321a_resources_shutdown();
- userport_rtc_ds1307_resources_shutdown();
-#ifdef HAVE_LIBCURL
- userport_wic64_resources_shutdown();
-#endif
+ userport_resources_shutdown();
tapeport_resources_shutdown();
joyport_resources_shutdown();
}
@@ -825,10 +767,6 @@
init_cmdline_options_fail("rs232drv");
return -1;
}
- if (rsuser_cmdline_options_init() < 0) {
- init_cmdline_options_fail("rsuser");
- return -1;
- }
if (serial_cmdline_options_init() < 0) {
init_cmdline_options_fail("serial");
return -1;
@@ -837,10 +775,6 @@
init_cmdline_options_fail("printer");
return -1;
}
- if (printer_userport_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport printer");
- return -1;
- }
if (joyport_cmdline_options_init() < 0) {
init_cmdline_options_fail("joyport");
return -1;
@@ -925,20 +859,6 @@
init_cmdline_options_fail("vic20 ieee488");
return -1;
}
- if (userport_rtc_58321a_cmdline_options_init() < 0) {
- init_cmdline_options_fail("userport rtc (58321a)");
- return -1;
- }
- if (userport_rtc_ds1307_cmdline_options_init() < 0) {
- init_cmdline_options...
[truncated message content] |
|
From: <gp...@us...> - 2024-08-06 18:17:13
|
Revision: 45273
http://sourceforge.net/p/vice-emu/code/45273
Author: gpz
Date: 2024-08-06 18:17:12 +0000 (Tue, 06 Aug 2024)
Log Message:
-----------
fix debug message
Modified Paths:
--------------
trunk/vice/src/interrupt.h
Modified: trunk/vice/src/interrupt.h
===================================================================
--- trunk/vice/src/interrupt.h 2024-08-05 22:46:21 UTC (rev 45272)
+++ trunk/vice/src/interrupt.h 2024-08-06 18:17:12 UTC (rev 45273)
@@ -158,7 +158,7 @@
cycles are stolen from the CPU. */
#ifdef DEBUG
if (debug.maincpu_traceflg) {
- log_debug("ICLK=%lu last_stolen_cycle=%lu",
+ log_debug(LOG_DEFAULT, "ICLK=%lu last_stolen_cycle=%lu",
(unsigned long)cpu_clk,
(unsigned long)(cs->last_stolen_cycles_clk));
}
@@ -204,7 +204,7 @@
#ifdef DEBUG
if (debug.maincpu_traceflg) {
- log_debug("ICLK=%lu last_stolen_cycle=%lu",
+ log_debug(LOG_DEFAULT, "ICLK=%lu last_stolen_cycle=%lu",
(unsigned long)cpu_clk,
(unsigned long)(cs->last_stolen_cycles_clk));
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-08-05 22:46:25
|
Revision: 45272
http://sourceforge.net/p/vice-emu/code/45272
Author: gpz
Date: 2024-08-05 22:46:21 +0000 (Mon, 05 Aug 2024)
Log Message:
-----------
make ane/lxa logging options available in all emus, except scpu
Modified Paths:
--------------
trunk/vice/src/arch/gtk3/widgets/settings_environment.c
Modified: trunk/vice/src/arch/gtk3/widgets/settings_environment.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_environment.c 2024-08-05 22:28:42 UTC (rev 45271)
+++ trunk/vice/src/arch/gtk3/widgets/settings_environment.c 2024-08-05 22:46:21 UTC (rev 45272)
@@ -86,8 +86,7 @@
gtk_grid_attach(GTK_GRID(grid), logfile_widget, 0, row, 1, 1);
row++;
- if ((machine_class == VICE_MACHINE_C64SC) ||
- (machine_class == VICE_MACHINE_VIC20)) {
+ if ((machine_class != VICE_MACHINE_SCPU64)) {
grid2 = gtk_grid_new();
gtk_grid_set_column_spacing(GTK_GRID(grid2), 8);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-08-05 22:28:45
|
Revision: 45271
http://sourceforge.net/p/vice-emu/code/45271
Author: gpz
Date: 2024-08-05 22:28:42 +0000 (Mon, 05 Aug 2024)
Log Message:
-----------
add ane/lxa logging to the regular cpu core
Modified Paths:
--------------
trunk/vice/src/6510core.c
trunk/vice/src/6510dtvcore.c
trunk/vice/src/c64/c64.c
trunk/vice/src/init.c
trunk/vice/src/main65816cpu.c
trunk/vice/src/main65816cpu.h
trunk/vice/src/maincpu.c
trunk/vice/src/vic20/vic20.c
Modified: trunk/vice/src/6510core.c
===================================================================
--- trunk/vice/src/6510core.c 2024-08-05 21:57:00 UTC (rev 45270)
+++ trunk/vice/src/6510core.c 2024-08-05 22:28:42 UTC (rev 45271)
@@ -45,6 +45,11 @@
#define CPU_STR "Main CPU"
#endif
+#ifndef CPU_LOG_ID
+#define CPU_LOG_ID LOG_DEFAULT
+#warning "CPU_LOG_ID not defined, using LOG_DEFAULT by default"
+#endif
+
#include "traps.h"
#ifndef DRIVE_CPU
@@ -838,10 +843,41 @@
#define ANE_MAGIC 0xef
#define ANE_RDY_MAGIC 0xee
+#ifndef ANE_LOG_LEVEL
+#define ANE_LOG_LEVEL 0
+#warning "ANE_LOG_LEVEL not defined, disabling by default"
+#endif
+
+#if 1
+#define ANE_LOGGING(rdy) \
+ do { \
+ unsigned int result = ((reg_a_read | (rdy ? ANE_RDY_MAGIC : ANE_MAGIC)) & reg_x_read & p1); \
+ unsigned int unstablebits = ((reg_a_read ^ 0xff) & (p1 & reg_x_read)); \
+ if ((ANE_LOG_LEVEL == 2) || ((ANE_LOG_LEVEL == 1) && (unstablebits != 0))) { \
+ if (unstablebits == 0) { \
+ log_warning(CPU_LOG_ID, "$%04x ANE #$%02x ; A=$%02x X=$%02x -> A=$%02x%s", \
+ reg_pc, p1, reg_a_read, reg_x_read, result, rdy ? " (RDY cycle)" : ""); \
+ } else { \
+ log_warning(CPU_LOG_ID, "$%04x ANE #$%02x ; A=$%02x X=$%02x -> A=$%02x (unstable bits: %c%c%c%c%c%c%c%c)%s", \
+ reg_pc, p1, reg_a_read, reg_x_read, result, \
+ unstablebits & 0x80 ? '*' : '.', unstablebits & 0x40 ? '*' : '.', \
+ unstablebits & 0x20 ? '*' : '.', unstablebits & 0x10 ? '*' : '.', \
+ unstablebits & 0x08 ? '*' : '.', unstablebits & 0x04 ? '*' : '.', \
+ unstablebits & 0x02 ? '*' : '.', unstablebits & 0x01 ? '*' : '.', \
+ rdy ? " (RDY cycle)" : "" \
+ ); \
+ } \
+ } \
+ } while (0)
+#else
+#define ANE_LOGGING(rdy)
+#endif
+
#ifndef ANE
#define ANE(value, pc_inc) \
do { \
uint8_t tmp = ((reg_a_read | ANE_MAGIC) & reg_x_read & ((uint8_t)(value))); \
+ ANE_LOGGING(0); \
reg_a_write(tmp); \
LOCAL_SET_NZ(tmp); \
INC_PC(pc_inc); \
@@ -1345,10 +1381,41 @@
#define LXA_MAGIC 0xee /* needs to be 0xee for wizball */
#define LXA_RDY_MAGIC 0xee
+#ifndef LXA_LOG_LEVEL
+#define LXA_LOG_LEVEL 0
+#warning "LXA_LOG_LEVEL not defined, disabling by default"
+#endif
+
+#if 1
+#define LXA_LOGGING(rdy) \
+ do { \
+ unsigned int result = (reg_a_read | (rdy ? LXA_RDY_MAGIC : LXA_MAGIC)) & p1; \
+ unsigned int unstablebits = (reg_a_read ^ 0xff) & p1; \
+ if ((LXA_LOG_LEVEL == 2) || ((LXA_LOG_LEVEL == 1) && (unstablebits != 0))) { \
+ if (unstablebits == 0) { \
+ log_warning(CPU_LOG_ID, "$%04x LAX #$%02x ; A=$%02x -> A=X=$%02x%s", \
+ reg_pc, p1, reg_a_read, result, rdy ? " (RDY cycle)" : ""); \
+ } else { \
+ log_warning(CPU_LOG_ID, "$%04x LAX #$%02x ; A=$%02x -> A=X=$%02x (unstable bits: %c%c%c%c%c%c%c%c)%s", \
+ reg_pc, p1, reg_a_read, result, \
+ unstablebits & 0x80 ? '*' : '.', unstablebits & 0x40 ? '*' : '.', \
+ unstablebits & 0x20 ? '*' : '.', unstablebits & 0x10 ? '*' : '.', \
+ unstablebits & 0x08 ? '*' : '.', unstablebits & 0x04 ? '*' : '.', \
+ unstablebits & 0x02 ? '*' : '.', unstablebits & 0x01 ? '*' : '.', \
+ rdy ? " (RDY cycle)" : "" \
+ ); \
+ } \
+ } \
+ } while (0)
+#else
+#define LXA_LOGGING(rdy)
+#endif
+
#ifndef LXA
#define LXA(value, pc_inc) \
do { \
uint8_t tmp = ((reg_a_read | LXA_MAGIC) & ((uint8_t)(value))); \
+ LXA_LOGGING(0); \
reg_x_write(tmp); \
reg_a_write(tmp); \
LOCAL_SET_NZ(tmp); \
Modified: trunk/vice/src/6510dtvcore.c
===================================================================
--- trunk/vice/src/6510dtvcore.c 2024-08-05 21:57:00 UTC (rev 45270)
+++ trunk/vice/src/6510dtvcore.c 2024-08-05 22:28:42 UTC (rev 45271)
@@ -1277,7 +1277,6 @@
#warning "LXA_LOG_LEVEL not defined, disabling by default"
#endif
-/* FIXME: perhaps we should make the log level a user setting */
#if 1
/* static int lxa_log_level = 1; */ /* 0: none, 1: unstable only 2: all */
Modified: trunk/vice/src/c64/c64.c
===================================================================
--- trunk/vice/src/c64/c64.c 2024-08-05 21:57:00 UTC (rev 45270)
+++ trunk/vice/src/c64/c64.c 2024-08-05 22:28:42 UTC (rev 45271)
@@ -674,11 +674,13 @@
init_resource_fail("rombanks");
return -1;
}
+#if 0
/* FIXME: we might want to move this into machine.c or init.c */
if (maincpu_resources_init() < 0) {
init_resource_fail("maincpu");
return -1;
}
+#endif
if (c64_resources_init() < 0) {
init_resource_fail("c64");
return -1;
Modified: trunk/vice/src/init.c
===================================================================
--- trunk/vice/src/init.c 2024-08-05 21:57:00 UTC (rev 45270)
+++ trunk/vice/src/init.c 2024-08-05 22:28:42 UTC (rev 45271)
@@ -108,6 +108,10 @@
init_resource_fail("UI");
return -1;
}
+ if (maincpu_resources_init() < 0) {
+ init_resource_fail("main cpu");
+ return -1;
+ }
if (machine_common_resources_init() < 0) {
init_resource_fail("machine common");
return -1;
Modified: trunk/vice/src/main65816cpu.c
===================================================================
--- trunk/vice/src/main65816cpu.c 2024-08-05 21:57:00 UTC (rev 45270)
+++ trunk/vice/src/main65816cpu.c 2024-08-05 22:28:42 UTC (rev 45271)
@@ -34,6 +34,7 @@
#include "alarm.h"
#include "archdep.h"
#include "autostart.h"
+#include "cmdline.h"
#include "debug.h"
#include "interrupt.h"
#include "log.h"
@@ -41,6 +42,7 @@
#include "main65816cpu.h"
#include "mem.h"
#include "monitor.h"
+#include "resources.h"
#include "snapshot.h"
#include "traps.h"
#include "types.h"
@@ -146,6 +148,29 @@
/* ------------------------------------------------------------------------- */
+static const resource_int_t maincpu_resources_int[] = {
+ /* TODO */
+ RESOURCE_INT_LIST_END
+};
+
+int maincpu_resources_init(void)
+{
+ return resources_register_int(maincpu_resources_int);
+}
+
+static const cmdline_option_t cmdline_options_maincpu[] =
+{
+ /* TODO */
+ CMDLINE_LIST_END
+};
+
+int maincpu_cmdline_options_init(void)
+{
+ return cmdline_register_options(cmdline_options_maincpu);
+}
+
+/* ------------------------------------------------------------------------- */
+
monitor_interface_t *maincpu_monitor_interface_get(void)
{
maincpu_monitor_interface->cpu_regs = NULL;
Modified: trunk/vice/src/main65816cpu.h
===================================================================
--- trunk/vice/src/main65816cpu.h 2024-08-05 21:57:00 UTC (rev 45270)
+++ trunk/vice/src/main65816cpu.h 2024-08-05 22:28:42 UTC (rev 45271)
@@ -58,6 +58,8 @@
struct monitor_interface_s *maincpu_monitor_interface_get(void);
int maincpu_snapshot_read_module(struct snapshot_s *s);
int maincpu_snapshot_write_module(struct snapshot_s *s);
+int maincpu_resources_init(void);
+int maincpu_cmdline_options_init(void);
void maincpu_set_pc(int);
void maincpu_set_a(int);
Modified: trunk/vice/src/maincpu.c
===================================================================
--- trunk/vice/src/maincpu.c 2024-08-05 21:57:00 UTC (rev 45270)
+++ trunk/vice/src/maincpu.c 2024-08-05 22:28:42 UTC (rev 45271)
@@ -294,8 +294,32 @@
/* ------------------------------------------------------------------------- */
+int ane_log_level = 0; /* 0: none, 1: unstable only 2: all */
+int lxa_log_level = 0; /* 0: none, 1: unstable only 2: all */
+
+static int set_ane_log_level(int val, void *param)
+{
+ if ((val < 0) || (val > 2)) {
+ return -1;
+ }
+ ane_log_level = val;
+ return 0;
+}
+
+static int set_lxa_log_level(int val, void *param)
+{
+ if ((val < 0) || (val > 2)) {
+ return -1;
+ }
+ lxa_log_level = val;
+ return 0;
+}
+
static const resource_int_t maincpu_resources_int[] = {
- /* TODO: add resources */
+ { "LogLevelANE", 0, RES_EVENT_NO, NULL,
+ &ane_log_level, set_ane_log_level, NULL },
+ { "LogLevelLXA", 0, RES_EVENT_NO, NULL,
+ &lxa_log_level, set_lxa_log_level, NULL },
RESOURCE_INT_LIST_END
};
@@ -306,7 +330,12 @@
static const cmdline_option_t cmdline_options_maincpu[] =
{
- /* TODO: add options */
+ { "-aneloglevel", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
+ NULL, NULL, "LogLevelANE", NULL,
+ "<Type>", "Set ANE log level: (0: None, 1: Unstable, 2: All)" },
+ { "-lxaloglevel", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
+ NULL, NULL, "LogLevelLXA", NULL,
+ "<Type>", "Set LXA log level: (0: None, 1: Unstable, 2: All)" },
CMDLINE_LIST_END
};
@@ -551,6 +580,9 @@
machine_trigger_reset(MACHINE_RESET_MODE_RESET_CPU);
while (1) {
+#define CPU_LOG_ID maincpu_log
+#define ANE_LOG_LEVEL ane_log_level
+#define LXA_LOG_LEVEL lxa_log_level
#define CLK maincpu_clk
#define RMW_FLAG maincpu_rmw_flag
#define LAST_OPCODE_INFO last_opcode_info
@@ -726,7 +758,7 @@
static char snap_module_name[] = "MAINCPU";
#define SNAP_MAJOR 1
-#define SNAP_MINOR 2
+#define SNAP_MINOR 3
int maincpu_snapshot_write_module(snapshot_t *s)
{
@@ -764,7 +796,10 @@
|| SMW_BA(m, burst_cache, 4) < 0
|| SMW_W(m, burst_addr) < 0
|| SMW_DW(m, dtvclockneg) < 0
- || SMW_DW(m, (uint32_t)last_opcode_info) < 0) {
+ || SMW_DW(m, (uint32_t)last_opcode_info) < 0
+ || SMW_DW(m, (uint32_t)ane_log_level) < 0
+ || SMW_DW(m, (uint32_t)lxa_log_level) < 0
+ ) {
goto fail;
}
#else
@@ -775,7 +810,10 @@
|| SMW_B(m, MOS6510_REGS_GET_SP(&maincpu_regs)) < 0
|| SMW_W(m, (uint16_t)MOS6510_REGS_GET_PC(&maincpu_regs)) < 0
|| SMW_B(m, (uint8_t)MOS6510_REGS_GET_STATUS(&maincpu_regs)) < 0
- || SMW_DW(m, (uint32_t)last_opcode_info) < 0) {
+ || SMW_DW(m, (uint32_t)last_opcode_info) < 0
+ || SMW_DW(m, (uint32_t)ane_log_level) < 0
+ || SMW_DW(m, (uint32_t)lxa_log_level) < 0
+ ) {
goto fail;
}
#endif
@@ -843,7 +881,10 @@
|| SMR_W(m, &burst_addr) < 0
|| SMR_DW_INT(m, &dtvclockneg) < 0
#endif
- || SMR_DW_UINT(m, &last_opcode_info) < 0) {
+ || SMR_DW_UINT(m, &last_opcode_info) < 0
+ || SMR_DW_INT(m, &ane_log_level) < 0
+ || SMR_DW_INT(m, &lxa_log_level) < 0
+ ) {
goto fail;
}
Modified: trunk/vice/src/vic20/vic20.c
===================================================================
--- trunk/vice/src/vic20/vic20.c 2024-08-05 21:57:00 UTC (rev 45270)
+++ trunk/vice/src/vic20/vic20.c 2024-08-05 22:28:42 UTC (rev 45271)
@@ -587,11 +587,13 @@
init_resource_fail("traps");
return -1;
}
+#if 0
/* FIXME: we might want to move this into machine.c or init.c */
if (maincpu_resources_init() < 0) {
init_resource_fail("maincpu");
return -1;
}
+#endif
if (vic20_resources_init() < 0) {
init_resource_fail("vic20");
return -1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-08-05 21:57:02
|
Revision: 45270
http://sourceforge.net/p/vice-emu/code/45270
Author: gpz
Date: 2024-08-05 21:57:00 +0000 (Mon, 05 Aug 2024)
Log Message:
-----------
add log related options to sdl ui
Modified Paths:
--------------
trunk/vice/src/arch/sdl/Makefile.am
trunk/vice/src/arch/sdl/vsidui.c
trunk/vice/src/arch/sdl/x128_ui.c
trunk/vice/src/arch/sdl/x64_ui.c
trunk/vice/src/arch/sdl/x64dtv_ui.c
trunk/vice/src/arch/sdl/x64sc_ui.c
trunk/vice/src/arch/sdl/xcbm2_ui.c
trunk/vice/src/arch/sdl/xcbm5x0_ui.c
trunk/vice/src/arch/sdl/xpet_ui.c
trunk/vice/src/arch/sdl/xplus4_ui.c
trunk/vice/src/arch/sdl/xscpu64_ui.c
trunk/vice/src/arch/sdl/xvic_ui.c
trunk/vice/src/log.h
Added Paths:
-----------
trunk/vice/src/arch/sdl/menu_log.c
trunk/vice/src/arch/sdl/menu_log.h
Modified: trunk/vice/src/arch/sdl/Makefile.am
===================================================================
--- trunk/vice/src/arch/sdl/Makefile.am 2024-08-05 20:50:38 UTC (rev 45269)
+++ trunk/vice/src/arch/sdl/Makefile.am 2024-08-05 21:57:00 UTC (rev 45270)
@@ -150,6 +150,8 @@
menu_joyport.h \
menu_joystick.c \
menu_joystick.h \
+ menu_log.c \
+ menu_log.h \
menu_media.c \
menu_media.h \
menu_midi.c \
Added: trunk/vice/src/arch/sdl/menu_log.c
===================================================================
--- trunk/vice/src/arch/sdl/menu_log.c (rev 0)
+++ trunk/vice/src/arch/sdl/menu_log.c 2024-08-05 21:57:00 UTC (rev 45270)
@@ -0,0 +1,145 @@
+/*
+ * menu_log.c - Implementation of the log settings menu for the SDL UI.
+ *
+ * Written by
+ * groepaz <gr...@gm...>
+ *
+ * This file is part of VICE, the Versatile Commodore Emulator.
+ * See README for copyright notice.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307 USA.
+ *
+ */
+
+#include "vice.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "lib.h"
+#include "menu_common.h"
+#include "resources.h"
+#include "sound.h"
+#include "uiactions.h"
+#include "uifilereq.h"
+#include "uimenu.h"
+#include "util.h"
+
+#include "menu_log.h"
+
+UI_MENU_DEFINE_STRING(LogFileName);
+UI_MENU_DEFINE_TOGGLE(LogToFile)
+UI_MENU_DEFINE_TOGGLE(LogToStdout)
+UI_MENU_DEFINE_TOGGLE(LogToMonitor)
+UI_MENU_DEFINE_RADIO(LogLimit)
+UI_MENU_DEFINE_RADIO(LogLevelANE)
+UI_MENU_DEFINE_RADIO(LogLevelLXA)
+
+static ui_menu_entry_t log_limit_menu[] = {
+ { .string = "silent",
+ .type = MENU_ENTRY_RESOURCE_RADIO,
+ .callback = radio_LogLimit_callback,
+ .data = (ui_callback_data_t)LOG_LIMIT_SILENT
+ },
+ { .string = "standard",
+ .type = MENU_ENTRY_RESOURCE_RADIO,
+ .callback = radio_LogLimit_callback,
+ .data = (ui_callback_data_t)LOG_LIMIT_STANDARD
+ },
+ { .string = "verbose",
+ .type = MENU_ENTRY_RESOURCE_RADIO,
+ .callback = radio_LogLimit_callback,
+ .data = (ui_callback_data_t)LOG_LIMIT_VERBOSE
+ },
+ { .string = "debug (all)",
+ .type = MENU_ENTRY_RESOURCE_RADIO,
+ .callback = radio_LogLimit_callback,
+ .data = (ui_callback_data_t)LOG_LIMIT_DEBUG
+ },
+ SDL_MENU_LIST_END
+};
+
+const ui_menu_entry_t log_menu[] = {
+ { .string = "Log to file",
+ .type = MENU_ENTRY_RESOURCE_TOGGLE,
+ .callback = toggle_LogToFile_callback
+ },
+ { .string = "File name",
+ .type = MENU_ENTRY_RESOURCE_STRING,
+ .callback = string_LogFileName_callback,
+ .data = (ui_callback_data_t)"Set log file"
+ },
+ { .string = "Log to stdout",
+ .type = MENU_ENTRY_RESOURCE_TOGGLE,
+ .callback = toggle_LogToStdout_callback
+ },
+ { .string = "Log to monitor",
+ .type = MENU_ENTRY_RESOURCE_TOGGLE,
+ .callback = toggle_LogToMonitor_callback
+ },
+ SDL_MENU_ITEM_SEPARATOR,
+
+ { .string = "Log Limit",
+ .type = MENU_ENTRY_SUBMENU,
+ .callback = submenu_radio_callback,
+ .data = (ui_callback_data_t)log_limit_menu
+ },
+ SDL_MENU_ITEM_SEPARATOR,
+
+ SDL_MENU_ITEM_TITLE("ANE log limit"),
+ { .string = "none",
+ .type = MENU_ENTRY_RESOURCE_RADIO,
+ .callback = radio_LogLevelANE_callback,
+ .data = (ui_callback_data_t)0
+ },
+ { .string = "unstable only",
+ .type = MENU_ENTRY_RESOURCE_RADIO,
+ .callback = radio_LogLevelANE_callback,
+ .data = (ui_callback_data_t)1
+ },
+ { .string = "all",
+ .type = MENU_ENTRY_RESOURCE_RADIO,
+ .callback = radio_LogLevelANE_callback,
+ .data = (ui_callback_data_t)2
+ },
+ SDL_MENU_ITEM_SEPARATOR,
+
+ SDL_MENU_ITEM_TITLE("LXA log limit"),
+ { .string = "none",
+ .type = MENU_ENTRY_RESOURCE_RADIO,
+ .callback = radio_LogLevelLXA_callback,
+ .data = (ui_callback_data_t)0
+ },
+ { .string = "unstable only",
+ .type = MENU_ENTRY_RESOURCE_RADIO,
+ .callback = radio_LogLevelLXA_callback,
+ .data = (ui_callback_data_t)1
+ },
+ { .string = "all",
+ .type = MENU_ENTRY_RESOURCE_RADIO,
+ .callback = radio_LogLevelLXA_callback,
+ .data = (ui_callback_data_t)2
+ },
+ SDL_MENU_LIST_END
+};
+
+/** \brief Clean up memory used by the dynamically created sound output menus
+ */
+void log_menu_shutdown(void)
+{
+
+}
Added: trunk/vice/src/arch/sdl/menu_log.h
===================================================================
--- trunk/vice/src/arch/sdl/menu_log.h (rev 0)
+++ trunk/vice/src/arch/sdl/menu_log.h 2024-08-05 21:57:00 UTC (rev 45270)
@@ -0,0 +1,38 @@
+/*
+ * menu_log.h - Implementation of the log settings menu for the SDL UI.
+ *
+ * Written by
+ * groepaz <gr...@gm...>
+ *
+ * This file is part of VICE, the Versatile Commodore Emulator.
+ * See README for copyright notice.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307 USA.
+ *
+ */
+
+#ifndef VICE_UIMENU_LOG_H
+#define VICE_UIMENU_LOG_H
+
+#include "vice.h"
+
+#include "uimenu.h"
+
+extern const ui_menu_entry_t log_menu[];
+
+void log_menu_shutdown(void);
+
+#endif
Modified: trunk/vice/src/arch/sdl/vsidui.c
===================================================================
--- trunk/vice/src/arch/sdl/vsidui.c 2024-08-05 20:50:38 UTC (rev 45269)
+++ trunk/vice/src/arch/sdl/vsidui.c 2024-08-05 21:57:00 UTC (rev 45270)
@@ -48,6 +48,7 @@
#include "menu_debug.h"
#include "menu_help.h"
#include "menu_jam.h"
+#include "menu_log.h"
#include "menu_monitor.h"
#include "menu_reset.h"
#include "menu_settings.h"
@@ -461,6 +462,11 @@
.callback = submenu_callback,
.data = (ui_callback_data_t)settings_manager_menu_vsid
},
+ { .string = "Log settings",
+ .type = MENU_ENTRY_SUBMENU,
+ .callback = submenu_callback,
+ .data = (ui_callback_data_t)log_menu
+ },
{ .action = ACTION_QUIT,
.string = "Quit emulator",
.type = MENU_ENTRY_OTHER
Modified: trunk/vice/src/arch/sdl/x128_ui.c
===================================================================
--- trunk/vice/src/arch/sdl/x128_ui.c 2024-08-05 20:50:38 UTC (rev 45269)
+++ trunk/vice/src/arch/sdl/x128_ui.c 2024-08-05 21:57:00 UTC (rev 45270)
@@ -51,6 +51,7 @@
#include "menu_jam.h"
#include "menu_joyport.h"
#include "menu_joystick.h"
+#include "menu_log.h"
#include "menu_media.h"
#include "menu_midi.h"
#include "menu_monitor.h"
@@ -202,6 +203,11 @@
.callback = submenu_callback,
.data = (ui_callback_data_t)settings_manager_menu
},
+ { .string = "Log settings",
+ .type = MENU_ENTRY_SUBMENU,
+ .callback = submenu_callback,
+ .data = (ui_callback_data_t)log_menu
+ },
#ifdef USE_SDL2UI
{ .string = "Edit",
.type = MENU_ENTRY_SUBMENU,
Modified: trunk/vice/src/arch/sdl/x64_ui.c
===================================================================
--- trunk/vice/src/arch/sdl/x64_ui.c 2024-08-05 20:50:38 UTC (rev 45269)
+++ trunk/vice/src/arch/sdl/x64_ui.c 2024-08-05 21:57:00 UTC (rev 45270)
@@ -51,6 +51,7 @@
#include "menu_jam.h"
#include "menu_joyport.h"
#include "menu_joystick.h"
+#include "menu_log.h"
#include "menu_media.h"
#include "menu_midi.h"
#include "menu_monitor.h"
@@ -209,6 +210,11 @@
.callback = submenu_callback,
.data = (ui_callback_data_t)settings_manager_menu
},
+ { .string = "Log settings",
+ .type = MENU_ENTRY_SUBMENU,
+ .callback = submenu_callback,
+ .data = (ui_callback_data_t)log_menu
+ },
#ifdef USE_SDL2UI
{ .string = "Edit",
.type = MENU_ENTRY_SUBMENU,
Modified: trunk/vice/src/arch/sdl/x64dtv_ui.c
===================================================================
--- trunk/vice/src/arch/sdl/x64dtv_ui.c 2024-08-05 20:50:38 UTC (rev 45269)
+++ trunk/vice/src/arch/sdl/x64dtv_ui.c 2024-08-05 21:57:00 UTC (rev 45270)
@@ -46,6 +46,7 @@
#include "menu_jam.h"
#include "menu_joyport.h"
#include "menu_joystick.h"
+#include "menu_log.h"
#include "menu_media.h"
#include "menu_monitor.h"
#include "menu_network.h"
@@ -180,6 +181,11 @@
.callback = submenu_callback,
.data = (ui_callback_data_t)settings_manager_menu
},
+ { .string = "Log settings",
+ .type = MENU_ENTRY_SUBMENU,
+ .callback = submenu_callback,
+ .data = (ui_callback_data_t)log_menu
+ },
#ifdef USE_SDL2UI
{ .string = "Edit",
.type = MENU_ENTRY_SUBMENU,
Modified: trunk/vice/src/arch/sdl/x64sc_ui.c
===================================================================
--- trunk/vice/src/arch/sdl/x64sc_ui.c 2024-08-05 20:50:38 UTC (rev 45269)
+++ trunk/vice/src/arch/sdl/x64sc_ui.c 2024-08-05 21:57:00 UTC (rev 45270)
@@ -51,6 +51,7 @@
#include "menu_jam.h"
#include "menu_joyport.h"
#include "menu_joystick.h"
+#include "menu_log.h"
#include "menu_media.h"
#include "menu_midi.h"
#include "menu_monitor.h"
@@ -210,6 +211,11 @@
.callback = submenu_callback,
.data = (ui_callback_data_t)settings_manager_menu
},
+ { .string = "Log settings",
+ .type = MENU_ENTRY_SUBMENU,
+ .callback = submenu_callback,
+ .data = (ui_callback_data_t)log_menu
+ },
#ifdef USE_SDL2UI
{ .string = "Edit",
.type = MENU_ENTRY_SUBMENU,
Modified: trunk/vice/src/arch/sdl/xcbm2_ui.c
===================================================================
--- trunk/vice/src/arch/sdl/xcbm2_ui.c 2024-08-05 20:50:38 UTC (rev 45269)
+++ trunk/vice/src/arch/sdl/xcbm2_ui.c 2024-08-05 21:57:00 UTC (rev 45270)
@@ -50,6 +50,7 @@
#include "menu_jam.h"
#include "menu_joyport.h"
#include "menu_joystick.h"
+#include "menu_log.h"
#include "menu_media.h"
#include "menu_monitor.h"
#include "menu_network.h"
@@ -191,6 +192,11 @@
.callback = submenu_callback,
.data = (ui_callback_data_t)settings_manager_menu
},
+ { .string = "Log settings",
+ .type = MENU_ENTRY_SUBMENU,
+ .callback = submenu_callback,
+ .data = (ui_callback_data_t)log_menu
+ },
#ifdef USE_SDL2UI
{ .string = "Edit",
.type = MENU_ENTRY_SUBMENU,
Modified: trunk/vice/src/arch/sdl/xcbm5x0_ui.c
===================================================================
--- trunk/vice/src/arch/sdl/xcbm5x0_ui.c 2024-08-05 20:50:38 UTC (rev 45269)
+++ trunk/vice/src/arch/sdl/xcbm5x0_ui.c 2024-08-05 21:57:00 UTC (rev 45270)
@@ -50,6 +50,7 @@
#include "menu_jam.h"
#include "menu_joyport.h"
#include "menu_joystick.h"
+#include "menu_log.h"
#include "menu_media.h"
#include "menu_monitor.h"
#include "menu_network.h"
@@ -194,6 +195,11 @@
.callback = submenu_callback,
.data = (ui_callback_data_t)settings_manager_menu
},
+ { .string = "Log settings",
+ .type = MENU_ENTRY_SUBMENU,
+ .callback = submenu_callback,
+ .data = (ui_callback_data_t)log_menu
+ },
#ifdef USE_SDL2UI
{ .string = "Edit",
.type = MENU_ENTRY_SUBMENU,
Modified: trunk/vice/src/arch/sdl/xpet_ui.c
===================================================================
--- trunk/vice/src/arch/sdl/xpet_ui.c 2024-08-05 20:50:38 UTC (rev 45269)
+++ trunk/vice/src/arch/sdl/xpet_ui.c 2024-08-05 21:57:00 UTC (rev 45270)
@@ -44,6 +44,7 @@
#include "menu_jam.h"
#include "menu_joyport.h"
#include "menu_joystick.h"
+#include "menu_log.h"
#include "menu_media.h"
#include "menu_monitor.h"
#include "menu_network.h"
@@ -196,6 +197,11 @@
.callback = submenu_callback,
.data = (ui_callback_data_t)settings_manager_menu
},
+ { .string = "Log settings",
+ .type = MENU_ENTRY_SUBMENU,
+ .callback = submenu_callback,
+ .data = (ui_callback_data_t)log_menu
+ },
#ifdef USE_SDL2UI
{ .string = "Edit",
.type = MENU_ENTRY_SUBMENU,
Modified: trunk/vice/src/arch/sdl/xplus4_ui.c
===================================================================
--- trunk/vice/src/arch/sdl/xplus4_ui.c 2024-08-05 20:50:38 UTC (rev 45269)
+++ trunk/vice/src/arch/sdl/xplus4_ui.c 2024-08-05 21:57:00 UTC (rev 45270)
@@ -43,6 +43,7 @@
#include "menu_jam.h"
#include "menu_joyport.h"
#include "menu_joystick.h"
+#include "menu_log.h"
#include "menu_media.h"
#include "menu_monitor.h"
#include "menu_network.h"
@@ -199,6 +200,11 @@
.callback = submenu_callback,
.data = (ui_callback_data_t)settings_manager_menu
},
+ { .string = "Log settings",
+ .type = MENU_ENTRY_SUBMENU,
+ .callback = submenu_callback,
+ .data = (ui_callback_data_t)log_menu
+ },
#ifdef USE_SDL2UI
{ .string = "Edit",
.type = MENU_ENTRY_SUBMENU,
Modified: trunk/vice/src/arch/sdl/xscpu64_ui.c
===================================================================
--- trunk/vice/src/arch/sdl/xscpu64_ui.c 2024-08-05 20:50:38 UTC (rev 45269)
+++ trunk/vice/src/arch/sdl/xscpu64_ui.c 2024-08-05 21:57:00 UTC (rev 45270)
@@ -47,6 +47,7 @@
#include "menu_jam.h"
#include "menu_joyport.h"
#include "menu_joystick.h"
+#include "menu_log.h"
#include "menu_media.h"
#include "menu_midi.h"
#include "menu_monitor.h"
@@ -200,6 +201,11 @@
.callback = submenu_callback,
.data = (ui_callback_data_t)settings_manager_menu
},
+ { .string = "Log settings",
+ .type = MENU_ENTRY_SUBMENU,
+ .callback = submenu_callback,
+ .data = (ui_callback_data_t)log_menu
+ },
#ifdef USE_SDL2UI
{ .string = "Edit",
.type = MENU_ENTRY_SUBMENU,
Modified: trunk/vice/src/arch/sdl/xvic_ui.c
===================================================================
--- trunk/vice/src/arch/sdl/xvic_ui.c 2024-08-05 20:50:38 UTC (rev 45269)
+++ trunk/vice/src/arch/sdl/xvic_ui.c 2024-08-05 21:57:00 UTC (rev 45270)
@@ -45,6 +45,7 @@
#include "menu_jam.h"
#include "menu_joyport.h"
#include "menu_joystick.h"
+#include "menu_log.h"
#include "menu_media.h"
#include "menu_midi.h"
#include "menu_monitor.h"
@@ -198,6 +199,11 @@
.callback = submenu_callback,
.data = (ui_callback_data_t)settings_manager_menu
},
+ { .string = "Log settings",
+ .type = MENU_ENTRY_SUBMENU,
+ .callback = submenu_callback,
+ .data = (ui_callback_data_t)log_menu
+ },
#ifdef USE_SDL2UI
{ .string = "Edit",
.type = MENU_ENTRY_SUBMENU,
Modified: trunk/vice/src/log.h
===================================================================
--- trunk/vice/src/log.h 2024-08-05 20:50:38 UTC (rev 45269)
+++ trunk/vice/src/log.h 2024-08-05 21:57:00 UTC (rev 45270)
@@ -3,6 +3,7 @@
*
* Written by
* Ettore Perazzoli <et...@co...>
+ * groepaz <gr...@gm...>
*
* This file is part of VICE, the Versatile Commodore Emulator.
* See README for copyright notice.
@@ -48,7 +49,7 @@
/* all messages, except debug */
#define LOG_LIMIT_VERBOSE (LOG_LEVEL_DEBUG - 1)
/* all messages */
-#define LOG_LIMIT_DEBUG (LOG_LEVEL_ALL - 1)
+#define LOG_LIMIT_DEBUG (LOG_LEVEL_ALL)
int log_set_limit_early(int n);
int log_early_init(int argc, char **argv);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-08-05 20:50:43
|
Revision: 45269
http://sourceforge.net/p/vice-emu/code/45269
Author: gpz
Date: 2024-08-05 20:50:38 +0000 (Mon, 05 Aug 2024)
Log Message:
-----------
support for AutostartDropMode in the SDL UI
Modified Paths:
--------------
trunk/vice/src/arch/sdl/menu_drive.c
trunk/vice/src/arch/sdl/ui.c
Modified: trunk/vice/src/arch/sdl/menu_drive.c
===================================================================
--- trunk/vice/src/arch/sdl/menu_drive.c 2024-08-05 16:20:27 UTC (rev 45268)
+++ trunk/vice/src/arch/sdl/menu_drive.c 2024-08-05 20:50:38 UTC (rev 45269)
@@ -27,6 +27,7 @@
#include "vice.h"
#include "attach.h"
+#include "autostart.h"
#include "autostart-prg.h"
#include "charset.h"
#include "drive.h"
@@ -1223,6 +1224,7 @@
UI_MENU_DEFINE_TOGGLE(AutostartBasicLoad)
UI_MENU_DEFINE_TOGGLE(AutostartTapeBasicLoad)
UI_MENU_DEFINE_TOGGLE(AutostartRunWithColon)
+UI_MENU_DEFINE_RADIO(AutostartDropMode)
UI_MENU_DEFINE_RADIO(AutostartPrgMode)
UI_MENU_DEFINE_STRING(AutostartPrgDiskImage)
@@ -1297,7 +1299,7 @@
},
SDL_MENU_ITEM_SEPARATOR,
- SDL_MENU_ITEM_TITLE("Autostart PRG mode"),
+ SDL_MENU_ITEM_TITLE("PRG Autostart mode"),
{ .string = "VirtualFS",
.type = MENU_ENTRY_RESOURCE_RADIO,
.callback = radio_AutostartPrgMode_callback,
@@ -1315,11 +1317,30 @@
},
SDL_MENU_ITEM_SEPARATOR,
- { .string = "Autostart disk image",
+ { .string = "Autostart disk",
.type = MENU_ENTRY_RESOURCE_STRING,
.callback = string_AutostartPrgDiskImage_callback,
.data = (ui_callback_data_t)"Disk image for autostarting PRG files"
},
+ SDL_MENU_ITEM_SEPARATOR,
+
+ SDL_MENU_ITEM_TITLE("Autostart drag'n drop mode"),
+ { .string = "Attach image",
+ .type = MENU_ENTRY_RESOURCE_RADIO,
+ .callback = radio_AutostartDropMode_callback,
+ .data = (ui_callback_data_t)AUTOSTART_DROP_MODE_ATTACH
+ },
+ { .string = "Load",
+ .type = MENU_ENTRY_RESOURCE_RADIO,
+ .callback = radio_AutostartDropMode_callback,
+ .data = (ui_callback_data_t)AUTOSTART_DROP_MODE_LOAD
+ },
+ { .string = "Load and Run",
+ .type = MENU_ENTRY_RESOURCE_RADIO,
+ .callback = radio_AutostartDropMode_callback,
+ .data = (ui_callback_data_t)AUTOSTART_DROP_MODE_RUN
+ },
+
SDL_MENU_LIST_END
};
Modified: trunk/vice/src/arch/sdl/ui.c
===================================================================
--- trunk/vice/src/arch/sdl/ui.c 2024-08-05 16:20:27 UTC (rev 45268)
+++ trunk/vice/src/arch/sdl/ui.c 2024-08-05 20:50:38 UTC (rev 45269)
@@ -35,6 +35,7 @@
#include "vice_sdl.h"
#include <stdio.h>
+#include "attach.h"
#include "autostart.h"
#include "cmdline.h"
#include "archdep.h"
@@ -202,8 +203,23 @@
#else
case SDL_DROPFILE:
if (machine_class != VICE_MACHINE_VSID) {
- if (autostart_autodetect(e.drop.file, NULL, 0,
- AUTOSTART_MODE_RUN) < 0) {
+ int drop_mode = 0;
+ int res = 0;
+ resources_get_int("AutostartDropMode", &drop_mode);
+ switch (drop_mode) {
+ case AUTOSTART_DROP_MODE_ATTACH:
+ res = file_system_attach_disk(8, 0, e.drop.file);
+ break;
+ case AUTOSTART_DROP_MODE_LOAD:
+ res = autostart_autodetect(e.drop.file, NULL, 0, AUTOSTART_MODE_LOAD);
+ break;
+ case AUTOSTART_DROP_MODE_RUN:
+ res = autostart_autodetect(e.drop.file, NULL, 0, AUTOSTART_MODE_RUN);
+ break;
+ default:
+ break;
+ }
+ if (res < 0) {
ui_error("Cannot autostart specified file.");
}
} else {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-08-05 16:20:29
|
Revision: 45268
http://sourceforge.net/p/vice-emu/code/45268
Author: gpz
Date: 2024-08-05 16:20:27 +0000 (Mon, 05 Aug 2024)
Log Message:
-----------
some more log cosmetics
Modified Paths:
--------------
trunk/vice/src/arch/shared/hwsiddrv/ps-ieee1284.c
trunk/vice/src/arch/shared/hwsiddrv/ps-unix-file.c
trunk/vice/src/arch/shared/mididrv/midi-unix-drv.c
trunk/vice/src/log.c
trunk/vice/src/resources.c
trunk/vice/src/viciisc/vicii.c
Modified: trunk/vice/src/arch/shared/hwsiddrv/ps-ieee1284.c
===================================================================
--- trunk/vice/src/arch/shared/hwsiddrv/ps-ieee1284.c 2024-08-05 15:02:30 UTC (rev 45267)
+++ trunk/vice/src/arch/shared/hwsiddrv/ps-ieee1284.c 2024-08-05 16:20:27 UTC (rev 45268)
@@ -53,6 +53,8 @@
#define MAXSID 3
+static log_t sid_log = LOG_DEFAULT;
+
static int sids_found = -1;
static int pssids[MAXSID] = {-1, -1, -1};
@@ -170,6 +172,10 @@
int cap;
int retval;
+ if (sid_log == LOG_DEFAULT) {
+ sid_log = log_open("PARSID1284");
+ }
+
if (!sids_found) {
return -1;
}
@@ -180,7 +186,7 @@
sids_found = 0;
- log_message(LOG_DEFAULT, "Detecting libieee1284 ParSIDs.");
+ log_message(sid_log, "Detecting libieee1284 ParSIDs.");
if (ieee1284_find_ports(&parlist, 0) != E1284_OK) {
return -1;
@@ -204,11 +210,11 @@
}
if (!sids_found) {
- log_message(LOG_DEFAULT, "No libieee1284 ParSIDs found.");
+ log_message(sid_log, "No libieee1284 ParSIDs found.");
return -1;
}
- log_message(LOG_DEFAULT, "Libieee1284 ParSID: opened, found %d SIDs.", sids_found);
+ log_message(sid_log, "Libieee1284 ParSID: opened, found %d SIDs.", sids_found);
return 0;
}
@@ -222,7 +228,7 @@
ieee1284_close(parlist.portv[pssids[i]]);
pssids[i] = -1;
}
- log_message(LOG_DEFAULT, "Libieee1284 ParSID: closed.");
+ log_message(sid_log, "Libieee1284 ParSID: closed.");
return 0;
}
Modified: trunk/vice/src/arch/shared/hwsiddrv/ps-unix-file.c
===================================================================
--- trunk/vice/src/arch/shared/hwsiddrv/ps-unix-file.c 2024-08-05 15:02:30 UTC (rev 45267)
+++ trunk/vice/src/arch/shared/hwsiddrv/ps-unix-file.c 2024-08-05 16:20:27 UTC (rev 45268)
@@ -52,6 +52,8 @@
#include "sid-resources.h"
#include "types.h"
+static log_t sid_log = LOG_DEFAULT;
+
#define MAXSID 3
#ifdef HAVE_LINUX_PARPORT_HEADERS
@@ -147,6 +149,10 @@
int i;
int mode = IEEE1284_MODE_COMPAT;
+ if (sid_log == LOG_DEFAULT) {
+ sid_log = log_open("PARSID");
+ }
+
if (!sids_found) {
return -1;
}
@@ -157,7 +163,7 @@
sids_found = 0;
- log_message(LOG_DEFAULT, "Detecting Linux ParSIDs.");
+ log_message(sid_log, "Detecting Linux ParSIDs.");
for (i = 0; i < MAXSID; ++i) {
pssids[sids_found] = open(parport_name[i], O_RDWR);
@@ -166,33 +172,33 @@
if (!ioctl(pssids[sids_found], PPNEGOT, &mode)) {
if (detect_sid(sids_found)) {
sids_found++;
- log_message(LOG_DEFAULT, "PARSID found on %s.", parport_name[i]);
+ log_message(sid_log, "PARSID found on %s.", parport_name[i]);
} else {
- log_message(LOG_DEFAULT, "No ParSID on %s.", parport_name[i]);
+ log_message(sid_log, "No ParSID on %s.", parport_name[i]);
close(pssids[sids_found]);
pssids[sids_found] = -1;
}
} else {
- log_message(LOG_DEFAULT, "Could not set correct mode for %s.", parport_name[i]);
+ log_message(sid_log, "Could not set correct mode for %s.", parport_name[i]);
close(pssids[sids_found]);
pssids[sids_found] = -1;
}
} else {
- log_message(LOG_DEFAULT, "Could not claim %s.", parport_name[i]);
+ log_message(sid_log, "Could not claim %s.", parport_name[i]);
close(pssids[sids_found]);
pssids[sids_found] = -1;
}
} else {
- log_message(LOG_DEFAULT, "Could not open %s.", parport_name[i]);
+ log_message(sid_log, "Could not open %s.", parport_name[i]);
}
}
if (!sids_found) {
- log_message(LOG_DEFAULT, "No Linux ParSIDs found.");
+ log_message(sid_log, "No Linux ParSIDs found.");
return -1;
}
- log_message(LOG_DEFAULT, "Linux ParSID: opened, found %d SIDs.", sids_found);
+ log_message(sid_log, "Linux ParSID: opened, found %d SIDs.", sids_found);
return 0;
}
@@ -208,7 +214,7 @@
}
}
- log_message(LOG_DEFAULT, "Linux ParSID: closed.");
+ log_message(sid_log, "Linux ParSID: closed.");
return 0;
}
@@ -300,7 +306,7 @@
sids_found = 0;
- log_message(LOG_DEFAULT, "Detecting FreeBSD ParSIDs.");
+ log_message(sid_log, "Detecting FreeBSD ParSIDs.");
for (i = 0; i < MAXSID; ++i) {
pssids[sids_found] = open(parport_name[i], O_RDWR);
@@ -307,23 +313,23 @@
if (pssids[sids_found] != -1) {
if (detect_sid(sids_found)) {
sids_found++;
- log_message(LOG_DEFAULT, "PARSID found on %s.", parport_name[i]);
+ log_message(sid_log, "PARSID found on %s.", parport_name[i]);
} else {
- log_message(LOG_DEFAULT, "No ParSID on %s.", parport_name[i]);
+ log_message(sid_log, "No ParSID on %s.", parport_name[i]);
close(pssids[sids_found]);
pssids[sids_found] = -1;
}
} else {
- log_message(LOG_DEFAULT, "Could not open %s.", parport_name[i]);
+ log_message(sid_log, "Could not open %s.", parport_name[i]);
}
}
if (!sids_found) {
- log_message(LOG_DEFAULT, "No FreeBSD ParSIDs found.");
+ log_message(sid_log, "No FreeBSD ParSIDs found.");
return -1;
}
- log_message(LOG_DEFAULT, "FreeBSD ParSID: opened, found %d SIDs.", sids_found);
+ log_message(sid_log, "FreeBSD ParSID: opened, found %d SIDs.", sids_found);
return 0;
}
@@ -339,7 +345,7 @@
}
}
- log_message(LOG_DEFAULT, "FreeBSD ParSID: closed.");
+ log_message(sid_log, "FreeBSD ParSID: closed.");
return 0;
}
Modified: trunk/vice/src/arch/shared/mididrv/midi-unix-drv.c
===================================================================
--- trunk/vice/src/arch/shared/mididrv/midi-unix-drv.c 2024-08-05 15:02:30 UTC (rev 45267)
+++ trunk/vice/src/arch/shared/mididrv/midi-unix-drv.c 2024-08-05 16:20:27 UTC (rev 45268)
@@ -441,6 +441,9 @@
/** a function to destroy ALSA MIDI objects */
static void mididrv_alsa_shutdown(void)
{
+ if (mididrv_log == LOG_DEFAULT) {
+ mididrv_log = log_open("ALSA MIDI");
+ }
#if 0
#ifdef DEBUG_MIDI
log_message(mididrv_log, "alsa_shutdown");
@@ -471,6 +474,10 @@
{
int alsa_err;
+ if (mididrv_log == LOG_DEFAULT) {
+ mididrv_log = log_open("ALSA MIDI");
+ }
+
#ifdef DEBUG_MIDI
log_message(mididrv_log, "alsa_init");
#endif
Modified: trunk/vice/src/log.c
===================================================================
--- trunk/vice/src/log.c 2024-08-05 15:02:30 UTC (rev 45267)
+++ trunk/vice/src/log.c 2024-08-05 16:20:27 UTC (rev 45268)
@@ -3,6 +3,7 @@
*
* Written by
* Ettore Perazzoli <et...@co...>
+ * groepaz <gr...@gm...>
*
* This file is part of VICE, the Versatile Commodore Emulator.
* See README for copyright notice.
@@ -516,9 +517,21 @@
log_t i;
LOCK();
-
+#if 0
+ /* first check if we have a log with the same tag */
+ /* FIXME: this is costly and stupid - we should use something with a hash
+ table or whatever else is quicker */
for (i = 0; i < num_logs; i++) {
if (logs[i] == NULL) {
+ if (!strcmp(id, logs[i])) {
+ printf("log_open(%s) exists: %d\n", id, (int)new_log);
+ UNLOCK_AND_RETURN_INT(i);
+ }
+ }
+ }
+#endif
+ for (i = 0; i < num_logs; i++) {
+ if (logs[i] == NULL) {
new_log = i;
break;
}
@@ -530,9 +543,8 @@
logs[new_log] = lib_strdup(id);
- /* printf("log_open(%s) = %d\n", id, (int)new_log); */
- UNLOCK();
- return new_log;
+ /*printf("log_open(%s) = %d\n", id, (int)new_log);*/
+ UNLOCK_AND_RETURN_INT(new_log);
}
int log_close(log_t log)
@@ -539,7 +551,7 @@
{
LOCK();
- /* printf("log_close(%d)\n", (int)log); */
+ /*printf("log_close(%s) = %d\n", logs[(unsigned int)log], (int)log);*/
if (logs[(unsigned int)log] == NULL) {
UNLOCK_AND_RETURN_INT(-1);
}
@@ -628,6 +640,8 @@
return rc;
}
+/* works like strdup, but produces a copy of the string which does
+ not contain any escape sequences in the form 0x1b [ xxx m */
static char *logskipcolors(char *txt)
{
char *p = lib_strdup(txt);
@@ -670,7 +684,7 @@
const char *lvlstr = level_strings[(level >> 5) & 7];
- const signed int logi = (signed int)log;
+ signed int logi = (signed int)log;
int rc = 0;
char *pretxt = NULL;
char *logtxt = NULL;
@@ -686,17 +700,17 @@
}
if (logi != LOG_DEFAULT) {
- if ((logs == NULL) || (logi < 0)|| (logi >= num_logs) || (logs[logi] == NULL)) {
- DBG(("log_helper: internal error (invalid id or closed log), messages follows:\n"));
- return -1;
+ if ((logs == NULL) || (logi < 0) || (logi >= num_logs) || (logs[logi] == NULL)) {
+ DBG(("log_helper: internal error (invalid id or closed log), message follows:\n"));
+ logi = LOG_DEFAULT;
}
}
/* prepend the log_t prefix, and the loglevel string */
- if ((log_file != NULL) && (logi != LOG_DEFAULT) && (*logs[logi] != '\0')) {
+ if ((logi == LOG_DEFAULT) || (*logs[logi] == '\0')) {
+ pretxt = lib_msprintf("%s", lvlstr);
+ } else {
pretxt = lib_msprintf(LOG_COL_LWHITE "%s" LOG_COL_OFF ": %s", logs[logi], lvlstr);
- } else {
- pretxt = lib_msprintf("%s", lvlstr);
}
/* build the log string */
logtxt = lib_mvsprintf(format, ap);
Modified: trunk/vice/src/resources.c
===================================================================
--- trunk/vice/src/resources.c 2024-08-05 15:02:30 UTC (rev 45267)
+++ trunk/vice/src/resources.c 2024-08-05 16:20:27 UTC (rev 45268)
@@ -998,7 +998,7 @@
if (resource_modified_callback != NULL) {
resources_exec_callback_chain(resource_modified_callback, NULL);
}
- log_message(LOG_DEFAULT, "Done setting resources to default.");
+ log_verbose(LOG_DEFAULT, "Done setting resources to default.");
return 0;
}
Modified: trunk/vice/src/viciisc/vicii.c
===================================================================
--- trunk/vice/src/viciisc/vicii.c 2024-08-05 15:02:30 UTC (rev 45267)
+++ trunk/vice/src/viciisc/vicii.c 2024-08-05 16:20:27 UTC (rev 45268)
@@ -252,6 +252,8 @@
return NULL;
}
+ /* log_debug(LOG_DEFAULT, "vicii_init(%d)", flag); */
+
vicii.log = log_open("VIC-II");
vicii_chip_model_init();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-08-05 15:02:36
|
Revision: 45267
http://sourceforge.net/p/vice-emu/code/45267
Author: gpz
Date: 2024-08-05 15:02:30 +0000 (Mon, 05 Aug 2024)
Log Message:
-----------
remove LOG_ERR, it never worked any different than LOG_DEFAULT in the first place. To log errors, use log_error instead of log_message.
Modified Paths:
--------------
trunk/vice/src/aciacore.c
trunk/vice/src/arch/gtk3/actions-help.c
trunk/vice/src/arch/gtk3/directx_renderer_impl.cc
trunk/vice/src/arch/gtk3/hotkeys.c
trunk/vice/src/arch/gtk3/joystickdrv/joystick_linux.c
trunk/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c
trunk/vice/src/arch/gtk3/ui.c
trunk/vice/src/arch/gtk3/uidata.c
trunk/vice/src/arch/gtk3/uidiskattach.c
trunk/vice/src/arch/gtk3/uimedia.c
trunk/vice/src/arch/gtk3/uisettings.c
trunk/vice/src/arch/gtk3/uismartattach.c
trunk/vice/src/arch/gtk3/uistatusbar.c
trunk/vice/src/arch/gtk3/uitapeattach.c
trunk/vice/src/arch/gtk3/video.c
trunk/vice/src/arch/gtk3/widgets/base/cartridgewidgets.c
trunk/vice/src/arch/gtk3/widgets/base/csshelpers.c
trunk/vice/src/arch/gtk3/widgets/base/openfiledialog.c
trunk/vice/src/arch/gtk3/widgets/base/resourcebrowser.c
trunk/vice/src/arch/gtk3/widgets/base/resourcecombobox.c
trunk/vice/src/arch/gtk3/widgets/base/resourceradiogroup.c
trunk/vice/src/arch/gtk3/widgets/base/resourcescale.c
trunk/vice/src/arch/gtk3/widgets/base/resourcespinbutton.c
trunk/vice/src/arch/gtk3/widgets/base/resourcewidgetmediator.c
trunk/vice/src/arch/gtk3/widgets/contentpreviewwidget.c
trunk/vice/src/arch/gtk3/widgets/crtcontrolwidget.c
trunk/vice/src/arch/gtk3/widgets/crtpreviewwidget.c
trunk/vice/src/arch/gtk3/widgets/cwdwidget.c
trunk/vice/src/arch/gtk3/widgets/keysetdialog.c
trunk/vice/src/arch/gtk3/widgets/logfilewidget.c
trunk/vice/src/arch/gtk3/widgets/mixerwidget.c
trunk/vice/src/arch/gtk3/widgets/printerdriverwidget.c
trunk/vice/src/arch/gtk3/widgets/printeroutputdevicewidget.c
trunk/vice/src/arch/gtk3/widgets/printeroutputmodewidget.c
trunk/vice/src/arch/gtk3/widgets/settings_ethernetcart.c
trunk/vice/src/arch/gtk3/widgets/settings_ieee488.c
trunk/vice/src/arch/gtk3/widgets/settings_ieeeflash64.c
trunk/vice/src/arch/gtk3/widgets/settings_mmc64.c
trunk/vice/src/arch/gtk3/widgets/settings_netplay.c
trunk/vice/src/arch/gtk3/widgets/settings_ramlink.c
trunk/vice/src/arch/gtk3/widgets/videomodelwidget.c
trunk/vice/src/arch/sdl/archdep.c
trunk/vice/src/arch/sdl/joy.c
trunk/vice/src/arch/sdl/kbd.c
trunk/vice/src/arch/sdl/menu_common.c
trunk/vice/src/arch/sdl/menu_screenshot.c
trunk/vice/src/arch/sdl/menu_wic64.c
trunk/vice/src/arch/sdl/uimedia.c
trunk/vice/src/arch/sdl/uimenu.c
trunk/vice/src/arch/sdl/video_sdl1.c
trunk/vice/src/arch/sdl/video_sdl2.c
trunk/vice/src/arch/shared/archdep_cbmfont.c
trunk/vice/src/arch/shared/archdep_create_user_cache_dir.c
trunk/vice/src/arch/shared/archdep_create_user_config_dir.c
trunk/vice/src/arch/shared/archdep_create_user_state_dir.c
trunk/vice/src/arch/shared/archdep_expand_path.c
trunk/vice/src/arch/shared/archdep_get_runtime_info.c
trunk/vice/src/arch/shared/archdep_mkdir.c
trunk/vice/src/arch/shared/archdep_open_default_log_file.c
trunk/vice/src/arch/shared/archdep_path_is_relative.c
trunk/vice/src/arch/shared/archdep_program_path.c
trunk/vice/src/arch/shared/archdep_tmpnam.c
trunk/vice/src/arch/shared/hotkeys/parser.c
trunk/vice/src/arch/shared/hotkeys/textfilereader.c
trunk/vice/src/arch/shared/hwsiddrv/cw-win32-dll.c
trunk/vice/src/arch/shared/mididrv/midi-osx-drv.c
trunk/vice/src/arch/shared/mididrv/midi-unix-drv.c
trunk/vice/src/arch/shared/mididrv/midi-win32-drv.c
trunk/vice/src/arch/shared/rawnetarch.c
trunk/vice/src/arch/shared/rawnetarch_win32.c
trunk/vice/src/arch/shared/rs232-unix-dev.c
trunk/vice/src/arch/shared/rs232-win32-dev.c
trunk/vice/src/arch/shared/uiactions.c
trunk/vice/src/autostart.c
trunk/vice/src/c128/c128.c
trunk/vice/src/c128/c128memsnapshot.c
trunk/vice/src/c128/c128mmu.c
trunk/vice/src/c128/c128rom.c
trunk/vice/src/c128/cart/c128cart.c
trunk/vice/src/c128/z80mem.c
trunk/vice/src/c64/c64.c
trunk/vice/src/c64/c64_256k.c
trunk/vice/src/c64/c64memsnapshot.c
trunk/vice/src/c64/c64rom.c
trunk/vice/src/c64/cart/c64carthooks.c
trunk/vice/src/c64/cart/cs8900io.c
trunk/vice/src/c64/cart/georam.c
trunk/vice/src/c64/cart/ltkernal.c
trunk/vice/src/c64/cart/mmc64.c
trunk/vice/src/c64/cart/ramcart.c
trunk/vice/src/c64/cart/ramlink.c
trunk/vice/src/c64/cart/reu.c
trunk/vice/src/c64/cart/rrnetmk3.c
trunk/vice/src/c64/plus256k.c
trunk/vice/src/c64/plus60k.c
trunk/vice/src/c64/psid.c
trunk/vice/src/c64/vsid.c
trunk/vice/src/c64/vsidmemsnapshot.c
trunk/vice/src/c64dtv/c64dtv.c
trunk/vice/src/c64dtv/c64dtvblitter.c
trunk/vice/src/c64dtv/c64dtvdma.c
trunk/vice/src/c64dtv/c64dtvflash.c
trunk/vice/src/c64dtv/c64dtvmem.c
trunk/vice/src/c64dtv/c64dtvmemsnapshot.c
trunk/vice/src/c64dtv/flash-trap.c
trunk/vice/src/c64dtv/hummeradc.c
trunk/vice/src/cbm2/cbm2.c
trunk/vice/src/cbm2/cbm2memsnapshot.c
trunk/vice/src/cbm2/cbm2rom.c
trunk/vice/src/cbm2/cbm5x0.c
trunk/vice/src/cbm2/cbm5x0rom.c
trunk/vice/src/cia.h
trunk/vice/src/color.c
trunk/vice/src/core/ciacore.c
trunk/vice/src/core/cs8900.c
trunk/vice/src/core/i8255a.c
trunk/vice/src/core/riotcore.c
trunk/vice/src/core/scsi.c
trunk/vice/src/core/viacore.c
trunk/vice/src/datasette/datasette.c
trunk/vice/src/diskimage/fsimage-dxx.c
trunk/vice/src/diskimage/fsimage-gcr.c
trunk/vice/src/diskimage/fsimage-p64.c
trunk/vice/src/diskimage/fsimage-probe.c
trunk/vice/src/drive/drive-snapshot.c
trunk/vice/src/drive/drive.c
trunk/vice/src/drive/drivemem.c
trunk/vice/src/drive/iec/cmdhd.c
trunk/vice/src/drive/iec/pc8477.c
trunk/vice/src/drive/iec/wd1770.c
trunk/vice/src/drive/ieee/fdc.c
trunk/vice/src/gfxoutputdrv/gfxoutput.c
trunk/vice/src/joyport/joystick.c
trunk/vice/src/joyport/mouse.c
trunk/vice/src/log.c
trunk/vice/src/log.h
trunk/vice/src/m3u.c
trunk/vice/src/midi.c
trunk/vice/src/monitor/mon_breakpoint.c
trunk/vice/src/monitor/mon_disassemble.c
trunk/vice/src/monitor/mon_register6502.c
trunk/vice/src/monitor/mon_register6502dtv.c
trunk/vice/src/monitor/mon_register65816.c
trunk/vice/src/monitor/mon_register6809.c
trunk/vice/src/monitor/mon_registerR65C02.c
trunk/vice/src/monitor/mon_registerz80.c
trunk/vice/src/monitor/monitor.c
trunk/vice/src/palette.c
trunk/vice/src/pet/pet.c
trunk/vice/src/pet/petdww.c
trunk/vice/src/pet/pethre.c
trunk/vice/src/pet/petmem.c
trunk/vice/src/pet/petmemsnapshot.c
trunk/vice/src/pet/petreu.c
trunk/vice/src/pet/petrom.c
trunk/vice/src/piacore.h
trunk/vice/src/plus4/plus4.c
trunk/vice/src/plus4/plus4memcsory256k.c
trunk/vice/src/plus4/plus4memhannes256k.c
trunk/vice/src/plus4/plus4memrom.c
trunk/vice/src/plus4/plus4memsnapshot.c
trunk/vice/src/plus4/plus4rom.c
trunk/vice/src/printerdrv/driver-select.c
trunk/vice/src/printerdrv/drv-1520.c
trunk/vice/src/printerdrv/drv-ascii.c
trunk/vice/src/printerdrv/drv-mps803.c
trunk/vice/src/printerdrv/drv-nl10.c
trunk/vice/src/printerdrv/interface-serial.c
trunk/vice/src/printerdrv/output-graphics.c
trunk/vice/src/ps2mouse.c
trunk/vice/src/riot.h
trunk/vice/src/rs232drv/rs232net.c
trunk/vice/src/samplerdrv/file_drv.c
trunk/vice/src/samplerdrv/portaudio_drv.c
trunk/vice/src/scpu64/scpu64.c
trunk/vice/src/scpu64/scpu64gluelogic.c
trunk/vice/src/scpu64/scpu64memsnapshot.c
trunk/vice/src/scpu64/scpu64rom.c
trunk/vice/src/screenshot.c
trunk/vice/src/serial/fsdrive-snapshot.c
trunk/vice/src/serial/fsdrive.c
trunk/vice/src/serial/serial-iec-device.c
trunk/vice/src/serial/serial.c
trunk/vice/src/sound.c
trunk/vice/src/sysfile.c
trunk/vice/src/tape/t64.c
trunk/vice/src/tape/tape-snapshot.c
trunk/vice/src/tape/tape.c
trunk/vice/src/tapeport/tapecart.c
trunk/vice/src/userport/userport_wic64.c
trunk/vice/src/util.c
trunk/vice/src/vdrive/vdrive-bam.c
trunk/vice/src/vdrive/vdrive-command.c
trunk/vice/src/vdrive/vdrive-dir.c
trunk/vice/src/vdrive/vdrive-iec.c
trunk/vice/src/vdrive/vdrive-rel.c
trunk/vice/src/vdrive/vdrive-snapshot.c
trunk/vice/src/vdrive/vdrive.c
trunk/vice/src/via.h
trunk/vice/src/vic20/cart/finalexpansion.c
trunk/vice/src/vic20/cart/megacart.c
trunk/vice/src/vic20/cart/mikroassembler.c
trunk/vice/src/vic20/cart/superexpander.c
trunk/vice/src/vic20/cart/ultimem.c
trunk/vice/src/vic20/cart/vic-fp.c
trunk/vice/src/vic20/cart/vic20cart.c
trunk/vice/src/vic20/vic20-cmdline-options.c
trunk/vice/src/vic20/vic20.c
trunk/vice/src/vic20/vic20memsnapshot.c
trunk/vice/src/vic20/vic20rom.c
trunk/vice/src/video/video-canvas.c
trunk/vice/src/zfile.c
Modified: trunk/vice/src/aciacore.c
===================================================================
--- trunk/vice/src/aciacore.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/aciacore.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -175,7 +175,7 @@
acia.ticks = 21111;
acia.fd = -1;
acia.in_tx = ACIA_TX_STATE_NO_TRANSMIT;
- acia.log = LOG_ERR;
+ acia.log = LOG_DEFAULT;
acia.irq_type = IK_NONE;
acia.mode = ACIA_MODE_NORMAL;
}
@@ -668,7 +668,7 @@
acia.alarm_tx = alarm_new(mycpu_alarm_context, MYACIA, int_acia_tx, NULL);
acia.alarm_rx = alarm_new(mycpu_alarm_context, MYACIA, int_acia_rx, NULL);
- if (acia.log == LOG_ERR) {
+ if (acia.log == LOG_DEFAULT) {
acia.log = log_open(MYACIA);
}
}
Modified: trunk/vice/src/arch/gtk3/actions-help.c
===================================================================
--- trunk/vice/src/arch/gtk3/actions-help.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/actions-help.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -75,7 +75,7 @@
* wrong and should be looked at. This is different from failing to
* load the PDF or not having a program to show the PDF
*/
- log_error(LOG_ERR, "failed to construct a proper URI from '%s',"
+ log_error(LOG_DEFAULT, "failed to construct a proper URI from '%s',"
" not trying the HTML fallback, this is an error that"
" should not happen.",
uri);
Modified: trunk/vice/src/arch/gtk3/directx_renderer_impl.cc
===================================================================
--- trunk/vice/src/arch/gtk3/directx_renderer_impl.cc 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/directx_renderer_impl.cc 2024-08-05 15:02:30 UTC (rev 45267)
@@ -640,7 +640,7 @@
0,
NULL);
- log_error(LOG_ERR, "%s: %s", prefix, error_message);
+ log_error(LOG_DEFAULT, "%s: %s", prefix, error_message);
LocalFree(error_message);
}
Modified: trunk/vice/src/arch/gtk3/hotkeys.c
===================================================================
--- trunk/vice/src/arch/gtk3/hotkeys.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/hotkeys.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -81,7 +81,7 @@
static gboolean valid_window_id(gint window_id)
{
if (window_id != PRIMARY_WINDOW && window_id != SECONDARY_WINDOW) {
- log_error(LOG_ERR, "Invalid window ID of %d.", window_id);
+ log_error(LOG_DEFAULT, "Invalid window ID of %d.", window_id);
return FALSE;
}
return TRUE;
Modified: trunk/vice/src/arch/gtk3/joystickdrv/joystick_linux.c
===================================================================
--- trunk/vice/src/arch/gtk3/joystickdrv/joystick_linux.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/joystickdrv/joystick_linux.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -59,7 +59,7 @@
/** \brief Linux joystick log */
-static log_t joystick_linux_log = LOG_ERR;
+static log_t joystick_linux_log = LOG_DEFAULT;
/** \brief Callback for the joystick system to poll a joystick device
@@ -132,7 +132,7 @@
{
int i;
- if (joystick_linux_log == LOG_ERR) {
+ if (joystick_linux_log == LOG_DEFAULT) {
joystick_linux_log = log_open("Joystick");
}
log_message(joystick_linux_log, "Linux joystick interface initialization...");
Modified: trunk/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c
===================================================================
--- trunk/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -398,7 +398,7 @@
rc = libevdev_new_from_fd(fd, &evdev);
if (rc < 0) {
- log_error(LOG_ERR, "failed to initialize libevdev: %s", strerror(rc));
+ log_error(LOG_DEFAULT, "failed to initialize libevdev: %s", strerror(rc));
close(fd);
return NULL;
}
@@ -446,7 +446,7 @@
sd_result = scandir("/dev/input", &namelist, sd_filter, alphasort);
if (sd_result < 0) {
- log_error(LOG_ERR, "scandir() failed on /dev/input: %s", strerror(errno));
+ log_error(LOG_DEFAULT, "scandir() failed on /dev/input: %s", strerror(errno));
return;
}
Modified: trunk/vice/src/arch/gtk3/ui.c
===================================================================
--- trunk/vice/src/arch/gtk3/ui.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/ui.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -860,7 +860,7 @@
case DT_TEXT_URI: /* fall through ('text/uri') */
default:
- log_error(LOG_ERR, "Unhandled drag target %u", info);
+ log_error(LOG_DEFAULT, "Unhandled drag target %u", info);
break;
}
@@ -975,7 +975,7 @@
if (index < 0) {
/* We should never end up here. */
- log_error(LOG_ERR, "focus-in-event: window not found\n");
+ log_error(LOG_DEFAULT, "focus-in-event: window not found\n");
archdep_vice_exit(1);
}
@@ -1026,7 +1026,7 @@
if (index < 0) {
/* We should never end up here. */
- log_error(LOG_ERR, "window-state-event: window not found\n");
+ log_error(LOG_DEFAULT, "window-state-event: window not found\n");
archdep_vice_exit(1);
}
@@ -1214,7 +1214,7 @@
canvas = ui_resources.canvas[active_win_index];
if (canvas == NULL) {
- log_error(LOG_ERR, "No canvas for window %d!", active_win_index);
+ log_error(LOG_DEFAULT, "No canvas for window %d!", active_win_index);
}
return canvas;
}
@@ -1614,7 +1614,7 @@
gbytes = g_bytes_new_take(png_buffer, png_buffer_size);
if (!gbytes) {
- log_error(LOG_ERR, "macos_set_dock_icon_workaround: failed to access icon bytes from gresource file.\n");
+ log_error(LOG_DEFAULT, "macos_set_dock_icon_workaround: failed to access icon bytes from gresource file.\n");
return;
}
@@ -1634,7 +1634,7 @@
OBJC_MSGSEND(id, id, SEL, id)(application, sel_getUid("setApplicationIconImage:"), logo);
OBJC_MSGSEND(id, id, SEL)(logo, sel_getUid("release"));
} else {
- log_error(LOG_ERR, "macos_set_dock_icon_workaround: failed to initialise image from resource");
+ log_error(LOG_DEFAULT, "macos_set_dock_icon_workaround: failed to initialise image from resource");
}
}
@@ -1830,11 +1830,11 @@
target_window = identify_canvas_func(canvas);
}
if (target_window < 0) {
- log_error(LOG_ERR, "ui_create_main_window: canvas not identified!\n");
+ log_error(LOG_DEFAULT, "ui_create_main_window: canvas not identified!\n");
archdep_vice_exit(1);
}
if (ui_resources.window_widget[target_window] != NULL) {
- log_error(LOG_ERR, "ui_create_main_window: existing window recreated??\n");
+ log_error(LOG_DEFAULT, "ui_create_main_window: existing window recreated??\n");
archdep_vice_exit(1);
}
@@ -2152,13 +2152,13 @@
}
if (!uidata_init()) {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"failed to initialize GResource data, don't expect much"
" when it comes to icons, fonts or logos.");
}
if (!archdep_register_cbmfont()) {
- log_error(LOG_ERR, "failed to register CBM font.");
+ log_error(LOG_DEFAULT, "failed to register CBM font.");
}
/*
Modified: trunk/vice/src/arch/gtk3/uidata.c
===================================================================
--- trunk/vice/src/arch/gtk3/uidata.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/uidata.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -62,7 +62,7 @@
#endif
if (sysfile_locate(UIDATA_GRESOURCE_FILE, "common", &path) < 0) {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"failed to find resource data '%s'.",
UIDATA_GRESOURCE_FILE);
return FALSE;
@@ -70,7 +70,7 @@
gresource = g_resource_load(path, &err);
if (gresource == NULL && err != NULL) {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"failed to load resource data '%s': %s.",
path, err->message);
g_clear_error(&err);
@@ -130,7 +130,7 @@
buf = gdk_pixbuf_new_from_resource(path, &err);
lib_free(path);
if (err) {
- log_error(LOG_ERR, "Failed to obtain pixbuf for %s, Error: %s", name, err->message);
+ log_error(LOG_DEFAULT, "Failed to obtain pixbuf for %s, Error: %s", name, err->message);
g_clear_error(&err);
}
return buf;
@@ -160,7 +160,7 @@
preserve_aspect, &err);
lib_free(path);
if (err) {
- log_error(LOG_ERR, "Failed to obtain pixbuf for %s, Error: %s", name, err->message);
+ log_error(LOG_DEFAULT, "Failed to obtain pixbuf for %s, Error: %s", name, err->message);
g_clear_error(&err);
}
return buf;
@@ -184,7 +184,7 @@
G_RESOURCE_LOOKUP_FLAGS_NONE, &err);
lib_free(path);
if (bytes == NULL) {
- log_error(LOG_ERR, "failed: %s.", err->message);
+ log_error(LOG_DEFAULT, "failed: %s.", err->message);
g_clear_error(&err);
}
return bytes;
Modified: trunk/vice/src/arch/gtk3/uidiskattach.c
===================================================================
--- trunk/vice/src/arch/gtk3/uidiskattach.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/uidiskattach.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -222,7 +222,7 @@
file in an image */
autostart ? AUTOSTART_MODE_RUN : AUTOSTART_MODE_LOAD) < 0) {
/* oeps */
- log_error(LOG_ERR, "autostart disk attach failed.");
+ log_error(LOG_DEFAULT, "autostart disk attach failed.");
vice_gtk3_message_error(GTK_WINDOW(widget),
"Autostart failure",
"Autostarting disk image '%s' failed.",
Modified: trunk/vice/src/arch/gtk3/uimedia.c
===================================================================
--- trunk/vice/src/arch/gtk3/uimedia.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/uimedia.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -507,7 +507,7 @@
if (screenshot_save(screenshot_driver, screenshot_filename, canvas) < 0) {
char *filename_copy;
- log_error(LOG_ERR, "Failed to write screenshot file '%s'.",
+ log_error(LOG_DEFAULT, "Failed to write screenshot file '%s'.",
screenshot_filename);
/* push error message handler onto the UI thread */
filename_copy = lib_strdup(screenshot_filename);
Modified: trunk/vice/src/arch/gtk3/uisettings.c
===================================================================
--- trunk/vice/src/arch/gtk3/uisettings.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/uisettings.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -2292,7 +2292,7 @@
nodes = main_nodes_vsid;
break;
default:
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"Error: %s:%d:%s(): unsupported machine_class %d\n",
__FILE__, __LINE__, __func__, machine_class);
archdep_vice_exit(1);
@@ -2689,12 +2689,12 @@
int column = 0;
if (settings_window == NULL) {
- log_error(LOG_ERR, "settings dialog node activation requested without"
+ log_error(LOG_DEFAULT, "settings dialog node activation requested without"
" the dialog active.");
return FALSE;
}
if (path == NULL || *path == '\0') {
- log_error(LOG_ERR, "NULL or empty path passed.");
+ log_error(LOG_DEFAULT, "NULL or empty path passed.");
return FALSE;
}
Modified: trunk/vice/src/arch/gtk3/uismartattach.c
===================================================================
--- trunk/vice/src/arch/gtk3/uismartattach.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/uismartattach.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -153,7 +153,7 @@
struct disk_image_s *diskimg = file_system_get_image(unit_number, drive_number);
if (diskimg == NULL) {
- log_error(LOG_ERR, "Failed to get disk image for unit %d.", unit_number);
+ log_error(LOG_DEFAULT, "Failed to get disk image for unit %d.", unit_number);
return -1;
} else {
int chk = drive_check_image_format(diskimg->type, 0);
@@ -162,7 +162,7 @@
/* change drive type only when image does not work in current drive */
if (chk < 0) {
if (resources_set_int_sprintf("Drive%dType", drive_image_type_to_drive_type(diskimg->type), unit_number) < 0) {
- log_error(LOG_ERR, "Failed to set drive type.");
+ log_error(LOG_DEFAULT, "Failed to set drive type.");
}
}
@@ -192,19 +192,19 @@
/* get current tapeport device */
if (resources_get_int("TapePort1Device", &tapedevice_temp) < 0) {
- log_error(LOG_ERR, "Failed to get tape port device.");
+ log_error(LOG_DEFAULT, "Failed to get tape port device.");
return -1;
}
/* first disable all devices, so we dont get any conflicts */
if (resources_set_int("TapePort1Device", TAPEPORT_DEVICE_NONE) < 0) {
- log_error(LOG_ERR, "Failed to disable the tape port device.");
+ log_error(LOG_DEFAULT, "Failed to disable the tape port device.");
goto exiterror;
}
/* enable the tape cart */
if (resources_set_int("TapePort1Device", TAPEPORT_DEVICE_TAPECART) < 0) {
- log_error(LOG_ERR, "Failed to enable the Tapecart.");
+ log_error(LOG_DEFAULT, "Failed to enable the Tapecart.");
goto exiterror;
}
@@ -216,7 +216,7 @@
exiterror:
/* restore tape port device */
if (resources_set_int("TapePort1Device", tapedevice_temp) < 0) {
- log_error(LOG_ERR, "Failed to restore tape port device.");
+ log_error(LOG_DEFAULT, "Failed to restore tape port device.");
}
return -1;
}
@@ -252,7 +252,7 @@
&& cartridge_attach_image(CARTRIDGE_CRT, filename_locale) < 0
&& autostart_prg(filename_locale, AUTOSTART_MODE_LOAD) < 0) {
/* failed */
- log_error(LOG_ERR, "smart attach failed for '%s' failed", filename);
+ log_error(LOG_DEFAULT, "smart attach failed for '%s' failed", filename);
}
} else if ((machine_class == VICE_MACHINE_VIC20)
|| (machine_class == VICE_MACHINE_CBM5x0)
@@ -263,7 +263,7 @@
/* && autostart_prg(filename_locale, AUTOSTART_MODE_LOAD) < 0 */
&& cartridge_attach_image(CARTRIDGE_CRT, filename_locale) < 0) {
/* failed */
- log_error(LOG_ERR, "smart attach failed for '%s' failed", filename);
+ log_error(LOG_DEFAULT, "smart attach failed for '%s' failed", filename);
}
} else {
/* Smart attach for other emulators: don't try to attach a file
@@ -273,7 +273,7 @@
&& tape_image_attach(1, filename_locale) < 0
&& autostart_snapshot(filename_locale, NULL) < 0)
{
- log_error(LOG_ERR, "Failed to smart attach '%s'",
+ log_error(LOG_DEFAULT, "Failed to smart attach '%s'",
filename_locale);
}
}
Modified: trunk/vice/src/arch/gtk3/uistatusbar.c
===================================================================
--- trunk/vice/src/arch/gtk3/uistatusbar.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/uistatusbar.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -2325,7 +2325,7 @@
/* sanity check */
if (bar < 0 || bar >= MAX_STATUS_BARS) {
- log_error(LOG_ERR, "Invalid status bar index of %d.", bar);
+ log_error(LOG_DEFAULT, "Invalid status bar index of %d.", bar);
return;
}
@@ -2360,7 +2360,7 @@
/* sanity check */
if (bar < 0 || bar >= MAX_STATUS_BARS) {
- log_error(LOG_ERR, "Invalid status bar index of %d.", bar);
+ log_error(LOG_DEFAULT, "Invalid status bar index of %d.", bar);
return;
}
@@ -2394,7 +2394,7 @@
/* sanity check */
if (bar < 0 || bar >= MAX_STATUS_BARS) {
- log_error(LOG_ERR, "Invalid status bar index of %d.", bar);
+ log_error(LOG_DEFAULT, "Invalid status bar index of %d.", bar);
return;
}
@@ -2519,7 +2519,7 @@
}
if (i == MAX_STATUS_BARS) {
/* Fatal error (should never happen) */
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"Maxium number of status bars (%d) exceeded.",
MAX_STATUS_BARS);
archdep_vice_exit(1);
Modified: trunk/vice/src/arch/gtk3/uitapeattach.c
===================================================================
--- trunk/vice/src/arch/gtk3/uitapeattach.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/uitapeattach.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -143,7 +143,7 @@
autostart ? AUTOSTART_MODE_RUN : AUTOSTART_MODE_LOAD,
port - 1 /* function uses 0/1 */) < 0) {
/* oeps */
- log_error(LOG_ERR, "autostarting tape '%s' failed.", filename_locale);
+ log_error(LOG_DEFAULT, "autostarting tape '%s' failed.", filename_locale);
vice_gtk3_message_error(GTK_WINDOW(widget),
"Autostart error",
"Autostarting tape '%s' failed.",
@@ -171,7 +171,7 @@
if (tape_image_attach(TAPEPORT_PORT_1 + port, filename_locale) < 0) {
/* failed */
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"attaching tape '%s' to port #%d failed.",
filename_locale, port);
vice_gtk3_message_error(GTK_WINDOW(widget),
Modified: trunk/vice/src/arch/gtk3/video.c
===================================================================
--- trunk/vice/src/arch/gtk3/video.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/video.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -49,7 +49,7 @@
/** \brief Log for Gtk3-native video messages
*/
-static log_t gtk3video_log = LOG_ERR;
+static log_t gtk3video_log = LOG_DEFAULT;
/** \brief Set <CHIP>AspectMode resource (integer)
*
@@ -404,7 +404,7 @@
*/
int video_init(void)
{
- if (gtk3video_log == LOG_ERR) {
+ if (gtk3video_log == LOG_DEFAULT) {
gtk3video_log = log_open("Gtk3Video");
}
return 0;
Modified: trunk/vice/src/arch/gtk3/widgets/base/cartridgewidgets.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/base/cartridgewidgets.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/base/cartridgewidgets.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -144,7 +144,7 @@
result = cartridge_save_secondary_image(state->cart_id, filename);
break;
default:
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"%s(): saving of %s cartridge image is not implemented.",
__func__, tag_defaults[state->image_num - CART_IMAGE_PRIMARY]);
result = -1;
@@ -200,7 +200,7 @@
result = cartridge_flush_secondary_image(state->cart_id);
break;
default:
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"%s(): flushing of %s cartridge image is not implemented.",
__func__, tag_defaults[state->image_num - CART_IMAGE_PRIMARY]);
result = -1;
@@ -615,7 +615,7 @@
int row = 0;
if (!valid_image_num(image_num)) {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"%s: invalid image number %d, valid range is %d-%d.",
__func__, image_num, CART_IMAGE_PRIMARY, CART_IMAGE_COUNT);
return NULL;
Modified: trunk/vice/src/arch/gtk3/widgets/base/csshelpers.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/base/csshelpers.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/base/csshelpers.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -56,7 +56,7 @@
/* attempt to load CSS from string */
gtk_css_provider_load_from_data(provider, css, -1, &err);
if (err != NULL) {
- log_error(LOG_ERR, "CSS error: %s", err->message);
+ log_error(LOG_DEFAULT, "CSS error: %s", err->message);
g_error_free(err);
return NULL;
}
@@ -79,7 +79,7 @@
/* try to get style context */
context = gtk_widget_get_style_context(widget);
if (context == NULL) {
- log_error(LOG_ERR, "Couldn't get style context of widget");
+ log_error(LOG_DEFAULT, "Couldn't get style context of widget");
/* don't free the context, it's owned by the widget */
return FALSE;
}
@@ -107,7 +107,7 @@
/* try to get style context */
context = gtk_widget_get_style_context(widget);
if (context == NULL) {
- log_error(LOG_ERR, "Couldn't get style context of widget");
+ log_error(LOG_DEFAULT, "Couldn't get style context of widget");
/* don't free the context, it's owned by the widget */
return FALSE;
}
Modified: trunk/vice/src/arch/gtk3/widgets/base/openfiledialog.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/base/openfiledialog.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/base/openfiledialog.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -59,7 +59,7 @@
filename_cb(dialog, filename, data);
} else {
/* should never be reached */
- log_error(LOG_ERR, "filename is NULL.");
+ log_error(LOG_DEFAULT, "filename is NULL.");
}
break;
default:
Modified: trunk/vice/src/arch/gtk3/widgets/base/resourcebrowser.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/base/resourcebrowser.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/base/resourcebrowser.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -217,7 +217,7 @@
if (filename != NULL) {
if (!vice_gtk3_resource_entry_set(state->entry, filename)){
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"failed to set resource %s to '%s', reverting\n",
state->res_name, filename);
/* restore resource to original state */
@@ -247,7 +247,7 @@
if (filename != NULL) {
if (!vice_gtk3_resource_entry_set(state->entry, filename)){
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"failed to set resource %s to '%s', reverting\n",
state->res_name, filename);
/* restore resource to original state */
Modified: trunk/vice/src/arch/gtk3/widgets/base/resourcecombobox.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/base/resourcecombobox.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/base/resourcecombobox.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -541,11 +541,11 @@
int step)
{
if (upper <= lower) {
- log_error(LOG_ERR, "%s(): invalid range %d-%d", __func__, lower, upper);
+ log_error(LOG_DEFAULT, "%s(): invalid range %d-%d", __func__, lower, upper);
return NULL;
}
if (step < 1) {
- log_error(LOG_ERR, "%s(): invalid step value %d", __func__, step);
+ log_error(LOG_DEFAULT, "%s(): invalid step value %d", __func__, step);
return NULL;
}
return combo_hex_helper(resource,
@@ -677,7 +677,7 @@
COLUMN_VALUE, value,
-1);
} else {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"%s(): cannot append row, `id` and `value` must both be"
" non-NULL and non-empty",
__func__);
Modified: trunk/vice/src/arch/gtk3/widgets/base/resourceradiogroup.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/base/resourceradiogroup.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/base/resourceradiogroup.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -61,7 +61,7 @@
/* get new and old values */
if (resources_get_int(resource, &old_val) < 0) {
- log_error(LOG_ERR, "failed to get value for resource '%s'\n",
+ log_error(LOG_DEFAULT, "failed to get value for resource '%s'\n",
resource);
return;
}
@@ -70,7 +70,7 @@
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio))
&& (old_val != new_val)) {
if (resources_set_int(resource, new_val) < 0) {
- log_error(LOG_ERR, "failed to set resource '%s' to %d\n",
+ log_error(LOG_DEFAULT, "failed to set resource '%s' to %d\n",
resource, new_val);
} else {
/* only trigger callback on succesfully setting the resource */
Modified: trunk/vice/src/arch/gtk3/widgets/base/resourcescale.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/base/resourcescale.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/base/resourcescale.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -60,7 +60,7 @@
resource = resource_widget_get_resource_name(widget);
if (resources_get_int(resource, &old_val) < 0) {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"%s(): failed to get value for resource '%s'\n",
__func__, resource);
return;
@@ -90,7 +90,7 @@
/* set current value */
if (resources_get_int(resource, &value) < 0) {
- log_error(LOG_ERR, "failed to get value for resource '%s'\n",
+ log_error(LOG_DEFAULT, "failed to get value for resource '%s'\n",
resource);
value = 0;
}
@@ -317,7 +317,7 @@
resource = resource_widget_get_resource_name(self);
if (resources_get_int(resource, &old_val) < 0) {
- log_error(LOG_ERR, "failed to get value for resource '%s'\n",
+ log_error(LOG_DEFAULT, "failed to get value for resource '%s'\n",
resource);
return;
}
@@ -456,7 +456,7 @@
resource_name = resource_widget_get_resource_name(self);
if (resources_get_int(resource_name, &resource_value) < 0) {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"%s(): failed to get value for resource '%s'.",
__func__, resource_name);
resource_value = 0;
@@ -754,7 +754,7 @@
resource = resource_widget_get_resource_name(self);
if (resources_get_int(resource, &old_val) < 0) {
- log_error(LOG_ERR, "failed to get value for resource '%s'\n",
+ log_error(LOG_DEFAULT, "failed to get value for resource '%s'\n",
resource);
return;
}
Modified: trunk/vice/src/arch/gtk3/widgets/base/resourcespinbutton.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/base/resourcespinbutton.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/base/resourcespinbutton.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -209,7 +209,7 @@
res = resource_widget_get_resource_name(spin);
value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin));
if (resources_set_int(res, value) < 0) {
- log_error(LOG_ERR, "failed to set resource '%s' to %d\n", res, value);
+ log_error(LOG_DEFAULT, "failed to set resource '%s' to %d\n", res, value);
}
}
@@ -236,7 +236,7 @@
gtk_spin_button_set_digits(GTK_SPIN_BUTTON(spin), 0);
if (resources_get_int(resource, ¤t) < 0) {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"%s(): failed to get value for resource '%s'\n",
__func__, resource);
}
@@ -275,7 +275,7 @@
/* store current resource value for use in reset() */
if (resources_get_int(resource, ¤t) < 0) {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"failed to get current value for resource '%s', defaulting"
" to 0.",
resource);
@@ -362,7 +362,7 @@
{
const char *resource = resource_widget_get_resource_name(widget);
if (resources_get_int(resource, value) < 0) {
- log_error(LOG_ERR, "failed to get value for resource '%s'.", resource);
+ log_error(LOG_DEFAULT, "failed to get value for resource '%s'.", resource);
return FALSE;
}
return TRUE;
@@ -395,7 +395,7 @@
resource = resource_widget_get_resource_name(widget);
if (resources_get_default_value(resource, &factory) < 0) {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"failed to get factory value for resource '%s'.",
resource);
return FALSE;
@@ -418,13 +418,13 @@
/* get widget state */
if (!vice_gtk3_resource_spin_int_get(widget, &widget_val)) {
- log_error(LOG_ERR, "failed to retrieve current value of widget");
+ log_error(LOG_DEFAULT, "failed to retrieve current value of widget");
return FALSE;
}
/* get resource value */
resource_name = resource_widget_get_resource_name(widget);
if (resources_get_int(resource_name, &resource_val) < 0) {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"failed to retrieve value for resource '%s'",
resource_name);
}
@@ -600,7 +600,7 @@
resource = resource_widget_get_resource_name(spin);
if (resources_get_default_value(resource, &factory) < 0) {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"failed to get factory value for resource %s'.",
resource);
return FALSE;
@@ -607,7 +607,7 @@
}
value = strtod(factory, &endptr);
if (*endptr != '\0') {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"factory value '%s' of resource '%s' could not be converted"
" to double.",
factory, resource);
Modified: trunk/vice/src/arch/gtk3/widgets/base/resourcewidgetmediator.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/base/resourcewidgetmediator.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/base/resourcewidgetmediator.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -194,7 +194,7 @@
return mediator;
report_error:
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"%s(): resource %s: failed to get value.",
__func__, name);
return mediator;
Modified: trunk/vice/src/arch/gtk3/widgets/contentpreviewwidget.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/contentpreviewwidget.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/contentpreviewwidget.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -150,7 +150,7 @@
}
if (content_func == NULL) {
- log_error(LOG_ERR, "no content-get function specified, bailing!");
+ log_error(LOG_DEFAULT, "no content-get function specified, bailing!");
return model;
}
Modified: trunk/vice/src/arch/gtk3/widgets/crtcontrolwidget.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/crtcontrolwidget.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/crtcontrolwidget.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -661,7 +661,7 @@
/* sanity check */
if (RESOURCE_COUNT != sizeof control_info / sizeof control_info[0]) {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"RESOURCE_COUNT doesn't match element count of control_info[]");
return NULL;
}
Modified: trunk/vice/src/arch/gtk3/widgets/crtpreviewwidget.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/crtpreviewwidget.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/crtpreviewwidget.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -399,7 +399,7 @@
debug_gtk3("next chip packet offset = %lx", (unsigned long)pos);
#endif
if (fseek(fd, pos, SEEK_SET) != 0) {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"fseek(%ld) failed: %d: %s",
pos, errno, strerror(errno));
break;
Modified: trunk/vice/src/arch/gtk3/widgets/cwdwidget.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/cwdwidget.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/cwdwidget.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -59,7 +59,7 @@
provider = gtk_css_provider_new();
if (!gtk_css_provider_load_from_data(provider, INVALID_PATH_CSS, -1, &error)) {
- log_error(LOG_ERR, "%s(): %s", __func__, error->message);
+ log_error(LOG_DEFAULT, "%s(): %s", __func__, error->message);
g_error_free(error);
}
}
Modified: trunk/vice/src/arch/gtk3/widgets/keysetdialog.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/keysetdialog.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/keysetdialog.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -229,7 +229,7 @@
if (keyset_labels[row][col]) {
if (resources_get_int_sprintf("KeySet%d%s", &value, keyset_index,
keyset_labels[row][col]) < 0) {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"failed to retrieve value for resource 'KeySet%d%s\n",
keyset_index, keyset_labels[row][col]);
return FALSE;
@@ -257,7 +257,7 @@
if (keyset_labels[row][col]) {
if (resources_set_int_sprintf("KeySet%d%s", value, keyset_index,
keyset_labels[row][col]) < 0) {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"failed to set value for resource 'KeySet%d%s\n",
keyset_index, keyset_labels[row][col]);
return FALSE;
@@ -361,7 +361,7 @@
gchar title[256];
if (keyset < 1 || keyset > 2) {
- log_error(LOG_ERR, "Got invalid keyset number: %d\n", keyset);
+ log_error(LOG_DEFAULT, "Got invalid keyset number: %d\n", keyset);
return;
}
Modified: trunk/vice/src/arch/gtk3/widgets/logfilewidget.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/logfilewidget.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/logfilewidget.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -121,7 +121,7 @@
NULL, /* user data for child setup */
NULL, /* child process ID */
&error)) {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"failed to launch file manager to view directory: %s",
error->message);
g_error_free(error);
@@ -131,7 +131,7 @@
uri,
GDK_CURRENT_TIME,
&error)) {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"failed to lauch file manager to view directory: %s",
error->message);
g_error_free(error);
Modified: trunk/vice/src/arch/gtk3/widgets/mixerwidget.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/mixerwidget.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/mixerwidget.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -510,7 +510,7 @@
|| machine_class == VICE_MACHINE_PLUS4) {
/* check for presence of SidCart */
if (resources_get_int("SidCart", &tmp) < 0) {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"failed to get value for resource SidCart, bailing!");
return NULL;
}
@@ -574,7 +574,7 @@
}
if (resources_get_int("SidModel", &model) < 0) {
- log_error(LOG_ERR, "failed to get SidModel resource");
+ log_error(LOG_DEFAULT, "failed to get SidModel resource");
return NULL;
}
Modified: trunk/vice/src/arch/gtk3/widgets/printerdriverwidget.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/printerdriverwidget.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/printerdriverwidget.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -124,7 +124,7 @@
/* sanity check */
if (device < 3 || device > 6) {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"%s(): invalid device number %d, valid device numbers are"
" 4-6 or 3 for userport",
__func__, device);
Modified: trunk/vice/src/arch/gtk3/widgets/printeroutputdevicewidget.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/printeroutputdevicewidget.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/printeroutputdevicewidget.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -73,7 +73,7 @@
strncpy(resource, "PrinterUserportTextDevice", sizeof resource - 1u);
resource[sizeof resource - 1u] = '\0';
} else {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"%s(): invalid device number %d.",
__func__, device);
return NULL;
Modified: trunk/vice/src/arch/gtk3/widgets/printeroutputmodewidget.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/printeroutputmodewidget.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/printeroutputmodewidget.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -106,7 +106,7 @@
strncpy(resource, "PrinterUserportOutput", sizeof resource - 1u);
resource[sizeof resource - 1u] = '\0';
} else {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"%s(): invalid device number %d.",
__func__, device);
return NULL;
Modified: trunk/vice/src/arch/gtk3/widgets/settings_ethernetcart.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_ethernetcart.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/settings_ethernetcart.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -99,7 +99,7 @@
eth_base_list_vic20);
break;
default:
- log_error(LOG_ERR, "%s(): should never get here!", __func__);
+ log_error(LOG_DEFAULT, "%s(): should never get here!", __func__);
break;
}
return combo;
Modified: trunk/vice/src/arch/gtk3/widgets/settings_ieee488.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_ieee488.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/settings_ieee488.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -82,7 +82,7 @@
if (state) {
if (cartridge_enable(CARTRIDGE_IEEE488) < 0) {
- log_error(LOG_ERR, "failed to enable " CARTNAME ".");
+ log_error(LOG_DEFAULT, "failed to enable " CARTNAME ".");
vice_gtk3_message_error(GTK_WINDOW(parent),
CARTNAME " Error",
"Failed to enable " CARTNAME ".");
@@ -90,7 +90,7 @@
}
} else {
if (cartridge_disable(CARTRIDGE_IEEE488) < 0) {
- log_error(LOG_ERR, "failed to disable " CARTNAME ".");
+ log_error(LOG_DEFAULT, "failed to disable " CARTNAME ".");
vice_gtk3_message_error(GTK_WINDOW(parent),
CARTNAME " Error",
"Failed to disable " CARTNAME ".");
Modified: trunk/vice/src/arch/gtk3/widgets/settings_ieeeflash64.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_ieeeflash64.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/settings_ieeeflash64.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -84,7 +84,7 @@
if (state) {
if (cartridge_enable(CARTRIDGE_IEEEFLASH64) < 0) {
- log_error(LOG_ERR, "failed to enable " CARTNAME ".");
+ log_error(LOG_DEFAULT, "failed to enable " CARTNAME ".");
vice_gtk3_message_error(GTK_WINDOW(parent),
CARTNAME " Error",
"Failed to enable " CARTNAME ".");
@@ -92,7 +92,7 @@
}
} else {
if (cartridge_disable(CARTRIDGE_IEEEFLASH64) < 0) {
- log_error(LOG_ERR, "failed to disable " CARTNAME ".");
+ log_error(LOG_DEFAULT, "failed to disable " CARTNAME ".");
vice_gtk3_message_error(GTK_WINDOW(parent),
CARTNAME" Error",
"Failed to enable " CARTNAME ".");
Modified: trunk/vice/src/arch/gtk3/widgets/settings_mmc64.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_mmc64.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/settings_mmc64.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -108,7 +108,7 @@
if (cartridge_enable(CARTRIDGE_MMC64) < 0) {
/* failed to set resource */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), FALSE);
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"failed to enable " CARTNAME ", please set BIOS file.");
vice_gtk3_message_error(GTK_WINDOW(parent),
CARTNAME " Error",
@@ -116,7 +116,7 @@
}
} else if (!enabled) {
if (cartridge_disable(CARTRIDGE_MMC64) < 0) {
- log_error(LOG_ERR, "failed to disable " CARTNAME ".");
+ log_error(LOG_DEFAULT, "failed to disable " CARTNAME ".");
vice_gtk3_message_error(GTK_WINDOW(parent),
CARTNAME " Error",
"Failed to disable " CARTNAME ", please set BIOS file.");
Modified: trunk/vice/src/arch/gtk3/widgets/settings_netplay.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_netplay.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/settings_netplay.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -203,13 +203,13 @@
if (role == 0) {
/* attempt to start server */
if (network_start_server() < 0) {
- log_error(LOG_ERR, "Failed to start netplay server.");
+ log_error(LOG_DEFAULT, "Failed to start netplay server.");
failed = true;
}
} else {
/* start the client */
if (network_connect_client() < 0) {
- log_error(LOG_ERR, "Failed to start client.");
+ log_error(LOG_DEFAULT, "Failed to start client.");
failed = true;
}
}
Modified: trunk/vice/src/arch/gtk3/widgets/settings_ramlink.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_ramlink.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/settings_ramlink.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -114,7 +114,7 @@
if (state) {
if (cartridge_enable(CARTRIDGE_RAMLINK) < 0) {
- log_error(LOG_ERR, "failed to enable " CARTRIDGE_NAME_RAMLINK ".");
+ log_error(LOG_DEFAULT, "failed to enable " CARTRIDGE_NAME_RAMLINK ".");
vice_gtk3_message_error(GTK_WINDOW(parent),
CARTNAME " Error",
"Failed to enable " CARTNAME ".");
@@ -123,7 +123,7 @@
}
} else {
if (cartridge_disable(CARTRIDGE_RAMLINK) < 0) {
- log_error(LOG_ERR, "failed to disable " CARTRIDGE_NAME_RAMLINK ".");
+ log_error(LOG_DEFAULT, "failed to disable " CARTRIDGE_NAME_RAMLINK ".");
vice_gtk3_message_error(GTK_WINDOW(parent),
CARTNAME " Error",
"Failed to disable " CARTNAME ".");
Modified: trunk/vice/src/arch/gtk3/widgets/videomodelwidget.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/videomodelwidget.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/gtk3/widgets/videomodelwidget.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -85,7 +85,7 @@
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
if (resources_set_int(resource_name, model_id) < 0) {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"%s(): failed to set %s to %d\n",
__func__, resource_name, model_id);
} else {
Modified: trunk/vice/src/arch/sdl/archdep.c
===================================================================
--- trunk/vice/src/arch/sdl/archdep.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/sdl/archdep.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -113,7 +113,7 @@
* call, but it appears to work at least (BW)
*/
if (atexit(SDL_Quit) != 0) {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"failed to register SDL_Quit() with atexit().");
archdep_vice_exit(1);
}
Modified: trunk/vice/src/arch/sdl/joy.c
===================================================================
--- trunk/vice/src/arch/sdl/joy.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/sdl/joy.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -58,7 +58,7 @@
#define DEFAULT_JOYSTICK_FUZZ 1000
#ifdef HAVE_SDL_NUMJOYSTICKS
-static log_t sdljoy_log = LOG_ERR;
+static log_t sdljoy_log = LOG_DEFAULT;
/* Autorepeat in menu & vkbd */
static ui_menu_action_t autorepeat;
Modified: trunk/vice/src/arch/sdl/kbd.c
===================================================================
--- trunk/vice/src/arch/sdl/kbd.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/sdl/kbd.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -57,7 +57,7 @@
/* #define SDL_DEBUG */
-static log_t sdlkbd_log = LOG_ERR;
+static log_t sdlkbd_log = LOG_DEFAULT;
/* Menu keys */
int sdl_ui_menukeys[MENU_ACTION_NUM];
Modified: trunk/vice/src/arch/sdl/menu_common.c
===================================================================
--- trunk/vice/src/arch/sdl/menu_common.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/sdl/menu_common.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -96,7 +96,7 @@
break;
}
} else {
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"item %s doesn't have a callback but also not a"
" resource name set or a `checked` function set.",
item->string);
Modified: trunk/vice/src/arch/sdl/menu_screenshot.c
===================================================================
--- trunk/vice/src/arch/sdl/menu_screenshot.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/sdl/menu_screenshot.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -75,7 +75,7 @@
}
if (screenshot_save((char *) param, filename, sdl_active_canvas) < 0) {
- log_error(LOG_ERR, "Failed to save screenshot.");
+ log_error(LOG_DEFAULT, "Failed to save screenshot.");
ui_error("Failed to save screenshot.");
} else {
log_message(LOG_DEFAULT, "Saved %s screenshot to %s", (char *) param, filename);
Modified: trunk/vice/src/arch/sdl/menu_wic64.c
===================================================================
--- trunk/vice/src/arch/sdl/menu_wic64.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/sdl/menu_wic64.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -187,7 +187,7 @@
j++;
wic64_menu[j].string = NULL;
if (j >= MENTRIES) {
- log_error(LOG_ERR, "internal error: %s, %d >= MENTRIES(%d)", __FUNCTION__, j, MENTRIES);
+ log_error(LOG_DEFAULT, "internal error: %s, %d >= MENTRIES(%d)", __FUNCTION__, j, MENTRIES);
}
return (ui_callback_data_t) wic64_menu;
}
Modified: trunk/vice/src/arch/sdl/uimedia.c
===================================================================
--- trunk/vice/src/arch/sdl/uimedia.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/sdl/uimedia.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -119,7 +119,7 @@
/* no need for locale bullshit */
filename = create_proposed_screenshot_name("png");
if ((filename == NULL) || (screenshot_save("PNG", filename, canvas) < 0)) {
- log_error(LOG_ERR, "Failed to autosave screenshot.");
+ log_error(LOG_DEFAULT, "Failed to autosave screenshot.");
ui_error("Error autosaving screenshot.");
}
lib_free(filename);
Modified: trunk/vice/src/arch/sdl/uimenu.c
===================================================================
--- trunk/vice/src/arch/sdl/uimenu.c 2024-08-05 14:27:11 UTC (rev 45266)
+++ trunk/vice/src/arch/sdl/uimenu.c 2024-08-05 15:02:30 UTC (rev 45267)
@@ -480,7 +480,7 @@
break;
default:
- log_error(LOG_ERR,
+ log_error(LOG_DEFAULT,
"%s(): unhandled type %u for item %s without callback.",
__func__, item->type, item->string);
itemdata = sdl_menu_text_unknown;
@@ -2090,7 +2090,7 @@
if (item->callback != NULL) {
item->callback(1 /*activated*/, item->data);
} else {
- log_error(LOG_ERR, "%s(): no callback to trigger!\n", __func__);
+ log_error(LOG_D...
[truncated message content] |
|
From: <gp...@us...> - 2024-08-05 14:27:14
|
Revision: 45266
http://sourceforge.net/p/vice-emu/code/45266
Author: gpz
Date: 2024-08-05 14:27:11 +0000 (Mon, 05 Aug 2024)
Log Message:
-----------
some cosmetics
Modified Paths:
--------------
trunk/vice/src/arch/shared/archdep_startup_log_error.c
trunk/vice/src/init.c
trunk/vice/src/main.c
trunk/vice/src/resources.c
Modified: trunk/vice/src/arch/shared/archdep_startup_log_error.c
===================================================================
--- trunk/vice/src/arch/shared/archdep_startup_log_error.c 2024-08-04 21:59:34 UTC (rev 45265)
+++ trunk/vice/src/arch/shared/archdep_startup_log_error.c 2024-08-05 14:27:11 UTC (rev 45266)
@@ -42,7 +42,7 @@
#include "archdep_startup_log_error.h"
-/** \brief Log an error message while the log system isn't initliazed yet
+/** \brief Log an error message while the log system isn't initialized yet
*
* \param[in] format format string
*/
Modified: trunk/vice/src/init.c
===================================================================
--- trunk/vice/src/init.c 2024-08-04 21:59:34 UTC (rev 45265)
+++ trunk/vice/src/init.c 2024-08-05 14:27:11 UTC (rev 45266)
@@ -62,7 +62,7 @@
/* #define DBGINIT */
#ifdef DBGINIT
-#define DBG(x) printf x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
@@ -83,7 +83,7 @@
int init_resources(void)
{
- DBG(("init_resources\n"));
+ DBG(("init_resources"));
if (resources_init(machine_get_name())) {
archdep_startup_log_error("Cannot initialize resource handling.\n");
return -1;
@@ -150,6 +150,7 @@
return -1;
}
#endif
+ DBG(("init_resources done"));
return 0;
}
@@ -161,6 +162,7 @@
int init_cmdline_options(void)
{
+ DBG(("init_cmdline_options"));
if (cmdline_init()) {
archdep_startup_log_error("Cannot initialize command-line handling.\n");
return -1;
@@ -232,6 +234,7 @@
return -1;
}
#endif
+ DBG(("init_cmdline_options done"));
return 0;
}
Modified: trunk/vice/src/main.c
===================================================================
--- trunk/vice/src/main.c 2024-08-04 21:59:34 UTC (rev 45265)
+++ trunk/vice/src/main.c 2024-08-05 14:27:11 UTC (rev 45266)
@@ -74,7 +74,7 @@
#endif
#ifdef DEBUG_MAIN
-#define DBG(x) printf x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
@@ -125,13 +125,72 @@
log_t main_log;
-/* This is the main program entry point. Call this from `main()'. */
-int main_program(int argc, char **argv)
+static void vice_banner(void)
{
int i, n;
const char *program_name;
char term_tmp[TERM_TMP_SIZE];
size_t name_len;
+
+ program_name = archdep_program_name();
+
+ /* NOTE: we do NOT use main_log here on purpose, this is so we can output the
+ welcome banner without the "Main:" prefix */
+
+ log_message(LOG_DEFAULT, " ");
+#ifdef USE_SVN_REVISION
+ log_message(LOG_DEFAULT, LOG_COL_LWHITE "*** VICE Version %s, rev %s ***" LOG_COL_OFF, VERSION, VICE_SVN_REV_STRING);
+#else
+ log_message(LOG_DEFAULT, LOG_COL_LWHITE "*** VICE Version %s ***" LOG_COL_OFF, VERSION);
+#endif
+ log_message(LOG_DEFAULT, " ");
+ if (machine_class == VICE_MACHINE_VSID) {
+ log_message(LOG_DEFAULT, "Welcome to %s, the free portable SID Player.",
+ program_name);
+ } else {
+ log_message(LOG_DEFAULT, "Welcome to %s, the free portable %s Emulator.",
+ program_name, machine_name);
+ }
+ log_message(LOG_DEFAULT, " ");
+
+ log_message(LOG_DEFAULT, "Current VICE team members:");
+ n = 0; *term_tmp = 0;
+ for (i = 0; core_team[i].name != NULL; i++) {
+ name_len = strlen(core_team[i].name);
+ /* XXX: reject names that will never fit, for now */
+ if ((int)name_len + 3 > TERM_TMP_SIZE) {
+ log_warning(LOG_DEFAULT, "%s:%d: name '%s' too large for buffer",
+ __FILE__, __LINE__, core_team[i].name);
+ break; /* this will still write out whatever was in the buffer */
+ }
+
+ if (n + (int)name_len + 3 > TERM_TMP_SIZE) { /* +3 for ", \0" */
+ log_message(LOG_DEFAULT, "%s", term_tmp);
+ strcpy(term_tmp, core_team[i].name);
+ n = (int)name_len;
+ } else {
+ strcat(term_tmp, core_team[i].name);
+ n += (int)name_len;
+ }
+ if (core_team[i + 1].name == NULL) {
+ strcat(term_tmp, ".");
+ } else {
+ strcat(term_tmp, ", ");
+ n += 2;
+ }
+ }
+ log_message(LOG_DEFAULT, "%s", term_tmp);
+
+ log_message(LOG_DEFAULT, " ");
+ log_message(LOG_DEFAULT, LOG_COL_LWHITE "This is free software with ABSOLUTELY NO WARRANTY." LOG_COL_OFF);
+ log_message(LOG_DEFAULT, LOG_COL_LWHITE "See the \"About VICE\" command for more info." LOG_COL_OFF);
+ log_message(LOG_DEFAULT, " ");
+}
+
+/* This is the main program entry point. Call this from `main()'. */
+int main_program(int argc, char **argv)
+{
+ int i, n;
int reserr;
char *cmdline;
#ifdef WINDOWS_COMPILE
@@ -192,7 +251,7 @@
-silent => no logging
-seed => set the random seed
*/
- DBG(("main:early cmdline(argc:%d)\n", argc));
+ DBG(("main:early parse cmdline(argc:%d)", argc));
for (i = 1; i < argc; i++) {
if ((!strcmp(argv[i], "-console")) || (!strcmp(argv[i], "--console"))) {
console_mode = true;
@@ -199,9 +258,9 @@
/* video_disabled_mode = 1; Breaks exitscreenshot */
} else if ((!strcmp(argv[i], "-version")) || (!strcmp(argv[i], "--version"))) {
#ifdef USE_SVN_REVISION
- printf("%s (VICE %s SVN r%d)\n", archdep_program_name(), VERSION, VICE_SVN_REV_NUMBER);
+ log_message(LOG_DEFAULT, "%s (VICE %s SVN r%d)\n", archdep_program_name(), VERSION, VICE_SVN_REV_NUMBER);
#else
- printf("%s (VICE %s)\n", archdep_program_name(), VERSION);
+ log_message(LOG_DEFAULT, "%s (VICE %s)\n", archdep_program_name(), VERSION);
#endif
archdep_program_name_free();
archdep_program_path_free();
@@ -251,17 +310,19 @@
}
}
- DBG(("main:archdep_init(argc:%d)\n", argc));
+ DBG(("main:archdep_init(argc:%d)", argc));
if (archdep_init(&argc, argv) != 0) {
archdep_startup_log_error("archdep_init failed.\n");
return -1;
}
+ DBG(("main:early init"));
tick_init();
maincpu_early_init();
machine_setup_context();
drive_setup_context();
machine_early_init();
+ DBG(("main:early init done"));
/* Initialize system file locator. */
sysfile_init(machine_name);
@@ -272,6 +333,7 @@
return -1;
}
+ DBG(("main:early gfxoutput init"));
gfxoutput_early_init((int)help_requested);
gfxoutput_resources_init();
if (gfxoutput_cmdline_options_init() < 0) {
@@ -278,6 +340,7 @@
init_cmdline_options_fail("gfxoutput");
return -1;
}
+ DBG(("main:early gfxoutput init done"));
/* Set factory defaults. */
if (resources_set_defaults() < 0) {
@@ -299,7 +362,7 @@
/* Initialize the user interface. `ui_init_with_args()' might need to handle the
command line somehow, so we call it before parsing the options.
(e.g. under X11, the `-display' option is handled independently). */
- DBG(("main:ui_init(argc:%d)\n", argc));
+ DBG(("main:ui_init(argc:%d)", argc));
if (!console_mode) {
ui_init_with_args(&argc, argv);
}
@@ -318,6 +381,7 @@
}
/* FIXME: it should be possible to init the log system much earlier */
+ DBG(("main:log init"));
if (log_init() < 0) {
const char *logfile = NULL;
@@ -335,74 +399,21 @@
main_log = log_open("Main");
- DBG(("main:initcmdline_check_args(argc:%d)\n", argc));
+ DBG(("main:initcmdline_check_args(argc:%d)", argc));
if (initcmdline_check_args(argc, argv) < 0) {
return -1;
}
/* Initialize the user interface, 2nd part. */
- DBG(("main:uidata_init(argc:%d)\n", argc));
+ DBG(("main:uidata_init(argc:%d)", argc));
if (!console_mode && ui_init() < 0) {
archdep_startup_log_error("Cannot initialize the UI.\n");
return -1;
}
- program_name = archdep_program_name();
-
/* VICE boot sequence. */
+ vice_banner();
- /* NOTE: we do NOT use main_log here on purpose, this is so we can output the
- welcome banner without the "Main:" prefix */
-
- log_message(LOG_DEFAULT, " ");
-#ifdef USE_SVN_REVISION
- log_message(LOG_DEFAULT, LOG_COL_LWHITE "*** VICE Version %s, rev %s ***" LOG_COL_OFF, VERSION, VICE_SVN_REV_STRING);
-#else
- log_message(LOG_DEFAULT, LOG_COL_LWHITE "*** VICE Version %s ***" LOG_COL_OFF, VERSION);
-#endif
- log_message(LOG_DEFAULT, " ");
- if (machine_class == VICE_MACHINE_VSID) {
- log_message(LOG_DEFAULT, "Welcome to %s, the free portable SID Player.",
- program_name);
- } else {
- log_message(LOG_DEFAULT, "Welcome to %s, the free portable %s Emulator.",
- program_name, machine_name);
- }
- log_message(LOG_DEFAULT, " ");
-
- log_message(LOG_DEFAULT, "Current VICE team members:");
- n = 0; *term_tmp = 0;
- for (i = 0; core_team[i].name != NULL; i++) {
- name_len = strlen(core_team[i].name);
- /* XXX: reject names that will never fit, for now */
- if ((int)name_len + 3 > TERM_TMP_SIZE) {
- log_warning(LOG_DEFAULT, "%s:%d: name '%s' too large for buffer",
- __FILE__, __LINE__, core_team[i].name);
- break; /* this will still write out whatever was in the buffer */
- }
-
- if (n + (int)name_len + 3 > TERM_TMP_SIZE) { /* +3 for ", \0" */
- log_message(LOG_DEFAULT, "%s", term_tmp);
- strcpy(term_tmp, core_team[i].name);
- n = (int)name_len;
- } else {
- strcat(term_tmp, core_team[i].name);
- n += (int)name_len;
- }
- if (core_team[i + 1].name == NULL) {
- strcat(term_tmp, ".");
- } else {
- strcat(term_tmp, ", ");
- n += 2;
- }
- }
- log_message(LOG_DEFAULT, "%s", term_tmp);
-
- log_message(LOG_DEFAULT, " ");
- log_message(LOG_DEFAULT, LOG_COL_LWHITE "This is free software with ABSOLUTELY NO WARRANTY." LOG_COL_OFF);
- log_message(LOG_DEFAULT, LOG_COL_LWHITE "See the \"About VICE\" command for more info." LOG_COL_OFF);
- log_message(LOG_DEFAULT, " ");
-
/* from this point on use main_log ! */
/* lib_free(program_name); */
Modified: trunk/vice/src/resources.c
===================================================================
--- trunk/vice/src/resources.c 2024-08-04 21:59:34 UTC (rev 45265)
+++ trunk/vice/src/resources.c 2024-08-05 14:27:11 UTC (rev 45266)
@@ -952,7 +952,7 @@
unsigned int i;
log_message(LOG_DEFAULT, "%s", ""); /* ugly hack to produce a blank log line, but not trigger a warning */
- log_message(LOG_DEFAULT, "Initializing resources...");
+ log_message(LOG_DEFAULT, "Setting resources to default...");
/* the cartridge system uses internal state variables so the default cartridge
can be unset without changing the attached cartridge and/or attach another
@@ -998,6 +998,7 @@
if (resource_modified_callback != NULL) {
resources_exec_callback_chain(resource_modified_callback, NULL);
}
+ log_message(LOG_DEFAULT, "Done setting resources to default.");
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-08-04 21:59:36
|
Revision: 45265
http://sourceforge.net/p/vice-emu/code/45265
Author: gpz
Date: 2024-08-04 21:59:34 +0000 (Sun, 04 Aug 2024)
Log Message:
-----------
fix check for terminal, seems to work in both cmd.exe and msys
Modified Paths:
--------------
trunk/vice/src/arch/shared/archdep_default_logger.c
Modified: trunk/vice/src/arch/shared/archdep_default_logger.c
===================================================================
--- trunk/vice/src/arch/shared/archdep_default_logger.c 2024-08-04 19:25:09 UTC (rev 45264)
+++ trunk/vice/src/arch/shared/archdep_default_logger.c 2024-08-04 21:59:34 UTC (rev 45265)
@@ -34,6 +34,7 @@
#ifdef WINDOWS_COMPILE
# include <windows.h>
+# include <sys/stat.h>
#endif
#include <stdio.h>
@@ -84,7 +85,27 @@
int archdep_default_logger_is_terminal(void)
{
- return 1; /* FIXME */
+ struct stat statinfo;
+ DWORD temp;
+ const bool mode = GetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), &temp);
+ const int type = GetFileType(GetStdHandle(STD_OUTPUT_HANDLE));
+ /* this works in cmd.exe */
+ if (mode || (type == FILE_TYPE_CHAR)) {
+ return 1;
+ }
+
+ /* extra check seems to work for msys */
+ fstat(fileno(stdout), &statinfo);
+ /* 1 - 0 msys (-noredir)
+ 0 - 1 msys (-noredir) > bla
+ 0 - 1 cmd -noredir > bla
+ 0 - 0 cmd > bla
+ 0 - 0 cmd
+ */
+ if (S_ISFIFO(statinfo.st_mode) && !S_ISREG(statinfo.st_mode)) {
+ return 1;
+ }
+ return 0;
}
#elif defined(UNIX_COMPILE) || defined(ARCHEP_OS_BEOS)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-08-04 19:25:14
|
Revision: 45264
http://sourceforge.net/p/vice-emu/code/45264
Author: gpz
Date: 2024-08-04 19:25:09 +0000 (Sun, 04 Aug 2024)
Log Message:
-----------
make log_debug also use log_t, add log_printf to work as a simple way to print to the default log
Modified Paths:
--------------
trunk/vice/src/arch/gtk3/uimon.c
trunk/vice/src/arch/gtk3/vsidstate.c
trunk/vice/src/arch/sdl/fullscreen.c
trunk/vice/src/arch/sdl/kbd.c
trunk/vice/src/arch/sdl/ui.c
trunk/vice/src/arch/sdl/video_sdl1.c
trunk/vice/src/arch/sdl/video_sdl2.c
trunk/vice/src/arch/shared/archdep_spawn.c
trunk/vice/src/arch/shared/hotkeys/parser.c
trunk/vice/src/arch/shared/sounddrv/lamelib.c
trunk/vice/src/arch/shared/sounddrv/soundaiff.c
trunk/vice/src/arch/shared/sounddrv/soundiff.c
trunk/vice/src/arch/shared/sounddrv/soundmp3.c
trunk/vice/src/arch/shared/sounddrv/soundvoc.c
trunk/vice/src/arch/shared/sounddrv/soundwav.c
trunk/vice/src/attach.c
trunk/vice/src/autostart-prg.c
trunk/vice/src/autostart.c
trunk/vice/src/c128/c128mem.c
trunk/vice/src/c128/c128mmu.c
trunk/vice/src/c1541.c
trunk/vice/src/c64/c64bus.c
trunk/vice/src/c64/c64parallel.c
trunk/vice/src/c64/c64rom.c
trunk/vice/src/c64/cart/blackbox9.c
trunk/vice/src/c64/cart/dqbb.c
trunk/vice/src/c64/cart/ide64.c
trunk/vice/src/c64/cart/mmc64.c
trunk/vice/src/c64/cart/mmcreplay.c
trunk/vice/src/c64/cart/ramcart.c
trunk/vice/src/c64/cart/rrnetmk3.c
trunk/vice/src/cbm2/cart/cbm2-generic.c
trunk/vice/src/cbm2/cart/cbm2cart.c
trunk/vice/src/cbm2/cbm2cia1.c
trunk/vice/src/cbm2/cbm2datasette.c
trunk/vice/src/cbm2/cbm5x0cia1.c
trunk/vice/src/cbmdos.c
trunk/vice/src/core/ciacore.c
trunk/vice/src/core/flash040core.c
trunk/vice/src/core/m93c86.c
trunk/vice/src/core/ser-eeprom.c
trunk/vice/src/core/spi-flash.c
trunk/vice/src/core/spi-sdcard.c
trunk/vice/src/crt.c
trunk/vice/src/crtc/crtc-resources.c
trunk/vice/src/crtc/crtc.c
trunk/vice/src/datasette/datasette.c
trunk/vice/src/debug.c
trunk/vice/src/diskimage/diskimage.c
trunk/vice/src/dma.c
trunk/vice/src/drive/drive-resources.c
trunk/vice/src/drive/drive.c
trunk/vice/src/drive/iec/cmdhd.c
trunk/vice/src/drive/iecieee/via2d.c
trunk/vice/src/event.c
trunk/vice/src/fliplist.c
trunk/vice/src/fsdevice/fsdevice-read.c
trunk/vice/src/fsdevice/fsdevice-write.c
trunk/vice/src/fsdevice/fsdevice.c
trunk/vice/src/gcr.c
trunk/vice/src/gfxoutputdrv/ffmpegdrv.c
trunk/vice/src/gfxoutputdrv/ffmpegexedrv.c
trunk/vice/src/gfxoutputdrv/ffmpeglib.c
trunk/vice/src/gfxoutputdrv/zmbvdrv.c
trunk/vice/src/iecbus/iecbus.c
trunk/vice/src/interrupt.c
trunk/vice/src/joyport/mouse.c
trunk/vice/src/joyport/mouse_1351.c
trunk/vice/src/joyport/mouse_neos.c
trunk/vice/src/joyport/mouse_paddle.c
trunk/vice/src/joyport/mouse_quadrature.c
trunk/vice/src/joyport/powerpad.c
trunk/vice/src/kbdbuf.c
trunk/vice/src/keyboard.c
trunk/vice/src/keymap.c
trunk/vice/src/log.c
trunk/vice/src/log.h
trunk/vice/src/machine-bus.c
trunk/vice/src/monitor/mon_file.c
trunk/vice/src/network.c
trunk/vice/src/opencbmlib.c
trunk/vice/src/palette.c
trunk/vice/src/parallel/parallel-trap.c
trunk/vice/src/parallel/parallel.c
trunk/vice/src/pet/petbus.c
trunk/vice/src/plus4/cart/plus4-generic.c
trunk/vice/src/plus4/cart/plus4cart.c
trunk/vice/src/plus4/plus4tcbm.c
trunk/vice/src/plus4/ted-fetch.c
trunk/vice/src/plus4/ted-mem.c
trunk/vice/src/plus4/ted-timer.c
trunk/vice/src/plus4/ted.c
trunk/vice/src/printerdrv/drv-ascii.c
trunk/vice/src/printerdrv/drv-mps803.c
trunk/vice/src/printerdrv/drv-nl10.c
trunk/vice/src/printerdrv/drv-raw.c
trunk/vice/src/printerdrv/interface-serial.c
trunk/vice/src/printerdrv/interface-userport.c
trunk/vice/src/printerdrv/output-graphics.c
trunk/vice/src/printerdrv/output-select.c
trunk/vice/src/printerdrv/output-text.c
trunk/vice/src/printerdrv/printer.c
trunk/vice/src/rs232drv/rs232.c
trunk/vice/src/rs232drv/rsuser.c
trunk/vice/src/serial/fsdrive.c
trunk/vice/src/serial/realdevice.c
trunk/vice/src/serial/serial-iec-bus.c
trunk/vice/src/serial/serial-trap.c
trunk/vice/src/sid/hardsid.c
trunk/vice/src/sid/sid-resources.c
trunk/vice/src/tape/tap.c
trunk/vice/src/traps.c
trunk/vice/src/vdc/vdc-resources.c
trunk/vice/src/vdrive/vdrive-command.c
trunk/vice/src/vdrive/vdrive-dir.c
trunk/vice/src/vdrive/vdrive-iec.c
trunk/vice/src/vdrive/vdrive-rel.c
trunk/vice/src/vdrive/vdrive.c
trunk/vice/src/vic20/cart/finalexpansion.c
trunk/vice/src/vic20/cart/megacart.c
trunk/vice/src/vic20/cart/mikroassembler.c
trunk/vice/src/vic20/cart/superexpander.c
trunk/vice/src/vicii/vicii-fetch.c
trunk/vice/src/vicii/vicii.c
trunk/vice/src/viciisc/vicii-cycle.c
trunk/vice/src/viciisc/vicii-fetch.c
trunk/vice/src/video/video-canvas.c
trunk/vice/src/video/video-color.c
trunk/vice/src/video/video-render-palntsc.c
trunk/vice/src/video/video-render.c
trunk/vice/src/video/video-resources.c
trunk/vice/src/video/video-sound.c
trunk/vice/src/vsync.c
trunk/vice/src/zfile.c
Modified: trunk/vice/src/arch/gtk3/uimon.c
===================================================================
--- trunk/vice/src/arch/gtk3/uimon.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/arch/gtk3/uimon.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -1454,7 +1454,7 @@
console_t *uimon_window_open(bool display_now)
{
- if (monui_log = LOG_DEFAULT) {
+ if (monui_log == LOG_DEFAULT) {
monui_log = log_open("Monitor UI");
}
Modified: trunk/vice/src/arch/gtk3/vsidstate.c
===================================================================
--- trunk/vice/src/arch/gtk3/vsidstate.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/arch/gtk3/vsidstate.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -295,7 +295,7 @@
}
}
buffer[t] = '\0';
- log_debug("VSID STATE: Tunes played: %s (%d/%d)", buffer, p, count);
+ log_debug(LOG_DEFAULT, "VSID STATE: Tunes played: %s (%d/%d)", buffer, p, count);
}
Modified: trunk/vice/src/arch/sdl/fullscreen.c
===================================================================
--- trunk/vice/src/arch/sdl/fullscreen.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/arch/sdl/fullscreen.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -44,7 +44,7 @@
#include "videoarch.h"
#ifdef SDL_DEBUG
-#define DBG(x) log_debug x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
Modified: trunk/vice/src/arch/sdl/kbd.c
===================================================================
--- trunk/vice/src/arch/sdl/kbd.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/arch/sdl/kbd.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -228,7 +228,7 @@
ui_action_map_t *map;
#ifdef SDL_DEBUG
- log_debug("%s: %i (%s),%04x", __func__, key, SDL_GetKeyName(SDL1x_to_SDL2x_Keys(key)), mod);
+ log_debug(LOG_DEFAULT, "%s: %i (%s),%04x", __func__, key, SDL_GetKeyName(SDL1x_to_SDL2x_Keys(key)), mod);
#endif
#ifdef WINDOWS_COMPILE
/* HACK: The Alt-Gr Key seems to work differently on windows and linux.
@@ -271,7 +271,7 @@
void sdlkbd_release(SDLKey key, SDLMod mod)
{
#ifdef SDL_DEBUG
- log_debug("%s: %i (%s),%04x", __func__, key, SDL_GetKeyName(key), mod);
+ log_debug(LOG_DEFAULT, "%s: %i (%s),%04x", __func__, key, SDL_GetKeyName(key), mod);
#endif
#ifdef WINDOWS_COMPILE
@@ -294,7 +294,7 @@
ui_menu_action_t i, retval = MENU_ACTION_NONE;
#ifdef SDL_DEBUG
- log_debug("%s: %i (%s),%04x", __func__, key, SDL_GetKeyName(key), mod);
+ log_debug(LOG_DEFAULT, "%s: %i (%s),%04x", __func__, key, SDL_GetKeyName(key), mod);
#endif
if (key != SDLK_UNKNOWN) {
@@ -316,7 +316,7 @@
ui_menu_action_t i, retval = MENU_ACTION_NONE_RELEASE;
#ifdef SDL_DEBUG
- log_debug("%s: %i (%s),%04x", __func__, key, SDL_GetKeyName(key), mod);
+ log_debug(LOG_DEFAULT, "%s: %i (%s),%04x", __func__, key, SDL_GetKeyName(key), mod);
#endif
if (key != SDLK_UNKNOWN) {
Modified: trunk/vice/src/arch/sdl/ui.c
===================================================================
--- trunk/vice/src/arch/sdl/ui.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/arch/sdl/ui.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -92,7 +92,7 @@
#endif
#ifdef SDL_DEBUG
-#define DBG(x) log_debug x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
Modified: trunk/vice/src/arch/sdl/video_sdl1.c
===================================================================
--- trunk/vice/src/arch/sdl/video_sdl1.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/arch/sdl/video_sdl1.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -63,7 +63,7 @@
#include "vsync.h"
#ifdef SDL_DEBUG
-#define DBG(x) log_debug x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
Modified: trunk/vice/src/arch/sdl/video_sdl2.c
===================================================================
--- trunk/vice/src/arch/sdl/video_sdl2.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/arch/sdl/video_sdl2.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -75,7 +75,7 @@
#include "vsync.h"
#ifdef SDL_DEBUG
-#define DBG(x) log_debug x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
Modified: trunk/vice/src/arch/shared/archdep_spawn.c
===================================================================
--- trunk/vice/src/arch/shared/archdep_spawn.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/arch/shared/archdep_spawn.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -65,7 +65,7 @@
/* #define DEBUG_SPAWN */
#ifdef DEBUG_SPAWN
-#define LOG(a) log_debug a
+#define LOG(a) log_printf a
#else
#define LOG(a)
#endif
Modified: trunk/vice/src/arch/shared/hotkeys/parser.c
===================================================================
--- trunk/vice/src/arch/shared/hotkeys/parser.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/arch/shared/hotkeys/parser.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -1154,7 +1154,7 @@
char *trimmed = vhk_parser_strtrim(line);
if (vhk_debug) {
- log_debug("(%s) LINE %3ld: '%s'",
+ log_debug(LOG_DEFAULT, "(%s) LINE %3ld: '%s'",
ifstack_true() ? "TRUE " : "FALSE",
textfile_reader_linenum(&reader),
line);
Modified: trunk/vice/src/arch/shared/sounddrv/lamelib.c
===================================================================
--- trunk/vice/src/arch/shared/sounddrv/lamelib.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/arch/shared/sounddrv/lamelib.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -41,7 +41,7 @@
#define GET_SYMBOL_AND_TEST( _name_ ) \
lamelib.p_##_name_ = (_name_##_t) vice_dynlib_symbol(lib_so, #_name_ ); \
if (!lamelib.p_##_name_ ) { \
- log_debug("getting symbol " #_name_ " failed!"); \
+ log_debug(LOG_DEFAULT, "getting symbol " #_name_ " failed!"); \
return -1; \
}
@@ -51,7 +51,7 @@
lib_so = vice_dynlib_open(ARCHDEP_LAME_SO_NAME);
if (!lib_so) {
- log_debug("opening dynamic library " ARCHDEP_LAME_SO_NAME " failed!");
+ log_debug(LOG_DEFAULT, "opening dynamic library " ARCHDEP_LAME_SO_NAME " failed!");
return -1;
}
@@ -73,7 +73,7 @@
{
if (lib_so) {
if (vice_dynlib_close(lib_so) != 0) {
- log_debug("closing dynamic library " ARCHDEP_LAME_SO_NAME " failed!");
+ log_debug(LOG_DEFAULT, "closing dynamic library " ARCHDEP_LAME_SO_NAME " failed!");
}
}
lib_so = NULL;
Modified: trunk/vice/src/arch/shared/sounddrv/soundaiff.c
===================================================================
--- trunk/vice/src/arch/shared/sounddrv/soundaiff.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/arch/shared/sounddrv/soundaiff.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -144,7 +144,7 @@
aiff_fd = NULL;
if (res < 0) {
- log_debug("ERROR aiff_close failed.");
+ log_debug(LOG_DEFAULT, "ERROR aiff_close failed.");
}
}
Modified: trunk/vice/src/arch/shared/sounddrv/soundiff.c
===================================================================
--- trunk/vice/src/arch/shared/sounddrv/soundiff.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/arch/shared/sounddrv/soundiff.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -149,7 +149,7 @@
iff_fd = NULL;
if (res < 0) {
- log_debug("ERROR iff_close failed.");
+ log_debug(LOG_DEFAULT, "ERROR iff_close failed.");
}
}
Modified: trunk/vice/src/arch/shared/sounddrv/soundmp3.c
===================================================================
--- trunk/vice/src/arch/shared/sounddrv/soundmp3.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/arch/shared/sounddrv/soundmp3.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -124,7 +124,7 @@
mp3_size = vice_lame_encode_flush(gfp, mp3_buffer, MP3_BUFFER_SIZE);
if (fwrite(mp3_buffer, 1, (size_t)mp3_size, mp3_fd) != (size_t)mp3_size) {
- log_debug("ERROR mp3_close failed.");
+ log_debug(LOG_DEFAULT, "ERROR mp3_close failed.");
}
fclose(mp3_fd);
mp3_fd = NULL;
@@ -163,7 +163,7 @@
#ifndef HAVE_STATIC_LAME
int result = lamelib_open();
if (result != 0) {
- log_debug("ERROR setting up dynamic lame lib!");
+ log_debug(LOG_DEFAULT, "ERROR setting up dynamic lame lib!");
return result;
}
#endif
Modified: trunk/vice/src/arch/shared/sounddrv/soundvoc.c
===================================================================
--- trunk/vice/src/arch/shared/sounddrv/soundvoc.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/arch/shared/sounddrv/soundvoc.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -154,7 +154,7 @@
voc_fd = NULL;
if (res < 0) {
- log_debug("ERROR voc_close failed.");
+ log_debug(LOG_DEFAULT, "ERROR voc_close failed.");
}
}
Modified: trunk/vice/src/arch/shared/sounddrv/soundwav.c
===================================================================
--- trunk/vice/src/arch/shared/sounddrv/soundwav.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/arch/shared/sounddrv/soundwav.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -121,7 +121,7 @@
fclose(wav_fd);
wav_fd = NULL;
if (res != 0) {
- log_debug("ERROR wav_close failed.");
+ log_debug(LOG_DEFAULT, "ERROR wav_close failed.");
}
}
Modified: trunk/vice/src/attach.c
===================================================================
--- trunk/vice/src/attach.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/attach.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -56,7 +56,7 @@
#include "p64.h"
#ifdef DEBUG_ATTACH
-#define DBG(x) log_debug x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
Modified: trunk/vice/src/autostart-prg.c
===================================================================
--- trunk/vice/src/autostart-prg.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/autostart-prg.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -49,7 +49,7 @@
#include "drive.h"
#ifdef DEBUG_AUTOSTART
-#define DBG(_x_) log_debug _x_
+#define DBG(_x_) log_printf _x_
#else
#define DBG(_x_)
#endif
Modified: trunk/vice/src/autostart.c
===================================================================
--- trunk/vice/src/autostart.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/autostart.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -84,13 +84,13 @@
#include "vsync.h"
#ifdef DEBUG_AUTOSTART
-#define DBG(_x_) log_debug _x_
+#define DBG(_x_) log_printf _x_
#else
#define DBG(_x_)
#endif
#ifdef DEBUG_AUTOSTARTWAIT
-#define DBGWAIT(_x_) log_debug _x_
+#define DBGWAIT(_x_) log_printf _x_
#else
#define DBGWAIT(_x_)
#endif
Modified: trunk/vice/src/c128/c128mem.c
===================================================================
--- trunk/vice/src/c128/c128mem.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/c128/c128mem.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -78,13 +78,13 @@
/* #define DEBUG_KEYS */
#ifdef DEBUG_MMU
-#define DEBUG_PRINT(x) log_debug x
+#define DEBUG_PRINT(x) log_printf x
#else
#define DEBUG_PRINT(x)
#endif
#ifdef DEBUG_KEYS
-#define DBGKEY(x) log_debug x
+#define DBGKEY(x) log_printf x
#else
#define DBGKEY(x)
#endif
Modified: trunk/vice/src/c128/c128mmu.c
===================================================================
--- trunk/vice/src/c128/c128mmu.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/c128/c128mmu.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -60,7 +60,7 @@
/* #define DEBUG_KEYS */
#ifdef DEBUG_KEYS
-#define DBGKEY(x) log_debug x
+#define DBGKEY(x) log_printf x
#else
#define DBGKEY(x)
#endif
Modified: trunk/vice/src/c1541.c
===================================================================
--- trunk/vice/src/c1541.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/c1541.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -3935,7 +3935,7 @@
if (geosFileStruc == GEOS_FILE_STRUC_SEQ) {
#ifdef DEBUG_DRIVE
- log_debug("DEBUG: GEOS_FILE_STRUC_SEQ (%d:%d)", infoTrk, infoSec);
+ log_debug(LOG_DEFAULT, "DEBUG: GEOS_FILE_STRUC_SEQ (%d:%d)", infoTrk, infoSec);
#endif
/* sequential file contained in cvt file
* since vlir block is the first data block simply put it to
@@ -3967,7 +3967,7 @@
}
} else if (geosFileStruc == GEOS_FILE_STRUC_VLIR) {
#ifdef DEBUG_DRIVE
- log_debug("DEBUG: GEOS_FILE_STRUC_VLIR (%d:%d)", infoTrk, infoSec);
+ log_debug(LOG_DEFAULT, "DEBUG: GEOS_FILE_STRUC_VLIR (%d:%d)", infoTrk, infoSec);
#endif
/* The vlir block in cvt files is a conversion of the vlir
* block on cbm disks.
@@ -3983,7 +3983,7 @@
}
#ifdef DEBUG_DRIVE
- log_debug("DEBUG: VLIR scan record chains");
+ log_debug(LOG_DEFAULT, "DEBUG: VLIR scan record chains");
#endif
/* Replace the TS-chain-origins with NoOfBlocks/BytesInLastSector */
@@ -3997,13 +3997,13 @@
while (aktTrk != 0 && vlirIdx <= 254) {
if (aktTrk != 0) { /* Record exists and is not empty */
#ifdef DEBUG_DRIVE
- log_debug("DEBUG: VLIR IDX %u", vlirIdx);
+ log_debug(LOG_DEFAULT, "DEBUG: VLIR IDX %u", vlirIdx);
#endif
NoOfChains++;
while (aktTrk != 0) {
/* Read the chain and collect No Of Blocks */
#ifdef DEBUG_DRIVE
- log_debug("DEBUG: VLIR BLOCK (%u:%u)", aktTrk, aktSec);
+ log_debug(LOG_DEFAULT, "DEBUG: VLIR BLOCK (%u:%u)", aktTrk, aktSec);
#endif
if (vdrive_read_sector(drives[unit], block, aktTrk, aktSec) != 0) {
@@ -4051,7 +4051,7 @@
}
#ifdef DEBUG_DRIVE
- log_debug("DEBUG: VLIR output record chains");
+ log_debug(LOG_DEFAULT, "DEBUG: VLIR output record chains");
#endif
/* now output the record chains
(leave the TS-Pointers since they are usesless now) */
@@ -4062,13 +4062,13 @@
while (aktTrk != 0 && vlirIdx <= 254) {
if (aktTrk != 0) {
#ifdef DEBUG_DRIVE
- log_debug("DEBUG: VLIR IDX %u", vlirIdx);
+ log_debug(LOG_DEFAULT, "DEBUG: VLIR IDX %u", vlirIdx);
#endif
NoOfChains--;
/* Record exists */
while (aktTrk != 0) {
#ifdef DEBUG_DRIVE
- log_debug("DEBUG: VLIR BLOCK (%u:%u)", aktTrk, aktSec);
+ log_debug(LOG_DEFAULT, "DEBUG: VLIR BLOCK (%u:%u)", aktTrk, aktSec);
#endif
if (vdrive_read_sector(drives[unit], block, aktTrk, aktSec) != 0) {
fprintf(stderr,
@@ -4354,7 +4354,7 @@
if (geosFileStruc == GEOS_FILE_STRUC_SEQ) {
#ifdef DEBUG_DRIVE
- log_debug("DEBUG: GEOS_FILE_STRUC_SEQ (%u:%u)", vlirTrk, vlirSec);
+ log_debug(LOG_DEFAULT, "DEBUG: GEOS_FILE_STRUC_SEQ (%u:%u)", vlirTrk, vlirSec);
#endif
/* normal seq file (rest like standard files) */
lastTrk = vlirTrk;
@@ -4407,7 +4407,7 @@
}
} else if (geosFileStruc == GEOS_FILE_STRUC_VLIR) {
#ifdef DEBUG_DRIVE
- log_debug("DEBUG: GEOS_FILE_STRUC_VLIR (%u:%u)", vlirTrk, vlirSec);
+ log_debug(LOG_DEFAULT, "DEBUG: GEOS_FILE_STRUC_VLIR (%u:%u)", vlirTrk, vlirSec);
#endif
/* in a cvt file containing a vlir file the vlir block contains
* a pair (NoOfBlocksForChain, BytesInLastBlock + 2) for every vlir
@@ -4420,7 +4420,7 @@
while (vlirIdx <= 254) {
if (vlirBlock[vlirIdx] != 0) {
#ifdef DEBUG_DRIVE
- log_debug("DEBUG: VLIR IDX %d (%u:%u)", vlirIdx, vlirTrk, vlirSec);
+ log_debug(LOG_DEFAULT, "DEBUG: VLIR IDX %d (%u:%u)", vlirIdx, vlirTrk, vlirSec);
#endif
lastTrk = vlirTrk;
lastSec = vlirSec;
@@ -4464,7 +4464,7 @@
/* write it to disk */
#ifdef DEBUG_DRIVE
- log_debug("DEBUG: VLIR BLOCK (%u:%u)", aktTrk, aktSec);
+ log_debug(LOG_DEFAULT, "DEBUG: VLIR BLOCK (%u:%u)", aktTrk, aktSec);
#endif
if (vdrive_write_sector(drives[unit], block, aktTrk, aktSec) != 0) {
@@ -4611,7 +4611,7 @@
30);
#ifdef DEBUG_DRIVE
- log_debug("DEBUG: closing, write DIR slot (%u %u) and BAM.",
+ log_debug(LOG_DEFAULT, "DEBUG: closing, write DIR slot (%u %u) and BAM.",
dir.track, dir.sector);
#endif
vdrive_write_sector(drives[dev], dir.buffer, dir.track, dir.sector);
Modified: trunk/vice/src/c64/c64bus.c
===================================================================
--- trunk/vice/src/c64/c64bus.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/c64/c64bus.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -36,7 +36,7 @@
#ifdef DEBUG_C64BUS
#include "log.h"
-#define DBG(x) log_debug x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
Modified: trunk/vice/src/c64/c64parallel.c
===================================================================
--- trunk/vice/src/c64/c64parallel.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/c64/c64parallel.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -45,7 +45,7 @@
#include "via.h"
#ifdef C64PAR_DEBUG
-#define DBG(x) log_debug x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
Modified: trunk/vice/src/c64/c64rom.c
===================================================================
--- trunk/vice/src/c64/c64rom.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/c64/c64rom.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -44,7 +44,7 @@
#include "types.h"
#ifdef DEBUG_C64ROM
-#define LOG(x) log_debug x
+#define LOG(x) log_printf x
#else
#define LOG(x)
#endif
Modified: trunk/vice/src/c64/cart/blackbox9.c
===================================================================
--- trunk/vice/src/c64/cart/blackbox9.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/c64/cart/blackbox9.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -79,7 +79,7 @@
/* #define BB9DEBUG */
#ifdef BB9DEBUG
-#define DBG(x) log_debug x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
Modified: trunk/vice/src/c64/cart/dqbb.c
===================================================================
--- trunk/vice/src/c64/cart/dqbb.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/c64/cart/dqbb.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -77,7 +77,7 @@
/* #define DBGDQBB */
#ifdef DBGDQBB
-#define DBG(x) log_debug x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
Modified: trunk/vice/src/c64/cart/ide64.c
===================================================================
--- trunk/vice/src/c64/cart/ide64.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/c64/cart/ide64.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -70,7 +70,7 @@
#include "vicii-phi1.h"
#ifdef IDE64_DEBUG
-#define debug(x) log_debug(x)
+#define debug(x) log_printf (x)
#else
#define debug(x)
#endif
Modified: trunk/vice/src/c64/cart/mmc64.c
===================================================================
--- trunk/vice/src/c64/cart/mmc64.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/c64/cart/mmc64.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -78,7 +78,7 @@
*/
#ifdef MMC64DEBUG
-#define LOG(_x_) log_debug _x_
+#define LOG(_x_) log_printf _x_
#else
#define LOG(_x_)
#endif
Modified: trunk/vice/src/c64/cart/mmcreplay.c
===================================================================
--- trunk/vice/src/c64/cart/mmcreplay.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/c64/cart/mmcreplay.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -111,7 +111,7 @@
#endif
#ifdef MMCRDEBUG
-#define LOG(_x_) log_debug _x_
+#define LOG(_x_) log_printf _x_
#else
#define LOG(_x_)
#endif
@@ -2550,7 +2550,7 @@
mmcreplay_set_stdcfg();
if (enable_rescue_mode) {
- log_debug("MMCREPLAY: Rescue Mode enabled");
+ log_debug(LOG_DEFAULT, "MMCREPLAY: Rescue Mode enabled");
}
mmcreplay_update_mapper(CMODE_READ, 0);
Modified: trunk/vice/src/c64/cart/ramcart.c
===================================================================
--- trunk/vice/src/c64/cart/ramcart.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/c64/cart/ramcart.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -57,7 +57,7 @@
#undef CARTRIDGE_INCLUDE_PRIVATE_API
#ifdef DEBUG_RAMCART
-#define DBG(x) log_debug x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
Modified: trunk/vice/src/c64/cart/rrnetmk3.c
===================================================================
--- trunk/vice/src/c64/cart/rrnetmk3.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/c64/cart/rrnetmk3.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -72,7 +72,7 @@
/* #define RRNETMK3DEBUG */
#ifdef RRNETMK3DEBUG
-#define LOG(_x_) log_debug _x_
+#define LOG(_x_) log_printf _x_
#else
#define LOG(_x_)
#endif
Modified: trunk/vice/src/cbm2/cart/cbm2-generic.c
===================================================================
--- trunk/vice/src/cbm2/cart/cbm2-generic.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/cbm2/cart/cbm2-generic.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -50,7 +50,7 @@
#include "cbm2-generic.h"
#ifdef DEBUGGENERIC
-#define DBG(x) log_debug x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
Modified: trunk/vice/src/cbm2/cart/cbm2cart.c
===================================================================
--- trunk/vice/src/cbm2/cart/cbm2cart.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/cbm2/cart/cbm2cart.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -49,7 +49,7 @@
#include "cbm2-generic.h"
#ifdef DEBUGCART
-#define DBG(x) log_debug x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
Modified: trunk/vice/src/cbm2/cbm2cia1.c
===================================================================
--- trunk/vice/src/cbm2/cbm2cia1.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/cbm2/cbm2cia1.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -27,7 +27,7 @@
/* #define DEBUG_CIA1 */
#ifdef DEBUG_CIA1
-#define DBG(_x_) log_debug _x_
+#define DBG(_x_) log_printf _x_
#else
#define DBG(_x_)
#endif
Modified: trunk/vice/src/cbm2/cbm2datasette.c
===================================================================
--- trunk/vice/src/cbm2/cbm2datasette.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/cbm2/cbm2datasette.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -37,7 +37,7 @@
#include "tapeport.h"
#ifdef DEBUG_TAPE
-#define DBG(x) log_debug x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
@@ -53,7 +53,7 @@
};
static int buf[4];
buf[f] = n;
- log_debug("%28s flux:%d sense:%d write:%d motor:%d",
+ log_debug(LOG_DEFAULT, "%28s flux:%d sense:%d write:%d motor:%d",
names[f], buf[0], buf[1], buf[2], buf[3]);
}
Modified: trunk/vice/src/cbm2/cbm5x0cia1.c
===================================================================
--- trunk/vice/src/cbm2/cbm5x0cia1.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/cbm2/cbm5x0cia1.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -26,7 +26,7 @@
/* #define DEBUG_CIA1 */
#ifdef DEBUG_CIA1
-#define DBG(_x_) log_debug _x_
+#define DBG(_x_) log_printf _x_
#else
#define DBG(_x_)
#endif
Modified: trunk/vice/src/cbmdos.c
===================================================================
--- trunk/vice/src/cbmdos.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/cbmdos.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -178,7 +178,7 @@
int cmdlen;
#ifdef DEBUG_CBMDOS
- log_debug("CBMDOS parse cmd: '%s' cmdlen: %u", cmd_parse->cmd, cmd_parse->cmdlength);
+ log_debug(LOG_DEFAULT, "CBMDOS parse cmd: '%s' cmdlen: %u", cmd_parse->cmd, cmd_parse->cmdlength);
#endif
cmd_parse->atsign = 0;
@@ -236,7 +236,7 @@
}
#ifdef DEBUG_CBMDOS
- log_debug("CBMDOS parse pattern: '%s' drive:%d", p, cmd_parse->drive);
+ log_debug(LOG_DEFAULT, "CBMDOS parse pattern: '%s' drive:%d", p, cmd_parse->drive);
#endif
cmdlen = cmd_parse->cmdlength - (int)(p - cmd_parse->cmd);
@@ -254,7 +254,7 @@
}
#ifdef DEBUG_CBMDOS
- log_debug("CBMDOS parsed cmd: '%s'", cmd_parse->parsecmd);
+ log_debug(LOG_DEFAULT, "CBMDOS parsed cmd: '%s'", cmd_parse->parsecmd);
#endif
/* Preset the file-type if the LOAD/SAVE secondary addresses are used. */
@@ -293,7 +293,7 @@
cmd_parse->recordlength = comma[1]; /* Changing RL causes error */
#ifdef DEBUG_CBMDOS
- log_debug("L recordlength=%u", cmd_parse->recordlength);
+ log_debug(LOG_DEFAULT, "L recordlength=%u", cmd_parse->recordlength);
#endif
/* Don't allow REL file record lengths less than 2 or
greater than 254. The 1541/71/81 lets you create a
@@ -352,7 +352,7 @@
int i, templength = 0;
#ifdef DEBUG_CBMDOS
- log_debug("CBMDOS parse plus cmd: '%s' cmdlen: %u", cmd_parse->full, cmd_parse->fulllength);
+ log_debug(LOG_DEFAULT, "CBMDOS parse plus cmd: '%s' cmdlen: %u", cmd_parse->full, cmd_parse->fulllength);
#endif
cmd_parse->command = NULL;
Modified: trunk/vice/src/core/ciacore.c
===================================================================
--- trunk/vice/src/core/ciacore.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/core/ciacore.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -33,7 +33,7 @@
/* #define DEBUG_CIA */
#ifdef DEBUG_CIA
-#define DBG(_x_) log_debug _x_
+#define DBG(_x_) log_printf _x_
#else
#define DBG(_x_)
#endif
Modified: trunk/vice/src/core/flash040core.c
===================================================================
--- trunk/vice/src/core/flash040core.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/core/flash040core.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -43,7 +43,7 @@
/* #define FLASH_DEBUG_ENABLED */
#ifdef FLASH_DEBUG_ENABLED
-#define FLASH_DEBUG(x) log_debug x
+#define FLASH_DEBUG(x) log_printf x
#else
#define FLASH_DEBUG(x)
#endif
Modified: trunk/vice/src/core/m93c86.c
===================================================================
--- trunk/vice/src/core/m93c86.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/core/m93c86.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -46,7 +46,7 @@
#include "util.h"
#ifdef M93C86DEBUG
-#define LOG(_x_) log_debug _x_
+#define LOG(_x_) log_printf _x_
#else
#define LOG(_x_)
#endif
@@ -353,7 +353,7 @@
/* FIXME */
} else {
/* FIXME */
- log_debug("eeprom card image name not set");
+ log_debug(LOG_DEFAULT, "eeprom card image name not set");
return 0;
}
@@ -369,21 +369,21 @@
m93c86_image_file = fopen(m93c86_image_filename, "rb");
if (m93c86_image_file == NULL) {
- log_debug("could not open eeprom card image: %s", m93c86_image_filename);
+ log_debug(LOG_DEFAULT, "could not open eeprom card image: %s", m93c86_image_filename);
return -1;
} else {
if (fread(m93c86_data, 1, M93C86_SIZE, m93c86_image_file) == 0) {
- log_debug("could not read eeprom card image: %s", m93c86_image_filename);
+ log_debug(LOG_DEFAULT, "could not read eeprom card image: %s", m93c86_image_filename);
}
fseek(m93c86_image_file, 0, SEEK_SET);
- log_debug("opened eeprom card image (ro): %s", m93c86_image_filename);
+ log_debug(LOG_DEFAULT, "opened eeprom card image (ro): %s", m93c86_image_filename);
}
} else {
if (fread(m93c86_data, 1, M93C86_SIZE, m93c86_image_file) == 0) {
- log_debug("could not read eeprom card image: %s", m93c86_image_filename);
+ log_debug(LOG_DEFAULT, "could not read eeprom card image: %s", m93c86_image_filename);
}
fseek(m93c86_image_file, 0, SEEK_SET);
- log_debug("opened eeprom card image (rw): %s", m93c86_image_filename);
+ log_debug(LOG_DEFAULT, "opened eeprom card image (rw): %s", m93c86_image_filename);
}
return 0;
}
@@ -399,19 +399,19 @@
FILE *fp;
if (name == NULL || *name == '\0') {
- log_debug("error: eeprom card image filename is NULL or empty");
+ log_debug(LOG_DEFAULT, "error: eeprom card image filename is NULL or empty");
return -1;
}
fp = fopen(name, "wb");
if (fp == NULL) {
- log_debug("could not open file '%s' for writing: errno %d (%s)",
+ log_debug(LOG_DEFAULT, "could not open file '%s' for writing: errno %d (%s)",
name, errno, strerror(errno));
return -1;
}
if (fwrite(m93c86_data, 1u, M93C86_SIZE, fp) != M93C86_SIZE) {
- log_debug("error while writing eeprom card image: errno %d (%s)",
+ log_debug(LOG_DEFAULT, "error while writing eeprom card image: errno %d (%s)",
errno, strerror(errno));
fclose(fp);
return -1;
@@ -427,16 +427,16 @@
int m93c86_flush_image(void)
{
if (m93c86_image_file == NULL) {
- log_debug("cannot flush eeprom card image: file not opened");
+ log_debug(LOG_DEFAULT, "cannot flush eeprom card image: file not opened");
return -1;
}
if (!eeprom_file_rw) {
- log_debug("cannot flush read-only eeprom card image");
+ log_debug(LOG_DEFAULT, "cannot flush read-only eeprom card image");
return -1;
}
fseek(m93c86_image_file, 0, SEEK_SET);
if (fwrite(m93c86_data, 1, M93C86_SIZE, m93c86_image_file) == 0) {
- log_debug("failed to flush eeprom card image: %d (%s)",
+ log_debug(LOG_DEFAULT, "failed to flush eeprom card image: %d (%s)",
errno, strerror(errno));
return -1;
}
@@ -451,7 +451,7 @@
if (rw) {
fseek(m93c86_image_file, 0, SEEK_SET);
if (fwrite(m93c86_data, 1, M93C86_SIZE, m93c86_image_file) == 0) {
- log_debug("could not write eeprom card image");
+ log_debug(LOG_DEFAULT, "could not write eeprom card image");
}
}
fclose(m93c86_image_file);
Modified: trunk/vice/src/core/ser-eeprom.c
===================================================================
--- trunk/vice/src/core/ser-eeprom.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/core/ser-eeprom.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -41,7 +41,7 @@
/* #define LOG_COMMANDS */ /* log eeprom commands */
#ifdef EEPROMDEBUG
-#define LOG(_x_) log_debug _x_
+#define LOG(_x_) log_printf _x_
#else
#define LOG(_x_)
#endif
@@ -391,7 +391,7 @@
/* FIXME */
} else {
/* FIXME */
- log_debug("eeprom card image name not set");
+ log_debug(LOG_DEFAULT, "eeprom card image name not set");
return 0;
}
@@ -407,21 +407,21 @@
eeprom_image_file = fopen(eeprom_image_filename, "rb");
if (eeprom_image_file == NULL) {
- log_debug("could not open eeprom card image: %s", eeprom_image_filename);
+ log_debug(LOG_DEFAULT, "could not open eeprom card image: %s", eeprom_image_filename);
return -1;
} else {
if (fread(eeprom_data, 1, EEPROM_SIZE, eeprom_image_file) == 0) {
- log_debug("could not read eeprom card image: %s", eeprom_image_filename);
+ log_debug(LOG_DEFAULT, "could not read eeprom card image: %s", eeprom_image_filename);
}
fseek(eeprom_image_file, 0, SEEK_SET);
- log_debug("opened eeprom card image (ro): %s", eeprom_image_filename);
+ log_debug(LOG_DEFAULT, "opened eeprom card image (ro): %s", eeprom_image_filename);
}
} else {
if (fread(eeprom_data, 1, EEPROM_SIZE, eeprom_image_file) == 0) {
- log_debug("could not read eeprom card image: %s", eeprom_image_filename);
+ log_debug(LOG_DEFAULT, "could not read eeprom card image: %s", eeprom_image_filename);
}
fseek(eeprom_image_file, 0, SEEK_SET);
- log_debug("opened eeprom card image (rw): %s", eeprom_image_filename);
+ log_debug(LOG_DEFAULT, "opened eeprom card image (rw): %s", eeprom_image_filename);
}
return 0;
}
@@ -433,7 +433,7 @@
if (rw) {
fseek(eeprom_image_file, 0, SEEK_SET);
if (fwrite(eeprom_data, 1, EEPROM_SIZE, eeprom_image_file) == 0) {
- log_debug("could not write eeprom card image");
+ log_debug(LOG_DEFAULT, "could not write eeprom card image");
}
}
fclose(eeprom_image_file);
Modified: trunk/vice/src/core/spi-flash.c
===================================================================
--- trunk/vice/src/core/spi-flash.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/core/spi-flash.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -47,7 +47,7 @@
#include "util.h"
#ifdef SPIFLASHDEBUG
-#define LOG(_x_) log_debug _x_
+#define LOG(_x_) log_printf _x_
#else
#define LOG(_x_)
#endif
Modified: trunk/vice/src/core/spi-sdcard.c
===================================================================
--- trunk/vice/src/core/spi-sdcard.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/core/spi-sdcard.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -46,7 +46,7 @@
/*#define DEBUG_SPI*/
#ifdef SPIDEBUG
-#define LOG(_x_) log_debug _x_
+#define LOG(_x_) log_printf _x_
#else
#define LOG(_x_)
#endif
@@ -534,13 +534,13 @@
switch (mmc_cmd_buffer[1]) {
case 0xff:
#ifdef DEBUG_MMC
- log_debug("Hard reset received");
+ log_debug(LOG_DEFAULT, "Hard reset received");
#endif
mmc_card_state = MMC_CARD_IDLE;
break;
case 0x40: /* CMD00 Reset */
#ifdef DEBUG_MMC
- log_debug("CMD00 Reset received");
+ log_debug(LOG_DEFAULT, "CMD00 Reset received");
#endif
mmc_reset_card();
mmc_card_state = MMC_CARD_RESET;
@@ -547,13 +547,13 @@
break;
case 0x41: /* CMD01 Init */
#ifdef DEBUG_MMC
- log_debug("CMD01 Init received");
+ log_debug(LOG_DEFAULT, "CMD01 Init received");
#endif
mmc_card_state = MMC_CARD_INIT;
break;
case 0x48: /* CMD8 ? */
#ifdef DEBUG_MMC
- log_debug("CMD8 ? received");
+ log_debug(LOG_DEFAULT, "CMD8 ? received");
#endif
if (mmc_card_type == CARD_TYPE_MMC) {
/* MMC */
@@ -571,7 +571,7 @@
break;
case 0x49: /* CMD9 send CSD */
#ifdef DEBUG_MMC
- log_debug("CMD9 send CSD received");
+ log_debug(LOG_DEFAULT, "CMD9 send CSD received");
#endif
if (!spi_mmc_card_inserted()) {
uint8_t csdresp[0x10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
@@ -585,7 +585,7 @@
break;
case 0x4a: /* CMD9 send CID */
#ifdef DEBUG_MMC
- log_debug("CMD10 send CID received");
+ log_debug(LOG_DEFAULT, "CMD10 send CID received");
#endif
if (!spi_mmc_card_inserted()) {
uint8_t cidresp[0x10] =
@@ -605,13 +605,13 @@
break;
case 0x4c: /* CMD12 Stop */
#ifdef DEBUG_MMC
- log_debug("CMD12 Stop received");
+ log_debug(LOG_DEFAULT, "CMD12 Stop received");
#endif
mmc_card_state = MMC_CARD_IDLE;
break;
case 0x50: /* CMD16 Set Block Size */
#ifdef DEBUG_MMC
- log_debug("CMD16-AAAA Set Block Size received");
+ log_debug(LOG_DEFAULT, "CMD16-AAAA Set Block Size received");
#endif
mmc_card_state = MMC_CARD_IDLE;
mmc_block_size =
@@ -622,7 +622,7 @@
break;
case 0x51:
#ifdef DEBUG_MMC
- log_debug("CMD17-AAAA Block Read received");
+ log_debug(LOG_DEFAULT, "CMD17-AAAA Block Read received");
#endif
if (!spi_mmc_card_inserted()) {
mmc_card_state = MMC_CARD_READ;
@@ -631,12 +631,12 @@
mmc_current_address_pointer = mmc_get_addr(&status);
if (status) {
#ifdef DEBUG_MMC
- log_debug("Address Overflow: %08x", mmc_current_address_pointer);
+ log_debug(LOG_DEFAULT, "Address Overflow: %08x", mmc_current_address_pointer);
#endif
mmc_card_state = MMC_CARD_DUMMY_READ;
} else {
#ifdef DEBUG_MMC
- log_debug("Address: %08x", mmc_current_address_pointer);
+ log_debug(LOG_DEFAULT, "Address: %08x", mmc_current_address_pointer);
#endif
if (fseek(mmc_image_file, mmc_current_address_pointer, SEEK_SET) != 0) {
mmc_card_state = MMC_CARD_DUMMY_READ;
@@ -643,7 +643,7 @@
} else {
uint8_t readbuf[0x1000]; /* FIXME */
#ifdef DEBUG_MMC
- log_debug("Buffering: %08x", mmc_current_address_pointer);
+ log_debug(LOG_DEFAULT, "Buffering: %08x", mmc_current_address_pointer);
#endif
fseek(mmc_image_file, mmc_current_address_pointer, SEEK_SET);
if (!feof(mmc_image_file)) {
@@ -652,7 +652,7 @@
mmc_read_buffer_writeptr = 0;
mmc_read_buffer_set(readbuf, mmc_block_size);
#ifdef DEBUG_MMC
- log_debug("Buffered: %02x %02x", readbuf[0], readbuf[1]);
+ log_debug(LOG_DEFAULT, "Buffered: %02x %02x", readbuf[0], readbuf[1]);
#endif
} else {
/* FIXME: handle error */
@@ -666,7 +666,7 @@
}
break;
case 0x58:
-/*log_debug("CMD Block Write received");*/
+/*log_debug(LOG_DEFAULT, "CMD Block Write received");*/
if (!spi_mmc_card_inserted() && mmc_block_size > 0) {
#ifdef DEBUG_MMC
LOG(("MMC CMD Block Write Address: %08x",
@@ -677,7 +677,7 @@
mmc_write_sequence = 0;
mmc_card_state = MMC_CARD_DUMMY_WRITE;
#ifdef DEBUG_MMC
- log_debug("Address Overflow: %08x", mmc_current_address_pointer);
+ log_debug(LOG_DEFAULT, "Address Overflow: %08x", mmc_current_address_pointer);
#endif
} else {
mmc_write_sequence = 0;
@@ -692,7 +692,7 @@
{
uint8_t cmdresp[0x10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
#ifdef DEBUG_MMC
- log_debug("ACMD41 ? received");
+ log_debug(LOG_DEFAULT, "ACMD41 ? received");
#endif
mmc_card_state = MMC_CARD_READ;
mmc_read_firstbyte = 0;
@@ -701,7 +701,7 @@
break;
case 0x77: /* CMD77 ? */
#ifdef DEBUG_MMC
- log_debug("CMD77 ? received");
+ log_debug(LOG_DEFAULT, "CMD77 ? received");
#endif
if (mmc_card_type != CARD_TYPE_MMC) {
/* SD v2 only */
@@ -713,7 +713,7 @@
break;
case 0x7a: /* CMD58 ? */
#ifdef DEBUG_MMC
- log_debug("CMD58 ? received");
+ log_debug(LOG_DEFAULT, "CMD58 ? received");
#endif
if (mmc_card_type == CARD_TYPE_SDHC) {
/* SDHC */
Modified: trunk/vice/src/crt.c
===================================================================
--- trunk/vice/src/crt.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/crt.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -43,7 +43,7 @@
/* #define DEBUGCRT */
#ifdef DEBUGCRT
-#define DBG(x) log_debug x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
Modified: trunk/vice/src/crtc/crtc-resources.c
===================================================================
--- trunk/vice/src/crtc/crtc-resources.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/crtc/crtc-resources.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -29,7 +29,7 @@
/* #define DEBUG_CRTC */
#ifdef DEBUG_CRTC
-#define DBG(_x_) log_debug _x_
+#define DBG(_x_) log_printf _x_
#else
#define DBG(_x_)
#endif
Modified: trunk/vice/src/crtc/crtc.c
===================================================================
--- trunk/vice/src/crtc/crtc.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/crtc/crtc.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -32,7 +32,7 @@
/* #define DEBUG_CRTC */
#ifdef DEBUG_CRTC
-#define DBG(_x_) log_debug _x_
+#define DBG(_x_) log_printf _x_
#else
#define DBG(_x_)
#endif
@@ -512,12 +512,12 @@
crtc.hires_draw_callback = NULL;
#if 0
- log_debug("scr_width=%d, scr_height=%d",
+ log_debug(LOG_DEFAULT, "scr_width=%d, scr_height=%d",
crtc.screen_width, crtc.screen_height);
- log_debug("tcols=%d, tlines=%d, bwidth=%d, bheight=%d",
+ log_debug(LOG_DEFAULT, "tcols=%d, tlines=%d, bwidth=%d, bheight=%d",
CRTC_SCREEN_TEXTCOLS(), CRTC_SCREEN_TEXTLINES(),
CRTC_SCREEN_BORDERWIDTH, CRTC_SCREEN_BORDERHEIGHT);
- log_debug("displayed lines: first=%d, last=%d",
+ log_debug(LOG_DEFAULT, "displayed lines: first=%d, last=%d",
CRTC_FIRST_DISPLAYED_LINE, CRTC_LAST_DISPLAYED_LINE);
#endif
Modified: trunk/vice/src/datasette/datasette.c
===================================================================
--- trunk/vice/src/datasette/datasette.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/datasette/datasette.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -54,7 +54,7 @@
#include "vice-event.h"
#ifdef DEBUG_TAPE
-#define DBG(x) log_debug x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
@@ -696,9 +696,9 @@
{
#ifdef DEBUG_TAPE
if (!datasette_alarm_pending[port]) {
- log_debug("datasette_alarm_set: %"PRIu64"", offset);
+ log_debug(LOG_DEFAULT, "datasette_alarm_set: %"PRIu64"", offset);
} else {
- log_debug("datasette_alarm_set: %"PRIu64" (WARNING: another alarm was pending!)", offset);
+ log_debug(LOG_DEFAULT, "datasette_alarm_set: %"PRIu64" (WARNING: another alarm was pending!)", offset);
}
#endif
alarm_set(datasette_alarm[port], offset);
Modified: trunk/vice/src/debug.c
===================================================================
--- trunk/vice/src/debug.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/debug.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -246,7 +246,7 @@
}
}
- log_debug("%04X %ld %02X%02X%02X %s", (unsigned int)reg_pc,
+ log_debug(LOG_DEFAULT, "%04X %ld %02X%02X%02X %s", (unsigned int)reg_pc,
(long)mclk, reg_a, reg_x, reg_y, small_dis);
break;
}
@@ -263,13 +263,13 @@
break;
}
case DEBUG_NORMAL:
- log_debug(".%04X %03u %03u %10ld %-22s "
+ log_debug(LOG_DEFAULT, ".%04X %03u %03u %10ld %-22s "
"%02x%02x%02x%02x", (unsigned int)reg_pc,
RLINE(mclk), RCYCLE(mclk), (long)mclk, dis,
reg_a, reg_x, reg_y, reg_sp);
break;
default:
- log_debug("Unknown debug format.");
+ log_debug(LOG_DEFAULT, "Unknown debug format.");
}
}
@@ -298,7 +298,7 @@
}
}
- log_debug("%02X%04X %ld %04X %04X %04X %s", reg_pbr, (unsigned int)reg_pc,
+ log_debug(LOG_DEFAULT, "%02X%04X %ld %04X %04X %04X %s", reg_pbr, (unsigned int)reg_pc,
(long)mclk, reg_c, reg_x, reg_y, small_dis);
break;
}
@@ -315,13 +315,13 @@
break;
}
case DEBUG_NORMAL:
- log_debug(".%02X%04X %03u %03u %10ld %-25s "
+ log_debug(LOG_DEFAULT, ".%02X%04X %03u %03u %10ld %-25s "
"%04x %04x %04x %04x", reg_pbr, (unsigned int)reg_pc,
RLINE(mclk), RCYCLE(mclk),(long)mclk, dis,
reg_c, reg_x, reg_y, reg_sp);
break;
default:
- log_debug("Unknown debug format.");
+ log_debug(LOG_DEFAULT, "Unknown debug format.");
}
}
@@ -338,7 +338,7 @@
if (debug.trace_mode == DEBUG_HISTORY || debug.trace_mode == DEBUG_AUTOPLAY) {
debug_history_step(st);
} else {
- log_debug("%s", st);
+ log_debug(LOG_DEFAULT, "%s", st);
}
}
@@ -347,7 +347,7 @@
if (debug.trace_mode == DEBUG_HISTORY || debug.trace_mode == DEBUG_AUTOPLAY) {
debug_history_step(text);
} else {
- log_debug("%s", text);
+ log_debug(LOG_DEFAULT, "%s", text);
}
}
@@ -374,7 +374,7 @@
if (debug.trace_mode == DEBUG_HISTORY || debug.trace_mode == DEBUG_AUTOPLAY) {
debug_history_step(textout);
} else {
- log_debug("%s", textout);
+ log_debug(LOG_DEFAULT, "%s", textout);
}
lib_free(textout);
@@ -392,7 +392,7 @@
void debug_dma(const char *txt, CLOCK dclk, CLOCK num)
{
- log_debug("*** DMA %s %"PRIu64" %02"PRIu64, txt, dclk, num);
+ log_debug(LOG_DEFAULT, "*** DMA %s %"PRIu64" %02"PRIu64, txt, dclk, num);
}
/*------------------------------------------------------------------------*/
Modified: trunk/vice/src/diskimage/diskimage.c
===================================================================
--- trunk/vice/src/diskimage/diskimage.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/diskimage/diskimage.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -29,7 +29,7 @@
/* #define DEBUG_DISKIMAGE */
#ifdef DEBUG_DISKIMAGE
-#define DBG(x) log_debug x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
Modified: trunk/vice/src/dma.c
===================================================================
--- trunk/vice/src/dma.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/dma.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -58,7 +58,7 @@
#ifdef DEBUG
if (debug.maincpu_traceflg) {
- log_debug("START %"PRIu64" NUM %"PRIu64" SUB %"PRIu64" MAIN %"PRIu64" DMAST %"PRIu64,
+ log_debug(LOG_DEFAULT, "START %"PRIu64" NUM %"PRIu64" SUB %"PRIu64" MAIN %"PRIu64" DMAST %"PRIu64,
start_clk, num, sub, maincpu_clk, dma_start);
}
#endif
@@ -80,7 +80,7 @@
&& cs->num_dma_per_opcode == 1) {
#ifdef DEBUGIRQDMA
if (debug.maincpu_traceflg) {
- log_debug("DECR");
+ log_debug(LOG_DEFAULT, "DECR");
}
#endif
irq_sub = 1;
@@ -90,7 +90,7 @@
&& cs->num_dma_per_opcode == 1) {
#ifdef DEBUGIRQDMA
if (debug.maincpu_traceflg) {
- log_debug("DECR");
+ log_debug(LOG_DEFAULT, "DECR");
}
#endif
nmi_sub = 1;
@@ -101,7 +101,7 @@
cs->last_stolen_cycles_clk = dma_start + num;
#ifdef DEBUGIRQDMA
if (debug.maincpu_traceflg) {
- log_debug("IRQCLK %i LASTSTOLEN %i",
+ log_debug(LOG_DEFAULT, "IRQCLK %i LASTSTOLEN %i",
cs->irq_clk, cs->last_stolen_cycles_clk);
}
#endif
@@ -123,7 +123,7 @@
#ifdef DEBUGIRQDMA
if (debug.maincpu_traceflg) {
- log_debug("NEWIRQCLK %i", cs->irq_clk);
+ log_debug(LOG_DEFAULT, "NEWIRQCLK %i", cs->irq_clk);
}
#endif
}
Modified: trunk/vice/src/drive/drive-resources.c
===================================================================
--- trunk/vice/src/drive/drive-resources.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/drive/drive-resources.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -51,7 +51,7 @@
#include "vdrive.h"
#ifdef DEBUGDRIVE
-#define DBG(x) log_debug x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
Modified: trunk/vice/src/drive/drive.c
===================================================================
--- trunk/vice/src/drive/drive.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/drive/drive.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -80,7 +80,7 @@
#include "vsync.h"
#ifdef DEBUG_DRIVE
-#define DBG(x) log_debug x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
Modified: trunk/vice/src/drive/iec/cmdhd.c
===================================================================
--- trunk/vice/src/drive/iec/cmdhd.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/drive/iec/cmdhd.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -151,7 +151,7 @@
if (value != oldvalue) {
oldvalue = value;
- log_debug("$1800 store: %s %s %s",
+ log_debug(LOG_DEFAULT, "$1800 store: %s %s %s",
value & 0x02 ? "DATA OUT" : " ",
value & 0x08 ? "CLK OUT" : " ",
value & 0x10 ? "ATNA " : " "
@@ -180,7 +180,7 @@
}
}
- log_debug("$1800 read: %s %s %s %s %s %s%s",
+ log_debug(LOG_DEFAULT, "$1800 read: %s %s %s %s %s %s%s",
value & 0x02 ? "DATA OUT" : " ",
value & 0x08 ? "CLK OUT" : " ",
value & 0x10 ? "ATNA " : " ",
Modified: trunk/vice/src/drive/iecieee/via2d.c
===================================================================
--- trunk/vice/src/drive/iecieee/via2d.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/drive/iecieee/via2d.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -36,13 +36,13 @@
/* #define DEBUG_STEP */
#ifdef DEBUG_VIA2
-#define DBG(_x_) log_debug _x_
+#define DBG(_x_) log_printf _x_
#else
#define DBG(_x_)
#endif
#ifdef DEBUG_STEP
-#define DBGSTEP(_x_) log_debug _x_
+#define DBGSTEP(_x_) log_printf _x_
#else
#define DBGSTEP(_x_)
#endif
Modified: trunk/vice/src/event.c
===================================================================
--- trunk/vice/src/event.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/event.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -61,7 +61,7 @@
#include "vice-event.h"
#ifdef EVENT_DEBUG
-#define DBG(x) log_debug x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
@@ -409,7 +409,7 @@
return;
}
- /*log_debug("EVENT PLAYBACK %i CLK %i", event_list_current->type,
+ /*log_debug(LOG_DEFAULT, "EVENT PLAYBACK %i CLK %i", event_list_current->type,
event_list_current->clk);*/
switch (event_list->current->type) {
@@ -868,7 +868,7 @@
uint8_t *data = (uint8_t *)(event_list->current->data);
switch (data[0]) {
case EVENT_START_MODE_FILE_SAVE:
- /*log_debug("READING %s", (char *)(&data[1]));*/
+ /*log_debug(LOG_DEFAULT, "READING %s", (char *)(&data[1]));*/
if (machine_read_snapshot(
event_snapshot_path((char *)(&data[1])), 0) < 0
&& machine_read_snapshot(
@@ -888,7 +888,7 @@
next_alarm_set();
break;
case EVENT_START_MODE_RESET:
- /*log_debug("RESET MODE!");*/
+ /*log_debug(LOG_DEFAULT, "RESET MODE!");*/
machine_trigger_reset(MACHINE_RESET_MODE_POWER_CYCLE);
if (event_list->current->size > 1) {
strncpy(event_version, (char *)(&data[1]), 15);
Modified: trunk/vice/src/fliplist.c
===================================================================
--- trunk/vice/src/fliplist.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/fliplist.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -48,7 +48,7 @@
#include "util.h"
#ifdef DEBUG_FLIPLIST
-#define DBG(x) log_debug x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
Modified: trunk/vice/src/fsdevice/fsdevice-read.c
===================================================================
--- trunk/vice/src/fsdevice/fsdevice-read.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/fsdevice/fsdevice-read.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -55,7 +55,7 @@
/* #define REL_DEBUG */
#ifdef REL_DEBUG
-# define DBG(x) log_debug x
+# define DBG(x) log_printf x
# include "log.h"
#else
# define DBG(x)
Modified: trunk/vice/src/fsdevice/fsdevice-write.c
===================================================================
--- trunk/vice/src/fsdevice/fsdevice-write.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/fsdevice/fsdevice-write.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -49,7 +49,7 @@
/* #define REL_DEBUG */
#ifdef REL_DEBUG
-# define DBG(x) log_debug x
+# define DBG(x) log_printf x
# include "log.h"
#else
# define DBG(x)
Modified: trunk/vice/src/fsdevice/fsdevice.c
===================================================================
--- trunk/vice/src/fsdevice/fsdevice.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/fsdevice/fsdevice.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -62,7 +62,7 @@
#include "vdrive.h"
#ifdef DEBUG_FSDEVICE
-#define DBG(x) log_debug x
+#define DBG(x) log_printf x
#else
#define DBG(x)
#endif
Modified: trunk/vice/src/gcr.c
===================================================================
--- trunk/vice/src/gcr.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/gcr.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -29,7 +29,7 @@
/* #define DEBUG_GCR */
#ifdef DEBUG_GCR
-#define DBG(_x_) log_debug _x_
+#define DBG(_x_) log_printf _x_
#else
#define DBG(_x_)
#endif
Modified: trunk/vice/src/gfxoutputdrv/ffmpegdrv.c
===================================================================
--- trunk/vice/src/gfxoutputdrv/ffmpegdrv.c 2024-08-04 16:28:07 UTC (rev 45263)
+++ trunk/vice/src/gfxoutputdrv/ffmpegdrv.c 2024-08-04 19:25:09 UTC (rev 45264)
@@ -335,7 +335,7 @@
int ret;
if (!frame) {
- log_debug("ffmpegdrv: Error allocating an audio frame");
+ log_debug(LOG_DEFAULT, "ffmpegdrv: Error allocating an audio frame");
return NULL;
}
@@ -347,7 +347,7 @@
if (nb_samples) {
ret = VICE_P_AV_FRAME_GET_BUFFER(frame, 0);
if (ret < 0) {
- log_debug("ffmpegdrv: Error allocating an audio buffer");
+ log_debug(LOG_DEFAULT, "ffmpegdrv: Error allocating an audio buffer");
return NULL;
}
}
@@ -370,7 +370,7 @@
VICE_P_AV_DICT_FREE(&opts);
if (ret < 0) {
- log_debug("ffmpegdrv: could not open audio codec (%d)", ret);
+ log_debug(LOG_DEFAULT, "ffmpegdrv: could not open audio codec (%d)", ret);
return -1;
}
@@ -440,7 +440,7 @@
st = VICE_P_AVFORMAT_NEW_STREAM(ffmpegdrv_oc, avcodecaudio);
if (!st) {
- log_debug("ffmpegdrv: Could not alloc audio stream");
+ log_debug(LOG_DEFAULT, "ffmpegdrv: Could not alloc audio stream");
return -1;
}
@@ -483,7 +483,7 @@
avr_ctx = VICE_P_AVRESAMPLE_ALLOC_CONTEXT();
if (!avr_ctx) {
#endif
- log_debug("ffmpegdrv: Could not alloc resampler context");
+ log_debug(LOG_DEFAULT, "ffmpegdrv: Could not alloc resampler context");
return -1;
}
@@ -512,7 +512,7 @@
#else
if (VICE_P_AVRESAMPLE_OPEN(avr_ctx) < 0) {
#endif
- log_debug("ffmpegdrv: Failed to initialize the resampling context");
+ log_de...
[truncated message content] |
|
From: <gp...@us...> - 2024-08-04 16:28:10
|
Revision: 45263
http://sourceforge.net/p/vice-emu/code/45263
Author: gpz
Date: 2024-08-04 16:28:07 +0000 (Sun, 04 Aug 2024)
Log Message:
-----------
use separate log_t streams (instead of LOG_DEFAULT) at various places. many other things should get updated the same way :)
Modified Paths:
--------------
trunk/vice/src/6510dtvcore.c
trunk/vice/src/arch/gtk3/mousedrv.c
trunk/vice/src/arch/gtk3/opengl_renderer.c
trunk/vice/src/arch/gtk3/opengl_renderer_unix.c
trunk/vice/src/arch/gtk3/render_thread.c
trunk/vice/src/arch/gtk3/uimachinewindow.c
trunk/vice/src/arch/gtk3/uimon.c
trunk/vice/src/c128/c128rom.c
trunk/vice/src/c64/c64-resources.c
trunk/vice/src/cmdline.c
trunk/vice/src/interrupt.c
trunk/vice/src/keymap.c
trunk/vice/src/lib.c
trunk/vice/src/lib.h
trunk/vice/src/machine.c
trunk/vice/src/main.c
trunk/vice/src/main65816cpu.c
trunk/vice/src/mainc64cpu.c
trunk/vice/src/maincpu.c
trunk/vice/src/mainlock.c
trunk/vice/src/mainviccpu.c
trunk/vice/src/opencbmlib.c
trunk/vice/src/resources.c
trunk/vice/src/sid/resid-dtv.cc
trunk/vice/src/sid/resid.cc
trunk/vice/src/sound.c
trunk/vice/src/traps.c
trunk/vice/src/viciisc/vicii-chip-model.c
trunk/vice/src/vsync.c
Modified: trunk/vice/src/6510dtvcore.c
===================================================================
--- trunk/vice/src/6510dtvcore.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/6510dtvcore.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -43,6 +43,11 @@
#define CPU_STR "Main CPU"
#endif
+#ifndef CPU_LOG_ID
+#define CPU_LOG_ID LOG_DEFAULT
+#warning "CPU_LOG_ID not defined, using LOG_DEFAULT by default"
+#endif
+
#include "traps.h"
#include "profiler.h"
@@ -830,10 +835,10 @@
unsigned int unstablebits = ((reg_a_read ^ 0xff) & (p1 & reg_x)); \
if ((ANE_LOG_LEVEL == 2) || ((ANE_LOG_LEVEL == 1) && (unstablebits != 0))) { \
if (unstablebits == 0) { \
- log_warning(LOG_DEFAULT, "%04x ANE #$%02x ; A=$%02x X=$%02x -> A=$%02x%s", \
+ log_warning(CPU_LOG_ID, "$%04x ANE #$%02x ; A=$%02x X=$%02x -> A=$%02x%s", \
reg_pc, p1, reg_a_read, reg_x, result, rdy ? " (RDY cycle)" : ""); \
} else { \
- log_warning(LOG_DEFAULT, "%04x ANE #$%02x ; A=$%02x X=$%02x -> A=$%02x (unstable bits: %c%c%c%c%c%c%c%c)%s", \
+ log_warning(CPU_LOG_ID, "$%04x ANE #$%02x ; A=$%02x X=$%02x -> A=$%02x (unstable bits: %c%c%c%c%c%c%c%c)%s", \
reg_pc, p1, reg_a_read, reg_x, result, \
unstablebits & 0x80 ? '*' : '.', unstablebits & 0x40 ? '*' : '.', \
unstablebits & 0x20 ? '*' : '.', unstablebits & 0x10 ? '*' : '.', \
@@ -1282,10 +1287,10 @@
unsigned int unstablebits = (reg_a_read ^ 0xff) & p1; \
if ((LXA_LOG_LEVEL == 2) || ((LXA_LOG_LEVEL == 1) && (unstablebits != 0))) { \
if (unstablebits == 0) { \
- log_warning(LOG_DEFAULT, "%04x LAX #$%02x ; A=$%02x -> A=X=$%02x%s", \
+ log_warning(CPU_LOG_ID, "$%04x LAX #$%02x ; A=$%02x -> A=X=$%02x%s", \
reg_pc, p1, reg_a_read, result, rdy ? " (RDY cycle)" : ""); \
} else { \
- log_warning(LOG_DEFAULT, "%04x LAX #$%02x ; A=$%02x -> A=X=$%02x (unstable bits: %c%c%c%c%c%c%c%c)%s", \
+ log_warning(CPU_LOG_ID, "$%04x LAX #$%02x ; A=$%02x -> A=X=$%02x (unstable bits: %c%c%c%c%c%c%c%c)%s", \
reg_pc, p1, reg_a_read, result, \
unstablebits & 0x80 ? '*' : '.', unstablebits & 0x40 ? '*' : '.', \
unstablebits & 0x20 ? '*' : '.', unstablebits & 0x10 ? '*' : '.', \
Modified: trunk/vice/src/arch/gtk3/mousedrv.c
===================================================================
--- trunk/vice/src/arch/gtk3/mousedrv.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/arch/gtk3/mousedrv.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -49,6 +49,7 @@
#include "ui.h"
#include "uimachinewindow.h"
+static log_t mousedrv_log = LOG_DEFAULT;
/** \brief The callbacks registered for mouse buttons being pressed or
* released.
@@ -97,7 +98,7 @@
}
break;
default:
- log_error(LOG_DEFAULT, "GTK3MOUSE: Warning: Strange mouse button %d\n", bnumber);
+ log_warning(mousedrv_log, "Strange mouse button %d\n", bnumber);
}
}
@@ -110,7 +111,7 @@
{
/** \todo Tell UI level to capture mouse cursor if necessary and
* permitted */
- log_verbose(LOG_DEFAULT, "GTK3MOUSE: Status changed: %d (%s)",
+ log_verbose(mousedrv_log, "Status changed: %d (%s)",
_mouse_enabled, _mouse_enabled ? "enabled" : "disabled");
if (_mouse_enabled) {
ui_mouse_grab_pointer();
@@ -121,6 +122,7 @@
int mousedrv_resources_init(const mouse_func_t *funcs)
{
+ mousedrv_log = log_open("GTK3 Mouse");
/* Copy entire 'mouse_func_t' structure. */
mouse_funcs = *funcs;
return 0;
Modified: trunk/vice/src/arch/gtk3/opengl_renderer.c
===================================================================
--- trunk/vice/src/arch/gtk3/opengl_renderer.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/arch/gtk3/opengl_renderer.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -57,6 +57,8 @@
#include "macOS-util.h"
#endif
+log_t opengl_log = LOG_DEFAULT;
+
#define CANVAS_LOCK() pthread_mutex_lock(&canvas->lock)
#define CANVAS_UNLOCK() pthread_mutex_unlock(&canvas->lock)
#define RENDER_LOCK() pthread_mutex_lock(&context->render_lock)
@@ -124,6 +126,8 @@
CANVAS_LOCK();
+ opengl_log = log_open("OpenGL");
+
/* First initialise the context_t that we'll need everywhere */
context = lib_calloc(1, sizeof(context_t));
context->cached_vsync_resource = -1;
@@ -705,13 +709,13 @@
/* TODO: BSD thread prio stuff */
#endif
- log_message(LOG_DEFAULT, "Render thread initialised");
+ log_message(opengl_log, "Render thread initialised");
return;
}
if (job == render_thread_shutdown) {
archdep_thread_shutdown();
- log_message(LOG_DEFAULT, "Render thread shutdown");
+ log_message(opengl_log, "Render thread shutdown");
return;
}
@@ -878,7 +882,7 @@
break;
}
- log_error(LOG_DEFAULT, "Compile failure in %s shader:\n%s\n", shader_type_name, info_log);
+ log_error(opengl_log, "Compile failure in %s shader:\n%s\n", shader_type_name, info_log);
lib_free(info_log);
archdep_vice_exit(1);
@@ -904,14 +908,14 @@
fd = sysfile_open(vertex_shader_filename, "GLSL", &path, "rb");
if (fd == NULL) {
- log_error(LOG_DEFAULT, "Could not open vertex shader: %s", vertex_shader_filename);
+ log_error(opengl_log, "Could not open vertex shader: %s", vertex_shader_filename);
archdep_vice_exit(1);
}
- log_message(LOG_DEFAULT, "Loading vertex shader: %s", path);
+ log_message(opengl_log, "Loading vertex shader: %s", path);
if (util_file_load_string(fd, &vertex_shader)) {
- log_error(LOG_DEFAULT, "Could not read vertex shader: %s", path);
+ log_error(opengl_log, "Could not read vertex shader: %s", path);
fclose(fd);
lib_free(path);
archdep_vice_exit(1);
@@ -923,14 +927,14 @@
fd = sysfile_open(fragment_shader_filename, "GLSL", &path, "rb");
if (fd == NULL) {
- log_error(LOG_DEFAULT, "Could not open fragment shader: %s", fragment_shader_filename);
+ log_error(opengl_log, "Could not open fragment shader: %s", fragment_shader_filename);
archdep_vice_exit(1);
}
- log_message(LOG_DEFAULT, "Loading fragment shader: %s", path);
+ log_message(opengl_log, "Loading fragment shader: %s", path);
if (util_file_load_string(fd, &fragment_shader)) {
- log_error(LOG_DEFAULT, "Could not read fragment shader: %s", path);
+ log_error(opengl_log, "Could not read fragment shader: %s", path);
fclose(fd);
lib_free(path);
lib_free(vertex_shader);
@@ -954,7 +958,7 @@
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &info_log_length);
info_log = lib_malloc(sizeof(GLchar) * (info_log_length + 1));
glGetProgramInfoLog(program, info_log_length, NULL, info_log);
- log_error(LOG_DEFAULT, "Linker failure: %s\n", info_log);
+ log_error(opengl_log, "Linker failure: %s\n", info_log);
lib_free(info_log);
lib_free(fragment_shader);
lib_free(vertex_shader);
Modified: trunk/vice/src/arch/gtk3/opengl_renderer_unix.c
===================================================================
--- trunk/vice/src/arch/gtk3/opengl_renderer_unix.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/arch/gtk3/opengl_renderer_unix.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -38,6 +38,8 @@
#include "log.h"
#include "render_queue.h"
+extern log_t opengl_log;
+
#define CANVAS_LOCK() pthread_mutex_lock(context->canvas_lock_ptr)
#define CANVAS_UNLOCK() pthread_mutex_unlock(context->canvas_lock_ptr)
#define RENDER_LOCK() pthread_mutex_lock(&context->render_lock)
@@ -109,27 +111,27 @@
context->x_display = GDK_WINDOW_XDISPLAY(gtk_widget_get_window(widget));
if (!glXQueryVersion(context->x_display, &glx_major, &glx_minor)) {
- log_error(LOG_DEFAULT, "Failed to get GLX version\n");
+ log_error(opengl_log, "Failed to get GLX version\n");
archdep_vice_exit(1);
}
- log_message(LOG_DEFAULT, "GLX version: %d.%d", glx_major, glx_minor);
+ log_message(opengl_log, "GLX version: %d.%d", glx_major, glx_minor);
/* FBConfigs were added in GLX version 1.3. */
if (glx_major < 1 || (glx_major == 1 && glx_minor < 3)) {
- log_error(LOG_DEFAULT, "At least GLX 1.3 is required\n");
+ log_error(opengl_log, "At least GLX 1.3 is required\n");
archdep_vice_exit(1);
}
- log_message(LOG_DEFAULT, "Getting matching framebuffer configs" );
+ log_message(opengl_log, "Getting matching framebuffer configs" );
PFNGLXCHOOSEFBCONFIGPROC vice_glXChooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC)glXGetProcAddressARB((const GLubyte *)"glXChooseFBConfig");
GLXFBConfig *framebuffer_configs = vice_glXChooseFBConfig(context->x_display, DefaultScreen(context->x_display), visual_attribs, &fbcount);
if (!framebuffer_configs) {
- log_error(LOG_DEFAULT, "Failed to retrieve a framebuffer config\n");
+ log_error(opengl_log, "Failed to retrieve a framebuffer config\n");
archdep_vice_exit(1);
}
- log_message(LOG_DEFAULT, "Found %d matching FB configs.", fbcount);
+ log_message(opengl_log, "Found %d matching FB configs.", fbcount);
/* Just pick the first one I guess. */
GLXFBConfig framebuffer_config = framebuffer_configs[0];
@@ -200,7 +202,7 @@
XSetErrorHandler(oldHandler);
if (!context->gl_context) {
- log_error(LOG_DEFAULT, "Failed to obtain an OpenGL 3.2 context, requesting a legacy context\n" );
+ log_error(opengl_log, "Failed to obtain an OpenGL 3.2 context, requesting a legacy context\n" );
/*
* Couldn't create GL 3.2 context. Fall back to old-style 2.x context.
@@ -228,7 +230,7 @@
/* Anything less than OpenGL 3.2 will use the legacy renderer */
context->gl_context_is_legacy = major < 3 || (major == 3 && minor < 2);
- log_message(LOG_DEFAULT, "Obtained OpenGL %d.%d context\n Vendor: %s\n Renderer: %s\n Version: %s\n Legacy: %s",
+ log_message(opengl_log, "Obtained OpenGL %d.%d context\n Vendor: %s\n Renderer: %s\n Version: %s\n Legacy: %s",
major,
minor,
glGetString(GL_VENDOR),
@@ -238,12 +240,12 @@
/* Not sure if an indirect context will work but lets leave some useful output for bug reports */
if (!glXIsDirect(context->x_display, context->gl_context)) {
- log_message(LOG_DEFAULT, "Indirect GLX rendering context obtained - please let us know if this works!");
+ log_message(opengl_log, "Indirect GLX rendering context obtained - please let us know if this works!");
} else {
- log_message(LOG_DEFAULT, "Direct GLX rendering context obtained");
+ log_message(opengl_log, "Direct GLX rendering context obtained");
}
- log_message(LOG_DEFAULT, "Swap control support. glXSwapIntervalMESA: %d glXSwapIntervalEXT: %d glXSwapIntervalSGI: %d", !!glXSwapIntervalMESA, !!glXSwapIntervalEXT, !!glXSwapIntervalSGI);
+ log_message(opengl_log, "Swap control support. glXSwapIntervalMESA: %d glXSwapIntervalEXT: %d glXSwapIntervalSGI: %d", !!glXSwapIntervalMESA, !!glXSwapIntervalEXT, !!glXSwapIntervalSGI);
vice_opengl_renderer_clear_current(context);
}
@@ -260,12 +262,12 @@
result = glXSwapIntervalMESA(gl_int);
if (result) {
if (!set_vsync_failed) {
- log_error(LOG_DEFAULT, "glXSwapIntervalMESA(%d) failed with error: %d (suppressing futher errors)", gl_int, result);
+ log_error(opengl_log, "glXSwapIntervalMESA(%d) failed with error: %d (suppressing futher errors)", gl_int, result);
set_vsync_failed = true;
}
} else {
if (set_vsync_failed) {
- log_message(LOG_DEFAULT, "glXSwapIntervalMESA(%d) started working again", gl_int);
+ log_message(opengl_log, "glXSwapIntervalMESA(%d) started working again", gl_int);
set_vsync_failed = false;
}
}
@@ -275,12 +277,12 @@
result = glXSwapIntervalSGI(gl_int);
if (result) {
if (!set_vsync_failed) {
- log_error(LOG_DEFAULT, "glXSwapIntervalSGI(%d) failed with error: %d (suppressing futher errors)", gl_int, result);
+ log_error(opengl_log, "glXSwapIntervalSGI(%d) failed with error: %d (suppressing futher errors)", gl_int, result);
set_vsync_failed = true;
}
} else {
if (set_vsync_failed) {
- log_message(LOG_DEFAULT, "glXSwapIntervalSGI(%d) started working again", gl_int);
+ log_message(opengl_log, "glXSwapIntervalSGI(%d) started working again", gl_int);
set_vsync_failed = false;
}
}
Modified: trunk/vice/src/arch/gtk3/render_thread.c
===================================================================
--- trunk/vice/src/arch/gtk3/render_thread.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/arch/gtk3/render_thread.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -54,6 +54,8 @@
#define LOCK() pthread_mutex_lock(&lock)
#define UNLOCK() pthread_mutex_unlock(&lock)
+log_t render_log = LOG_DEFAULT;
+
render_thread_t render_thread_create(render_thread_callback_t callback, void *thread_context)
{
render_thread_t thread;
@@ -60,8 +62,10 @@
LOCK();
+ render_log = log_open("Render thread");
+
if (thread_count == RENDER_THREAD_MAX) {
- log_error(LOG_ERR, "Reach maximum render thread count (%d), cannot create another", RENDER_THREAD_MAX);
+ log_error(render_log, "Reach maximum render thread count (%d), cannot create another", RENDER_THREAD_MAX);
UNLOCK();
archdep_vice_exit(-1);
}
@@ -77,7 +81,7 @@
UNLOCK();
- log_message(LOG_DEFAULT, "Created render thread %d", thread->index);
+ log_message(render_log, "Created render thread %d", thread->index);
return thread;
}
@@ -91,7 +95,7 @@
return;
}
- log_message(LOG_DEFAULT, "Initiating render thread %d shutdown", thread->index);
+ log_message(render_log, "Initiating render thread %d shutdown", thread->index);
thread->is_shutdown_initiated = true;
/* Schedule the shutdown job */
@@ -102,7 +106,7 @@
void render_thread_join(render_thread_t thread)
{
- log_message(LOG_DEFAULT, "Joining render thread %d ...", thread->index);
+ log_message(render_log, "Joining render thread %d ...", thread->index);
/* TODO: We should block until all jobs are done - but there's a race condition deadlock outcome here. Fix needed */
g_thread_pool_free(thread->executor, TRUE, TRUE);
@@ -111,7 +115,7 @@
thread->is_shut_down = true;
UNLOCK();
- log_message(LOG_DEFAULT, "Joined render thread %d.", thread->index);
+ log_message(render_log, "Joined render thread %d.", thread->index);
}
void render_thread_shutdown_and_join_all(void)
@@ -132,7 +136,7 @@
if (thread->is_shutdown_initiated)
{
- log_message(LOG_DEFAULT, "Ignoring new render job as render thread %d %s down", thread->index, thread->is_shut_down ? "has shut" : "is shutting");
+ log_message(render_log, "Ignoring new render job as render thread %d %s down", thread->index, thread->is_shut_down ? "has shut" : "is shutting");
UNLOCK();
return;
}
Modified: trunk/vice/src/arch/gtk3/uimachinewindow.c
===================================================================
--- trunk/vice/src/arch/gtk3/uimachinewindow.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/arch/gtk3/uimachinewindow.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -79,6 +79,8 @@
#define VICE_EMPTY_POINTER canvas->blank_ptr
#endif
+log_t machine_window_log = LOG_DEFAULT;
+
static gboolean event_box_stillness_tick_cb(GtkWidget *widget,
GdkFrameClock *clock,
gpointer user_data);
@@ -133,7 +135,7 @@
#elif defined(WINDOWS_COMPILE)
if (SetCursorPos(x, y) == FALSE) {
- log_error(LOG_DEFAULT, "SetCursorPos(%d, %d) - %lu", x, y, GetLastError());
+ log_error(machine_window_log, "SetCursorPos(%d, %d) - %lu", x, y, GetLastError());
}
{
@@ -142,7 +144,7 @@
mouse_event(MOUSEEVENTF_ABSOLUTE, x, y, 0, 0);
dw = GetLastError();
if (dw != 0) {
- log_error(LOG_DEFAULT, "mouse_event(%d, %d) - %lu", x, y, dw);
+ log_error(machine_window_log, "mouse_event(%d, %d) - %lu", x, y, dw);
}
}
@@ -296,10 +298,10 @@
POINT pt;
/* mouse_host_moved(motion->x_root * scale, motion->y_root * scale); */
if (GetCursorPos(&pt) == FALSE) {
- log_error(LOG_DEFAULT, "GetCursorPos failed (%ld, %ld)\n", pt.x, pt.y);
+ log_error(machine_window_log, "GetCursorPos failed (%ld, %ld)\n", pt.x, pt.y);
/*printf("GetCursorPos failed (%ld, %ld)\n", pt.x, pt.y); fflush(stdout);*/
} else {
- /* log_message(LOG_DEFAULT, "mouse move %f, %f GetCursorPos: %ld, %ld", motion->x, motion->y, pt.x, pt.y); */
+ /* log_message(machine_window_log, "mouse move %f, %f GetCursorPos: %ld, %ld", motion->x, motion->y, pt.x, pt.y); */
/*printf("mouse move %f, %f GetCursorPos: %ld, %ld\n", motion->x, motion->y, pt.x, pt.y); fflush(stdout);*/
mouse_host_moved(pt.x * scale, pt.y * scale);
}
@@ -639,6 +641,8 @@
unsigned w, h, vstretch = 0, hstretch = 0;
gint window_id = PRIMARY_WINDOW;
+ machine_window_log = log_open("Window");
+
/* hack to determine window index for use in UI action handling later */
if (strcmp(canvas->videoconfig->chip_name, "VDC") == 0) {
window_id = SECONDARY_WINDOW;
@@ -652,7 +656,7 @@
backend_label = "OpenGL";
#endif
- log_message(LOG_DEFAULT, "using GTK3 backend: %s", backend_label);
+ log_message(machine_window_log, "using GTK3 backend: %s", backend_label);
new_event_box = gtk_event_box_new();
@@ -700,20 +704,20 @@
tricks and assumptions. the following also shows shortcomings / problems in other parts of the code.
*/
#if 1
- log_debug("chip_name: %s", canvas->videoconfig->chip_name);
- log_debug(" screen_size: %u x %u", canvas->geometry->screen_size.width, canvas->geometry->screen_size.height);
- /*log_debug(" first/lastline: %u x %u", canvas->viewport->first_line, canvas->viewport->last_line);*/
- log_debug(" gfx_size: %u x %u", canvas->geometry->gfx_size.width, canvas->geometry->gfx_size.height);
- log_debug(" gfx_position: %u x %u", canvas->geometry->gfx_position.x, canvas->geometry->gfx_position.y);
- log_debug(" first/last displayed line: %u x %u", canvas->geometry->first_displayed_line, canvas->geometry->last_displayed_line);
- log_debug(" extra offscreen border left/right: %u x %u", canvas->geometry->extra_offscreen_border_left, canvas->geometry->extra_offscreen_border_right);
- /*log_debug(" screen_display_wh: %f x %f", (float)canvas->screen_display_w, (float)canvas->screen_display_h);*/
- /*log_debug(" canvas_physical_wh: %u x %u", canvas->draw_buffer->canvas_physical_width, canvas->draw_buffer->canvas_physical_width);*/
- log_debug(" scalexy: %d x %d sizexy: %u x %u",
+ log_message(machine_window_log, "chip_name: %s", canvas->videoconfig->chip_name);
+ log_message(machine_window_log, " screen_size: %u x %u", canvas->geometry->screen_size.width, canvas->geometry->screen_size.height);
+ /*log_message(machine_window_log, " first/lastline: %u x %u", canvas->viewport->first_line, canvas->viewport->last_line);*/
+ log_message(machine_window_log, " gfx_size: %u x %u", canvas->geometry->gfx_size.width, canvas->geometry->gfx_size.height);
+ log_message(machine_window_log, " gfx_position: %u x %u", canvas->geometry->gfx_position.x, canvas->geometry->gfx_position.y);
+ log_message(machine_window_log, " first/last displayed line: %u x %u", canvas->geometry->first_displayed_line, canvas->geometry->last_displayed_line);
+ log_message(machine_window_log, " extra offscreen border left/right: %u x %u", canvas->geometry->extra_offscreen_border_left, canvas->geometry->extra_offscreen_border_right);
+ /*log_message(machine_window_log, " screen_display_wh: %f x %f", (float)canvas->screen_display_w, (float)canvas->screen_display_h);*/
+ /*log_message(machine_window_log, " canvas_physical_wh: %u x %u", canvas->draw_buffer->canvas_physical_width, canvas->draw_buffer->canvas_physical_width);*/
+ log_message(machine_window_log, " scalexy: %d x %d sizexy: %u x %u",
canvas->videoconfig->scalex, canvas->videoconfig->scaley,
canvas->videoconfig->cap->single_mode.sizex, canvas->videoconfig->cap->single_mode.sizey);
- log_debug(" rmode: %u", canvas->videoconfig->cap->single_mode.rmode);
- log_debug(" aspect ratio: %f", (float)canvas->geometry->pixel_aspect_ratio);
+ log_message(machine_window_log, " rmode: %u", canvas->videoconfig->cap->single_mode.rmode);
+ log_message(machine_window_log, " aspect ratio: %f", (float)canvas->geometry->pixel_aspect_ratio);
#endif
/* find out if we have a videochip that uses vertical stretching. since the resources are not
initialized, assume it always is stretched (this is the default) */
@@ -728,7 +732,7 @@
/* vstretch = 1; */ /* HACK: for some reason that doesn't give the wanted result */
}
#if 1
- log_debug(" hstretch: %u vstretch: %u", hstretch, vstretch);
+ log_message(machine_window_log, " hstretch: %u vstretch: %u", hstretch, vstretch);
#endif
/* calculate the initial size from the values we have
WARNING: terrible hacks coming up
@@ -746,7 +750,7 @@
h = (unsigned)(((double)h) * canvas->geometry->pixel_aspect_ratio);
}
#if 1
- log_debug(" initializing with width, height: %u x %u", w, h);
+ log_message(machine_window_log, " initializing with width, height: %u x %u", w, h);
#endif
/* finally set the size. use -1 for width and height to compensate for single pixel errors. this
will be corrected by the resize that will happen at the end of initialization */
Modified: trunk/vice/src/arch/gtk3/uimon.c
===================================================================
--- trunk/vice/src/arch/gtk3/uimon.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/arch/gtk3/uimon.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -115,6 +115,8 @@
#define FONT_TYPE_PETME64 3 /* https://www.kreativekorp.com/software/fonts/c64/ */
static int font_type = FONT_TYPE_ASCII;
+static log_t monui_log = LOG_DEFAULT;
+
/* FIXME: this should perhaps be done using some function from archdep */
static int is_dir(struct dirent *de)
{
@@ -915,7 +917,7 @@
static void printfontinfo(const PangoFontDescription* desc, const char *name)
{
const char *variations = pango_font_description_get_variations(desc);
- log_message(LOG_DEFAULT, "Monitor: using font '%s' (Family:%s, Size:%d, Variations:%s) PETSCII:%s Terminal Scale:%f",
+ log_message(monui_log, "using font '%s' (Family:%s, Size:%d, Variations:%s) PETSCII:%s Terminal Scale:%f",
name,
pango_font_description_get_family(desc),
pango_font_description_get_size(desc) / PANGO_SCALE,
@@ -1107,7 +1109,7 @@
PangoFontDescription* desc = pango_font_description_from_string(name);
if (desc == NULL) {
- log_warning(LOG_ERR, "Failed to parse Pango font description '%s'", name);
+ log_warning(monui_log, "Failed to parse Pango font description '%s'", name);
return NULL;
}
@@ -1129,12 +1131,12 @@
font_type = FONT_TYPE_ASCII;
if (resources_get_string("MonitorFont", &monitor_font) < 0) {
- log_error(LOG_ERR, "Failed to read 'MonitorFont' resource.");
+ log_error(monui_log, "Failed to read 'MonitorFont' resource.");
return false;
}
if (fixed.term == NULL) {
- log_error(LOG_ERR, "No monitor instance found.");
+ log_error(monui_log, "No monitor instance found.");
return false;
}
@@ -1165,14 +1167,14 @@
desc_tmp = vte_terminal_get_font(VTE_TERMINAL(fixed.term));
using_font = pango_font_description_to_string(desc_tmp);
if(!strncasecmp("c64 pro", using_font, 7)) {
- log_message(LOG_DEFAULT, "'C64 Pro*' font found, enabling PETSCII output.");
+ log_message(monui_log, "'C64 Pro*' font found, enabling PETSCII output.");
font_type = FONT_TYPE_C64PRO;
} else if(!strncasecmp("pet me 64", using_font, 9) ||
!strncasecmp("pet me 128", using_font, 10)) {
- log_message(LOG_DEFAULT, "'PET Me 64/128*' font found, enabling PETSCII output.");
+ log_message(monui_log, "'PET Me 64/128*' font found, enabling PETSCII output.");
font_type = FONT_TYPE_PETME64;
} else if(!strncasecmp("pet me", using_font, 6)) {
- log_message(LOG_DEFAULT, "'PET Me*' font found, enabling PETSCII output.");
+ log_message(monui_log, "'PET Me*' font found, enabling PETSCII output.");
font_type = FONT_TYPE_PETME;
}
scale_terminal_set(1.0f);
@@ -1179,7 +1181,7 @@
printfontinfo(desc_tmp, using_font);
if (resources_set_string("MonitorFont", using_font) < 0) {
- log_error(LOG_ERR, "Failed to set 'MonitorFont' resource.");
+ log_error(monui_log, "Failed to set 'MonitorFont' resource.");
return false;
}
@@ -1452,6 +1454,10 @@
console_t *uimon_window_open(bool display_now)
{
+ if (monui_log = LOG_DEFAULT) {
+ monui_log = log_open("Monitor UI");
+ }
+
if (native_monitor()) {
return uimonfb_window_open();
}
Modified: trunk/vice/src/c128/c128rom.c
===================================================================
--- trunk/vice/src/c128/c128rom.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/c128/c128rom.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -332,8 +332,9 @@
log_error(c128rom_log, "Unknown machine type %i.", machine_type);
return -1;
}
- printf("kernal64:%s\n", kernal64);
+ log_verbose(c128rom_log, "kernal64:%s", kernal64);
+
if (kernal64 != last_kernal64) {
resources_set_string("Kernal64Name", kernal64);
}
Modified: trunk/vice/src/c64/c64-resources.c
===================================================================
--- trunk/vice/src/c64/c64-resources.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/c64/c64-resources.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -79,6 +79,8 @@
static int board_type = BOARD_C64;
static int iec_reset = 0;
+static log_t res_log = LOG_DEFAULT;
+
static int set_chargen_rom_name(const char *val, void *param)
{
if (util_string_set(&chargen_rom_name, val)) {
@@ -95,7 +97,7 @@
AND it was not null before (in that case we are setting the
default value) */
int changed = 0;
- log_verbose(LOG_DEFAULT, "set_kernal_rom_name val:%s.", val);
+ log_verbose(res_log, "set_kernal_rom_name val:%s.", val);
if ((val != NULL) && (kernal_rom_name != NULL)) {
changed = (strcmp(val, kernal_rom_name) != 0);
}
@@ -255,7 +257,7 @@
const char *name = NULL;
int flags;
- log_verbose(LOG_DEFAULT, "set_kernal_revision(val:%d) was kernal_revision: %d", val, kernal_revision);
+ log_verbose(res_log, "set_kernal_revision(val:%d) was kernal_revision: %d", val, kernal_revision);
flags = get_trapflags();
@@ -282,7 +284,7 @@
} while ((rev == C64_KERNAL_UNKNOWN) && (kernal_match[n].name != NULL));
if (rev == C64_KERNAL_UNKNOWN) {
- log_error(LOG_DEFAULT, "invalid kernal revision (%d)", val);
+ log_error(res_log, "invalid kernal revision (%d)", val);
return -1;
}
@@ -293,10 +295,10 @@
}
}
- log_verbose(LOG_DEFAULT, "set_kernal_revision found rev:%d name: %s", rev, name);
+ log_verbose(res_log, "set_kernal_revision found rev:%d name: %s", rev, name);
if (resources_set_string("KernalName", name) < 0) {
- log_error(LOG_DEFAULT, "failed to set kernal name (%s)", name);
+ log_error(res_log, "failed to set kernal name (%s)", name);
restore_trapflags(flags);
return -1;
}
@@ -311,7 +313,7 @@
restore_trapflags(flags);
}
kernal_revision = rev;
- log_verbose(LOG_DEFAULT, "set_kernal_revision new kernal_revision: %d", kernal_revision);
+ log_verbose(res_log, "set_kernal_revision new kernal_revision: %d", kernal_revision);
return 0;
}
@@ -424,6 +426,7 @@
int c64_resources_init(void)
{
+ res_log = log_open("C64RES");
if (resources_register_string(resources_string) < 0) {
return -1;
}
Modified: trunk/vice/src/cmdline.c
===================================================================
--- trunk/vice/src/cmdline.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/cmdline.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -494,7 +494,7 @@
lib_free(cmd); /* free old pointer */
}
}
- log_message(LOG_DEFAULT, "\nreconstructed commandline options (might be incomplete):");
+ log_message(LOG_DEFAULT, "\n" LOG_COL_LWHITE "reconstructed commandline options (might be incomplete)" LOG_COL_OFF ":");
log_message(LOG_DEFAULT, "%s\n", cmdline);
lib_free(cmdline);
}
Modified: trunk/vice/src/interrupt.c
===================================================================
--- trunk/vice/src/interrupt.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/interrupt.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -314,6 +314,9 @@
}
/* Trigger a TRAP next cycle */
+
+extern log_t traps_log;
+
void interrupt_maincpu_trigger_trap(void (*trap_func)(uint16_t, void *data),
void *data)
{
@@ -331,7 +334,7 @@
*/
if (trap_size_needed > cs->traps_size) {
- log_message(LOG_DEFAULT, "Increasing trap_func array size to %d with %d to run", trap_size_needed, cs->traps_count);
+ log_verbose(traps_log, "Increasing trap_func array size to %d with %d to run", trap_size_needed, cs->traps_count);
cs->trap_func = lib_realloc(cs->trap_func, trap_size_needed * sizeof(*cs->trap_func));
cs->trap_data = lib_realloc(cs->trap_data, trap_size_needed * sizeof(*cs->trap_data));
cs->traps_size = trap_size_needed;
Modified: trunk/vice/src/keymap.c
===================================================================
--- trunk/vice/src/keymap.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/keymap.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -1484,6 +1484,8 @@
int nsym, npos, mapping, idx, type;
const char *name;
+ keyboard_log = log_open("Keymap");
+
/* VSID doesn't have a keyboard */
if (machine_class == VICE_MACHINE_VSID) {
return 0;
@@ -1504,7 +1506,7 @@
if (npos && nsym) {
mapping = archdep_kbd_get_host_mapping();
- log_verbose(LOG_DEFAULT, "Setting up default keyboard mapping for host type %d (%s)",
+ log_verbose(keyboard_log, "Setting up default keyboard mapping for host type %d (%s)",
mapping, keyboard_get_mapping_name(mapping));
if (resources_set_int("KeymapIndex", KBD_INDEX_SYM) < 0) {
/* return -1; */
@@ -1522,13 +1524,13 @@
util_string_set(&resources_string_d1, name);
util_string_set(&resources_string_d3, name);
- log_verbose(LOG_DEFAULT, "Default positional map is: %s", name);
+ log_verbose(keyboard_log, "Default positional map is: %s", name);
keyboard_set_default_keymap_file(KBD_INDEX_SYM);
if (resources_get_string("KeymapSymFile", &name) < 0) {
DBG(("<<keyboard_resources_init(error)\n"));
return -1;
}
- log_verbose(LOG_DEFAULT, "Default symbolic map is: %s", name);
+ log_verbose(keyboard_log, "Default symbolic map is: %s", name);
util_string_set(&resources_string_d0, name);
util_string_set(&resources_string_d2, name);
Modified: trunk/vice/src/lib.c
===================================================================
--- trunk/vice/src/lib.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/lib.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -962,9 +962,9 @@
}
static uint64_t initalseed;
-void lib_rand_printseed(void)
+void lib_rand_printseed(log_t log)
{
- log_message(LOG_DEFAULT, "random seed was: 0x%"PRIx64, initalseed);
+ log_message(log, "random seed was: 0x%"PRIx64, initalseed);
}
void lib_rand_seed(uint64_t seed)
Modified: trunk/vice/src/lib.h
===================================================================
--- trunk/vice/src/lib.h 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/lib.h 2024-08-04 16:28:07 UTC (rev 45263)
@@ -35,6 +35,7 @@
#include <stdlib.h>
#include "debug.h"
+#include "log.h"
#ifdef DEBUG
/* memory leak pinpointing, don't forget to enable in lib.c */
@@ -48,7 +49,7 @@
double lib_double_rand_unit(void);
void lib_rand_seed(uint64_t seed);
-void lib_rand_printseed(void);
+void lib_rand_printseed(log_t log);
char *lib_msprintf(const char *fmt, ...) VICE_ATTR_PRINTF;
char *lib_mvsprintf(const char *fmt, va_list args);
Modified: trunk/vice/src/machine.c
===================================================================
--- trunk/vice/src/machine.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/machine.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -242,9 +242,12 @@
/* NOTE: To make sure things work "as expected", really only deal with "reset"
in the function below - anything related to "powerup" should go into
machine_powerup() instead */
+
+extern log_t maincpu_log; /* FIXME: where should this live? */
+
void machine_reset(void)
{
- log_message(LOG_DEFAULT, "Main CPU: RESET.");
+ log_message(maincpu_log, "RESET.");
is_jammed = false;
Modified: trunk/vice/src/main.c
===================================================================
--- trunk/vice/src/main.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/main.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -123,6 +123,8 @@
/* ------------------------------------------------------------------------- */
+log_t main_log;
+
/* This is the main program entry point. Call this from `main()'. */
int main_program(int argc, char **argv)
{
@@ -331,6 +333,8 @@
}
}
+ main_log = log_open("Main");
+
DBG(("main:initcmdline_check_args(argc:%d)\n", argc));
if (initcmdline_check_args(argc, argv) < 0) {
return -1;
@@ -346,11 +350,15 @@
program_name = archdep_program_name();
/* VICE boot sequence. */
+
+ /* NOTE: we do NOT use main_log here on purpose, this is so we can output the
+ welcome banner without the "Main:" prefix */
+
log_message(LOG_DEFAULT, " ");
#ifdef USE_SVN_REVISION
- log_message(LOG_DEFAULT, "*** VICE Version %s, rev %s ***", VERSION, VICE_SVN_REV_STRING);
+ log_message(LOG_DEFAULT, LOG_COL_LWHITE "*** VICE Version %s, rev %s ***" LOG_COL_OFF, VERSION, VICE_SVN_REV_STRING);
#else
- log_message(LOG_DEFAULT, "*** VICE Version %s ***", VERSION);
+ log_message(LOG_DEFAULT, LOG_COL_LWHITE "*** VICE Version %s ***" LOG_COL_OFF, VERSION);
#endif
log_message(LOG_DEFAULT, " ");
if (machine_class == VICE_MACHINE_VSID) {
@@ -391,18 +399,20 @@
log_message(LOG_DEFAULT, "%s", term_tmp);
log_message(LOG_DEFAULT, " ");
- log_message(LOG_DEFAULT, "This is free software with ABSOLUTELY NO WARRANTY.");
- log_message(LOG_DEFAULT, "See the \"About VICE\" command for more info.");
+ log_message(LOG_DEFAULT, LOG_COL_LWHITE "This is free software with ABSOLUTELY NO WARRANTY." LOG_COL_OFF);
+ log_message(LOG_DEFAULT, LOG_COL_LWHITE "See the \"About VICE\" command for more info." LOG_COL_OFF);
log_message(LOG_DEFAULT, " ");
+ /* from this point on use main_log ! */
+
/* lib_free(program_name); */
- lib_rand_printseed(); /* log the random seed */
- log_message(LOG_DEFAULT, "command line was: %s", cmdline);
+ lib_rand_printseed(main_log); /* log the random seed */
+ log_message(main_log, "command line was: %s", cmdline);
lib_free(cmdline);
/* log VICE system file directory */
datadir = archdep_get_vice_datadir();
- log_message(LOG_DEFAULT, "VICE system file directory: %s.", datadir);
+ log_message(main_log, "VICE system file directory: %s.", datadir);
lib_free(datadir);
/* Complete the GUI initialization (after loading the resources and
@@ -423,7 +433,7 @@
#ifdef USE_VICE_THREAD
if (pthread_create(&vice_thread, NULL, vice_thread_main, NULL)) {
- log_error(LOG_DEFAULT, "Fatal: failed to launch main thread");
+ log_fatal(main_log, "failed to launch main thread");
return 1;
}
@@ -438,15 +448,17 @@
return 0;
}
+extern log_t maincpu_log; /* FIXME: where should this live? */
+
void main_loop_forever(void)
{
- log_message(LOG_DEFAULT, "%s", ""); /* ugly hack to produce a blank log line, but not trigger a warning */
- log_message(LOG_DEFAULT, "Main CPU: starting at ($FFFC).");
+ log_message(maincpu_log, "%s", ""); /* ugly hack to produce a blank log line, but not trigger a warning */
+ log_message(maincpu_log, "starting at ($FFFC).");
/* This doesn't return. The thread will directly exit when requested. */
maincpu_mainloop();
- log_error(LOG_DEFAULT, "perkele! (THREAD)");
+ log_fatal(main_log, "perkele! (THREAD)");
}
#ifdef USE_VICE_THREAD
@@ -458,7 +470,9 @@
return;
}
- log_message(LOG_DEFAULT, "\nConfigure Flags:\n%s", CONFIGURE_FLAGS);
+ /* NOTE: use LOG_DEFAULT here on purpose */
+
+ log_message(LOG_DEFAULT, "\n" LOG_COL_LWHITE "Configure Flags" LOG_COL_OFF ":\n%s", CONFIGURE_FLAGS);
/* log resources with non default values */
resources_log_active();
/* log the active config as commandline options */
@@ -474,7 +488,7 @@
pthread_join(vice_thread, NULL);
- log_message(LOG_DEFAULT, "VICE thread has been joined.");
+ log_message(main_log, "VICE thread has been joined.");
}
void *vice_thread_main(void *unused)
Modified: trunk/vice/src/main65816cpu.c
===================================================================
--- trunk/vice/src/main65816cpu.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/main65816cpu.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -50,6 +50,8 @@
#define EXIT_FAILURE 1
#endif
+log_t maincpu_log = LOG_DEFAULT;
+
/* MACHINE_STUFF should define/undef
- NEED_REG_PC
@@ -187,6 +189,8 @@
void maincpu_early_init(void)
{
maincpu_int_status = interrupt_cpu_status_new();
+
+ maincpu_log = log_open("Main CPU");
}
void maincpu_init(void)
Modified: trunk/vice/src/mainc64cpu.c
===================================================================
--- trunk/vice/src/mainc64cpu.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/mainc64cpu.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -42,6 +42,7 @@
#include "debug.h"
#include "cmdline.h"
#include "interrupt.h"
+#include "log.h"
#include "machine.h"
#include "mainc64cpu.h"
#include "maincpu.h"
@@ -59,6 +60,7 @@
#define EXIT_FAILURE 1
#endif
+log_t maincpu_log = LOG_DEFAULT;
/* MACHINE_STUFF should define/undef
@@ -607,6 +609,8 @@
void maincpu_early_init(void)
{
maincpu_int_status = interrupt_cpu_status_new();
+
+ maincpu_log = log_open("Main CPU");
}
void maincpu_init(void)
@@ -749,6 +753,7 @@
machine_trigger_reset(MACHINE_RESET_MODE_RESET_CPU);
while (1) {
+#define CPU_LOG_ID maincpu_log
#define ANE_LOG_LEVEL ane_log_level
#define LXA_LOG_LEVEL lxa_log_level
#define CLK maincpu_clk
@@ -803,7 +808,7 @@
maincpu_int_status->num_dma_per_opcode = 0;
if (maincpu_clk_limit && (maincpu_clk > maincpu_clk_limit)) {
- log_error(LOG_DEFAULT, "cycle limit reached.");
+ log_error(maincpu_log, "cycle limit reached.");
archdep_vice_exit(EXIT_FAILURE);
}
Modified: trunk/vice/src/maincpu.c
===================================================================
--- trunk/vice/src/maincpu.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/maincpu.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -58,6 +58,8 @@
#define EXIT_FAILURE 1
#endif
+log_t maincpu_log = LOG_DEFAULT;
+
/* MACHINE_STUFF should define/undef
- NEED_REG_PC
@@ -372,6 +374,8 @@
void maincpu_early_init(void)
{
maincpu_int_status = interrupt_cpu_status_new();
+
+ maincpu_log = log_open("Main CPU");
}
void maincpu_init(void)
Modified: trunk/vice/src/mainlock.c
===================================================================
--- trunk/vice/src/mainlock.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/mainlock.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -63,8 +63,11 @@
static bool vice_thread_keepalive = true;
static bool vice_thread_is_running = false;
+static log_t mainlock_log = LOG_DEFAULT;
+
void mainlock_init(void)
{
+ mainlock_log = log_open("Mainlock");
}
@@ -106,7 +109,7 @@
pthread_mutex_unlock(&internal_lock);
pthread_mutex_unlock(&main_lock);
- log_message(LOG_DEFAULT, "VICE thread is exiting");
+ log_message(mainlock_log, "VICE thread is exiting");
archdep_thread_shutdown();
@@ -135,12 +138,12 @@
vice_thread_keepalive = false;
pthread_mutex_unlock(&internal_lock);
- log_message(LOG_DEFAULT, "VICE thread initiating shutdown");
+ log_message(mainlock_log, "VICE thread initiating shutdown");
/* If called on the vice thread itself, run the exit code immediately */
if (pthread_equal(pthread_self(), vice_thread)) {
consider_exit();
- log_error(LOG_ERR, "VICE thread didn't immediately exit when it should have");
+ log_error(mainlock_log, "VICE thread didn't immediately exit when it should have");
}
}
Modified: trunk/vice/src/mainviccpu.c
===================================================================
--- trunk/vice/src/mainviccpu.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/mainviccpu.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -51,6 +51,8 @@
#define EXIT_FAILURE 1
#endif
+log_t maincpu_log = LOG_DEFAULT;
+
/* MACHINE_STUFF should define/undef
- NEED_REG_PC
@@ -433,6 +435,8 @@
void maincpu_early_init(void)
{
maincpu_int_status = interrupt_cpu_status_new();
+
+ maincpu_log = log_open("Main CPU");
}
void maincpu_init(void)
@@ -576,6 +580,7 @@
machine_trigger_reset(MACHINE_RESET_MODE_RESET_CPU);
while (1) {
+#define CPU_LOG_ID maincpu_log
#define ANE_LOG_LEVEL ane_log_level
#define LXA_LOG_LEVEL lxa_log_level
#define CLK maincpu_clk
Modified: trunk/vice/src/opencbmlib.c
===================================================================
--- trunk/vice/src/opencbmlib.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/opencbmlib.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -45,6 +45,8 @@
#define LOG(x)
#endif
+static log_t opencbm_log = LOG_DEFAULT;
+
static void *opencbm_so = NULL;
/* Macro for getting function pointers from opencbm dll. */
@@ -83,8 +85,10 @@
if (opencbm_so == NULL) {
opencbm_so = vice_dynlib_open(ARCHDEP_OPENCBM_SO_NAME);
+ opencbm_log = log_open("OPENCBM");
+
if (opencbm_so == NULL) {
- log_verbose(LOG_DEFAULT, "opening dynamic library " ARCHDEP_OPENCBM_SO_NAME " failed!");
+ log_verbose(opencbm_log, "opening dynamic library " ARCHDEP_OPENCBM_SO_NAME " failed!");
return -1;
}
@@ -102,7 +106,7 @@
GET_SYMBOL_AND_TEST(cbm_get_eoi);
GET_SYMBOL_AND_TEST(cbm_reset);
- log_verbose(LOG_DEFAULT, "sucessfully loaded " ARCHDEP_OPENCBM_SO_NAME);
+ log_verbose(opencbm_log, "sucessfully loaded " ARCHDEP_OPENCBM_SO_NAME);
}
return 0;
Modified: trunk/vice/src/resources.c
===================================================================
--- trunk/vice/src/resources.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/resources.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -1678,7 +1678,7 @@
char *line = string_resource_item(i, "");
if (line != NULL) {
if (n == 0) {
- log_message(LOG_DEFAULT, "\nResources with non default values:");
+ log_message(LOG_DEFAULT, "\n" LOG_COL_LWHITE "Resources with non default values" LOG_COL_OFF ":");
n++;
}
log_message(LOG_DEFAULT, "%s", line);
Modified: trunk/vice/src/sid/resid-dtv.cc
===================================================================
--- trunk/vice/src/sid/resid-dtv.cc 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/sid/resid-dtv.cc 2024-08-04 16:28:07 UTC (rev 45263)
@@ -45,6 +45,8 @@
#include "sid-snapshot.h"
#include "types.h"
+extern log_t sound_log;
+
} // extern "C"
#include "resid-dtv/sid.h"
@@ -153,12 +155,12 @@
if (!psid->sid->set_sampling_parameters(cycles_per_sec, method,
speed, passband, gain)) {
- log_warning(LOG_DEFAULT,
+ log_warning(sound_log,
"reSID_dtv: Out of spec, increase sampling rate or decrease maximum speed");
return 0;
}
- log_message(LOG_DEFAULT, "reSID_dtv: %s, filter %s, sampling rate %dHz - %s",
+ log_message(sound_log, "reSID_dtv: %s, filter %s, sampling rate %dHz - %s",
model_text,
filters_enabled ? "on" : "off",
speed, method_text);
Modified: trunk/vice/src/sid/resid.cc
===================================================================
--- trunk/vice/src/sid/resid.cc 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/sid/resid.cc 2024-08-04 16:28:07 UTC (rev 45263)
@@ -45,6 +45,8 @@
#include "sid-snapshot.h"
#include "types.h"
+extern log_t sound_log;
+
} // extern "C"
#include "resid/sid.h"
@@ -219,7 +221,7 @@
if (!psid->sid->set_sampling_parameters(cycles_per_sec, method,
speed, passband, gain)) {
- log_warning(LOG_DEFAULT,
+ log_warning(sound_log,
"reSID: Out of spec, increase sampling rate or decrease maximum speed");
return 0;
}
@@ -226,7 +228,7 @@
psid->sid->enable_raw_debug_output(rawoutput);
- log_message(LOG_DEFAULT, "reSID: %s, filter %s, sampling rate %dHz - %s%s",
+ log_message(sound_log, "reSID: %s, filter %s, sampling rate %dHz - %s%s",
model_text,
filters_enabled ? "on" : "off",
speed, method_text,
Modified: trunk/vice/src/sound.c
===================================================================
--- trunk/vice/src/sound.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/sound.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -60,7 +60,7 @@
#include "ui.h"
-static log_t sound_log = LOG_ERR;
+log_t sound_log = LOG_ERR;
static void sounddev_close(const sound_device_t **dev);
Modified: trunk/vice/src/traps.c
===================================================================
--- trunk/vice/src/traps.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/traps.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -62,7 +62,7 @@
static int install_trap(const trap_t *t);
static int remove_trap(const trap_t *t);
-static log_t traps_log = LOG_ERR;
+log_t traps_log = LOG_DEFAULT;
/* ------------------------------------------------------------------------- */
@@ -302,7 +302,7 @@
}
}
- log_verbose(LOG_DEFAULT, "Trap '%s' installed.", t->name);
+ log_verbose(traps_log, "Trap '%s' installed.", t->name);
(t->storefunc)(t->address, TRAP_OPCODE);
return 0;
@@ -318,10 +318,10 @@
traplist = p;
if (traps_enabled) {
- log_verbose(LOG_DEFAULT, "Trap '%s' added.", trap->name);
+ log_verbose(traps_log, "Trap '%s' added.", trap->name);
install_trap(trap);
} else {
- log_verbose(LOG_DEFAULT, "Traps are disabled, trap '%s' not installed.", trap->name);
+ log_verbose(traps_log, "Traps are disabled, trap '%s' not installed.", trap->name);
}
return 0;
@@ -334,7 +334,7 @@
trap->address, trap->name);
return -1;
}
- log_verbose(LOG_DEFAULT, "Trap '%s' disabled.", trap->name);
+ log_verbose(traps_log, "Trap '%s' disabled.", trap->name);
(trap->storefunc)(trap->address, trap->check[0]);
return 0;
Modified: trunk/vice/src/viciisc/vicii-chip-model.c
===================================================================
--- trunk/vice/src/viciisc/vicii-chip-model.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/viciisc/vicii-chip-model.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -596,8 +596,8 @@
"Initializing chip model \"%s\" (%d cycles per line, %d raster lines).",
cm->name, cm->cycles_per_line, cm->num_raster_lines);
- log_verbose(LOG_DEFAULT, "VIC-II: BA");
- log_verbose(LOG_DEFAULT, "VIC-II: cycle xpos vi M76543210 fetch border gfx sprite");
+ log_verbose(vicii.log, " BA");
+ log_verbose(vicii.log, " cycle xpos vi M76543210 fetch border gfx sprite");
for (i = 0; i < (cm->cycles_per_line * 2); i++) {
int phi = (ct[i].cycle & 0x80) ? 1 : 0;
@@ -716,7 +716,7 @@
}
/* dump to log */
- log_verbose(LOG_DEFAULT, "VIC-II: %s $%03x %s %s %s %s %s %s",
+ log_verbose(vicii.log, " %s $%03x %s %s %s %s %s %s",
cycle_str, (unsigned int)xpos, visible_str, ba_str,
fetch_str, border_str, gfx_str, sprite_str);
}
@@ -837,7 +837,7 @@
default:
/* should never happen */
vicii_chip_model_set(&chip_model_mos6569r3);
- log_error(LOG_DEFAULT, "vicii_chip_model_init: unknown VICII type.");
+ log_error(vicii.log, "vicii_chip_model_init: unknown VICII type.");
break;
}
vicii_color_update_palette(vicii.raster.canvas);
Modified: trunk/vice/src/vsync.c
===================================================================
--- trunk/vice/src/vsync.c 2024-08-04 14:53:15 UTC (rev 45262)
+++ trunk/vice/src/vsync.c 2024-08-04 16:28:07 UTC (rev 45263)
@@ -90,6 +90,8 @@
# define METRIC_UNLOCK()
#endif
+log_t vsync_log = LOG_DEFAULT;
+
/* ------------------------------------------------------------------------- */
typedef struct callback_queue_s {
@@ -166,7 +168,7 @@
{
if (val == 0) {
val = 100;
- log_warning(LOG_DEFAULT, "Setting speed to 0 is no longer supported - use warp instead.");
+ log_warning(vsync_log, "Setting speed to 0 is no longer supported - use warp instead.");
}
relative_speed = val;
@@ -324,6 +326,8 @@
void vsync_init(void (*hook)(void))
{
+ vsync_log = log_open("VSync");
+
/* Set the initial warp state. */
if (initial_warp_mode_cmdline != -1) {
/* Command line overrides config resource setting. */
@@ -521,7 +525,7 @@
tick_now = tick_now_after(last_sync_tick);
if (sync_reset) {
- log_message(LOG_DEFAULT, "Sync reset");
+ log_message(vsync_log, "Sync reset");
sync_reset = false;
metrics_reset = true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-08-04 14:53:16
|
Revision: 45262
http://sourceforge.net/p/vice-emu/code/45262
Author: gpz
Date: 2024-08-04 14:53:15 +0000 (Sun, 04 Aug 2024)
Log Message:
-----------
add log_fatal
Modified Paths:
--------------
trunk/vice/src/log.c
trunk/vice/src/log.h
Modified: trunk/vice/src/log.c
===================================================================
--- trunk/vice/src/log.c 2024-08-03 21:20:13 UTC (rev 45261)
+++ trunk/vice/src/log.c 2024-08-04 14:53:15 UTC (rev 45262)
@@ -808,6 +808,20 @@
UNLOCK_AND_RETURN_INT(rc);
}
+int log_fatal(log_t log, const char *format, ...)
+{
+ va_list ap;
+ int rc;
+
+ LOCK();
+
+ va_start(ap, format);
+ rc = log_helper(log, LOG_LEVEL_FATAL, format, ap);
+ va_end(ap);
+
+ UNLOCK_AND_RETURN_INT(rc);
+}
+
int log_verbose(log_t log, const char *format, ...)
{
va_list ap;
Modified: trunk/vice/src/log.h
===================================================================
--- trunk/vice/src/log.h 2024-08-03 21:20:13 UTC (rev 45261)
+++ trunk/vice/src/log.h 2024-08-04 14:53:15 UTC (rev 45262)
@@ -101,6 +101,7 @@
int log_message(log_t log, const char *format, ...) VICE_ATTR_PRINTF2;
int log_warning(log_t log, const char *format, ...) VICE_ATTR_PRINTF2;
int log_error(log_t log, const char *format, ...) VICE_ATTR_PRINTF2;
+int log_fatal(log_t log, const char *format, ...) VICE_ATTR_PRINTF2;
int log_debug(const char *format, ...) VICE_ATTR_PRINTF;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-08-03 21:20:16
|
Revision: 45261
http://sourceforge.net/p/vice-emu/code/45261
Author: gpz
Date: 2024-08-03 21:20:13 +0000 (Sat, 03 Aug 2024)
Log Message:
-----------
call log_verbose also with log_t
Modified Paths:
--------------
trunk/vice/src/arch/gtk3/mousedrv.c
trunk/vice/src/c64/c64-cmdline-options.c
trunk/vice/src/c64/c64-resources.c
trunk/vice/src/c64/psid.c
trunk/vice/src/c64/vsid-resources.c
trunk/vice/src/diskimage/diskimage.c
trunk/vice/src/diskimage/fsimage-probe.c
trunk/vice/src/fileio/p00.c
trunk/vice/src/keymap.c
trunk/vice/src/log.c
trunk/vice/src/log.h
trunk/vice/src/opencbmlib.c
trunk/vice/src/resources.c
trunk/vice/src/traps.c
trunk/vice/src/viciisc/vicii-chip-model.c
Modified: trunk/vice/src/arch/gtk3/mousedrv.c
===================================================================
--- trunk/vice/src/arch/gtk3/mousedrv.c 2024-08-03 20:41:21 UTC (rev 45260)
+++ trunk/vice/src/arch/gtk3/mousedrv.c 2024-08-03 21:20:13 UTC (rev 45261)
@@ -110,7 +110,7 @@
{
/** \todo Tell UI level to capture mouse cursor if necessary and
* permitted */
- log_verbose("GTK3MOUSE: Status changed: %d (%s)",
+ log_verbose(LOG_DEFAULT, "GTK3MOUSE: Status changed: %d (%s)",
_mouse_enabled, _mouse_enabled ? "enabled" : "disabled");
if (_mouse_enabled) {
ui_mouse_grab_pointer();
Modified: trunk/vice/src/c64/c64-cmdline-options.c
===================================================================
--- trunk/vice/src/c64/c64-cmdline-options.c 2024-08-03 20:41:21 UTC (rev 45260)
+++ trunk/vice/src/c64/c64-cmdline-options.c 2024-08-03 21:20:13 UTC (rev 45261)
@@ -188,7 +188,7 @@
i++;
} while ((rev == C64_KERNAL_UNKNOWN) && (kernal_match[i].name != NULL));
- log_verbose("set_kernal_revision (\"-kernalrev\") val:'%s' rev: %d", param, rev);
+ log_verbose(LOG_DEFAULT, "set_kernal_revision (\"-kernalrev\") val:'%s' rev: %d", param, rev);
if (rev == C64_KERNAL_UNKNOWN) {
log_error(LOG_DEFAULT, "invalid kernal revision (%d)", rev);
Modified: trunk/vice/src/c64/c64-resources.c
===================================================================
--- trunk/vice/src/c64/c64-resources.c 2024-08-03 20:41:21 UTC (rev 45260)
+++ trunk/vice/src/c64/c64-resources.c 2024-08-03 21:20:13 UTC (rev 45261)
@@ -95,7 +95,7 @@
AND it was not null before (in that case we are setting the
default value) */
int changed = 0;
- log_verbose("set_kernal_rom_name val:%s.", val);
+ log_verbose(LOG_DEFAULT, "set_kernal_rom_name val:%s.", val);
if ((val != NULL) && (kernal_rom_name != NULL)) {
changed = (strcmp(val, kernal_rom_name) != 0);
}
@@ -255,7 +255,7 @@
const char *name = NULL;
int flags;
- log_verbose("set_kernal_revision(val:%d) was kernal_revision: %d", val, kernal_revision);
+ log_verbose(LOG_DEFAULT, "set_kernal_revision(val:%d) was kernal_revision: %d", val, kernal_revision);
flags = get_trapflags();
@@ -293,7 +293,7 @@
}
}
- log_verbose("set_kernal_revision found rev:%d name: %s", rev, name);
+ log_verbose(LOG_DEFAULT, "set_kernal_revision found rev:%d name: %s", rev, name);
if (resources_set_string("KernalName", name) < 0) {
log_error(LOG_DEFAULT, "failed to set kernal name (%s)", name);
@@ -311,7 +311,7 @@
restore_trapflags(flags);
}
kernal_revision = rev;
- log_verbose("set_kernal_revision new kernal_revision: %d", kernal_revision);
+ log_verbose(LOG_DEFAULT, "set_kernal_revision new kernal_revision: %d", kernal_revision);
return 0;
}
Modified: trunk/vice/src/c64/psid.c
===================================================================
--- trunk/vice/src/c64/psid.c 2024-08-03 20:41:21 UTC (rev 45260)
+++ trunk/vice/src/c64/psid.c 2024-08-03 21:20:13 UTC (rev 45261)
@@ -126,7 +126,7 @@
i++;
} while ((rev == C64_KERNAL_UNKNOWN) && (kernal_match[i].name != NULL));
- log_verbose("set_kernal_revision (\"-kernalrev\") val:'%s' rev: %d", param, rev);
+ log_verbose(LOG_DEFAULT, "set_kernal_revision (\"-kernalrev\") val:'%s' rev: %d", param, rev);
if (rev == C64_KERNAL_UNKNOWN) {
log_error(LOG_DEFAULT, "invalid kernal revision (%d)", rev);
Modified: trunk/vice/src/c64/vsid-resources.c
===================================================================
--- trunk/vice/src/c64/vsid-resources.c 2024-08-03 20:41:21 UTC (rev 45260)
+++ trunk/vice/src/c64/vsid-resources.c 2024-08-03 21:20:13 UTC (rev 45261)
@@ -140,7 +140,7 @@
{
int n = 0, rev = C64_KERNAL_UNKNOWN;
const char *name = NULL;
- log_verbose("set_kernal_revision was kernal_revision: %d new val:%d", kernal_revision, val);
+ log_verbose(LOG_DEFAULT, "set_kernal_revision was kernal_revision: %d new val:%d", kernal_revision, val);
if (val == C64_KERNAL_UNKNOWN) {
kernal_revision = C64_KERNAL_UNKNOWN;
@@ -161,7 +161,7 @@
return -1;
}
- log_verbose("set_kernal_revision found rev:%d name: %s", rev, name);
+ log_verbose(LOG_DEFAULT, "set_kernal_revision found rev:%d name: %s", rev, name);
if (resources_set_string("KernalName", name) < 0) {
log_error(LOG_DEFAULT, "failed to set kernal name (%s)", name);
@@ -175,7 +175,7 @@
}
kernal_revision = rev;
- log_verbose("set_kernal_revision new kernal_revision: %d", kernal_revision);
+ log_verbose(LOG_DEFAULT, "set_kernal_revision new kernal_revision: %d", kernal_revision);
return 0;
}
Modified: trunk/vice/src/diskimage/diskimage.c
===================================================================
--- trunk/vice/src/diskimage/diskimage.c 2024-08-03 20:41:21 UTC (rev 45260)
+++ trunk/vice/src/diskimage/diskimage.c 2024-08-03 21:20:13 UTC (rev 45261)
@@ -441,7 +441,7 @@
switch (image->device) {
case DISK_IMAGE_DEVICE_FS:
- log_verbose("Unit %u drive %u: %s disk image attached: %s.",
+ log_verbose(LOG_DEFAULT, "Unit %u drive %u: %s disk image attached: %s.",
unit, drive, type, fsimage_name_get(image));
break;
}
@@ -465,7 +465,7 @@
switch (image->device) {
case DISK_IMAGE_DEVICE_FS:
- log_verbose("Unit %u drive %u: %s disk image detached: %s.",
+ log_verbose(LOG_DEFAULT, "Unit %u drive %u: %s disk image detached: %s.",
unit, drive, type, fsimage_name_get(image));
break;
}
Modified: trunk/vice/src/diskimage/fsimage-probe.c
===================================================================
--- trunk/vice/src/diskimage/fsimage-probe.c 2024-08-03 20:41:21 UTC (rev 45260)
+++ trunk/vice/src/diskimage/fsimage-probe.c 2024-08-03 21:20:13 UTC (rev 45261)
@@ -65,7 +65,7 @@
fsimage = image->media.fsimage;
- log_verbose("%s disk image recognised: %s, %u tracks%s",
+ log_verbose(LOG_DEFAULT, "%s disk image recognised: %s, %u tracks%s",
type, fsimage->name, image->tracks,
image->read_only ? " (read only)." : ".");
}
Modified: trunk/vice/src/fileio/p00.c
===================================================================
--- trunk/vice/src/fileio/p00.c 2024-08-03 20:41:21 UTC (rev 45260)
+++ trunk/vice/src/fileio/p00.c 2024-08-03 21:20:13 UTC (rev 45261)
@@ -450,7 +450,7 @@
} else if (*reclenp != reclen) {
/* The given record length does not match the stored record
* length */
- log_verbose("p00_open: record size: found %d != expected %d => record size mismatch\n", reclen, *reclenp);
+ log_verbose(LOG_DEFAULT, "p00_open: record size: found %d != expected %d => record size mismatch\n", reclen, *reclenp);
return NULL;
}
}
Modified: trunk/vice/src/keymap.c
===================================================================
--- trunk/vice/src/keymap.c 2024-08-03 20:41:21 UTC (rev 45260)
+++ trunk/vice/src/keymap.c 2024-08-03 21:20:13 UTC (rev 45261)
@@ -1504,7 +1504,7 @@
if (npos && nsym) {
mapping = archdep_kbd_get_host_mapping();
- log_verbose("Setting up default keyboard mapping for host type %d (%s)",
+ log_verbose(LOG_DEFAULT, "Setting up default keyboard mapping for host type %d (%s)",
mapping, keyboard_get_mapping_name(mapping));
if (resources_set_int("KeymapIndex", KBD_INDEX_SYM) < 0) {
/* return -1; */
@@ -1522,13 +1522,13 @@
util_string_set(&resources_string_d1, name);
util_string_set(&resources_string_d3, name);
- log_verbose("Default positional map is: %s", name);
+ log_verbose(LOG_DEFAULT, "Default positional map is: %s", name);
keyboard_set_default_keymap_file(KBD_INDEX_SYM);
if (resources_get_string("KeymapSymFile", &name) < 0) {
DBG(("<<keyboard_resources_init(error)\n"));
return -1;
}
- log_verbose("Default symbolic map is: %s", name);
+ log_verbose(LOG_DEFAULT, "Default symbolic map is: %s", name);
util_string_set(&resources_string_d0, name);
util_string_set(&resources_string_d2, name);
Modified: trunk/vice/src/log.c
===================================================================
--- trunk/vice/src/log.c 2024-08-03 20:41:21 UTC (rev 45260)
+++ trunk/vice/src/log.c 2024-08-03 21:20:13 UTC (rev 45261)
@@ -808,30 +808,31 @@
UNLOCK_AND_RETURN_INT(rc);
}
-int log_debug(const char *format, ...)
+int log_verbose(log_t log, const char *format, ...)
{
va_list ap;
- int rc;
+ int rc = 0;
LOCK();
va_start(ap, format);
- rc = log_helper(LOG_DEFAULT, LOG_LEVEL_DEBUG, format, ap);
+ rc = log_helper(log, LOG_LEVEL_VERBOSE, format, ap);
va_end(ap);
UNLOCK_AND_RETURN_INT(rc);
}
-int log_verbose(const char *format, ...)
+int log_debug(const char *format, ...)
{
va_list ap;
- int rc = 0;
+ int rc;
LOCK();
va_start(ap, format);
- rc = log_helper(LOG_DEFAULT, LOG_LEVEL_VERBOSE, format, ap);
+ rc = log_helper(LOG_DEFAULT, LOG_LEVEL_DEBUG, format, ap);
va_end(ap);
UNLOCK_AND_RETURN_INT(rc);
}
+
Modified: trunk/vice/src/log.h
===================================================================
--- trunk/vice/src/log.h 2024-08-03 20:41:21 UTC (rev 45260)
+++ trunk/vice/src/log.h 2024-08-03 21:20:13 UTC (rev 45261)
@@ -97,11 +97,11 @@
int log_out(log_t log, unsigned int level, const char *format, ...) VICE_ATTR_PRINTF3;
+int log_verbose(log_t log, const char *format, ...) VICE_ATTR_PRINTF2;
int log_message(log_t log, const char *format, ...) VICE_ATTR_PRINTF2;
int log_warning(log_t log, const char *format, ...) VICE_ATTR_PRINTF2;
int log_error(log_t log, const char *format, ...) VICE_ATTR_PRINTF2;
int log_debug(const char *format, ...) VICE_ATTR_PRINTF;
-int log_verbose(const char *format, ...) VICE_ATTR_PRINTF;
#endif
Modified: trunk/vice/src/opencbmlib.c
===================================================================
--- trunk/vice/src/opencbmlib.c 2024-08-03 20:41:21 UTC (rev 45260)
+++ trunk/vice/src/opencbmlib.c 2024-08-03 21:20:13 UTC (rev 45261)
@@ -84,7 +84,7 @@
opencbm_so = vice_dynlib_open(ARCHDEP_OPENCBM_SO_NAME);
if (opencbm_so == NULL) {
- log_verbose("opening dynamic library " ARCHDEP_OPENCBM_SO_NAME " failed!");
+ log_verbose(LOG_DEFAULT, "opening dynamic library " ARCHDEP_OPENCBM_SO_NAME " failed!");
return -1;
}
@@ -102,7 +102,7 @@
GET_SYMBOL_AND_TEST(cbm_get_eoi);
GET_SYMBOL_AND_TEST(cbm_reset);
- log_verbose("sucessfully loaded " ARCHDEP_OPENCBM_SO_NAME);
+ log_verbose(LOG_DEFAULT, "sucessfully loaded " ARCHDEP_OPENCBM_SO_NAME);
}
return 0;
Modified: trunk/vice/src/resources.c
===================================================================
--- trunk/vice/src/resources.c 2024-08-03 20:41:21 UTC (rev 45260)
+++ trunk/vice/src/resources.c 2024-08-03 21:20:13 UTC (rev 45261)
@@ -977,7 +977,7 @@
case RES_INTEGER:
if ((*resources[i].set_func_int)(vice_ptr_to_int(resources[i].factory_value),
resources[i].param) < 0) {
- log_verbose("Cannot set int resource '%s' to default '%d'",
+ log_verbose(LOG_DEFAULT, "Cannot set int resource '%s' to default '%d'",
resources[i].name, vice_ptr_to_int(resources[i].factory_value));
/*return -1;*/
}
@@ -985,7 +985,7 @@
case RES_STRING:
if ((*resources[i].set_func_string)((const char *)(resources[i].factory_value),
resources[i].param) < 0) {
- log_verbose("Cannot set string resource '%s' to default '%s'",
+ log_verbose(LOG_DEFAULT, "Cannot set string resource '%s' to default '%s'",
resources[i].name, (const char *)(resources[i].factory_value));
/*return -1;*/
}
Modified: trunk/vice/src/traps.c
===================================================================
--- trunk/vice/src/traps.c 2024-08-03 20:41:21 UTC (rev 45260)
+++ trunk/vice/src/traps.c 2024-08-03 21:20:13 UTC (rev 45261)
@@ -302,7 +302,7 @@
}
}
- log_verbose("Trap '%s' installed.", t->name);
+ log_verbose(LOG_DEFAULT, "Trap '%s' installed.", t->name);
(t->storefunc)(t->address, TRAP_OPCODE);
return 0;
@@ -318,10 +318,10 @@
traplist = p;
if (traps_enabled) {
- log_verbose("Trap '%s' added.", trap->name);
+ log_verbose(LOG_DEFAULT, "Trap '%s' added.", trap->name);
install_trap(trap);
} else {
- log_verbose("Traps are disabled, trap '%s' not installed.", trap->name);
+ log_verbose(LOG_DEFAULT, "Traps are disabled, trap '%s' not installed.", trap->name);
}
return 0;
@@ -334,7 +334,7 @@
trap->address, trap->name);
return -1;
}
- log_verbose("Trap '%s' disabled.", trap->name);
+ log_verbose(LOG_DEFAULT, "Trap '%s' disabled.", trap->name);
(trap->storefunc)(trap->address, trap->check[0]);
return 0;
Modified: trunk/vice/src/viciisc/vicii-chip-model.c
===================================================================
--- trunk/vice/src/viciisc/vicii-chip-model.c 2024-08-03 20:41:21 UTC (rev 45260)
+++ trunk/vice/src/viciisc/vicii-chip-model.c 2024-08-03 21:20:13 UTC (rev 45261)
@@ -596,8 +596,8 @@
"Initializing chip model \"%s\" (%d cycles per line, %d raster lines).",
cm->name, cm->cycles_per_line, cm->num_raster_lines);
- log_verbose("VIC-II: BA");
- log_verbose("VIC-II: cycle xpos vi M76543210 fetch border gfx sprite");
+ log_verbose(LOG_DEFAULT, "VIC-II: BA");
+ log_verbose(LOG_DEFAULT, "VIC-II: cycle xpos vi M76543210 fetch border gfx sprite");
for (i = 0; i < (cm->cycles_per_line * 2); i++) {
int phi = (ct[i].cycle & 0x80) ? 1 : 0;
@@ -716,7 +716,7 @@
}
/* dump to log */
- log_verbose("VIC-II: %s $%03x %s %s %s %s %s %s",
+ log_verbose(LOG_DEFAULT, "VIC-II: %s $%03x %s %s %s %s %s %s",
cycle_str, (unsigned int)xpos, visible_str, ba_str,
fetch_str, border_str, gfx_str, sprite_str);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-08-03 20:41:23
|
Revision: 45260
http://sourceforge.net/p/vice-emu/code/45260
Author: gpz
Date: 2024-08-03 20:41:21 +0000 (Sat, 03 Aug 2024)
Log Message:
-----------
add archdep_default_logger_is_terminal(), used to disable colors when stdout is redirected
Modified Paths:
--------------
trunk/vice/src/arch/shared/archdep_default_logger.c
trunk/vice/src/arch/shared/archdep_default_logger.h
trunk/vice/src/c1541-stubs.c
trunk/vice/src/log.c
Modified: trunk/vice/src/arch/shared/archdep_default_logger.c
===================================================================
--- trunk/vice/src/arch/shared/archdep_default_logger.c 2024-08-03 20:16:11 UTC (rev 45259)
+++ trunk/vice/src/arch/shared/archdep_default_logger.c 2024-08-03 20:41:21 UTC (rev 45260)
@@ -36,6 +36,14 @@
# include <windows.h>
#endif
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef UNIX_COMPILE
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
+
#include "lib.h"
#include "util.h"
@@ -74,6 +82,11 @@
return 0;
}
+int archdep_default_logger_is_terminal(void)
+{
+ return 1; /* FIXME */
+}
+
#elif defined(UNIX_COMPILE) || defined(ARCHEP_OS_BEOS)
/** \brief Write log message to stdout
@@ -95,6 +108,18 @@
return 0;
}
+int archdep_default_logger_is_terminal(void)
+{
+ FILE *fp = stdout;
+ struct stat statinfo;
+
+ fstat(fileno(fp), &statinfo);
+ if (!S_ISFIFO(statinfo.st_mode) && !S_ISREG(statinfo.st_mode)) {
+ return 1;
+ }
+ return 0;
+}
+
#else
/** \brief Write log message to stdout
@@ -111,4 +136,9 @@
return 0;
}
+int archdep_default_logger_is_terminal(void)
+{
+ return 0; /* FIXME */
+}
+
#endif
Modified: trunk/vice/src/arch/shared/archdep_default_logger.h
===================================================================
--- trunk/vice/src/arch/shared/archdep_default_logger.h 2024-08-03 20:16:11 UTC (rev 45259)
+++ trunk/vice/src/arch/shared/archdep_default_logger.h 2024-08-03 20:41:21 UTC (rev 45260)
@@ -31,4 +31,6 @@
int archdep_default_logger(const char *level_string, const char *txt);
+int archdep_default_logger_is_terminal(void);
+
#endif
Modified: trunk/vice/src/c1541-stubs.c
===================================================================
--- trunk/vice/src/c1541-stubs.c 2024-08-03 20:16:11 UTC (rev 45259)
+++ trunk/vice/src/c1541-stubs.c 2024-08-03 20:41:21 UTC (rev 45260)
@@ -41,6 +41,7 @@
#include "machine-drive.h"
#include "main.h"
#include "mainlock.h"
+#include "monitor.h"
#include "network.h"
#include "serial.h"
#include "tape.h"
@@ -322,5 +323,6 @@
int mon_out(const char *format, ...)
{
+ return 0;
}
Modified: trunk/vice/src/log.c
===================================================================
--- trunk/vice/src/log.c 2024-08-03 20:16:11 UTC (rev 45259)
+++ trunk/vice/src/log.c 2024-08-03 20:41:21 UTC (rev 45260)
@@ -717,7 +717,7 @@
if (log_to_stdout) {
/* FIXME: we should force colors off here, if the standard logger goes
into a file (because stdout was redirected) */
- if (0) {
+ if (archdep_default_logger_is_terminal() == 0) {
terminalpre = nocolorpre;
terminaltxt = nocolortxt;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-08-03 20:16:14
|
Revision: 45259
http://sourceforge.net/p/vice-emu/code/45259
Author: gpz
Date: 2024-08-03 20:16:11 +0000 (Sat, 03 Aug 2024)
Log Message:
-----------
adjust docs
Modified Paths:
--------------
trunk/vice/doc/vice.texi
Modified: trunk/vice/doc/vice.texi
===================================================================
--- trunk/vice/doc/vice.texi 2024-08-03 20:15:00 UTC (rev 45258)
+++ trunk/vice/doc/vice.texi 2024-08-03 20:16:11 UTC (rev 45259)
@@ -1257,6 +1257,12 @@
Enable/disable logging to the monitor.
(@code{LogToMonitor=1}, @code{LogToMonitor=0}).
+@findex -logcolorize, +logcolorize
+@item -logcolorize
+@itemx +logcolorize
+Enable/disable colorizing the log output.
+(@code{LogColorize=1}, @code{LogColorize=0}).
+
@findex -verbose
@item -verbose
Enable verbose log output.
@@ -8739,11 +8745,6 @@
Integer, 1-255: Timeout to wait for URLs in seconds
(vic20, x64, x64sc, xscpu64 and x128 only).
-@vindex WIC64ColorizeLog
-@item WIC64ColorizeLog
-Integer, 1: WiC64 tracing using ANSI colorizing, 0: no colorizing
-(vic20, x64, x64sc, xscpu64 and x128 only).
-
@vindex WIC64LogLevel
@item WIC64LogLevel
Integer, WiC64 trace level, 0: no trace, 1: standard, 2: verbose,
@@ -8811,13 +8812,6 @@
Timeout to wait for URLs in seconds, 1 - 255
(vic20, x64, x64sc, xscpu64 and x128 only).
-@findex -wic64colorizetrace
-@item -wic64colorizetrace
-@itemx +wic64colorizetrace
-Enable/disable ANSI color codes for terminals to colorize the WiC64 log for
-better readability
-(vic20, x64, x64sc, xscpu64 and x128 only).
-
@end table
@c -----------------------------------------------------------------------------
@@ -17554,6 +17548,10 @@
@item LogToMonitor
Boolean that specifies whether the log should go to the monitor console.
+@vindex LogColorize
+@item LogColorize
+Boolean that specifies whether the log in the terminal should be colorized.
+
@vindex ExitScreenshotName
@item ExitScreenshotName
String specifying the filename of a screenshot file that will be written when the emulator exits.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-08-03 20:15:01
|
Revision: 45258
http://sourceforge.net/p/vice-emu/code/45258
Author: gpz
Date: 2024-08-03 20:15:00 +0000 (Sat, 03 Aug 2024)
Log Message:
-----------
colors are now handled completely transparently in the log system. also no more special cases for stdout needed. some more renaming and refactoring.
Modified Paths:
--------------
trunk/vice/src/arch/gtk3/widgets/settings_userport.c
trunk/vice/src/userport/userport_wic64.c
Modified: trunk/vice/src/arch/gtk3/widgets/settings_userport.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_userport.c 2024-08-03 20:11:04 UTC (rev 45257)
+++ trunk/vice/src/arch/gtk3/widgets/settings_userport.c 2024-08-03 20:15:00 UTC (rev 45258)
@@ -339,19 +339,9 @@
static GtkWidget *create_wic64_logenabled_widget(void)
{
return vice_gtk3_resource_check_button_new("WIC64Logenabled",
- "Enable WiC64 tracing");
+ "Enable WiC64 logging");
}
-/** \brief Create widget for the "WIC64ColorizeLog" resource
- *
- * \return GtkCheckButton
- */
-static GtkWidget *create_wic64_colorizedlog_widget(void)
-{
- return vice_gtk3_resource_check_button_new("WIC64ColorizeLog",
- "Enable WiC64 colorized tracing");
-}
-
/** \brief Create widget for the "WIC64Logenabled" resource
*
* \return GtkCheckButton
@@ -451,7 +441,6 @@
GtkWidget *server;
GtkWidget *tz_widget;
GtkWidget *tracing;
- GtkWidget *colorized;
GtkWidget *resetuser;
GtkWidget *lines_widget;
GtkWidget *trace_level;
@@ -470,33 +459,9 @@
label = label_helper("<b>WiC64 settings</b>");
gtk_widget_set_margin_bottom(label, 8);
- gtk_grid_attach(GTK_GRID(grid), label, 0, row++, 2, 1);
-
- /* enable WiC64 tracing */
- tracing = create_wic64_logenabled_widget();
- gtk_grid_attach(GTK_GRID(grid), tracing, 0, row, 1, 1);
-
- label = gtk_label_new("Hexdump Lines\n(0: unlimited)");
- gtk_widget_set_margin_start(label, 4);
- gtk_widget_set_halign(label, GTK_ALIGN_START);
- lines_widget = vice_gtk3_resource_spin_int_new(
- "WIC64HexdumpLines", 0, 32768, 1);
- gtk_grid_attach(GTK_GRID(grid), lines_widget, 1, row, 1, 1);
- gtk_grid_attach(GTK_GRID(grid), label, 2, row, 1, 1);
+ gtk_grid_attach(GTK_GRID(grid), label, 0, row, 2, 1);
row++;
- colorized = create_wic64_colorizedlog_widget();
- gtk_grid_attach(GTK_GRID(grid), colorized, 0, row, 1, 1);
-
- label = gtk_label_new("Trace level\n(0: off)");
- gtk_widget_set_margin_start(label, 4);
- gtk_widget_set_halign(label, GTK_ALIGN_START);
- trace_level = vice_gtk3_resource_spin_int_new(
- "WIC64LogLevel", 0, WIC64_MAXTRACELEVEL, 1);
- gtk_grid_attach(GTK_GRID(grid), trace_level, 1, row, 1, 1);
- gtk_grid_attach(GTK_GRID(grid), label, 2, row, 1, 1);
- row++;
-
label = gtk_label_new("Remote Timeout\n(1 - 255)");
gtk_widget_set_margin_start(label, 4);
gtk_widget_set_halign(label, GTK_ALIGN_START);
@@ -567,6 +532,28 @@
gtk_grid_attach(GTK_GRID(grid), resetuser, 1, row, 1, 1);
row++;
+ /* enable WiC64 tracing */
+ tracing = create_wic64_logenabled_widget();
+ gtk_grid_attach(GTK_GRID(grid), tracing, 0, row, 1, 1);
+
+ label = gtk_label_new("Hexdump Lines\n(0: unlimited)");
+ gtk_widget_set_margin_start(label, 4);
+ gtk_widget_set_halign(label, GTK_ALIGN_START);
+ lines_widget = vice_gtk3_resource_spin_int_new(
+ "WIC64HexdumpLines", 0, 32768, 1);
+ gtk_grid_attach(GTK_GRID(grid), lines_widget, 1, row, 1, 1);
+ gtk_grid_attach(GTK_GRID(grid), label, 2, row, 1, 1);
+ row++;
+
+ label = gtk_label_new("Log level\n(0: off)");
+ gtk_widget_set_margin_start(label, 4);
+ gtk_widget_set_halign(label, GTK_ALIGN_START);
+ trace_level = vice_gtk3_resource_spin_int_new(
+ "WIC64LogLevel", 0, WIC64_MAXTRACELEVEL, 1);
+ gtk_grid_attach(GTK_GRID(grid), trace_level, 1, row, 1, 1);
+ gtk_grid_attach(GTK_GRID(grid), label, 2, row, 1, 1);
+ row++;
+
wic64_save = grid;
gtk_grid_attach(GTK_GRID(parent_grid), grid, 0, parent_row, 2, 1);
return parent_row + 1;
Modified: trunk/vice/src/userport/userport_wic64.c
===================================================================
--- trunk/vice/src/userport/userport_wic64.c 2024-08-03 20:11:04 UTC (rev 45257)
+++ trunk/vice/src/userport/userport_wic64.c 2024-08-03 20:15:00 UTC (rev 45258)
@@ -46,9 +46,9 @@
(1) tape #1 read
(2) also connected to tape "sense" (PLAY, F.FWD or REW pressed)
- enable the device and start https://www.wic64.de/wp-content/uploads/2021/10/wic64start.zip
+ enable the device and start https://wic64.net/web/__downloads/wic-launcher25.prg
- for more info see https://www.wic64.de
+ for more info see https://wic64.net/web/
*/
#include "vice.h"
@@ -108,11 +108,11 @@
static int wic64_set_loglevel(int val, void *param);
static int wic64_set_resetuser(int val, void *param);
static int wic64_set_hexdumplines(int val, void *param);
-static int wic64_set_colorize_log(int val, void *param);
+
static int wic64_set_remote_timeout(int val, void *param);
static int wic64_cmdl_reset(const char *val, void *param);
static void wic64_log(const char *col, const char *fmt, ...);
-static void _wic64_log(const char *col, const int lv, const char *fmt, ...);
+static void debug_log(const char *col, const int lv, const char *fmt, ...);
static void handshake_flag2(void);
static void send_binary_reply(const uint8_t *reply, size_t len);
static void send_reply_revised(const uint8_t rcode, const char *msg, const uint8_t *payload, size_t len, const char *legacy_msg);
@@ -179,7 +179,7 @@
static int wic64_loglevel = 0;
static int wic64_resetuser = 0;
static int wic64_hexdumplines = 0;
-static int wic64_colorize_log = 0;
+
static char wic64_protocol = 'U'; /* invalid, so we see in trace even the legacy */
static int big_load = 0;
static char wic64_last_status[40]; /* according spec 40 bytes, hold status string. incl. \0 */
@@ -191,6 +191,114 @@
static int post_error;
static int cheatlen = 0;
+/* ---------------------------------------------------------------------*/
+#define CONS_COL_NO ""
+
+/** \brief log message to console
+ *
+ * \param[in] typical printf format string
+ */
+static void wic64_log(const char *col, const char *fmt, ...)
+{
+ char t[256];
+ va_list args;
+
+ if (!wic64_logenabled) {
+ return;
+ }
+
+ va_start(args, fmt);
+ vsnprintf(t, 256, fmt, args);
+ log_message(wic64_loghandle, "%s%s" LOG_COL_OFF, col, t);
+}
+
+/** \brief debug log message to console
+ *
+ * \param[in] typical printf format string
+ */
+static void debug_log(const char *col, const int lv, const char *fmt, ...)
+{
+ char t[256];
+ va_list args;
+
+ if (wic64_loglevel < lv) {
+ return;
+ }
+ va_start(args, fmt);
+ vsnprintf(t, 256, fmt, args);
+ wic64_log(col, "%s", t);
+}
+
+/** \brief formatted hexdump, lines limited by value of "WIC64HexdumpLines"
+ *
+ * \param[in] buf, len
+ */
+static void wic64_log_hexdump(const char *col, const char *buf, int len)
+{
+ int i;
+ int idx = 0;
+ int lines = 0;
+ char linestr[256];
+
+ while (len > 0) {
+ if (big_load) {
+ snprintf(linestr, 256, "%08x: ", (unsigned) idx);
+ } else {
+ snprintf(linestr, 256, "%04x: ", (unsigned) idx);
+ }
+
+ if (wic64_hexdumplines && lines++ >= wic64_hexdumplines) {
+ strcat(linestr, "...");
+ wic64_log(col, "%s", linestr);
+ break;
+ }
+ for (i = 0; i < 16; i++) {
+ if (i < len) {
+ char t[4];
+ snprintf(t, 4, "%02x ", (uint8_t) buf[idx + i]);
+ strcat(linestr, t);
+ } else {
+ strcat(linestr, " ");
+ }
+ }
+ strcat(linestr, "|");
+ for (i = 0; i < 16; i++) {
+ if (i < len) {
+ char t[2];
+ char c;
+ if (((unsigned char)buf[idx + i] > 31) && /* avoid tabs and other printable ctrl chars) */
+ isprint((unsigned char)buf[idx + i])) {
+ c= buf[idx + i];
+ } else {
+ c = '.';
+ }
+ snprintf(t, 2, "%c", c);
+ strcat(linestr, t);
+ } else {
+ strcat(linestr, " ");
+ }
+ }
+ strcat(linestr, "|");
+ wic64_log(col, "%s", linestr);
+ idx += 16;
+ len -= 16;
+ }
+}
+
+/** \brief formatted hexdump, lines limited by value of "WIC64HexdumpLines" for debug level
+ *
+ * \param[in] lv, buf, len
+ */
+static void debug_hexdump(const char *col, const int lv, const char *buf, int len)
+{
+ if (wic64_loglevel < lv) {
+ return;
+ }
+ wic64_log_hexdump(col, buf, len);
+}
+
+/* ---------------------------------------------------------------------*/
+
static const resource_string_t wic64_resources[] =
{
{ "WIC64DefaultServer", "http://x.wic64.net/", (resource_event_relevant_t)0, NULL,
@@ -215,8 +323,6 @@
&wic64_resetuser, wic64_set_resetuser, NULL },
{ "WIC64HexdumpLines", 8, RES_EVENT_NO, NULL,
&wic64_hexdumplines, wic64_set_hexdumplines, NULL },
- { "WIC64ColorizeLog", 0, RES_EVENT_NO, NULL,
- &wic64_colorize_log, wic64_set_colorize_log, NULL },
{ "WIC64RemoteTimeout", WIC64_DEFAULT_REMOTE_TIMEOUT, RES_EVENT_NO, NULL,
&wic64_remote_timeout, wic64_set_remote_timeout, NULL },
RESOURCE_INT_LIST_END
@@ -280,12 +386,6 @@
{ "-wic64hexdumplines", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
NULL, NULL, "WIC64HexdumpLines", NULL,
"<value>", "Limit WiC64 hexdump lines (0: unlimited)" },
- { "-wic64colorizetrace", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
- NULL, NULL, "WIC64colorizelog", (void *)1,
- NULL, "Enable WiC64 colorized trace on terminal" },
- { "+wic64colorizetrace", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
- NULL, NULL, "WIC64colorizelog", (void *)0,
- NULL, "Disable WiC64 colorized trace on terminal" },
{ "-wic64remotetimeout", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
NULL, NULL, "WIC64RemoteTimeout", NULL,
"<value>", "Set WIC64 remote timeout (1 - 255)" },
@@ -370,12 +470,6 @@
#define INPUT_EXP_HH 5
#define INPUT_EXP_ARGS 6
-#define CONS_COL_NO ""
-#define CONS_COL_RED "\x1B[91;40m"
-#define CONS_COL_GREEN "\x1B[92;40m"
-#define CONS_COL_BLUE "\x1B[96;40m"
-#define CONS_COL_OFF "\033[0m\t\t"
-
static const char *cmd2string[256];
/* WiC64 return codes */
static uint8_t SUCCESS = 0;
@@ -426,19 +520,19 @@
userport_wic64_enabled = val;
if (val) {
httpbuffer = lib_malloc(HTTPREPLY_MAXLEN);
- _wic64_log(CONS_COL_NO, 2, "%s: httpreplybuffer allocated 0x%xkB", __FUNCTION__,
+ debug_log(CONS_COL_NO, 2, "%s: httpreplybuffer allocated 0x%xkB", __FUNCTION__,
HTTPREPLY_MAXLEN / 1024);
replybuffer = lib_malloc(HTTPREPLY_MAXLEN + 16);
- _wic64_log(CONS_COL_NO, 2, "%s: replybuffer allocated 0x%xkB", __FUNCTION__,
+ debug_log(CONS_COL_NO, 2, "%s: replybuffer allocated 0x%xkB", __FUNCTION__,
(HTTPREPLY_MAXLEN / 1024) + 16);
encoded_helper = lib_malloc(COMMANDBUFFER_MAXLEN);
- _wic64_log(CONS_COL_NO, 2, "%s: encoded_helper allocated 0x%xkB", __FUNCTION__,
+ debug_log(CONS_COL_NO, 2, "%s: encoded_helper allocated 0x%xkB", __FUNCTION__,
COMMANDBUFFER_MAXLEN / 1024);
curl_send_buf = lib_malloc(COMMANDBUFFER_MAXLEN);
- _wic64_log(CONS_COL_NO, 2, "%s: curl_send_buf allocated 0x%xkB", __FUNCTION__,
+ debug_log(CONS_COL_NO, 2, "%s: curl_send_buf allocated 0x%xkB", __FUNCTION__,
COMMANDBUFFER_MAXLEN / 1014);
wic64_set_status("enabled");
@@ -505,7 +599,7 @@
alarm_destroy(cmd_remote_timeout_alarm);
cmd_remote_timeout_alarm = NULL;
}
- _wic64_log(CONS_COL_NO, 2, "%s: several WiC64 dynamic buffers freed",
+ debug_log(CONS_COL_NO, 2, "%s: several WiC64 dynamic buffers freed",
__FUNCTION__);
wic64_set_status("disabled");
@@ -588,20 +682,16 @@
return 0;
}
-static int wic64_set_colorize_log(int val, void *param)
-{
- wic64_colorize_log = val;
- return 0;
-}
-
static int wic64_set_remote_timeout(int val, void *param)
{
wic64_remote_timeout = val;
/* overrule in case of wrong range */
- if (val < 1)
+ if (val < 1) {
wic64_remote_timeout = 1;
- if (val > 255)
+ }
+ if (val > 255) {
wic64_remote_timeout = 255;
+ }
return 0;
}
@@ -698,106 +788,6 @@
wic64_last_status[sizeof wic64_last_status - 1u] = '\0';
}
-/** \brief log message to console
- *
- * \param[in] typical printf format string
- */
-static void wic64_log(const char *col, const char *fmt, ...)
-{
- char t[256];
- va_list args;
- const char *col_before = "";
- const char *col_after = "";
- const char *lf;
-
- if (!wic64_logenabled) {
- return;
- }
- if (resources_get_string("LogFileName", &lf) != -1) {
- if ((col && wic64_colorize_log) &&
- ((*lf == '\0') || (strncmp(lf, "-", 1) == 0))) {
- col_before = col;
- col_after = CONS_COL_OFF;
- }
- }
- va_start(args, fmt);
- vsnprintf(t, 256, fmt, args);
- log_message(wic64_loghandle, "%s%s%s", col_before, t, col_after);
-}
-
-/** \brief debug log message to console
- *
- * \param[in] typical printf format string
- */
-static void _wic64_log(const char *col, const int lv, const char *fmt, ...)
-{
- char t[256];
- va_list args;
-
- if (wic64_loglevel < lv) {
- return;
- }
- va_start(args, fmt);
- vsnprintf(t, 256, fmt, args);
- wic64_log(col, "%s", t);
-}
-
-/** \brief formatted hexdump, lines limited by value of "WIC64HexdumpLines"
- *
- * \param[in] buf, len
- */
-static void hexdump(const char *col, const char *buf, int len)
-{
- int i;
- int idx = 0;
- int lines = 0;
- char linestr[256];
-
- while (len > 0) {
- if (big_load) {
- snprintf(linestr, 256, "%08x: ", (unsigned) idx);
- } else {
- snprintf(linestr, 256, "%04x: ", (unsigned) idx);
- }
-
- if (wic64_hexdumplines && lines++ >= wic64_hexdumplines) {
- strcat(linestr, "...");
- wic64_log(col, "%s", linestr);
- break;
- }
- for (i = 0; i < 16; i++) {
- if (i < len) {
- char t[4];
- snprintf(t, 4, "%02x ", (uint8_t) buf[idx + i]);
- strcat(linestr, t);
- } else {
- strcat(linestr, " ");
- }
- }
- strcat(linestr, "|");
- for (i = 0; i < 16; i++) {
- if (i < len) {
- char t[2];
- char c;
- if (((unsigned char)buf[idx + i] > 31) && /* avoid tabs and other printable ctrl chars) */
- isprint((unsigned char)buf[idx + i])) {
- c= buf[idx + i];
- } else {
- c = '.';
- }
- snprintf(t, 2, "%c", c);
- strcat(linestr, t);
- } else {
- strcat(linestr, " ");
- }
- }
- strcat(linestr, "|");
- wic64_log(col, "%s", linestr);
- idx += 16;
- len -= 16;
- }
-}
-
static void prep_wic64_str(void)
{
cmd2string[WIC64_CMD_GET_VERSION_STRING] = "WIC64_CMD_GET_VERSION_STRING";
@@ -865,18 +855,6 @@
cmd2string[WIC64_CMD_DEPRECATED_LEGACY_HTTP_POST_24] = "WIC64_CMD_DEPRECATED_LEGACY_HTTP_POST_24";
}
-/** \brief formatted hexdump, lines limited by value of "WIC64HexdumpLines" for debug level
- *
- * \param[in] lv, buf, len
- */
-static void _hexdump(const char *col, const int lv, const char *buf, int len)
-{
- if (wic64_loglevel < lv) {
- return;
- }
- hexdump(col, buf, len);
-}
-
static size_t write_cb(char *data, size_t n, size_t l, void *userp)
{
size_t tmp = httpbufferptr + n * l;
@@ -920,7 +898,7 @@
{
/* manage preferences in memory only for now */
wic64_log(CONS_COL_NO, "%s: requested", __FUNCTION__);
- hexdump(CONS_COL_NO, (char *)buffer, (int)len);
+ wic64_log_hexdump(CONS_COL_NO, (char *)buffer, (int)len);
char *t;
char *p;
char *pref = NULL;
@@ -975,10 +953,10 @@
wic64_log(CONS_COL_NO, "%s: curl_multi_perform failed: %s", __FUNCTION__, curl_multi_strerror(r));
msg = curl_multi_info_read(cm, &msgs_left);
if (msg) {
- _wic64_log(CONS_COL_RED, 2, "%s: msg: %u, %s", __FUNCTION__,
+ debug_log(LOG_COL_LRED, 2, "%s: msg: %u, %s", __FUNCTION__,
msg->data.result, curl_easy_strerror(msg->data.result));
curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, &url);
- _wic64_log(CONS_COL_RED, 2, "%s, R: %u - %s <%s>", __FUNCTION__,
+ debug_log(LOG_COL_LRED, 2, "%s, R: %u - %s <%s>", __FUNCTION__,
msg->data.result, curl_easy_strerror(msg->data.result), url);
}
send_reply_revised(NETWORK_ERROR, "Failed to read HTTP response", NULL, 0, "!0"); /* maybe wrong here */
@@ -986,7 +964,7 @@
}
if (wic64_remote_timeout_triggered) {
- _wic64_log(CONS_COL_RED, 2, "Remote timout expired");
+ debug_log(LOG_COL_LRED, 2, "Remote timout expired");
send_reply_revised(NETWORK_ERROR, "Remote timeout", NULL, 0, "!0");
wic64_remote_timeout_triggered = 0;
remote_to = wic64_remote_timeout;
@@ -1009,7 +987,7 @@
CURLINFO_RESPONSE_CODE,
&response);
if (res != CURLE_OK) {
- wic64_log(CONS_COL_RED, "%s: curl_easy_getinfo(...&response failed: %s", __FUNCTION__,
+ wic64_log(LOG_COL_LRED, "%s: curl_easy_getinfo(...&response failed: %s", __FUNCTION__,
curl_easy_strerror(res));
send_reply_revised(NETWORK_ERROR, "Failed to read HTTP response", NULL, 0, "!0");
goto out;
@@ -1017,7 +995,7 @@
res = curl_easy_getinfo(msg->easy_handle, CURLINFO_EFFECTIVE_URL, &url);
if (res != CURLE_OK) {
/* ignore problem, URL is only for debugging */
- wic64_log(CONS_COL_RED, "%s: curl_easy_getinfo(...&URL failed: %s", __FUNCTION__,
+ wic64_log(LOG_COL_LRED, "%s: curl_easy_getinfo(...&URL failed: %s", __FUNCTION__,
curl_easy_strerror(res));
url = "<unknown>";
}
@@ -1038,7 +1016,7 @@
t = strrchr(url, '.');
if ((t != NULL) && (strcmp(t, ".prg") == 0)){
cheatlen = -2;
- wic64_log(CONS_COL_GREEN, "prg URL -> reducing reported len by 2");
+ wic64_log(LOG_COL_LGREEN, "prg URL -> reducing reported len by 2");
}
}
send_reply_revised(SUCCESS, "Success", httpbuffer, httpbufferptr, NULL); /* raw send, supporting big_load */
@@ -1045,7 +1023,7 @@
cheatlen = 0;
} else if (response >= 301) {
char t[32];
- wic64_log(CONS_COL_RED, "URL '%s' returned %lu bytes (http code: %ld)", url, httpbufferptr, response);
+ wic64_log(LOG_COL_LRED, "URL '%s' returned %lu bytes (http code: %ld)", url, httpbufferptr, response);
snprintf(t, 31, "http response: %ld", response);
send_reply_revised(SERVER_ERROR, t, NULL, 0, "!0"); /* raw send supporting big_load */
} else {
@@ -1052,7 +1030,7 @@
/* firmeare handles codes: 301, 302, 307, 308 - check if needed with libcurl */
char m[64];
snprintf(m, 64, "Unhandled http response %ld, received %"PRI_SIZE_T" bytes", response, httpbufferptr);
- wic64_log(CONS_COL_RED, m);
+ wic64_log(LOG_COL_LRED, m);
if (httpbufferptr > 0) {
send_reply_revised(SUCCESS, "Success", httpbuffer,
(httpbufferptr > 0xffff) ? 0xffff : httpbufferptr,
@@ -1136,7 +1114,7 @@
{
if (replyptr < reply_length) {
reply_port_value = replybuffer[replyptr];
- /* _wic64_log(CONS_COL_NO, 2, "reply_next_byte: %3u/%3u - %02x'%c'", replyptr, reply_length, reply_port_value, isprint((unsigned char)reply_port_value)?reply_port_value:'.')); */
+ /* debug_log(CONS_COL_NO, 2, "reply_next_byte: %3u/%3u - %02x'%c'", replyptr, reply_length, reply_port_value, isprint((unsigned char)reply_port_value)?reply_port_value:'.')); */
replyptr++;
if (replyptr == reply_length) {
replyptr = reply_length = 0;
@@ -1168,10 +1146,10 @@
reply_length = (uint32_t)(len + offs);
replyptr = 0;
if (len > 0) {
- wic64_log(CONS_COL_GREEN, "sends %d/0x%x bytes...", len, len);
- hexdump(CONS_COL_GREEN, replybuffer, reply_length);
+ wic64_log(LOG_COL_LGREEN, "sends %d/0x%x bytes...", len, len);
+ wic64_log_hexdump(LOG_COL_LGREEN, replybuffer, reply_length);
} else {
- wic64_log(CONS_COL_GREEN, "handshake flag2");
+ wic64_log(LOG_COL_LGREEN, "handshake flag2");
}
handshake_flag2();
}
@@ -1178,7 +1156,7 @@
static void cmd_timeout_alarm_handler(CLOCK offset, void *data)
{
- wic64_log(CONS_COL_RED, "timed out - '%s' command", cmd2string[input_command]);
+ wic64_log(LOG_COL_LRED, "timed out - '%s' command", cmd2string[input_command]);
replyptr = reply_length = force_timeout = 0;
input_state = INPUT_EXP_PROT;
commandptr = 0;
@@ -1202,7 +1180,7 @@
static void cmd_remote_timeout_alarm_handler(CLOCK offset, void *data)
{
- wic64_log(CONS_COL_RED, "remote time out - '%s' command", cmd2string[input_command]);
+ wic64_log(LOG_COL_LRED, "remote time out - '%s' command", cmd2string[input_command]);
wic64_remote_timeout_triggered = 1;
alarm_unset(cmd_remote_timeout_alarm);
}
@@ -1215,7 +1193,7 @@
}
alarm_unset(cmd_remote_timeout_alarm);
if (arm) {
- _wic64_log(CONS_COL_NO, 2, "arming remote timeout with %ds", wic64_remote_timeout);
+ debug_log(CONS_COL_NO, 2, "arming remote timeout with %ds", wic64_remote_timeout);
wic64_remote_timeout_triggered = 0;
alarm_set(cmd_remote_timeout_alarm, maincpu_clk + remote_to * machine_get_cycles_per_second());
}
@@ -1231,9 +1209,9 @@
const char *col;
if (rcode == SUCCESS) {
- col = CONS_COL_GREEN;
+ col = LOG_COL_LGREEN;
} else {
- col = CONS_COL_RED;
+ col = LOG_COL_LRED;
}
wic64_log(col, "replies %s", msg);
replybuffer[0] = rcode;
@@ -1245,11 +1223,11 @@
replybuffer[4] = (len >> 24) & 0xff;
}
memcpy((char *) &replybuffer[3 + offs], (const char *)payload, len);
- _wic64_log(col, 2, "sends header...");
- _hexdump(col, 2, replybuffer, 3 + offs);
+ debug_log(col, 2, "sends header...");
+ debug_hexdump(col, 2, replybuffer, 3 + offs);
if (len > 0) {
wic64_log(col, "sends payload %d/0x%x bytes...", len, len);
- hexdump(col, &replybuffer[3 + offs], (int)len);
+ wic64_log_hexdump(col, &replybuffer[3 + offs], (int)len);
}
reply_length = (uint32_t)(len + 3 + offs);
@@ -1258,7 +1236,7 @@
} else {
/* legacy protocol */
if (legacy_msg && payload) {
- wic64_log(CONS_COL_RED,
+ wic64_log(LOG_COL_LRED,
"protocol error: can't send both payload and legacy message: '%s' discarded.",
legacy_msg);
return;
@@ -1318,7 +1296,7 @@
int len;
int l;
- hexdump(CONS_COL_BLUE, (const char *)commandbuffer, commandptr);
+ wic64_log_hexdump(LOG_COL_LBLUE, (const char *)commandbuffer, commandptr);
/* if encode is enabled, there might be binary data after <$, which is
then encoded as a stream of hex digits */
@@ -1331,7 +1309,7 @@
(cptr < endmarker)) {
l = (int)(p - cptr);
len += l;
- _wic64_log(CONS_COL_NO, 2, "%s: escape sequence found, offset %d", __FUNCTION__, len);
+ debug_log(CONS_COL_NO, 2, "%s: escape sequence found, offset %d", __FUNCTION__, len);
/* copy string before <$ */
memcpy(tptr, cptr, (size_t)l);
tptr += l;
@@ -1338,9 +1316,9 @@
l = (unsigned char) p[2];
l += (((unsigned char) p[3]) << 8);
p += 4; /* skip escape sequence and len */
- _wic64_log(CONS_COL_NO, 2, "%s: length to encode = %d", __FUNCTION__, l);
+ debug_log(CONS_COL_NO, 2, "%s: length to encode = %d", __FUNCTION__, l);
l = _encode(&p, l);
- _wic64_log(CONS_COL_NO, 2, "%s: encoded length = %d", __FUNCTION__, l);
+ debug_log(CONS_COL_NO, 2, "%s: encoded length = %d", __FUNCTION__, l);
memcpy(tptr, encoded_helper, l);
len += l;
cptr = p;
@@ -1364,7 +1342,7 @@
int i;
char *cur = final_url;
- hexdump(CONS_COL_BLUE, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
+ wic64_log_hexdump(LOG_COL_LBLUE, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
if (commandptr == 0) {
send_reply_revised(CLIENT_ERROR, "URL not specified", NULL, 0, "!E");
@@ -1386,7 +1364,7 @@
/* sanity check if URL is OK in principle */
for (i = 0; i < commandptr; i++) {
if (!isprint(commandbuffer[i])) {
- wic64_log(CONS_COL_RED, "bad char '0x%02x' detected in URL at offet %d, %s",
+ wic64_log(LOG_COL_LRED, "bad char '0x%02x' detected in URL at offet %d, %s",
commandbuffer[i], i, commandbuffer);
send_reply_revised(CLIENT_ERROR, "Malformed URL", NULL, 0, "!0");
return -1;
@@ -1420,7 +1398,7 @@
cur += 8;
p += 8;
} else {
- wic64_log(CONS_COL_RED, "malformed URL: %s", commandbuffer);
+ wic64_log(LOG_COL_LRED, "malformed URL: %s", commandbuffer);
send_reply_revised(CLIENT_ERROR, "Malformed URL", NULL, 0, "!0");
return -1;
}
@@ -1472,7 +1450,7 @@
strcat(temppath, p + 4);
/* copy back to path buffer */
strcpy(cur, temppath);
- _wic64_log(CONS_COL_NO, 2, "temppath:%s", temppath);
+ debug_log(CONS_COL_NO, 2, "temppath:%s", temppath);
}
/* now strip trailing whitespaces of path */
p = cur + strlen(cur) - 1;
@@ -1486,7 +1464,7 @@
*p = '\0';
p--;
}
- _wic64_log(CONS_COL_NO, 2, "%s: URL = '%s'", __FUNCTION__, final_url);
+ debug_log(CONS_COL_NO, 2, "%s: URL = '%s'", __FUNCTION__, final_url);
if (strlen(final_url) > URL_MAXLEN) {
send_reply_revised(CLIENT_ERROR, "URL too long (max 2000 bytes)", NULL, 0, "!E");
@@ -1508,7 +1486,7 @@
static void http_post_endalarm_handler(CLOCK offset, void *data)
{
- _wic64_log(CONS_COL_NO, 2, "http post endalarm triggered...");
+ debug_log(CONS_COL_NO, 2, "http post endalarm triggered...");
send_reply_revised(SUCCESS, "Success", (uint8_t *)post_data, post_data_rcvd, NULL);
alarm_unset(http_post_endalarm);
alarm_unset(http_post_alarm);
@@ -1515,12 +1493,12 @@
lib_free(post_data);
post_data = NULL;
post_error = post_data_rcvd = post_data_new = 0;
- _wic64_log(CONS_COL_NO, 2, "http post done");
+ debug_log(CONS_COL_NO, 2, "http post done");
}
static void http_post_alarm_handler(CLOCK offset, void *data)
{
- _wic64_log(CONS_COL_NO, 2, "%s: post_data_rcvd = %d, expected = %d",
+ debug_log(CONS_COL_NO, 2, "%s: post_data_rcvd = %d, expected = %d",
__FUNCTION__, post_data_rcvd, post_data_size);
if (post_error) {
@@ -1557,7 +1535,7 @@
lib_free(post_data);
post_data = NULL;
post_error = post_data_new = post_data_rcvd = 0;
- _wic64_log(CONS_COL_NO, 2, "http post done");
+ debug_log(CONS_COL_NO, 2, "http post done");
}
static size_t post_write_func(char *buffer, size_t size, size_t nitems, void *userdata)
@@ -1568,9 +1546,9 @@
ret = size * nitems;
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &cl);
- _wic64_log(CONS_COL_NO, 2, "http_post returned %d/0x%x bytes, expected len = %d...", ret, ret, cl);
+ debug_log(CONS_COL_NO, 2, "http_post returned %d/0x%x bytes, expected len = %d...", ret, ret, cl);
if (res != CURLE_OK) {
- _wic64_log(CONS_COL_NO, 2, "post callback failed to read length");
+ debug_log(CONS_COL_NO, 2, "post callback failed to read length");
post_error = 1;
goto out;
}
@@ -1580,7 +1558,7 @@
}
memcpy(post_data + post_data_rcvd, buffer, ret);
post_data_rcvd += ret;
- _hexdump(CONS_COL_NO, 2, buffer, (int)ret);
+ debug_hexdump(CONS_COL_NO, 2, buffer, (int)ret);
out:
post_data_size = (size_t) cl; /* if -1 => largest size_t, so unknown */
return ret;
@@ -1601,7 +1579,7 @@
}
send_reply_revised(SUCCESS, "Success", NULL, 0, NULL);
} else {
- hexdump(CONS_COL_BLUE, (const char *)commandbuffer, commandptr);
+ wic64_log_hexdump(LOG_COL_LBLUE, (const char *)commandbuffer, commandptr);
if (post_url == NULL) {
send_reply_revised(CLIENT_ERROR, "URL not specified", NULL, 0, "!0");
@@ -1665,7 +1643,7 @@
/* set wlan ssid + password */
static void cmd_wifi(int cmd)
{
- hexdump(CONS_COL_NO, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
+ wic64_log_hexdump(CONS_COL_NO, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
int l = (wic64_protocol == WIC64_PROT_LEGACY) ? 0 : 1; /* kludge to make it compatible */
@@ -1742,7 +1720,7 @@
/* set timezone */
static void cmd_set_timezone(void)
{
- hexdump(CONS_COL_NO, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
+ wic64_log_hexdump(CONS_COL_NO, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
wic64_timezone[0] = commandbuffer[0];
wic64_timezone[1] = commandbuffer[1];
@@ -1763,7 +1741,7 @@
static void cmd_get_timezone(void)
{
char buf[16];
- hexdump(CONS_COL_NO, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
+ wic64_log_hexdump(CONS_COL_NO, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
snprintf(buf, 16, "%d",
timezones[current_tz].hour_offs * 3600 +
timezones[current_tz].min_offs * 60);
@@ -1803,7 +1781,7 @@
static void cmd_tcp_open(void)
{
char tmp[COMMANDBUFFER_MAXLEN];
- hexdump(CONS_COL_BLUE, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
+ wic64_log_hexdump(LOG_COL_LBLUE, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
if (commandptr == 0) {
send_reply_revised(CLIENT_ERROR, "No URL specified", NULL, 0, "!0");
@@ -1874,7 +1852,7 @@
big_load = 0;
send_reply_revised(SUCCESS, "Success", curl_buf, total_read, NULL);
} else {
- wic64_log(CONS_COL_RED, "%s: curl_easy_recv: %s", __FUNCTION__, curl_easy_strerror(res));
+ wic64_log(LOG_COL_LRED, "%s: curl_easy_recv: %s", __FUNCTION__, curl_easy_strerror(res));
send_reply_revised(NETWORK_ERROR, "TCP connection closed", NULL, 0, "!E");
}
total_read = 0;
@@ -1883,11 +1861,11 @@
static void cmd_tcp_read(void)
{
if (commandptr > 0) {
- hexdump(CONS_COL_BLUE, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
+ wic64_log_hexdump(LOG_COL_LBLUE, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
}
if (!curl) {
- wic64_log(CONS_COL_RED, "%s: connection lost", __FUNCTION__);
+ wic64_log(LOG_COL_LRED, "%s: connection lost", __FUNCTION__);
send_reply_revised(NETWORK_ERROR, "TCP connection closed", NULL, 0, "!E");
return;
}
@@ -1927,7 +1905,7 @@
wic64_log(CONS_COL_NO, "%s: tcp sent successfully", __FUNCTION__);
send_reply_revised(SUCCESS, "Success", NULL, 0, "0");
} else {
- wic64_log(CONS_COL_RED, "%s: curl_easy_send: %s", __FUNCTION__, curl_easy_strerror(res));
+ wic64_log(LOG_COL_LRED, "%s: curl_easy_send: %s", __FUNCTION__, curl_easy_strerror(res));
send_reply_revised(NETWORK_ERROR, "Failed to write TCP data", NULL, 0, "!E");
}
}
@@ -1934,10 +1912,10 @@
static void cmd_tcp_write(void)
{
- hexdump(CONS_COL_NO, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
+ wic64_log_hexdump(CONS_COL_NO, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
if (!curl) {
- wic64_log(CONS_COL_RED, "%s: connection lost", __FUNCTION__);
+ wic64_log(LOG_COL_LRED, "%s: connection lost", __FUNCTION__);
send_reply_revised(CONNECTION_ERROR, "Can't execute TCP command", NULL, 0, "!0");
return;
}
@@ -1974,7 +1952,7 @@
bool upcase = false;
if (commandptr > 0) {
- hexdump(CONS_COL_BLUE, (const char *)commandbuffer, commandptr);
+ wic64_log_hexdump(LOG_COL_LBLUE, (const char *)commandbuffer, commandptr);
upcase = (commandbuffer[0] > 0);
}
@@ -2024,16 +2002,16 @@
break;
case WIC64_CMD_DEPRECATED_GET_UPD_0A:
case WIC64_CMD_DEPRECATED_GET_UPD_DUPLICATE_1E:
- wic64_log(CONS_COL_RED, "get udp/tcp package, not implemented");
+ wic64_log(LOG_COL_LRED, "get udp/tcp package, not implemented");
send_reply_revised(INTERNAL_ERROR, "LEGACY", NULL, 0, "");
break;
case WIC64_CMD_DEPRECATED_SEND_UPD_0B:
case WIC64_CMD_DEPRECATED_SEND_UPD_DUPLICATE_1F:
- wic64_log(CONS_COL_RED, "send udp/tcp package, not implemented");
+ wic64_log(LOG_COL_LRED, "send udp/tcp package, not implemented");
send_reply_revised(INTERNAL_ERROR, "LEGACY", NULL, 0, NULL);
break;
case WIC64_CMD_DEPRECATED_SET_UPD_PORT_0E:
- hexdump(CONS_COL_NO, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
+ wic64_log_hexdump(CONS_COL_NO, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
wic64_udp_port = commandbuffer[0];
wic64_udp_port += commandbuffer[1] << 8;
wic64_log(CONS_COL_NO, "set udp port to %d", wic64_udp_port);
@@ -2055,18 +2033,18 @@
case WIC64_CMD_DEPRECATED_GET_PREFERENCES_19:
{
char buffer[256];
- hexdump(CONS_COL_NO, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
+ wic64_log_hexdump(CONS_COL_NO, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
snprintf(buffer, 255, "%s", "vice");
- wic64_log(CONS_COL_RED, "read prefs not implemented, returning '%s'", buffer);
+ wic64_log(LOG_COL_LRED, "read prefs not implemented, returning '%s'", buffer);
send_reply_revised(INTERNAL_ERROR, "LEGACY", (uint8_t *) buffer, strlen(buffer), NULL);
break;
}
case WIC64_CMD_DEPRECATED_SET_PREFERENCES_1A:
- wic64_log(CONS_COL_RED, "write prefs not implemented");
+ wic64_log(LOG_COL_LRED, "write prefs not implemented");
send_reply_revised(INTERNAL_ERROR, "LEGACY", NULL, 0, "");
break;
case WIC64_CMD_DEPRECATED_SET_TCP_PORT_20:
- hexdump(CONS_COL_NO, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
+ wic64_log_hexdump(CONS_COL_NO, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
wic64_tcp_port = commandbuffer[0];
wic64_tcp_port += commandbuffer[1] << 8;
wic64_log(CONS_COL_NO, "set tcp port to %d", wic64_tcp_port);
@@ -2073,7 +2051,7 @@
send_reply_revised(SUCCESS, "LEGACY", NULL, 0, NULL);
break;
case WIC64_CMD_DEPRECATED_BIG_LOADER_25:
- hexdump(CONS_COL_NO, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
+ wic64_log_hexdump(CONS_COL_NO, (const char *)commandbuffer, commandptr); /* commands may contain '0' */
big_load = 1;
cmd_http_get();
break;
@@ -2083,7 +2061,7 @@
send_reply_revised(SUCCESS, "LEGACY", NULL, 0, NULL);
break;
case WIC64_CMD_DEPRECATED_LEGACY_HTTP_POST_24:
- wic64_log(CONS_COL_RED, "httppost - not implemented");
+ wic64_log(LOG_COL_LRED, "httppost - not implemented");
send_reply_revised(INTERNAL_ERROR, "LEGACY", NULL, 0, "!E");
break;
default:
@@ -2102,7 +2080,7 @@
case WIC64_CMD_HTTP_GET_ENCODED: /* send http with decoded url for PHP */
cmd_http_get_encoded();
/* show in log that we're entering http_get */
- wic64_log(CONS_COL_BLUE, "URL decoded, proceed with %s", cmd2string[WIC64_CMD_HTTP_GET]);
+ wic64_log(LOG_COL_LBLUE, "URL decoded, proceed with %s", cmd2string[WIC64_CMD_HTTP_GET]);
/* fall through */
case WIC64_CMD_HTTP_GET:
big_load = 0;
@@ -2171,6 +2149,8 @@
case WIC64_CMD_REBOOT:
userport_wic64_reset();
send_reply_revised(SUCCESS, "Success", NULL, 0, NULL);
+ /* FIXME: userport->sendHandshakeSignalBeforeReboot(); */
+ handshake_flag2();
break;
case WIC64_CMD_SET_TRANSFER_TIMEOUT:
case WIC64_CMD_SET_REMOTE_TIMEOUT:
@@ -2192,10 +2172,11 @@
send_reply_revised(SUCCESS, "Success", NULL, 0, NULL);
break;
case WIC64_CMD_IS_HARDWARE:
- send_reply_revised(INTERNAL_ERROR, "WiC64 is emulated", NULL, 0, NULL);
+ /* send_reply_revised(INTERNAL_ERROR, "WiC64 is emulated", NULL, 0, NULL); */
+ send_reply_revised(SUCCESS, "Success", NULL, 0, NULL);
break;
case WIC64_CMD_FORCE_ERROR:
- wic64_log(CONS_COL_RED, "forcing error...");
+ wic64_log(LOG_COL_LRED, "forcing error...");
send_reply_revised(INTERNAL_ERROR, "Test error", NULL, 0, NULL);
break;
case WIC64_CMD_FORCE_TIMEOUT:
@@ -2227,7 +2208,7 @@
default:
{
char it[64];
- wic64_log(CONS_COL_RED, "WiC64: unsupported command 0x%02x (len: %d/0x%x)",
+ wic64_log(LOG_COL_LRED, "WiC64: unsupported command 0x%02x (len: %d/0x%x)",
input_command, input_length, input_length);
input_state = 0;
snprintf(it, 63, "Undefined command id 0x%02x", input_command);
@@ -2276,9 +2257,9 @@
commandbuffer[commandptr] = value;
commandptr++;
if (commandptr >= COMMANDBUFFER_MAXLEN) {
- wic64_log(CONS_COL_RED, "command %s exceeds maxlength, forcing timeout",
+ wic64_log(LOG_COL_LRED, "command %s exceeds maxlength, forcing timeout",
cmd2string[input_command]);
- hexdump(CONS_COL_BLUE, (const char *)commandbuffer, commandptr - 1);
+ wic64_log_hexdump(LOG_COL_LBLUE, (const char *)commandbuffer, commandptr - 1);
commandbuffer[0] = 1; /* for timeout for 1s */
cmd_force_timeout();
return;
@@ -2287,7 +2268,7 @@
}
break;
default:
- wic64_log(CONS_COL_RED, "unknown input state %d", input_state);
+ wic64_log(LOG_COL_LRED, "unknown input state %d", input_state);
break;
}
}
@@ -2298,7 +2279,7 @@
if ((pulse == 1) &&
(!force_timeout)) {
if (wic64_inputmode) {
- _wic64_log(CONS_COL_BLUE, 3, "receiving '%c'/0x%02x, input_state = %d",
+ debug_log(LOG_COL_LBLUE, 3, "receiving '%c'/0x%02x, input_state = %d",
isprint(value) ? value : '.',
value,
input_state);
@@ -2315,7 +2296,7 @@
input_state = INPUT_EXP_CMD;
break;
default:
- wic64_log(CONS_COL_RED, "unknown protocol '%c'/0x%02x, using revised.",
+ wic64_log(LOG_COL_LRED, "unknown protocol '%c'/0x%02x, using revised.",
isprint(value) ? value: '.', value);
wic64_protocol = WIC64_PROT_REVISED;
input_state = INPUT_EXP_CMD;
@@ -2339,7 +2320,7 @@
handshake_flag2();
if ((input_state == INPUT_EXP_ARGS) &&
(commandptr == input_length)) {
- wic64_log(CONS_COL_BLUE, "command %s (len=%d/0x%x, using %s protocol)",
+ wic64_log(LOG_COL_LBLUE, "command %s (len=%d/0x%x, using %s protocol)",
cmd2string[input_command],
input_length, input_length,
(wic64_protocol == WIC64_PROT_LEGACY) ? "legacy" :
@@ -2368,7 +2349,7 @@
/* CIA read is triggered once more by wic64 lib on the host,
even if all bytes are sent, so the last byte seems to be sent twice */
- _wic64_log(CONS_COL_GREEN, 3, "sending '%c'/0x%02x - ptr = %d, rl = %d/0x%x",
+ debug_log(LOG_COL_LGREEN, 3, "sending '%c'/0x%02x - ptr = %d, rl = %d/0x%x",
isprint(retval) ? retval : '.',
retval, replyptr, reply_length, reply_length);
cmd_timeout(0);
@@ -2379,7 +2360,7 @@
/* PA2 interrupt toggles input/output mode */
static void userport_wic64_store_pa2(uint8_t value)
{
- _wic64_log(CONS_COL_NO, 2, "userport mode %s...(len = %d)",
+ debug_log(CONS_COL_NO, 2, "userport mode %s...(len = %d)",
value ? "sending" : "receiving",
reply_length);
@@ -2386,7 +2367,7 @@
if ((wic64_inputmode == 1) &&
(value == 0) &&
(reply_length)) {
- _wic64_log(CONS_COL_NO, 2, "userport_wic64_store_pa2 val:%02x (host %s - rl = %u)",
+ debug_log(CONS_COL_NO, 2, "userport_wic64_store_pa2 val:%02x (host %s - rl = %u)",
value, value ? "sends" : "receives", reply_length);
handshake_flag2();
}
@@ -2395,9 +2376,9 @@
if ((reply_length > 0) &&
(replyptr > 0)) {
replyptr--; /* rewind by 1 byte */
- wic64_log(CONS_COL_RED, "discarding %d bytes, which were not sent to host",
+ wic64_log(LOG_COL_LRED, "discarding %d bytes, which were not sent to host",
(reply_length - replyptr));
- hexdump(CONS_COL_RED, &replybuffer[replyptr], (reply_length - replyptr));
+ wic64_log_hexdump(LOG_COL_LRED, &replybuffer[replyptr], (reply_length - replyptr));
}
replyptr = reply_length = 0; /* host decided to send, truncate outputbuffer */
}
@@ -2423,7 +2404,7 @@
lib_unsigned_rand(0, 15),
lib_unsigned_rand(0, 15),
lib_unsigned_rand(0, 15));
- _wic64_log(CONS_COL_NO, 2, "WIC64: generated MAC: %s", wic64_mac_address);
+ debug_log(CONS_COL_NO, 2, "WIC64: generated MAC: %s", wic64_mac_address);
} else {
wic64_mac_address = tmp;
}
@@ -2435,7 +2416,7 @@
snprintf(wic64_internal_ip, 16, "192.168.%u.%u",
lib_unsigned_rand(1, 254),
lib_unsigned_rand(1, 254));
- _wic64_log(CONS_COL_NO, 2, "WIC64: generated internal IP: %s", wic64_internal_ip);
+ debug_log(CONS_COL_NO, 2, "WIC64: generated internal IP: %s", wic64_internal_ip);
} else {
wic64_internal_ip = tmp;
}
@@ -2477,12 +2458,11 @@
post_url = NULL;
}
wic64_set_status("RESET");
- if (wic64_colorize_log) {
- wic64_log(CONS_COL_BLUE, "cyan color: host -> WiC64 communication");
- wic64_log(CONS_COL_GREEN, "green color: WiC64 -> host communication");
- wic64_log(CONS_COL_RED, "red color: some error");
- wic64_log(CONS_COL_NO, "no color: other information");
- }
+
+ wic64_log(LOG_COL_LBLUE, "cyan color: host -> WiC64 communication");
+ wic64_log(LOG_COL_LGREEN, "green color: WiC64 -> host communication");
+ wic64_log(LOG_COL_LRED, "red color: some error");
+ wic64_log(CONS_COL_NO, "no color: other information");
}
/* ---------------------------------------------------------------------*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-08-03 20:11:07
|
Revision: 45257
http://sourceforge.net/p/vice-emu/code/45257
Author: gpz
Date: 2024-08-03 20:11:04 +0000 (Sat, 03 Aug 2024)
Log Message:
-----------
basic support for colors in log messages
Modified Paths:
--------------
trunk/vice/src/arch/gtk3/widgets/logfilewidget.c
trunk/vice/src/log.c
trunk/vice/src/log.h
Modified: trunk/vice/src/arch/gtk3/widgets/logfilewidget.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/logfilewidget.c 2024-08-02 22:35:17 UTC (rev 45256)
+++ trunk/vice/src/arch/gtk3/widgets/logfilewidget.c 2024-08-03 20:11:04 UTC (rev 45257)
@@ -175,8 +175,10 @@
GtkWidget *logfile_chooser;
GtkWidget *stdout_check;
GtkWidget *mon_check;
+ GtkWidget *col_check;
GtkWidget *button_box;
GtkWidget *limits_widget;
+ GtkWidget *limits_label;
const char *logfilename = NULL;
char *logfile_default;
int row = 0;
@@ -188,7 +190,7 @@
gtk_grid_set_row_spacing(GTK_GRID(grid), 8);
/* header */
- header_label = label_helper("<b>VICE log file</b>");
+ header_label = label_helper("<b>VICE log</b>");
gtk_grid_attach(GTK_GRID(grid), header_label, 0, row, 2, 1);
row++;
@@ -211,16 +213,10 @@
gtk_grid_attach(GTK_GRID(grid), logfile_chooser, 1, row, 3, 1);
row++;
- /* check button for "log to stdout" */
- stdout_check = vice_gtk3_resource_check_button_new("LogToStdout", "Log to stdout");
- logfilename = gtk_entry_get_text(GTK_ENTRY(logfile_chooser));
- if (g_strcmp0(logfilename, "-") == 0) {
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stdout_check), TRUE);
- }
- gtk_grid_attach(GTK_GRID(grid), stdout_check, 0, row, 1, 1);
- mon_check = vice_gtk3_resource_check_button_new("LogToMonitor", "Log to monitor");
- gtk_grid_attach(GTK_GRID(grid), mon_check, 1, row, 1, 1);
+ limits_label = label_helper("Log limit");
+ gtk_widget_set_halign(limits_label, GTK_ALIGN_END);
+ gtk_grid_attach(GTK_GRID(grid), limits_label, 1, row, 1, 1);
limits_widget = vice_gtk3_resource_combo_int_new("LogLimit",
log_limits);
@@ -234,6 +230,25 @@
gtk_widget_set_halign(button_box, GTK_ALIGN_END);
gtk_grid_attach(GTK_GRID(grid), button_box, 3, row, 1, 1);
+ row++;
+
+ /* check button for "log to stdout" */
+ stdout_check = vice_gtk3_resource_check_button_new("LogToStdout", "Log to stdout");
+ logfilename = gtk_entry_get_text(GTK_ENTRY(logfile_chooser));
+ if (g_strcmp0(logfilename, "-") == 0) {
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stdout_check), TRUE);
+ }
+ gtk_grid_attach(GTK_GRID(grid), stdout_check, 0, row, 1, 1);
+
+ /* check button for "log to monitor" */
+ mon_check = vice_gtk3_resource_check_button_new("LogToMonitor", "Log to monitor");
+ gtk_grid_attach(GTK_GRID(grid), mon_check, 1, row, 1, 1);
+
+ /* check button for "Colorize Log" */
+ col_check = vice_gtk3_resource_check_button_new("LogColorize", "Colorize Log");
+ gtk_grid_attach(GTK_GRID(grid), col_check, 2, row, 1, 1);
+
+
g_signal_connect(G_OBJECT(launcher),
"clicked",
G_CALLBACK(on_launcher_clicked),
Modified: trunk/vice/src/log.c
===================================================================
--- trunk/vice/src/log.c 2024-08-02 22:35:17 UTC (rev 45256)
+++ trunk/vice/src/log.c 2024-08-03 20:11:04 UTC (rev 45257)
@@ -95,6 +95,8 @@
static int log_to_stdout = 1;
static int log_to_monitor = 0;
+static int log_colorize = 1;
+
/* ------------------------------------------------------------------------- */
static int log_file_type = 0;
@@ -278,6 +280,15 @@
return 0;
}
+static int set_log_colorize(int val, void *param)
+{
+ LOCK();
+ log_colorize = val ? 1 : 0;
+ DBG(("set_log_colorize:%d\n", val));
+ UNLOCK();
+ return 0;
+}
+
static int set_log_file_name(const char *val, void *param)
{
if (locked) {
@@ -317,6 +328,8 @@
&log_to_stdout, set_log_to_stdout, NULL },
{ "LogToMonitor", 0, RES_EVENT_NO, NULL,
&log_to_monitor, set_log_to_monitor, NULL },
+ { "LogColorize", 1, RES_EVENT_NO, NULL,
+ &log_colorize, set_log_colorize, NULL },
RESOURCE_INT_LIST_END
};
@@ -420,6 +433,12 @@
{ "+logtomonitor", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
NULL, NULL, "LogToMonitor", (void *)0,
NULL, "Do not log to the monitor." },
+ { "-logcolorize", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
+ NULL, NULL, "LogColorize", (void *)1,
+ NULL, "Colorize the log output." },
+ { "+logcolorize", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
+ NULL, NULL, "LogColorize", (void *)0,
+ NULL, "Do not colorize the log output." },
CMDLINE_LIST_END
};
@@ -609,6 +628,31 @@
return rc;
}
+static char *logskipcolors(char *txt)
+{
+ char *p = lib_strdup(txt);
+ char *out;
+ out = p;
+ while (*txt != 0) {
+ if (*txt == 0x1b) {
+ txt++;
+ if (*txt == '[') {
+ while ((*txt != 0) && (*txt != 'm')) {
+ txt++;
+ }
+ if (*txt != 0) {
+ txt++;
+ }
+ }
+ } else {
+ *out = *txt;
+ out++; txt++;
+ }
+ }
+ *out = 0;
+ return p;
+}
+
/* main log helper */
static int log_helper(log_t log, unsigned int level, const char *format,
va_list ap)
@@ -615,9 +659,9 @@
{
static const char * const level_strings[8] = {
"", /* LOG_LEVEL_NONE */
- "Fatal - ", /* LOG_LEVEL_FATAL */
- "Error - ", /* LOG_LEVEL_ERROR */
- "Warning - ", /* LOG_LEVEL_WARNING */
+ LOG_COL_LRED "Fatal" LOG_COL_OFF " - ", /* LOG_LEVEL_FATAL */
+ LOG_COL_LRED "Error" LOG_COL_OFF " - ", /* LOG_LEVEL_ERROR */
+ LOG_COL_LMAGENTA "Warning" LOG_COL_OFF " - ", /* LOG_LEVEL_WARNING */
"", /* LOG_LEVEL_INFO */
"", /* LOG_LEVEL_VERBOSE */
"", /* LOG_LEVEL_DEBUG */
@@ -630,9 +674,11 @@
int rc = 0;
char *pretxt = NULL;
char *logtxt = NULL;
+ char *nocolorpre = NULL;
+ char *nocolortxt = NULL;
+ char *terminalpre = NULL;
+ char *terminaltxt = NULL;
- // va_list ap1, ap2;
-
/* exit early if there is no log enabled */
if ((log_limit < level) ||
((log_to_stdout == 0) && (log_to_file == 0) && (log_to_monitor == 0))) {
@@ -641,9 +687,7 @@
if ((logi != LOG_DEFAULT) && (logi != LOG_ERR)) {
if ((logs == NULL) || (logi < 0)|| (logi >= num_logs) || (logs[logi] == NULL)) {
-#ifdef DEBUG
- log_archdep("log_helper: internal error (invalid id or closed log), messages follows:\n", format, ap);
-#endif
+ DBG(("log_helper: internal error (invalid id or closed log), messages follows:\n"));
return -1;
}
}
@@ -650,7 +694,7 @@
/* prepend the log_t prefix, and the loglevel string */
if ((log_file != NULL) && (logi != LOG_DEFAULT) && (logi != LOG_ERR) && (*logs[logi] != '\0')) {
- pretxt = lib_msprintf("%s: %s", logs[logi], lvlstr);
+ pretxt = lib_msprintf(LOG_COL_LWHITE "%s" LOG_COL_OFF ": %s", logs[logi], lvlstr);
} else {
pretxt = lib_msprintf("%s", lvlstr);
}
@@ -657,9 +701,28 @@
/* build the log string */
logtxt = lib_mvsprintf(format, ap);
+ if ((log_to_file) || (!log_colorize)) {
+ nocolorpre = logskipcolors(pretxt);
+ nocolortxt = logskipcolors(logtxt);
+ }
+
+ if (log_colorize) {
+ terminalpre = pretxt;
+ terminaltxt = logtxt;
+ } else {
+ terminalpre = nocolorpre;
+ terminaltxt = nocolortxt;
+ }
+
if (log_to_stdout) {
+ /* FIXME: we should force colors off here, if the standard logger goes
+ into a file (because stdout was redirected) */
+ if (0) {
+ terminalpre = nocolorpre;
+ terminaltxt = nocolortxt;
+ }
/* output to stdout */
- if (log_archdep(pretxt, logtxt) < 0) {
+ if (log_archdep(terminalpre, terminaltxt) < 0) {
rc = -1;
}
}
@@ -666,7 +729,7 @@
if (log_to_file) {
/* output to log file */
- if (log_tofile(pretxt, logtxt) < 0) {
+ if (log_tofile(nocolorpre, nocolortxt) < 0) {
rc = -1;
}
}
@@ -673,7 +736,7 @@
if (log_to_monitor) {
/* output to monitor */
- if (log_monitor(pretxt, logtxt) < 0) {
+ if (log_monitor(terminalpre, terminaltxt) < 0) {
rc = -1;
}
}
@@ -680,6 +743,8 @@
lib_free(pretxt);
lib_free(logtxt);
+ lib_free(nocolorpre);
+ lib_free(nocolortxt);
return rc;
}
Modified: trunk/vice/src/log.h
===================================================================
--- trunk/vice/src/log.h 2024-08-02 22:35:17 UTC (rev 45256)
+++ trunk/vice/src/log.h 2024-08-03 20:11:04 UTC (rev 45257)
@@ -74,6 +74,27 @@
void log_close_all(void);
/* actual log functions */
+
+/* foreground colors */
+#define LOG_COL_BLACK "\x1B[30;40m"
+#define LOG_COL_RED "\x1B[31;40m"
+#define LOG_COL_GREEN "\x1B[32;40m"
+#define LOG_COL_YELLOW "\x1B[33;40m"
+#define LOG_COL_BLUE "\x1B[34;40m"
+#define LOG_COL_MAGENTA "\x1B[35;40m"
+#define LOG_COL_CYAN "\x1B[36;40m"
+#define LOG_COL_WHITE "\x1B[37;40m"
+#define LOG_COL_LBLACK "\x1B[90;40m"
+#define LOG_COL_LRED "\x1B[91;40m"
+#define LOG_COL_LGREEN "\x1B[92;40m"
+#define LOG_COL_LYELLOW "\x1B[93;40m"
+#define LOG_COL_LBLUE "\x1B[94;40m"
+#define LOG_COL_LMAGENTA "\x1B[95;40m"
+#define LOG_COL_LCYAN "\x1B[96;40m"
+#define LOG_COL_LWHITE "\x1B[97;40m"
+
+#define LOG_COL_OFF "\x1B[0m"
+
int log_out(log_t log, unsigned int level, const char *format, ...) VICE_ATTR_PRINTF3;
int log_message(log_t log, const char *format, ...) VICE_ATTR_PRINTF2;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-08-02 22:35:20
|
Revision: 45256
http://sourceforge.net/p/vice-emu/code/45256
Author: gpz
Date: 2024-08-02 22:35:17 +0000 (Fri, 02 Aug 2024)
Log Message:
-----------
rework the log system. logging to stdout and to an actual file can coexist now, each can be selected separately. This simplifies some code (eg in archdep_open_default_log_file) and makes sure stdout is only ever written to (if enabled). Some odd side effects in Windows may disappear now.
Modified Paths:
--------------
trunk/vice/doc/vice.texi
trunk/vice/src/arch/gtk3/widgets/logfilewidget.c
trunk/vice/src/arch/shared/archdep_open_default_log_file.c
trunk/vice/src/c1541-stubs.c
trunk/vice/src/c1541.c
trunk/vice/src/log.c
trunk/vice/src/log.h
trunk/vice/src/main.c
Modified: trunk/vice/doc/vice.texi
===================================================================
--- trunk/vice/doc/vice.texi 2024-07-31 21:10:21 UTC (rev 45255)
+++ trunk/vice/doc/vice.texi 2024-08-02 22:35:17 UTC (rev 45256)
@@ -1239,13 +1239,33 @@
Specify log file name
(@code{LogFileName}).
+@findex -logtofile, +logtofile
+@item -logtofile
+@itemx +logtofile
+Enable/disable logging to the log file.
+(@code{LogToFile=1}, @code{LogToFile=0}).
+
+@findex -logtostdout, +logtostdout
+@item -logtostdout
+@itemx +logtostdout
+Enable/disable logging to stdout.
+(@code{LogToStdout=1}, @code{LogToStdout=0}).
+
+@findex -logtomonitor, +logtomonitor
+@item -logtomonitor
+@itemx +logtomonitor
+Enable/disable logging to the monitor.
+(@code{LogToMonitor=1}, @code{LogToMonitor=0}).
+
@findex -verbose
@item -verbose
Enable verbose log output.
+(@code{LogLimit}).
@findex -silent
@item -silent
Disable all log output (except errors).
+(@code{LogLimit}).
@findex -no-redirect-streams
@item -no-redirect-streams
@@ -17517,6 +17537,23 @@
@item LogFileName
String specifying the filename of the current log file.
+@vindex LogLimit
+@item LogLimit
+Integer specifying the "verbosity" of the log output. Higher numbers mean more
+verbosity (0: no log, 255: all messages)
+
+@vindex LogToFile
+@item LogToFile
+Boolean that specifies whether the log should go to the log file.
+
+@vindex LogToStdout
+@item LogToStdout
+Boolean that specifies whether the log should go stdout (usually the launching terminal).
+
+@vindex LogToMonitor
+@item LogToMonitor
+Boolean that specifies whether the log should go to the monitor console.
+
@vindex ExitScreenshotName
@item ExitScreenshotName
String specifying the filename of a screenshot file that will be written when the emulator exits.
Modified: trunk/vice/src/arch/gtk3/widgets/logfilewidget.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/logfilewidget.c 2024-07-31 21:10:21 UTC (rev 45255)
+++ trunk/vice/src/arch/gtk3/widgets/logfilewidget.c 2024-08-02 22:35:17 UTC (rev 45256)
@@ -43,18 +43,13 @@
#include "logfilewidget.h"
-
-/** \brief ID of the 'changed' signal handler of the "stdout" check button
- *
- * This ID is used to temporarily block the signal to avoid signal handlers of
- * the check button and the text entry triggering each other.
- */
-static gulong check_handler = 0;
-
/** \brief Button to open a file manager in the logfile directory
*/
static GtkWidget *launcher = NULL;
+/** \brief "Log to file" checkbutton widget
+ */
+static GtkWidget *file_check;
/** \brief Handler for the 'changed' event of the entry
*
@@ -68,32 +63,11 @@
const char *text = gtk_entry_get_text(GTK_ENTRY(entry));
bool enabled = g_strcmp0(text, "-") == 0;
- /* avoid signals bouncing */
- g_signal_handler_block(check, check_handler);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), enabled);
- gtk_widget_set_sensitive(launcher, !enabled);
- g_signal_handler_unblock(check, check_handler);
-}
-
-/** \brief Handler for the 'toggled' event of the check button
- *
- * Set \a browser contents to "-" when \a check is toggled on, clear \a browser
- * contents when \a check is toggled off.
- *
- * \param[in] check GtkCheckButton for "log to stdout"
- * \param[in] chooser resource file chooser containing the LogFileName contents
- */
-static void on_stdout_check_toggled(GtkWidget *check, gpointer chooser)
-{
- const char *text;
-
- if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check))) {
- text = "-";
- } else {
- text = "";
+ if (enabled) {
+ /* enable "log to stdout", disable "log to file" when "-" was entered as name */
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), enabled);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(file_check), enabled ^ 1);
}
- gtk_entry_set_text(GTK_ENTRY(chooser), text);
- resources_set_string("LogFileName", text);
}
/** \brief Open directory containing the log file
@@ -182,6 +156,13 @@
return label;
}
+static const vice_gtk3_combo_entry_int_t log_limits[] = {
+ { "Silent", LOG_LIMIT_SILENT },
+ { "Standard", LOG_LIMIT_STANDARD },
+ { "Verbose", LOG_LIMIT_VERBOSE },
+ { "Debug", LOG_LIMIT_DEBUG },
+ { NULL, -1 }
+};
/** \brief Create widget to set the LogFileName resource
*
@@ -193,7 +174,9 @@
GtkWidget *header_label;
GtkWidget *logfile_chooser;
GtkWidget *stdout_check;
+ GtkWidget *mon_check;
GtkWidget *button_box;
+ GtkWidget *limits_widget;
const char *logfilename = NULL;
char *logfile_default;
int row = 0;
@@ -209,6 +192,9 @@
gtk_grid_attach(GTK_GRID(grid), header_label, 0, row, 2, 1);
row++;
+ file_check = vice_gtk3_resource_check_button_new("LogToFile", "Log to file");
+ gtk_grid_attach(GTK_GRID(grid), file_check, 0, row, 1, 1);
+
/* logfile resource filechooser */
logfile_default = archdep_default_logfile();
logfile_chooser = vice_gtk3_resource_filechooser_new("LogFileName",
@@ -222,11 +208,11 @@
/* use the default log file path as a placeholder text */
gtk_entry_set_placeholder_text(GTK_ENTRY(logfile_chooser), logfile_default);
lib_free(logfile_default);
- gtk_grid_attach(GTK_GRID(grid), logfile_chooser, 0, row, 2, 1);
+ gtk_grid_attach(GTK_GRID(grid), logfile_chooser, 1, row, 3, 1);
row++;
/* check button for "log to stdout" */
- stdout_check = gtk_check_button_new_with_label("Log to stdout");
+ stdout_check = vice_gtk3_resource_check_button_new("LogToStdout", "Log to stdout");
logfilename = gtk_entry_get_text(GTK_ENTRY(logfile_chooser));
if (g_strcmp0(logfilename, "-") == 0) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stdout_check), TRUE);
@@ -233,6 +219,13 @@
}
gtk_grid_attach(GTK_GRID(grid), stdout_check, 0, row, 1, 1);
+ mon_check = vice_gtk3_resource_check_button_new("LogToMonitor", "Log to monitor");
+ gtk_grid_attach(GTK_GRID(grid), mon_check, 1, row, 1, 1);
+
+ limits_widget = vice_gtk3_resource_combo_int_new("LogLimit",
+ log_limits);
+ gtk_grid_attach(GTK_GRID(grid), limits_widget, 2, row, 1, 1);
+
/* "Open directory" button in button box, next to the stdout check button */
button_box = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
gtk_box_set_spacing(GTK_BOX(button_box), 8);
@@ -239,16 +232,12 @@
launcher = gtk_button_new_with_label("Open directory containing log file");
gtk_box_pack_start(GTK_BOX(button_box), launcher, FALSE, FALSE, 0);
gtk_widget_set_halign(button_box, GTK_ALIGN_END);
- gtk_grid_attach(GTK_GRID(grid), button_box, 1, row, 1, 1);
+ gtk_grid_attach(GTK_GRID(grid), button_box, 3, row, 1, 1);
g_signal_connect(G_OBJECT(launcher),
"clicked",
G_CALLBACK(on_launcher_clicked),
NULL);
- check_handler = g_signal_connect(G_OBJECT(stdout_check),
- "toggled",
- G_CALLBACK(on_stdout_check_toggled),
- (gpointer)logfile_chooser);
g_signal_connect_unlocked(G_OBJECT(logfile_chooser),
"changed",
G_CALLBACK(on_logfile_entry_changed),
Modified: trunk/vice/src/arch/shared/archdep_open_default_log_file.c
===================================================================
--- trunk/vice/src/arch/shared/archdep_open_default_log_file.c 2024-07-31 21:10:21 UTC (rev 45255)
+++ trunk/vice/src/arch/shared/archdep_open_default_log_file.c 2024-08-02 22:35:17 UTC (rev 45256)
@@ -47,40 +47,30 @@
/** \brief Opens the default log file
*
- * On *nix the log goes to stdout by default. If that does not exist, attempt
- * to open a log file in the user's vice state dir. If the file cannot be
- * opened for some reason, stdout is returned anyway.
+ * Attempt to open a log file in the user's vice state dir. If the file cannot
+ * be opened for some reason, return NULL.
*
- * \return file pointer to log file
+ * NOTE: In the past this function would return stdout (instead of opening a
+ * regular file) under certain conditions, eg when stdout was connected to a
+ * pipe or a terminal. Or simply when opening the default log file failed. This
+ * is not the case anymore, since the log system handles the log file and stdout
+ * separately now.
+ *
+ * \return file pointer to log file, or NULL on failure.
*/
FILE *archdep_open_default_log_file(void)
{
- FILE *fp = stdout;
+ FILE *fp;
char *path;
- /* quick fix. on non windows platforms this should check if VICE has been
- started from a terminal, and only if not open a file instead of stdout */
-#ifdef UNIX_COMPILE
- if (!isatty(fileno(fp))) {
- struct stat statinfo;
- fstat(fileno(fp), &statinfo);
- /* also check if stdout is connected to a pipe or regular file, in that
- case do not open a logfile either, so we can redirect the output on
- the shell */
- if (!S_ISFIFO(statinfo.st_mode) && !S_ISREG(statinfo.st_mode)) {
-#endif
- path = archdep_default_logfile();
- fp = fopen(path, "w");
- if (fp == NULL) {
- log_error(LOG_ERR,
- "failed to open log file '%s' for writing, reverting to stdout",
- path);
- fp = stdout;
- }
- lib_free(path);
-#ifdef UNIX_COMPILE
- }
+ path = archdep_default_logfile();
+ fp = fopen(path, "w");
+ if (fp == NULL) {
+ log_error(LOG_ERR,
+ "failed to open log file '%s' for writing.",
+ path);
}
-#endif
+ lib_free(path);
+
return fp;
}
Modified: trunk/vice/src/c1541-stubs.c
===================================================================
--- trunk/vice/src/c1541-stubs.c 2024-07-31 21:10:21 UTC (rev 45255)
+++ trunk/vice/src/c1541-stubs.c 2024-08-02 22:35:17 UTC (rev 45256)
@@ -320,3 +320,7 @@
{
}
+int mon_out(const char *format, ...)
+{
+}
+
Modified: trunk/vice/src/c1541.c
===================================================================
--- trunk/vice/src/c1541.c 2024-07-31 21:10:21 UTC (rev 45255)
+++ trunk/vice/src/c1541.c 2024-08-02 22:35:17 UTC (rev 45256)
@@ -3665,9 +3665,9 @@
static int verbose_cmd(int nargs, char **args)
{
if (nargs >= 2 && strcmp(args[1], "off") == 0) {
- return log_set_verbose(0);
+ return log_set_limit(LOG_LIMIT_STANDARD);
} else {
- return log_set_verbose(1);
+ return log_set_limit(LOG_LIMIT_VERBOSE);
}
}
@@ -3677,9 +3677,9 @@
static int silent_cmd(int nargs, char **args)
{
if (nargs >= 2 && strcmp(args[1], "off") == 0) {
- return log_set_silent(0);
+ return log_set_limit(LOG_LIMIT_STANDARD);
} else {
- return log_set_silent(1);
+ return log_set_limit(LOG_LIMIT_SILENT);
}
}
Modified: trunk/vice/src/log.c
===================================================================
--- trunk/vice/src/log.c 2024-07-31 21:10:21 UTC (rev 45255)
+++ trunk/vice/src/log.c 2024-08-02 22:35:17 UTC (rev 45256)
@@ -37,6 +37,7 @@
#include "cmdline.h"
#include "lib.h"
#include "log.h"
+#include "monitor.h"
#include "resources.h"
#include "util.h"
@@ -80,88 +81,119 @@
static char **logs = NULL;
static log_t num_logs = 0;
-static int log_enabled = 1; /* cv: this flag allows to temporarly disable all logging */
-static int verbose = 0;
+static int log_limit_early = -1; /* -1 means not set */
+
static int locked = 0;
+/* resources */
+
+static char *log_file_name = NULL; /* name of the log file */
+
+static int log_limit = LOG_LIMIT_DEBUG; /* before the default is set, we want all messages */
+
+static int log_to_file = 1;
+static int log_to_stdout = 1;
+static int log_to_monitor = 0;
+
/* ------------------------------------------------------------------------- */
-static char *log_file_name = NULL;
+static int log_file_type = 0;
-static void log_file_open(void)
+static int log_file_open(void)
{
- if (log_file_name == NULL || *log_file_name == 0) {
+ int rc = 0;
+ DBG(("log_file_open\n"));
+ if (log_file != NULL) {
+ DBG(("log_file_open is open, return -1\n"));
+ return -1;
+ }
+ if ((log_file_name == NULL) || (*log_file_name == 0)) {
+ /* no log file name was given, in this case we use the arch dependent
+ default name */
+ /* CAUTION: this may return stdout */
+ log_file_type = 2;
+ DBG(("log_file_open default\n"));
log_file = archdep_open_default_log_file();
- } else {
- if (strcmp(log_file_name, "-") == 0) {
- log_file = stdout;
- } else {
- log_file = fopen(log_file_name, MODE_WRITE_TEXT);
+ if (log_file == NULL) {
+ /* if the archdep layer returned NULL for whatever reason (usually
+ because it could not open the log file), enable logging to stdout,
+ disable logging to file, and set log_file to NULL */
+ DBG(("archdep_open_default_log_file returned NULL, using stdout\n"));
+ log_to_stdout = 1;
+ log_to_file = 0;
+ log_file = NULL;
+ log_file_type = 1;
}
+ } else if (strcmp(log_file_name, "-") == 0) {
+ DBG(("log_file_open stdout\n"));
+ /* HACK: if log_file_name is "-", enable logging to stdout,
+ disable logging to file, and set log_file to NULL */
+ log_to_stdout = 1;
+ log_to_file = 0;
+ log_file = NULL;
+ log_file_name[0] = 0;
+ log_file_type = 1;
+ } else if (log_to_file) {
+ DBG(("log_file_open file '%s'\n", log_file_name));
+ log_file_type = 3;
+ log_file = fopen(log_file_name, MODE_WRITE_TEXT);
+ if (log_file == NULL) {
+ log_file_type = 0;
+ rc = -1;
+ }
}
+
+ /* at this point log_file is either NULL, or a valid fd for the log file,
+ however it will NOT be stdout! */
+#if 1
+ /* FIXME: we probably should not do this for performance reasons? */
/* flush all data direct to the output stream. */
if (log_file) {
setbuf(log_file, NULL);
}
+#endif
+ DBG(("log_file_open return:%d\n", rc));
+ return rc;
}
-static int set_log_file_name(const char *val, void *param)
+static void log_file_close(void)
{
- if (locked) {
- return 0;
- }
-
- if (util_string_set(&log_file_name, val) < 0) {
- return 0;
- }
-
+ DBG(("log_file_close %p\n", log_file));
if (log_file) {
if (log_file != stdout) {
fclose(log_file);
}
- log_file_open();
+ fflush(log_file);
+ log_file = NULL;
}
-
- return 0;
}
-static int log_verbose_opt(const char *param, void *extra_param)
-{
- verbose = vice_ptr_to_int(extra_param);
- return 0;
-}
+/******************************************************************************/
-static int log_silent_opt(const char *param, void *extra_param)
+int log_set_limit(int n)
{
- int silent = vice_ptr_to_int(extra_param);
- log_enabled = ! silent;
- return 0;
-}
-
-
-int log_set_verbose(int n)
-{
LOCK();
- if (n) {
- UNLOCK_AND_RETURN_INT(log_verbose_opt(NULL, (void*)1));
+ if ((n < 0) || (n > 0xff)) {
+ UNLOCK_AND_RETURN_INT(-1);
}
- UNLOCK_AND_RETURN_INT(log_verbose_opt(NULL, (void*)0));
+ log_limit = n;
+ UNLOCK_AND_RETURN_INT(0);
}
-
-int log_set_silent(int n)
+/* called by code that is executed *before* the resources are registered */
+int log_set_limit_early(int n)
{
LOCK();
- log_enabled = !n;
+ log_limit = n;
+ log_limit_early = n;
UNLOCK_AND_RETURN_INT(0);
}
-
-
+/* called via main_program()->archdep_init() */
int log_early_init(int argc, char **argv)
{
int i;
@@ -177,12 +209,15 @@
if (argc > 1) {
for (i = 1; i < argc; i++) {
DBG(("log_early_init: %d %s\n", i, argv[i]));
- if (strcmp("-verbose", argv[i]) == 0) {
- log_set_verbose(1);
+ if ((strcmp("-verbose", argv[i]) == 0) || (strcmp("--verbose", argv[i]) == 0)) {
+ log_set_limit_early(LOG_LIMIT_VERBOSE);
break;
- } else if (strcmp("-silent", argv[1]) == 0) {
- log_enabled = 0;
+ } else if ((strcmp("-silent", argv[i]) == 0) || (strcmp("--silent", argv[i]) == 0)) {
+ log_set_limit_early(LOG_LIMIT_SILENT);
break;
+ } else if ((strcmp("-debug", argv[i]) == 0) || (strcmp("--debug", argv[i]) == 0)) {
+ log_set_limit_early(LOG_LIMIT_DEBUG);
+ break;
}
}
}
@@ -189,7 +224,102 @@
return 0;
}
+/******************************************************************************/
+
#ifndef __X1541__
+
+static int set_log_limit(int val, void *param)
+{
+ LOCK();
+ /* HACK: When a log limit was given "early" (meaning: before the resources
+ are being initialized) on the commandline, the wanted log limit will
+ be saved into log_limit_early (which is NOT tied to a resource).
+ We initialize log_limit_early with -1 so we can check if the log
+ limit was given on the command line or not.
+ */
+ if (log_limit_early != -1) {
+ /* log limit was given on command line */
+ val = log_limit_early; /* set the resource to the value given on command line */
+ log_limit_early = -1; /* reset to initial ("ignored") value */
+ }
+ UNLOCK_AND_RETURN_INT(log_set_limit(val));
+}
+
+static int set_log_to_file(int val, void *param)
+{
+ LOCK();
+ log_to_file = val ? 1 : 0;
+#if 0
+ log_file_close();
+ if (log_to_file) {
+ log_file_open();
+ }
+#endif
+ DBG(("set_log_to_file:%d\n", val));
+ UNLOCK();
+ return 0;
+}
+
+static int set_log_to_stdout(int val, void *param)
+{
+ LOCK();
+ log_to_stdout = val ? 1 : 0;
+ DBG(("set_log_to_stdout:%d\n", val));
+ UNLOCK();
+ return 0;
+}
+
+static int set_log_to_monitor(int val, void *param)
+{
+ LOCK();
+ log_to_monitor = val ? 1 : 0;
+ DBG(("set_log_to_monitor:%d\n", val));
+ UNLOCK();
+ return 0;
+}
+
+static int set_log_file_name(const char *val, void *param)
+{
+ if (locked) {
+ DBG(("set_log_file_name (locked):%s\n", val));
+ return 0;
+ }
+ DBG(("set_log_file_name:'%s'->'%s'\n", log_file_name, val));
+ if (((log_file_name == NULL) || (*log_file_name == 0)) &&
+ ((val == NULL) || (*val == 0))) {
+ util_string_set(&log_file_name, val);
+ return 0;
+ }
+
+ if (strcmp(log_file_name, val) == 0) {
+ return 0;
+ }
+
+ if (util_string_set(&log_file_name, val) < 0) {
+ return 0;
+ }
+
+ /* if log file was open, close and re-open it */
+ log_file_close();
+ if (log_to_file) {
+ log_file_open();
+ }
+
+ return 0;
+}
+
+static const resource_int_t resources_int[] = {
+ { "LogLimit", LOG_LIMIT_STANDARD, RES_EVENT_NO, NULL,
+ &log_limit, set_log_limit, NULL },
+ { "LogToFile", 1, RES_EVENT_NO, NULL,
+ &log_to_file, set_log_to_file, NULL },
+ { "LogToStdout", 1, RES_EVENT_NO, NULL,
+ &log_to_stdout, set_log_to_stdout, NULL },
+ { "LogToMonitor", 0, RES_EVENT_NO, NULL,
+ &log_to_monitor, set_log_to_monitor, NULL },
+ RESOURCE_INT_LIST_END
+};
+
static const resource_string_t resources_string[] = {
{ "LogFileName", "", RES_EVENT_NO, NULL,
&log_file_name, set_log_file_name, NULL },
@@ -196,18 +326,15 @@
RESOURCE_STRING_LIST_END
};
-static int log_logfile_opt(const char *param, void *extra_param)
-{
- locked = 0;
- set_log_file_name(param, NULL);
- locked = 1;
- return 0;
-}
-
+/* called via init_resources() */
int log_resources_init(void)
{
LOCK();
+ if (resources_register_int(resources_int) < 0) {
+ UNLOCK_AND_RETURN_INT(-1);
+ }
+
UNLOCK_AND_RETURN_INT(resources_register_string(resources_string));
}
@@ -220,6 +347,42 @@
UNLOCK();
}
+static int log_verbose_opt(const char *param, void *extra_param)
+{
+ return log_set_limit(LOG_LIMIT_VERBOSE);
+}
+
+static int log_silent_opt(const char *param, void *extra_param)
+{
+ return log_set_limit(LOG_LIMIT_SILENT);
+}
+
+static int log_debug_opt(const char *param, void *extra_param)
+{
+ return log_set_limit(LOG_LIMIT_DEBUG);
+}
+
+static int log_logfile_opt(const char *val, void *param)
+{
+ locked = 0;
+
+ DBG(("log_logfile_opt:%s\n", val));
+
+ if (util_string_set(&log_file_name, val) < 0) {
+ return 0;
+ }
+
+ /* if log file was open, close and re-open it */
+ log_file_close();
+ if (log_to_file) {
+ log_file_open();
+ }
+
+ locked = 1;
+
+ return 0;
+}
+
static const cmdline_option_t cmdline_options[] =
{
/* NOTE: although we use CALL_FUNCTION, we put the resource that will be
@@ -227,12 +390,37 @@
{ "-logfile", CALL_FUNCTION, CMDLINE_ATTRIB_NEED_ARGS,
log_logfile_opt, NULL, "LogFileName", NULL,
"<Name>", "Specify log file name" },
+ { "-loglimit", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
+ NULL, NULL, "LogLimit", NULL,
+ "<Type>", "Set log level: (0: None, 255: All)" },
+ { "-silent", CALL_FUNCTION, CMDLINE_ATTRIB_NONE,
+ log_silent_opt, NULL, NULL, NULL,
+ NULL, "Disable all log output, except errors." },
{ "-verbose", CALL_FUNCTION, CMDLINE_ATTRIB_NONE,
- log_verbose_opt, (void*)1, NULL, NULL,
+ log_verbose_opt, NULL, NULL, NULL,
NULL, "Enable verbose log output." },
- { "-silent", CALL_FUNCTION, CMDLINE_ATTRIB_NONE,
- log_silent_opt, (void*)1, NULL, NULL,
- NULL, "Disable verbose log output." },
+ { "-debug", CALL_FUNCTION, CMDLINE_ATTRIB_NONE,
+ log_debug_opt, NULL, NULL, NULL,
+ NULL, "Enable verbose debug log output." },
+ { "-logtofile", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
+ NULL, NULL, "LogToFile", (void *)1,
+ NULL, "Log to the log file." },
+ { "+logtofile", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
+ NULL, NULL, "LogToFile", (void *)0,
+ NULL, "Do not log to the log file." },
+ { "-logtostdout", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
+ NULL, NULL, "LogToStdout", (void *)1,
+ NULL, "Log to stdout." },
+ { "+logtostdout", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
+ NULL, NULL, "LogToStdout", (void *)0,
+ NULL, "Do not log to stdout." },
+ { "-logtomonitor", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
+ NULL, NULL, "LogToMonitor", (void *)1,
+ NULL, "Log to the monitor." },
+ { "+logtomonitor", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
+ NULL, NULL, "LogToMonitor", (void *)0,
+ NULL, "Do not log to the monitor." },
+
CMDLINE_LIST_END
};
@@ -244,8 +432,9 @@
}
#endif
-/* ------------------------------------------------------------------------- */
+/******************************************************************************/
+/* called from c1541.c */
int log_init_with_fd(FILE *f)
{
LOCK();
@@ -254,10 +443,23 @@
UNLOCK_AND_RETURN_INT(-1);
}
- log_file = f;
+ if (log_file != NULL) {
+ DBG(("log_init_with_fd log already open\n"));
+ UNLOCK_AND_RETURN_INT(-1);
+ }
+
+ if (f == stdout) {
+ DBG(("log_init_with_fd stdout\n"));
+ log_to_stdout = 1;
+ } else {
+ log_file = f;
+ log_to_file = 1;
+ }
+
UNLOCK_AND_RETURN_INT(0);
}
+/* called via main.c:main_program() */
int log_init(void)
{
LOCK();
@@ -274,12 +476,21 @@
UNLOCK_AND_RETURN_INT(-1);
}
#endif
+ DBG(("log_init (log file type:%d)\n", log_file_type));
+ if (log_to_file) {
+ /* HACK: do not close/reopen if previous log_file_open triggered stdout
+ or custom filename */
+ if ((log_file_type == 0) || (log_file_type == 3)) {
+ log_file_close();
+ log_file_open();
+ }
+ }
- log_file_open();
-
- UNLOCK_AND_RETURN_INT((log_file == NULL) ? -1 : 0);
+ UNLOCK_AND_RETURN_INT(0);
}
+/******************************************************************************/
+
log_t log_open(const char *id)
{
log_t new_log = 0;
@@ -336,7 +547,10 @@
UNLOCK();
}
-static int log_archdep(const char *logtxt, const char *fmt, va_list ap)
+/******************************************************************************/
+
+/* helper function for formatted output to default logger (stdout) */
+static int log_archdep(const char *pretxt, const char *logtxt)
{
/*
* ------ Split into single lines ------
@@ -343,11 +557,9 @@
*/
int rc = 0;
- char *txt = lib_mvsprintf(fmt, ap);
+ const char *beg = logtxt;
+ const char *end = logtxt + strlen(logtxt) + 1;
- char *beg = txt;
- char *end = txt + strlen(txt) + 1;
-
while (beg < end) {
char *eol = strchr(beg, '\n');
@@ -355,7 +567,8 @@
*eol = '\0';
}
- if (archdep_default_logger(*beg ? logtxt : "", beg) < 0) {
+ /* output to stdout */
+ if (archdep_default_logger(*beg ? pretxt : "", beg) < 0) {
rc = -1;
break;
}
@@ -367,25 +580,62 @@
beg = eol + 1;
}
- lib_free(txt);
+ return rc;
+}
+/* helper function for formatted output to the monitor */
+static int log_monitor(const char *pretxt, const char *logtxt)
+{
+ int rc = 0;
+
+ mon_out("%s%s\n", pretxt, logtxt);
+
return rc;
}
+/* helper function for formatted output to the log file */
+static int log_tofile(const char *pretxt, const char *logtxt)
+{
+ int rc = 0;
+ if (log_file != NULL) {
+ if (fputs(pretxt, log_file) == EOF) {
+ rc = -1;
+ } else if (fputs(logtxt, log_file) == EOF) {
+ rc = -1;
+ } else if (fputc ('\n', log_file) == EOF) {
+ rc = -1;
+ }
+ }
+ return rc;
+}
+
+/* main log helper */
static int log_helper(log_t log, unsigned int level, const char *format,
va_list ap)
{
- static const char * const level_strings[3] = {
- "",
- "Warning - ",
- "Error - "
+ static const char * const level_strings[8] = {
+ "", /* LOG_LEVEL_NONE */
+ "Fatal - ", /* LOG_LEVEL_FATAL */
+ "Error - ", /* LOG_LEVEL_ERROR */
+ "Warning - ", /* LOG_LEVEL_WARNING */
+ "", /* LOG_LEVEL_INFO */
+ "", /* LOG_LEVEL_VERBOSE */
+ "", /* LOG_LEVEL_DEBUG */
+ "" /* LOG_LEVEL_ALL */
};
+ const char *lvlstr = level_strings[(level >> 5) & 7];
+
const signed int logi = (signed int)log;
int rc = 0;
+ char *pretxt = NULL;
char *logtxt = NULL;
- if (!log_enabled) {
+ // va_list ap1, ap2;
+
+ /* exit early if there is no log enabled */
+ if ((log_limit < level) ||
+ ((log_to_stdout == 0) && (log_to_file == 0) && (log_to_monitor == 0))) {
return 0;
}
@@ -398,30 +648,59 @@
}
}
+ /* prepend the log_t prefix, and the loglevel string */
if ((log_file != NULL) && (logi != LOG_DEFAULT) && (logi != LOG_ERR) && (*logs[logi] != '\0')) {
- logtxt = lib_msprintf("%s: %s", logs[logi], level_strings[level]);
+ pretxt = lib_msprintf("%s: %s", logs[logi], lvlstr);
} else {
- logtxt = lib_msprintf("%s", level_strings[level]);
+ pretxt = lib_msprintf("%s", lvlstr);
}
+ /* build the log string */
+ logtxt = lib_mvsprintf(format, ap);
- if (log_file == NULL) {
- rc = log_archdep(logtxt, format, ap);
- } else {
-#ifdef ARCHDEP_EXTRA_LOG_CALL
- log_archdep(logtxt, format, ap);
-#endif
- if (fputs(logtxt, log_file) == EOF
- || vfprintf(log_file, format, ap) < 0
- || fputc ('\n', log_file) == EOF) {
+ if (log_to_stdout) {
+ /* output to stdout */
+ if (log_archdep(pretxt, logtxt) < 0) {
rc = -1;
}
}
+ if (log_to_file) {
+ /* output to log file */
+ if (log_tofile(pretxt, logtxt) < 0) {
+ rc = -1;
+ }
+ }
+
+ if (log_to_monitor) {
+ /* output to monitor */
+ if (log_monitor(pretxt, logtxt) < 0) {
+ rc = -1;
+ }
+ }
+
+ lib_free(pretxt);
lib_free(logtxt);
-
return rc;
}
+/******************************************************************************
+ High level log functions
+ ******************************************************************************/
+
+int log_out(log_t log, unsigned int level, const char *format, ...)
+{
+ va_list ap;
+ int rc;
+
+ LOCK();
+
+ va_start(ap, format);
+ rc = log_helper(log, level, format, ap);
+ va_end(ap);
+
+ UNLOCK_AND_RETURN_INT(rc);
+}
+
int log_message(log_t log, const char *format, ...)
{
va_list ap;
@@ -430,7 +709,7 @@
LOCK();
va_start(ap, format);
- rc = log_helper(log, 0, format, ap);
+ rc = log_helper(log, LOG_LEVEL_INFO, format, ap);
va_end(ap);
UNLOCK_AND_RETURN_INT(rc);
@@ -444,7 +723,7 @@
LOCK();
va_start(ap, format);
- rc = log_helper(log, 1, format, ap);
+ rc = log_helper(log, LOG_LEVEL_WARNING, format, ap);
va_end(ap);
UNLOCK_AND_RETURN_INT(rc);
@@ -458,7 +737,7 @@
LOCK();
va_start(ap, format);
- rc = log_helper(log, 2, format, ap);
+ rc = log_helper(log, LOG_LEVEL_ERROR, format, ap);
va_end(ap);
UNLOCK_AND_RETURN_INT(rc);
@@ -472,7 +751,7 @@
LOCK();
va_start(ap, format);
- rc = log_helper(LOG_DEFAULT, 0, format, ap);
+ rc = log_helper(LOG_DEFAULT, LOG_LEVEL_DEBUG, format, ap);
va_end(ap);
UNLOCK_AND_RETURN_INT(rc);
@@ -486,19 +765,8 @@
LOCK();
va_start(ap, format);
- if (verbose) {
- rc = log_helper(LOG_DEFAULT, 0, format, ap);
- }
+ rc = log_helper(LOG_DEFAULT, LOG_LEVEL_VERBOSE, format, ap);
va_end(ap);
UNLOCK_AND_RETURN_INT(rc);
}
-
-void log_enable(int on)
-{
- LOCK();
-
- log_enabled = on;
-
- UNLOCK();
-}
Modified: trunk/vice/src/log.h
===================================================================
--- trunk/vice/src/log.h 2024-07-31 21:10:21 UTC (rev 45255)
+++ trunk/vice/src/log.h 2024-08-02 22:35:17 UTC (rev 45256)
@@ -29,26 +29,53 @@
#include <stdio.h>
+/* values passed into the log helper (log_out->log_helper) */
+#define LOG_LEVEL_NONE 0x00
+#define LOG_LEVEL_FATAL 0x20
+#define LOG_LEVEL_ERROR 0x40
+#define LOG_LEVEL_WARNING 0x60
+#define LOG_LEVEL_INFO 0x80
+#define LOG_LEVEL_VERBOSE 0xa0
+#define LOG_LEVEL_DEBUG 0xc0
+#define LOG_LEVEL_ALL 0xff
-#define LOG_LEVEL_NONE 0x00
+/* values used to set the log level (log_set_limit, log_set_limit_early) */
-typedef signed int log_t;
-#define LOG_ERR ((log_t)-1)
-#define LOG_DEFAULT ((log_t)-2)
+/* errors only */
+#define LOG_LIMIT_SILENT (LOG_LEVEL_WARNING - 1)
+/* all messages, except verbose+debug */
+#define LOG_LIMIT_STANDARD (LOG_LEVEL_VERBOSE - 1)
+/* all messages, except debug */
+#define LOG_LIMIT_VERBOSE (LOG_LEVEL_DEBUG - 1)
+/* all messages */
+#define LOG_LIMIT_DEBUG (LOG_LEVEL_ALL - 1)
+int log_set_limit_early(int n);
+int log_early_init(int argc, char **argv);
+
+//void log_enable(int on);
+int log_set_limit(int n);
+
int log_resources_init(void);
void log_resources_shutdown(void);
int log_cmdline_options_init(void);
+
+/* init/open the log file */
int log_init(void);
int log_init_with_fd(FILE *f);
+
+/* for individual log streams */
+typedef signed int log_t;
+#define LOG_ERR ((log_t)-1)
+#define LOG_DEFAULT ((log_t)-2)
+
log_t log_open(const char *id);
int log_close(log_t log);
void log_close_all(void);
-void log_enable(int on);
-int log_set_silent(int n);
-int log_set_verbose(int n);
-int log_early_init(int argc, char **argv);
+/* actual log functions */
+int log_out(log_t log, unsigned int level, const char *format, ...) VICE_ATTR_PRINTF3;
+
int log_message(log_t log, const char *format, ...) VICE_ATTR_PRINTF2;
int log_warning(log_t log, const char *format, ...) VICE_ATTR_PRINTF2;
int log_error(log_t log, const char *format, ...) VICE_ATTR_PRINTF2;
Modified: trunk/vice/src/main.c
===================================================================
--- trunk/vice/src/main.c 2024-07-31 21:10:21 UTC (rev 45255)
+++ trunk/vice/src/main.c 2024-08-02 22:35:17 UTC (rev 45256)
@@ -217,11 +217,11 @@
default_settings_requested = 1;
#endif
} else if ((!strcmp(argv[i], "-verbose")) || (!strcmp(argv[i], "--verbose"))) {
- log_set_silent(0);
- log_set_verbose(1);
+ log_set_limit_early(LOG_LIMIT_VERBOSE);
} else if ((!strcmp(argv[i], "-silent")) || (!strcmp(argv[i], "--silent"))) {
- log_set_silent(1);
- log_set_verbose(0);
+ log_set_limit_early(LOG_LIMIT_SILENT);
+ } else if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug"))) {
+ log_set_limit_early(LOG_LIMIT_DEBUG);
} else if ((!strcmp(argv[i], "-seed")) || (!strcmp(argv[i], "--seed"))) {
if ((i + 1) < argc) {
lib_rand_seed(strtoul(argv[++i], NULL, 0));
@@ -315,6 +315,7 @@
}
}
+ /* FIXME: it should be possible to init the log system much earlier */
if (log_init() < 0) {
const char *logfile = NULL;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|