From 2b1e9a5656a607458b21076d4dc72fe9f34da46a Mon Sep 17 00:00:00 2001 From: Panagiotis <58827426+tiseno100@users.noreply.github.com> Date: Fri, 1 Jan 2021 20:11:03 +0200 Subject: [PATCH] Properly done logging --- src/chipset/acc2168.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/chipset/acc2168.c b/src/chipset/acc2168.c index 66783022e..b9e6a2c18 100644 --- a/src/chipset/acc2168.c +++ b/src/chipset/acc2168.c @@ -16,11 +16,13 @@ * Copyright 2019 Sarah Walker. * Copyright 2021 Tiseno100. */ -#include +#include #include +#include #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include "cpu.h" #include <86box/timer.h> @@ -36,6 +38,23 @@ #define SHADOW_SIZE ((i <= 1) ? 0x8000 : 0x10000) #define SHADOW_RECALC ((dev->regs[0x02] & (1 << i)) ? ENABLED_SHADOW : DISABLED_SHADOW) +#ifdef ENABLE_ACC2168_LOG +int ali1429_do_log = ENABLE_ACC2168_LOG; +static void +acc2168_log(const char *fmt, ...) +{ + va_list ap; + + if (acc2168_do_log) { + va_start(ap, fmt); + pclog_ex(fmt, ap); + va_end(ap); + } +} +#else +#define acc2168_log(fmt, ...) +#endif + typedef struct acc2168_t { uint8_t reg_idx, regs[256]; @@ -59,7 +78,7 @@ acc2168_write(uint16_t addr, uint8_t val, void *p) dev->reg_idx = val; break; case 0xf3: - pclog("dev->regs[%02x] = %02x\n", dev->reg_idx, val); + acc2168_log("ACC2168: dev->regs[%02x] = %02x\n", dev->reg_idx, val); switch (dev->reg_idx) { case 0x00: