1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-04 06:54:33 +00:00

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 c801337dde.

* 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 d80bdb32da.

* 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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
82 changed files with 327 additions and 323 deletions

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, 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, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } },
{ 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);

View file

@ -56,7 +56,7 @@ void Main(void* arg) {
// "System heap initalization"
osSyncPrintf("システムヒープ初期化 %08x-%08x %08x\n", sysHeap, fb, gSystemHeapSize);
SystemHeap_Init(sysHeap, gSystemHeapSize); // initializes the system heap
if (osMemSize >= 0x800000U) {
if (osMemSize >= 0x800000) {
debugHeap = SysCfb_GetFbEnd();
debugHeapSize = (s32)(0x80600000 - debugHeap);
} else {
@ -74,7 +74,7 @@ void Main(void* arg) {
Main_LogSystemHeap();
osCreateMesgQueue(&irqMgrMsgQ, irqMgrMsgBuf, 0x3c);
osCreateMesgQueue(&irqMgrMsgQ, irqMgrMsgBuf, 0x3C);
StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, sIrqMgrStack + sizeof(sIrqMgrStack), 0, 0x100, "irqmgr");
IrqMgr_Init(&gIrqMgr, &sGraphStackInfo, Z_PRIORITY_IRQMGR, 1);
@ -85,7 +85,7 @@ void Main(void* arg) {
IrqMgr_AddClient(&gIrqMgr, &irqClient, &irqMgrMsgQ);
StackCheck_Init(&sAudioStackInfo, sAudioStack, sAudioStack + sizeof(sAudioStack), 0, 0x100, "audio");
AudioMgr_Init(&gAudioMgr, sAudioStack + sizeof(sAudioStack), Z_PRIORITY_AUDIOMGR, 0xa, &gSchedContext, &gIrqMgr);
AudioMgr_Init(&gAudioMgr, sAudioStack + sizeof(sAudioStack), Z_PRIORITY_AUDIOMGR, 0xA, &gSchedContext, &gIrqMgr);
StackCheck_Init(&sPadMgrStackInfo, sPadMgrStack, sPadMgrStack + sizeof(sPadMgrStack), 0, 0x100, "padmgr");
PadMgr_Init(&gPadMgr, &sSiIntMsgQ, &gIrqMgr, 7, Z_PRIORITY_PADMGR, &sIrqMgrStack);

View file

@ -46,10 +46,10 @@ void Sched_SwapFrameBuffer(CfbInfo* cfbInfo) {
HREG(95) = 0xD;
}
if (HREG(80) == 0xD && HREG(81) == 2) {
osViSetSpecialFeatures(HREG(82) != 0 ? 1 : 2);
osViSetSpecialFeatures(HREG(83) != 0 ? 0x40 : 0x80);
osViSetSpecialFeatures(HREG(84) != 0 ? 0x4 : 0x8);
osViSetSpecialFeatures(HREG(85) != 0 ? 0x10 : 0x20);
osViSetSpecialFeatures(HREG(82) != 0 ? OS_VI_GAMMA_ON : OS_VI_GAMMA_OFF);
osViSetSpecialFeatures(HREG(83) != 0 ? OS_VI_DITHER_FILTER_ON : OS_VI_DITHER_FILTER_OFF);
osViSetSpecialFeatures(HREG(84) != 0 ? OS_VI_GAMMA_DITHER_ON : OS_VI_GAMMA_DITHER_OFF);
osViSetSpecialFeatures(HREG(85) != 0 ? OS_VI_DIVOT_ON : OS_VI_DIVOT_OFF);
}
}
cfbInfo->unk_10 = 0;

View file

@ -7,7 +7,7 @@ void SysCfb_Init(s32 n64dd) {
u32 screenSize;
u32 tmpFbEnd;
if (osMemSize >= 0x800000U) {
if (osMemSize >= 0x800000) {
// "8MB or more memory is installed"
osSyncPrintf("8Mバイト以上のメモリが搭載されています\n");
tmpFbEnd = 0x8044BE80;
@ -19,7 +19,7 @@ void SysCfb_Init(s32 n64dd) {
osSyncPrintf("このバージョンのマージンは %dK バイトです\n", (0x4BC00 / 1024));
sSysCfbEnd = tmpFbEnd;
}
} else if (osMemSize >= 0x400000U) {
} else if (osMemSize >= 0x400000) {
osSyncPrintf("RAM4M mode\n");
sSysCfbEnd = 0x80400000;
} else {
@ -27,7 +27,7 @@ void SysCfb_Init(s32 n64dd) {
}
screenSize = SCREEN_WIDTH * SCREEN_HEIGHT;
sSysCfbEnd &= ~0x3f;
sSysCfbEnd &= ~0x3F;
// "The final address used by the system is %08x"
osSyncPrintf("システムが使用する最終アドレスは %08x です\n", sSysCfbEnd);
sSysCfbFbPtr[0] = sSysCfbEnd - (screenSize * 4);

View file

@ -2694,7 +2694,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId
objBankIndex = Object_GetIndex(&globalCtx->objectCtx, actorInit->objectId);
if ((objBankIndex < 0) ||
((actorInit->category == ACTORCAT_ENEMY) && (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)))) {
((actorInit->category == ACTORCAT_ENEMY) && Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num))) {
// "No data bank!! <data bank%d> (profilep->bank=%d)"
osSyncPrintf(VT_COL(RED, WHITE) "データバンク無し!!<データバンク=%d>(profilep->bank=%d)\n" VT_RST,
objBankIndex, actorInit->objectId);
@ -4372,7 +4372,7 @@ u32 func_80035BFC(GlobalContext* globalCtx, s16 arg1) {
if (Flags_GetEventChkInf(0x5C)) {
retTextId = 0x1079;
} else {
retTextId = 0x104e;
retTextId = 0x104E;
}
}
break;
@ -4402,7 +4402,7 @@ u32 func_80035BFC(GlobalContext* globalCtx, s16 arg1) {
}
} else {
if (Flags_GetEventChkInf(0x5C)) {
retTextId = 0x107b;
retTextId = 0x107B;
} else {
retTextId = 0x1051;
}
@ -4462,7 +4462,7 @@ u32 func_80035BFC(GlobalContext* globalCtx, s16 arg1) {
break;
case 17:
if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) {
if (Flags_GetInfTable(0x6c)) {
if (Flags_GetInfTable(0x6C)) {
retTextId = 0x7008;
} else {
retTextId = 0x7007;
@ -4524,7 +4524,7 @@ u32 func_80035BFC(GlobalContext* globalCtx, s16 arg1) {
if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) {
retTextId = 0x7046;
} else {
Flags_GetInfTable(0xc2);
Flags_GetInfTable(0xC2);
retTextId = 0x7018;
}
break;
@ -4547,7 +4547,7 @@ u32 func_80035BFC(GlobalContext* globalCtx, s16 arg1) {
if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) {
retTextId = 0x7048;
} else {
Flags_GetInfTable(0xca);
Flags_GetInfTable(0xCA);
retTextId = 0x701D;
}
break;
@ -4555,7 +4555,7 @@ u32 func_80035BFC(GlobalContext* globalCtx, s16 arg1) {
if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) {
retTextId = 0x7049;
} else {
Flags_GetInfTable(0xcc);
Flags_GetInfTable(0xCC);
retTextId = 0x701F;
}
break;
@ -5044,7 +5044,7 @@ void func_80036E50(u16 textId, s16 arg1) {
}
return;
case 34:
if (textId == 0x403c) {
if (textId == 0x403C) {
Flags_SetInfTable(0xD6);
}
return;

View file

@ -76,7 +76,7 @@ void KaleidoManager_Destroy() {
sKaleidoAreaPtr = NULL;
}
// NOTE: this function looks messed up and probably doesn't work like how the devs wanted it to work
// NOTE: this function looks messed up and probably doesn't work how it was intended to
void* KaleidoManager_GetRamAddr(void* vram) {
KaleidoMgrOverlay* iter = gKaleidoMgrCurOvl;
KaleidoMgrOverlay* ovl = iter;
@ -90,7 +90,7 @@ void* KaleidoManager_GetRamAddr(void* vram) {
ovl = iter;
goto KaleidoManager_GetRamAddr_end;
}
//! @bug Devs probably forgot iter++ here
//! @bug Probably missing iter++ here
}
osSyncPrintf("異常\n"); // "Abnormal"

View file

@ -244,7 +244,7 @@ void Gameplay_Init(GameState* thisx) {
gSaveContext.cutsceneIndex = 0;
}
if (gSaveContext.nextDayTime != 0xFFFFU) {
if (gSaveContext.nextDayTime != 0xFFFF) {
gSaveContext.dayTime = gSaveContext.nextDayTime;
gSaveContext.skyboxTime = gSaveContext.nextDayTime;
}

View file

@ -683,10 +683,10 @@ void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable,
if (LINK_IS_ADULT) {
s32 strengthUpgrade = CUR_UPG_VALUE(UPG_STRENGTH);
if (strengthUpgrade >= PLAYER_STR_SILVER_G) {
if (strengthUpgrade >= 2) { // silver or gold gauntlets
gDPPipeSync(POLY_OPA_DISP++);
color = &sGauntletColors[strengthUpgrade - PLAYER_STR_SILVER_G];
color = &sGauntletColors[strengthUpgrade - 2];
gDPSetEnvColor(POLY_OPA_DISP++, color->r, color->g, color->b, 0);
gSPDisplayList(POLY_OPA_DISP++, D_06025218);
@ -697,6 +697,7 @@ void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable,
if (boots != 0) {
Gfx** bootDLists = sBootDListGroups[boots - 1];
gSPDisplayList(POLY_OPA_DISP++, bootDLists[0]);
gSPDisplayList(POLY_OPA_DISP++, bootDLists[1]);
}

View file

@ -461,7 +461,7 @@ void Sram_WriteSave(SramContext* sramCtx) {
j = 0;
for (offset = 0; offset < CHECKSUM_SIZE; offset++) {
if (++j == 0x20U) {
if (++j == 0x20) {
j = 0;
}
checksum += *ptr++;
@ -473,7 +473,7 @@ void Sram_WriteSave(SramContext* sramCtx) {
checksum = 0;
for (offset = 0; offset < CHECKSUM_SIZE; offset++) {
if (++j == 0x20U) {
if (++j == 0x20) {
j = 0;
}
checksum += *ptr++;
@ -486,7 +486,7 @@ void Sram_WriteSave(SramContext* sramCtx) {
checksum = 0;
for (offset = 0; offset < CHECKSUM_SIZE; offset++) {
if (++j == 0x20U) {
if (++j == 0x20) {
j = 0;
}
checksum += *ptr++;
@ -715,7 +715,7 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
for (offset = 0; offset < CHECKSUM_SIZE; offset++) {
osSyncPrintf("%x ", *ptr);
checksum += *ptr++;
if (++j == 0x20u) {
if (++j == 0x20) {
osSyncPrintf("\n");
j = 0;
}

View file

@ -1,7 +1,7 @@
#include "global.h"
// (Note: 80 = SCREEN_HEIGHT/3, see VisMono_DrawTexture)
// Did the devs forget to update this? 1+1+1+80*(7+2+2+3)+1+1 makes more sense
// This may not have been kept up-to-date with the code, 1+1+1+80*(7+2+2+3)+1+1 makes more sense
#define DLSIZE (1 + 3 + 1 + 1 + 80 * (7 + 2 + 2 + 3) + 1)
// framebuffer