1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-03 06:24:30 +00:00

More documentation for z_std_dma.c (#1415)

* More documentation for z_std_dma

* uintptr casts for rom symbols in z64animation.h and z_kanfont.c

* Format

* Suggested changes, more defines for static texture sizes

* PI Interface -> PI

* Further suggested changes

* Format

* Comments about item_name and map_name texture assumptions
This commit is contained in:
Tharo 2022-11-17 02:57:02 +00:00 committed by GitHub
parent 40639e698d
commit 7ecafcfe7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 549 additions and 320 deletions

View file

@ -5139,7 +5139,7 @@ void func_8083AE40(Player* this, s16 objectId) {
LOG_HEX("size", size, "../z_player.c", 9090);
ASSERT(size <= 1024 * 8, "size <= 1024 * 8", "../z_player.c", 9091);
DmaMgr_SendRequest2(&this->giObjectDmaRequest, this->giObjectSegment, gObjectTable[objectId].vromStart, size, 0,
DmaMgr_RequestAsync(&this->giObjectDmaRequest, this->giObjectSegment, gObjectTable[objectId].vromStart, size, 0,
&this->giObjectLoadQueue, NULL, "../z_player.c", 9099);
}
}

View file

@ -1879,13 +1879,14 @@ void FileSelect_Init(GameState* thisx) {
this->staticSegment = GameState_Alloc(&this->state, size, "../z_file_choose.c", 3392);
ASSERT(this->staticSegment != NULL, "this->staticSegment != NULL", "../z_file_choose.c", 3393);
DmaMgr_SendRequest1(this->staticSegment, (uintptr_t)_title_staticSegmentRomStart, size, "../z_file_choose.c", 3394);
DmaMgr_RequestSyncDebug(this->staticSegment, (uintptr_t)_title_staticSegmentRomStart, size, "../z_file_choose.c",
3394);
size = (uintptr_t)_parameter_staticSegmentRomEnd - (uintptr_t)_parameter_staticSegmentRomStart;
this->parameterSegment = GameState_Alloc(&this->state, size, "../z_file_choose.c", 3398);
ASSERT(this->parameterSegment != NULL, "this->parameterSegment != NULL", "../z_file_choose.c", 3399);
DmaMgr_SendRequest1(this->parameterSegment, (uintptr_t)_parameter_staticSegmentRomStart, size, "../z_file_choose.c",
3400);
DmaMgr_RequestSyncDebug(this->parameterSegment, (uintptr_t)_parameter_staticSegmentRomStart, size,
"../z_file_choose.c", 3400);
Matrix_Init(&this->state);
View_Init(&this->view, this->state.gfxCtx);

View file

@ -761,7 +761,8 @@ void MapSelect_Init(GameState* thisx) {
R_UPDATE_RATE = 1;
this->staticSegment = GameState_Alloc(&this->state, size, "../z_select.c", 1114);
DmaMgr_SendRequest1(this->staticSegment, (uintptr_t)_z_select_staticSegmentRomStart, size, "../z_select.c", 1115);
DmaMgr_RequestSyncDebug(this->staticSegment, (uintptr_t)_z_select_staticSegmentRomStart, size, "../z_select.c",
1115);
gSaveContext.cutsceneIndex = 0x8000;
gSaveContext.linkAge = LINK_AGE_CHILD;
}

View file

@ -160,8 +160,8 @@ void ConsoleLogo_Init(GameState* thisx) {
this->staticSegment = GameState_Alloc(&this->state, size, "../z_title.c", 611);
osSyncPrintf("z_title.c\n");
ASSERT(this->staticSegment != NULL, "this->staticSegment != NULL", "../z_title.c", 614);
DmaMgr_SendRequest1(this->staticSegment, (uintptr_t)_nintendo_rogo_staticSegmentRomStart, size, "../z_title.c",
615);
DmaMgr_RequestSyncDebug(this->staticSegment, (uintptr_t)_nintendo_rogo_staticSegmentRomStart, size, "../z_title.c",
615);
R_UPDATE_RATE = 1;
Matrix_Init(&this->state);
View_Init(&this->view, this->state.gfxCtx);

View file

@ -710,7 +710,9 @@ void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 150, 255, 255, pauseCtx->alpha);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
POLY_OPA_DISP = KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, pauseCtx->nameSegment + 0x400, 80, 32, 4);
POLY_OPA_DISP = KaleidoScope_QuadTextureIA8(POLY_OPA_DISP,
pauseCtx->nameSegment + MAX(MAP_NAME_TEX1_SIZE, ITEM_NAME_TEX_SIZE),
MAP_NAME_TEX2_WIDTH, MAP_NAME_TEX2_HEIGHT, 4);
}
gDPPipeSync(POLY_OPA_DISP++);

View file

@ -1140,7 +1140,10 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255);
}
POLY_OPA_DISP = KaleidoScope_QuadTextureIA4(POLY_OPA_DISP, pauseCtx->nameSegment, 128, 16, 0);
// Note that this is used to draw both item name and map name textures, it expects that the dimensions and
// format for both sets of textures are identical.
POLY_OPA_DISP = KaleidoScope_QuadTextureIA4(POLY_OPA_DISP, pauseCtx->nameSegment, ITEM_NAME_TEX_WIDTH,
ITEM_NAME_TEX_HEIGHT, 0);
}
if (pauseCtx->pageIndex == PAUSE_MAP) {
@ -1352,12 +1355,13 @@ void KaleidoScope_UpdateNamePanel(PlayState* play) {
sp2A += 12;
}
DmaMgr_SendRequest1(pauseCtx->nameSegment, (uintptr_t)_map_name_staticSegmentRomStart + (sp2A * 0x400),
0x400, "../z_kaleido_scope_PAL.c", 2093);
DmaMgr_RequestSyncDebug(pauseCtx->nameSegment,
(uintptr_t)_map_name_staticSegmentRomStart + (sp2A * MAP_NAME_TEX1_SIZE),
MAP_NAME_TEX1_SIZE, "../z_kaleido_scope_PAL.c", 2093);
} else {
osSyncPrintf("zoom_name=%d\n", pauseCtx->namedItem);
if (gSaveContext.language) {
if (gSaveContext.language) { // != LANGUAGE_ENG
sp2A += 123;
}
if (gSaveContext.language == LANGUAGE_FRA) {
@ -1366,8 +1370,9 @@ void KaleidoScope_UpdateNamePanel(PlayState* play) {
osSyncPrintf("J_N=%d point=%d\n", gSaveContext.language, sp2A);
DmaMgr_SendRequest1(pauseCtx->nameSegment, (uintptr_t)_item_name_staticSegmentRomStart + (sp2A * 0x400),
0x400, "../z_kaleido_scope_PAL.c", 2120);
DmaMgr_RequestSyncDebug(pauseCtx->nameSegment,
(uintptr_t)_item_name_staticSegmentRomStart + (sp2A * ITEM_NAME_TEX_SIZE),
ITEM_NAME_TEX_SIZE, "../z_kaleido_scope_PAL.c", 2120);
}
pauseCtx->nameDisplayTimer = 0;
@ -2441,13 +2446,13 @@ void KaleidoScope_LoadDungeonMap(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
s32 pad;
DmaMgr_SendRequest1(interfaceCtx->mapSegment,
(uintptr_t)_map_48x85_staticSegmentRomStart + (R_MAP_TEX_INDEX * 2040), 2040,
"../z_kaleido_scope_PAL.c", 3467);
DmaMgr_RequestSyncDebug(interfaceCtx->mapSegment,
(uintptr_t)_map_48x85_staticSegmentRomStart + ((R_MAP_TEX_INDEX + 0) * MAP_48x85_TEX_SIZE),
MAP_48x85_TEX_SIZE, "../z_kaleido_scope_PAL.c", 3467);
DmaMgr_SendRequest1(interfaceCtx->mapSegment + 0x800,
(uintptr_t)_map_48x85_staticSegmentRomStart + ((R_MAP_TEX_INDEX + 1) * 2040), 2040,
"../z_kaleido_scope_PAL.c", 3471);
DmaMgr_RequestSyncDebug(interfaceCtx->mapSegment + ALIGN16(MAP_48x85_TEX_SIZE),
(uintptr_t)_map_48x85_staticSegmentRomStart + ((R_MAP_TEX_INDEX + 1) * MAP_48x85_TEX_SIZE),
MAP_48x85_TEX_SIZE, "../z_kaleido_scope_PAL.c", 3471);
}
void KaleidoScope_UpdateDungeonMap(PlayState* play) {
@ -2461,13 +2466,15 @@ void KaleidoScope_UpdateDungeonMap(PlayState* play) {
if ((play->sceneId >= SCENE_YDAN) && (play->sceneId <= SCENE_TAKARAYA)) {
if ((VREG(30) + 3) == pauseCtx->cursorPoint[PAUSE_MAP]) {
KaleidoScope_OverridePalIndexCI4(interfaceCtx->mapSegment, 2040, interfaceCtx->mapPaletteIndex, 14);
KaleidoScope_OverridePalIndexCI4(interfaceCtx->mapSegment, MAP_48x85_TEX_SIZE,
interfaceCtx->mapPaletteIndex, 14);
}
}
if ((play->sceneId >= SCENE_YDAN) && (play->sceneId <= SCENE_TAKARAYA)) {
if ((VREG(30) + 3) == pauseCtx->cursorPoint[PAUSE_MAP]) {
KaleidoScope_OverridePalIndexCI4(interfaceCtx->mapSegment + 0x800, 2040, interfaceCtx->mapPaletteIndex, 14);
KaleidoScope_OverridePalIndexCI4(interfaceCtx->mapSegment + ALIGN16(MAP_48x85_TEX_SIZE), MAP_48x85_TEX_SIZE,
interfaceCtx->mapPaletteIndex, 14);
}
}
}
@ -2536,8 +2543,8 @@ void KaleidoScope_Update(PlayState* play) {
size0 = (uintptr_t)_icon_item_staticSegmentRomEnd - (uintptr_t)_icon_item_staticSegmentRomStart;
osSyncPrintf("icon_item size0=%x\n", size0);
DmaMgr_SendRequest1(pauseCtx->iconItemSegment, (uintptr_t)_icon_item_staticSegmentRomStart, size0,
"../z_kaleido_scope_PAL.c", 3662);
DmaMgr_RequestSyncDebug(pauseCtx->iconItemSegment, (uintptr_t)_icon_item_staticSegmentRomStart, size0,
"../z_kaleido_scope_PAL.c", 3662);
gSegments[8] = VIRTUAL_TO_PHYSICAL(pauseCtx->iconItemSegment);
@ -2551,8 +2558,8 @@ void KaleidoScope_Update(PlayState* play) {
size = (uintptr_t)_icon_item_24_staticSegmentRomEnd - (uintptr_t)_icon_item_24_staticSegmentRomStart;
osSyncPrintf("icon_item24 size=%x\n", size);
DmaMgr_SendRequest1(pauseCtx->iconItem24Segment, (uintptr_t)_icon_item_24_staticSegmentRomStart, size,
"../z_kaleido_scope_PAL.c", 3675);
DmaMgr_RequestSyncDebug(pauseCtx->iconItem24Segment, (uintptr_t)_icon_item_24_staticSegmentRomStart, size,
"../z_kaleido_scope_PAL.c", 3675);
pauseCtx->iconItemAltSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItem24Segment + size);
@ -2579,9 +2586,9 @@ void KaleidoScope_Update(PlayState* play) {
size2 = (uintptr_t)_icon_item_dungeon_staticSegmentRomEnd -
(uintptr_t)_icon_item_dungeon_staticSegmentRomStart;
osSyncPrintf("icon_item_dungeon dungeon-size2=%x\n", size2);
DmaMgr_SendRequest1(pauseCtx->iconItemAltSegment,
(uintptr_t)_icon_item_dungeon_staticSegmentRomStart, size2,
"../z_kaleido_scope_PAL.c", 3712);
DmaMgr_RequestSyncDebug(pauseCtx->iconItemAltSegment,
(uintptr_t)_icon_item_dungeon_staticSegmentRomStart, size2,
"../z_kaleido_scope_PAL.c", 3712);
interfaceCtx->mapPalette[28] = 6;
interfaceCtx->mapPalette[29] = 99;
@ -2593,8 +2600,9 @@ void KaleidoScope_Update(PlayState* play) {
size2 = (uintptr_t)_icon_item_field_staticSegmentRomEnd -
(uintptr_t)_icon_item_field_staticSegmentRomStart;
osSyncPrintf("icon_item_field field-size2=%x\n", size2);
DmaMgr_SendRequest1(pauseCtx->iconItemAltSegment, (uintptr_t)_icon_item_field_staticSegmentRomStart,
size2, "../z_kaleido_scope_PAL.c", 3726);
DmaMgr_RequestSyncDebug(pauseCtx->iconItemAltSegment,
(uintptr_t)_icon_item_field_staticSegmentRomStart, size2,
"../z_kaleido_scope_PAL.c", 3726);
break;
}
@ -2603,18 +2611,18 @@ void KaleidoScope_Update(PlayState* play) {
if (gSaveContext.language == LANGUAGE_ENG) {
size = (uintptr_t)_icon_item_nes_staticSegmentRomEnd - (uintptr_t)_icon_item_nes_staticSegmentRomStart;
osSyncPrintf("icon_item_dungeon dungeon-size=%x\n", size);
DmaMgr_SendRequest1(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_nes_staticSegmentRomStart,
size, "../z_kaleido_scope_PAL.c", 3739);
DmaMgr_RequestSyncDebug(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_nes_staticSegmentRomStart,
size, "../z_kaleido_scope_PAL.c", 3739);
} else if (gSaveContext.language == LANGUAGE_GER) {
size = (uintptr_t)_icon_item_ger_staticSegmentRomEnd - (uintptr_t)_icon_item_ger_staticSegmentRomStart;
osSyncPrintf("icon_item_dungeon dungeon-size=%x\n", size);
DmaMgr_SendRequest1(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_ger_staticSegmentRomStart,
size, "../z_kaleido_scope_PAL.c", 3746);
DmaMgr_RequestSyncDebug(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_ger_staticSegmentRomStart,
size, "../z_kaleido_scope_PAL.c", 3746);
} else {
size = (uintptr_t)_icon_item_fra_staticSegmentRomEnd - (uintptr_t)_icon_item_fra_staticSegmentRomStart;
osSyncPrintf("icon_item_dungeon dungeon-size=%x\n", size);
DmaMgr_SendRequest1(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_fra_staticSegmentRomStart,
size, "../z_kaleido_scope_PAL.c", 3753);
DmaMgr_RequestSyncDebug(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_fra_staticSegmentRomStart,
size, "../z_kaleido_scope_PAL.c", 3753);
}
pauseCtx->nameSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemLangSegment + size);
@ -2626,24 +2634,28 @@ void KaleidoScope_Update(PlayState* play) {
if (((void)0, gSaveContext.worldMapArea) < 22) {
if (gSaveContext.language == LANGUAGE_ENG) {
DmaMgr_SendRequest1(pauseCtx->nameSegment + 0x400,
(uintptr_t)_map_name_staticSegmentRomStart +
(((void)0, gSaveContext.worldMapArea) * 0xA00) + 0x9000,
0xA00, "../z_kaleido_scope_PAL.c", 3776);
DmaMgr_RequestSyncDebug(pauseCtx->nameSegment + MAX(MAP_NAME_TEX1_SIZE, ITEM_NAME_TEX_SIZE),
(uintptr_t)_map_name_staticSegmentRomStart +
(((void)0, gSaveContext.worldMapArea) * MAP_NAME_TEX2_SIZE) +
36 * MAP_NAME_TEX1_SIZE + 22 * LANGUAGE_ENG * MAP_NAME_TEX2_SIZE,
MAP_NAME_TEX2_SIZE, "../z_kaleido_scope_PAL.c", 3776);
} else if (gSaveContext.language == LANGUAGE_GER) {
DmaMgr_SendRequest1(pauseCtx->nameSegment + 0x400,
(uintptr_t)_map_name_staticSegmentRomStart +
(((void)0, gSaveContext.worldMapArea) * 0xA00) + 0x16C00,
0xA00, "../z_kaleido_scope_PAL.c", 3780);
DmaMgr_RequestSyncDebug(pauseCtx->nameSegment + MAX(MAP_NAME_TEX1_SIZE, ITEM_NAME_TEX_SIZE),
(uintptr_t)_map_name_staticSegmentRomStart +
(((void)0, gSaveContext.worldMapArea) * MAP_NAME_TEX2_SIZE) +
36 * MAP_NAME_TEX1_SIZE + 22 * LANGUAGE_GER * MAP_NAME_TEX2_SIZE,
MAP_NAME_TEX2_SIZE, "../z_kaleido_scope_PAL.c", 3780);
} else {
DmaMgr_SendRequest1(pauseCtx->nameSegment + 0x400,
(uintptr_t)_map_name_staticSegmentRomStart +
(((void)0, gSaveContext.worldMapArea) * 0xA00) + 0x24800,
0xA00, "../z_kaleido_scope_PAL.c", 3784);
DmaMgr_RequestSyncDebug(pauseCtx->nameSegment + MAX(MAP_NAME_TEX1_SIZE, ITEM_NAME_TEX_SIZE),
(uintptr_t)_map_name_staticSegmentRomStart +
(((void)0, gSaveContext.worldMapArea) * MAP_NAME_TEX2_SIZE) +
36 * MAP_NAME_TEX1_SIZE + 22 * LANGUAGE_FRA * MAP_NAME_TEX2_SIZE,
MAP_NAME_TEX2_SIZE, "../z_kaleido_scope_PAL.c", 3784);
}
}
sPreRenderCvg = (void*)ALIGN16((uintptr_t)pauseCtx->nameSegment + 0x400 + 0xA00);
sPreRenderCvg = (void*)ALIGN16((uintptr_t)pauseCtx->nameSegment +
MAX(MAP_NAME_TEX1_SIZE, ITEM_NAME_TEX_SIZE) + MAP_NAME_TEX2_SIZE);
PreRender_Init(&sPlayerPreRender);
PreRender_SetValuesSave(&sPlayerPreRender, PAUSE_EQUIP_PLAYER_WIDTH, PAUSE_EQUIP_PLAYER_HEIGHT,
@ -3150,39 +3162,39 @@ void KaleidoScope_Update(PlayState* play) {
pauseCtx->iconItemSegment = (void*)(((uintptr_t)play->objectCtx.spaceStart + 0x30) & ~0x3F);
size0 = (uintptr_t)_icon_item_staticSegmentRomEnd - (uintptr_t)_icon_item_staticSegmentRomStart;
osSyncPrintf("icon_item size0=%x\n", size0);
DmaMgr_SendRequest1(pauseCtx->iconItemSegment, (uintptr_t)_icon_item_staticSegmentRomStart, size0,
"../z_kaleido_scope_PAL.c", 4356);
DmaMgr_RequestSyncDebug(pauseCtx->iconItemSegment, (uintptr_t)_icon_item_staticSegmentRomStart, size0,
"../z_kaleido_scope_PAL.c", 4356);
pauseCtx->iconItem24Segment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemSegment + size0);
size = (uintptr_t)_icon_item_24_staticSegmentRomEnd - (uintptr_t)_icon_item_24_staticSegmentRomStart;
osSyncPrintf("icon_item24 size=%x\n", size);
DmaMgr_SendRequest1(pauseCtx->iconItem24Segment, (uintptr_t)_icon_item_24_staticSegmentRomStart, size,
"../z_kaleido_scope_PAL.c", 4363);
DmaMgr_RequestSyncDebug(pauseCtx->iconItem24Segment, (uintptr_t)_icon_item_24_staticSegmentRomStart, size,
"../z_kaleido_scope_PAL.c", 4363);
pauseCtx->iconItemAltSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItem24Segment + size);
size2 = (uintptr_t)_icon_item_gameover_staticSegmentRomEnd -
(uintptr_t)_icon_item_gameover_staticSegmentRomStart;
osSyncPrintf("icon_item_dungeon gameover-size2=%x\n", size2);
DmaMgr_SendRequest1(pauseCtx->iconItemAltSegment, (uintptr_t)_icon_item_gameover_staticSegmentRomStart,
size2, "../z_kaleido_scope_PAL.c", 4370);
DmaMgr_RequestSyncDebug(pauseCtx->iconItemAltSegment, (uintptr_t)_icon_item_gameover_staticSegmentRomStart,
size2, "../z_kaleido_scope_PAL.c", 4370);
pauseCtx->iconItemLangSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemAltSegment + size2);
if (gSaveContext.language == LANGUAGE_ENG) {
size = (uintptr_t)_icon_item_nes_staticSegmentRomEnd - (uintptr_t)_icon_item_nes_staticSegmentRomStart;
osSyncPrintf("icon_item_dungeon dungeon-size=%x\n", size);
DmaMgr_SendRequest1(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_nes_staticSegmentRomStart,
size, "../z_kaleido_scope_PAL.c", 4379);
DmaMgr_RequestSyncDebug(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_nes_staticSegmentRomStart,
size, "../z_kaleido_scope_PAL.c", 4379);
} else if (gSaveContext.language == LANGUAGE_GER) {
size = (uintptr_t)_icon_item_ger_staticSegmentRomEnd - (uintptr_t)_icon_item_ger_staticSegmentRomStart;
osSyncPrintf("icon_item_dungeon dungeon-size=%x\n", size);
DmaMgr_SendRequest1(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_ger_staticSegmentRomStart,
size, "../z_kaleido_scope_PAL.c", 4386);
DmaMgr_RequestSyncDebug(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_ger_staticSegmentRomStart,
size, "../z_kaleido_scope_PAL.c", 4386);
} else {
size = (uintptr_t)_icon_item_fra_staticSegmentRomEnd - (uintptr_t)_icon_item_fra_staticSegmentRomStart;
osSyncPrintf("icon_item_dungeon dungeon-size=%x\n", size);
DmaMgr_SendRequest1(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_fra_staticSegmentRomStart,
size, "../z_kaleido_scope_PAL.c", 4393);
DmaMgr_RequestSyncDebug(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_fra_staticSegmentRomStart,
size, "../z_kaleido_scope_PAL.c", 4393);
}
D_8082AB8C = 255;