Update error and debug logging methods
Build Dusk / run-tests (push) Failing after 14s
Build Dusk / build-linux (push) Failing after 15s
Build Dusk / build-psp (push) Failing after 22s
Build Dusk / build-gamecube (push) Failing after 18s
Build Dusk / build-wii (push) Failing after 15s
Build Dusk / run-tests (push) Failing after 14s
Build Dusk / build-linux (push) Failing after 15s
Build Dusk / build-psp (push) Failing after 22s
Build Dusk / build-gamecube (push) Failing after 18s
Build Dusk / build-wii (push) Failing after 15s
This commit is contained in:
@@ -16,6 +16,6 @@ target_sources(${DUSK_BINARY_TARGET_NAME}
|
||||
|
||||
# Subdirs
|
||||
add_subdirectory(asset)
|
||||
add_subdirectory(debug)
|
||||
add_subdirectory(log)
|
||||
add_subdirectory(display)
|
||||
add_subdirectory(input)
|
||||
@@ -1,81 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "debug/debug.h"
|
||||
#include "display/display.h"
|
||||
#include <debug.h>
|
||||
|
||||
static char_t DEBUG_ERROR_BUFFER[16*1024] = {0};
|
||||
|
||||
void debugPrint(const char_t *message, ...) {
|
||||
size_t start = strlen(DEBUG_ERROR_BUFFER);
|
||||
|
||||
va_list args;
|
||||
va_start(args, message);
|
||||
|
||||
// Print to stdout
|
||||
va_list copy;
|
||||
va_copy(copy, args);
|
||||
vfprintf(stdout, message, copy);
|
||||
va_end(copy);
|
||||
fflush(stdout);
|
||||
|
||||
// Append to buffer
|
||||
// vsnprintf(
|
||||
// DEBUG_ERROR_BUFFER + start,
|
||||
// sizeof(DEBUG_ERROR_BUFFER) - start,
|
||||
// message,
|
||||
// args
|
||||
// );
|
||||
}
|
||||
|
||||
void debugFlush() {
|
||||
fflush(stdout);
|
||||
|
||||
// Either create graphics, or hijack the displays' graphics.
|
||||
// void *xfb = NULL;
|
||||
// GXRModeObj *rmode = NULL;
|
||||
// void *framebuffer;
|
||||
|
||||
// if(DISPLAY.frameBuffer[0]) {
|
||||
// console_init(
|
||||
// DISPLAY.frameBuffer[0],
|
||||
// 20,
|
||||
// 20,
|
||||
// DISPLAY.screenMode->fbWidth,
|
||||
// DISPLAY.screenMode->xfbHeight,
|
||||
// DISPLAY.screenMode->fbWidth * VI_DISPLAY_PIX_SZ
|
||||
// );
|
||||
// } else {
|
||||
// VIDEO_Init();
|
||||
// rmode = VIDEO_GetPreferredMode(NULL);
|
||||
// framebuffer = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
|
||||
// console_init(
|
||||
// framebuffer,
|
||||
// 20,
|
||||
// 20,
|
||||
// rmode->fbWidth,
|
||||
// rmode->xfbHeight,
|
||||
// rmode->fbWidth*VI_DISPLAY_PIX_SZ
|
||||
// );
|
||||
// VIDEO_Configure(rmode);
|
||||
// VIDEO_SetNextFramebuffer(framebuffer);
|
||||
// VIDEO_SetBlack(FALSE);
|
||||
// VIDEO_Flush();
|
||||
// VIDEO_WaitVSync();
|
||||
// if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
|
||||
// }
|
||||
|
||||
// // Printf
|
||||
// printf("SOB\n");
|
||||
// printf(DEBUG_ERROR_BUFFER);
|
||||
// printf("\nEOB.");
|
||||
|
||||
while(SYS_MainLoop()) {
|
||||
VIDEO_WaitVSync();
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "display/mesh/mesh.h"
|
||||
#include "display/texture/texture.h"
|
||||
#include "assert/assert.h"
|
||||
#include "debug/debug.h"
|
||||
|
||||
errorret_t meshInitDolphin(
|
||||
meshdolphin_t *mesh,
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
#include "input/input.h"
|
||||
#include "assert/assert.h"
|
||||
#include "debug/debug.h"
|
||||
|
||||
inputbuttondata_t INPUT_BUTTON_DATA[] = {
|
||||
#ifdef DUSK_INPUT_GAMEPAD
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
|
||||
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||
PUBLIC
|
||||
debug.c
|
||||
log.c
|
||||
)
|
||||
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "log/log.h"
|
||||
#include "display/display.h"
|
||||
#include <debug.h>
|
||||
|
||||
void logDebug(const char_t *message, ...) {
|
||||
// Print to stdout
|
||||
va_list args;
|
||||
va_start(args, message);
|
||||
vfprintf(stdout, message, args);
|
||||
va_end(args);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
void logError(const char_t *message, ...) {
|
||||
// Either create graphics, or hijack the displays' graphics.
|
||||
void *xfb = NULL;
|
||||
GXRModeObj *rmode = NULL;
|
||||
void *framebuffer;
|
||||
|
||||
if(DISPLAY.frameBuffer[0]) {
|
||||
console_init(
|
||||
DISPLAY.frameBuffer[0],
|
||||
20,
|
||||
20,
|
||||
DISPLAY.screenMode->fbWidth,
|
||||
DISPLAY.screenMode->xfbHeight,
|
||||
DISPLAY.screenMode->fbWidth * VI_DISPLAY_PIX_SZ
|
||||
);
|
||||
} else {
|
||||
VIDEO_Init();
|
||||
rmode = VIDEO_GetPreferredMode(NULL);
|
||||
framebuffer = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
|
||||
console_init(
|
||||
framebuffer,
|
||||
20,
|
||||
20,
|
||||
rmode->fbWidth,
|
||||
rmode->xfbHeight,
|
||||
rmode->fbWidth*VI_DISPLAY_PIX_SZ
|
||||
);
|
||||
VIDEO_Configure(rmode);
|
||||
VIDEO_SetNextFramebuffer(framebuffer);
|
||||
VIDEO_SetBlack(FALSE);
|
||||
VIDEO_Flush();
|
||||
VIDEO_WaitVSync();
|
||||
if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
|
||||
}
|
||||
|
||||
// Printf
|
||||
va_list args;
|
||||
va_start(args, message);
|
||||
vprintf(message, args);
|
||||
va_end(args);
|
||||
|
||||
while(SYS_MainLoop()) {
|
||||
VIDEO_WaitVSync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user