diff options
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/z_actor_dlftbls.c | 8 | ||||
| -rw-r--r-- | src/code/z_kanfont.c | 8 | ||||
| -rw-r--r-- | src/code/z_scene.c | 20 | ||||
| -rw-r--r-- | src/code/z_scene_table.c | 2 | ||||
| -rw-r--r-- | src/code/z_vr_box.c | 32 |
5 files changed, 36 insertions, 34 deletions
diff --git a/src/code/z_actor_dlftbls.c b/src/code/z_actor_dlftbls.c index 63dcc9c58..4165e4c9b 100644 --- a/src/code/z_actor_dlftbls.c +++ b/src/code/z_actor_dlftbls.c @@ -1,10 +1,10 @@ #include "global.h" #include "initvars.h" -#define ACTOR_OVERLAY(name, allocType) \ - { \ - (u32) _ovl_##name##SegmentRomStart, (u32)_ovl_##name##SegmentRomEnd, _ovl_##name##SegmentStart, \ - _ovl_##name##SegmentEnd, NULL, &name##_InitVars, NULL, allocType, 0 \ +#define ACTOR_OVERLAY(name, allocType) \ + { \ + SEGMENT_ROM_START(ovl_##name), SEGMENT_ROM_END(ovl_##name), SEGMENT_START(ovl_##name), \ + SEGMENT_END(ovl_##name), NULL, &name##_InitVars, NULL, allocType, 0 \ } #define ACTOR_OVERLAY_INTERNAL(name, allocType) \ diff --git a/src/code/z_kanfont.c b/src/code/z_kanfont.c index f85911fc6..b678642b1 100644 --- a/src/code/z_kanfont.c +++ b/src/code/z_kanfont.c @@ -9,12 +9,13 @@ void Font_LoadCharNES(GlobalContext* globalCtx, u8 codePointIndex, s32 offset) { Font* font = &msgCtx->font; DmaMgr_SendRequest0(&font->charBuf[font->unk_11D88][offset], - &_nes_font_staticSegmentRomStart[(codePointIndex - ' ') * FONT_CHAR_TEX_SIZE], + &((u8*)SEGMENT_ROM_START(nes_font_static))[(codePointIndex - ' ') * FONT_CHAR_TEX_SIZE], FONT_CHAR_TEX_SIZE); } void Font_LoadMessageBoxEndIcon(Font* font, u16 icon) { - DmaMgr_SendRequest0(&font->iconBuf, &_message_staticSegmentRomStart[5 * 0x1000 + icon * FONT_CHAR_TEX_SIZE], + DmaMgr_SendRequest0(&font->iconBuf, + &((u8*)SEGMENT_ROM_START(message_static))[5 * 0x1000 + icon * FONT_CHAR_TEX_SIZE], FONT_CHAR_TEX_SIZE); } @@ -36,7 +37,8 @@ void Font_LoadOrderedFont(Font* font) { loadOffset = 0; } // UB to convert pointer to u32 - DmaMgr_SendRequest0(writeLocation, (u32)_nes_font_staticSegmentRomStart + loadOffset, FONT_CHAR_TEX_SIZE); + DmaMgr_SendRequest0(writeLocation, (uintptr_t)SEGMENT_ROM_START(nes_font_static) + loadOffset, + FONT_CHAR_TEX_SIZE); if (sFontOrdering[codePointIndex] == 0x8C) { break; } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index efaadf4bf..e77144528 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -221,8 +221,8 @@ void Scene_HeaderCmdEntranceList(GlobalContext* globalCtx, SceneCmd* cmd) { // SceneTableEntry Header Command 0x07: Special Files void Scene_HeaderCmdSpecialFiles(GlobalContext* globalCtx, SceneCmd* cmd) { static RomFile tatlMessageFiles[2] = { - { (u32)_elf_message_fieldSegmentRomStart, (u32)_elf_message_fieldSegmentRomEnd }, - { (u32)_elf_message_ydanSegmentRomStart, (u32)_elf_message_ydanSegmentRomEnd }, + { SEGMENT_ROM_START(elf_message_field), SEGMENT_ROM_END(elf_message_field) }, + { SEGMENT_ROM_START(elf_message_ydan), SEGMENT_ROM_END(elf_message_ydan) }, }; if (cmd->specialFiles.subKeepIndex != 0) { @@ -344,14 +344,14 @@ void Scene_HeaderCmdEnvLightSettings(GlobalContext* globalCtx, SceneCmd* cmd) { s32 Scene_LoadAreaTextures(GlobalContext* globalCtx, s32 fileIndex) { static RomFile sceneTextureFiles[9] = { { 0, 0 }, // Default - { (u32)_scene_texture_01SegmentRomStart, (u32)_scene_texture_01SegmentRomEnd }, - { (u32)_scene_texture_02SegmentRomStart, (u32)_scene_texture_02SegmentRomEnd }, - { (u32)_scene_texture_03SegmentRomStart, (u32)_scene_texture_03SegmentRomEnd }, - { (u32)_scene_texture_04SegmentRomStart, (u32)_scene_texture_04SegmentRomEnd }, - { (u32)_scene_texture_05SegmentRomStart, (u32)_scene_texture_05SegmentRomEnd }, - { (u32)_scene_texture_06SegmentRomStart, (u32)_scene_texture_06SegmentRomEnd }, - { (u32)_scene_texture_07SegmentRomStart, (u32)_scene_texture_07SegmentRomEnd }, - { (u32)_scene_texture_08SegmentRomStart, (u32)_scene_texture_08SegmentRomEnd }, + { SEGMENT_ROM_START(scene_texture_01), SEGMENT_ROM_END(scene_texture_01) }, + { SEGMENT_ROM_START(scene_texture_02), SEGMENT_ROM_END(scene_texture_02) }, + { SEGMENT_ROM_START(scene_texture_03), SEGMENT_ROM_END(scene_texture_03) }, + { SEGMENT_ROM_START(scene_texture_04), SEGMENT_ROM_END(scene_texture_04) }, + { SEGMENT_ROM_START(scene_texture_05), SEGMENT_ROM_END(scene_texture_05) }, + { SEGMENT_ROM_START(scene_texture_06), SEGMENT_ROM_END(scene_texture_06) }, + { SEGMENT_ROM_START(scene_texture_07), SEGMENT_ROM_END(scene_texture_07) }, + { SEGMENT_ROM_START(scene_texture_08), SEGMENT_ROM_END(scene_texture_08) }, }; u32 vromStart = sceneTextureFiles[fileIndex].vromStart; u32 size = sceneTextureFiles[fileIndex].vromEnd - vromStart; diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index cee8546f0..8372c350a 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -1,7 +1,7 @@ #include "global.h" #define SCENE_ENTRY(name, textId, config) \ - { { (u32)_##name##SegmentRomStart, (u32)_##name##SegmentRomEnd }, textId, 0, config, 0 } + { { SEGMENT_ROM_START(name), SEGMENT_ROM_END(name) }, textId, 0, config, 0 } #define SCENE_ENTRY_NONE() \ { { 0, 0 }, 0, 0, 0, 0 } diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c index 5c00758d2..1fca4801d 100644 --- a/src/code/z_vr_box.c +++ b/src/code/z_vr_box.c @@ -50,21 +50,21 @@ void func_801431E8(GameState* gamestate, SkyboxContext* skyboxCtx, s16 skyType) } else { // Send a DMA request for the cloudy sky texture skyboxCtx->skyboxStaticSegment[0] = &D_80025D00; - size = (u32)_d2_cloud_staticSegmentRomEnd - (u32)_d2_cloud_staticSegmentRomStart; + size = SEGMENT_ROM_SIZE(d2_cloud_static); offset = (void*)ALIGN8((u32)skyboxCtx->skyboxStaticSegment[0] + size); - DmaMgr_SendRequest0(skyboxCtx->skyboxStaticSegment[0], (u32)_d2_cloud_staticSegmentRomStart, size); + DmaMgr_SendRequest0(skyboxCtx->skyboxStaticSegment[0], SEGMENT_ROM_START(d2_cloud_static), size); // Send a DMA request for the clear sky texture skyboxCtx->skyboxStaticSegment[1] = offset; - size = (u32)_d2_fine_staticSegmentRomEnd - (u32)_d2_fine_staticSegmentRomStart; + size = SEGMENT_ROM_SIZE(d2_fine_static); offset = (void*)ALIGN8((u32)offset + size); - DmaMgr_SendRequest0(skyboxCtx->skyboxStaticSegment[1], (u32)_d2_fine_staticSegmentRomStart, size); + DmaMgr_SendRequest0(skyboxCtx->skyboxStaticSegment[1], SEGMENT_ROM_START(d2_fine_static), size); // Send a DMA request for the skybox palette skyboxCtx->skyboxPaletteStaticSegment = offset; - size = (u32)_d2_fine_pal_staticSegmentRomEnd - (u32)_d2_fine_pal_staticSegmentRomStart; + size = SEGMENT_ROM_SIZE(d2_fine_pal_static); offset = (void*)ALIGN8((u32)offset + size); - DmaMgr_SendRequest0(skyboxCtx->skyboxPaletteStaticSegment, (u32)_d2_fine_pal_staticSegmentRomStart, size); + DmaMgr_SendRequest0(skyboxCtx->skyboxPaletteStaticSegment, SEGMENT_ROM_START(d2_fine_pal_static), size); skyboxCtx->primR = 145; skyboxCtx->primG = 120; @@ -91,16 +91,16 @@ void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyTy if (globalCtx->envCtx.unk_10 == 0) { // Send a DMA request for the clear sky texture - size = (u32)_d2_fine_staticSegmentRomEnd - (u32)_d2_fine_staticSegmentRomStart; + size = SEGMENT_ROM_SIZE(d2_fine_static); DmaMgr_SendRequestImpl(&skyboxCtx->unk188, skyboxCtx->skyboxStaticSegment[0], - (u32)_d2_fine_staticSegmentRomStart, size, 0, &skyboxCtx->loadQueue, NULL); + SEGMENT_ROM_START(d2_fine_static), size, 0, &skyboxCtx->loadQueue, NULL); } else { // Send a DMA request for the cloudy sky texture - size = (u32)_d2_cloud_staticSegmentRomEnd - (u32)_d2_cloud_staticSegmentRomStart; + size = SEGMENT_ROM_SIZE(d2_cloud_static); DmaMgr_SendRequestImpl(&skyboxCtx->unk188, skyboxCtx->skyboxStaticSegment[0], - (u32)_d2_cloud_staticSegmentRomStart, size, 0, &skyboxCtx->loadQueue, NULL); + SEGMENT_ROM_START(d2_cloud_static), size, 0, &skyboxCtx->loadQueue, NULL); } osRecvMesg(&skyboxCtx->loadQueue, NULL, 1); @@ -108,26 +108,26 @@ void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyTy if (globalCtx->envCtx.unk_11 == 0) { // Send a DMA request for the clear sky texture - size = (u32)_d2_fine_staticSegmentRomEnd - (u32)_d2_fine_staticSegmentRomStart; + size = SEGMENT_ROM_SIZE(d2_fine_static); DmaMgr_SendRequestImpl(&skyboxCtx->unk1A8, skyboxCtx->skyboxStaticSegment[1], - (u32)_d2_fine_staticSegmentRomStart, size, 0, &skyboxCtx->loadQueue, NULL); + SEGMENT_ROM_START(d2_fine_static), size, 0, &skyboxCtx->loadQueue, NULL); } else { // Send a DMA request for the cloudy sky texture - size = (u32)_d2_cloud_staticSegmentRomEnd - (u32)_d2_cloud_staticSegmentRomStart; + size = SEGMENT_ROM_SIZE(d2_cloud_static); DmaMgr_SendRequestImpl(&skyboxCtx->unk1A8, skyboxCtx->skyboxStaticSegment[1], - (u32)_d2_cloud_staticSegmentRomStart, size, 0, &skyboxCtx->loadQueue, NULL); + SEGMENT_ROM_START(d2_cloud_static), size, 0, &skyboxCtx->loadQueue, NULL); } osRecvMesg(&skyboxCtx->loadQueue, NULL, 1); osCreateMesgQueue(&skyboxCtx->loadQueue, &skyboxCtx->loadMsg, 1); - size = (u32)_d2_fine_pal_staticSegmentRomEnd - (u32)_d2_fine_pal_staticSegmentRomStart; + size = SEGMENT_ROM_SIZE(d2_fine_pal_static); // Send a DMA request for the skybox palette DmaMgr_SendRequestImpl(&skyboxCtx->unk1C8, skyboxCtx->skyboxPaletteStaticSegment, - (u32)_d2_fine_pal_staticSegmentRomStart, size, 0, &skyboxCtx->loadQueue, NULL); + SEGMENT_ROM_START(d2_fine_pal_static), size, 0, &skyboxCtx->loadQueue, NULL); osRecvMesg(&skyboxCtx->loadQueue, NULL, 1); } |
