remove gnCreateDebugger function

This commit is contained in:
Greg Wells
2025-07-15 09:18:53 -04:00
parent 7722467ceb
commit 8d476781a8
22 changed files with 36 additions and 68 deletions

View File

@@ -1,8 +0,0 @@
#include "gryphn_debugger.h"
gnReturnCode gnCreateDebugger(gnDebuggerHandle* debugger, const gnDebuggerInfo info) {
*debugger = malloc(sizeof(struct gnDebugger_t));
(*debugger)->info = info;
return GN_SUCCESS;
}
void gnDestroyDebugger(gnDebuggerHandle debugger) {}

View File

@@ -1,8 +1,6 @@
#pragma once
#include "stdint.h"
#include "utils/gryphn_string.h"
#include "utils/gryphn_error_code.h"
#include "gryphn_handles.h"
struct gnPlatformDebugger_t;
@@ -43,24 +41,14 @@ typedef struct gnDebuggerInfo {
} gnDebuggerInfo;
#ifdef GN_REVEAL_IMPL
struct gnDebugger_t {
gnDebuggerInfo info;
};
#endif
gnReturnCode gnCreateDebugger(gnDebuggerHandle* debugger, const gnDebuggerInfo info);
void gnDestroyDebugger(gnDebuggerHandle debugger);
#ifdef GN_REVEAL_IMPL
static void gnDebuggerSetErrorMessage(gnDebuggerHandle debugger, gnMessageData data) {
if (debugger == NULL) return;
debugger->info.callback(
// struct gnDebugger_t { gnDebuggerInfo info; };
static void gnDebuggerSetErrorMessage(gnDebuggerInfo debugger, gnMessageData data) {
// if (debugger == NULL) return;
debugger.callback(
GN_MESSAGE_ERROR,
GN_DEBUG_MESSAGE_VALIDATION,
data,
debugger->info.userData
debugger.userData
);
}
#endif

View File

@@ -2,11 +2,11 @@
#include "instance/gryphn_instance.h"
#include <loader/src/gryphn_instance_functions.h>
#include "loader/src/gryphn_loader.h"
#include "debugger/gryphn_debugger.h"
#include "loader/src/gryphn_loader.h"
gnReturnCode gnCreateInstance(gnInstanceHandle* instance, gnInstanceInfo info) {
*instance = malloc(sizeof(struct gnInstance_t));
(*instance)->hasDebugger = gnFalse;
(*instance)->layers = loaderLayerArrayListCreate();
loaderLayerArrayListAdd(&(*instance)->layers, loadLayer((loaderInfo){
@@ -20,8 +20,12 @@ gnReturnCode gnCreateInstance(gnInstanceHandle* instance, gnInstanceInfo info) {
}
gnBool loaderFunctionChecker = gnFalse;
for (int i = 0; i < info.debugger->info.layerCount; i++) {
if (info.debugger->info.layers[i] == GN_DEBUGGER_LAYER_FUNCTIONS) loaderFunctionChecker = gnTrue;
if (info.debugger != NULL) {
for (int i = 0; i < info.debugger->layerCount; i++) {
if (info.debugger->layers[i] == GN_DEBUGGER_LAYER_FUNCTIONS) loaderFunctionChecker = gnTrue;
}
(*instance)->debugger = *info.debugger;
(*instance)->hasDebugger = gnTrue;
}
if (loaderFunctionChecker) {
@@ -36,7 +40,6 @@ gnReturnCode gnCreateInstance(gnInstanceHandle* instance, gnInstanceInfo info) {
// i hate this line of code but im not fixing it
(*instance)->callingLayer = &(*instance)->layers.data[(*instance)->layers.count - 1];
(*instance)->debugger = info.debugger;
return (*instance)->callingLayer->instanceFunctions._gnCreateInstance((*instance), info);
}

View File

@@ -3,6 +3,7 @@
#include "core/src/gryphn_handles.h"
#include "utils/gryphn_version.h"
#include "utils/gryphn_error_code.h"
#include "core/src/instance/gryphn_debugger.h"
#include <gryphn_extensions.h>
typedef struct gnInstanceInfo {
@@ -13,7 +14,7 @@ typedef struct gnInstanceInfo {
gnVersion engineVersion;
gnRenderingAPI renderingAPI;
gnDebuggerHandle debugger;
gnDebuggerInfo* debugger;
uint32_t extensionCount;
gnExtension* extensions;
@@ -29,7 +30,8 @@ struct gnInstance_t {
loaderLayer* callingLayer;
uint32_t currentLayer;
gnDebuggerHandle debugger;
gnBool hasDebugger;
gnDebuggerInfo debugger;
};
#endif