]> git.0x19.co - doomgeneric-snom360/commitdiff
Refactor boolean type definition for C++/-std=gnu23 compatibility
authorArawn Davies <19764552+Arawn-Davies@users.noreply.github.com>
Mon, 15 Dec 2025 03:19:36 +0000 (03:19 +0000)
committerGitHub <noreply@github.com>
Mon, 15 Dec 2025 03:19:36 +0000 (03:19 +0000)
Changed the definition of 'boolean' type for C++ & -std=gnu23 compatibility, and included base <stdbool.h> header.

This is to help bring it more inline with other source ports (Chocolate Doom mainly) and keep compatibility with new toolchains I think. I didn't come up with this fix (https://blog.svgames.pl/article/the-little-bool-of-doom) but it's helped me work on a port of doomgeneric to PlayStation 2

How easy would it be to get audio working? I think only SDL 1.2 works well on that platform so I'll be using GSKit instead

doomgeneric/doomtype.h

index a225c6487eaea4c2569ed6464bc137b8535725ad..f837f71a6306caa9dd910d8424d2c6962a105137 100644 (file)
@@ -33,7 +33,7 @@
 #else
 
 #include <strings.h>
-
+#include <stdbool.h>
 #endif
 
 
 
 #include <inttypes.h>
 
-#ifdef __cplusplus
+#ifdef __cplusplus || defined(__bool_true_false_are_defined)
 
 // Use builtin bool type with C++.
 
-typedef bool boolean;
+typedef int boolean;
 
 #else
 
 typedef enum 
 {
-    false      = 0,
-    true       = 1,
+    //false    = 0,
+    //true     = 1,
        undef   = 0xFFFFFFFF
 } boolean;