Fix/cleanup/rephrase miscellaneous stuff (#983)

* Add parens around params usage in VEC_SET macro

* Remove unnecessary space character in a xml

* Use defines instead of magic values in head/tail magic comments

* Use `OS_USEC_TO_CYCLES` to make a time look better in `Graph_TaskSet00`

* `0x25800` -> `sizeof(u16[SCREEN_HEIGHT][SCREEN_WIDTH])`

* `0x803DA800` -> `0x80400000 - frame buffer size`

* Use `OS_VI_` defines instead of hex

* Add empty line after some variable declarations

* Remove unused `extern CutsceneData` in `z_bg_dy_yoseizo.c`

* `Matrix_MtxFToYXZRotS` does not use `MTXMODE_`

* Use `MTXMODE_` more

* Remove `ASCII_TO_U32`, use `'IS64'`

* Add explicit `!= NULL` in some ternaries

* Use `INV_CONTENT`, `AMMO` macros more

* Use `PLAYER_AP_` enum more to compare to `Player#heldItemActionParam`

* Get rid of lowercase hex (outside libultra)

* `gWindMill*` -> `gWindmill*`

* Format and small fix enums in `z_boss_mo.h`

* Use `CHECK_BTN_ANY` more

* Fix xz/xy mistake in comment in tektite

* Rephrase comments mentioning "the devs" in a more neutral way

* Clean-up some objectively useless parens

* Fix some negative values written as u16 instead of s16 in ichains

* `SKJ_ACTON_` -> `SKJ_ACTION_`

* Run formatter

* Fix unk_ offset of `TransformUpdateIndex#unk_10` -> `unk_0E`

* Remove comments using in-game text

* Remove `U` suffix from integer literals

* Revert "Remove `ASCII_TO_U32`, use `'IS64'`"

This reverts commit c801337dde9fe5e8b7a7ecf85ad3629bf5b87aaf.

* Use `PLAYER_STR_*` to compare to `CUR_UPG_VALUE(UPG_STRENGTH)`

* Add empty line after decl x2

* Revert "Use `PLAYER_STR_*` to compare to `CUR_UPG_VALUE(UPG_STRENGTH)`"

This reverts commit d80bdb32da449edc74e02b8ab3f5a2c532e74bdb.

* Make `CUR_UPG_VALUE(UPG_STRENGTH)` compare to integers (eventually needs its own enum)

* Only use `PLAYER_SHIELD_` enum with `Player#currentShield`

* Only use `PLAYER_TUNIC_` enum with `Player#currentTunic`
This commit is contained in:
Dragorn421
2021-10-03 05:17:09 +02:00
committed by GitHub
parent 5c95f70d59
commit f1d27bf653
82 changed files with 327 additions and 323 deletions

View File

@@ -1,5 +1,5 @@
<Root>
<File Name="gameplay_field_keep" Segment= "5">
<File Name="gameplay_field_keep" Segment="5">
<DList Name="gHanaFlower1DL" Offset="0x000"/>
<DList Name="gHanaFlower2DL" Offset="0x0A0"/>
<DList Name="gHanaFlower3DL" Offset="0x0140"/>

View File

@@ -31,8 +31,8 @@
<Texture Name="gWindmillManEyeClosedTex" OutName="eye_closed" Format="ci8" Width="32" Height="32" Offset="0x5F20"/>
<Texture Name="gWindmillManEyeAngryTex" OutName="eye_angry" Format="ci8" Width="32" Height="32" Offset="0x6320"/>
<Texture Name="gWindMillManMouthOpenTex" OutName="mouth_open" Format="ci8" Width="32" Height="16" Offset="0x6720"/>
<Texture Name="gWindMillManMouthAngryTex" OutName="mouth_angry" Format="ci8" Width="32" Height="16" Offset="0x6920"/>
<Texture Name="gWindmillManMouthOpenTex" OutName="mouth_open" Format="ci8" Width="32" Height="16" Offset="0x6720"/>
<Texture Name="gWindmillManMouthAngryTex" OutName="mouth_angry" Format="ci8" Width="32" Height="16" Offset="0x6920"/>
<Texture Name="gWindmillManHairTex" OutName="hair" Format="ci8" Width="8" Height="16" Offset="0x6B20"/>
<Skeleton Name="gWindmillManSkel" Type="Flex" LimbType="Standard" Offset="0x6C90"/>

View File

@@ -67,13 +67,13 @@ typedef struct {
} GameInfo; // size = 0x15D4
typedef struct {
/* 0x00000 */ u16 headMagic; // 1234
/* 0x00000 */ u16 headMagic; // GFXPOOL_HEAD_MAGIC
/* 0x00008 */ Gfx polyOpaBuffer[0x17E0];
/* 0x0BF08 */ Gfx polyXluBuffer[0x800];
/* 0x0FF08 */ Gfx overlayBuffer[0x400];
/* 0x11F08 */ Gfx workBuffer[0x80];
/* 0x11308 */ Gfx unusedBuffer[0x20];
/* 0x12408 */ u16 tailMagic; // 5678
/* 0x12408 */ u16 tailMagic; // GFXPOOL_TAIL_MAGIC
} GfxPool; // size = 0x12410
typedef struct {
@@ -1658,15 +1658,15 @@ typedef struct {
/* 0x0050 */ s32 viHeight;
/* 0x0054 */ s32 viWidth;
/* 0x0058 */ s32 unk_58; // Right adjustment?
/* 0x005c */ s32 unk_5C; // Left adjustment?
/* 0x005C */ s32 unk_5C; // Left adjustment?
/* 0x0060 */ s32 unk_60; // Bottom adjustment?
/* 0x0064 */ s32 unk_64; // Top adjustment?
/* 0x0068 */ s32 viModeBase; // enum: {0, 1, 2, 3}
/* 0x006c */ s32 viTvType;
/* 0x006C */ s32 viTvType;
/* 0x0070 */ u32 unk_70; // bool
/* 0x0074 */ u32 unk_74; // bool
/* 0x0078 */ u32 unk_78; // bool
/* 0x007c */ u32 unk_7C; // bool
/* 0x007C */ u32 unk_7C; // bool
/* 0x0080 */ u32 viFeatures;
/* 0x0084 */ u32 unk_84;
} ViMode;

View File

@@ -212,7 +212,7 @@ typedef struct {
/* 0x0004 */ TransformData* transformData;
/* 0x0008 */ s16* copyValues;
/* 0x000C */ s16 unk_0C;
/* 0x000E */ s16 unk_10;
/* 0x000E */ s16 unk_0E;
} TransformUpdateIndex; // size = 0x10
typedef struct {

View File

@@ -3,7 +3,7 @@
#include "ultra64.h"
#define VEC_SET(V,X,Y,Z) V.x=X;V.y=Y;V.z=Z
#define VEC_SET(V,X,Y,Z) (V).x=(X);(V).y=(Y);(V).z=(Z)
typedef struct {
f32 x, y;

View File

@@ -51,7 +51,7 @@ void Idle_ThreadEntry(void* arg) {
osCreateViManager(OS_PRIORITY_VIMGR);
gViConfigFeatures = 0x42;
gViConfigFeatures = OS_VI_GAMMA_OFF | OS_VI_DITHER_FILTER_ON;
gViConfigXScale = 1.0f;
gViConfigYScale = 1.0f;

View File

@@ -2,7 +2,7 @@
OSPiHandle* sISVHandle; // official name : is_Handle
#define gISVDbgPrnAdrs ((ISVDbg*)0xb3ff0000)
#define gISVDbgPrnAdrs ((ISVDbg*)0xB3FF0000)
#define ASCII_TO_U32(a, b, c, d) ((u32)((a << 24) | (b << 16) | (c << 8) | (d << 0)))
void isPrintfInit(void) {
@@ -55,8 +55,8 @@ void* is_proutSyncPrintf(void* arg, const char* str, u32 count) {
osEPiReadIo(sISVHandle, (u32)&gISVDbgPrnAdrs->put, &data);
start = data;
end = start + count;
if (end >= 0xffe0) {
end -= 0xffe0;
if (end >= 0xFFE0) {
end -= 0xFFE0;
if (pos < end || start < pos) {
return 1;
}
@@ -66,15 +66,16 @@ void* is_proutSyncPrintf(void* arg, const char* str, u32 count) {
}
}
while (count) {
u32 addr = (u32)&gISVDbgPrnAdrs->data + (start & 0xffffffc);
u32 addr = (u32)&gISVDbgPrnAdrs->data + (start & 0xFFFFFFC);
s32 shift = ((3 - (start & 3)) * 8);
if (*str) {
osEPiReadIo(sISVHandle, addr, &data);
osEPiWriteIo(sISVHandle, addr, (*str << shift) | (data & ~(0xff << shift)));
osEPiWriteIo(sISVHandle, addr, (*str << shift) | (data & ~(0xFF << shift)));
start++;
if (start >= 0xffe0) {
start -= 0xffe0;
if (start >= 0xFFE0) {
start -= 0xFFE0;
}
}
count--;

View File

@@ -44,7 +44,7 @@ void LogUtils_LogHexDump(void* ptr, s32 size0) {
}
i++;
if (i > 0xf) {
if (i > 0xF) {
break;
}
}
@@ -54,13 +54,13 @@ void LogUtils_LogHexDump(void* ptr, s32 size0) {
while (true) {
if (i < rest) {
u8 a = *(addr + i);
osSyncPrintf("%c", (a >= 0x20 && a < 0x7f) ? a : '.');
osSyncPrintf("%c", (a >= 0x20 && a < 0x7F) ? a : '.');
} else {
osSyncPrintf(" ");
}
i++;
if (i > 0xf) {
if (i > 0xF) {
break;
}
}

View File

@@ -99,7 +99,7 @@ StackStatus StackCheck_GetState(StackEntry* entry) {
}
osSyncPrintf("head=%08x tail=%08x last=%08x used=%08x free=%08x [%s]\n", entry->head, entry->tail, last, used, free,
entry->name ? entry->name : "(null)");
entry->name != NULL ? entry->name : "(null)");
osSyncPrintf(VT_RST);
if (ret != STACK_STATUS_OK) {

View File

@@ -1699,7 +1699,8 @@ void DmaMgr_Error(DmaRequest* req, const char* file, const char* errorName, cons
osSyncPrintf("%c", 7);
osSyncPrintf(VT_FGCOL(RED));
osSyncPrintf("DMA致命的エラー(%s)\nROM:%X RAM:%X SIZE:%X %s\n",
errorDesc ? errorDesc : (errorName ? errorName : "???"), vrom, ram, size, file ? file : "???");
errorDesc != NULL ? errorDesc : (errorName != NULL ? errorName : "???"), vrom, ram, size,
file != NULL ? file : "???");
if (req->filename) {
osSyncPrintf("DMA ERROR: %s %d", req->filename, req->line);
@@ -1714,10 +1715,10 @@ void DmaMgr_Error(DmaRequest* req, const char* file, const char* errorName, cons
} else if (sDmaMgrCurFileName) {
sprintf(buff1, "DMA ERROR: %s %d", sDmaMgrCurFileName, sDmaMgrCurFileLine);
} else {
sprintf(buff1, "DMA ERROR: %s", errorName ? errorName : "???");
sprintf(buff1, "DMA ERROR: %s", errorName != NULL ? errorName : "???");
}
sprintf(buff2, "%07X %08X %X %s", vrom, ram, size, file ? file : "???");
sprintf(buff2, "%07X %08X %X %s", vrom, ram, size, file != NULL ? file : "???");
Fault_AddHungupAndCrashImpl(buff1, buff2);
}
@@ -1733,7 +1734,7 @@ const char* DmaMgr_GetFileNameImpl(u32 vrom) {
iter++;
name++;
}
//! @bug Since the devs forgot to return in case the file isn't found, the return value will be a pointer to the end
//! @bug Since there is no return, in case the file isn't found, the return value will be a pointer to the end
// of gDmaDataTable
}
@@ -1860,7 +1861,7 @@ void DmaMgr_ThreadEntry(void* arg0) {
s32 DmaMgr_SendRequestImpl(DmaRequest* req, u32 ram, u32 vrom, u32 size, u32 unk, OSMesgQueue* queue, OSMesg msg) {
static s32 sDmaMgrQueueFullLogged = 0;
if ((1 && (ram == 0)) || (osMemSize < ram + size + 0x80000000) || (vrom & 1) || (vrom > 0x4000000U) ||
if ((1 && (ram == 0)) || (osMemSize < ram + size + 0x80000000) || (vrom & 1) || (vrom > 0x4000000) ||
(size == 0) || (size & 1)) {
DmaMgr_Error(req, NULL, "ILLIGAL DMA-FUNCTION CALL", "パラメータ異常です");
}

View File

@@ -708,7 +708,7 @@ void __osDisplayArena(Arena* arena) {
if (!iter->isFree) {
osSyncPrintf(" [%016llu:%2d:%s:%d]", OS_CYCLES_TO_NSEC(iter->time), iter->threadId,
iter->filename ? iter->filename : "**NULL**", iter->line);
iter->filename != NULL ? iter->filename : "**NULL**", iter->line);
}
osSyncPrintf("\n");

View File

@@ -86,7 +86,7 @@ f32 Audio_GetPortamentoFreqScale(Portamento* p) {
f32 result;
p->cur += p->speed;
loResCur = (p->cur >> 8) & 0xff;
loResCur = (p->cur >> 8) & 0xFF;
if (loResCur >= 127) {
loResCur = 127;

View File

@@ -32,16 +32,16 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) {
sub->bitField0.s.usesHeadsetPanEffects = sp24.usesHeadsetPanEffects;
if (stereoHeadsetEffects && gAudioContext.soundMode == 1) {
smallPanIndex = pan >> 1;
if (smallPanIndex > 0x3f) {
smallPanIndex = 0x3f;
if (smallPanIndex > 0x3F) {
smallPanIndex = 0x3F;
}
sub->headsetPanLeft = gHeadsetPanQuantization[smallPanIndex];
sub->headsetPanRight = gHeadsetPanQuantization[0x3f - smallPanIndex];
sub->headsetPanRight = gHeadsetPanQuantization[0x3F - smallPanIndex];
sub->bitField1.s.usesHeadsetPanEffects2 = true;
volLeft = gHeadsetPanVolume[pan];
volRight = gHeadsetPanVolume[0x7f - pan];
volRight = gHeadsetPanVolume[0x7F - pan];
} else if (stereoHeadsetEffects && gAudioContext.soundMode == 0) {
strongLeft = strongRight = 0;
sub->headsetPanRight = 0;
@@ -49,7 +49,7 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) {
sub->bitField1.s.usesHeadsetPanEffects2 = false;
volLeft = gStereoPanVolume[pan];
volRight = gStereoPanVolume[0x7f - pan];
volRight = gStereoPanVolume[0x7F - pan];
if (pan < 0x20) {
strongLeft = 1;
} else if (pan > 0x60) {
@@ -85,7 +85,7 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) {
sub->bitField0.s.stereoStrongRight = sp24.strongRight;
sub->bitField0.s.stereoStrongLeft = sp24.strongLeft;
volLeft = gDefaultPanVolume[pan];
volRight = gDefaultPanVolume[0x7f - pan];
volRight = gDefaultPanVolume[0x7F - pan];
}
vel = 0.0f > vel ? 0.0f : vel;
@@ -169,7 +169,7 @@ void Audio_ProcessNotes(void) {
noteSubEu2 = &gAudioContext.noteSubsEu[gAudioContext.noteSubEuOffset + i];
playbackState = &note->playbackState;
if (playbackState->parentLayer != NO_LAYER) {
if ((u32)playbackState->parentLayer < 0x7FFFFFFFU) {
if ((u32)playbackState->parentLayer < 0x7FFFFFFF) {
continue;
}
@@ -349,7 +349,7 @@ Drum* Audio_GetDrum(s32 bankId, s32 drumId) {
gAudioContext.audioErrorFlags = ((bankId << 8) + drumId) + 0x4000000;
return NULL;
}
if ((u32)gAudioContext.ctlEntries[bankId].drums < 0x80000000U) {
if ((u32)gAudioContext.ctlEntries[bankId].drums < 0x80000000) {
return NULL;
}
drum = gAudioContext.ctlEntries[bankId].drums[drumId];
@@ -378,7 +378,7 @@ AudioBankSound* Audio_GetSfx(s32 bankId, s32 sfxId) {
return NULL;
}
if ((u32)gAudioContext.ctlEntries[bankId].soundEffects < 0x80000000U) {
if ((u32)gAudioContext.ctlEntries[bankId].soundEffects < 0x80000000) {
return NULL;
}
@@ -570,7 +570,7 @@ void Audio_InitSyntheticWave(Note* note, SequenceChannelLayer* seqLayer) {
s32 waveSampleCountIndex;
s32 waveId = seqLayer->instOrWave;
if (waveId == 0xff) {
if (waveId == 0xFF) {
waveId = seqLayer->seqChannel->instOrWave;
}
@@ -761,7 +761,7 @@ void Audio_NoteInitForLayer(Note* note, SequenceChannelLayer* seqLayer) {
Audio_NoteInit(note);
instId = seqLayer->instOrWave;
if (instId == 0xff) {
if (instId == 0xFF) {
instId = seqLayer->seqChannel->instOrWave;
}
sub->sound.audioBankSound = seqLayer->sound;

View File

@@ -109,7 +109,7 @@ SoundParams sPlayerBankParams[] = {
{ 0x30, 0x400 }, { 0x30, 0x400 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x80 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x3 }, { 0x30, 0x1 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x2000 }, { 0x30, 0xc00 }, { 0x30, 0x400 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x2000 }, { 0x30, 0xC00 }, { 0x30, 0x400 },
{ 0x30, 0x400 }, { 0x30, 0x400 }, { 0x20, 0x80 }, { 0x20, 0x80 }, { 0x20, 0x80 }, { 0x20, 0x80 },
{ 0x20, 0x40 }, { 0x20, 0x40 }, { 0x20, 0x40 }, { 0x20, 0x40 }, { 0x20, 0x80 }, { 0x20, 0x80 },
{ 0x20, 0x80 }, { 0x20, 0x0 }, { 0x20, 0x0 }, { 0x20, 0x0 }, { 0x20, 0x0 }, { 0x20, 0x0 },
@@ -121,7 +121,7 @@ SoundParams sPlayerBankParams[] = {
{ 0x40, 0x0 }, { 0x40, 0x0 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 },
{ 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 },
{ 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 },
{ 0x30, 0xc00 }, { 0x30, 0x80 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0xC00 }, { 0x30, 0x80 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x60, 0x2 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x800 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 },
@@ -137,7 +137,7 @@ SoundParams sItemBankParams[] = {
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x40, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x80 }, { 0x30, 0x40 }, { 0x30, 0x400 }, { 0x20, 0x400 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x400 }, { 0x30, 0x400 }, { 0x60, 0x43 },
{ 0x30, 0x1 }, { 0x30, 0x401 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0xa0, 0x2 }, { 0xa0, 0x2 },
{ 0x30, 0x1 }, { 0x30, 0x401 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0xA0, 0x2 }, { 0xA0, 0x2 },
{ 0x30, 0x400 }, { 0x30, 0x0 }, { 0x60, 0x0 }, { 0x60, 0x0 }, { 0x60, 0x0 }, { 0x30, 0x400 },
{ 0x30, 0x0 }, { 0x60, 0x81 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x60, 0x8003 }, { 0x60, 0x8003 },
{ 0x60, 0x8003 }, { 0x30, 0x4000 }, { 0x30, 0x4000 }, { 0x30, 0x40 }, { 0x80, 0x3 }, { 0x80, 0x3 },
@@ -148,26 +148,26 @@ SoundParams sItemBankParams[] = {
SoundParams sEnvBankParams[] = {
{ 0x70, 0x640 }, { 0x80, 0x40 }, { 0x30, 0x0 }, { 0x30, 0x40 }, { 0x30, 0x40 }, { 0x40, 0x40 },
{ 0x30, 0x480 }, { 0x38, 0x2 }, { 0x30, 0x40 }, { 0x30, 0x40 }, { 0x80, 0x2 }, { 0xa0, 0x3 },
{ 0x30, 0x480 }, { 0x38, 0x2 }, { 0x30, 0x40 }, { 0x30, 0x40 }, { 0x80, 0x2 }, { 0xA0, 0x3 },
{ 0x30, 0x3 }, { 0x30, 0x3 }, { 0x30, 0x3 }, { 0x30, 0x3 }, { 0x30, 0x2 }, { 0x30, 0x40 },
{ 0x30, 0x40 }, { 0x30, 0x0 }, { 0x60, 0x0 }, { 0x30, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x82 },
{ 0x30, 0x0 }, { 0x40, 0x0 }, { 0x38, 0x0 }, { 0x28, 0x0 }, { 0x60, 0x0 }, { 0x70, 0x3 },
{ 0x30, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0xa0, 0x2008 }, { 0x20, 0x2 }, { 0x30, 0x0 },
{ 0x30, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0xA0, 0x2008 }, { 0x20, 0x2 }, { 0x30, 0x0 },
{ 0x30, 0x800 }, { 0x30, 0x8800 }, { 0x30, 0x8000 }, { 0x30, 0x2 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x400 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x80 },
{ 0x60, 0x42 }, { 0x10, 0x0 }, { 0xa0, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x10 }, { 0x30, 0x3 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x2 }, { 0x30, 0x0 }, { 0xa0, 0x3 },
{ 0x60, 0x42 }, { 0x10, 0x0 }, { 0xA0, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x10 }, { 0x30, 0x3 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x2 }, { 0x30, 0x0 }, { 0xA0, 0x3 },
{ 0x30, 0x0 }, { 0x30, 0x400 }, { 0x30, 0x400 }, { 0x70, 0x13 }, { 0x60, 0x8000 }, { 0x30, 0x8000 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x2003 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x2010 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x1 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x40, 0x0 }, { 0x30, 0xc2 }, { 0x70, 0x2 },
{ 0x30, 0x1 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x40, 0x0 }, { 0x30, 0xC2 }, { 0x70, 0x2 },
{ 0x60, 0x2 }, { 0x30, 0x0 }, { 0x60, 0x1 }, { 0x30, 0x2 }, { 0x30, 0x0 }, { 0x90, 0x3 },
{ 0x90, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x2 }, { 0x30, 0x3800 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x803 }, { 0x30, 0x0 }, { 0x30, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x2 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x2 }, { 0x30, 0x2 }, { 0x30, 0x2 }, { 0x40, 0x0 }, { 0x1c, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x2 }, { 0x30, 0x2 }, { 0x30, 0x2 }, { 0x40, 0x0 }, { 0x1C, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x60, 0x200 }, { 0x30, 0x800 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x3 },
@@ -179,23 +179,23 @@ SoundParams sEnvBankParams[] = {
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x3 }, { 0x60, 0x3 },
{ 0x30, 0x80 }, { 0x30, 0x2000 }, { 0x30, 0x0 }, { 0x30, 0x1 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x2 }, { 0x30, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0xa0, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0xc0 }, { 0x30, 0x2 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0xA0, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0xC0 }, { 0x30, 0x2 },
{ 0x30, 0x2 }, { 0x30, 0x0 }, { 0x30, 0x3 }, { 0x30, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x4083 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x80, 0x0 }, { 0x60, 0x0 }, { 0x90, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x60, 0xc3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x3 }, { 0x30, 0x3 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0xa0, 0x800 }, { 0x30, 0x0 },
{ 0x60, 0xC3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x3 }, { 0x30, 0x3 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0xA0, 0x800 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x2 }, { 0x30, 0x0 }, { 0x30, 0x3 }, { 0x20, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 },
};
SoundParams sSystemBankParams[] = {
{ 0xc0, 0x0 }, { 0xc0, 0x0 }, { 0xb0, 0x20 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x50, 0x0 },
{ 0xC0, 0x0 }, { 0xC0, 0x0 }, { 0xB0, 0x20 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x50, 0x0 },
{ 0x30, 0x20 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x20, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x28, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x18, 0x0 }, { 0x2c, 0x0 }, { 0x2c, 0x0 }, { 0x20, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x18, 0x0 }, { 0x2C, 0x0 }, { 0x2C, 0x0 }, { 0x20, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x20, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 },
{ 0x30, 0x0 }, { 0x30, 0x0 }, { 0x60, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 },

View File

@@ -7,7 +7,7 @@ u8 D_8012D200[] = {
void func_800C3C20(void) {
s32 i;
for (i = 0; (i < ARRAY_COUNT(D_8012D200)) & 0xFFFFFFFFu; i++) {
for (i = 0; (i < ARRAY_COUNT(D_8012D200)) & 0xFFFFFFFF; i++) {
func_800F87A0(D_8012D200[i]);
}
}

View File

@@ -140,42 +140,42 @@ u8 D_80130658[0x70] = {
s8 sSpecReverbs[20] = { 0, 0, 0, 0, 0, 0, 0, 40, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
D_801306DC_s D_801306DC[20] = {
{ 0xc0ff, 0xc0fe, { 0, 2, 0, 0, 3, 0, 1, 2, 9, 1, 3, 64, 1, 4, 0, 1, 5, 32, 2, 2, 4, 2, 3,
{ 0xC0FF, 0XC0FE, { 0, 2, 0, 0, 3, 0, 1, 2, 9, 1, 3, 64, 1, 4, 0, 1, 5, 32, 2, 2, 4, 2, 3,
0, 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} },
{ 0xC01F, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 0, 1, 3, 80, 1, 4, 1, 1, 5, 8, 2, 2, 10, 2, 3, 80, 2, 4, 1, 2,
5, 48, 3, 2, 6, 3, 3, 0, 3, 4, 0, 3, 5, 0, 4, 2, 11, 4, 3, 96, 4, 4, 0, 4, 5, 32, 0xFF } },
{ 0xc003, 0xc000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } },
{ 0xc003, 0xc000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } },
{ 0xc003, 0xc000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } },
{ 0xc003, 0xc000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } },
{ 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } },
{ 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } },
{ 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } },
{ 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } },
};
u32 sOcarinaAllowedBtnMask = 0x800F;

View File

@@ -83,7 +83,7 @@ void* DebugArena_Calloc(u32 num, u32 size) {
}
void DebugArena_Display(void) {
// "Zelda heap display" (devs forgot to change "Zelda" to "Debug" apparently)
// "Zelda heap display" ("Zelda" should probably have been changed to "Debug")
osSyncPrintf("ゼルダヒープ表示\n");
__osDisplayArena(&sDebugArena);
}

View File

@@ -39,6 +39,7 @@ extern FaultThreadStruct gFaultStruct;
void Fault_SleepImpl(u32 duration) {
u64 value = (duration * OS_CPU_COUNTER) / 1000ull;
Sleep_Cycles(value);
}
@@ -102,6 +103,7 @@ void Fault_ProcessClientContext(FaultClientContext* ctx) {
u32 Fault_ProcessClient(u32 callback, u32 param0, u32 param1) {
FaultClientContext a;
a.callback = callback;
a.param0 = param0;
a.param1 = param1;
@@ -118,6 +120,7 @@ void Fault_AddClient(FaultClient* client, void* callback, void* param0, void* pa
{
FaultClient* iter = sFaultStructPtr->clients;
while (iter != NULL) {
if (iter == client) {
alreadyExists = true;
@@ -186,6 +189,7 @@ void Fault_AddAddrConvClient(FaultAddrConvClient* client, void* callback, void*
{
FaultAddrConvClient* iter = sFaultStructPtr->addrConvClients;
while (iter != NULL) {
if (iter == client) {
alreadyExists = true;
@@ -347,9 +351,9 @@ void Fault_DrawCornerRec(u16 color) {
void Fault_PrintFReg(s32 idx, f32* value) {
u32 raw = *(u32*)value;
s32 v0 = ((raw & 0x7f800000) >> 0x17) - 0x7f;
s32 v0 = ((raw & 0x7F800000) >> 0x17) - 0x7F;
if ((v0 >= -0x7e && v0 < 0x80) || raw == 0) {
if ((v0 >= -0x7E && v0 < 0x80) || raw == 0) {
FaultDrawer_Printf("F%02d:%14.7e ", idx, *value);
} else {
FaultDrawer_Printf("F%02d: %08x(16) ", idx, raw);
@@ -358,9 +362,9 @@ void Fault_PrintFReg(s32 idx, f32* value) {
void Fault_LogFReg(s32 idx, f32* value) {
u32 raw = *(u32*)value;
s32 v0 = ((raw & 0x7f800000) >> 0x17) - 0x7f;
s32 v0 = ((raw & 0x7F800000) >> 0x17) - 0x7F;
if ((v0 >= -0x7e && v0 < 0x80) || raw == 0) {
if ((v0 >= -0x7E && v0 < 0x80) || raw == 0) {
osSyncPrintf("F%02d:%14.7e ", idx, *value);
} else {
osSyncPrintf("F%02d: %08x(16) ", idx, *(u32*)value);
@@ -370,6 +374,7 @@ void Fault_LogFReg(s32 idx, f32* value) {
void Fault_PrintFPCR(u32 value) {
s32 i;
u32 flag = 0x20000;
FaultDrawer_Printf("FPCSR:%08xH ", value);
for (i = 0; i < 6; i++) {
if (value & flag) {
@@ -384,6 +389,7 @@ void Fault_PrintFPCR(u32 value) {
void Fault_LogFPCR(u32 value) {
s32 i;
u32 flag = 0x20000;
osSyncPrintf("FPCSR:%08xH ", value);
for (i = 0; i < 6; i++) {
if (value & flag) {
@@ -396,11 +402,12 @@ void Fault_LogFPCR(u32 value) {
void Fault_PrintThreadContext(OSThread* t) {
__OSThreadContext* ctx;
s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1f) << 0x10) >> 0x10;
s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1F) << 0x10) >> 0x10;
if (causeStrIdx == 0x17) {
causeStrIdx = 0x10;
}
if (causeStrIdx == 0x1f) {
if (causeStrIdx == 0x1F) {
causeStrIdx = 0x11;
}
@@ -433,10 +440,10 @@ void Fault_PrintThreadContext(OSThread* t) {
Fault_PrintFReg(6, &ctx->fp6.f.f_even);
FaultDrawer_Printf("\n");
Fault_PrintFReg(8, &ctx->fp8.f.f_even);
Fault_PrintFReg(0xa, &ctx->fp10.f.f_even);
Fault_PrintFReg(0xA, &ctx->fp10.f.f_even);
FaultDrawer_Printf("\n");
Fault_PrintFReg(0xc, &ctx->fp12.f.f_even);
Fault_PrintFReg(0xe, &ctx->fp14.f.f_even);
Fault_PrintFReg(0xC, &ctx->fp12.f.f_even);
Fault_PrintFReg(0xE, &ctx->fp14.f.f_even);
FaultDrawer_Printf("\n");
Fault_PrintFReg(0x10, &ctx->fp16.f.f_even);
Fault_PrintFReg(0x12, &ctx->fp18.f.f_even);
@@ -445,21 +452,22 @@ void Fault_PrintThreadContext(OSThread* t) {
Fault_PrintFReg(0x16, &ctx->fp22.f.f_even);
FaultDrawer_Printf("\n");
Fault_PrintFReg(0x18, &ctx->fp24.f.f_even);
Fault_PrintFReg(0x1a, &ctx->fp26.f.f_even);
Fault_PrintFReg(0x1A, &ctx->fp26.f.f_even);
FaultDrawer_Printf("\n");
Fault_PrintFReg(0x1c, &ctx->fp28.f.f_even);
Fault_PrintFReg(0x1e, &ctx->fp30.f.f_even);
Fault_PrintFReg(0x1C, &ctx->fp28.f.f_even);
Fault_PrintFReg(0x1E, &ctx->fp30.f.f_even);
FaultDrawer_Printf("\n");
FaultDrawer_SetCharPad(0, 0);
}
void Fault_LogThreadContext(OSThread* t) {
__OSThreadContext* ctx;
s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1f) << 0x10) >> 0x10;
s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1F) << 0x10) >> 0x10;
if (causeStrIdx == 0x17) {
causeStrIdx = 0x10;
}
if (causeStrIdx == 0x1f) {
if (causeStrIdx == 0x1F) {
causeStrIdx = 0x11;
}
@@ -488,10 +496,10 @@ void Fault_LogThreadContext(OSThread* t) {
Fault_LogFReg(6, &ctx->fp6.f.f_even);
osSyncPrintf("\n");
Fault_LogFReg(8, &ctx->fp8.f.f_even);
Fault_LogFReg(0xa, &ctx->fp10.f.f_even);
Fault_LogFReg(0xA, &ctx->fp10.f.f_even);
osSyncPrintf("\n");
Fault_LogFReg(0xc, &ctx->fp12.f.f_even);
Fault_LogFReg(0xe, &ctx->fp14.f.f_even);
Fault_LogFReg(0xC, &ctx->fp12.f.f_even);
Fault_LogFReg(0xE, &ctx->fp14.f.f_even);
osSyncPrintf("\n");
Fault_LogFReg(0x10, &ctx->fp16.f.f_even);
Fault_LogFReg(0x12, &ctx->fp18.f.f_even);
@@ -500,17 +508,18 @@ void Fault_LogThreadContext(OSThread* t) {
Fault_LogFReg(0x16, &ctx->fp22.f.f_even);
osSyncPrintf("\n");
Fault_LogFReg(0x18, &ctx->fp24.f.f_even);
Fault_LogFReg(0x1a, &ctx->fp26.f.f_even);
Fault_LogFReg(0x1A, &ctx->fp26.f.f_even);
osSyncPrintf("\n");
Fault_LogFReg(0x1c, &ctx->fp28.f.f_even);
Fault_LogFReg(0x1e, &ctx->fp30.f.f_even);
Fault_LogFReg(0x1C, &ctx->fp28.f.f_even);
Fault_LogFReg(0x1E, &ctx->fp30.f.f_even);
osSyncPrintf("\n");
}
OSThread* Fault_FindFaultedThread() {
OSThread* iter = __osGetActiveQueue();
while (iter->priority != -1) {
if (iter->priority > 0 && iter->priority < 0x7f && (iter->flags & 3)) {
if (iter->priority > 0 && iter->priority < 0x7F && (iter->flags & 3)) {
return iter;
}
iter = iter->tlnext;
@@ -520,10 +529,11 @@ OSThread* Fault_FindFaultedThread() {
void Fault_Wait5Seconds(void) {
OSTime start[2]; // to make the function allocate 0x28 bytes of stack instead of 0x20
start[0] = osGetTime();
do {
Fault_Sleep(0x10);
} while ((osGetTime() - start[0]) < OS_USEC_TO_CYCLES(5000000) + 1); // 0xdf84759
} while ((osGetTime() - start[0]) < OS_USEC_TO_CYCLES(5000000) + 1);
sFaultStructPtr->faultActive = true;
}
@@ -684,8 +694,8 @@ void Fault_DrawMemDumpPage(const char* title, u32* addr, u32 param_3) {
if (alignedAddr < (u32*)0x80000000) {
alignedAddr = (u32*)0x80000000;
}
if (alignedAddr > (u32*)0x807fff00) {
alignedAddr = (u32*)0x807fff00;
if (alignedAddr > (u32*)0x807FFF00) {
alignedAddr = (u32*)0x807FFF00;
}
alignedAddr = (u32*)((u32)alignedAddr & ~3);
@@ -693,7 +703,7 @@ void Fault_DrawMemDumpPage(const char* title, u32* addr, u32 param_3) {
Fault_FillScreenBlack();
FaultDrawer_SetCharPad(-2, 0);
FaultDrawer_DrawText(0x24, 0x12, "%s %08x", title ? title : "PrintDump", alignedAddr);
FaultDrawer_DrawText(0x24, 0x12, "%s %08x", title != NULL ? title : "PrintDump", alignedAddr);
if (alignedAddr >= (u32*)0x80000000 && alignedAddr < (u32*)0xC0000000) {
for (y = 0x1C; y != 0xE2; y += 9) {
FaultDrawer_DrawText(0x18, y, "%06x", writeAddr);
@@ -717,8 +727,8 @@ void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1) {
if (addr < 0x80000000) {
addr = 0x80000000;
}
if (addr > 0x807fff00) {
addr = 0x807fff00;
if (addr > 0x807FFF00) {
addr = 0x807FFF00;
}
addr &= ~0xF;
@@ -884,7 +894,7 @@ void Fault_ResumeThread(OSThread* t) {
t->context.cause = 0;
t->context.fpcsr = 0;
t->context.pc += 4;
*(u32*)t->context.pc = 0xd;
*(u32*)t->context.pc = 0xD;
osWritebackDCache(t->context.pc, 4);
osInvalICache(t->context.pc, 4);
osStartThread(t);
@@ -892,9 +902,10 @@ void Fault_ResumeThread(OSThread* t) {
void Fault_CommitFB() {
u16* fb;
osViSetYScale(1.0f);
osViSetMode(&osViModeNtscLan1);
osViSetSpecialFeatures(0x42); // gama_disable|dither_fliter_enable_aa_mode3_disable
osViSetSpecialFeatures(OS_VI_GAMMA_OFF | OS_VI_DITHER_FILTER_ON);
osViBlack(false);
if (sFaultStructPtr->fb) {
@@ -902,7 +913,7 @@ void Fault_CommitFB() {
} else {
fb = (u16*)osViGetNextFramebuffer();
if ((u32)fb == 0x80000000) {
fb = (u16*)((osMemSize | 0x80000000) - 0x25800);
fb = (u16*)((osMemSize | 0x80000000) - sizeof(u16[SCREEN_HEIGHT][SCREEN_WIDTH]));
}
}
@@ -972,7 +983,7 @@ void Fault_ThreadEntry(void* arg) {
}
} while (faultedThread == NULL);
__osSetFpcCsr(__osGetFpcCsr() & -0xf81);
__osSetFpcCsr(__osGetFpcCsr() & -0xF81);
sFaultStructPtr->faultedThread = faultedThread;
while (!sFaultStructPtr->faultHandlerEnabled) {
@@ -1045,11 +1056,11 @@ void Fault_Init(void) {
void Fault_HangupFaultClient(const char* arg0, const char* arg1) {
osSyncPrintf("HungUp on Thread %d\n", osGetThreadId(0));
osSyncPrintf("%s\n", arg0 ? arg0 : "(NULL)");
osSyncPrintf("%s\n", arg1 ? arg1 : "(NULL)");
osSyncPrintf("%s\n", arg0 != NULL ? arg0 : "(NULL)");
osSyncPrintf("%s\n", arg1 != NULL ? arg1 : "(NULL)");
FaultDrawer_Printf("HungUp on Thread %d\n", osGetThreadId(0));
FaultDrawer_Printf("%s\n", arg0 ? arg0 : "(NULL)");
FaultDrawer_Printf("%s\n", arg1 ? arg1 : "(NULL)");
FaultDrawer_Printf("%s\n", arg0 != NULL ? arg0 : "(NULL)");
FaultDrawer_Printf("%s\n", arg1 != NULL ? arg1 : "(NULL)");
}
void Fault_AddHungupAndCrashImpl(const char* arg0, const char* arg1) {

View File

@@ -35,18 +35,18 @@ const u32 sFaultDrawerFont[] = {
};
FaultDrawer sFaultDrawerDefault = {
(u16*)0x803DA800, // fb
SCREEN_WIDTH, // w
SCREEN_HEIGHT, // h
16, // yStart
223, // yEnd
22, // xStart
297, // xEnd
GPACK_RGBA5551(255, 255, 255, 255), // foreColor
GPACK_RGBA5551(0, 0, 0, 0), // backColor
22, // cursorX
16, // cursorY
sFaultDrawerFont, // font
(u16*)(0x80400000 - sizeof(u16[SCREEN_HEIGHT][SCREEN_WIDTH])), // fb
SCREEN_WIDTH, // w
SCREEN_HEIGHT, // h
16, // yStart
223, // yEnd
22, // xStart
297, // xEnd
GPACK_RGBA5551(255, 255, 255, 255), // foreColor
GPACK_RGBA5551(0, 0, 0, 0), // backColor
22, // cursorX
16, // cursorY
sFaultDrawerFont, // font
8,
8,
0,
@@ -302,5 +302,5 @@ void FaultDrawer_WritebackFBDCache() {
void FaultDrawer_SetDefault() {
bcopy(&sFaultDrawerDefault, &sFaultDrawerStruct, sizeof(FaultDrawer));
sFaultDrawerStruct.fb = (u16*)((osMemSize | 0x80000000) - 0x25800);
sFaultDrawerStruct.fb = (u16*)((osMemSize | 0x80000000) - sizeof(u16[SCREEN_HEIGHT][SCREEN_WIDTH]));
}

View File

@@ -156,7 +156,7 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) {
D_8016A528 = osGetTime() - sGraphSetTaskTime - D_8016A558;
osSetTimer(&timer, 140625000, 0, &gfxCtx->queue, (OSMesg)666);
osSetTimer(&timer, OS_USEC_TO_CYCLES(3000000), 0, &gfxCtx->queue, (OSMesg)666);
osRecvMesg(&gfxCtx->queue, &msg, OS_MESG_BLOCK);
osStopTimer(&timer);
@@ -322,7 +322,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
GfxPool* pool = &gGfxPools[gfxCtx->gfxPoolIdx & 1];
if (pool->headMagic != GFXPOOL_HEAD_MAGIC) {
//! @bug (?) : devs might've forgotten "problem = true;"
//! @bug (?) : "problem = true;" may be missing
osSyncPrintf("%c", 7);
// "Dynamic area head is destroyed"
osSyncPrintf(VT_COL(RED, WHITE) "ダイナミック領域先頭が破壊されています\n" VT_RST);

Some files were not shown because too many files have changed in this diff Show More