Merge branch 'master' of https://github.com/Reonu/HackerSM64 into develop/merge-master-2.0.1-into-2.1.0
This commit is contained in:
commit
e6d68e6d76
89 files changed
+3205
-1095
No files matched your search
+37
-25
@@ -1,4 +1,5 @@
|
||||
#include <ultra64.h>
|
||||
#include <PR/os_internal_reg.h>
|
||||
#include <PR/os_system.h>
|
||||
#include <PR/os_vi.h>
|
||||
#include <stdio.h>
|
||||
@@ -20,6 +21,7 @@
|
||||
#endif
|
||||
#include "game/puppyprint.h"
|
||||
#include "game/puppylights.h"
|
||||
#include "game/profiling.h"
|
||||
|
||||
#include "game/vc_check.h"
|
||||
|
||||
@@ -188,10 +190,8 @@ void start_gfx_sptask(void) {
|
||||
if (gActiveSPTask == NULL
|
||||
&& sCurrentDisplaySPTask != NULL
|
||||
&& sCurrentDisplaySPTask->state == SPTASK_STATE_NOT_STARTED) {
|
||||
#if PUPPYPRINT_DEBUG
|
||||
rspDelta = osGetTime();
|
||||
#endif
|
||||
start_sptask(M_GFXTASK);
|
||||
profiler_rsp_started(PROFILER_RSP_GFX);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,15 +223,14 @@ void handle_vblank(void) {
|
||||
} else {
|
||||
pretend_audio_sptask_done();
|
||||
}
|
||||
profiler_rsp_started(PROFILER_RSP_AUDIO);
|
||||
}
|
||||
} else {
|
||||
if (gActiveSPTask == NULL
|
||||
&& sCurrentDisplaySPTask != NULL
|
||||
&& sCurrentDisplaySPTask->state != SPTASK_STATE_FINISHED) {
|
||||
#if PUPPYPRINT_DEBUG
|
||||
rspDelta = osGetTime();
|
||||
#endif
|
||||
start_sptask(M_GFXTASK);
|
||||
profiler_rsp_started(PROFILER_RSP_GFX);
|
||||
}
|
||||
}
|
||||
#if ENABLE_RUMBLE
|
||||
@@ -256,9 +255,9 @@ 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;
|
||||
#if PUPPYPRINT_DEBUG
|
||||
profiler_update(rspGenTime, rspDelta);
|
||||
#endif
|
||||
profiler_rsp_completed(PROFILER_RSP_GFX);
|
||||
} else {
|
||||
profiler_rsp_yielded();
|
||||
}
|
||||
|
||||
// Start the audio task, as expected by handle_vblank.
|
||||
@@ -267,12 +266,19 @@ void handle_sp_complete(void) {
|
||||
} else {
|
||||
pretend_audio_sptask_done();
|
||||
}
|
||||
profiler_rsp_started(PROFILER_RSP_AUDIO);
|
||||
} else {
|
||||
curSPTask->state = SPTASK_STATE_FINISHED;
|
||||
if (curSPTask->task.t.type == M_AUDTASK) {
|
||||
profiler_rsp_completed(PROFILER_RSP_AUDIO);
|
||||
// After audio tasks come gfx tasks.
|
||||
if ((sCurrentDisplaySPTask != NULL)
|
||||
&& (sCurrentDisplaySPTask->state != SPTASK_STATE_FINISHED)) {
|
||||
if (sCurrentDisplaySPTask->state == SPTASK_STATE_INTERRUPTED) {
|
||||
profiler_rsp_resumed();
|
||||
} else {
|
||||
profiler_rsp_started(PROFILER_RSP_GFX);
|
||||
}
|
||||
start_sptask(M_GFXTASK);
|
||||
}
|
||||
sCurrentAudioSPTask = NULL;
|
||||
@@ -283,9 +289,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.
|
||||
#if PUPPYPRINT_DEBUG
|
||||
profiler_update(rspGenTime, rspDelta);
|
||||
#endif
|
||||
profiler_rsp_completed(PROFILER_RSP_GFX);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -298,6 +302,22 @@ void handle_dp_complete(void) {
|
||||
sCurrentDisplaySPTask->state = SPTASK_STATE_FINISHED_DP;
|
||||
sCurrentDisplaySPTask = NULL;
|
||||
}
|
||||
|
||||
void check_cache_emulation() {
|
||||
// Disable interrupts to ensure that nothing evicts the variable from cache while we're using it.
|
||||
u32 saved = __osDisableInt();
|
||||
// Create a variable with an initial value of 1. This value will remain cached.
|
||||
volatile u8 sCachedValue = 1;
|
||||
// Overwrite the variable directly in RDRAM without going through cache.
|
||||
// This should preserve its value of 1 in dcache if dcache is emulated correctly.
|
||||
*(u8*)(K0_TO_K1(&sCachedValue)) = 0;
|
||||
// Read the variable back from dcache, if it's still 1 then cache is emulated correctly.
|
||||
// If it's zero, then dcache is not emulated correctly.
|
||||
gCacheEmulated = sCachedValue;
|
||||
// Restore interrupts
|
||||
__osRestoreInt(saved);
|
||||
}
|
||||
|
||||
extern void crash_screen_init(void);
|
||||
|
||||
void thread3_main(UNUSED void *arg) {
|
||||
@@ -315,8 +335,9 @@ void thread3_main(UNUSED void *arg) {
|
||||
|
||||
#ifdef DEBUG
|
||||
osSyncPrintf("Super Mario 64\n");
|
||||
#if 0 // if your PC username isn't your real name feel free to uncomment
|
||||
osSyncPrintf("Built by: %s\n", __username__);
|
||||
osSyncPrintf("Date : %s\n", __datetime__);
|
||||
#endif
|
||||
osSyncPrintf("Compiler: %s\n", __compiler__);
|
||||
osSyncPrintf("Linker : %s\n", __linker__);
|
||||
#endif
|
||||
@@ -325,6 +346,7 @@ void thread3_main(UNUSED void *arg) {
|
||||
gIsConsole = FALSE;
|
||||
gBorderHeight = BORDER_HEIGHT_EMULATOR;
|
||||
gIsVC = IS_VC();
|
||||
check_cache_emulation();
|
||||
} else {
|
||||
gIsConsole = TRUE;
|
||||
gBorderHeight = BORDER_HEIGHT_CONSOLE;
|
||||
@@ -338,9 +360,6 @@ void thread3_main(UNUSED void *arg) {
|
||||
|
||||
while (TRUE) {
|
||||
OSMesg msg;
|
||||
#if PUPPYPRINT_DEBUG
|
||||
OSTime first = osGetTime();
|
||||
#endif
|
||||
osRecvMesg(&gIntrMesgQueue, &msg, OS_MESG_BLOCK);
|
||||
switch ((uintptr_t) msg) {
|
||||
case MESG_VI_VBLANK:
|
||||
@@ -359,9 +378,6 @@ void thread3_main(UNUSED void *arg) {
|
||||
handle_nmi_request();
|
||||
break;
|
||||
}
|
||||
#if PUPPYPRINT_DEBUG
|
||||
profiler_update(taskTime, first);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -491,12 +507,10 @@ void thread1_idle(UNUSED void *arg) {
|
||||
}
|
||||
}
|
||||
|
||||
#if CLEARRAM
|
||||
void ClearRAM(void)
|
||||
{
|
||||
// Clear RAM on boot
|
||||
void ClearRAM(void) {
|
||||
bzero(_mainSegmentEnd, (size_t)osMemSize - (size_t)OS_K0_TO_PHYSICAL(_mainSegmentEnd));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ISVPRINT
|
||||
extern u32 gISVDbgPrnAdrs;
|
||||
@@ -515,9 +529,7 @@ void osInitialize_fakeisv() {
|
||||
#endif
|
||||
|
||||
void main_func(void) {
|
||||
#if CLEARRAM
|
||||
ClearRAM();
|
||||
#endif
|
||||
__osInitialize_common();
|
||||
#ifdef ISVPRINT
|
||||
osInitialize_fakeisv();
|
||||
|
||||
@@ -259,9 +259,6 @@ u32 main_pool_pop_state(void) {
|
||||
*/
|
||||
void dma_read(u8 *dest, u8 *srcStart, u8 *srcEnd) {
|
||||
u32 size = ALIGN16(srcEnd - srcStart);
|
||||
#if PUPPYPRINT_DEBUG
|
||||
OSTime first = osGetTime();
|
||||
#endif
|
||||
|
||||
osInvalDCache(dest, size);
|
||||
while (size != 0) {
|
||||
@@ -275,9 +272,6 @@ void dma_read(u8 *dest, u8 *srcStart, u8 *srcEnd) {
|
||||
srcStart += copySize;
|
||||
size -= copySize;
|
||||
}
|
||||
#if PUPPYPRINT_DEBUG
|
||||
dmaTime[perfIteration] += (osGetTime() - first);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user