diff options
author | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2023-01-18 15:59:39 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2023-01-18 15:59:39 +0300 |
commit | 1487fadc7cf08554ac93aba83303172d73b596e1 (patch) | |
tree | cb5f84cd32411559707d0c5e8851aa1b1fc9b891 | |
parent | ba5fcf3a0b86c3e3d5dd9c23567e14101d331008 (diff) |
Debug messages
-rw-r--r-- | FamicomDumperConnection/FamicomDumperLocal.cs | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/FamicomDumperConnection/FamicomDumperLocal.cs b/FamicomDumperConnection/FamicomDumperLocal.cs index a64af28..6630bd1 100644 --- a/FamicomDumperConnection/FamicomDumperLocal.cs +++ b/FamicomDumperConnection/FamicomDumperLocal.cs @@ -96,8 +96,32 @@ namespace com.clusterrr.Famicom.DumperConnection private (DumperCommand Command, byte[] Data) RecvCommand()
{
- var (Command, Data) = connection.RecvCommand();
- return ((DumperCommand)Command, Data);
+ byte command;
+ byte[] data;
+#if DEBUG
+ bool debugging = false;
+ do
+ {
+ (command, data) = connection.RecvCommand();
+ if (command == (byte)DumperCommand.DEBUG)
+ {
+ if (!debugging)
+ Console.Write("Debug data: ");
+ foreach (var b in data)
+ {
+ Console.Write($"{b:X02} ");
+ }
+ debugging = true;
+ } else if (debugging)
+ {
+ Console.WriteLine();
+ }
+ }
+ while (command == (byte)DumperCommand.DEBUG);
+#else
+ (command, data) = connection.RecvCommand();
+#endif
+ return ((DumperCommand)command, data);
}
/// <summary>
|