Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PAL dma_load_msg #1165

Merged
merged 1 commit into from
Feb 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading