2023-07-21 09:50:06 +00:00
|
|
|
/**
|
|
|
|
* limbo_debugger.h
|
|
|
|
* =============================================================================
|
2024-03-21 20:38:57 +00:00
|
|
|
* Copyright 2021-2024 Serhii Snitsaruk
|
2023-07-21 09:50:06 +00:00
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style
|
|
|
|
* license that can be found in the LICENSE file or at
|
|
|
|
* https://opensource.org/licenses/MIT.
|
|
|
|
* =============================================================================
|
|
|
|
*/
|
2023-04-13 07:29:45 +00:00
|
|
|
|
|
|
|
#ifndef LIMBO_DEBUGGER_H
|
|
|
|
#define LIMBO_DEBUGGER_H
|
|
|
|
|
2024-08-03 09:07:06 +00:00
|
|
|
#include "../../bt/bt_instance.h"
|
2024-01-07 01:40:51 +00:00
|
|
|
#include "../../bt/tasks/bt_task.h"
|
2023-07-20 16:35:36 +00:00
|
|
|
|
2024-01-07 01:40:51 +00:00
|
|
|
#ifdef LIMBOAI_MODULE
|
2023-04-13 07:29:45 +00:00
|
|
|
#include "core/object/class_db.h"
|
|
|
|
#include "core/object/object.h"
|
|
|
|
#include "core/string/node_path.h"
|
2024-01-07 01:40:51 +00:00
|
|
|
#endif // LIMBOAI_MODULE
|
|
|
|
|
|
|
|
#ifdef LIMBOAI_GDEXTENSION
|
|
|
|
#include <godot_cpp/classes/object.hpp>
|
|
|
|
#include <godot_cpp/core/class_db.hpp>
|
2024-08-03 09:07:06 +00:00
|
|
|
#include <godot_cpp/templates/hash_set.hpp>
|
2024-01-07 01:40:51 +00:00
|
|
|
#include <godot_cpp/variant/node_path.hpp>
|
|
|
|
#endif // LIMBOAI_GDEXTENSION
|
2023-04-13 07:29:45 +00:00
|
|
|
|
|
|
|
class LimboDebugger : public Object {
|
|
|
|
GDCLASS(LimboDebugger, Object);
|
|
|
|
|
|
|
|
private:
|
|
|
|
static LimboDebugger *singleton;
|
|
|
|
|
|
|
|
LimboDebugger();
|
|
|
|
|
|
|
|
public:
|
|
|
|
static void initialize();
|
|
|
|
static void deinitialize();
|
2024-08-03 09:39:23 +00:00
|
|
|
_FORCE_INLINE_ static LimboDebugger *get_singleton() { return singleton; }
|
2023-04-13 07:29:45 +00:00
|
|
|
|
|
|
|
~LimboDebugger();
|
|
|
|
|
2024-01-07 01:40:51 +00:00
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
2023-04-13 07:29:45 +00:00
|
|
|
#ifdef DEBUG_ENABLED
|
|
|
|
private:
|
2024-08-03 09:07:06 +00:00
|
|
|
HashSet<uint64_t> active_bt_instances;
|
2024-08-03 11:48:15 +00:00
|
|
|
uint64_t tracked_instance_id = 0;
|
2023-04-13 07:29:45 +00:00
|
|
|
bool session_active = false;
|
|
|
|
|
2024-08-03 09:07:06 +00:00
|
|
|
void _track_tree(uint64_t p_instance_id);
|
2023-04-13 07:29:45 +00:00
|
|
|
void _untrack_tree();
|
2023-04-15 07:01:37 +00:00
|
|
|
void _send_active_bt_players();
|
2023-04-13 07:29:45 +00:00
|
|
|
|
2024-08-03 09:07:06 +00:00
|
|
|
void _on_bt_instance_updated(int status, uint64_t p_instance_id);
|
2023-04-13 07:29:45 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
static Error parse_message(void *p_user, const String &p_msg, const Array &p_args, bool &r_captured);
|
2024-01-07 01:40:51 +00:00
|
|
|
#ifdef LIMBOAI_GDEXTENSION
|
|
|
|
bool parse_message_gdext(const String &p_msg, const Array &p_args);
|
|
|
|
#endif
|
2023-04-13 07:29:45 +00:00
|
|
|
|
2024-08-03 09:07:06 +00:00
|
|
|
void register_bt_instance(uint64_t p_instance_id);
|
|
|
|
void unregister_bt_instance(uint64_t p_instance_id);
|
2024-08-03 09:39:23 +00:00
|
|
|
bool is_active() const;
|
2023-04-13 07:29:45 +00:00
|
|
|
|
2024-01-10 22:26:24 +00:00
|
|
|
#endif // ! DEBUG_ENABLED
|
2023-04-13 07:29:45 +00:00
|
|
|
};
|
2024-01-13 16:10:42 +00:00
|
|
|
#endif // LIMBO_DEBUGGER_H
|