Skip to content

Commit

Permalink
Use debug macros even in N64 code
Browse files Browse the repository at this point in the history
  • Loading branch information
cadmic committed Nov 14, 2024
1 parent 8ce69c3 commit 3e476a5
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 56 deletions.
4 changes: 2 additions & 2 deletions src/code/code_n64dd_800AD410.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ vu8 D_80121214;

void func_800AD410(void) {
if (!D_80121210) {
DmaMgr_RequestSync(_n64ddSegmentStart, (uintptr_t)_n64ddSegmentRomStart,
_n64ddSegmentRomEnd - _n64ddSegmentRomStart);
DMA_REQUEST_SYNC(_n64ddSegmentStart, (uintptr_t)_n64ddSegmentRomStart,
_n64ddSegmentRomEnd - _n64ddSegmentRomStart, "../code_n64dd_800AD410.c", 0);
bzero(_n64ddSegmentBssStart, _n64ddSegmentBssEnd - _n64ddSegmentBssStart);
D_80121210 = true;
D_80121211 = func_801C6E80();
Expand Down
12 changes: 7 additions & 5 deletions src/code/z_kanfont.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
*/
void Font_LoadCharWide(Font* font, u16 character, u16 codePointIndex) {
#if OOT_NTSC
DmaMgr_RequestSync(&font->charTexBuf[codePointIndex],
(uintptr_t)_kanjiSegmentRomStart + Kanji_OffsetFromShiftJIS(character), FONT_CHAR_TEX_SIZE);
DMA_REQUEST_SYNC(&font->charTexBuf[codePointIndex],
(uintptr_t)_kanjiSegmentRomStart + Kanji_OffsetFromShiftJIS(character), FONT_CHAR_TEX_SIZE,
"../z_kanfont.c", 0);
#endif
}

Expand Down Expand Up @@ -53,7 +54,8 @@ void Font_LoadOrderedFont(Font* font) {

#if OOT_NTSC
len = (u32)size / 2;
DmaMgr_RequestSync(font->msgBufWide, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, size);
DMA_REQUEST_SYNC(font->msgBufWide, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, size,
"../z_kanfont.c", 0);

fontBufIndex = 0;
for (codePointIndex = 0; font->msgBufWide[codePointIndex] != MESSAGE_WIDE_END; codePointIndex++) {
Expand All @@ -63,8 +65,8 @@ void Font_LoadOrderedFont(Font* font) {

if (font->msgBufWide[codePointIndex] != MESSAGE_WIDE_NEWLINE) {
offset = Kanji_OffsetFromShiftJIS(font->msgBufWide[codePointIndex]);
DmaMgr_RequestSync(&font->fontBuf[fontBufIndex * 8], (uintptr_t)_kanjiSegmentRomStart + offset,
FONT_CHAR_TEX_SIZE);
DMA_REQUEST_SYNC(&font->fontBuf[fontBufIndex * 8], (uintptr_t)_kanjiSegmentRomStart + offset,
FONT_CHAR_TEX_SIZE, "../z_kanfont.c", 0);
fontBufIndex += FONT_CHAR_TEX_SIZE / 8;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/code/z_map_exp.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ void Map_InitData(PlayState* play, s16 room) {
#if PLATFORM_N64
if ((B_80121220 != NULL) && (B_80121220->unk_28 != NULL) && B_80121220->unk_28(play)) {
} else {
DmaMgr_RequestSync(play->interfaceCtx.mapSegment,
(uintptr_t)_map_i_staticSegmentRomStart +
((gMapData->dgnMinimapTexIndexOffset[mapIndex] + room) * MAP_I_TEX_SIZE),
MAP_I_TEX_SIZE);
DMA_REQUEST_SYNC(play->interfaceCtx.mapSegment,
(uintptr_t)_map_i_staticSegmentRomStart +
((gMapData->dgnMinimapTexIndexOffset[mapIndex] + room) * MAP_I_TEX_SIZE),
MAP_I_TEX_SIZE, "../z_map_exp.c", 0);
}
#else
DMA_REQUEST_SYNC(play->interfaceCtx.mapSegment,
Expand Down
48 changes: 24 additions & 24 deletions src/code/z_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -2036,14 +2036,14 @@ void Message_Decode(PlayState* play) {
msgCtx->textboxBackgroundBackColorIdx = (font->msgBufWide[msgCtx->msgBufPos + 2] & 0xF00) >> 8;
msgCtx->textboxBackgroundYOffsetIdx = (font->msgBufWide[msgCtx->msgBufPos + 2] & 0xF0) >> 4;
msgCtx->textboxBackgroundUnkArg = font->msgBufWide[msgCtx->msgBufPos + 2] & 0xF;
DmaMgr_RequestSync(msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE,
(uintptr_t)_message_texture_staticSegmentRomStart +
msgCtx->textboxBackgroundIdx * MESSAGE_TEXTURE_STATIC_TEX_SIZE,
MESSAGE_TEXTURE_STATIC_TEX_SIZE);
DmaMgr_RequestSync(msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE + MESSAGE_TEXTURE_STATIC_TEX_SIZE,
(uintptr_t)_message_texture_staticSegmentRomStart +
(msgCtx->textboxBackgroundIdx + 1) * MESSAGE_TEXTURE_STATIC_TEX_SIZE,
MESSAGE_TEXTURE_STATIC_TEX_SIZE);
DMA_REQUEST_SYNC(msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE,
(uintptr_t)_message_texture_staticSegmentRomStart +
msgCtx->textboxBackgroundIdx * MESSAGE_TEXTURE_STATIC_TEX_SIZE,
MESSAGE_TEXTURE_STATIC_TEX_SIZE, "../z_message_PAL.c", 0);
DMA_REQUEST_SYNC(msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE + MESSAGE_TEXTURE_STATIC_TEX_SIZE,
(uintptr_t)_message_texture_staticSegmentRomStart +
(msgCtx->textboxBackgroundIdx + 1) * MESSAGE_TEXTURE_STATIC_TEX_SIZE,
MESSAGE_TEXTURE_STATIC_TEX_SIZE, "../z_message_PAL.c", 0);
numLines = 2;
msgCtx->msgBufPos += 2;
R_TEXTBOX_BG_YPOS = R_TEXTBOX_Y + 8;
Expand Down Expand Up @@ -2528,8 +2528,8 @@ void Message_OpenText(PlayState* play, u16 textId) {
if ((B_80121220 != NULL) && (B_80121220->unk_60 != NULL) && B_80121220->unk_60(&play->msgCtx.font)) {

} else {
DmaMgr_RequestSync(font->msgBuf, (uintptr_t)_staff_message_data_staticSegmentRomStart + font->msgOffset,
font->msgLength);
DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_staff_message_data_staticSegmentRomStart + font->msgOffset,
font->msgLength, "../z_message_PAL.c", 0);
}
#else
DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_staff_message_data_staticSegmentRomStart + font->msgOffset,
Expand All @@ -2544,12 +2544,12 @@ void Message_OpenText(PlayState* play, u16 textId) {
if ((B_80121220 != NULL) && (B_80121220->unk_64 != NULL) && B_80121220->unk_64(&play->msgCtx.font)) {

} else {
DmaMgr_RequestSync(font->msgBuf, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset,
font->msgLength);
DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset,
font->msgLength, "../z_message_PAL.c", 0);
}
#else
DmaMgr_RequestSync(font->msgBuf, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset,
font->msgLength);
DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset,
font->msgLength, "../z_message_PAL.c", 0);
#endif
} else {
Message_FindMessageNES(play, textId);
Expand All @@ -2558,12 +2558,12 @@ void Message_OpenText(PlayState* play, u16 textId) {
if ((B_80121220 != NULL) && (B_80121220->unk_68 != NULL) && B_80121220->unk_68(&play->msgCtx.font)) {

} else {
DmaMgr_RequestSync(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset,
font->msgLength);
DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset,
font->msgLength, "../z_message_PAL.c", 0);
}
#else
DmaMgr_RequestSync(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset,
font->msgLength);
DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset,
font->msgLength, "../z_message_PAL.c", 0);
#endif
}
#else
Expand All @@ -2574,8 +2574,8 @@ void Message_OpenText(PlayState* play, u16 textId) {
if ((B_80121220 != NULL) && (B_80121220->unk_64 != NULL) && B_80121220->unk_64(&play->msgCtx.font)) {

} else {
DmaMgr_RequestSync(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset,
font->msgLength);
DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset,
font->msgLength, "../z_message_PAL.c", 0);
}
#else
DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset,
Expand All @@ -2589,8 +2589,8 @@ void Message_OpenText(PlayState* play, u16 textId) {
if ((B_80121220 != NULL) && (B_80121220->unk_64 != NULL) && B_80121220->unk_68(&play->msgCtx.font)) {

} else {
DmaMgr_RequestSync(font->msgBuf, (uintptr_t)_ger_message_data_staticSegmentRomStart + font->msgOffset,
font->msgLength);
DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_ger_message_data_staticSegmentRomStart + font->msgOffset,
font->msgLength, "../z_message_PAL.c", 0);
}
#else
DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_ger_message_data_staticSegmentRomStart + font->msgOffset,
Expand All @@ -2604,8 +2604,8 @@ void Message_OpenText(PlayState* play, u16 textId) {
if ((B_80121220 != NULL) && (B_80121220->unk_64 != NULL) && B_80121220->unk_6C_PAL(&play->msgCtx.font)) {

} else {
DmaMgr_RequestSync(font->msgBuf, (uintptr_t)_fra_message_data_staticSegmentRomStart + font->msgOffset,
font->msgLength);
DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_fra_message_data_staticSegmentRomStart + font->msgOffset,
font->msgLength, "../z_message_PAL.c", 0);
}
#else
DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_fra_message_data_staticSegmentRomStart + font->msgOffset,
Expand Down
2 changes: 1 addition & 1 deletion src/code/z_play.c
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,7 @@ void* Play_LoadFileFromDiskDrive(PlayState* this, RomFile* file) {
void* allocp;

size = file->vromEnd - file->vromStart;
allocp = THA_AllocTailAlign16(&this->state.tha, size);
allocp = GAME_STATE_ALLOC(&this->state.tha, size, "../z_play.c", 0);
func_801C7C1C(allocp, file->vromStart, size);

return allocp;
Expand Down
4 changes: 2 additions & 2 deletions src/overlays/gamestates/ovl_file_choose/z_file_nameset.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ void FileSelect_DrawCharacter(GraphicsContext* gfxCtx, void* texture, s16 vtx) {

#if OOT_NTSC
void FileSelect_DrawCharacterTransition(GraphicsContext* gfxCtx, void* texture1, void* texture2, s16 vtx) {
OPEN_DISPS(gfxCtx, "", 0);
OPEN_DISPS(gfxCtx, "../z_file_nameset_PAL.c", 0);

gDPLoadTextureBlock_4b(POLY_OPA_DISP++, texture1, G_IM_FMT_I, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gDPLoadMultiBlock_4b(POLY_OPA_DISP++, texture2, 0x0080, 1, G_IM_FMT_I, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0);

CLOSE_DISPS(gfxCtx, "", 0);
CLOSE_DISPS(gfxCtx, "../z_file_nameset_PAL.c", 0);
}
#endif

Expand Down
36 changes: 18 additions & 18 deletions src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c
Original file line number Diff line number Diff line change
Expand Up @@ -3696,12 +3696,12 @@ void KaleidoScope_Update(PlayState* play) {
#if OOT_NTSC
if (gSaveContext.language == LANGUAGE_JPN) {
size = (uintptr_t)_icon_item_jpn_staticSegmentRomEnd - (uintptr_t)_icon_item_jpn_staticSegmentRomStart;
DmaMgr_RequestSync(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_jpn_staticSegmentRomStart,
size);
DMA_REQUEST_SYNC(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_jpn_staticSegmentRomStart, size,
"../z_kaleido_scope_PAL.c", 0);
} else {
size = (uintptr_t)_icon_item_nes_staticSegmentRomEnd - (uintptr_t)_icon_item_nes_staticSegmentRomStart;
DmaMgr_RequestSync(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_nes_staticSegmentRomStart,
size);
DMA_REQUEST_SYNC(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_nes_staticSegmentRomStart, size,
"../z_kaleido_scope_PAL.c", 0);
}
#else
if (gSaveContext.language == LANGUAGE_ENG) {
Expand Down Expand Up @@ -3732,17 +3732,17 @@ void KaleidoScope_Update(PlayState* play) {
if (((void)0, gSaveContext.worldMapArea) < WORLD_MAP_AREA_MAX) {
#if OOT_NTSC
if (gSaveContext.language == LANGUAGE_JPN) {
DmaMgr_RequestSync(pauseCtx->nameSegment + MAX(MAP_NAME_TEX1_SIZE, ITEM_NAME_TEX_SIZE),
(uintptr_t)_map_name_staticSegmentRomStart +
(((void)0, gSaveContext.worldMapArea) * MAP_NAME_TEX2_SIZE) +
24 * MAP_NAME_TEX1_SIZE + 22 * LANGUAGE_JPN * MAP_NAME_TEX2_SIZE,
MAP_NAME_TEX2_SIZE);
DMA_REQUEST_SYNC(pauseCtx->nameSegment + MAX(MAP_NAME_TEX1_SIZE, ITEM_NAME_TEX_SIZE),
(uintptr_t)_map_name_staticSegmentRomStart +
(((void)0, gSaveContext.worldMapArea) * MAP_NAME_TEX2_SIZE) +
24 * MAP_NAME_TEX1_SIZE + 22 * LANGUAGE_JPN * MAP_NAME_TEX2_SIZE,
MAP_NAME_TEX2_SIZE, "../z_kaleido_scope_PAL.c", 0);
} else {
DmaMgr_RequestSync(pauseCtx->nameSegment + MAX(MAP_NAME_TEX1_SIZE, ITEM_NAME_TEX_SIZE),
(uintptr_t)_map_name_staticSegmentRomStart +
(((void)0, gSaveContext.worldMapArea) * MAP_NAME_TEX2_SIZE) +
24 * MAP_NAME_TEX1_SIZE + 22 * LANGUAGE_ENG * MAP_NAME_TEX2_SIZE,
MAP_NAME_TEX2_SIZE);
DMA_REQUEST_SYNC(pauseCtx->nameSegment + MAX(MAP_NAME_TEX1_SIZE, ITEM_NAME_TEX_SIZE),
(uintptr_t)_map_name_staticSegmentRomStart +
(((void)0, gSaveContext.worldMapArea) * MAP_NAME_TEX2_SIZE) +
24 * MAP_NAME_TEX1_SIZE + 22 * LANGUAGE_ENG * MAP_NAME_TEX2_SIZE,
MAP_NAME_TEX2_SIZE, "../z_kaleido_scope_PAL.c", 0);
}
#else
if (gSaveContext.language == LANGUAGE_ENG) {
Expand Down Expand Up @@ -4293,12 +4293,12 @@ void KaleidoScope_Update(PlayState* play) {
#if OOT_NTSC
if (gSaveContext.language == LANGUAGE_JPN) {
size = (uintptr_t)_icon_item_jpn_staticSegmentRomEnd - (uintptr_t)_icon_item_jpn_staticSegmentRomStart;
DmaMgr_RequestSync(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_jpn_staticSegmentRomStart,
size);
DMA_REQUEST_SYNC(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_jpn_staticSegmentRomStart, size,
"../z_kaleido_scope_PAL.c", 0);
} else {
size = (uintptr_t)_icon_item_nes_staticSegmentRomEnd - (uintptr_t)_icon_item_nes_staticSegmentRomStart;
DmaMgr_RequestSync(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_nes_staticSegmentRomStart,
size);
DMA_REQUEST_SYNC(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_nes_staticSegmentRomStart, size,
"../z_kaleido_scope_PAL.c", 0);
}
#else
if (gSaveContext.language == LANGUAGE_ENG) {
Expand Down

0 comments on commit 3e476a5

Please sign in to comment.