mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
DMA_COPY_SEGMENT macro for straightforward DMAs of segments (#1096)
* DMA_SEGMENT macro for straightforward DMAs of segments * PRomment
This commit is contained in:
parent
01d88aa9ee
commit
9f00021dbe
@ -330,4 +330,6 @@
|
||||
#define DT (1.0f)
|
||||
#endif
|
||||
|
||||
#define DMA_COPY_SEGMENT(segment) dma_copy(segment##_ROM_START, segment##_ROM_END, segment##_VRAM)
|
||||
|
||||
#endif
|
||||
|
@ -1536,7 +1536,7 @@ void btl_state_update_prepare_menu(void) {
|
||||
battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_STAR_POWER] = -1;
|
||||
battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_STRATEGY] = -1;
|
||||
|
||||
dma_copy(_415D90_ROM_START, _415D90_ROM_END, _415D90_VRAM);
|
||||
DMA_COPY_SEGMENT(_415D90);
|
||||
|
||||
if (battleStatus->flags1 & BS_FLAGS1_PARTNER_ACTING) {
|
||||
btl_set_state(BATTLE_STATE_PARTNER_MENU);
|
||||
|
@ -529,7 +529,7 @@ void btl_state_update_celebration(void) {
|
||||
if (CelebrateSubstateTime != 0) {
|
||||
CelebrateSubstateTime--;
|
||||
} else if (btl_cam_is_moving_done()) {
|
||||
dma_copy(starpoint_ROM_START, starpoint_ROM_END, starpoint_VRAM);
|
||||
DMA_COPY_SEGMENT(starpoint);
|
||||
script = start_script(&EVS_ShowStarpoints, EVT_PRIORITY_A, 0);
|
||||
EndBattleRewardsDone = FALSE;
|
||||
// divide reward into 20 increments
|
||||
@ -614,7 +614,7 @@ void btl_state_update_celebration(void) {
|
||||
playerData->level++;
|
||||
btl_cam_use_preset(BTL_CAM_DEFAULT);
|
||||
btl_cam_move(5);
|
||||
dma_copy(level_up_ROM_START, level_up_ROM_END, level_up_VRAM);
|
||||
DMA_COPY_SEGMENT(level_up);
|
||||
sfx_play_sound(SOUND_80000008);
|
||||
CelebrateStateTime = 0;
|
||||
gBattleSubState = BTL_SUBSTATE_CELEBRATE_LEVEL_UP_BEGIN;
|
||||
|
24
src/77480.c
24
src/77480.c
@ -6,15 +6,15 @@
|
||||
#include "sprite/player.h"
|
||||
|
||||
#ifdef SHIFT
|
||||
#define inspect_icon_VRAM_DEF inspect_icon_VRAM
|
||||
#define speech_bubble_VRAM_DEF speech_bubble_VRAM
|
||||
#define pulse_stone_VRAM_DEF pulse_stone_VRAM
|
||||
#define i_spy_VRAM_DEF i_spy_VRAM
|
||||
#define inspect_icon_VRAM inspect_icon_VRAM
|
||||
#define speech_bubble_VRAM speech_bubble_VRAM
|
||||
#define pulse_stone_VRAM pulse_stone_VRAM
|
||||
#define i_spy_VRAM i_spy_VRAM
|
||||
#else
|
||||
#define inspect_icon_VRAM_DEF (void*)0x802B7000
|
||||
#define speech_bubble_VRAM_DEF (void*)0x802B7000
|
||||
#define pulse_stone_VRAM_DEF (void*)0x802B7000
|
||||
#define i_spy_VRAM_DEF (void*)0x802B7000
|
||||
#define inspect_icon_VRAM (void*)0x802B7000
|
||||
#define speech_bubble_VRAM (void*)0x802B7000
|
||||
#define pulse_stone_VRAM (void*)0x802B7000
|
||||
#define i_spy_VRAM (void*)0x802B7000
|
||||
#endif
|
||||
|
||||
SHIFT_BSS UNK_FUN_PTR(ISpyNotificationCallback);
|
||||
@ -1005,7 +1005,7 @@ void check_for_ispy(void) {
|
||||
if (gCurrentHiddenPanels.activateISpy && ISpyNotificationCallback == NULL) {
|
||||
if (!(playerStatus->animFlags &
|
||||
(PA_FLAG_SPEECH_PROMPT_AVAILABLE | PA_FLAG_INTERACT_PROMPT_AVAILABLE))) {
|
||||
dma_copy(i_spy_ROM_START, i_spy_ROM_END, i_spy_VRAM_DEF);
|
||||
DMA_COPY_SEGMENT(i_spy);
|
||||
ISpyNotificationCallback = ispy_notification_setup;
|
||||
}
|
||||
}
|
||||
@ -1054,7 +1054,7 @@ void check_for_pulse_stone(void) {
|
||||
}
|
||||
|
||||
if (!(gPlayerStatus.animFlags & (PA_FLAG_SPEECH_PROMPT_AVAILABLE | PA_FLAG_INTERACT_PROMPT_AVAILABLE))) {
|
||||
dma_copy(pulse_stone_ROM_START, pulse_stone_ROM_END, pulse_stone_VRAM_DEF);
|
||||
DMA_COPY_SEGMENT(pulse_stone);
|
||||
PulseStoneNotificationCallback = pulse_stone_notification_setup;
|
||||
}
|
||||
}
|
||||
@ -1100,7 +1100,7 @@ void check_for_conversation_prompt(void) {
|
||||
|
||||
if (has_valid_conversation_npc()) {
|
||||
TalkNotificationCallback = NULL;
|
||||
dma_copy(speech_bubble_ROM_START, speech_bubble_ROM_END, speech_bubble_VRAM_DEF);
|
||||
DMA_COPY_SEGMENT(speech_bubble);
|
||||
TalkNotificationCallback = interact_speech_setup;
|
||||
} else {
|
||||
TalkNotificationCallback = NULL;
|
||||
@ -1274,7 +1274,7 @@ void check_for_interactables(void) {
|
||||
}
|
||||
|
||||
if (InteractNotificationCallback == NULL) {
|
||||
dma_copy(inspect_icon_ROM_START, inspect_icon_ROM_END, inspect_icon_VRAM_DEF);
|
||||
DMA_COPY_SEGMENT(inspect_icon);
|
||||
InteractNotificationCallback = interact_inspect_setup;
|
||||
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ void clear_effect_data(void) {
|
||||
|
||||
osUnmapTLBAll();
|
||||
osMapTLB(0x10, NULL, _325AD0_VRAM, (s32)&D_801A6000 & 0xFFFFFF, -1, -1);
|
||||
dma_copy(_325AD0_ROM_START, _325AD0_ROM_END, _325AD0_VRAM);
|
||||
DMA_COPY_SEGMENT(_325AD0);
|
||||
}
|
||||
|
||||
void func_80059D48(void) {
|
||||
|
16
src/entity.c
16
src/entity.c
@ -18,13 +18,15 @@ extern Addr WorldEntityHeapBottom;
|
||||
extern Addr WorldEntityHeapBase;
|
||||
#define WORLD_ENTITY_HEAP_BOTTOM (s32) WorldEntityHeapBottom
|
||||
#define WORLD_ENTITY_HEAP_BASE (s32) WorldEntityHeapBase
|
||||
// TODO this only refers to one of 3 overlays which happen to share the same address space
|
||||
// but don't necessarily have to
|
||||
#define AREA_SPECIFIC_ENTITY_VRAM (s32) entity_default_VRAM
|
||||
#define entity_jan_iwa_VRAM (s32) entity_jan_iwa_VRAM
|
||||
#define entity_sbk_omo_VRAM (s32) entity_sbk_omo_VRAM
|
||||
#define entity_default_VRAM (s32) entity_default_VRAM
|
||||
#else
|
||||
#define WORLD_ENTITY_HEAP_BOTTOM 0x80250000
|
||||
#define WORLD_ENTITY_HEAP_BASE 0x80267FF0
|
||||
#define AREA_SPECIFIC_ENTITY_VRAM 0x802BAE00
|
||||
#define entity_jan_iwa_VRAM (void*) 0x802BAE00
|
||||
#define entity_sbk_omo_VRAM (void*) 0x802BAE00
|
||||
#define entity_default_VRAM (void*) 0x802BAE00
|
||||
#endif
|
||||
|
||||
s32 D_8014AFB0 = 255;
|
||||
@ -771,11 +773,11 @@ void entity_reset_collision(Entity* entity) {
|
||||
void load_area_specific_entity_data(void) {
|
||||
if (!isAreaSpecificEntityDataLoaded) {
|
||||
if (gGameStatusPtr->areaID == AREA_JAN || gGameStatusPtr->areaID == AREA_IWA) {
|
||||
dma_copy(entity_jan_iwa_ROM_START, entity_jan_iwa_ROM_END, (void*)AREA_SPECIFIC_ENTITY_VRAM);
|
||||
DMA_COPY_SEGMENT(entity_jan_iwa);
|
||||
} else if (gGameStatusPtr->areaID == AREA_SBK || gGameStatusPtr->areaID == AREA_OMO) {
|
||||
dma_copy(entity_sbk_omo_ROM_START, entity_sbk_omo_ROM_END, (void*)AREA_SPECIFIC_ENTITY_VRAM);
|
||||
DMA_COPY_SEGMENT(entity_sbk_omo);
|
||||
} else {
|
||||
dma_copy(entity_default_ROM_START, entity_default_ROM_END, (void*)AREA_SPECIFIC_ENTITY_VRAM);
|
||||
DMA_COPY_SEGMENT(entity_default);
|
||||
}
|
||||
|
||||
isAreaSpecificEntityDataLoaded = TRUE;
|
||||
|
@ -1020,7 +1020,7 @@ void filemenu_init(s32 arg0) {
|
||||
MenuPanel* menu;
|
||||
s32 i;
|
||||
|
||||
dma_copy(ui_images_ROM_START, ui_images_ROM_END, ui_images_VRAM);
|
||||
DMA_COPY_SEGMENT(ui_images);
|
||||
for (i = 0; i < ARRAY_COUNT(filemenu_cursorHudElemID); i++) {
|
||||
filemenu_cursorHudElemID[i] = hud_element_create(filemenu_cursor_hudElemScripts[i]);
|
||||
hud_element_set_flags(filemenu_cursorHudElemID[i], HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80);
|
||||
|
@ -249,12 +249,12 @@ void gfx_draw_frame(void) {
|
||||
void load_engine_data(void) {
|
||||
s32 i;
|
||||
|
||||
dma_copy(engine4_ROM_START, engine4_ROM_END, engine4_VRAM);
|
||||
dma_copy(engine1_ROM_START, engine1_ROM_END, engine1_VRAM);
|
||||
dma_copy(evt_ROM_START, evt_ROM_END, evt_VRAM);
|
||||
dma_copy(entity_ROM_START, entity_ROM_END, entity_VRAM);
|
||||
dma_copy(engine2_ROM_START, engine2_ROM_END, engine2_VRAM);
|
||||
dma_copy(font_width_ROM_START, font_width_ROM_END, font_width_VRAM);
|
||||
DMA_COPY_SEGMENT(engine4);
|
||||
DMA_COPY_SEGMENT(engine1);
|
||||
DMA_COPY_SEGMENT(evt);
|
||||
DMA_COPY_SEGMENT(entity);
|
||||
DMA_COPY_SEGMENT(engine2);
|
||||
DMA_COPY_SEGMENT(font_width);
|
||||
|
||||
gOverrideFlags = 0;
|
||||
gGameStatusPtr->unk_79 = 0;
|
||||
|
@ -7,37 +7,21 @@ void general_heap_create_obfuscated(void);
|
||||
void battle_heap_create_obfuscated(void);
|
||||
|
||||
void shim_create_audio_system_obfuscated(void) {
|
||||
dma_copy(
|
||||
create_audio_system_obfuscated_ROM_START,
|
||||
create_audio_system_obfuscated_ROM_END,
|
||||
create_audio_system_obfuscated_VRAM
|
||||
);
|
||||
DMA_COPY_SEGMENT(create_audio_system_obfuscated);
|
||||
create_audio_system_obfuscated();
|
||||
}
|
||||
|
||||
void shim_load_engine_data_obfuscated(void) {
|
||||
dma_copy(
|
||||
load_engine_data_obfuscated_ROM_START,
|
||||
load_engine_data_obfuscated_ROM_END,
|
||||
load_engine_data_obfuscated_VRAM
|
||||
);
|
||||
DMA_COPY_SEGMENT(load_engine_data_obfuscated);
|
||||
load_engine_data_obfuscated();
|
||||
}
|
||||
|
||||
void shim_general_heap_create_obfuscated(void) {
|
||||
dma_copy(
|
||||
general_heap_create_obfuscated_ROM_START,
|
||||
general_heap_create_obfuscated_ROM_END,
|
||||
general_heap_create_obfuscated_VRAM
|
||||
);
|
||||
DMA_COPY_SEGMENT(general_heap_create_obfuscated);
|
||||
general_heap_create_obfuscated();
|
||||
}
|
||||
|
||||
void shim_battle_heap_create_obfuscated(void) {
|
||||
dma_copy(
|
||||
battle_heap_create_obfuscated_ROM_START,
|
||||
battle_heap_create_obfuscated_ROM_END,
|
||||
battle_heap_create_obfuscated_VRAM
|
||||
);
|
||||
DMA_COPY_SEGMENT(battle_heap_create_obfuscated);
|
||||
battle_heap_create_obfuscated();
|
||||
}
|
||||
|
@ -612,7 +612,7 @@ void pause_init(void) {
|
||||
MenuPanel** menuPanels;
|
||||
s32 i;
|
||||
|
||||
dma_copy(ui_images_ROM_START, ui_images_ROM_END, ui_images_VRAM);
|
||||
DMA_COPY_SEGMENT(ui_images);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gPauseIconScripts); i++) {
|
||||
gPauseCommonIconIDs[i] = hud_element_create(gPauseIconScripts[i]);
|
||||
|
@ -92,7 +92,7 @@ void state_step_battle(void) {
|
||||
clear_npcs();
|
||||
clear_entity_data(1);
|
||||
clear_trigger_data();
|
||||
dma_copy(battle_code_ROM_START, battle_code_ROM_END, battle_code_VRAM);
|
||||
DMA_COPY_SEGMENT(battle_code);
|
||||
initialize_battle();
|
||||
btl_save_world_cameras();
|
||||
load_battle_section();
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "sprite/player.h"
|
||||
|
||||
ApiStatus N(LoadSmashBridgesGraphics)(void) {
|
||||
dma_copy(dgb_01_smash_bridges_ROM_START, dgb_01_smash_bridges_ROM_END, dgb_01_smash_bridges_VRAM);
|
||||
DMA_COPY_SEGMENT(dgb_01_smash_bridges);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ void load_map_hit_asset(void);
|
||||
extern ShapeFile gMapShapeData;
|
||||
|
||||
void load_map_script_lib(void) {
|
||||
dma_copy(world_script_api_ROM_START, world_script_api_ROM_END, world_script_api_VRAM);
|
||||
DMA_COPY_SEGMENT(world_script_api);
|
||||
}
|
||||
|
||||
void load_map_by_IDs(s16 areaID, s16 mapID, s16 loadType) {
|
||||
|
Loading…
Reference in New Issue
Block a user