Skip to content

Commit

Permalink
PAL dma_load_msg (#1165)
Browse files Browse the repository at this point in the history
  • Loading branch information
croghostrider authored Feb 4, 2024
1 parent 9f0452d commit 8ea884c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 46 deletions.
18 changes: 16 additions & 2 deletions src/msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1409,8 +1409,22 @@ void initialize_printer(MessagePrintState* printer, s32 arg1, s32 arg2) {
}

#if VERSION_PAL
void dma_load_msg(u32 msgID, void* dest);
INCLUDE_ASM(s32, "msg", dma_load_msg);
void dma_load_msg(u32 msgID, void* dest) {
u8* langPtr = D_PAL_8014AE50[gCurrentLanguage];
u8* new_langPtr;
u8* addr = (u8*) langPtr + (msgID >> 14); // (msgID >> 16) * 4
u8* offset[2]; // start, end

dma_copy(addr, addr + 4, &offset[0]); // Load section offset

new_langPtr = langPtr;
new_langPtr = offset[0] + ((u32) new_langPtr);
addr = new_langPtr + ((msgID & 0xFFFF) * 4);
dma_copy(addr, addr + 8, &offset); // Load message start and end offsets

// Load the msg data
dma_copy(&langPtr[(u32)offset[0]], &langPtr[(u32)offset[1]], dest);
}
#else
void dma_load_msg(u32 msgID, void* dest) {
u8* addr = (u8*) MSG_ROM_START + (msgID >> 14); // (msgID >> 16) * 4
Expand Down
44 changes: 0 additions & 44 deletions ver/pal/asm/nonmatchings/msg/dma_load_msg.s

This file was deleted.

0 comments on commit 8ea884c

Please sign in to comment.