Merge branch 'nightly' of https://github.com/Reonu/HackerSM64 into nightly

This commit is contained in:
Arceveti
2021-09-28 12:18:04 -07:00
25 changed files with 433 additions and 622 deletions

View File

@@ -8,7 +8,6 @@
#include "game/game_init.h"
#include "game/memory.h"
#include "game/sound_init.h"
#include "game/profiler.h"
#include "buffers/buffers.h"
#include "segments.h"
#include "game/main.h"
@@ -71,27 +70,14 @@ s8 gDebugLevelSelect = TRUE;
s8 gDebugLevelSelect = FALSE;
#endif
s8 gShowProfiler = FALSE;
s8 gShowDebugText = FALSE;
// unused
void handle_debug_key_sequences(void) {
static u16 sProfilerKeySequence[] = {
U_JPAD, U_JPAD, D_JPAD, D_JPAD, L_JPAD, R_JPAD, L_JPAD, R_JPAD
};
static u16 sDebugTextKeySequence[] = { D_JPAD, D_JPAD, U_JPAD, U_JPAD,
L_JPAD, R_JPAD, L_JPAD, R_JPAD };
static s16 sProfilerKey = 0;
static s16 sDebugTextKey = 0;
if (gPlayer3Controller->buttonPressed != 0) {
if (sProfilerKeySequence[sProfilerKey++] == gPlayer3Controller->buttonPressed) {
if (sProfilerKey == ARRAY_COUNT(sProfilerKeySequence)) {
sProfilerKey = 0, gShowProfiler ^= 1;
}
} else {
sProfilerKey = 0;
}
if (sDebugTextKeySequence[sDebugTextKey++] == gPlayer3Controller->buttonPressed) {
if (sDebugTextKey == ARRAY_COUNT(sDebugTextKeySequence)) {
sDebugTextKey = 0, gShowDebugText ^= 1;
@@ -192,7 +178,6 @@ void interrupt_gfx_sptask(void) {
void start_gfx_sptask(void) {
if (gActiveSPTask == NULL && sCurrentDisplaySPTask != NULL
&& sCurrentDisplaySPTask->state == SPTASK_STATE_NOT_STARTED) {
profiler_log_gfx_time(TASKS_QUEUED);
#if PUPPYPRINT_DEBUG
rspDelta = osGetTime();
#endif
@@ -224,7 +209,6 @@ void handle_vblank(void) {
if (gActiveSPTask != NULL) {
interrupt_gfx_sptask();
} else {
profiler_log_vblank_time();
if (sAudioEnabled) {
start_sptask(M_AUDTASK);
} else {
@@ -234,7 +218,6 @@ void handle_vblank(void) {
} else {
if (gActiveSPTask == NULL && sCurrentDisplaySPTask != NULL
&& sCurrentDisplaySPTask->state != SPTASK_STATE_FINISHED) {
profiler_log_gfx_time(TASKS_QUEUED);
#if PUPPYPRINT_DEBUG
rspDelta = osGetTime();
#endif
@@ -267,11 +250,9 @@ void handle_sp_complete(void) {
#if PUPPYPRINT_DEBUG
profiler_update(rspGenTime, rspDelta);
#endif
profiler_log_gfx_time(RSP_COMPLETE);
}
// Start the audio task, as expected by handle_vblank.
profiler_log_vblank_time();
if (sAudioEnabled) {
start_sptask(M_AUDTASK);
} else {
@@ -281,12 +262,8 @@ void handle_sp_complete(void) {
curSPTask->state = SPTASK_STATE_FINISHED;
if (curSPTask->task.t.type == M_AUDTASK) {
// After audio tasks come gfx tasks.
profiler_log_vblank_time();
if (sCurrentDisplaySPTask != NULL
&& sCurrentDisplaySPTask->state != SPTASK_STATE_FINISHED) {
if (sCurrentDisplaySPTask->state != SPTASK_STATE_INTERRUPTED) {
profiler_log_gfx_time(TASKS_QUEUED);
}
start_sptask(M_GFXTASK);
}
sCurrentAudioSPTask = NULL;
@@ -300,7 +277,6 @@ void handle_sp_complete(void) {
#if PUPPYPRINT_DEBUG
profiler_update(rspGenTime, rspDelta);
#endif
profiler_log_gfx_time(RSP_COMPLETE);
}
}
}
@@ -310,7 +286,6 @@ void handle_dp_complete(void) {
if (sCurrentDisplaySPTask->msgqueue != NULL) {
osSendMesg(sCurrentDisplaySPTask->msgqueue, sCurrentDisplaySPTask->msg, OS_MESG_NOBLOCK);
}
profiler_log_gfx_time(RDP_COMPLETE);
sCurrentDisplaySPTask->state = SPTASK_STATE_FINISHED_DP;
sCurrentDisplaySPTask = NULL;
}

View File

@@ -66,7 +66,9 @@ extern struct MainPoolBlock *sPoolListHeadR;
*/
struct MemoryPool *gEffectsMemoryPool;
uintptr_t sSegmentTable[32];
uintptr_t sSegmentROMTable[32];
u32 sPoolFreeSpace;
u8 *sPoolStart;
u8 *sPoolEnd;
@@ -337,13 +339,13 @@ void *load_segment(s32 segment, u8 *srcStart, u8 *srcEnd, u32 side, u8 *bssStart
addr = dynamic_dma_read(srcStart, srcEnd, side, TLB_PAGE_SIZE, (uintptr_t)bssEnd - (uintptr_t)bssStart);
if (addr != NULL) {
u8 *realAddr = (u8 *)ALIGN((uintptr_t)addr, TLB_PAGE_SIZE);
set_segment_base_addr(segment, realAddr);
set_segment_base_addr(segment, realAddr); sSegmentROMTable[segment] = (uintptr_t) srcStart;
mapTLBPages(segment << 24, VIRTUAL_TO_PHYSICAL(realAddr), (srcEnd - srcStart) + ((uintptr_t)bssEnd - (uintptr_t)bssStart), segment);
}
} else {
addr = dynamic_dma_read(srcStart, srcEnd, side, 0, 0);
if (addr != NULL) {
set_segment_base_addr(segment, addr);
set_segment_base_addr(segment, addr); sSegmentROMTable[segment] = (uintptr_t) srcStart;
}
}
#if PUPPYPRINT_DEBUG
@@ -418,7 +420,7 @@ void *load_segment_decompress(s32 segment, u8 *srcStart, u8 *srcEnd) {
decompress(compressed, dest);
#endif
osSyncPrintf("end decompress\n");
set_segment_base_addr(segment, dest);
set_segment_base_addr(segment, dest); sSegmentROMTable[segment] = (uintptr_t) srcStart;
main_pool_free(compressed);
}
}
@@ -457,7 +459,7 @@ void *load_segment_decompress_heap(u32 segment, u8 *srcStart, u8 *srcEnd) {
#elif MIO0
decompress(compressed, gDecompressionHeap);
#endif
set_segment_base_addr(segment, gDecompressionHeap);
set_segment_base_addr(segment, gDecompressionHeap); sSegmentROMTable[segment] = (uintptr_t) srcStart;
main_pool_free(compressed);
}
return gDecompressionHeap;

View File

@@ -13,7 +13,6 @@
#include "game/memory.h"
#include "game/object_helpers.h"
#include "game/object_list_processor.h"
#include "game/profiler.h"
#include "game/save_file.h"
#include "game/sound_init.h"
#include "goddard/renderer.h"
@@ -961,7 +960,6 @@ struct LevelCommand *level_script_execute(struct LevelCommand *cmd) {
LevelScriptJumpTable[sCurrentCmd->type]();
}
profiler_log_thread5_time(LEVEL_SCRIPT_EXECUTE);
init_rcp(CLEAR_ZBUFFER);
render_game();
end_master_display_list();

File diff suppressed because it is too large Load Diff

View File

@@ -369,7 +369,9 @@ void play_transition_after_delay(s16 transType, s16 time, u8 red, u8 green, u8 b
void render_game(void) {
if (gCurrentArea != NULL && !gWarpTransition.pauseRendering) {
geo_process_root(gCurrentArea->graphNode, gViewportOverride, gViewportClip, gFBSetColor);
if (gCurrentArea->graphNode) {
geo_process_root(gCurrentArea->graphNode, gViewportOverride, gViewportClip, gFBSetColor);
}
gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gViewport));

View File

@@ -29,6 +29,7 @@
#include "engine/surface_collision.h"
#include "engine/surface_load.h"
#include "object_list_processor.h"
#include "behavior_data.h"
#include "debug_box.h"
@@ -239,9 +240,18 @@ void iterate_surfaces_visual(s32 x, s32 z, Vtx *verts) {
surf = node->surface;
node = node->next;
make_vertex(verts, gVisualSurfaceCount, surf->vertex1[0], surf->vertex1[1], surf->vertex1[2], 0, 0, col[0], col[1], col[2], 0x80);
make_vertex(verts, gVisualSurfaceCount+1, surf->vertex2[0], surf->vertex2[1], surf->vertex2[2], 0, 0, col[0], col[1], col[2], 0x80);
make_vertex(verts, gVisualSurfaceCount+2, surf->vertex3[0], surf->vertex3[1], surf->vertex3[2], 0, 0, col[0], col[1], col[2], 0x80);
if (surf->type >= SURFACE_INSTANT_WARP_1B && surf->type <= SURFACE_INSTANT_WARP_1E)
{
make_vertex(verts, gVisualSurfaceCount, surf->vertex1[0], surf->vertex1[1], surf->vertex1[2], 0, 0, 0xFF, 0xA0, 0x00, 0x80);
make_vertex(verts, gVisualSurfaceCount+1, surf->vertex2[0], surf->vertex2[1], surf->vertex2[2], 0, 0, 0xFF, 0xA0, 0x00, 0x80);
make_vertex(verts, gVisualSurfaceCount+2, surf->vertex3[0], surf->vertex3[1], surf->vertex3[2], 0, 0, 0xFF, 0xA0, 0x00, 0x80);
}
else
{
make_vertex(verts, gVisualSurfaceCount, surf->vertex1[0], surf->vertex1[1], surf->vertex1[2], 0, 0, col[0], col[1], col[2], 0x80);
make_vertex(verts, gVisualSurfaceCount+1, surf->vertex2[0], surf->vertex2[1], surf->vertex2[2], 0, 0, col[0], col[1], col[2], 0x80);
make_vertex(verts, gVisualSurfaceCount+2, surf->vertex3[0], surf->vertex3[1], surf->vertex3[2], 0, 0, col[0], col[1], col[2], 0x80);
}
gVisualSurfaceCount+=3;
}

View File

@@ -11,7 +11,6 @@
#include "game_init.h"
#include "main.h"
#include "memory.h"
#include "profiler.h"
#include "save_file.h"
#include "seq_ids.h"
#include "sound_init.h"
@@ -322,9 +321,6 @@ void init_rcp(s32 resetZB) {
*/
void end_master_display_list(void) {
draw_screen_borders();
if (gShowProfiler) {
draw_profiler();
}
gDPFullSync(gDisplayListHead++);
gSPEndDisplayList(gDisplayListHead++);
@@ -415,7 +411,6 @@ void display_and_vsync(void) {
gIsConsole = 1;
gBorderHeight = BORDER_HEIGHT_CONSOLE;
}
profiler_log_thread5_time(BEFORE_DISPLAY_LISTS);
//gIsConsole = (IO_READ(DPC_PIPEBUSY_REG));
osRecvMesg(&gGfxVblankQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
if (gGoddardVblankCallback != NULL) {
@@ -423,10 +418,8 @@ void display_and_vsync(void) {
gGoddardVblankCallback = NULL;
}
exec_display_list(&gGfxPool->spTask);
profiler_log_thread5_time(AFTER_DISPLAY_LISTS);
osRecvMesg(&gGameVblankQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
osViSwapBuffer((void *) PHYSICAL_TO_VIRTUAL(gPhysicalFrameBuffers[sRenderedFramebuffer]));
profiler_log_thread5_time(THREAD5_END);
osRecvMesg(&gGameVblankQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
// Skip swapping buffers on emulator so that they display immediately as the Gfx task finishes
if (gIsConsole || gIsVC) { // Read RDP Clock Register, has a value of zero on emulators
@@ -741,7 +734,6 @@ void thread5_game_loop(UNUSED void *arg) {
draw_reset_bars();
continue;
}
profiler_log_thread5_time(THREAD5_START);
#if PUPPYPRINT_DEBUG
while (TRUE) {
lastTime = osGetTime();

View File

@@ -71,7 +71,7 @@ void print_fps(s32 x, s32 y) {
sprintf(text, "FPS %2.2f", fps);
#ifdef PUPPYPRINT
print_small_text(x, y, text, PRINT_TEXT_ALIGN_LEFT, PRINT_ALL);
print_small_text(x, y, text, PRINT_TEXT_ALIGN_LEFT, PRINT_ALL, FONT_OUTLINE);
#else
print_text(x, y, text);
#endif

View File

@@ -1335,7 +1335,7 @@ s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum) {
return 0;
}
if (gDebugLevelSelect && !gShowProfiler) {
if (gDebugLevelSelect) {
return 0;
}

View File

@@ -65,7 +65,6 @@ extern u32 gNumVblanks;
extern s8 gResetTimer;
extern s8 gNmiResetBarsTimer;
extern s8 gDebugLevelSelect;
extern s8 gShowProfiler;
extern s8 gShowDebugText;
void set_vblank_handler(s32 index, struct VblankHandler *handler, OSMesgQueue *queue, OSMesg *msg);

View File

@@ -18,7 +18,6 @@
#include "object_helpers.h"
#include "object_list_processor.h"
#include "platform_displacement.h"
#include "profiler.h"
#include "spawn_object.h"
#include "puppyprint.h"
#include "puppylights.h"

View File

@@ -1,306 +0,0 @@
#include <ultra64.h>
#include "sm64.h"
#include "profiler.h"
#include "game_init.h"
s16 gProfilerMode = 0;
// the thread 3 info is logged on the opposite profiler from what is used by
// the thread4 and 5 loggers. It's likely because the sound thread runs at a
// much faster rate and shouldn't be flipping the index for the "slower" game
// threads, which could leave the frame data in a possibly corrupt or incomplete
// state.
s16 gCurrentFrameIndex1 = 1;
s16 gCurrentFrameIndex2 = 0;
struct ProfilerFrameData gProfilerFrameData[2];
// log the current osTime to the appropriate idx for current thread5 processes.
void profiler_log_thread5_time(enum ProfilerGameEvent eventID) {
gProfilerFrameData[gCurrentFrameIndex1].gameTimes[eventID] = osGetTime();
// event ID 4 is the last profiler event for after swapping
// buffers: switch the Info after updating.
if (eventID == THREAD5_END) {
gCurrentFrameIndex1 ^= 1;
gProfilerFrameData[gCurrentFrameIndex1].numSoundTimes = 0;
}
}
// log the audio system before and after osTimes in pairs to the soundTimes array.
void profiler_log_thread4_time(void) {
struct ProfilerFrameData *profiler = &gProfilerFrameData[gCurrentFrameIndex1];
if (profiler->numSoundTimes < ARRAY_COUNT(profiler->soundTimes)) {
profiler->soundTimes[profiler->numSoundTimes++] = osGetTime();
}
}
// log the times for gfxTimes: RSP completes, and RDP completes.
void profiler_log_gfx_time(enum ProfilerGfxEvent eventID) {
if (eventID == TASKS_QUEUED) {
gCurrentFrameIndex2 ^= 1;
gProfilerFrameData[gCurrentFrameIndex2].numVblankTimes = 0;
}
gProfilerFrameData[gCurrentFrameIndex2].gfxTimes[eventID] = osGetTime();
}
// log the times between vblank started and ended.
void profiler_log_vblank_time(void) {
struct ProfilerFrameData *profiler = &gProfilerFrameData[gCurrentFrameIndex2];
if (profiler->numVblankTimes < ARRAY_COUNT(profiler->vblankTimes)) {
profiler->vblankTimes[profiler->numVblankTimes++] = osGetTime();
}
}
// draw the specified profiler given the information passed.
void draw_profiler_bar(OSTime clockBase, OSTime clockStart, OSTime clockEnd, s16 posY, u16 color) {
s64 durationStart, durationEnd;
s32 rectX1, rectX2;
// set the duration to start, and floor to 0 if the result is below 0.
if ((durationStart = clockStart - clockBase) < 0) {
durationStart = 0;
}
// like the above, but with end.
if ((durationEnd = clockEnd - clockBase) < 0) {
durationEnd = 0;
}
// calculate the x coordinates of where start and end begins, respectively.
rectX1 = ((((durationStart * 1000000) / osClockRate * 3) / 1000) + 30);
rectX2 = ((((durationEnd * 1000000) / osClockRate * 3) / 1000) + 30);
//! I believe this is supposed to cap rectX1 and rectX2 to 320, but the
// code seems to use the wrong variables... it's possible that the variable
// names were very similar within a single letter.
if (rectX1 > 319) {
clockStart = 319;
}
if (rectX2 > 319) {
clockEnd = 319;
}
// perform the render if start is less than end. in most cases, it should be.
if (rectX1 < rectX2) {
gDPPipeSync(gDisplayListHead++);
gDPSetFillColor(gDisplayListHead++, color << 16 | color);
gDPFillRectangle(gDisplayListHead++, rectX1, posY, rectX2, posY + 2);
}
}
void draw_reference_profiler_bars(void) {
// Draws the reference "max" bars underneath the real thing.
// Blue
gDPPipeSync(gDisplayListHead++);
gDPSetFillColor(gDisplayListHead++,
GPACK_RGBA5551(40, 80, 255, 1) << 16 | GPACK_RGBA5551(40, 80, 255, 1));
gDPFillRectangle(gDisplayListHead++, 30, 220, 79, 222);
// Yellow
gDPPipeSync(gDisplayListHead++);
gDPSetFillColor(gDisplayListHead++,
GPACK_RGBA5551(255, 255, 40, 1) << 16 | GPACK_RGBA5551(255, 255, 40, 1));
gDPFillRectangle(gDisplayListHead++, 79, 220, 128, 222);
// Orange
gDPPipeSync(gDisplayListHead++);
gDPSetFillColor(gDisplayListHead++,
GPACK_RGBA5551(255, 120, 40, 1) << 16 | GPACK_RGBA5551(255, 120, 40, 1));
gDPFillRectangle(gDisplayListHead++, 128, 220, 177, 222);
// Red
gDPPipeSync(gDisplayListHead++);
gDPSetFillColor(gDisplayListHead++,
GPACK_RGBA5551(255, 40, 40, 1) << 16 | GPACK_RGBA5551(255, 40, 40, 1));
gDPFillRectangle(gDisplayListHead++, 177, 220, 226, 222);
}
/*
Draw Profiler Mode 1. This mode draws a traditional per-event bar for durations of tasks
recorded by the profiler calls of various threads.
Information:
(yellow): Level Scripts Execution
(orange): Rendering
(blue): Display Lists Send
(red): Sound Updates
(yellow): Time from SP tasks queued to RSP complete
(orange): Time from RSP complete to RDP complete (possibly bugged, see //! note below)
(red): VBlank Times
*/
void draw_profiler_mode_1(void) {
s32 i;
struct ProfilerFrameData *profiler;
OSTime clockBase;
// the profiler logs 2 frames of data: last frame and current frame. Indexes are used
// to keep track of the current frame, so the index is xor'd to retrieve the last frame's
// data.
profiler = &gProfilerFrameData[gCurrentFrameIndex1 ^ 1];
// calculate the clockBase.
clockBase = profiler->soundTimes[0] - (16433 * osClockRate / 1000000);
// draw the profiler for the time it takes for level scripts to execute. (yellow)
draw_profiler_bar(clockBase, profiler->gameTimes[0], profiler->gameTimes[1], 212,
GPACK_RGBA5551(255, 255, 40, 1));
// draw the profiler for the time it takes for the game to render (between level scripts and
// pre-display lists). (orange)
draw_profiler_bar(clockBase, profiler->gameTimes[1], profiler->gameTimes[2], 212,
GPACK_RGBA5551(255, 120, 40, 1));
// draw the profiler for the time it takes for the display lists to send. (blue)
draw_profiler_bar(clockBase, profiler->gameTimes[2], profiler->gameTimes[3], 212,
GPACK_RGBA5551(40, 192, 230, 1));
// we need to get the amount of finished numSoundTimes pairs, so get rid of the odd bit to get the
// limit of finished pairs.
profiler->numSoundTimes &= 0xFFFE;
// draw the sound update times. (red)
for (i = 0; i < profiler->numSoundTimes; i += 2) {
draw_profiler_bar(clockBase, profiler->soundTimes[i], profiler->soundTimes[i + 1], 212,
GPACK_RGBA5551(255, 40, 40, 1));
}
//! RSP and RDP run in parallel, so while they are not absolutely guaranteed to return in order,
// it is theoretically possible they might not. In all cases, the RDP should finish later than RSP.
// Thus, this is not really a bug in practice, but should still be noted that the C doesn't check
// this.
draw_profiler_bar(clockBase, profiler->gfxTimes[0], profiler->gfxTimes[1], 216,
GPACK_RGBA5551(255, 255, 40, 1));
// (orange)
draw_profiler_bar(clockBase, profiler->gfxTimes[1], profiler->gfxTimes[2], 216,
GPACK_RGBA5551(255, 120, 40, 1));
// like earlier, toss the odd bit.
profiler->numVblankTimes &= 0xFFFE;
// render the vblank time pairs. (red)
for (i = 0; i < profiler->numVblankTimes; i += 2) {
draw_profiler_bar(clockBase, profiler->vblankTimes[i], profiler->vblankTimes[i + 1], 216,
GPACK_RGBA5551(255, 40, 40, 1));
}
draw_reference_profiler_bars();
}
/*
Draw Profiler Mode 0. This mode renders bars over each other to make it
easier to see which processes take the longest.
Information:
(red): Sound Updates
(yellow): Level Script Execution
(orange): Rendering
(orange): RDP Duration
(yellow): RSP Duration
(red): VBlank Duration
*/
void draw_profiler_mode_0(void) {
s32 i;
struct ProfilerFrameData *profiler;
u64 clockStart;
u64 levelScriptDuration;
u64 renderDuration;
u64 taskStart;
u64 rspDuration;
u64 rdpDuration;
u64 vblank;
u64 soundDuration;
// get the last frame profiler. gCurrentFrameIndex1 has the current frame being processed, so
// xor it to get the last frame profiler.
profiler = &gProfilerFrameData[gCurrentFrameIndex1 ^ 1];
// was thread 5 ran before thread 4? set the lower one to be the clockStart.
clockStart = profiler->gameTimes[0] <= profiler->soundTimes[0] ? profiler->gameTimes[0]
: profiler->soundTimes[0];
// set variables for duration of tasks.
levelScriptDuration = profiler->gameTimes[1] - clockStart;
renderDuration = profiler->gameTimes[2] - profiler->gameTimes[1];
taskStart = 0;
rspDuration = profiler->gfxTimes[1] - profiler->gfxTimes[0];
rdpDuration = profiler->gfxTimes[2] - profiler->gfxTimes[0];
vblank = 0;
// like above functions, toss the odd bit.
profiler->numSoundTimes &= 0xFFFE;
// sound duration seems to be rendered with empty space and not actually drawn.
for (i = 0; i < profiler->numSoundTimes; i += 2) {
// calculate sound duration of max - min
soundDuration = profiler->soundTimes[i + 1] - profiler->soundTimes[i];
taskStart += soundDuration;
// was the sound time minimum less than level script execution?
if (profiler->soundTimes[i] < profiler->gameTimes[1]) {
// overlay the levelScriptDuration onto the profiler by subtracting the soundDuration.
levelScriptDuration -= soundDuration;
} else if (profiler->soundTimes[i] < profiler->gameTimes[2]) {
// overlay the renderDuration onto the profiler by subtracting the soundDuration.
renderDuration -= soundDuration;
}
}
// same as above. toss the odd bit.
profiler->numSoundTimes &= 0xFFFE;
//! wrong index used to retrieve vblankTimes, thus empty pairs can
// potentially be passed to draw_profiler_bar, because it could be sending
// pairs that are beyond the numVblankTimes enforced non-odd limit, due to
// using the wrong num value.
for (i = 0; i < profiler->numSoundTimes; i += 2) {
vblank += (profiler->vblankTimes[i + 1] - profiler->vblankTimes[i]);
}
// Draw top profilers.
// draw sound duration as the first bar. (red)
clockStart = 0;
draw_profiler_bar(0, clockStart, clockStart + taskStart, 212, GPACK_RGBA5551(255, 40, 40, 1));
// draw level script execution duration. (yellow)
clockStart += taskStart;
draw_profiler_bar(0, clockStart, clockStart + levelScriptDuration, 212,
GPACK_RGBA5551(255, 255, 40, 1));
// draw render duration. (orange)
clockStart += levelScriptDuration;
draw_profiler_bar(0, clockStart, clockStart + renderDuration, 212,
GPACK_RGBA5551(255, 120, 40, 1));
// Draw bottom profilers.
// rdp duration (orange)
draw_profiler_bar(0, 0, rdpDuration, 216, GPACK_RGBA5551(255, 120, 40, 1));
// rsp duration (yellow)
draw_profiler_bar(0, 0, rspDuration, 216, GPACK_RGBA5551(255, 255, 40, 1));
// vblank duration (red)
draw_profiler_bar(0, 0, vblank, 216, GPACK_RGBA5551(255, 40, 40, 1));
draw_reference_profiler_bars();
}
// Draw the Profiler per frame. Toggle the mode if the player presses L while this
// renderer is active.
void draw_profiler(void) {
if (gPlayer1Controller->buttonPressed & L_TRIG) {
gProfilerMode ^= 1;
}
if (gProfilerMode == 0) {
draw_profiler_mode_0();
} else {
draw_profiler_mode_1();
}
}

View File

@@ -1,51 +0,0 @@
#ifndef PROFILER_H
#define PROFILER_H
#include <PR/ultratypes.h>
#include <PR/os_time.h>
#include "types.h"
extern u64 osClockRate;
struct ProfilerFrameData {
/* 0x00 */ s16 numSoundTimes;
/* 0x02 */ s16 numVblankTimes;
// gameTimes:
// 0: thread 5 start
// 1: level script execution
// 2: render
// 3: display lists
// 4: thread 4 end (0 terminated)
/* 0x08 */ OSTime gameTimes[5];
// gfxTimes:
// 0: processors queued
// 1: rsp completed
// 2: rdp completed
/* 0x30 */ OSTime gfxTimes[3];
/* 0x48 */ OSTime soundTimes[8];
/* 0x88 */ OSTime vblankTimes[8];
};
// thread event IDs
enum ProfilerGameEvent {
THREAD5_START,
LEVEL_SCRIPT_EXECUTE,
BEFORE_DISPLAY_LISTS,
AFTER_DISPLAY_LISTS,
THREAD5_END
};
enum ProfilerGfxEvent {
TASKS_QUEUED,
RSP_COMPLETE,
RDP_COMPLETE
};
void profiler_log_thread5_time(enum ProfilerGameEvent eventID);
void profiler_log_thread4_time(void);
void profiler_log_gfx_time(enum ProfilerGfxEvent eventID);
void profiler_log_vblank_time(void);
void draw_profiler(void);
#endif // PROFILER_H

View File

@@ -451,7 +451,7 @@ void puppycam_check_pause_buttons(void) {
play_sound(SOUND_MENU_CHANGE_SELECT, gGlobalSoundSource);
if (gPlayer1Controller->rawStickX >= 60 || gPlayer1Controller->buttonDown & R_JPAD) {
puppycam_change_setting(1);
} else if (gPlayer1Controller->rawStickX <= -60 || gPlayer1Controller->buttonDown & L_JPAD)
} else if (gPlayer1Controller->rawStickX <= -60 || gPlayer1Controller->buttonDown & L_JPAD) {
puppycam_change_setting(-1);
}
}
@@ -1079,7 +1079,7 @@ void puppycam_projection_behaviours(void) {
gPuppyCam.floorY[1] = 0;
gPuppyCam.targetFloorHeight = gPuppyCam.targetObj->oPosY;
gPuppyCam.lastTargetFloorHeight = gPuppyCam.targetObj->oPosY;
gPuppyCam.yawTarget = approach_angle(gPuppyCam.yawTarget, (gMarioState->faceAngle[1] + 0x8000), (1000 * (gMarioState->forwardVel / 32)));
if (gMarioState->waterLevel - 100 - gMarioState->pos[1] > 5 && gPuppyCam.flags & PUPPYCAM_BEHAVIOUR_PITCH_ROTATION) {
gPuppyCam.swimPitch = approach_f32_asymptotic(gPuppyCam.swimPitch,gMarioState->faceAngle[0] / 10, 0.05f);

View File

@@ -31,7 +31,6 @@ a modern game engine's developer's console.
#include "game_init.h"
#include "memory.h"
#include "print.h"
#include "segment2.h"
#include "string.h"
#include "stdarg.h"
#include "printf.h"
@@ -265,7 +264,7 @@ void print_ram_overview(void) {
sprintf(textBytes, "Segment %02X: %X", i - nameTable + 2, ramsizeSegment[i]);
}
print_set_envcolour(colourChart[i][0], colourChart[i][1], colourChart[i][2], 255);
print_small_text(x, y, textBytes, PRINT_TEXT_ALIGN_CENTRE, PRINT_ALL);
print_small_text(x, y, textBytes, PRINT_TEXT_ALIGN_CENTRE, PRINT_ALL, FONT_DEFAULT);
y += 12;
drawn++;
}
@@ -306,7 +305,7 @@ void print_which_benchmark(void) {
render_blank_box(110, 115, 210, 160, 0, 0, 0, 255);
finish_blank_box();
sprintf(textBytes, "Select Option#%s#L: Confirm", benchNames[benchOption]);
print_small_text(160,120, textBytes, PRINT_TEXT_ALIGN_CENTRE, PRINT_ALL);
print_small_text(160,120, textBytes, PRINT_TEXT_ALIGN_CENTRE, PRINT_ALL, FONT_DEFAULT);
}
char consoleLogTable[LOG_BUFFER_SIZE][255];
@@ -346,7 +345,7 @@ void print_console_log(void) {
if (consoleLogTable[i] == NULL) {
continue;
}
print_small_text(16, (LINE_HEIGHT) - (i * 12), consoleLogTable[i], PRINT_TEXT_ALIGN_LEFT, PRINT_ALL);
print_small_text(16, (LINE_HEIGHT) - (i * 12), consoleLogTable[i], PRINT_TEXT_ALIGN_LEFT, PRINT_ALL, FONT_DEFAULT);
}
}
#undef LINE_HEIGHT
@@ -373,7 +372,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);
print_small_text(160, 224, textBytes, PRINT_TEXT_ALIGN_CENTRE, PRINT_ALL, FONT_OUTLINE);
if (!ramViewer && !benchViewer && !logViewer) {
print_fps(16,40);
@@ -382,20 +381,20 @@ void puppyprint_render_profiler(void) {
#else
sprintf(textBytes, "CPU: %dus (%d_)#RSP: %dus (%d_)#RDP: %dus (%d_)", (s32)cpuCount, (s32)(cpuCount / 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);
#endif
print_small_text(16, 52, textBytes, PRINT_TEXT_ALIGN_LEFT, PRINT_ALL);
print_small_text(16, 52, textBytes, PRINT_TEXT_ALIGN_LEFT, PRINT_ALL, FONT_OUTLINE);
sprintf(textBytes, "OBJ: %d/%d", gObjectCounter, OBJECT_POOL_CAPACITY);
print_small_text(16, 124, textBytes, PRINT_TEXT_ALIGN_LEFT, PRINT_ALL);
print_small_text(16, 124, textBytes, PRINT_TEXT_ALIGN_LEFT, PRINT_ALL, FONT_OUTLINE);
// Very little point printing useless info if Mayro doesn't even exist.
if (gMarioState->marioObj) {
sprintf(textBytes, "Mario Pos#X: %d#Y: %d#Z: %d#D: %X", (s32)(gMarioState->pos[0]), (s32)(gMarioState->pos[1]), (s32)(gMarioState->pos[2]), (u16)(gMarioState->faceAngle[1]));
print_small_text(16, 140, textBytes, PRINT_TEXT_ALIGN_LEFT, PRINT_ALL);
print_small_text(16, 140, textBytes, PRINT_TEXT_ALIGN_LEFT, PRINT_ALL, FONT_OUTLINE);
}
// Same for the camera, especially so because this will crash otherwise.
if (gCamera) {
sprintf(textBytes, "Camera Pos#X: %d#Y: %d#Z: %d#D: %X", (s32)(gCamera->pos[0]), (s32)(gCamera->pos[1]), (s32)(gCamera->pos[2]), (u16)(gCamera->yaw));
print_small_text(304, 140, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL);
print_small_text(304, 140, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL, FONT_OUTLINE);
}
if (benchmarkTimer > 0) {
@@ -408,9 +407,9 @@ void puppyprint_render_profiler(void) {
// sprintf(textBytes, "Benchmark: %dus#High: %dus", (s32)OS_CYCLES_TO_USEC(benchMark[NUM_BENCH_ITERATIONS]), (s32)OS_CYCLES_TO_USEC(benchMark[NUM_BENCH_ITERATIONS+1]));
sprintf(textBytes, "Done in %0.000f seconds#Benchmark: %dus#High: %dus", (f32)(benchmarkProgramTimer) * 0.000001f, (s32)OS_CYCLES_TO_USEC(benchMark[NUM_BENCH_ITERATIONS]), (s32)OS_CYCLES_TO_USEC(benchMark[NUM_BENCH_ITERATIONS + 1]));
#endif
render_blank_box(160 - (get_text_width(textBytes) / 2) - 4, 158, 160 + (get_text_width(textBytes) / 2) + 4, 196, 0, 0, 0, 255);
render_blank_box(160 - (get_text_width(textBytes, FONT_OUTLINE) / 2) - 4, 158, 160 + (get_text_width(textBytes, FONT_OUTLINE) / 2) + 4, 196, 0, 0, 0, 255);
print_set_envcolour(255, 255, 255, 255);
print_small_text(160, 160, textBytes, PRINT_TEXT_ALIGN_CENTRE, PRINT_ALL);
print_small_text(160, 160, textBytes, PRINT_TEXT_ALIGN_CENTRE, PRINT_ALL, FONT_OUTLINE);
finish_blank_box();
}
@@ -424,26 +423,26 @@ void puppyprint_render_profiler(void) {
#ifdef PUPPYPRINT_DEBUG_CYCLES
sprintf(textBytes, "Collision: <COL_99505099>%dc", (s32)(collisionTime[NUM_PERF_ITERATIONS]));
print_small_text(304, 40, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL);
print_small_text(304, 40, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL, FONT_OUTLINE);
sprintf(textBytes, "Graph: <COL_50509999>%dc", (s32)(graphTime[NUM_PERF_ITERATIONS]));
print_small_text(304, 52, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL);
print_small_text(304, 52, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL, FONT_OUTLINE);
sprintf(textBytes, "Behaviour: <COL_50995099>%dc", (s32)(behaviourTime[NUM_PERF_ITERATIONS]));
print_small_text(304, 64, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL);
print_small_text(304, 64, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL, FONT_OUTLINE);
sprintf(textBytes, "Audio: <COL_99995099>%dc", (s32)(audioTime[NUM_PERF_ITERATIONS]));
print_small_text(304, 76, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL);
print_small_text(304, 76, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL, FONT_OUTLINE);
sprintf(textBytes, "DMA: <COL_99509999>%dc", (s32)(dmaTime[NUM_PERF_ITERATIONS]));
print_small_text(304, 88, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL);
print_small_text(304, 88, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL, FONT_OUTLINE);
#else
sprintf(textBytes, "Collision: <COL_99505099>%dus", (s32)OS_CYCLES_TO_USEC(collisionTime[NUM_PERF_ITERATIONS]));
print_small_text(304, 40, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL);
print_small_text(304, 40, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL, FONT_OUTLINE);
sprintf(textBytes, "Graph: <COL_50509999>%dus", (s32)OS_CYCLES_TO_USEC(graphTime[NUM_PERF_ITERATIONS]));
print_small_text(304, 52, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL);
print_small_text(304, 52, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL, FONT_OUTLINE);
sprintf(textBytes, "Behaviour: <COL_50995099>%dus", (s32)OS_CYCLES_TO_USEC(behaviourTime[NUM_PERF_ITERATIONS]));
print_small_text(304, 64, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL);
print_small_text(304, 64, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL, FONT_OUTLINE);
sprintf(textBytes, "Audio: <COL_99995099>%dus", (s32)OS_CYCLES_TO_USEC(audioTime[NUM_PERF_ITERATIONS]));
print_small_text(304, 76, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL);
print_small_text(304, 76, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL, FONT_OUTLINE);
sprintf(textBytes, "DMA: <COL_99509999>%dus", (s32)OS_CYCLES_TO_USEC(dmaTime[NUM_PERF_ITERATIONS]));
print_small_text(304, 88, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL);
print_small_text(304, 88, textBytes, PRINT_TEXT_ALIGN_RIGHT, PRINT_ALL, FONT_OUTLINE);
#endif
// Render CPU breakdown bar.
@@ -595,7 +594,7 @@ void finish_blank_box(void) {
// This does some epic shenanigans to figure out the optimal way to draw this.
// If the width is a multiple of 4, then use fillmode (fastest)
// Otherwise, if there's transparency, it uses that rendermode, which is slower than using opaque rendermodes.
void render_blank_box(s16 x1, s16 y1, s16 x2, s16 y2, u8 r, u8 g, u8 b, u8 a) {
void render_blank_box(s32 x1, s32 y1, s32 x2, s32 y2, s32 r, s32 g, s32 b, s32 a) {
s32 cycleadd = 0;
if (ABS(x1 - x2) % 4 == 0 && a == 255) {
gDPSetCycleType(gDisplayListHead++, G_CYC_FILL);
@@ -616,19 +615,12 @@ void render_blank_box(s16 x1, s16 y1, s16 x2, s16 y2, u8 r, u8 g, u8 b, u8 a) {
gDPFillRectangle(gDisplayListHead++, x1, y1, x2-cycleadd, y2-cycleadd);
}
u8 textLen[] = {
/*0*/ 7, /*1*/ 7, /*2*/ 7, /*3*/ 7, /*4*/ 7, /*5*/ 7, /*6*/ 7, /*7*/ 7, /*8*/ 7, /*9*/ 7, /*-*/ 7, /*+*/ 7, /*(*/ 4, /*)*/ 4, /*!*/ 5, /*?*/ 6,
/*A*/ 7, /*B*/ 7, /*C*/ 7, /*D*/ 7, /*E*/ 7, /*F*/ 7, /*G*/ 7, /*H*/ 7, /*I*/ 7, /*J*/ 7, /*K*/ 7, /*L*/ 7, /*M*/ 7, /*N*/ 7, /*O*/ 7, /*P*/ 7,
/*Q*/ 7, /*R*/ 7, /*S*/ 7, /*T*/ 7, /*U*/ 7, /*V*/ 7, /*W*/ 7, /*X*/ 7, /*Y*/ 7, /*Z*/ 7, /*"*/ 5, /*'*/ 2, /*:*/ 3, /*;*/ 3, /*.*/ 3, /*,*/ 3,
/*a*/ 6, /*b*/ 6, /*c*/ 6, /*d*/ 6, /*e*/ 6, /*f*/ 6, /*g*/ 6, /*h*/ 6, /*i*/ 2, /*j*/ 6, /*k*/ 6, /*l*/ 3, /*m*/ 6, /*n*/ 6, /*o*/ 6, /*p*/ 6,
/*q*/ 6, /*r*/ 6, /*s*/ 6, /*t*/ 6, /*u*/ 6, /*v*/ 6, /*w*/ 6, /*x*/ 6, /*y*/ 6, /*z*/ 6, /*~*/ 7, /*¨*/ 6, /*^*/ 7, /*/*/ 6, /*%*/ 6, /*&*/ 7,
};
#include "level_update.h"
void get_char_from_byte(u8 letter, s32 *textX, s32 *textY, s32 *spaceX, s32 *offsetY) {
void get_char_from_byte(u8 letter, s32 *textX, s32 *textY, s32 *spaceX, s32 *offsetY, s32 font) {
*offsetY = 0;
u8 **textKern = segmented_to_virtual(puppyprint_kerning_lut);
u8 *textLen = segmented_to_virtual(textKern[font]);
if (letter >= '0' && letter <= '9') { // Line 1
*textX = (letter - '0') * 4;
*textY = 0;
@@ -680,8 +672,8 @@ void get_char_from_byte(u8 letter, s32 *textX, s32 *textY, s32 *spaceX, s32 *off
// This is for the letters that sit differently on the line. It just moves them down a bit.
case 'g': *offsetY = 1; break;
case 'q': *offsetY = 1; break;
// case 'p': *offsetY = 1; break;
// case 'y': *offsetY = 1; break;
case 'p': if (font == FONT_DEFAULT) *offsetY = 3; break;
case 'y': if (font == FONT_DEFAULT) *offsetY = 1; break;
}
}
@@ -756,7 +748,7 @@ s32 text_iterate_command(const char *str, s32 i, s32 runCMD) {
return len;
}
s32 get_text_width(const char *str) {
s32 get_text_width(const char *str, s32 font) {
s32 i= 0;
s32 textPos = 0;
s32 wideX = 0;
@@ -770,7 +762,7 @@ s32 get_text_width(const char *str) {
if (str[i] == '<') {
i += text_iterate_command(str, i, FALSE);
}
get_char_from_byte(str[i], &textX, &textY, &spaceX, &offsetY);
get_char_from_byte(str[i], &textX, &textY, &spaceX, &offsetY, font);
textPos += spaceX + 1;
wideX = MAX(textPos, wideX);
}
@@ -790,7 +782,7 @@ s32 get_text_height(const char *str) {
return textPos;
}
void print_small_text(s32 x, s32 y, const char *str, s32 align, s32 amount)
void print_small_text(s32 x, s32 y, const char *str, s32 align, s32 amount, s32 font)
{
s32 textX = 0;
s32 textY = 0;
@@ -805,6 +797,7 @@ void print_small_text(s32 x, s32 y, const char *str, s32 align, s32 amount)
s32 lines = 0;
s32 xlu = currEnv[3];
s32 prevxlu = 256; //Set out of bounds, so it will *always* be different at first.
Texture *(*fontTex)[] = segmented_to_virtual(&puppyprint_font_lut);
shakeToggle = 0;
waveToggle = 0;
@@ -825,7 +818,7 @@ void print_small_text(s32 x, s32 y, const char *str, s32 align, s32 amount)
if (str[i] == '<') {
i += text_iterate_command(str, i, FALSE);
}
get_char_from_byte(str[i], &textX, &textY, &spaceX, &offsetY);
get_char_from_byte(str[i], &textX, &textY, &spaceX, &offsetY, font);
textPos[0] += spaceX + 1;
wideX[lines] = MAX(textPos[0], wideX[lines]);
}
@@ -842,14 +835,14 @@ void print_small_text(s32 x, s32 y, const char *str, s32 align, s32 amount)
if (str[i] == '<') {
i += text_iterate_command(str, i, FALSE);
}
get_char_from_byte(str[i], &textX, &textY, &spaceX, &offsetY);
get_char_from_byte(str[i], &textX, &textY, &spaceX, &offsetY, font);
wideX[lines] = MAX(textPos[0], wideX[lines]);
}
textPos[0] = -wideX[0];
}
lines = 0;
gDPLoadTextureBlock_4b(gDisplayListHead++, segmented_to_virtual(small_font), G_IM_FMT_I, 128, 60, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 0, 0, 0, 0, 0);
gDPLoadTextureBlock_4b(gDisplayListHead++, (*fontTex)[font], G_IM_FMT_I, 128, 60, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 0, 0, 0, 0, 0);
for (i = 0; i < tx; i++) {
if (str[i] == '#') {
i++;
@@ -876,7 +869,7 @@ void print_small_text(s32 x, s32 y, const char *str, s32 align, s32 amount)
} else {
wavePos = 0;
}
get_char_from_byte(str[i], &textX, &textY, &spaceX, &offsetY);
get_char_from_byte(str[i], &textX, &textY, &spaceX, &offsetY, font);
if (xlu != prevxlu) {
prevxlu = xlu;
if (xlu > 250) {

View File

@@ -2,6 +2,7 @@
#define PUPPYPRINT_H
#ifdef PUPPYPRINT
#include "segment2.h"
// 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
@@ -17,7 +18,13 @@
#define PRINT_TEXT_ALIGN_RIGHT 2
#define PRINT_ALL -1
extern Texture small_font[];
enum PuppyFont {
FONT_DEFAULT,
FONT_OUTLINE,
FONT_NUM,
};
extern u8 gPuppyFont;
extern s8 perfIteration;
extern s16 benchmarkLoop;
extern s32 benchmarkTimer;
@@ -62,14 +69,13 @@ extern void puppyprint_profiler_finished(void);
extern void print_set_envcolour(s32 r, s32 g, s32 b, s32 a);
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 print_small_text(s32 x, s32 y, const char *str, s32 align, s32 amount);
extern void print_small_text(s32 x, s32 y, const char *str, s32 align, s32 amount, s32 font);
extern void render_multi_image(Texture *image, s32 x, s32 y, s32 width, s32 height, s32 scaleX, s32 scaleY, s32 mode);
extern s32 get_text_height(const char *str);
extern s32 get_text_width(const char *str);
extern s32 get_text_width(const char *str, s32 font);
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 render_blank_box(s32 x1, s32 y1, s32 x2, s32 y2, s32 r, s32 g, s32 b, s32 a);
extern void append_puppyprint_log(const char *str, ...);
extern char consoleLogTable[LOG_BUFFER_SIZE][255];

View File

@@ -15,6 +15,7 @@
#include "puppyprint.h"
#include "debug_box.h"
#include "level_update.h"
#include "behavior_data.h"
#include "config.h"
@@ -426,7 +427,6 @@ void geo_process_perspective(struct GraphNodePerspective *node) {
if (gCamera) {
// gWorldScale = ((sqr(gCamera->pos[0]) + sqr(gCamera->pos[1]) + sqr(gCamera->pos[2])) / sqr(0x2000));
gWorldScale = (max_3f(ABS(gCamera->pos[0]), ABS(gCamera->pos[1]), ABS(gCamera->pos[2])) / (f32)0x2000);
gWorldScale = MAX(gWorldScale, 1.0f);
} else {
gWorldScale = 1.0f;
}
@@ -435,6 +435,7 @@ void geo_process_perspective(struct GraphNodePerspective *node) {
farClipDelta /= farClip;
gWorldScale *= farClipDelta;
}
gWorldScale = MAX(gWorldScale, 1.0f);
guPerspective(mtx, &perspNorm, node->fov, sAspectRatio, ((farClip / 300) / gWorldScale), (farClip / gWorldScale), 1.0f);
gSPPerspNormalize(gDisplayListHead++, perspNorm);
@@ -965,7 +966,10 @@ void geo_process_object(struct Object *node) {
if (node->oIntangibleTimer != -1) {
vec3f_set(bnds1, node->oPosX, node->oPosY - node->hitboxDownOffset, node->oPosZ);
vec3f_set(bnds2, node->hitboxRadius, node->hitboxHeight-node->hitboxDownOffset, node->hitboxRadius);
debug_box_color(0x800000FF);
if (node->behavior == segmented_to_virtual(bhvWarp) || node->behavior == segmented_to_virtual(bhvDoorWarp) || node->behavior == segmented_to_virtual(bhvFadingWarp))
debug_box_color(0x80FFA500);
else
debug_box_color(0x800000FF);
debug_box(bnds1, bnds2, DEBUG_SHAPE_CYLINDER | DEBUG_UCODE_REJ);
vec3f_set(bnds1, node->oPosX, node->oPosY - node->hitboxDownOffset, node->oPosZ);
vec3f_set(bnds2, node->hurtboxRadius, node->hurtboxHeight, node->hurtboxRadius);

View File

@@ -4,6 +4,9 @@
#include <PR/ultratypes.h>
#include <PR/gbi.h>
extern void *puppyprint_font_lut[2];
extern void *puppyprint_kerning_lut[2][80];
extern u8 seg2_course_name_table[];
extern u8 seg2_act_name_table[];
extern Gfx dl_rgba16_text_begin[];

View File

@@ -9,7 +9,6 @@
#include "main.h"
#include "paintings.h"
#include "print.h"
#include "profiler.h"
#include "save_file.h"
#include "seq_ids.h"
#include "sm64.h"
@@ -358,12 +357,10 @@ void thread4_sound(UNUSED void *arg) {
#endif
if (gResetTimer < 25) {
struct SPTask *spTask;
profiler_log_thread4_time();
spTask = create_next_audio_frame_task();
if (spTask != NULL) {
dispatch_audio_sptask(spTask);
}
profiler_log_thread4_time();
#if PUPPYPRINT_DEBUG
profiler_update(audioTime, lastTime);
audioTime[perfIteration] -= dmaAudioTime[perfIteration];