From 0222dd2dca9be63961f39a0bc9f9d7072db8d8bc Mon Sep 17 00:00:00 2001 From: Astoria Date: Wed, 10 Apr 2024 21:26:33 -0500 Subject: [PATCH] Add LogConsumer (?) --- .../java/net/brokenmoon/redcontrol/api/Emulator.java | 1 + .../net/brokenmoon/redcontrol/api/LogConsumer.java | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 src/main/java/net/brokenmoon/redcontrol/api/LogConsumer.java diff --git a/src/main/java/net/brokenmoon/redcontrol/api/Emulator.java b/src/main/java/net/brokenmoon/redcontrol/api/Emulator.java index 9034f05..a843ae7 100644 --- a/src/main/java/net/brokenmoon/redcontrol/api/Emulator.java +++ b/src/main/java/net/brokenmoon/redcontrol/api/Emulator.java @@ -21,6 +21,7 @@ public class Emulator { public Emulator(RedBus bus){ this.bus = bus; cpu = new Cpu(); + cpu.setLogCallback(new LogConsumer()); cpu.setBus(new Bus(bus)); ram = new Memory(0x0000, 0x2000 - 1, ((CpuAccessor)cpu).getRedBusState()); try { diff --git a/src/main/java/net/brokenmoon/redcontrol/api/LogConsumer.java b/src/main/java/net/brokenmoon/redcontrol/api/LogConsumer.java new file mode 100644 index 0000000..facf7ff --- /dev/null +++ b/src/main/java/net/brokenmoon/redcontrol/api/LogConsumer.java @@ -0,0 +1,12 @@ +package net.brokenmoon.redcontrol.api; + +import net.brokenmoon.redcontrol.RedControl; + +import java.util.function.IntConsumer; + +public class LogConsumer implements IntConsumer { + @Override + public void accept(int value) { + RedControl.LOGGER.info("Cpu MMU Logger: " + value); + } +}