byte mapped_action[MAX_PLAYERS];
#if DEBUG_PLAYER_ACTIONS
- Print(":::");
for (i = 0; i < MAX_PLAYERS; i++)
- Print(" %d, ", stored_player[i].effective_action);
+ DebugContinued("", "%d, ", stored_player[i].effective_action);
#endif
for (i = 0; i < MAX_PLAYERS; i++)
stored_player[i].effective_action = mapped_action[i];
#if DEBUG_PLAYER_ACTIONS
- Print(" =>");
+ DebugContinued("", "=> ");
for (i = 0; i < MAX_PLAYERS; i++)
- Print(" %d, ", stored_player[i].effective_action);
- Print("\n");
+ DebugContinued("", "%d, ", stored_player[i].effective_action);
+ DebugContinued("game:playing:player", "\n");
#endif
}
#if DEBUG_PLAYER_ACTIONS
else
{
- Print(":::");
for (i = 0; i < MAX_PLAYERS; i++)
- Print(" %d, ", stored_player[i].effective_action);
- Print("\n");
+ DebugContinued("", "%d, ", stored_player[i].effective_action);
+ DebugContinued("game:playing:player", "\n");
}
#endif
#endif
va_end(ap);
}
+void DebugContinued(char *mode, char *format, ...)
+{
+ static char message[MAX_LINE_LEN] = { 0 };
+
+ // initialize message (optional)
+ if (strEqual(format, ""))
+ {
+ message[0] = '\0';
+
+ return;
+ }
+
+ char *message_ptr = message + strlen(message);
+ int size_left = MAX_LINE_LEN - strlen(message);
+ va_list ap;
+
+ // append message
+ va_start(ap, format);
+ vsnprintf(message_ptr, size_left, format, ap);
+ va_end(ap);
+
+ // finalize message
+ if (strSuffix(format, "\n"))
+ {
+ message[strlen(message) - 1] = '\0';
+
+ Debug(mode, message);
+
+ message[0] = '\0';
+ }
+}
+
void Debug(char *mode, char *format, ...)
{
va_list ap;
void PrintLine(char *, int);
void PrintLineWithPrefix(char *, char *, int);
+void DebugContinued(char *, char *, ...);
void Debug(char *, char *, ...);
void Info(char *, ...);
void Warn(char *, ...);
{
int i;
- Print("Dumping TreeInfo:\n");
+ Debug("tree", "Dumping TreeInfo:");
while (node)
{
for (i = 0; i < (depth + 1) * 3; i++)
- Print(" ");
+ DebugContinued("", " ");
- Print("'%s' / '%s'\n", node->identifier, node->name);
+ DebugContinued("tree", "'%s' / '%s'\n", node->identifier, node->name);
/*
// use for dumping artwork info tree
- Print("subdir == '%s' ['%s', '%s'] [%d])\n",
+ Debug("tree", "subdir == '%s' ['%s', '%s'] [%d])",
node->subdir, node->fullpath, node->basepath, node->in_user_dir);
*/
{
int i;
- Print("::: network buffer maximum size: %d\n", nb->max_size);
- Print("::: network buffer size: %d\n", nb->size);
- Print("::: network buffer position : %d\n", nb->pos);
+ Debug("network:buffer", "network buffer maximum size: %d\n", nb->max_size);
+ Debug("network:buffer", "network buffer size: %d\n", nb->size);
+ Debug("network:buffer", "network buffer position : %d\n", nb->pos);
for (i = 0; i < nb->size; i++)
{
if ((i % 16) == 0)
- Print("\n::: ");
+ DebugContinued("network:buffer", "\n");
- Print("%02x ", nb->buffer[i]);
+ DebugContinued("", "%02x ", nb->buffer[i]);
}
- Print("\n");
+ DebugContinued("network:buffer", "\n");
}
static void SendNetworkBufferToAllButOne(struct NetworkBuffer *nb,
action[i] = tape.pos[tape.counter].action[i];
#if DEBUG_TAPE_WHEN_PLAYING
- Print("%05d", FrameCounter);
+ DebugContinued("", "%05d", FrameCounter);
for (i = 0; i < MAX_TAPE_ACTIONS; i++)
- Print(" %08x", action[i]);
- Print("\n");
+ DebugContinued("", " %08x", action[i]);
+ DebugContinued("tape:play", "\n");
#endif
tape.set_centered_player = FALSE;