From 2a46d5829dd6bbeb0de558d8e4604c879fe2e60e Mon Sep 17 00:00:00 2001 From: mcarans Date: Tue, 29 Sep 2026 12:50:20 +1300 Subject: [PATCH 1/6] This builds but not sure if has everything needed for debug console --- meson.build | 6 +++++- meson.options | 3 +++ src/Core/Debug/OODebugFlags.h | 2 +- src/Core/Debug/OODebugMonitor.m | 4 ++-- src/Core/Debug/OODebugStandards.m | 2 +- src/Core/Debug/OODebugSupport.h | 2 +- src/Core/Debug/OODebugSupport.m | 4 ++-- src/Core/Debug/OODebugTCPConsoleClient.m | 4 ++-- src/Core/Debug/OOJSConsole.m | 14 +++++++------- src/Core/Debug/OOTCPStreamDecoder.c | 4 ++-- .../Debug/OOTCPStreamDecoderAbstractionLayer.m | 4 ++-- src/Core/Entities/DustEntity.m | 2 +- src/Core/Entities/Entity.h | 4 ++-- src/Core/Entities/Entity.m | 8 ++++---- src/Core/Entities/OOEntityWithDrawable.m | 2 +- src/Core/Entities/OOLightParticleEntity.m | 2 +- src/Core/Entities/OOParticleSystem.m | 2 +- src/Core/Entities/PlanetEntity.m | 2 +- src/Core/Entities/PlayerEntity.h | 2 +- src/Core/Entities/PlayerEntity.m | 2 +- src/Core/Entities/PlayerEntityControls.m | 8 ++++---- src/Core/Entities/ShipEntity.m | 2 +- src/Core/Entities/SkyEntity.m | 2 +- src/Core/GameController.m | 4 ++-- src/Core/Materials/OOBasicMaterial.m | 2 +- src/Core/Materials/OOConcreteTexture.m | 4 ++-- src/Core/Materials/OOMaterial.h | 2 +- src/Core/Materials/OOMaterial.m | 2 +- src/Core/Materials/OOMultiTextureMaterial.m | 2 +- src/Core/Materials/OOShaderMaterial.m | 2 +- src/Core/Materials/OOSingleTextureMaterial.m | 2 +- src/Core/Materials/OOTexture.h | 4 ++-- src/Core/Materials/OOTexture.m | 2 +- src/Core/NSObjectOOExtensions.h | 2 +- src/Core/NSObjectOOExtensions.m | 2 +- src/Core/OODrawable.h | 2 +- src/Core/OODrawable.m | 2 +- src/Core/OOLogHeader.m | 2 +- src/Core/OOMesh.m | 2 +- src/Core/OOPlanetDrawable.m | 2 ++ src/Core/OOSkyDrawable.m | 6 +++--- src/Core/Octree.h | 2 +- src/Core/Octree.m | 2 +- src/Core/Scripting/OOJSCall.h | 2 +- src/Core/Scripting/OOJSCall.m | 2 +- src/Core/Scripting/OOJSEngineDebuggerHelpers.m | 2 +- src/Core/Scripting/OOJSEngineTimeManagement.m | 2 +- src/Core/Scripting/OOJSEntity.m | 6 +++--- src/Core/Scripting/OOJSGlobal.m | 18 +++++++++--------- src/Core/Scripting/OOJSMissionVariables.m | 6 +++--- src/Core/Scripting/OOJSOolite.m | 8 ++++---- src/Core/Scripting/OOJSSpecialFunctions.m | 6 +++--- src/Core/Scripting/OOJavaScriptEngine.h | 10 +++++----- src/Core/Scripting/OOJavaScriptEngine.m | 6 +++--- src/Core/Universe.h | 4 ++-- src/Core/Universe.m | 6 +++--- src/SDL/main.m | 2 +- 57 files changed, 113 insertions(+), 104 deletions(-) diff --git a/meson.build b/meson.build index 8397f071ea..418880e09e 100644 --- a/meson.build +++ b/meson.build @@ -55,7 +55,8 @@ if get_option('deployment_release') add_project_arguments( '-DNDEBUG', '-DOO_CHECK_GL_HEAVY=0', - '-DOO_OXP_VERIFIER_ENABLED=0', + '-DOO_DEBUG_MONITOR_ENABLED=1', + '-DOO_OXP_VERIFIER_ENABLED=1', '-DOO_LOCALIZATION_TOOLS=0', '-DDEBUG_GRAPHVIZ=0', '-DOO_FOV_INFLIGHT_CONTROL_ENABLED=0', @@ -68,6 +69,9 @@ else if get_option('oo_exclude_debug_support') add_project_arguments('-DNDEBUG', language: c_family) endif + if get_option('oo_debug_monitor_enabled') + add_project_arguments('-DOO_DEBUG_MONITOR_ENABLED=1', language: c_family) + endif if get_option('oo_oxp_verifier_enabled') add_project_arguments('-DOO_OXP_VERIFIER_ENABLED=1', language: c_family) endif diff --git a/meson.options b/meson.options index 138a83074c..e640775ffc 100644 --- a/meson.options +++ b/meson.options @@ -22,6 +22,9 @@ option('oo_check_gl_heavy', type: 'boolean', value: false, option('oo_exclude_debug_support', type: 'boolean', value: false, description: 'Force exclude developer debug features (strips diagnostic tools)') +option('oo_debug_monitor_enabled', type: 'boolean', value: true, + description: 'Enable Oolite debug monitor') + option('oo_oxp_verifier_enabled', type: 'boolean', value: true, description: 'Enable Oolite Expansion Pack (OXP) checking and verification stages') diff --git a/src/Core/Debug/OODebugFlags.h b/src/Core/Debug/OODebugFlags.h index 3c90613710..f443616284 100644 --- a/src/Core/Debug/OODebugFlags.h +++ b/src/Core/Debug/OODebugFlags.h @@ -19,7 +19,7 @@ enum OODebugFlags { }; #define DEBUG_ALL 0xffffffff -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED extern uint32_t gDebugFlags; extern uint32_t gLiveEntityCount; diff --git a/src/Core/Debug/OODebugMonitor.m b/src/Core/Debug/OODebugMonitor.m index 5867f0d101..437eb26307 100644 --- a/src/Core/Debug/OODebugMonitor.m +++ b/src/Core/Debug/OODebugMonitor.m @@ -27,7 +27,7 @@ of this software and associated documentation files (the "Software"), to deal */ -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED #import "OODebugMonitor.h" #import "NSStringOOExtensions.h" @@ -929,4 +929,4 @@ - (id)autorelease @end -#endif /* NDEBUG */ +#endif /* OO_DEBUG_MONITOR_ENABLED */ diff --git a/src/Core/Debug/OODebugStandards.m b/src/Core/Debug/OODebugStandards.m index cf70fecc67..79cbf85959 100644 --- a/src/Core/Debug/OODebugStandards.m +++ b/src/Core/Debug/OODebugStandards.m @@ -32,7 +32,7 @@ of this software and associated documentation files (the "Software"), to deal #import "OOCollectionExtractors.h" #import "OOLogging.h" -#ifdef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED // in release mode, stubs void OOStandardsDeprecated(NSString* message) { } void OOStandardsError(NSString* message) { } diff --git a/src/Core/Debug/OODebugSupport.h b/src/Core/Debug/OODebugSupport.h index 42100f773f..d1a3df6e08 100644 --- a/src/Core/Debug/OODebugSupport.h +++ b/src/Core/Debug/OODebugSupport.h @@ -27,7 +27,7 @@ SOFTWARE. */ -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED void OOInitDebugSupport(void); diff --git a/src/Core/Debug/OODebugSupport.m b/src/Core/Debug/OODebugSupport.m index d3498252fc..24538683f7 100644 --- a/src/Core/Debug/OODebugSupport.m +++ b/src/Core/Debug/OODebugSupport.m @@ -25,7 +25,7 @@ of this software and associated documentation files (the "Software"), to deal */ -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED #import "OODebugSupport.h" #import "GameController.h" @@ -132,4 +132,4 @@ static id LoadDebugPlugIn() #endif -#endif /* NDEBUG */ +#endif /* OO_DEBUG_MONITOR_ENABLED */ diff --git a/src/Core/Debug/OODebugTCPConsoleClient.m b/src/Core/Debug/OODebugTCPConsoleClient.m index 4aae6ebd2d..8c7b285497 100644 --- a/src/Core/Debug/OODebugTCPConsoleClient.m +++ b/src/Core/Debug/OODebugTCPConsoleClient.m @@ -27,7 +27,7 @@ of this software and associated documentation files (the "Software"), to deal */ -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED #import "OODebugTCPConsoleClient.h" #import "NSDictionaryOOExtensions.h" @@ -671,4 +671,4 @@ static void LogSendPacket(NSDictionary* packet) } #endif -#endif /* NDEBUG */ +#endif /* OO_DEBUG_MONITOR_ENABLED */ diff --git a/src/Core/Debug/OOJSConsole.m b/src/Core/Debug/OOJSConsole.m index 5c0e50f815..0835fb9725 100644 --- a/src/Core/Debug/OOJSConsole.m +++ b/src/Core/Debug/OOJSConsole.m @@ -26,7 +26,7 @@ of this software and associated documentation files (the "Software"), to deal */ -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED #import "OOJSConsole.h" #import "OODebugMonitor.h" @@ -66,7 +66,7 @@ - (void)inspect; static JSBool ConsoleClearConsole(JSContext* context, uintN argc, jsval* vp); static JSBool ConsoleScriptStack(JSContext* context, uintN argc, jsval* vp); static JSBool ConsoleInspectEntity(JSContext* context, uintN argc, jsval* vp); -#if OO_DEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED static JSBool ConsoleCallObjCMethod(JSContext* context, uintN argc, jsval* vp); static JSBool ConsoleSetUpCallObjC(JSContext* context, uintN argc, jsval* vp); #endif @@ -184,7 +184,7 @@ - (void)inspect; { "clearConsole", ConsoleClearConsole, 0 }, { "scriptStack", ConsoleScriptStack, 0 }, { "inspectEntity", ConsoleInspectEntity, 1 }, -#if OO_DEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED { "__setUpCallObjC", ConsoleSetUpCallObjC, 1 }, #endif { "isExecutableJavaScript", ConsoleIsExecutableJavaScript, 2 }, @@ -292,7 +292,7 @@ static JSBool ConsoleGetProperty(JSContext* context, JSObject* this, jsid propID OOJS_NATIVE_ENTER(context) switch (JSID_TO_INT(propID)) { -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED case kConsole_debugFlags: *value = INT_TO_JSVAL((uint32_t)gDebugFlags); break; @@ -391,7 +391,7 @@ static JSBool ConsoleSetProperty(JSContext* context, JSObject* this, jsid propID NSString* sValue; switch (JSID_TO_INT(propID)) { -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED case kConsole_debugFlags: if (JS_ValueToInt32(context, *value, &iValue)) { gDebugFlags = iValue; @@ -693,7 +693,7 @@ static JSBool ConsoleInspectEntity(JSContext* context, uintN argc, jsval* vp) OOJS_NATIVE_EXIT } -#if OO_DEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED // function callObjC(selector : String [, ...]) : Object static JSBool ConsoleCallObjCMethod(JSContext* context, uintN argc, jsval* vp) { @@ -1050,4 +1050,4 @@ static JSBool PerformProfiling(JSContext* context, NSString* nominalFunction, ui #endif // OOJS_PROFILE -#endif /* NDEBUG */ +#endif /* OO_DEBUG_MONITOR_ENABLED */ diff --git a/src/Core/Debug/OOTCPStreamDecoder.c b/src/Core/Debug/OOTCPStreamDecoder.c index 5cc34d71aa..c64d72d2f2 100644 --- a/src/Core/Debug/OOTCPStreamDecoder.c +++ b/src/Core/Debug/OOTCPStreamDecoder.c @@ -25,7 +25,7 @@ SOFTWARE. */ -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED #include "OOTCPStreamDecoder.h" #include "OODebugTCPConsoleProtocol.h" @@ -219,4 +219,4 @@ static void Error(OOTCPStreamDecoderRef decoder, OOALStringRef format, ...) } } -#endif /* NDEBUG */ +#endif /* OO_DEBUG_MONITOR_ENABLED */ diff --git a/src/Core/Debug/OOTCPStreamDecoderAbstractionLayer.m b/src/Core/Debug/OOTCPStreamDecoderAbstractionLayer.m index 5bd1bae6a7..ee02fbbfd4 100644 --- a/src/Core/Debug/OOTCPStreamDecoderAbstractionLayer.m +++ b/src/Core/Debug/OOTCPStreamDecoderAbstractionLayer.m @@ -6,7 +6,7 @@ Foundation implementation. */ -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED #import "OOTCPStreamDecoderAbstractionLayer.h" #import "OOFoundation.h" @@ -109,4 +109,4 @@ OOALObjectRef OOALPropertyListFromData(OOALMutableDataRef data, OOALStringRef* e return result; } -#endif /* NDEBUG */ +#endif /* OO_DEBUG_MONITOR_ENABLED */ diff --git a/src/Core/Entities/DustEntity.m b/src/Core/Entities/DustEntity.m index 5c79004598..5d7ebd12b5 100644 --- a/src/Core/Entities/DustEntity.m +++ b/src/Core/Entities/DustEntity.m @@ -407,7 +407,7 @@ - (void)resetGraphicsState #endif } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSString*)descriptionForObjDump { // Don't include range and visibility flag as they're irrelevant. diff --git a/src/Core/Entities/Entity.h b/src/Core/Entities/Entity.h index 6dc030a187..f75710cc71 100644 --- a/src/Core/Entities/Entity.h +++ b/src/Core/Entities/Entity.h @@ -35,7 +35,7 @@ MA 02110-1301, USA. @class Universe, CollisionRegion, ShipEntity, OOVisualEffectEntity; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED extern uint32_t gLiveEntityCount; extern size_t gTotalEntityMemory; @@ -284,7 +284,7 @@ enum OOScanClass { - (void)setAtmosphereFogging:(OOColor*)fogging; - (OOColor*)fogUniform; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSString*)descriptionForObjDumpBasic; - (NSString*)descriptionForObjDump; diff --git a/src/Core/Entities/Entity.m b/src/Core/Entities/Entity.m index 8912306908..98642d9a10 100644 --- a/src/Core/Entities/Entity.m +++ b/src/Core/Entities/Entity.m @@ -39,7 +39,7 @@ #import "NSScannerOOExtensions.h" #import "OODebugFlags.h" -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED uint32_t gLiveEntityCount = 0; size_t gTotalEntityMemory = 0; #endif @@ -86,7 +86,7 @@ - (id)init atmosphereFogging = [[OOColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.0] retain]; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED gLiveEntityCount++; gTotalEntityMemory += [self oo_objectSize]; #endif @@ -104,7 +104,7 @@ - (void)dealloc [self setOwner:nil]; [atmosphereFogging release]; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED gLiveEntityCount--; gTotalEntityMemory -= [self oo_objectSize]; #endif @@ -998,7 +998,7 @@ - (OOColor*)fogUniform return [[atmosphereFogging retain] autorelease]; } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSString*)descriptionForObjDumpBasic { NSString* result = [self descriptionComponents]; diff --git a/src/Core/Entities/OOEntityWithDrawable.m b/src/Core/Entities/OOEntityWithDrawable.m index 8f24952909..0fadebe14d 100644 --- a/src/Core/Entities/OOEntityWithDrawable.m +++ b/src/Core/Entities/OOEntityWithDrawable.m @@ -112,7 +112,7 @@ - (void)drawImmediate:(bool)immediate translucent:(bool)translucent OOGLWireframeModeOff(); } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSSet*)allTextures { return [[self drawable] allTextures]; diff --git a/src/Core/Entities/OOLightParticleEntity.m b/src/Core/Entities/OOLightParticleEntity.m index aa3e1094ca..6f35abf551 100644 --- a/src/Core/Entities/OOLightParticleEntity.m +++ b/src/Core/Entities/OOLightParticleEntity.m @@ -319,7 +319,7 @@ - (BOOL)canCollide return NO; } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSSet*)allTextures { return [NSSet setWithObject:[self texture]]; diff --git a/src/Core/Entities/OOParticleSystem.m b/src/Core/Entities/OOParticleSystem.m index 9f72b9cd55..11b00f85c7 100644 --- a/src/Core/Entities/OOParticleSystem.m +++ b/src/Core/Entities/OOParticleSystem.m @@ -232,7 +232,7 @@ - (OOTexture*)texture return [OOLightParticleEntity defaultParticleTexture]; } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSSet*)allTextures { return [NSSet setWithObject:[OOLightParticleEntity defaultParticleTexture]]; diff --git a/src/Core/Entities/PlanetEntity.m b/src/Core/Entities/PlanetEntity.m index bbdfae0635..ea3e57412c 100644 --- a/src/Core/Entities/PlanetEntity.m +++ b/src/Core/Entities/PlanetEntity.m @@ -1473,7 +1473,7 @@ - (OOTexture*)cloudTextureWithCloudColor:(OOColor*)cloudColor cloudImpress:(GLfl return [OOTexture textureWithGenerator:loader]; } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSSet*)allTextures { if (_texture != nil) diff --git a/src/Core/Entities/PlayerEntity.h b/src/Core/Entities/PlayerEntity.h index eae1c946ac..fde780a188 100644 --- a/src/Core/Entities/PlayerEntity.h +++ b/src/Core/Entities/PlayerEntity.h @@ -654,7 +654,7 @@ typedef enum { NSArray* n_key_dec_field_of_view; #endif -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED NSArray* n_key_dump_target_state; NSArray* n_key_dump_entity_list; NSArray* n_key_debug_full; diff --git a/src/Core/Entities/PlayerEntity.m b/src/Core/Entities/PlayerEntity.m index 974af128d1..7e4c4d1afe 100644 --- a/src/Core/Entities/PlayerEntity.m +++ b/src/Core/Entities/PlayerEntity.m @@ -4395,7 +4395,7 @@ - (NSString*)dial_fpsinfo - (NSString*)dial_objinfo { NSString* result = [NSString stringWithFormat:@"Entities: %3zu", [UNIVERSE entityCount]]; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED result = [NSString stringWithFormat:@"%@ (%d, %zu KiB, avg %zu bytes)", result, gLiveEntityCount, gTotalEntityMemory >> 10, gTotalEntityMemory / gLiveEntityCount]; #endif diff --git a/src/Core/Entities/PlayerEntityControls.m b/src/Core/Entities/PlayerEntityControls.m index 8ff459e9ee..b084d6548b 100644 --- a/src/Core/Entities/PlayerEntityControls.m +++ b/src/Core/Entities/PlayerEntityControls.m @@ -92,7 +92,7 @@ static BOOL autopilot_key_pressed; static BOOL fast_autopilot_key_pressed; static BOOL docking_clearance_request_key_pressed; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED static BOOL dump_target_state_pressed; static BOOL dump_entity_list_pressed; #endif @@ -494,7 +494,7 @@ - (void)initKeyConfigSettings LOAD_KEY_SETTING2(n_key_dec_field_of_view, 'k', NO, NO, 0, NO, NO); #endif -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED LOAD_KEY_SETTING2(n_key_dump_target_state, 'H', YES, NO, 0, NO, NO); LOAD_KEY_SETTING2(n_key_dump_entity_list, '0', NO, NO, 0, NO, NO); LOAD_KEY_SETTING2(n_key_debug_full, 'd', NO, NO, 0, NO, NO); @@ -1604,7 +1604,7 @@ - (void)pollFlightControls:(double)delta_t } #endif -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED exceptionContext = @"dump target state"; if ([self checkKeyPress:n_key_dump_target_state]) { if (!dump_target_state_pressed) { @@ -1654,7 +1654,7 @@ - (void)pollFlightControls:(double)delta_t } exceptionContext = @"debug keys"; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED // look for debugging keys if ([self checkKeyPress:n_key_dump_entity_list] && ![gameView allowingStringInput]) // look for the '0' key { diff --git a/src/Core/Entities/ShipEntity.m b/src/Core/Entities/ShipEntity.m index d30460aea0..1a632b46c1 100644 --- a/src/Core/Entities/ShipEntity.m +++ b/src/Core/Entities/ShipEntity.m @@ -12928,7 +12928,7 @@ - (void)doNothing { } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSString*)descriptionForObjDump { NSString* desc = [super descriptionForObjDump]; diff --git a/src/Core/Entities/SkyEntity.m b/src/Core/Entities/SkyEntity.m index 02f18e3dc0..2657e61cf2 100644 --- a/src/Core/Entities/SkyEntity.m +++ b/src/Core/Entities/SkyEntity.m @@ -214,7 +214,7 @@ - (void)drawImmediate:(bool)immediate translucent:(bool)translucent OOCheckOpenGLErrors(@"SkyEntity after drawing %@", self); } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSString*)descriptionForObjDump { // Don't include range and visibility flag as they're irrelevant. diff --git a/src/Core/GameController.m b/src/Core/GameController.m index 07ad5d3cb6..253d301ec3 100644 --- a/src/Core/GameController.m +++ b/src/Core/GameController.m @@ -51,7 +51,7 @@ #import static void SetUpSparkle(void); -#elif (OOLITE_GNUSTEP && !defined(NDEBUG)) +#elif (OOLITE_GNUSTEP && defined(OO_DEBUG_MONITOR_ENABLED)) #import "OODebugMonitor.h" #endif @@ -773,7 +773,7 @@ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender - (void)exitAppWithContext:(NSString*)context { OOLog(@"exit.context", @"Exiting: %@.", context); -#if (OOLITE_GNUSTEP && !defined(NDEBUG)) +#if (OOLITE_GNUSTEP && defined(OO_DEBUG_MONITOR_ENABLED)) [[OODebugMonitor sharedDebugMonitor] applicationWillTerminate]; #endif #if OOLITE_WINDOWS diff --git a/src/Core/Materials/OOBasicMaterial.m b/src/Core/Materials/OOBasicMaterial.m index 85d476c4f8..f09361718c 100644 --- a/src/Core/Materials/OOBasicMaterial.m +++ b/src/Core/Materials/OOBasicMaterial.m @@ -304,7 +304,7 @@ - (BOOL)permitSpecular return ![UNIVERSE reducedDetail]; } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSSet*)allTextures { return [NSSet set]; diff --git a/src/Core/Materials/OOConcreteTexture.m b/src/Core/Materials/OOConcreteTexture.m index dda86b4a17..054d81ba16 100644 --- a/src/Core/Materials/OOConcreteTexture.m +++ b/src/Core/Materials/OOConcreteTexture.m @@ -129,7 +129,7 @@ - (id)initWithPath:(NSString*)path - (void)dealloc { -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED OOLog(_trace ? @"texture.allocTrace.dealloc" : @"texture.dealloc", @"Deallocating and uncaching texture %p", self); #endif @@ -394,7 +394,7 @@ - (void)setUpTexture } #endif -#if !defined(NDEBUG) && OOTEXTURE_RELOADABLE +#if defined(OO_DEBUG_MONITOR_ENABLED) && OOTEXTURE_RELOADABLE if (_trace) { static unsigned dumpID = 0; NSString* name = [NSString stringWithFormat:@"tex dump %u \"%@\"", ++dumpID, [self name]]; diff --git a/src/Core/Materials/OOMaterial.h b/src/Core/Materials/OOMaterial.h index c4aad0fe23..74aaa23d24 100644 --- a/src/Core/Materials/OOMaterial.h +++ b/src/Core/Materials/OOMaterial.h @@ -74,7 +74,7 @@ SOFTWARE. - (NSUInteger)countOfTextureUnitsWithBaseCoordinates; #endif -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSSet*)allTextures; #endif diff --git a/src/Core/Materials/OOMaterial.m b/src/Core/Materials/OOMaterial.m index 3942cf64d1..c2c6e87324 100644 --- a/src/Core/Materials/OOMaterial.m +++ b/src/Core/Materials/OOMaterial.m @@ -106,7 +106,7 @@ - (NSUInteger)countOfTextureUnitsWithBaseCoordinates } #endif -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSSet*)allTextures { return nil; diff --git a/src/Core/Materials/OOMultiTextureMaterial.m b/src/Core/Materials/OOMultiTextureMaterial.m index 843d6e4bdb..3a257d289d 100644 --- a/src/Core/Materials/OOMultiTextureMaterial.m +++ b/src/Core/Materials/OOMultiTextureMaterial.m @@ -190,7 +190,7 @@ - (void)unapplyWithNext:(OOMaterial*)next OOGL(glActiveTextureARB(GL_TEXTURE0_ARB)); } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSSet*)allTextures { if (_diffuseMap == nil) diff --git a/src/Core/Materials/OOShaderMaterial.m b/src/Core/Materials/OOShaderMaterial.m index 20f584dfd0..b23afda700 100644 --- a/src/Core/Materials/OOShaderMaterial.m +++ b/src/Core/Materials/OOShaderMaterial.m @@ -678,7 +678,7 @@ - (BOOL)permitSpecular return YES; } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSSet*)allTextures { return [NSSet setWithObjects:textures count:texCount]; diff --git a/src/Core/Materials/OOSingleTextureMaterial.m b/src/Core/Materials/OOSingleTextureMaterial.m index 4e69582a0a..32e175d0b8 100644 --- a/src/Core/Materials/OOSingleTextureMaterial.m +++ b/src/Core/Materials/OOSingleTextureMaterial.m @@ -105,7 +105,7 @@ - (BOOL)wantsNormalsAsTextureCoordinates return [_texture isCubeMap]; } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSSet*)allTextures { return [NSSet setWithObject:_texture]; diff --git a/src/Core/Materials/OOTexture.h b/src/Core/Materials/OOTexture.h index 13a96e60d2..bf7595c091 100644 --- a/src/Core/Materials/OOTexture.h +++ b/src/Core/Materials/OOTexture.h @@ -107,7 +107,7 @@ enum { typedef OOPixMapFormat OOTextureDataFormat; @interface OOTexture : OOWeakRefObject { -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED @protected BOOL _trace; #endif @@ -249,7 +249,7 @@ typedef OOPixMapFormat OOTextureDataFormat; // Called by OOGraphicsResetManager as necessary. + (void)rebindAllTextures; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (void)setTrace:(BOOL)trace; + (NSArray*)cachedTexturesByAge; diff --git a/src/Core/Materials/OOTexture.m b/src/Core/Materials/OOTexture.m index cf7c09d2be..59d11b530f 100644 --- a/src/Core/Materials/OOTexture.m +++ b/src/Core/Materials/OOTexture.m @@ -360,7 +360,7 @@ + (void)rebindAllTextures } } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (void)setTrace:(BOOL)trace { if (trace && !_trace) { diff --git a/src/Core/NSObjectOOExtensions.h b/src/Core/NSObjectOOExtensions.h index 464bbccf63..0375940b01 100644 --- a/src/Core/NSObjectOOExtensions.h +++ b/src/Core/NSObjectOOExtensions.h @@ -31,7 +31,7 @@ SOFTWARE. @interface NSObject (OOExtensions) -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED + (size_t)oo_instanceSize; - (size_t)oo_objectSize; diff --git a/src/Core/NSObjectOOExtensions.m b/src/Core/NSObjectOOExtensions.m index 55a36d1a2b..af6655067a 100644 --- a/src/Core/NSObjectOOExtensions.m +++ b/src/Core/NSObjectOOExtensions.m @@ -33,7 +33,7 @@ of this software and associated documentation files (the "Software"), to deal @implementation NSObject (OOExtensions) -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED + (size_t)oo_instanceSize { diff --git a/src/Core/OODrawable.h b/src/Core/OODrawable.h index 8267bcba65..f96abef87c 100644 --- a/src/Core/OODrawable.h +++ b/src/Core/OODrawable.h @@ -49,7 +49,7 @@ SOFTWARE. - (void)dumpSelfState; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSSet*)allTextures; - (size_t)totalSize; // Size including dynamic data, not counting textures. #endif diff --git a/src/Core/OODrawable.m b/src/Core/OODrawable.m index 44b3d5f76f..7d8209e1af 100644 --- a/src/Core/OODrawable.m +++ b/src/Core/OODrawable.m @@ -71,7 +71,7 @@ - (void)dumpSelfState { } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSSet*)allTextures { return nil; diff --git a/src/Core/OOLogHeader.m b/src/Core/OOLogHeader.m index 9831d0e051..da467e1439 100644 --- a/src/Core/OOLogHeader.m +++ b/src/Core/OOLogHeader.m @@ -114,7 +114,7 @@ void OOPrintLogHeader(void) @"heavy OpenGL error checking", #endif -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED @"JavaScript console support", #if OOLITE_MAC_OS_X // Under Mac OS X, Debug.oxp adds more than console support. diff --git a/src/Core/OOMesh.m b/src/Core/OOMesh.m index 5728b2d39c..493e6c969b 100644 --- a/src/Core/OOMesh.m +++ b/src/Core/OOMesh.m @@ -764,7 +764,7 @@ - (void)dumpSelfState } #endif -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSSet*)allTextures { NSMutableSet* result = [NSMutableSet set]; diff --git a/src/Core/OOPlanetDrawable.m b/src/Core/OOPlanetDrawable.m index 023656dc80..eeea695b30 100644 --- a/src/Core/OOPlanetDrawable.m +++ b/src/Core/OOPlanetDrawable.m @@ -374,7 +374,9 @@ - (void)debugDrawNormals OODebugEndWireframe(state); } +#endif +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSSet*)allTextures { return [[self material] allTextures]; diff --git a/src/Core/OOSkyDrawable.m b/src/Core/OOSkyDrawable.m index 756cc90e05..6cc08eb9df 100644 --- a/src/Core/OOSkyDrawable.m +++ b/src/Core/OOSkyDrawable.m @@ -81,7 +81,7 @@ - (id)initWithQuadsWithTexture:(OOTexture*)texture inArray:(OOSkyQuadDesc*)array - (void)render; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (size_t)totalSize; - (OOTexture*)texture; #endif @@ -230,7 +230,7 @@ - (GLfloat)maxDrawDistance return INFINITY; } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSSet*)allTextures { NSMutableSet* result = [NSMutableSet setWithCapacity:[_quadSets count]]; @@ -645,7 +645,7 @@ - (void)render OOGL(glDrawArrays(GL_QUADS, 0, 4 * _count)); } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (size_t)totalSize { return [self oo_objectSize] + _count * 4 * (sizeof *_positions + sizeof *_texCoords + sizeof *_colors); diff --git a/src/Core/Octree.h b/src/Core/Octree.h index 20b1928352..b86b04b4f8 100644 --- a/src/Core/Octree.h +++ b/src/Core/Octree.h @@ -72,7 +72,7 @@ MA 02110-1301, USA. - (Vector)randomPoint; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (size_t)totalSize; #endif diff --git a/src/Core/Octree.m b/src/Core/Octree.m index 89e8065bdc..e6b7b27fbc 100644 --- a/src/Core/Octree.m +++ b/src/Core/Octree.m @@ -718,7 +718,7 @@ - (Vector)randomPoint return randomFullNodeFrom([self octreeDetails], kZeroVector); } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (size_t)totalSize { return [self oo_objectSize] + _nodeCount * [_data oo_objectSize] + [_data length] + _nodeCount * sizeof *_collisionOctree; diff --git a/src/Core/Scripting/OOJSCall.h b/src/Core/Scripting/OOJSCall.h index fb5bee2846..4e4be6417a 100644 --- a/src/Core/Scripting/OOJSCall.h +++ b/src/Core/Scripting/OOJSCall.h @@ -24,7 +24,7 @@ MA 02110-1301, USA. */ -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED #import #include diff --git a/src/Core/Scripting/OOJSCall.m b/src/Core/Scripting/OOJSCall.m index 5656bbab5d..b46dadb2b3 100644 --- a/src/Core/Scripting/OOJSCall.m +++ b/src/Core/Scripting/OOJSCall.m @@ -24,7 +24,7 @@ */ -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED #import "OOJSCall.h" #import "OOJavaScriptEngine.h" diff --git a/src/Core/Scripting/OOJSEngineDebuggerHelpers.m b/src/Core/Scripting/OOJSEngineDebuggerHelpers.m index bf4f3fcf35..ec41505009 100644 --- a/src/Core/Scripting/OOJSEngineDebuggerHelpers.m +++ b/src/Core/Scripting/OOJSEngineDebuggerHelpers.m @@ -78,7 +78,7 @@ to use them in data formatters (by double-clicking the "Summary" field for Mac-specific/DataFormatters. */ -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED #import "OOJavaScriptEngine.h" diff --git a/src/Core/Scripting/OOJSEngineTimeManagement.m b/src/Core/Scripting/OOJSEngineTimeManagement.m index 3e8304e77f..d6d20c59f8 100644 --- a/src/Core/Scripting/OOJSEngineTimeManagement.m +++ b/src/Core/Scripting/OOJSEngineTimeManagement.m @@ -216,7 +216,7 @@ static JSBool OperationCallback(JSContext* context) return YES; OOLogERR(@"script.javaScript.timeLimit", @"Script \"%@\" ran for %g seconds and has been terminated.", [[OOJSScript currentlyRunningScript] name], elapsed); -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED OOJSDumpStack(context); #endif diff --git a/src/Core/Scripting/OOJSEntity.m b/src/Core/Scripting/OOJSEntity.m index 1d56e0e515..12960642cc 100644 --- a/src/Core/Scripting/OOJSEntity.m +++ b/src/Core/Scripting/OOJSEntity.m @@ -37,7 +37,7 @@ static JSBool EntityGetProperty(JSContext* context, JSObject* this, jsid propID, jsval* value); static JSBool EntitySetProperty(JSContext* context, JSObject* this, jsid propID, JSBool strict, jsval* value); -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED static JSBool EntityDumpState(JSContext* context, uintN argc, jsval* vp); #endif @@ -118,7 +118,7 @@ static JSFunctionSpec sEntityMethods[] = { // JS name Function min args { "toString", OOJSObjectWrapperToString, 0 }, -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED { "dumpState", EntityDumpState, 0 }, #endif { 0 } @@ -372,7 +372,7 @@ static JSBool EntitySetProperty(JSContext* context, JSObject* this, jsid propID, OOJS_NATIVE_EXIT } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED static JSBool EntityDumpState(JSContext* context, uintN argc, jsval* vp) { OOJS_PROFILE_ENTER diff --git a/src/Core/Scripting/OOJSGlobal.m b/src/Core/Scripting/OOJSGlobal.m index ac7d596bcf..20c59afba5 100644 --- a/src/Core/Scripting/OOJSGlobal.m +++ b/src/Core/Scripting/OOJSGlobal.m @@ -55,7 +55,7 @@ - (void)sendMonitorLogMessage:(NSString*)message static NSString* const kOOLogDebugMessage = @"script.debug.message"; static JSBool GlobalGetProperty(JSContext* context, JSObject* this, jsid propID, jsval* value); -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED static JSBool GlobalSetProperty(JSContext* context, JSObject* this, jsid propID, JSBool strict, jsval* value); #endif @@ -78,7 +78,7 @@ - (void)sendMonitorLogMessage:(NSString*)message static JSBool GlobalSetExtraGuiScreenKeys(JSContext* context, uintN argc, jsval* vp); static JSBool GlobalClearExtraGuiScreenKeys(JSContext* context, uintN argc, jsval* vp); -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED static JSBool GlobalTakeSnapShot(JSContext* context, uintN argc, jsval* vp); #endif @@ -89,7 +89,7 @@ - (void)sendMonitorLogMessage:(NSString*)message JS_PropertyStub, JS_PropertyStub, GlobalGetProperty, -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED GlobalSetProperty, #else // No writeable properties in non-debug builds @@ -106,7 +106,7 @@ - (void)sendMonitorLogMessage:(NSString*)message kGlobal_galaxyNumber, // galaxy number, integer, read-only kGlobal_global, // global.global.global.global, integer, read-only kGlobal_guiScreen, // current GUI screen, string, read-only -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED kGlobal_timeAccelerationFactor // time acceleration, float, read/write #endif }; @@ -115,7 +115,7 @@ - (void)sendMonitorLogMessage:(NSString*)message // JS name ID flags { "galaxyNumber", kGlobal_galaxyNumber, OOJS_PROP_READONLY_CB }, { "guiScreen", kGlobal_guiScreen, OOJS_PROP_READONLY_CB }, -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED { "timeAccelerationFactor", kGlobal_timeAccelerationFactor, OOJS_PROP_READWRITE_CB }, #endif { 0 } @@ -140,7 +140,7 @@ - (void)sendMonitorLogMessage:(NSString*)message { "setExtraGuiScreenKeys", GlobalSetExtraGuiScreenKeys, 2 }, { "clearExtraGuiScreenKeys", GlobalClearExtraGuiScreenKeys, 2 }, -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED { "takeSnapShot", GlobalTakeSnapShot, 1 }, { "quitGame", GlobalQuitGame, 0 }, #endif @@ -182,7 +182,7 @@ static JSBool GlobalGetProperty(JSContext* context, JSObject* this, jsid propID, *value = OOJSValueFromGUIScreenID(context, [player guiScreen]); return YES; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED case kGlobal_timeAccelerationFactor: return JS_NewNumberValue(context, [UNIVERSE timeAccelerationFactor], value); #endif @@ -195,7 +195,7 @@ static JSBool GlobalGetProperty(JSContext* context, JSObject* this, jsid propID, OOJS_NATIVE_EXIT } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED static JSBool GlobalSetProperty(JSContext* context, JSObject* this, jsid propID, JSBool strict, jsval* value) { if (!JSID_IS_INT(propID)) @@ -688,7 +688,7 @@ static JSBool GlobalSetGuiColorSettingForKey(JSContext* context, uintN argc, jsv OOJS_NATIVE_EXIT } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED // takeSnapShot([name : alphanumeric String]) : Boolean static JSBool GlobalTakeSnapShot(JSContext* context, uintN argc, jsval* vp) { diff --git a/src/Core/Scripting/OOJSMissionVariables.m b/src/Core/Scripting/OOJSMissionVariables.m index 15c1b7cbd8..6358fa63c2 100644 --- a/src/Core/Scripting/OOJSMissionVariables.m +++ b/src/Core/Scripting/OOJSMissionVariables.m @@ -46,7 +46,7 @@ static JSBool MissionVariablesSetProperty(JSContext* context, JSObject* this, jsid propID, JSBool strict, jsval* value); static JSBool MissionVariablesEnumerate(JSContext* context, JSObject* object, JSIterateOp enumOp, jsval* state, jsid* idp); -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED static id MissionVariablesConverter(JSContext* context, JSObject* object); #endif @@ -68,13 +68,13 @@ void InitOOJSMissionVariables(JSContext* context, JSObject* global) { JS_DefineObject(context, global, "missionVariables", &sMissionVariablesClass, NULL, OOJS_PROP_READONLY); -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED // Allow callObjC() on missionVariables to call methods on the mission variables dictionary. OOJSRegisterObjectConverter(&sMissionVariablesClass, MissionVariablesConverter); #endif } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED static id MissionVariablesConverter(JSContext* context, JSObject* object) { return [PLAYER missionVariables]; diff --git a/src/Core/Scripting/OOJSOolite.m b/src/Core/Scripting/OOJSOolite.m index a938e41cbc..32eaa9e56c 100644 --- a/src/Core/Scripting/OOJSOolite.m +++ b/src/Core/Scripting/OOJSOolite.m @@ -68,7 +68,7 @@ JavaScript proxy for Oolite (for version checking and similar). kOolite_postFX, // current post processing effect, integer, read/write kOolite_hdrToneMapper, // currently active HDR tone mapper, string, read/write kOolite_sdrToneMapper, // currently active SDR tone mapper, string, read/write -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED kOolite_timeAccelerationFactor, // time acceleration, float, read/write #endif }; @@ -85,7 +85,7 @@ JavaScript proxy for Oolite (for version checking and similar). { "postFX", kOolite_postFX, OOJS_PROP_READWRITE_CB }, { "hdrToneMapper", kOolite_hdrToneMapper, OOJS_PROP_READWRITE_CB }, { "sdrToneMapper", kOolite_sdrToneMapper, OOJS_PROP_READWRITE_CB }, -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED { "timeAccelerationFactor", kOolite_timeAccelerationFactor, OOJS_PROP_READWRITE_CB }, #endif { 0 } @@ -166,7 +166,7 @@ static JSBool OoliteGetProperty(JSContext* context, JSObject* this, jsid propID, break; } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED case kOolite_timeAccelerationFactor: return JS_NewNumberValue(context, [UNIVERSE timeAccelerationFactor], value); #endif @@ -239,7 +239,7 @@ static JSBool OoliteSetProperty(JSContext* context, JSObject* this, jsid propID, } break; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED case kOolite_timeAccelerationFactor: if (JS_ValueToNumber(context, *value, &fValue)) { [UNIVERSE setTimeAccelerationFactor:fValue]; diff --git a/src/Core/Scripting/OOJSSpecialFunctions.m b/src/Core/Scripting/OOJSSpecialFunctions.m index ad35487a25..27113812db 100644 --- a/src/Core/Scripting/OOJSSpecialFunctions.m +++ b/src/Core/Scripting/OOJSSpecialFunctions.m @@ -27,14 +27,14 @@ #include static JSBool SpecialJSWarning(JSContext* context, uintN argc, jsval* vp); -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED static JSBool SpecialMarkConsoleEntryPoint(JSContext* context, uintN argc, jsval* vp); #endif static JSFunctionSpec sSpecialFunctionsMethods[] = { // JS name Function min args { "jsWarning", SpecialJSWarning, 1 }, -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED { "markConsoleEntryPoint", SpecialMarkConsoleEntryPoint, 0 }, #endif { 0 } @@ -86,7 +86,7 @@ static JSBool SpecialJSWarning(JSContext* context, uintN argc, jsval* vp) OOJS_PROFILE_EXIT } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED static JSBool SpecialMarkConsoleEntryPoint(JSContext* context, uintN argc, jsval* vp) { // First stack frame will be in eval() in console.script.evaluate(), unless someone is playing silly buggers. diff --git a/src/Core/Scripting/OOJavaScriptEngine.h b/src/Core/Scripting/OOJavaScriptEngine.h index 298503b31e..1d649de43c 100644 --- a/src/Core/Scripting/OOJavaScriptEngine.h +++ b/src/Core/Scripting/OOJavaScriptEngine.h @@ -30,7 +30,7 @@ MA 02110-1301, USA. #import "Universe.h" #include -#define OOJSENGINE_MONITOR_SUPPORT OOLITE_DEBUG +#define OOJSENGINE_MONITOR_SUPPORT OO_DEBUG_MONITOR_ENABLED #import "OOJSPropID.h" @@ -48,7 +48,7 @@ MA 02110-1301, USA. JSClass* _numberClass; JSClass* _booleanClass; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED BOOL _dumpStackForErrors; BOOL _dumpStackForWarnings; #endif @@ -89,7 +89,7 @@ MA 02110-1301, USA. - (JSClass*)numberClass; - (JSClass*)booleanClass; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (BOOL)dumpStackForErrors; - (void)setDumpStackForErrors:(BOOL)value; @@ -124,7 +124,7 @@ OOINLINE JSContext* OOJSAcquireContext(void) // End a request on the main thread's context. OOINLINE void OOJSRelinquishContext(JSContext* context) { -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED extern JSContext* gOOJSMainThreadContext; NSCParameterAssert(context == gOOJSMainThreadContext && JS_IsInRequest(context)); #endif @@ -496,7 +496,7 @@ void OOJSRegisterObjectConverter(JSClass* theClass, OOJSClassConverterCallback c In debug builds, this will deliberately cause an error if name is not a string literal. */ -#ifdef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED #define OOJSAddGCValueRoot(context, root, name) JS_AddValueRoot((context), (root)) #define OOJSAddGCStringRoot(context, root, name) JS_AddStringRoot((context), (root)) #define OOJSAddGCObjectRoot(context, root, name) JS_AddObjectRoot((context), (root)) diff --git a/src/Core/Scripting/OOJavaScriptEngine.m b/src/Core/Scripting/OOJavaScriptEngine.m index 7d1ea59a29..95af360cb1 100644 --- a/src/Core/Scripting/OOJavaScriptEngine.m +++ b/src/Core/Scripting/OOJavaScriptEngine.m @@ -206,7 +206,7 @@ static void ReportJSError(JSContext* context, const char* message, JSErrorReport } } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED BOOL dump; if (report->flags & JSREPORT_WARNING) dump = [jsEng dumpStackForWarnings]; @@ -258,7 +258,7 @@ - (id)init JS_SetCStringsAreUTF8(); NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED /* Set stack trace preferences from preferences. These will be overriden by the debug OXP script if installed, but being able to enable traces without setting up the debug console could be useful for debugging @@ -585,7 +585,7 @@ - (void)registerStandardObjectConverters OOJSRegisterObjectConverter([self booleanClass], JSBooleanConverter); } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED static JSTrapStatus DebuggerHook(JSContext* context, JSScript* script, jsbytecode* pc, jsval* rval, void* closure) { OOJSPauseTimeLimiter(); diff --git a/src/Core/Universe.h b/src/Core/Universe.h index 865b945347..3deb051db4 100644 --- a/src/Core/Universe.h +++ b/src/Core/Universe.h @@ -299,7 +299,7 @@ enum { BOOL no_update; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED double timeAccelerationFactor; #endif @@ -393,7 +393,7 @@ enum { - (BOOL)doingStartUp; // True during initial game startup (not reset). - (NSUInteger)entityCount; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (void)debugDumpEntities; - (NSArray*)entityList; #endif diff --git a/src/Core/Universe.m b/src/Core/Universe.m index 3f2dd14807..308220e4f7 100644 --- a/src/Core/Universe.m +++ b/src/Core/Universe.m @@ -947,7 +947,7 @@ - (NSUInteger)entityCount return [entities count]; } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (void)debugDumpEntities { int i; @@ -6655,7 +6655,7 @@ - (void)update:(OOTimeDelta)inDeltaT OOLog(@"universe.profile.update", @"%@", @"Update complete"); } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (double)timeAccelerationFactor { return timeAccelerationFactor; @@ -9253,7 +9253,7 @@ - (void)setUpSettings // time_delta = 0.0; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED [self setTimeAccelerationFactor:TIME_ACCELERATION_FACTOR_DEFAULT]; #endif universal_time = 0.0; diff --git a/src/SDL/main.m b/src/SDL/main.m index 1e85444e9e..3899e85c29 100644 --- a/src/SDL/main.m +++ b/src/SDL/main.m @@ -46,7 +46,7 @@ GameController* controller; #endif -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED uint32_t gDebugFlags = 0; #endif From 8ca4fc3573947cb1a5c8116464ab3e68584a506f Mon Sep 17 00:00:00 2001 From: mcarans Date: Tue, 29 Sep 2026 17:45:20 +1300 Subject: [PATCH 2/6] More things for debug console debugging functionality --- ShellScripts/common/post_build.sh | 10 ++++------ src/Core/CollisionRegion.m | 6 +++--- src/Core/Entities/DockEntity.m | 2 +- src/Core/Entities/DustEntity.m | 2 +- src/Core/Entities/Entity.m | 14 +++++++------- src/Core/Entities/OOSunEntity.m | 2 +- src/Core/Entities/PlanetEntity.m | 2 +- src/Core/Entities/PlayerEntity.m | 2 +- src/Core/Entities/ShipEntity.h | 2 +- src/Core/Entities/ShipEntity.m | 12 ++++++------ src/Core/Materials/OOShaderMaterial.m | 2 +- src/Core/Materials/OOShaderProgram.m | 2 +- src/Core/Materials/OOShaderUniformMethodType.h | 2 +- src/Core/Materials/OOShaderUniformMethodType.m | 2 +- src/Core/OODebugGLDrawing.h | 2 +- src/Core/OOMesh.m | 8 ++++---- src/Core/OOPlanetDrawable.m | 6 +++--- src/Core/Octree.h | 2 +- src/Core/Octree.m | 2 +- 19 files changed, 40 insertions(+), 42 deletions(-) diff --git a/ShellScripts/common/post_build.sh b/ShellScripts/common/post_build.sh index 4a65d39730..6d2d1a2810 100755 --- a/ShellScripts/common/post_build.sh +++ b/ShellScripts/common/post_build.sh @@ -38,12 +38,10 @@ run_script() { return 1 fi generate_manifest "$resourcesdir/manifest.plist" "$deployment_release" "$ver_full" "$ver_quad" "$ver_githash" "$buildtime" - if [[ "$deployment_release" == "no" ]]; then - local addonsdir="$progdir/AddOns" - mkdir -p "$addonsdir" - rm -rf "$addonsdir/Basic-debug.oxp" - cp -rf DebugOXP/Debug.oxp "$addonsdir/Basic-debug.oxp" - fi + local addonsdir="$progdir/AddOns" + mkdir -p "$addonsdir" + rm -rf "$addonsdir/Basic-debug.oxp" + cp -rf DebugOXP/Debug.oxp "$addonsdir/Basic-debug.oxp" # Voice Data if [[ "$espeak" == "yes" ]]; then diff --git a/src/Core/CollisionRegion.m b/src/Core/CollisionRegion.m index 73d332b92c..e32e7fa408 100644 --- a/src/Core/CollisionRegion.m +++ b/src/Core/CollisionRegion.m @@ -250,7 +250,7 @@ - (void)findCollisions } } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED if (gDebugFlags & DEBUG_COLLISIONS) { OOLog(@"collisionRegion.debug", @"DEBUG in collision region %@ testing %d out of %d entities", self, n_entities_to_test, n_entities); } @@ -297,7 +297,7 @@ - (void)findCollisions dist2 = HPdistance2(e2->position, p1); min_dist2 = r0 * r0; if (dist2 < PROXIMITY_WARN_DISTANCE2 * min_dist2) { -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED if (gDebugFlags & DEBUG_COLLISIONS) { OOLog(@"collisionRegion.debug", @"DEBUG Testing collision between %@ (%@) and %@ (%@)", e1, (e1->collisionTestFilter == 3) ? @"YES" : @"NO", e2, (e2->collisionTestFilter == 3) ? @"YES" : @"NO"); @@ -366,7 +366,7 @@ - (void)findCollisions } } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED if (gDebugFlags & DEBUG_COLLISIONS) { OOLog(@"collisionRegion.debug", @"Collision test checks %d, within range %d, for %d entities", checks_this_tick, checks_within_range, n_entities_to_test); } diff --git a/src/Core/Entities/DockEntity.m b/src/Core/Entities/DockEntity.m index 37afc768f1..5553dc3382 100644 --- a/src/Core/Entities/DockEntity.m +++ b/src/Core/Entities/DockEntity.m @@ -650,7 +650,7 @@ - (BOOL)shipIsInDockingCorridor:(ShipEntity*)ship ww *= 0.5; hh *= 0.5; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED if ([ship isPlayer] && (gDebugFlags & DEBUG_DOCKING)) { BOOL inLane; float range; diff --git a/src/Core/Entities/DustEntity.m b/src/Core/Entities/DustEntity.m index 5d7ebd12b5..7e17bbeb84 100644 --- a/src/Core/Entities/DustEntity.m +++ b/src/Core/Entities/DustEntity.m @@ -256,7 +256,7 @@ - (void)drawImmediate:(bool)immediate translucent:(bool)translucent PlayerEntity* player = PLAYER; assert(player != nil); -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED if (gDebugFlags & DEBUG_NO_DUST) return; #endif diff --git a/src/Core/Entities/Entity.m b/src/Core/Entities/Entity.m index 98642d9a10..cbcf087e16 100644 --- a/src/Core/Entities/Entity.m +++ b/src/Core/Entities/Entity.m @@ -44,7 +44,7 @@ size_t gTotalEntityMemory = 0; #endif -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED static NSString* const kOOLogEntityAddToList = @"entity.linkedList.add"; static NSString* const kOOLogEntityAddToListError = @"entity.linkedList.add.error"; static NSString* const kOOLogEntityRemoveFromList = @"entity.linkedList.remove"; @@ -206,7 +206,7 @@ - (BOOL)validForAddToUniverse - (void)addToLinkedLists { -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED if (gDebugFlags & DEBUG_LINKED_LISTS) OOLog(kOOLogEntityAddToList, @"DEBUG adding entity %@ to linked lists", self); #endif @@ -256,7 +256,7 @@ - (void)addToLinkedLists UNIVERSE->z_list_start = self; } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED if (gDebugFlags & DEBUG_LINKED_LISTS) { if (![self checkLinkedLists]) { OOLog(kOOLogEntityAddToListError, @"DEBUG LINKED LISTS - problem encountered while adding %@ to linked lists", self); @@ -268,7 +268,7 @@ - (void)addToLinkedLists - (void)removeFromLinkedLists { -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED if (gDebugFlags & DEBUG_LINKED_LISTS) OOLog(kOOLogEntityRemoveFromList, @"DEBUG removing entity %@ from linked lists", self); #endif @@ -308,7 +308,7 @@ - (void)removeFromLinkedLists z_previous = nil; z_next = nil; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED if (gDebugFlags & DEBUG_LINKED_LISTS) { if (![self checkLinkedLists]) { OOLog(kOOLogEntityRemoveFromListError, @"DEBUG LINKED LISTS - problem encountered while removing %@ from linked lists", self); @@ -397,7 +397,7 @@ - (void)updateLinkedLists if ((x_next == nil) && (x_previous == nil)) return; // not in the lists - don't do this! -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED if (gDebugFlags & DEBUG_LINKED_LISTS) { if (![self checkLinkedLists]) { OOLog(kOOLogEntityVerificationError, @"DEBUG LINKED LISTS problem encountered before updating linked lists for %@", self); @@ -476,7 +476,7 @@ - (void)updateLinkedLists UNIVERSE->z_list_start = self; // done -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED if (gDebugFlags & DEBUG_LINKED_LISTS) { if (![self checkLinkedLists]) { OOLog(kOOLogEntityUpdateError, @"DEBUG LINKED LISTS problem encountered after updating linked lists for %@", self); diff --git a/src/Core/Entities/OOSunEntity.m b/src/Core/Entities/OOSunEntity.m index da739c53eb..8ea6725705 100644 --- a/src/Core/Entities/OOSunEntity.m +++ b/src/Core/Entities/OOSunEntity.m @@ -223,7 +223,7 @@ - (BOOL)canCollide return YES; } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (BOOL)checkCloseCollisionWith:(Entity*)other { if (gDebugFlags & DEBUG_COLLISIONS) { diff --git a/src/Core/Entities/PlanetEntity.m b/src/Core/Entities/PlanetEntity.m index ea3e57412c..69debf644b 100644 --- a/src/Core/Entities/PlanetEntity.m +++ b/src/Core/Entities/PlanetEntity.m @@ -605,7 +605,7 @@ - (BOOL)canCollide - (BOOL)checkCloseCollisionWith:(Entity*)other { -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED if (gDebugFlags & DEBUG_COLLISIONS) OOLog(@"planet.collide", @"PLANET Collision!"); #endif diff --git a/src/Core/Entities/PlayerEntity.m b/src/Core/Entities/PlayerEntity.m index 7e4c4d1afe..2b0a02a00e 100644 --- a/src/Core/Entities/PlayerEntity.m +++ b/src/Core/Entities/PlayerEntity.m @@ -11790,7 +11790,7 @@ - (BOOL)setExtraGuiScreenKeys:(OOGUIScreenID)gui definition:(OOJSGuiScreenKeyDef return result; } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (void)dumpSelfState { NSMutableArray* flags = nil; diff --git a/src/Core/Entities/ShipEntity.h b/src/Core/Entities/ShipEntity.h index c026b83d07..75a6a2cbd7 100644 --- a/src/Core/Entities/ShipEntity.h +++ b/src/Core/Entities/ShipEntity.h @@ -410,7 +410,7 @@ typedef enum { // Collision detection Octree* octree; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED // DEBUGGING OOBehaviour debugLastBehaviour; #endif diff --git a/src/Core/Entities/ShipEntity.m b/src/Core/Entities/ShipEntity.m index 1a632b46c1..5cd2deec21 100644 --- a/src/Core/Entities/ShipEntity.m +++ b/src/Core/Entities/ShipEntity.m @@ -96,7 +96,7 @@ #define USEMASC 1 static NSString* const kOOLogSyntaxAddShips = @"script.debug.syntax.addShips"; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED static NSString* const kOOLogEntityBehaviourChanged = @"entity.behaviour.changed"; #endif @@ -2202,7 +2202,7 @@ - (void)update:(OOTimeDelta)delta_t } // end if !isSubEntity -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED // DEBUGGING if (reportAIMessages && (debugLastBehaviour != behaviour)) { OOLog(kOOLogEntityBehaviourChanged, @"%@ behaviour is now %@", self, OOStringFromBehaviour(behaviour)); @@ -5494,7 +5494,7 @@ - (void)drawImmediate:(bool)immediate translucent:(bool)translucent // Draw self. [super drawImmediate:immediate translucent:translucent]; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED // Draw bounding boxes if we have to before going for the subentities. // TODO: the translucent flag here makes very little sense. Something's wrong with the matrices. if (translucent) @@ -5519,7 +5519,7 @@ - (void)drawImmediate:(bool)immediate translucent:(bool)translucent } } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (void)drawDebugStuff { // HPVect: imprecise here - needs camera relative @@ -5561,7 +5561,7 @@ - (void)drawSubEntityImmediate:(bool)immediate translucent:(bool)translucent OOGLMultModelView(rotMatrix); [self drawImmediate:immediate translucent:translucent]; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED if (gDebugFlags & DEBUG_BOUNDING_BOXES) { OODebugDrawBoundingBox([self boundingBox]); } @@ -12628,7 +12628,7 @@ - (void)pilotArrived } #endif -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (void)dumpSelfState { NSMutableArray* flags = nil; diff --git a/src/Core/Materials/OOShaderMaterial.m b/src/Core/Materials/OOShaderMaterial.m index b23afda700..b928168656 100644 --- a/src/Core/Materials/OOShaderMaterial.m +++ b/src/Core/Materials/OOShaderMaterial.m @@ -182,7 +182,7 @@ - (id)initWithName:(NSString*)name { BOOL canFallBack = ![modifiedMacros oo_boolForKey:@"OO_REDUCED_COMPLEXITY"]; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED if (gDebugFlags & DEBUG_NO_SHADER_FALLBACK) canFallBack = NO; #endif if (canFallBack) diff --git a/src/Core/Materials/OOShaderProgram.m b/src/Core/Materials/OOShaderProgram.m index aba4eee5ec..8a34506693 100644 --- a/src/Core/Materials/OOShaderProgram.m +++ b/src/Core/Materials/OOShaderProgram.m @@ -249,7 +249,7 @@ static BOOL ValidateShaderObject(GLhandleARB object, NSString* name) return NO; } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED if (gDebugFlags & DEBUG_SHADER_VALIDATION && 0) { OOGL(glValidateProgramARB(object)); OOGL(glGetObjectParameterivARB(object, GL_OBJECT_VALIDATE_STATUS_ARB, &status)); diff --git a/src/Core/Materials/OOShaderUniformMethodType.h b/src/Core/Materials/OOShaderUniformMethodType.h index e748c0b84d..a47d7eff99 100644 --- a/src/Core/Materials/OOShaderUniformMethodType.h +++ b/src/Core/Materials/OOShaderUniformMethodType.h @@ -30,7 +30,7 @@ SOFTWARE. #import "OOOpenGLExtensionManager.h" -#if OO_SHADERS || !defined(NDEBUG) +#if OO_SHADERS || defined(OO_DEBUG_MONITOR_ENABLED) #import "OOMaths.h" diff --git a/src/Core/Materials/OOShaderUniformMethodType.m b/src/Core/Materials/OOShaderUniformMethodType.m index 6d710edf74..b9dda20187 100644 --- a/src/Core/Materials/OOShaderUniformMethodType.m +++ b/src/Core/Materials/OOShaderUniformMethodType.m @@ -46,7 +46,7 @@ of this software and associated documentation files (the "Software"), to deal #import "OOShaderUniformMethodType.h" -#if OO_SHADERS || !defined(NDEBUG) +#if OO_SHADERS || defined(OO_DEBUG_MONITOR_ENABLED) #import "OOMaths.h" diff --git a/src/Core/OODebugGLDrawing.h b/src/Core/OODebugGLDrawing.h index 2887bfb526..52a0f6c380 100644 --- a/src/Core/OODebugGLDrawing.h +++ b/src/Core/OODebugGLDrawing.h @@ -31,7 +31,7 @@ SOFTWARE. #import "OOColor.h" #import "OOMaths.h" -#if !defined(OODEBUGLDRAWING_DISABLE) && defined(NDEBUG) +#if !defined(OODEBUGLDRAWING_DISABLE) && !defined(OO_DEBUG_MONITOR_ENABLED) #define OODEBUGLDRAWING_DISABLE 1 #endif diff --git a/src/Core/OOMesh.m b/src/Core/OOMesh.m index 493e6c969b..bb32026cde 100644 --- a/src/Core/OOMesh.m +++ b/src/Core/OOMesh.m @@ -152,7 +152,7 @@ - (void)calculateBoundingVolumes; - (void)rescaleByFactor:(GLfloat)factor; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (void)debugDrawNormals; #endif @@ -513,7 +513,7 @@ - (void)renderOpaqueParts OOGL(glDisableClientState(GL_TEXTURE_COORD_ARRAY)); #endif -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED if (gDebugFlags & DEBUG_DRAW_NORMALS) [self debugDrawNormals]; if (gDebugFlags & DEBUG_OCTREE_DRAW) @@ -752,7 +752,7 @@ - (void)setBindingTarget:(id)target } } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (void)dumpSelfState { [super dumpSelfState]; @@ -1852,7 +1852,7 @@ - (BoundingBox)boundingBox return boundingBox; } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (void)debugDrawNormals { GLuint i; diff --git a/src/Core/OOPlanetDrawable.m b/src/Core/OOPlanetDrawable.m index eeea695b30..5e2925a488 100644 --- a/src/Core/OOPlanetDrawable.m +++ b/src/Core/OOPlanetDrawable.m @@ -33,7 +33,7 @@ #import "OOSingleTextureMaterial.h" #import "Universe.h" -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED #import "Entity.h" #import "OODebugFlags.h" #import "OODebugGLDrawing.h" @@ -272,7 +272,7 @@ - (void)renderCommonParts #endif OOGLPopModelView(); -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED if (gDebugFlags & DEBUG_DRAW_NORMALS) [self debugDrawNormals]; #endif @@ -326,7 +326,7 @@ - (void)recalculateTransform _transform = OOMatrixForScaleUniform(_radius); } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (void)debugDrawNormals { diff --git a/src/Core/Octree.h b/src/Core/Octree.h index b86b04b4f8..7ca87531b6 100644 --- a/src/Core/Octree.h +++ b/src/Core/Octree.h @@ -30,7 +30,7 @@ MA 02110-1301, USA. #define OCTREE_MIN_HALF_WIDTH 1.0 -#if !defined(OODEBUGLDRAWING_DISABLE) && defined(NDEBUG) +#if !defined(OODEBUGLDRAWING_DISABLE) && !defined(OO_DEBUG_MONITOR_ENABLED) #define OODEBUGLDRAWING_DISABLE 1 #endif diff --git a/src/Core/Octree.m b/src/Core/Octree.m index e6b7b27fbc..9566101798 100644 --- a/src/Core/Octree.m +++ b/src/Core/Octree.m @@ -32,7 +32,7 @@ #import "OOMaths.h" #import "OOOpenGL.h" -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED #define OctreeDebugLog(format, ...) \ do { \ if (EXPECT_NOT(gDebugFlags & DEBUG_OCTREE_LOGGING)) \ From 16dad82dbec2c3e9e6dc719402a64167f68da606 Mon Sep 17 00:00:00 2001 From: mcarans Date: Wed, 30 Sep 2026 11:02:18 +1300 Subject: [PATCH 3/6] png names More things possibly needed for debug console debugging functionality --- src/Core/Entities/PlanetEntity.h | 2 +- src/Core/Entities/PlanetEntity.m | 2 +- src/Core/Entities/ShipEntity.h | 2 +- src/Core/Entities/ShipEntity.m | 2 +- src/Core/Materials/OOConcreteTexture.h | 2 +- src/Core/Materials/OOConcreteTexture.m | 4 ++-- src/Core/OOPolygonSprite.h | 2 +- src/Core/OOPolygonSprite.m | 13 ++++++++----- 8 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/Core/Entities/PlanetEntity.h b/src/Core/Entities/PlanetEntity.h index e2c2d07bd8..b8956ef97d 100644 --- a/src/Core/Entities/PlanetEntity.h +++ b/src/Core/Entities/PlanetEntity.h @@ -119,7 +119,7 @@ typedef struct - (void)drawUnconditionally; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (PlanetEntity*)atmosphere; #endif diff --git a/src/Core/Entities/PlanetEntity.m b/src/Core/Entities/PlanetEntity.m index 69debf644b..4e5f746676 100644 --- a/src/Core/Entities/PlanetEntity.m +++ b/src/Core/Entities/PlanetEntity.m @@ -917,7 +917,7 @@ - (void)drawUnconditionally } } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (PlanetEntity*)atmosphere { return atmosphere; diff --git a/src/Core/Entities/ShipEntity.h b/src/Core/Entities/ShipEntity.h index 75a6a2cbd7..46f7474826 100644 --- a/src/Core/Entities/ShipEntity.h +++ b/src/Core/Entities/ShipEntity.h @@ -1261,7 +1261,7 @@ Vector positionOffsetForShipInRotationToAlignment(ShipEntity* ship, Quaternion q @end -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED @interface ShipEntity (Debug) - (OOShipGroup*)rawEscortGroup; diff --git a/src/Core/Entities/ShipEntity.m b/src/Core/Entities/ShipEntity.m index 5cd2deec21..d90111de09 100644 --- a/src/Core/Entities/ShipEntity.m +++ b/src/Core/Entities/ShipEntity.m @@ -6003,7 +6003,7 @@ - (void)setEscortGroup:(OOShipGroup*)group } } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (OOShipGroup*)rawEscortGroup { return _escortGroup; diff --git a/src/Core/Materials/OOConcreteTexture.h b/src/Core/Materials/OOConcreteTexture.h index fac6bda4e1..f65c60ed65 100644 --- a/src/Core/Materials/OOConcreteTexture.h +++ b/src/Core/Materials/OOConcreteTexture.h @@ -70,7 +70,7 @@ SOFTWARE. float _anisotropy; #endif -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED NSString* _name; #endif } diff --git a/src/Core/Materials/OOConcreteTexture.m b/src/Core/Materials/OOConcreteTexture.m index 054d81ba16..c3696629a6 100644 --- a/src/Core/Materials/OOConcreteTexture.m +++ b/src/Core/Materials/OOConcreteTexture.m @@ -155,7 +155,7 @@ - (void)dealloc DESTROY(_loader); -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED DESTROY(_name); #endif @@ -184,7 +184,7 @@ - (NSString*)shortDescriptionComponents return _key; } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSString*)name { if (_name != nil) diff --git a/src/Core/OOPolygonSprite.h b/src/Core/OOPolygonSprite.h index adb8f1fa4d..adb3dfa14d 100644 --- a/src/Core/OOPolygonSprite.h +++ b/src/Core/OOPolygonSprite.h @@ -44,7 +44,7 @@ SOFTWARE. GLuint _outlineVBO; #endif -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED NSString* _name; #endif } diff --git a/src/Core/OOPolygonSprite.m b/src/Core/OOPolygonSprite.m index f0941ef37a..5e637d63e0 100644 --- a/src/Core/OOPolygonSprite.m +++ b/src/Core/OOPolygonSprite.m @@ -67,10 +67,13 @@ - (BOOL)loadPolygons:(NSArray*)dataArray outlineWidth:(float)outlineWidth; size_t vCount; // Number of vertices so far in primitive. NSPoint pending0, pending1; // Used for splitting GL_TRIANGLE_STRIP/GL_TRIANGLE_FAN primitives. BOOL OK; // Set to false to indicate error. +#ifdef OO_DEBUG_MONITOR_ENABLED + NSString* name; +#endif + #ifndef NDEBUG BOOL generatingOutline; unsigned svgID; - NSString* name; NSMutableString* debugSVG; #endif } TessPolygonData; @@ -131,7 +134,7 @@ @implementation OOPolygonSprite - (id)initWithDataArray:(NSArray*)dataArray outlineWidth:(GLfloat)outlineWidth name:(NSString*)name { if ((self = [super init])) { -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED _name = [name copy]; #endif @@ -159,7 +162,7 @@ - (void)dealloc { [[OOGraphicsResetManager sharedManager] unregisterClient:self]; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED DESTROY(_name); #endif free(_solidData); @@ -168,7 +171,7 @@ - (void)dealloc [super dealloc]; } -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED - (NSString*)descriptionComponents { return _name; @@ -743,7 +746,7 @@ static void APIENTRY ErrorCallback(GLenum error, void* polygonData) NSCParameterAssert(data != NULL); NSString* name = @""; -#ifndef NDEBUG +#ifdef OO_DEBUG_MONITOR_ENABLED name = [NSString stringWithFormat:@" \"%@\"", data->name]; #endif From 09e294661f6282597fdf0c00f4c47ebeed2c0290 Mon Sep 17 00:00:00 2001 From: mcarans Date: Wed, 30 Sep 2026 11:28:56 +1300 Subject: [PATCH 4/6] Make test workflow test deployment not dev --- .github/workflows/test_builds.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test_builds.yaml b/.github/workflows/test_builds.yaml index 2d2bff7a2f..87d4e02269 100644 --- a/.github/workflows/test_builds.yaml +++ b/.github/workflows/test_builds.yaml @@ -47,14 +47,14 @@ jobs: ShellScripts/Linux/install_mozilla_js.sh system - name: Build Oolite run: | - ./mk.sh build dev + ./mk.sh build deployment - name: Test Oolite if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name run: | - ./mk.sh test dev + ./mk.sh test deployment - name: Build AppImage run: | - ./mk.sh pkg-appimage dev + ./mk.sh pkg-appimage deployment fedora: runs-on: ubuntu-latest @@ -94,14 +94,14 @@ jobs: ldconfig - name: Build Oolite run: | - ./mk.sh build dev + ./mk.sh build deployment - name: Test Oolite if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name run: | - ./mk.sh test dev + ./mk.sh test deployment - name: Build AppImage run: | - ./mk.sh pkg-appimage dev + ./mk.sh pkg-appimage deployment arch: runs-on: ubuntu-latest @@ -141,14 +141,14 @@ jobs: ldconfig - name: Build Oolite run: | - ./mk.sh build dev + ./mk.sh build deployment - name: Test Oolite if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name run: | - ./mk.sh test dev + ./mk.sh test deployment - name: Build AppImage run: | - ./mk.sh pkg-appimage dev + ./mk.sh pkg-appimage deployment windows: runs-on: windows-latest @@ -187,7 +187,7 @@ jobs: msystem: UCRT64 PYTHONUTF8: "1" run: | - ./mk.sh build dev + ./mk.sh build deployment - name: Test Oolite if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name @@ -196,4 +196,4 @@ jobs: msystem: UCRT64 PYTHONUTF8: "1" run: | - ./mk.sh test dev + ./mk.sh test deployment From ef5a340ea0a011c0ae46bd29a9ae3cd3f41220eb Mon Sep 17 00:00:00 2001 From: mcarans Date: Wed, 30 Sep 2026 11:37:16 +1300 Subject: [PATCH 5/6] Allow testing deployment --- mk.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mk.sh b/mk.sh index ffbec771c2..2847c4555d 100755 --- a/mk.sh +++ b/mk.sh @@ -198,10 +198,6 @@ execute_target() { # Target Execution Logic ;; test) validate_build_type "$build_type" - if [[ "$build_type" == "deployment" ]]; then - echo "❌ Cannot test deployment as not set up for debug console!" >&2 - exit 1 - fi source tests/run_test_fn.sh && run_test "$build_type" ;; clean) From 7b6994309d041933f573b7bce5035e97a8da0fc8 Mon Sep 17 00:00:00 2001 From: mcarans Date: Sun, 4 Oct 2026 17:26:10 +1300 Subject: [PATCH 6/6] Fix startup issue --- src/Core/OOFoundation.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Core/OOFoundation.h b/src/Core/OOFoundation.h index 921f49376e..44a3c4fe96 100644 --- a/src/Core/OOFoundation.h +++ b/src/Core/OOFoundation.h @@ -39,7 +39,7 @@ MA 02110-1301, USA. #define OOLITE_DEBUG 1 #endif -#if !OOLITE_DEBUG +#if !OO_DEBUG_MONITOR_ENABLED #define NS_BLOCK_ASSERTIONS 1 #endif