Merge branch 'master' into puppycamera2

This commit is contained in:
Fazana committed 2021-08-26 19:45:48 +01:00
commit 8bc9863abe
24 files changed
+155 -98

No files matched your search

+1 -1
View File
@@ -337,7 +337,7 @@ ACTOR_DIR := actors
LEVEL_DIRS := $(patsubst levels/%,%,$(dir $(wildcard levels/*/header.h)))
# Directories containing source files
SRC_DIRS += src src/game src/engine src/audio src/menu src/buffers actors levels bin data assets asm lib sound
SRC_DIRS += src src/boot src/game src/engine src/audio src/menu src/buffers actors levels bin data assets asm lib sound
LIBZ_SRC_DIRS := src/libz
GODDARD_SRC_DIRS := src/goddard src/goddard/dynlists
BIN_DIRS := bin bin/$(VERSION)
+8 -8
View File
@@ -6,7 +6,7 @@ index f50b7622..124c7ec6 100644
$(BUILD_DIR)/src/menu/file_select.o: $(BUILD_DIR)/include/text_strings.h
$(BUILD_DIR)/src/menu/star_select.o: $(BUILD_DIR)/include/text_strings.h
$(BUILD_DIR)/src/game/ingame_menu.o: $(BUILD_DIR)/include/text_strings.h
+$(BUILD_DIR)/src/game/mem_error_screen.o: $(BUILD_DIR)/include/text_strings.h
+$(BUILD_DIR)/src/boot/mem_error_screen.o: $(BUILD_DIR)/include/text_strings.h
#==============================================================================#
@@ -137,14 +137,14 @@ index d41a91c8..7d047236 100644
struct LevelCommand *level_script_execute(struct LevelCommand *cmd);
diff --git a/src/game/main.c b/src/game/main.c
diff --git a/src/boot/main.c b/src/boot/main.c
index 1a9d9e7e..f4f7a9e5 100644
--- a/src/game/main.c
+++ b/src/game/main.c
--- a/src/boot/main.c
+++ b/src/boot/main.c
@@ -11,6 +11,7 @@
#include "segments.h"
#include "main.h"
#include "rumble_init.h"
#include "game/main.h"
#include "game/rumble_init.h"
+#include "mem_error_screen.h"
// Message IDs
@@ -172,11 +172,11 @@ index 1a9d9e7e..f4f7a9e5 100644
osStartThread(&gGameLoopThread);
while (TRUE) {
diff --git a/src/game/mem_error_screen.c b/src/game/mem_error_screen.c
diff --git a/src/boot/mem_error_screen.c b/src/boot/mem_error_screen.c
new file mode 100644
index 00000000..f432927c
--- /dev/null
+++ b/src/game/mem_error_screen.c
+++ b/src/boot/mem_error_screen.c
@@ -0,0 +1,104 @@
+/* clang-format off */
+/*
+8 -8
View File
@@ -148,9 +148,8 @@ SECTIONS
{
KEEP(BUILD_DIR/asm/entry.o(.text));
BUILD_DIR/src/game*.o(.text);
BUILD_DIR/src/boot*.o(.text);
BUILD_DIR/src/hvqm*.o(.text);
BUILD_DIR/src/gdb*.o(.text);
BUILD_DIR/src/usb*.o(.text);
BUILD_DIR/src/audio*.o(.text);
#ifdef S2DEX_TEXT_ENGINE
@@ -169,8 +168,7 @@ SECTIONS
lib/PR/hvqm/hvqm2sp1.o(.text);
/* data */
BUILD_DIR/src/game*.o(.*data*);
BUILD_DIR/src/gdb*.o(.*data*);
BUILD_DIR/src/boot*.o(.*data*);
BUILD_DIR/src/usb*.o(.*data*);
BUILD_DIR/src/audio*.o(.*data*);
#ifdef S2DEX_TEXT_ENGINE
@@ -188,8 +186,7 @@ SECTIONS
lib/PR/hvqm/hvqm2sp1.o(.data*);
/* rodata */
BUILD_DIR/src/game*.o(.rodata*);
BUILD_DIR/src/gdb*.o(.*rodata*);
BUILD_DIR/src/boot*.o(.rodata*);
BUILD_DIR/src/usb*.o(.rodata*);
BUILD_DIR/src/audio*.o(.rodata*);
#ifdef S2DEX_TEXT_ENGINE
@@ -212,9 +209,8 @@ SECTIONS
#endif
BEGIN_NOLOAD(main)
{
BUILD_DIR/src/game*.o(.*bss*);
BUILD_DIR/src/boot*.o(.*bss*);
BUILD_DIR/src/hvqm*.o(.*bss*);
BUILD_DIR/src/gdb*.o(.*bss*);
BUILD_DIR/src/usb*.o(.*bss*);
BUILD_DIR/src/audio*.o(.*bss*);
#ifdef S2DEX_TEXT_ENGINE
@@ -239,16 +235,20 @@ SECTIONS
BEGIN_SEG(engine, .)
{
BUILD_DIR/src/game*.o(.text);
BUILD_DIR/src/engine*.o(.text);
/* data */
BUILD_DIR/src/game*.o(.*data*);
BUILD_DIR/src/engine*.o(.data*);
BUILD_DIR/src/engine*.o(.sdata*);
/* rodata */
BUILD_DIR/src/game*.o(.rodata*);
BUILD_DIR/src/engine*.o(.rodata*);
}
END_SEG(engine)
BEGIN_NOLOAD(engine)
{
BUILD_DIR/src/game*.o(.*bss*);
BUILD_DIR/src/engine*.o(.bss*);
. = ALIGN(0x40);
}
+2
View File
@@ -292,6 +292,7 @@ void note_vibrato_init(struct Note *note) {
vib = &note->vibratoState;
/* This code was probably removed from EU and SH for a reason; probably because it's dumb and makes vibrato harder to use well.
#if defined(VERSION_JP) || defined(VERSION_US)
if (note->parentLayer->seqChannel->vibratoExtentStart == 0
&& note->parentLayer->seqChannel->vibratoExtentTarget == 0
@@ -300,6 +301,7 @@ void note_vibrato_init(struct Note *note) {
return;
}
#endif
*/
vib->active = TRUE;
vib->time = 0;
+6 -6
View File
@@ -340,7 +340,7 @@ extern s32 D_SH_80315EE8;
void sound_init_main_pools(s32 sizeForAudioInitPool) {
sound_alloc_pool_init(&gAudioInitPool, gAudioHeap, sizeForAudioInitPool);
sound_alloc_pool_init(&gAudioSessionPool, gAudioHeap + sizeForAudioInitPool, gAudioHeapSize - sizeForAudioInitPool);
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
audioPool[0] = sizeForAudioInitPool;
audioPool[1] = gAudioHeapSize - sizeForAudioInitPool;
#endif
@@ -356,7 +356,7 @@ void session_pools_init(struct PoolSplit *a) {
gAudioSessionPool.cur = gAudioSessionPool.start;
sound_alloc_pool_init(&gNotesAndBuffersPool, SOUND_ALLOC_FUNC(&gAudioSessionPool, a->wantSeq), a->wantSeq);
sound_alloc_pool_init(&gSeqAndBankPool, SOUND_ALLOC_FUNC(&gAudioSessionPool, a->wantCustom), a->wantCustom);
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
audioPool[2] = a->wantSeq;
audioPool[3] = a->wantCustom;
#endif
@@ -366,7 +366,7 @@ void seq_and_bank_pool_init(struct PoolSplit2 *a) {
gSeqAndBankPool.cur = gSeqAndBankPool.start;
sound_alloc_pool_init(&gPersistentCommonPool, SOUND_ALLOC_FUNC(&gSeqAndBankPool, a->wantPersistent), a->wantPersistent);
sound_alloc_pool_init(&gTemporaryCommonPool, SOUND_ALLOC_FUNC(&gSeqAndBankPool, a->wantTemporary), a->wantTemporary);
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
audioPool[4] = a->wantPersistent;
audioPool[5] = a->wantTemporary;
#endif
@@ -377,7 +377,7 @@ void persistent_pools_init(struct PoolSplit *a) {
sound_alloc_pool_init(&gSeqLoadedPool.persistent.pool, SOUND_ALLOC_FUNC(&gPersistentCommonPool, a->wantSeq), a->wantSeq);
sound_alloc_pool_init(&gBankLoadedPool.persistent.pool, SOUND_ALLOC_FUNC(&gPersistentCommonPool, a->wantBank), a->wantBank);
sound_alloc_pool_init(&gUnusedLoadedPool.persistent.pool, SOUND_ALLOC_FUNC(&gPersistentCommonPool, a->wantUnused), a->wantUnused);
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
audioPool[6] = a->wantSeq;
audioPool[7] = a->wantBank;
audioPool[8] = a->wantUnused;
@@ -392,7 +392,7 @@ void temporary_pools_init(struct PoolSplit *a) {
sound_alloc_pool_init(&gSeqLoadedPool.temporary.pool, SOUND_ALLOC_FUNC(&gTemporaryCommonPool, a->wantSeq), a->wantSeq);
sound_alloc_pool_init(&gBankLoadedPool.temporary.pool, SOUND_ALLOC_FUNC(&gTemporaryCommonPool, a->wantBank), a->wantBank);
sound_alloc_pool_init(&gUnusedLoadedPool.temporary.pool, SOUND_ALLOC_FUNC(&gTemporaryCommonPool, a->wantUnused), a->wantUnused);
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
audioPool[9] = a->wantSeq;
audioPool[10] = a->wantBank;
audioPool[11] = a->wantUnused;
@@ -1275,7 +1275,7 @@ void audio_reset_session(void) {
if (toggleBetterReverb && betterReverbWindowsSize >= 0)
reverbWindowSize = betterReverbWindowsSize;
if (gReverbDownsampleRate < (1 << (reverbConsole - 1)))
gReverbDownsampleRate = (1 << (reverbConsole - 1));
reverbWindowSize /= gReverbDownsampleRate;
+11 -11
View File
@@ -142,12 +142,12 @@ u8 audioString49[] = "BANK LOAD MISS! FOR %d\n";
* Performs an asynchronus (normal priority) DMA copy
*/
void audio_dma_copy_async(uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQueue *queue, OSIoMesg *mesg) {
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
OSTime first = osGetTime();
#endif
osInvalDCache(vAddr, nbytes);
osPiStartDma(mesg, OS_MESG_PRI_NORMAL, OS_READ, devAddr, vAddr, nbytes, queue);
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
dmaAudioTime[perfIteration] += osGetTime()-first;
#endif
}
@@ -157,7 +157,7 @@ void audio_dma_copy_async(uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQ
* to 0x1000 bytes transfer at once.
*/
void audio_dma_partial_copy_async(uintptr_t *devAddr, u8 **vAddr, ssize_t *remaining, OSMesgQueue *queue, OSIoMesg *mesg) {
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
OSTime first = osGetTime();
#endif
#if defined(VERSION_EU)
@@ -170,7 +170,7 @@ void audio_dma_partial_copy_async(uintptr_t *devAddr, u8 **vAddr, ssize_t *remai
osPiStartDma(mesg, OS_MESG_PRI_NORMAL, OS_READ, *devAddr, *vAddr, transfer, queue);
*devAddr += transfer;
*vAddr += transfer;
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
dmaAudioTime[perfIteration] += osGetTime()-first;
#endif
}
@@ -220,7 +220,7 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
u32 dmaIndex;
ssize_t bufferPos;
UNUSED u32 pad;
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
OSTime first = osGetTime();
#endif
@@ -248,12 +248,12 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
dma->ttl = 60;
*dmaIndexRef = (u8) i;
#if defined(VERSION_EU)
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
dmaAudioTime[perfIteration] += osGetTime()-first;
#endif
return &dma->buffer[(devAddr - dma->source)];
#else
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
dmaAudioTime[perfIteration] += osGetTime()-first;
#endif
return (devAddr - dma->source) + dma->buffer;
@@ -296,12 +296,12 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
}
dma->ttl = 2;
#if defined(VERSION_EU)
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
dmaAudioTime[perfIteration] += osGetTime()-first;
#endif
return dma->buffer + (devAddr - dma->source);
#else
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
dmaAudioTime[perfIteration] += osGetTime()-first;
#endif
return (devAddr - dma->source) + dma->buffer;
@@ -329,7 +329,7 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
osPiStartDma(&gCurrAudioFrameDmaIoMesgBufs[gCurrAudioFrameDmaCount++], OS_MESG_PRI_NORMAL,
OS_READ, dmaDevAddr, dma->buffer, transfer, &gCurrAudioFrameDmaQueue);
*dmaIndexRef = dmaIndex;
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
dmaAudioTime[perfIteration] += osGetTime()-first;
#endif
return (devAddr - dmaDevAddr) + dma->buffer;
@@ -338,7 +338,7 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
osPiStartDma(&gCurrAudioFrameDmaIoMesgBufs[gCurrAudioFrameDmaCount - 1], OS_MESG_PRI_NORMAL,
OS_READ, dmaDevAddr, dma->buffer, transfer, &gCurrAudioFrameDmaQueue);
*dmaIndexRef = dmaIndex;
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
dmaAudioTime[perfIteration] += osGetTime()-first;
#endif
return dma->buffer + (devAddr - dmaDevAddr);
File renamed without changes.
+14 -14
View File
@@ -5,20 +5,20 @@
#include "sm64.h"
#include "audio/external.h"
#include "game_init.h"
#include "memory.h"
#include "sound_init.h"
#include "profiler.h"
#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 "main.h"
#include "rumble_init.h"
#include "version.h"
#include "game/main.h"
#include "game/rumble_init.h"
#include "game/version.h"
#ifdef UNF
#include "usb/usb.h"
#include "usb/debug.h"
#endif
#include "puppyprint.h"
#include "game/puppyprint.h"
// Message IDs
#define MESG_SP_COMPLETE 100
@@ -189,7 +189,7 @@ void start_gfx_sptask(void) {
if (gActiveSPTask == NULL && sCurrentDisplaySPTask != NULL
&& sCurrentDisplaySPTask->state == SPTASK_STATE_NOT_STARTED) {
profiler_log_gfx_time(TASKS_QUEUED);
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
rspDelta = osGetTime();
#endif
start_sptask(M_GFXTASK);
@@ -237,7 +237,7 @@ void handle_vblank(void) {
if (gActiveSPTask == NULL && sCurrentDisplaySPTask != NULL
&& sCurrentDisplaySPTask->state != SPTASK_STATE_FINISHED) {
profiler_log_gfx_time(TASKS_QUEUED);
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
rspDelta = osGetTime();
#endif
start_sptask(M_GFXTASK);
@@ -272,7 +272,7 @@ void handle_sp_complete(void) {
// The gfx task completed before we had time to interrupt it.
// Mark it finished, just like below.
curSPTask->state = SPTASK_STATE_FINISHED;
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
profiler_update(rspGenTime, rspDelta);
#endif
profiler_log_gfx_time(RSP_COMPLETE);
@@ -305,7 +305,7 @@ void handle_sp_complete(void) {
// The SP process is done, but there is still a Display Processor notification
// that needs to arrive before we can consider the task completely finished and
// null out sCurrentDisplaySPTask. That happens in handle_dp_complete.
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
profiler_update(rspGenTime, rspDelta);
#endif
profiler_log_gfx_time(RSP_COMPLETE);
@@ -503,10 +503,10 @@ extern u32 gISVFlag;
void osInitialize_fakeisv() {
/* global flag to skip `__checkHardware_isv` from being called. */
gISVFlag = 0x49533634; // 'IS64'
/* printf writes go to this address, cen64(1) has this hardcoded. */
gISVDbgPrnAdrs = 0x13FF0000;
/* `__printfunc`, used by `osSyncPrintf` will be set. */
__osInitialize_isv();
}
+9 -9
View File
@@ -6,9 +6,9 @@
#include "buffers/buffers.h"
#include "slidec.h"
#include "game_init.h"
#include "main.h"
#include "memory.h"
#include "game/game_init.h"
#include "game/main.h"
#include "game/memory.h"
#include "segment_symbols.h"
#include "segments.h"
#ifdef GZIP
@@ -21,7 +21,7 @@
#include "usb/usb.h"
#include "usb/debug.h"
#endif
#include "puppyprint.h"
#include "game/puppyprint.h"
// round up to the next multiple
@@ -135,7 +135,7 @@ void main_pool_init(void *start, void *end) {
sPoolListHeadL->next = NULL;
sPoolListHeadR->prev = NULL;
sPoolListHeadR->next = NULL;
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
mempool = sPoolFreeSpace;
#endif
}
@@ -260,7 +260,7 @@ u32 main_pool_pop_state(void) {
*/
void dma_read(u8 *dest, u8 *srcStart, u8 *srcEnd) {
u32 size = ALIGN16(srcEnd - srcStart);
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
OSTime first = osGetTime();
#endif
@@ -276,7 +276,7 @@ void dma_read(u8 *dest, u8 *srcStart, u8 *srcEnd) {
srcStart += copySize;
size -= copySize;
}
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
dmaTime[perfIteration] += osGetTime()-first;
#endif
}
@@ -355,7 +355,7 @@ void *load_segment(s32 segment, u8 *srcStart, u8 *srcEnd, u32 side, u8 *bssStart
set_segment_base_addr(segment, addr);
}
}
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
ramsizeSegment[segment+nameTable-2] = (s32)srcEnd- (s32)srcStart;
#endif
return addr;
@@ -435,7 +435,7 @@ void *load_segment_decompress(s32 segment, u8 *srcStart, u8 *srcEnd) {
}
} else {
}
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
ramsizeSegment[segment+nameTable-2] = (s32)srcEnd - (s32)srcStart;
#endif
return dest;
View File
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2 -2
View File
@@ -977,7 +977,7 @@ void find_surface_on_ray_list(struct SurfaceNode *list, Vec3f orig, Vec3f dir, f
f32 length;
Vec3f chk_hit_pos;
f32 top, bottom;
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
OSTime first = osGetTime();
#endif
@@ -1011,7 +1011,7 @@ void find_surface_on_ray_list(struct SurfaceNode *list, Vec3f orig, Vec3f dir, f
}
}
}
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
collisionTime[perfIteration] += osGetTime()-first;
#endif
}
+14 -14
View File
@@ -188,7 +188,7 @@ s32 find_wall_collisions(struct WallCollisionData *colData) {
s32 numCollisions = 0;
s32 x = colData->x;
s32 z = colData->z;
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
OSTime first = osGetTime();
#endif
@@ -217,7 +217,7 @@ s32 find_wall_collisions(struct WallCollisionData *colData) {
// Increment the debug tracker.
gNumCalls.wall += 1;
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
collisionTime[perfIteration] += osGetTime()-first;
#endif
@@ -307,7 +307,7 @@ f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil) {
f32 height = CELL_HEIGHT_LIMIT;
f32 dynamicHeight = CELL_HEIGHT_LIMIT;
s32 x, y, z;
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
OSTime first = osGetTime();
#endif
@@ -345,7 +345,7 @@ f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil) {
// Increment the debug tracker.
gNumCalls.ceil += 1;
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
collisionTime[perfIteration] += osGetTime()-first;
#endif
@@ -574,7 +574,7 @@ f32 unused_find_dynamic_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfl
*/
f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
s32 cellZ, cellX;
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
OSTime first = osGetTime();
#endif
@@ -594,13 +594,13 @@ f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
*pfloor = NULL;
if (x <= -LEVEL_BOUNDARY_MAX || x >= LEVEL_BOUNDARY_MAX) {
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
collisionTime[perfIteration] += osGetTime()-first;
#endif
return height;
}
if (z <= -LEVEL_BOUNDARY_MAX || z >= LEVEL_BOUNDARY_MAX) {
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
collisionTime[perfIteration] += osGetTime()-first;
#endif
return height;
@@ -649,7 +649,7 @@ f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
// Increment the debug tracker.
gNumCalls.floor += 1;
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
collisionTime[perfIteration] += osGetTime()-first;
#endif
@@ -710,7 +710,7 @@ s32 find_water_level_and_floor(s32 x, s32 z, struct Surface **pfloor) {
s32 waterLevel = FLOOR_LOWER_LIMIT;
TerrainData *p = gEnvironmentRegions;
struct Surface *floor = NULL;
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
OSTime first = osGetTime();
#endif
@@ -743,7 +743,7 @@ s32 find_water_level_and_floor(s32 x, s32 z, struct Surface **pfloor) {
*pfloor = floor;
}
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
collisionTime[perfIteration] += osGetTime()-first;
#endif
@@ -761,7 +761,7 @@ s32 find_water_level(s32 x, s32 z) {
s32 waterLevel = FLOOR_LOWER_LIMIT;
TerrainData *p = gEnvironmentRegions;
struct Surface *floor;
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
OSTime first = osGetTime();
#endif
@@ -792,7 +792,7 @@ s32 find_water_level(s32 x, s32 z) {
}
}
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
collisionTime[perfIteration] += osGetTime()-first;
#endif
@@ -809,7 +809,7 @@ s32 find_poison_gas_level(s32 x, s32 z) {
s32 loX, hiX, loZ, hiZ;
s32 gasLevel = FLOOR_LOWER_LIMIT;
TerrainData *p = gEnvironmentRegions;
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
OSTime first = osGetTime();
#endif
@@ -838,7 +838,7 @@ s32 find_poison_gas_level(s32 x, s32 z) {
}
}
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
collisionTime[perfIteration] += osGetTime()-first;
#endif
+4 -4
View File
@@ -604,7 +604,7 @@ u32 get_area_terrain_size(TerrainData *data) {
void load_area_terrain(s32 index, TerrainData *data, RoomData *surfaceRooms, s16 *macroObjects) {
s32 terrainLoadType;
TerrainData *vertexData = NULL;
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
OSTime first = osGetTime();
#endif
@@ -654,7 +654,7 @@ void load_area_terrain(s32 index, TerrainData *data, RoomData *surfaceRooms, s16
gNumStaticSurfaceNodes = gSurfaceNodesAllocated;
gNumStaticSurfaces = gSurfacesAllocated;
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
collisionTime[perfIteration] += osGetTime()-first;
#endif
}
@@ -784,7 +784,7 @@ void load_object_surfaces(TerrainData **data, TerrainData *vertexData) {
*/
void load_object_collision_model(void) {
TerrainData vertexData[600];
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
OSTime first = osGetTime();
#endif
@@ -821,7 +821,7 @@ void load_object_collision_model(void) {
} else {
gCurrentObject->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
}
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
collisionTime[perfIteration] += osGetTime()-first;
#endif
}
+1 -1
View File
@@ -425,7 +425,7 @@ void render_game(void) {
}
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
puppyprint_render_profiler();
#endif
+4 -4
View File
@@ -716,7 +716,7 @@ void setup_game_memory(void) {
*/
void thread5_game_loop(UNUSED void *arg) {
struct LevelCommand *addr;
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
OSTime lastTime = 0;
#endif
@@ -755,7 +755,7 @@ void thread5_game_loop(UNUSED void *arg) {
continue;
}
profiler_log_thread5_time(THREAD5_START);
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
while (TRUE)
{
lastTime = osGetTime();
@@ -777,10 +777,10 @@ void thread5_game_loop(UNUSED void *arg) {
select_gfx_pool();
read_controller_inputs();
addr = level_script_execute(addr);
#if defined(VISUAL_DEBUG) && !defined(PUPPYPRINT)
#if PUPPYPRINT_DEBUG == 0 && defined(VISUAL_DEBUG)
debug_box_input();
#endif
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
profiler_update(scriptTime, lastTime);
if (benchmarkLoop > 0 && benchOption == 0)
{
+10 -1
View File
@@ -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;
}
+2 -2
View File
@@ -626,7 +626,7 @@ UNUSED static u16 unused_get_elapsed_time(u64 *cycleCounts, s32 index) {
*/
void update_objects(UNUSED s32 unused) {
s64 cycleCounts[30];
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
OSTime first = osGetTime();
OSTime colTime = collisionTime[perfIteration];
#endif
@@ -688,7 +688,7 @@ void update_objects(UNUSED s32 unused) {
}
gPrevFrameObjectCount = gObjectCounter;
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
profiler_update(behaviourTime, first);
behaviourTime[perfIteration] -= collisionTime[perfIteration]+colTime;
#endif
+50 -7
View File
@@ -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.
@@ -42,9 +46,11 @@ There's also a custom option that's left blank. It runs benchmark_custom which c
u8 currEnv[4];
u8 fDebug = 0;
#if PUPPYPRINT_DEBUG
s8 benchViewer = 0;
u8 benchOption = 0;
s8 logViewer = 0;
//Profiler values
s8 perfIteration = 0;
s16 benchmarkLoop = 0;
@@ -301,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)
@@ -317,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);
@@ -391,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();
@@ -457,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();
}
@@ -491,19 +535,18 @@ void puppyprint_profiler_process(void)
}
benchmark_custom();
}
#if PUPPYPRINT_DEBUG
if (gPlayer1Controller->buttonDown & U_JPAD && gPlayer1Controller->buttonPressed & L_TRIG)
{
ramViewer = 0;
benchViewer = 0;
fDebug ^= 1;
}
#endif
if (perfIteration++ == NUM_PERF_ITERATIONS-1)
perfIteration = 0;
}
#endif
void print_set_envcolour(s32 r, s32 g, s32 b, s32 a)
{
+3
View File
@@ -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
+2 -2
View File
@@ -1095,7 +1095,7 @@ void geo_process_node_and_siblings(struct GraphNode *firstNode) {
*/
void geo_process_root(struct GraphNodeRoot *node, Vp *b, Vp *c, s32 clearColor) {
UNUSED s32 unused;
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
OSTime first = osGetTime();
#endif
@@ -1138,7 +1138,7 @@ void geo_process_root(struct GraphNodeRoot *node, Vp *b, Vp *c, s32 clearColor)
}
main_pool_free(gDisplayListHeap);
}
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
profiler_update(graphTime, first);
#endif
}
+4 -4
View File
@@ -336,7 +336,7 @@ void audio_game_loop_tick(void) {
void thread4_sound(UNUSED void *arg) {
audio_init();
sound_init();
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
OSTime lastTime;
#endif
@@ -351,7 +351,7 @@ void thread4_sound(UNUSED void *arg) {
OSMesg msg;
osRecvMesg(&sSoundMesgQueue, &msg, OS_MESG_BLOCK);
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
while (TRUE)
{
lastTime = osGetTime();
@@ -365,7 +365,7 @@ void thread4_sound(UNUSED void *arg) {
dispatch_audio_sptask(spTask);
}
profiler_log_thread4_time();
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
profiler_update(audioTime, lastTime);
audioTime[perfIteration] -= dmaAudioTime[perfIteration];
if (benchmarkLoop > 0 && benchOption == 1)
@@ -382,7 +382,7 @@ void thread4_sound(UNUSED void *arg) {
break;
#endif
}
#ifdef PUPPYPRINT
#if PUPPYPRINT_DEBUG
}
#endif
}