Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable console logging if MONO or LOGGER is defined #159

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ endif()

if(UNIX AND NOT APPLE)
message("Building for Linux")
add_definitions( -D_DEBUG -D__LINUX__ -DLINUX -D_MAX_PATH=260 -D_MAX_FNAME=256 -D_REENRANT -D__32BIT__ -DHAVEALLOCA_H -D_USE_OGL_ACTIVE_TEXTURES)
add_definitions( -D_DEBUG -D__LINUX__ -DLINUX -D_MAX_PATH=260 -D_MAX_FNAME=256 -D_REENRANT -D__32BIT__ -DHAVEALLOCA_H -D_USE_OGL_ACTIVE_TEXTURES -DLOGGER)
set(PLATFORM_INCLUDES "lib/linux" ${SDL_INCLUDE_DIR})
endif()

if(APPLE)
message("Building for MAC OSX")
add_definitions(-D_DEBUG -D__LINUX__ -DLINUX -D_MAX_PATH=260 -D_MAX_FNAME=256 -D_REENRANT -DMACOSX=1 -D_USE_OGL_ACTIVE_TEXTURES)
add_definitions(-D_DEBUG -D__LINUX__ -DLINUX -D_MAX_PATH=260 -D_MAX_FNAME=256 -D_REENRANT -DMACOSX=1 -D_USE_OGL_ACTIVE_TEXTURES -DLOGGER)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we want this definition conditionally, if the user specified the CMake Option LOGGER

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in latest commit

set(PLATFORM_INCLUDES "lib/linux" ${SDL_INCLUDE_DIR} "/usr/X11/include")
endif()

Expand Down
4 changes: 2 additions & 2 deletions lib/debug.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -166,7 +166,7 @@ bool Debug_ConsoleInit();
void Debug_ConsoleOpen(int n, int row, int col, int width, int height, char *title);
void Debug_ConsoleClose(int n);
void Debug_ConsolePrintf(int n, char *format, ...);
void Debug_ConsolePrintf(int n, int row, int col, char *format, ...);
void Debug_ConsolePrintfAt(int n, int row, int col, char *format, ...);
void Debug_ConsoleRedirectMessages(int virtual_window, int physical_window);
// DEBUGGING MACROS
// Break into the debugger, if this feature was enabled in Debug_init()
Expand Down
6 changes: 3 additions & 3 deletions lib/mono.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -66,12 +66,12 @@
#include "debug.h"
void nw_InitTCPLogging(char *ip, unsigned short port);
void nw_TCPPrintf(int n, char *format, ...);
#if (!defined(RELEASE)) && defined(MONO)
#if (!defined(RELEASE)) && (defined(MONO) || defined(LOGGER))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to keep both, LOGGER is enough

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to keep both so we could keep the MONO code for historical reasons if we add a logging library. But it's easy enough to resurrect MONO later.

extern bool Debug_print_block;
// Prints a formatted string to the debug window
#define mprintf(args) Debug_ConsolePrintf args
// Prints a formatted string on window n at row, col.
#define mprintf_at(args) Debug_ConsolePrintf args
#define mprintf_at(args) Debug_ConsolePrintfAt args
#define DebugBlockPrint(args) \
do { \
if (Debug_print_block) \
Expand Down
4 changes: 2 additions & 2 deletions linux/lnxmono.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -554,7 +554,7 @@ void Debug_ConsolePrintf(int n, char *format, ...) {
}
}

void Debug_ConsolePrintf(int n, int row, int col, char *format, ...) {
void Debug_ConsolePrintfAt(int n, int row, int col, char *format, ...) {
if (!Mono_initialized)
return;

Expand Down