mirror of
https://github.com/pmret/papermario.git
synced 2024-09-08 02:29:49 +02:00
PAL dma_load_msg (#1165)
This commit is contained in:
parent
9f0452dd0a
commit
8ea884c0a9
18
src/msg.c
18
src/msg.c
@ -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
|
||||
|
@ -1,44 +0,0 @@
|
||||
.set noat /* allow manual use of $at */
|
||||
.set noreorder /* don't insert nops after branches */
|
||||
|
||||
/* Generated by spimdisasm 1.11.1 */
|
||||
|
||||
glabel dma_load_msg
|
||||
/* BA664 80124314 27BDFFD8 */ addiu $sp, $sp, -0x28
|
||||
/* BA668 80124318 AFB00018 */ sw $s0, 0x18($sp)
|
||||
/* BA66C 8012431C 0080802D */ daddu $s0, $a0, $zero
|
||||
/* BA670 80124320 AFB20020 */ sw $s2, 0x20($sp)
|
||||
/* BA674 80124324 00A0902D */ daddu $s2, $a1, $zero
|
||||
/* BA678 80124328 3C028015 */ lui $v0, %hi(gCurrentLanguage)
|
||||
/* BA67C 8012432C 8C42AE4C */ lw $v0, %lo(gCurrentLanguage)($v0)
|
||||
/* BA680 80124330 27A60010 */ addiu $a2, $sp, 0x10
|
||||
/* BA684 80124334 AFBF0024 */ sw $ra, 0x24($sp)
|
||||
/* BA688 80124338 AFB1001C */ sw $s1, 0x1C($sp)
|
||||
/* BA68C 8012433C 00021080 */ sll $v0, $v0, 2
|
||||
/* BA690 80124340 3C118015 */ lui $s1, %hi(D_PAL_8014AE50)
|
||||
/* BA694 80124344 02228821 */ addu $s1, $s1, $v0
|
||||
/* BA698 80124348 8E31AE50 */ lw $s1, %lo(D_PAL_8014AE50)($s1)
|
||||
/* BA69C 8012434C 00101382 */ srl $v0, $s0, 14
|
||||
/* BA6A0 80124350 02222021 */ addu $a0, $s1, $v0
|
||||
/* BA6A4 80124354 0C00A5AF */ jal dma_copy
|
||||
/* BA6A8 80124358 24850004 */ addiu $a1, $a0, 0x4
|
||||
/* BA6AC 8012435C 27A60010 */ addiu $a2, $sp, 0x10
|
||||
/* BA6B0 80124360 3210FFFF */ andi $s0, $s0, 0xFFFF
|
||||
/* BA6B4 80124364 8FA20010 */ lw $v0, 0x10($sp)
|
||||
/* BA6B8 80124368 00108080 */ sll $s0, $s0, 2
|
||||
/* BA6BC 8012436C 02221021 */ addu $v0, $s1, $v0
|
||||
/* BA6C0 80124370 00502021 */ addu $a0, $v0, $s0
|
||||
/* BA6C4 80124374 0C00A5AF */ jal dma_copy
|
||||
/* BA6C8 80124378 24850008 */ addiu $a1, $a0, 0x8
|
||||
/* BA6CC 8012437C 0240302D */ daddu $a2, $s2, $zero
|
||||
/* BA6D0 80124380 8FA40010 */ lw $a0, 0x10($sp)
|
||||
/* BA6D4 80124384 8FA50014 */ lw $a1, 0x14($sp)
|
||||
/* BA6D8 80124388 02242021 */ addu $a0, $s1, $a0
|
||||
/* BA6DC 8012438C 0C00A5AF */ jal dma_copy
|
||||
/* BA6E0 80124390 02252821 */ addu $a1, $s1, $a1
|
||||
/* BA6E4 80124394 8FBF0024 */ lw $ra, 0x24($sp)
|
||||
/* BA6E8 80124398 8FB20020 */ lw $s2, 0x20($sp)
|
||||
/* BA6EC 8012439C 8FB1001C */ lw $s1, 0x1C($sp)
|
||||
/* BA6F0 801243A0 8FB00018 */ lw $s0, 0x18($sp)
|
||||
/* BA6F4 801243A4 03E00008 */ jr $ra
|
||||
/* BA6F8 801243A8 27BD0028 */ addiu $sp, $sp, 0x28
|
Loading…
Reference in New Issue
Block a user