Merge branch 'master' of github.com:pret/pokediamond into pikalax_work

This commit is contained in:
PikalaxALT 2020-08-01 09:53:07 -04:00
commit 85a668f75a
9 changed files with 421 additions and 725 deletions

View File

@ -15,7 +15,7 @@ add_compile_options(-fms-extensions)
file(GLOB_RECURSE SOURCES RELATIVE ${CMAKE_SOURCE_DIR} "*.c" "*.cpp")
add_executable(PokeDiamond ${SOURCES})
target_include_directories(PokeDiamond PRIVATE include include-mw arm9/lib/include arm7/lib/include)
target_include_directories(PokeDiamond PRIVATE include include-mw arm9/lib/include arm7/lib/include arm9/modules/63/include)
add_executable(calcrom .travis/calcrom/calcrom.cpp)
target_include_directories(calcrom PRIVATE /usr/local/include)

View File

@ -53,6 +53,8 @@ LD_TEMPLATE := ARM9-TS.lcf.template
SRC_DIRS := src lib lib/src $(sort $(wildcard modules/*/src))
ASM_DIRS := asm data files $(sort $(wildcard modules/*/asm))
LIBASM_DIRS := lib/syscall
INCLUDE_RECURSIVE_DIRS := ../include-mw lib/include
INCLUDE_DIRS := ../include $(sort $(wildcard modules/*/include))
C_FILES := $(foreach dir,$(SRC_DIRS),$(sort $(wildcard $(dir)/*.c)))
CXX_FILES := $(foreach dir,$(SRC_DIRS),$(sort $(wildcard $(dir)/*.cpp)))
@ -102,8 +104,8 @@ OBJCOPY := $(CROSS)objcopy
# ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm9_thumb.s -o arm9.o
ASFLAGS = -proc arm5te -i ../include -i .. -D$(GAME_VERSION) -D$(GAME_LANGUAGE)
CFLAGS = -O4,p -gccext,on -proc arm946e -fp soft -lang c99 -Cpp_exceptions off -i ../include -ir ../include-mw -ir lib/include -interworking -DFS_IMPLEMENT -enum int -W all -D$(GAME_VERSION) -D$(GAME_LANGUAGE)
CXXFLAGS = -O4,p -proc arm946e -fp soft -lang c99 -Cpp_exceptions off -i ../include -ir ../include-mw -ir lib/include -interworking -DFS_IMPLEMENT -enum int -W all -D$(GAME_VERSION) -D$(GAME_LANGUAGE)
CFLAGS = -O4,p -gccext,on -proc arm946e -fp soft -lang c99 -Cpp_exceptions off $(foreach dir,$(INCLUDE_DIRS),-i $(dir)) $(foreach dir,$(INCLUDE_RECURSIVE_DIRS),-ir $(dir)) -interworking -DFS_IMPLEMENT -enum int -W all -D$(GAME_VERSION) -D$(GAME_LANGUAGE)
CXXFLAGS = -O4,p -proc arm946e -fp soft -lang c99 -Cpp_exceptions off $(foreach dir,$(INCLUDE_DIRS),-i $(dir)) $(foreach dir,$(INCLUDE_RECURSIVE_DIRS),-ir $(dir)) -interworking -DFS_IMPLEMENT -enum int -W all -D$(GAME_VERSION) -D$(GAME_LANGUAGE)
LDFLAGS = -nodead -w off -proc v5te -interworking -map closure,unused -symtab sort -m _start
LIBS := -Llib -lsyscall
ARFLAGS = rcS

View File

@ -7413,7 +7413,7 @@
.extern MOD63_021DB1AC
.extern MOD63_021DB38C
.extern MOD63_021DB498
.extern MOD63_021DB49C
.extern Title_SetupMonAnimationSprites
.extern MOD63_021DB580
.extern MOD63_021DB598
.extern MOD63_021DB5A8

View File

@ -2,6 +2,7 @@
#define GUARD_GX_G2_H
#include "fx.h"
#include "registers.h"
void G2x_SetBGyAffine_(u32 *ptr, struct Mtx22 *mtx, fx32 a, fx32 b, fx32 c, fx32 d);
void G2x_SetBlendAlpha_(u32 *ptr, fx32 a, fx32 b, fx32 c, fx32 d);
@ -9,6 +10,39 @@ void G2x_SetBlendBrightness_(u16 *ptr, fx32 a, fx32 brightness);
void G2x_SetBlendBrightnessExt_(u16 *ptr, fx32 a, fx32 b, fx32 c, fx32 d, fx32 brightness);
void G2x_ChangeBlendBrightness_(u16 *ptr, fx32 brightness);
typedef struct
{
u8 planeMask:5;
u8 effect:1;
u8 _reserve:2;
}
GXWndPlane;
typedef enum
{
GX_WND_PLANEMASK_NONE = 0x0000,
GX_WND_PLANEMASK_BG0 = 0x0001,
GX_WND_PLANEMASK_BG1 = 0x0002,
GX_WND_PLANEMASK_BG2 = 0x0004,
GX_WND_PLANEMASK_BG3 = 0x0008,
GX_WND_PLANEMASK_OBJ = 0x0010
}
GXWndPlaneMask;
static inline void G2_SetWndOutsidePlane(int wnd, BOOL effect)
{
u32 tmp;
tmp = ((reg_G2_WINOUT & ~REG_G2_WINOUT_WINOUT_MASK) | ((u32)wnd << REG_G2_WINOUT_WINOUT_SHIFT));
if (effect)
{
tmp |= (0x20 << REG_G2_WINOUT_WINOUT_SHIFT); // EFCT
}
reg_G2_WINOUT = (u16)tmp;
}
//The g2 and g2_oam headers contain a lot of inline functions and enums that may want to be ported over at some point
#endif //GUARD_GX_G2_H

View File

@ -454,6 +454,19 @@
#define REG_PAD_KEYCNT_A_SIZE 1
#define REG_PAD_KEYCNT_A_MASK 0x0001
#define REG_G2_WINOUT_OBJWININ_SHIFT 8
#define REG_G2_WINOUT_OBJWININ_SIZE 6
#define REG_G2_WINOUT_OBJWININ_MASK 0x3f00
#define REG_G2_WINOUT_WINOUT_SHIFT 0
#define REG_G2_WINOUT_WINOUT_SIZE 6
#define REG_G2_WINOUT_WINOUT_MASK 0x003f
#define REG_G2_WINOUT_FIELD( objwinin, winout ) \
(u16)( \
((u32)(objwinin) << REG_G2_WINOUT_OBJWININ_SHIFT) | \
((u32)(winout) << REG_G2_WINOUT_WINOUT_SHIFT))
#ifndef SDK_ASM
#define REG_PAD_KEYCNT_FIELD( logic, intr, l, r, down, up, left, right, start, sel, b, a ) \
(u16)( \

View File

@ -1540,7 +1540,7 @@ MOD63_021D9498: ; 0x021D9498
add r0, #0x3b
strb r1, [r0]
ldr r0, [r5, #0x4c]
bl MOD63_021DB49C
bl Title_SetupMonAnimationSprites
ldr r0, [r5, #0xc]
mov r1, #1
str r0, [r5, #0x40]

View File

@ -1,720 +0,0 @@
.include "asm/macros.inc"
.include "global.inc"
.section .text
.balign 4, 0
thumb_func_start MOD63_021DB450
MOD63_021DB450: ; 0x021DB450
push {r4, lr}
ldr r3, _021DB470 ; =UNK_021064B8
mov r2, #0
ldr r3, [r3]
blx r3
add r4, r0, #0
bl FUN_0201327C
cmp r4, #0
bne _021DB468
bl ErrorHandling
_021DB468:
lsl r0, r4, #0x10
lsr r0, r0, #0xd
pop {r4, pc}
nop
_021DB470: .word UNK_021064B8
thumb_func_end MOD63_021DB450
thumb_func_start MOD63_021DB474
MOD63_021DB474: ; 0x021DB474
push {r4, lr}
ldr r3, _021DB494 ; =UNK_021064C0
mov r2, #1
ldr r3, [r3]
blx r3
add r4, r0, #0
bne _021DB486
bl ErrorHandling
_021DB486:
add r0, r4, #0
bl FUN_020132BC
lsl r0, r4, #0x10
lsr r0, r0, #0xd
pop {r4, pc}
nop
_021DB494: .word UNK_021064C0
thumb_func_end MOD63_021DB474
thumb_func_start MOD63_021DB498
MOD63_021DB498: ; 0x021DB498
mov r0, #0x20
bx lr
thumb_func_end MOD63_021DB498
thumb_func_start MOD63_021DB49C
MOD63_021DB49C: ; 0x021DB49C
push {r4, r5, r6, r7, lr}
sub sp, #0x2c
ldr r3, _021DB56C ; =MOD63_021DBECC
add r5, r0, #0
ldmia r3!, {r0, r1}
add r2, sp, #0x10
stmia r2!, {r0, r1}
ldr r0, [r3]
str r0, [r2]
mov r0, #0x4c
bl FUN_02006D98
ldr r7, _021DB570 ; =MOD63_021DBEF0
str r0, [r5]
mov r4, #0
_021DB4BA:
mov r0, #0
str r0, [sp]
str r0, [sp, #4]
str r0, [sp, #8]
lsl r6, r4, #2
add r1, sp, #0x10
ldr r1, [r1, r6]
add r0, sp, #0x1c
lsl r1, r1, #0x10
lsr r1, r1, #0x10
mov r2, #0
mov r3, #2
bl FUN_02068C00
ldr r0, _021DB574 ; =0x000003FF
lsl r2, r4, #3
str r0, [sp]
str r4, [sp, #4]
mov r0, #0
str r0, [sp, #8]
str r0, [sp, #0xc]
add r3, r7, r2
ldr r0, [r5]
ldr r2, [r7, r2]
ldr r3, [r3, #4]
add r1, sp, #0x1c
add r6, r5, r6
bl FUN_020073A0
mov r1, #6
mov r2, #1
str r0, [r6, #4]
bl FUN_02007558
add r0, r4, #1
lsl r0, r0, #0x18
lsr r4, r0, #0x18
cmp r4, #3
blo _021DB4BA
ldr r0, [r5, #8]
mov r1, #0x23
mov r2, #1
bl FUN_02007558
mov r0, #1
str r0, [r5, #0x10]
bl FUN_02012CC8
mov r1, #0x12
mov r0, #0x4c
lsl r1, r1, #0xa
bl AllocFromHeap
str r0, [r5, #0x14]
mov r0, #1
str r0, [sp]
mov r0, #0x4c
str r0, [sp, #4]
mov r3, #0x12
ldr r0, _021DB578 ; =MOD63_021DB450
ldr r1, _021DB57C ; =MOD63_021DB474
ldr r2, [r5, #0x14]
lsl r3, r3, #0xa
bl FUN_02012CDC
str r0, [r5, #0x18]
bl FUN_0201343C
add r2, r0, #0
mov r0, #1
mov r1, #0xe1
lsl r0, r0, #0xc
lsl r1, r1, #0xe
bl FUN_0201EC94
mov r0, #0x3d
mov r1, #4
mov r2, #0x4c
bl FUN_0201318C
add r1, r0, #0
ldr r0, [r5, #0x18]
mov r2, #0xa
mov r3, #1
bl FUN_02013194
add sp, #0x2c
pop {r4, r5, r6, r7, pc}
nop
_021DB56C: .word MOD63_021DBECC
_021DB570: .word MOD63_021DBEF0
_021DB574: .word 0x000003FF
_021DB578: .word MOD63_021DB450
_021DB57C: .word MOD63_021DB474
thumb_func_end MOD63_021DB49C
thumb_func_start MOD63_021DB580
MOD63_021DB580: ; 0x021DB580
push {r4, lr}
add r4, r0, #0
ldr r0, [r4, #0x18]
bl FUN_02012DE4
ldr r0, [r4, #0x14]
bl FreeToHeap
ldr r0, [r4]
bl FUN_020072E8
pop {r4, pc}
thumb_func_end MOD63_021DB580
thumb_func_start MOD63_021DB598
MOD63_021DB598: ; 0x021DB598
push {r3, lr}
cmp r0, #0
beq _021DB5A4
ldr r0, [r0]
bl FUN_020081C4
_021DB5A4:
pop {r3, pc}
.align 2, 0
thumb_func_end MOD63_021DB598
thumb_func_start MOD63_021DB5A8
MOD63_021DB5A8: ; 0x021DB5A8
push {r4, lr}
add r4, r0, #0
beq _021DB5C8
bl FUN_020222AC
bl FUN_020B02C8
ldr r0, [r4]
bl FUN_02006ED4
bl MOD63_021DB934
mov r0, #1
mov r1, #0
bl FUN_020222B4
_021DB5C8:
pop {r4, pc}
.align 2, 0
thumb_func_end MOD63_021DB5A8
thumb_func_start MOD63_021DB5CC
MOD63_021DB5CC: ; 0x021DB5CC
push {r3, r4, r5, r6, r7, lr}
sub sp, #8
add r4, r0, #0
add r7, r2, #0
ldrb r2, [r4, #0x1c]
add r5, r4, #0
add r6, r1, #0
add r5, #0x1c
cmp r2, #5
bls _021DB5E2
b _021DB6FC
_021DB5E2:
add r2, r2, r2
add r2, pc
ldrh r2, [r2, #6]
lsl r2, r2, #0x10
asr r2, r2, #0x10
add pc, r2
_021DB5EE: ; jump table
.short _021DB5FA - _021DB5EE - 2 ; case 0
.short _021DB63C - _021DB5EE - 2 ; case 1
.short _021DB658 - _021DB5EE - 2 ; case 2
.short _021DB690 - _021DB5EE - 2 ; case 3
.short _021DB6BE - _021DB5EE - 2 ; case 4
.short _021DB6E4 - _021DB5EE - 2 ; case 5
_021DB5FA:
ldr r0, _021DB704 ; =0x0400004A
mov r1, #0x3f
ldrh r2, [r0]
add r7, r4, #4
bic r2, r1
mov r1, #0x11
orr r1, r2
mov r2, #0x20
orr r1, r2
strh r1, [r0]
lsl r0, r6, #2
str r0, [sp]
ldr r0, [r7, r0]
mov r1, #0xc
lsl r2, r2, #5
bl FUN_02007558
ldr r0, [sp]
mov r2, #1
ldr r0, [r7, r0]
mov r1, #0xd
lsl r2, r2, #0xa
bl FUN_02007558
ldr r0, [sp]
mov r1, #6
ldr r0, [r7, r0]
mov r2, #0
bl FUN_02007558
ldrb r0, [r5]
add r0, r0, #1
strb r0, [r5]
_021DB63C:
ldr r2, _021DB708 ; =MOD63_021DBED8
lsl r3, r6, #3
ldr r2, [r2, r3]
add r0, r4, #0
add r1, r6, #0
blx r2
cmp r0, #0
beq _021DB6FC
mov r0, #0
strb r0, [r4, #0x1d]
ldrb r0, [r5]
add r0, r0, #1
strb r0, [r5]
b _021DB6FC
_021DB658:
ldr r0, [r4, #0x18]
mov r1, #1
bl FUN_02013440
lsl r0, r6, #2
str r0, [sp, #4]
ldr r1, _021DB70C ; =MOD63_021DBF08
lsl r6, r6, #3
ldr r3, [sp, #4]
add r7, r4, #4
ldr r0, [r4, #0x18]
ldr r1, [r1, r6]
ldr r2, _021DB710 ; =MOD63_021DB940
ldr r3, [r7, r3]
bl FUN_020133AC
ldr r1, _021DB714 ; =MOD63_021DBF0C
ldr r3, [sp, #4]
ldr r0, [r4, #0x18]
ldr r1, [r1, r6]
ldr r2, _021DB710 ; =MOD63_021DB940
ldr r3, [r7, r3]
bl FUN_020133AC
ldrb r0, [r5]
add r0, r0, #1
strb r0, [r5]
b _021DB6FC
_021DB690:
ldr r0, [r4, #0x18]
bl FUN_020133C8
cmp r0, #0
bne _021DB6FC
ldr r0, _021DB718 ; =MOD63_021DBEC0
lsl r1, r6, #2
ldr r0, [r0, r1]
cmp r7, r0
blt _021DB6FC
ldr r1, _021DB704 ; =0x0400004A
mov r0, #0x3f
ldrh r2, [r1]
bic r2, r0
mov r0, #0x10
orr r2, r0
mov r0, #0x20
orr r0, r2
strh r0, [r1]
ldrb r0, [r5]
add r0, r0, #1
strb r0, [r5]
b _021DB6FC
_021DB6BE:
ldr r2, _021DB71C ; =MOD63_021DBEDC
lsl r3, r6, #3
ldr r2, [r2, r3]
blx r2
cmp r0, #0
beq _021DB6FC
lsl r0, r6, #2
add r0, r4, r0
ldr r0, [r0, #4]
mov r1, #6
mov r2, #1
bl FUN_02007558
mov r0, #0
strb r0, [r4, #0x1d]
ldrb r0, [r5]
add r0, r0, #1
strb r0, [r5]
b _021DB6FC
_021DB6E4:
ldrb r0, [r4, #0x1d]
add r0, r0, #1
strb r0, [r4, #0x1d]
ldrb r0, [r4, #0x1d]
cmp r0, #0x14
blo _021DB6FC
mov r0, #0
strb r0, [r4, #0x1d]
strb r0, [r5]
add sp, #8
mov r0, #1
pop {r3, r4, r5, r6, r7, pc}
_021DB6FC:
mov r0, #0
add sp, #8
pop {r3, r4, r5, r6, r7, pc}
nop
_021DB704: .word 0x0400004A
_021DB708: .word MOD63_021DBED8
_021DB70C: .word MOD63_021DBF08
_021DB710: .word MOD63_021DB940
_021DB714: .word MOD63_021DBF0C
_021DB718: .word MOD63_021DBEC0
_021DB71C: .word MOD63_021DBEDC
thumb_func_end MOD63_021DB5CC
thumb_func_start MOD63_021DB720
MOD63_021DB720: ; 0x021DB720
push {r3, r4, r5, lr}
add r5, r0, #0
lsl r0, r1, #2
add r0, r5, r0
ldr r4, [r0, #4]
mov r1, #0
add r0, r4, #0
mov r2, #6
bl FUN_020079E0
mov r1, #1
add r2, r1, #0
add r0, r4, #0
sub r2, #0x11
bl FUN_020079E0
mov r1, #0xc
add r2, r1, #0
add r0, r4, #0
sub r2, #0x8c
bl FUN_020079E0
mov r1, #0xd
add r2, r1, #0
add r0, r4, #0
sub r2, #0x8d
bl FUN_020079E0
ldrb r0, [r5, #0x1d]
add r0, r0, #1
strb r0, [r5, #0x1d]
ldrb r0, [r5, #0x1d]
cmp r0, #6
blo _021DB780
mov r1, #0xc
add r2, r1, #0
add r0, r4, #0
add r2, #0xf4
bl FUN_02007558
mov r1, #0xd
add r2, r1, #0
add r0, r4, #0
add r2, #0xf3
bl FUN_02007558
mov r0, #1
pop {r3, r4, r5, pc}
_021DB780:
mov r0, #0
pop {r3, r4, r5, pc}
thumb_func_end MOD63_021DB720
thumb_func_start MOD63_021DB784
MOD63_021DB784: ; 0x021DB784
push {r3, r4, r5, lr}
add r5, r0, #0
lsl r0, r1, #2
add r0, r5, r0
ldr r4, [r0, #4]
mov r1, #0
add r0, r4, #0
sub r2, r1, #3
bl FUN_020079E0
mov r1, #1
add r2, r1, #0
add r0, r4, #0
sub r2, #0x13
bl FUN_020079E0
ldrb r0, [r5, #0x1d]
add r0, r0, #1
strb r0, [r5, #0x1d]
ldrb r0, [r5, #0x1d]
cmp r0, #6
blo _021DB7CC
mov r1, #0xc
add r2, r1, #0
add r0, r4, #0
add r2, #0xf4
bl FUN_02007558
mov r1, #0xd
add r2, r1, #0
add r0, r4, #0
add r2, #0xf3
bl FUN_02007558
mov r0, #1
pop {r3, r4, r5, pc}
_021DB7CC:
mov r0, #0
pop {r3, r4, r5, pc}
thumb_func_end MOD63_021DB784
thumb_func_start MOD63_021DB7D0
MOD63_021DB7D0: ; 0x021DB7D0
push {r3, r4, r5, lr}
add r5, r0, #0
lsl r0, r1, #2
add r0, r5, r0
ldr r4, [r0, #4]
mov r1, #0
add r2, r1, #0
add r0, r4, #0
sub r2, #0x10
bl FUN_020079E0
mov r1, #1
add r2, r1, #0
add r0, r4, #0
sub r2, #0x11
bl FUN_020079E0
mov r1, #0xc
add r2, r1, #0
add r0, r4, #0
sub r2, #0x8c
bl FUN_020079E0
mov r1, #0xd
add r2, r1, #0
add r0, r4, #0
sub r2, #0x8d
bl FUN_020079E0
ldrb r0, [r5, #0x1d]
add r0, r0, #1
strb r0, [r5, #0x1d]
ldrb r0, [r5, #0x1d]
cmp r0, #6
blo _021DB832
mov r1, #0xc
add r2, r1, #0
add r0, r4, #0
add r2, #0xf4
bl FUN_02007558
mov r1, #0xd
add r2, r1, #0
add r0, r4, #0
add r2, #0xf3
bl FUN_02007558
mov r0, #1
pop {r3, r4, r5, pc}
_021DB832:
mov r0, #0
pop {r3, r4, r5, pc}
.align 2, 0
thumb_func_end MOD63_021DB7D0
thumb_func_start MOD63_021DB838
MOD63_021DB838: ; 0x021DB838
push {r3, r4, r5, lr}
add r5, r0, #0
lsl r0, r1, #2
add r0, r5, r0
ldr r4, [r0, #4]
mov r1, #0
add r0, r4, #0
sub r2, r1, #6
bl FUN_020079E0
mov r1, #1
add r2, r1, #0
add r0, r4, #0
sub r2, #0x11
bl FUN_020079E0
ldrb r0, [r5, #0x1d]
add r0, r0, #1
strb r0, [r5, #0x1d]
ldrb r0, [r5, #0x1d]
cmp r0, #6
blo _021DB880
mov r1, #0xc
add r2, r1, #0
add r0, r4, #0
add r2, #0xf4
bl FUN_02007558
mov r1, #0xd
add r2, r1, #0
add r0, r4, #0
add r2, #0xf3
bl FUN_02007558
mov r0, #1
pop {r3, r4, r5, pc}
_021DB880:
mov r0, #0
pop {r3, r4, r5, pc}
thumb_func_end MOD63_021DB838
thumb_func_start MOD63_021DB884
MOD63_021DB884: ; 0x021DB884
push {r3, r4, r5, lr}
add r5, r0, #0
lsl r0, r1, #2
add r0, r5, r0
ldr r4, [r0, #4]
mov r1, #0
add r0, r4, #0
mov r2, #8
bl FUN_020079E0
mov r1, #1
add r2, r1, #0
add r0, r4, #0
sub r2, #0x11
bl FUN_020079E0
mov r1, #0xc
add r2, r1, #0
add r0, r4, #0
sub r2, #0x8c
bl FUN_020079E0
mov r1, #0xd
add r2, r1, #0
add r0, r4, #0
sub r2, #0x8d
bl FUN_020079E0
ldrb r0, [r5, #0x1d]
add r0, r0, #1
strb r0, [r5, #0x1d]
ldrb r0, [r5, #0x1d]
cmp r0, #6
blo _021DB8E4
mov r1, #0xc
add r2, r1, #0
add r0, r4, #0
add r2, #0xf4
bl FUN_02007558
mov r1, #0xd
add r2, r1, #0
add r0, r4, #0
add r2, #0xf3
bl FUN_02007558
mov r0, #1
pop {r3, r4, r5, pc}
_021DB8E4:
mov r0, #0
pop {r3, r4, r5, pc}
thumb_func_end MOD63_021DB884
thumb_func_start MOD63_021DB8E8
MOD63_021DB8E8: ; 0x021DB8E8
push {r3, r4, r5, lr}
add r5, r0, #0
lsl r0, r1, #2
add r0, r5, r0
ldr r4, [r0, #4]
mov r1, #0
add r0, r4, #0
mov r2, #6
bl FUN_020079E0
mov r1, #1
add r2, r1, #0
add r0, r4, #0
sub r2, #0x15
bl FUN_020079E0
ldrb r0, [r5, #0x1d]
add r0, r0, #1
strb r0, [r5, #0x1d]
ldrb r0, [r5, #0x1d]
cmp r0, #6
blo _021DB930
mov r1, #0xc
add r2, r1, #0
add r0, r4, #0
add r2, #0xf4
bl FUN_02007558
mov r1, #0xd
add r2, r1, #0
add r0, r4, #0
add r2, #0xf3
bl FUN_02007558
mov r0, #1
pop {r3, r4, r5, pc}
_021DB930:
mov r0, #0
pop {r3, r4, r5, pc}
thumb_func_end MOD63_021DB8E8
thumb_func_start MOD63_021DB934
MOD63_021DB934: ; 0x021DB934
push {r3, lr}
bl FUN_02013364
bl FUN_02013388
pop {r3, pc}
thumb_func_end MOD63_021DB934
thumb_func_start MOD63_021DB940
MOD63_021DB940: ; 0x021DB940
push {r4, r5, lr}
sub sp, #0xc
add r5, r0, #0
bl FUN_0201341C
add r2, sp, #0
mov r1, #0
str r1, [r2]
str r1, [r2, #4]
add r4, r0, #0
str r1, [r2, #8]
bl FUN_0200782C
sub r0, #0x80
mov r1, #0xac
mul r1, r0
str r1, [sp]
add r0, r4, #0
mov r1, #1
bl FUN_0200782C
sub r0, #0x60
mov r1, #0xac
mul r1, r0
str r1, [sp, #4]
mov r0, #0x40
str r0, [sp, #8]
ldr r0, [r5, #0x20]
ldr r1, [sp]
ldr r0, [r0]
ldr r0, [r0, #4]
add r0, r1, r0
str r0, [r5, #0x28]
ldr r0, [r5, #0x20]
ldr r1, [sp, #4]
ldr r0, [r0]
ldr r0, [r0, #8]
add r0, r1, r0
str r0, [r5, #0x2c]
ldr r0, [r5, #0x20]
ldr r1, [sp, #8]
ldr r0, [r0]
ldr r0, [r0, #0xc]
add r0, r1, r0
str r0, [r5, #0x30]
add sp, #0xc
pop {r4, r5, pc}
.align 2, 0
thumb_func_end MOD63_021DB940
.section .rodata
.global MOD63_021DBEC0
MOD63_021DBEC0: ; 0x021DBEC0
.byte 0x03, 0x07, 0x00, 0x00, 0xCE, 0x07, 0x00, 0x00
.byte 0xA8, 0x08, 0x00, 0x00
.global MOD63_021DBECC
MOD63_021DBECC: ; 0x021DBECC
.byte 0x83, 0x01, 0x00, 0x00, 0x86, 0x01, 0x00, 0x00, 0x89, 0x01, 0x00, 0x00
.global MOD63_021DBED8
MOD63_021DBED8: ; 0x021DBED8
.word MOD63_021DB720
.global MOD63_021DBEDC
MOD63_021DBEDC: ; 0x021DBEDC
.word MOD63_021DB784, MOD63_021DB7D0, MOD63_021DB838, MOD63_021DB884
.word MOD63_021DB8E8
.global MOD63_021DBEF0
MOD63_021DBEF0: ; 0x021DBEF0
.byte 0x80, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00
.byte 0x00, 0x01, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00
.global MOD63_021DBF08
MOD63_021DBF08: ; 0x021DBF08
.byte 0x04, 0x00, 0x00, 0x00
.global MOD63_021DBF0C
MOD63_021DBF0C: ; 0x021DBF0C
.byte 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00

View File

@ -0,0 +1,61 @@
#ifndef POKEDIAMOND_MOD63_021DB450_H
#define POKEDIAMOND_MOD63_021DB450_H
#include "global.h"
typedef struct UnkStruct63_021DB450
{
struct UnkStruct63_021DB450 * field_00;
u32 field_04[3];
u32 field_10;
void * field_14;
void * field_18;
u8 field_1C;
u8 field_1D;
u8 padding_1E[2];
u32 ** field_20;
u32 field_24;
u32 field_28;
u32 field_2C;
u32 field_30;
u8 filler_34[0x30];
} UnkStruct63_021DB450;
typedef struct UnkStruct63_021DB49C
{
u32 field_00;
u32 field_04;
u32 field_08;
u32 field_0C;
} UnkStruct63_021DB49C;
typedef struct UnkStruct63_021DBEF0
{
u32 field_00;
u32 field_04;
} UnkStruct63_021DBEF0;
typedef struct UnkStruct63_021DBED8
{
BOOL (*unk_00)(struct UnkStruct63_021DB450 *, u32);
BOOL (*unk_04)(struct UnkStruct63_021DB450 *, u32);
} UnkStruct63_021DBED8;
u32 MOD63_021DB450(u32 param0, u32 param1);
u32 MOD63_021DB474(u32 param0, u32 param1);
u32 MOD63_021DB498(void);
void Title_SetupMonAnimationSprites(struct UnkStruct63_021DB450 * arg0);
void MOD63_021DB580(UnkStruct63_021DB450 *param0);
void MOD63_021DB598(UnkStruct63_021DB450 *param0);
void MOD63_021DB5A8(UnkStruct63_021DB450 *param0);
BOOL MOD63_021DB5CC(UnkStruct63_021DB450 *param0, u32 param1, s32 param2);
BOOL MOD63_021DB720(UnkStruct63_021DB450 *param0, u32 param1);
BOOL MOD63_021DB784(UnkStruct63_021DB450 *param0, u32 param1);
BOOL MOD63_021DB7D0(UnkStruct63_021DB450 *param0, u32 param1);
BOOL MOD63_021DB838(UnkStruct63_021DB450 *param0, u32 param1);
BOOL MOD63_021DB884(UnkStruct63_021DB450 *param0, u32 param1);
BOOL MOD63_021DB8E8(UnkStruct63_021DB450 *param0, u32 param1);
void MOD63_021DB934(void);
void MOD63_021DB940(struct UnkStruct63_021DB450 * a0);
#endif //POKEDIAMOND_MOD63_021DB450_H

View File

@ -0,0 +1,306 @@
#include "global.h"
#include "heap.h"
#include "constants/species.h"
#include "gx.h"
#include "mod63_021DB450.h"
//todo resolve to static code
extern u32 (*UNK_021064B8)(u32 param0, u32 param1, u32 param2);
extern u32 (*UNK_021064C0)(u32 param0, u32 param1, u32 param2);
extern void FUN_0201327C(u32 param0);
extern void FUN_020132BC(u32 param0);
extern void * FUN_02012CDC(void *, void *, void *, u32, u32, u32);
extern u32 FUN_020073A0(struct UnkStruct63_021DB450 *, struct UnkStruct63_021DB49C *, u32, u32, u32, u32, u32, u32);
extern struct UnkStruct63_021DB450 * FUN_02006D98(u32);
extern void FUN_02068C00(struct UnkStruct63_021DB49C*, u16, u32, u32, u32, u32, u32);
extern void FUN_02012CC8(void);
extern void FUN_02007558(u32, u32, u32);
extern void FUN_0201EC94(u32, u32, u32);
extern u32 FUN_0201343C(void);
extern void FUN_02013194(void *, u32, u32, u32);
extern u32 FUN_0201318C(u32, u32, u32);
extern void FUN_02012DE4(void *);
extern void FUN_020072E8(struct UnkStruct63_021DB450 *);
extern void FUN_020081C4(struct UnkStruct63_021DB450 *);
extern void FUN_020222AC(void);
extern void FUN_020B02C8(void);
extern u32 FUN_02006ED4(struct UnkStruct63_021DB450 *);
extern void FUN_020222B4(u32, u32);
extern void FUN_02013440(void *, u32);
extern void FUN_020133AC(void *, u32, const void *, u32);
extern BOOL FUN_020133C8(void *);
extern void FUN_020079E0(u32, u32, s32);
extern void FUN_02013364(void);
extern void FUN_02013388(void);
void * FUN_0201341C(struct UnkStruct63_021DB450 *);
int FUN_0200782C(void *, int);
const s32 MOD63_021DBEC0[3] = {0x703, 0x7CE, 0x8A8};
const struct UnkStruct63_021DBEF0 MOD63_021DBEF0[3];
THUMB_FUNC u32 MOD63_021DB450(u32 param0, u32 param1)
{
u32 res0 = (UNK_021064B8)(param0, param1, 0);
FUN_0201327C(res0);
GF_ASSERT(res0);
return (u32)((u16)res0 * 8);
}
THUMB_FUNC u32 MOD63_021DB474(u32 param0, u32 param1)
{
u32 res0 = (UNK_021064C0)(param0, param1, 1);
GF_ASSERT(res0);
FUN_020132BC(res0);
return (u32)((u16)res0 * 8);
}
THUMB_FUNC u32 MOD63_021DB498(void)
{
return 32;
}
THUMB_FUNC void Title_SetupMonAnimationSprites(struct UnkStruct63_021DB450 * arg0)
{
struct UnkStruct63_021DB49C sp1C;
int introMonArray[3] = {SPECIES_TURTWIG, SPECIES_CHIMCHAR, SPECIES_PIPLUP};
arg0->field_00 = FUN_02006D98(76);
for (u8 i = 0; i < 3; i++) //some kind of animation assignment TODO: investigate further
{
FUN_02068C00(&sp1C, (u16)introMonArray[i], 0, 2, 0, 0, 0);
arg0->field_04[i] = FUN_020073A0(arg0->field_00, &sp1C, MOD63_021DBEF0[i].field_00, MOD63_021DBEF0[i].field_04, 0x3FF, i, 0, 0);
FUN_02007558(arg0->field_04[i], 6, 1);
}
FUN_02007558(arg0->field_04[1], 35, 1);
arg0->field_10 = 1;
FUN_02012CC8();
arg0->field_14 = AllocFromHeap(0x4C, 0x4800);
arg0->field_18 = FUN_02012CDC(MOD63_021DB450, MOD63_021DB474, arg0->field_14, 0x4800, 1, 0x4C);
FUN_0201EC94(0x1000, 0x384000, FUN_0201343C());
FUN_02013194(arg0->field_18, FUN_0201318C(0x3D, 4, 0x4C), 10, 1);
}
THUMB_FUNC void MOD63_021DB580(UnkStruct63_021DB450 *param0)
{
FUN_02012DE4(param0->field_18);
FreeToHeap(param0->field_14);
FUN_020072E8(param0->field_00);
}
THUMB_FUNC void MOD63_021DB598(UnkStruct63_021DB450 *param0)
{
if (param0 == NULL)
{
return;
}
FUN_020081C4(param0->field_00);
}
THUMB_FUNC void MOD63_021DB5A8(UnkStruct63_021DB450 *param0)
{
if (param0 == NULL)
{
return;
}
FUN_020222AC();
FUN_020B02C8();
(void)FUN_02006ED4(param0->field_00);
MOD63_021DB934();
FUN_020222B4(1, 0);
}
const struct UnkStruct63_021DBED8 MOD63_021DBED8[3] = {
{MOD63_021DB720, MOD63_021DB784},
{MOD63_021DB7D0, MOD63_021DB838},
{MOD63_021DB884, MOD63_021DB8E8}
};
const struct UnkStruct63_021DBEF0 MOD63_021DBEF0[3] = {
{0x080, 0xC0},
{0x100, 0xC0},
{0x050, 0xC0}
};
const struct UnkStruct63_021DBEF0 MOD63_021DBF08[3] = { //no idea if this is the right type
{4, 5},
{2, 3},
{0, 1}
};
THUMB_FUNC BOOL MOD63_021DB5CC(UnkStruct63_021DB450 *param0, u32 param1, s32 param2)
{
u8 * state = &param0->field_1C;
switch(*state)
{
case 0:
G2_SetWndOutsidePlane(GX_WND_PLANEMASK_OBJ | GX_WND_PLANEMASK_BG0, TRUE);
FUN_02007558(param0->field_04[param1], 12, 0x400);
FUN_02007558(param0->field_04[param1], 13, 0x400);
FUN_02007558(param0->field_04[param1], 6, 0);
(*state)++;
// fallthrough
case 1:
if (MOD63_021DBED8[param1].unk_00(param0, param1))
{
param0->field_1D = 0;
(*state)++;
}
break;
case 2:
FUN_02013440(param0->field_18, 1);
FUN_020133AC(param0->field_18, MOD63_021DBF08[param1].field_00, MOD63_021DB940, param0->field_04[param1]);
FUN_020133AC(param0->field_18, MOD63_021DBF08[param1].field_04, MOD63_021DB940, param0->field_04[param1]);
(*state)++;
break;
case 3:
if (!FUN_020133C8(param0->field_18) && param2 >= MOD63_021DBEC0[param1])
{
G2_SetWndOutsidePlane(GX_WND_PLANEMASK_OBJ, TRUE);
(*state)++;
}
break;
case 4:
if (MOD63_021DBED8[param1].unk_04(param0, param1))
{
FUN_02007558(param0->field_04[param1], 6, 1);
param0->field_1D = 0;
(*state)++;
}
break;
case 5:
param0->field_1D++;
if (param0->field_1D >= 20)
{
param0->field_1D = 0;
*state = 0;
return TRUE;
}
break;
}
return FALSE;
}
THUMB_FUNC BOOL MOD63_021DB720(UnkStruct63_021DB450 *param0, u32 param1)
{
u32 field = param0->field_04[param1];
FUN_020079E0(field, 0x0, 0x6);
FUN_020079E0(field, 0x1, -0x10);
FUN_020079E0(field, 0xC, -0x80);
FUN_020079E0(field, 0xD, -0x80);
param0->field_1D++;
if (param0->field_1D >= 6)
{
FUN_02007558(field, 0xC, 0x100);
FUN_02007558(field, 0xD, 0x100);
return TRUE;
}
return FALSE;
}
THUMB_FUNC BOOL MOD63_021DB784(UnkStruct63_021DB450 *param0, u32 param1)
{
u32 field = param0->field_04[param1];
FUN_020079E0(field, 0x0, -0x3);
FUN_020079E0(field, 0x1, -0x12);
param0->field_1D++;
if (param0->field_1D >= 6)
{
FUN_02007558(field, 0xC, 0x100);
FUN_02007558(field, 0xD, 0x100);
return TRUE;
}
return FALSE;
}
THUMB_FUNC BOOL MOD63_021DB7D0(UnkStruct63_021DB450 *param0, u32 param1)
{
u32 field = param0->field_04[param1];
FUN_020079E0(field, 0x0, -0x10);
FUN_020079E0(field, 0x1, -0x10);
FUN_020079E0(field, 0xC, -0x80);
FUN_020079E0(field, 0xD, -0x80);
param0->field_1D++;
if (param0->field_1D >= 6)
{
FUN_02007558(field, 0xC, 0x100);
FUN_02007558(field, 0xD, 0x100);
return TRUE;
}
return FALSE;
}
THUMB_FUNC BOOL MOD63_021DB838(UnkStruct63_021DB450 *param0, u32 param1)
{
u32 field = param0->field_04[param1];
FUN_020079E0(field, 0, -0x6);
FUN_020079E0(field, 1, -0x10);
param0->field_1D++;
if (param0->field_1D >= 6)
{
FUN_02007558(field, 0xC, 0x100);
FUN_02007558(field, 0xD, 0x100);
return TRUE;
}
return FALSE;
}
THUMB_FUNC BOOL MOD63_021DB884(UnkStruct63_021DB450 *param0, u32 param1)
{
u32 field = param0->field_04[param1];
FUN_020079E0(field, 0, 0x8);
FUN_020079E0(field, 1, -0x10);
FUN_020079E0(field, 0xC, -0x80);
FUN_020079E0(field, 0xD, -0x80);
param0->field_1D++;
if (param0->field_1D >= 6)
{
FUN_02007558(field, 0xC, 0x100);
FUN_02007558(field, 0xD, 0x100);
return TRUE;
}
return FALSE;
}
THUMB_FUNC BOOL MOD63_021DB8E8(UnkStruct63_021DB450 *param0, u32 param1)
{
u32 field = param0->field_04[param1];
FUN_020079E0(field, 0, 0x6);
FUN_020079E0(field, 1, -0x14);
param0->field_1D++;
if (param0->field_1D >= 6)
{
FUN_02007558(field, 0xC, 0x100);
FUN_02007558(field, 0xD, 0x100);
return TRUE;
}
return FALSE;
}
THUMB_FUNC void MOD63_021DB934(void)
{
FUN_02013364();
FUN_02013388();
}
THUMB_FUNC void MOD63_021DB940(struct UnkStruct63_021DB450 * a0)
{
void * r4 = FUN_0201341C(a0);
int sp0[3] = {0, 0, 0};
sp0[0] = (FUN_0200782C(r4, 0) - 0x80) * 0xAC;
sp0[1] = (FUN_0200782C(r4, 1) - 0x60) * 0xAC;
sp0[2] = 0x40;
a0->field_28 = sp0[0] + (*a0->field_20)[1];
a0->field_2C = sp0[1] + (*a0->field_20)[2];
a0->field_30 = sp0[2] + (*a0->field_20)[3];
}