You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
Puppyprint Logging
Puppyprint now supports logging strings for debugging use. tapping dpad left while inside the puppyprint debugging screen will toggle it
This commit is contained in:
@@ -777,7 +777,7 @@ void thread5_game_loop(UNUSED void *arg) {
|
||||
select_gfx_pool();
|
||||
read_controller_inputs();
|
||||
addr = level_script_execute(addr);
|
||||
#if defined(VISUAL_DEBUG) && PUPPYPRINT_DEBUG
|
||||
#if PUPPYPRINT_DEBUG == 0 && defined(VISUAL_DEBUG)
|
||||
debug_box_input();
|
||||
#endif
|
||||
#if PUPPYPRINT_DEBUG
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "course_table.h"
|
||||
#include "rumble_init.h"
|
||||
#include "puppycam2.h"
|
||||
#include "puppyprint.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
@@ -563,7 +564,7 @@ void check_instant_warp(void) {
|
||||
#ifdef INSTANT_WARP_OFFSET_FIX
|
||||
gMarioObject->header.gfx.pos[0] = gMarioState->pos[0];
|
||||
gMarioObject->header.gfx.pos[1] = gMarioState->pos[1];
|
||||
gMarioObject->header.gfx.pos[2] = gMarioState->pos[2];
|
||||
gMarioObject->header.gfx.pos[2] = gMarioState->pos[2];
|
||||
#endif
|
||||
cameraAngle = gMarioState->area->camera->yaw;
|
||||
|
||||
@@ -1187,6 +1188,10 @@ s32 update_level(void) {
|
||||
|
||||
s32 init_level(void) {
|
||||
s32 val4 = 0;
|
||||
#if PUPPYPRINT_DEBUG
|
||||
char textBytes[64];
|
||||
OSTime first = osGetTime();
|
||||
#endif
|
||||
|
||||
set_play_mode(PLAY_MODE_NORMAL);
|
||||
|
||||
@@ -1260,6 +1265,10 @@ s32 init_level(void) {
|
||||
sound_banks_disable(SEQ_PLAYER_SFX, SOUND_BANKS_DISABLED_DURING_INTRO_CUTSCENE);
|
||||
}
|
||||
|
||||
#if PUPPYPRINT_DEBUG
|
||||
sprintf(textBytes, "Level loaded in %dus", (s32)(OS_CYCLES_TO_USEC(osGetTime() - first)));
|
||||
append_puppyprint_log(textBytes);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,10 @@ Inside this display, if you press up on the dpad again, you can switch between p
|
||||
If you press dpad down, you can toggle the benchmarking display.
|
||||
You can press dpad left or right to change which option, and you can measure game thread or audio thread performance by default.
|
||||
There's also a custom option that's left blank. It runs benchmark_custom which can contain anything of your choice.
|
||||
You can press dpad right to cycle between collision visuals, from surface collision, hitbox collision, both, or neither.
|
||||
dpad left will toggle the logging view, which will display a number of strings you've sent through for debugging purposes, like
|
||||
a modern game engine's developer's console.
|
||||
|
||||
- Collision marks the time it takes to generate and process collision.
|
||||
- Behaviour marks the time it takes for objects to perform their behaviours. This excludes collision.
|
||||
- Graph measures the time it takes to process the node graphs, which is all the 3D geometry and rendering.
|
||||
@@ -46,6 +50,7 @@ u8 fDebug = 0;
|
||||
#if PUPPYPRINT_DEBUG
|
||||
s8 benchViewer = 0;
|
||||
u8 benchOption = 0;
|
||||
s8 logViewer = 0;
|
||||
//Profiler values
|
||||
s8 perfIteration = 0;
|
||||
s16 benchmarkLoop = 0;
|
||||
@@ -302,6 +307,34 @@ void print_which_benchmark(void)
|
||||
print_small_text(160,120, textBytes, PRINT_TEXT_ALIGN_CENTRE, PRINT_ALL);
|
||||
}
|
||||
|
||||
char consoleLogTable[LOG_BUFFER_SIZE][255];
|
||||
|
||||
void append_puppyprint_log(char str[255])
|
||||
{
|
||||
s32 i;
|
||||
for (i = 0; i < LOG_BUFFER_SIZE-1; i++)
|
||||
{
|
||||
memcpy(consoleLogTable[i], consoleLogTable[i+1], 255);
|
||||
}
|
||||
memcpy(consoleLogTable[LOG_BUFFER_SIZE-1], str, 255);
|
||||
}
|
||||
|
||||
#define LINE_HEIGHT 8 + ((LOG_BUFFER_SIZE-1)*12)
|
||||
void print_console_log(void)
|
||||
{
|
||||
s32 i;
|
||||
prepare_blank_box();
|
||||
render_blank_box(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0, 96);
|
||||
finish_blank_box();
|
||||
for (i = 0; i < LOG_BUFFER_SIZE; i++)
|
||||
{
|
||||
if (consoleLogTable[i] == NULL)
|
||||
continue;
|
||||
print_small_text(16, (LINE_HEIGHT)-(i*12), consoleLogTable[i], PRINT_TEXT_ALIGN_LEFT, PRINT_ALL);
|
||||
}
|
||||
}
|
||||
#undef LINE_HEIGHT
|
||||
|
||||
extern void print_fps(s32 x, s32 y);
|
||||
|
||||
void puppyprint_render_profiler(void)
|
||||
@@ -318,7 +351,7 @@ void puppyprint_render_profiler(void)
|
||||
sprintf(textBytes, "RAM: %06X /%06X (%d_)", main_pool_available(), mempool, (s32)(((f32)main_pool_available()/(f32)mempool)*100));
|
||||
print_small_text(160, 224, textBytes, PRINT_TEXT_ALIGN_CENTRE, PRINT_ALL);
|
||||
|
||||
if (!ramViewer && !benchViewer)
|
||||
if (!ramViewer && !benchViewer && !logViewer)
|
||||
{
|
||||
print_fps(16,40);
|
||||
sprintf(textBytes, "CPU: %dus (%d_)#RSP: %dus (%d_)#RDP: %dus (%d_)", (s32)cpuCount, (s32)OS_CYCLES_TO_USEC(cpuTime)/333, (s32)OS_CYCLES_TO_USEC(rspTime), (s32)OS_CYCLES_TO_USEC(rspTime)/333, (s32)OS_CYCLES_TO_USEC(rdpTime), (s32)OS_CYCLES_TO_USEC(rdpTime)/333);
|
||||
@@ -392,6 +425,9 @@ void puppyprint_render_profiler(void)
|
||||
if (ramViewer)
|
||||
print_ram_overview();
|
||||
else
|
||||
if (logViewer)
|
||||
print_console_log();
|
||||
else
|
||||
if (benchViewer)
|
||||
print_which_benchmark();
|
||||
|
||||
@@ -458,18 +494,25 @@ void puppyprint_profiler_process(void)
|
||||
{
|
||||
benchViewer ^= 1;
|
||||
ramViewer = 0;
|
||||
collisionViewer = 0;
|
||||
logViewer = 0;
|
||||
}
|
||||
else
|
||||
if (gPlayer1Controller->buttonPressed & U_JPAD)
|
||||
{
|
||||
ramViewer ^= 1;
|
||||
benchViewer = 0;
|
||||
collisionViewer = 0;
|
||||
logViewer = 0;
|
||||
}
|
||||
else
|
||||
if (gPlayer1Controller->buttonPressed & L_JPAD)
|
||||
{
|
||||
logViewer ^= 1;
|
||||
ramViewer = 0;
|
||||
benchViewer = 0;
|
||||
}
|
||||
#ifdef VISUAL_DEBUG
|
||||
else
|
||||
if (!benchViewer && !ramViewer)
|
||||
if (!benchViewer && !ramViewer && !logViewer)
|
||||
{
|
||||
debug_box_input();
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
//This is how many indexes of timers are saved at once. higher creates a smoother average, but naturally uses more RAM. 15's fine.
|
||||
#define NUM_PERF_ITERATIONS 15
|
||||
#define NUM_BENCH_ITERATIONS 150
|
||||
#define LOG_BUFFER_SIZE 16
|
||||
|
||||
#define BENCHMARK_GAME 1
|
||||
#define BENCHMARK_AUDIO 2
|
||||
@@ -66,6 +67,8 @@ extern s32 get_text_width(const char *str);
|
||||
extern void prepare_blank_box(void);
|
||||
extern void finish_blank_box(void);
|
||||
extern void render_blank_box(s16 x1, s16 y1, s16 x2, s16 y2, u8 r, u8 g, u8 b, u8 a);
|
||||
extern void append_puppyprint_log(char str[255]);
|
||||
extern char consoleLogTable[LOG_BUFFER_SIZE][255];
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user