diff options
| -rw-r--r-- | arm9/asm/unk_02035068.s | 6 | ||||
| -rw-r--r-- | arm9/asm/unk_020377F0.s | 10 | ||||
| -rw-r--r-- | arm9/asm/unk_02050E48.s | 2 | ||||
| -rw-r--r-- | arm9/asm/unk_0205FA2C.s | 930 | ||||
| -rw-r--r-- | arm9/global.inc | 4 | ||||
| -rw-r--r-- | arm9/modules/11/asm/module_11_thumb2.s | 2 | ||||
| -rw-r--r-- | arm9/modules/14/asm/module_14.s | 4 | ||||
| -rw-r--r-- | arm9/modules/52/src/module_52.c | 2 | ||||
| -rw-r--r-- | arm9/src/unk_0205FA2C.c | 546 | ||||
| -rw-r--r-- | arm9/src/unk_0206BB28.c | 6 | ||||
| -rw-r--r-- | include/unk_0205FA2C.h | 120 | ||||
| -rw-r--r-- | include/unk_0206BB28.h | 4 | 
12 files changed, 686 insertions, 950 deletions
| diff --git a/arm9/asm/unk_02035068.s b/arm9/asm/unk_02035068.s index 0c8e3612..f0cdc150 100644 --- a/arm9/asm/unk_02035068.s +++ b/arm9/asm/unk_02035068.s @@ -1870,7 +1870,7 @@ _02035ECC:  	bl FUN_0202A918  	str r0, [r7, #0x20]  	ldr r0, [r5, #0xc] -	bl FUN_0206BB28 +	bl SavArray_IsNatDexEnabled  	str r0, [r7, #0x1c]  	ldr r0, [r5, #0xc]  	bl FUN_02079C70 @@ -1918,7 +1918,7 @@ _02035F4A:  	mov r0, #0x2  	strb r0, [r7, #0x12]  	ldr r0, [r5, #0xc] -	bl FUN_0206BB28 +	bl SavArray_IsNatDexEnabled  	str r0, [r7, #0x1c]  	ldr r0, [r5, #0xc]  	bl FUN_02079C70 @@ -1975,7 +1975,7 @@ _02035FD0:  	mov r0, #0x2  	strb r0, [r7, #0x12]  	ldr r0, [r5, #0xc] -	bl FUN_0206BB28 +	bl SavArray_IsNatDexEnabled  	str r0, [r7, #0x1c]  	ldr r0, [r5, #0xc]  	bl FUN_02079C70 diff --git a/arm9/asm/unk_020377F0.s b/arm9/asm/unk_020377F0.s index 9d5e2f32..7c45ad7a 100644 --- a/arm9/asm/unk_020377F0.s +++ b/arm9/asm/unk_020377F0.s @@ -773,7 +773,7 @@ FUN_02037C00: ; 0x02037C00  	bl FUN_0202A918  	str r0, [r4, #0x20]  	ldr r0, [r5, #0xc] -	bl FUN_0206BB28 +	bl SavArray_IsNatDexEnabled  	str r0, [r4, #0x1c]  	ldr r0, [r5, #0xc]  	bl FUN_02079C70 @@ -827,7 +827,7 @@ FUN_02037C7C: ; 0x02037C7C  	strh r0, [r4, #0x18]  	strb r6, [r4, #0x12]  	add r0, r5, #0x0 -	bl FUN_0206BB28 +	bl SavArray_IsNatDexEnabled  	str r0, [r4, #0x1c]  	add r0, r5, #0x0  	bl FUN_02079C70 @@ -874,7 +874,7 @@ FUN_02037CF0: ; 0x02037CF0  	mov r0, #0x2  	strb r0, [r4, #0x12]  	ldr r0, [r5, #0xc] -	bl FUN_0206BB28 +	bl SavArray_IsNatDexEnabled  	str r0, [r4, #0x1c]  	ldr r0, [r5, #0xc]  	bl FUN_02079C70 @@ -1426,7 +1426,7 @@ FUN_02038144: ; 0x02038144  	bl Sav2_Pokedex_get  	str r0, [r5, #0x24]  	ldr r0, [r4, #0xc] -	bl FUN_0206BB28 +	bl SavArray_IsNatDexEnabled  	str r0, [r5, #0x30]  	ldr r0, [r4, #0xc]  	str r0, [r5, #0x10] @@ -2157,7 +2157,7 @@ FUN_020386E0: ; 0x020386E0  	ldr r0, [r5, #0xc]  	str r0, [r4, #0x20]  	ldr r0, [r5, #0xc] -	bl FUN_0206BB28 +	bl SavArray_IsNatDexEnabled  	str r0, [r4, #0x34]  	ldr r0, [r4, #0x14]  	bl FUN_02033830 diff --git a/arm9/asm/unk_02050E48.s b/arm9/asm/unk_02050E48.s index 5746b23f..c8a8a153 100644 --- a/arm9/asm/unk_02050E48.s +++ b/arm9/asm/unk_02050E48.s @@ -35,7 +35,7 @@ FUN_02050E48: ; 0x02050E48  	add r0, r4, #0x0  	bl FUN_0207C2A4  	add r0, r6, #0x0 -	bl FUN_0206BB28 +	bl SavArray_IsNatDexEnabled  	str r0, [r4, #0x1c]  	add r0, r6, #0x0  	bl FUN_02079C70 diff --git a/arm9/asm/unk_0205FA2C.s b/arm9/asm/unk_0205FA2C.s deleted file mode 100644 index ae0d9d3f..00000000 --- a/arm9/asm/unk_0205FA2C.s +++ /dev/null @@ -1,930 +0,0 @@ -    .include "asm/macros.inc" -    .include "global.inc" - -	.extern UNK_020F96DC -	.extern UNK_020FA6E8 - -	.section .rodata - -	.global UNK_020F7454 -UNK_020F7454: ; 0x020F7454 -	.byte 0x00, 0x01, 0x02, 0x04, 0x03, 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00 - -	.text - -	thumb_func_start FUN_0205FA2C -FUN_0205FA2C: ; 0x0205FA2C -	push {r3-r7, lr} -	add r5, r0, #0x0 -	add r7, r1, #0x0 -	add r0, r2, #0x0 -	mov r1, #0x40 -	bl AllocFromHeapAtEnd -	ldr r6, [r7, #0xc] -	mov r1, #0x0 -	mov r2, #0x40 -	add r4, r0, #0x0 -	bl MI_CpuFill8 -	add r0, r6, #0x0 -	bl Sav2_PlayerData_GetOptionsAddr -	str r0, [r4, #0xc] -	add r0, r6, #0x0 -	bl SavArray_PlayerParty_get -	str r0, [r4, #0x0] -	add r0, r6, #0x0 -	bl Sav2_Bag_get -	str r0, [r4, #0x4] -	add r0, r4, #0x0 -	mov r1, #0x0 -	add r0, #0x21 -	strb r1, [r0, #0x0] -	add r0, r4, #0x0 -	ldrb r2, [r5, #0x8] -	add r0, #0x20 -	strb r2, [r0, #0x0] -	add r0, r4, #0x0 -	add r0, #0x32 -	ldrb r0, [r0, #0x0] -	mov r2, #0xf -	ldrb r3, [r5, #0xa] -	bic r0, r2 -	mov r2, #0xf -	and r2, r3 -	orr r2, r0 -	add r0, r4, #0x0 -	add r0, #0x32 -	strb r2, [r0, #0x0] -	add r0, r4, #0x0 -	add r0, #0x32 -	ldrb r0, [r0, #0x0] -	mov r2, #0xf0 -	bic r0, r2 -	ldrb r2, [r5, #0xb] -	lsl r2, r2, #0x1c -	lsr r2, r2, #0x18 -	orr r2, r0 -	add r0, r4, #0x0 -	add r0, #0x32 -	strb r2, [r0, #0x0] -	add r0, r4, #0x0 -	ldrb r2, [r5, #0xc] -	add r0, #0x33 -	strb r2, [r0, #0x0] -	add r0, r4, #0x0 -	ldrb r2, [r5, #0xd] -	add r0, #0x22 -	strb r2, [r0, #0x0] -_0205FAAE: -	add r0, r5, r1 -	ldrb r2, [r0, #0xe] -	add r0, r4, r1 -	add r0, #0x2c -	strb r2, [r0, #0x0] -	add r0, r1, #0x1 -	lsl r0, r0, #0x18 -	lsr r1, r0, #0x18 -	cmp r1, #0x6 -	blo _0205FAAE -	ldr r1, _0205FAD4 ; =UNK_020F96DC -	add r0, r7, #0x0 -	add r2, r4, #0x0 -	bl FUN_020373D4 -	ldr r0, [r5, #0x14] -	str r4, [r0, #0x0] -	mov r0, #0x1 -	pop {r3-r7, pc} -	.balign 4 -_0205FAD4: .word UNK_020F96DC - -	thumb_func_start FUN_0205FAD8 -FUN_0205FAD8: ; 0x0205FAD8 -	push {r3-r5, lr} -	add r5, r0, #0x0 -	add r0, r1, #0x0 -	bl FUN_0204647C -	cmp r0, #0x0 -	beq _0205FAEA -	mov r0, #0x1 -	pop {r3-r5, pc} -_0205FAEA: -	ldr r0, [r5, #0x14] -	ldr r4, [r0, #0x0] -	add r0, r4, #0x0 -	add r0, #0x22 -	ldrb r0, [r0, #0x0] -	cmp r0, #0x6 -	beq _0205FB04 -	cmp r0, #0x7 -	bne _0205FB0C -	mov r0, #0x0 -	str r0, [r5, #0x0] -	mov r0, #0x4 -	pop {r3-r5, pc} -_0205FB04: -	mov r0, #0x1 -	str r0, [r5, #0x0] -	mov r0, #0x4 -	pop {r3-r5, pc} -_0205FB0C: -	add r0, r4, #0x0 -	add r1, r5, #0x0 -	add r0, #0x2c -	add r1, #0xe -	mov r2, #0x6 -	bl MI_CpuCopy8 -	add r0, r4, #0x0 -	add r0, #0x22 -	ldrb r0, [r0, #0x0] -	strb r0, [r5, #0xd] -	add r0, r4, #0x0 -	bl FreeToHeap -	ldr r0, [r5, #0x14] -	mov r1, #0x0 -	str r1, [r0, #0x0] -	mov r0, #0x2 -	pop {r3-r5, pc} -	.balign 4 - -	thumb_func_start FUN_0205FB34 -FUN_0205FB34: ; 0x0205FB34 -	push {r3-r7, lr} -	add r7, r1, #0x0 -	add r6, r0, #0x0 -	ldr r5, [r7, #0xc] -	add r0, r2, #0x0 -	mov r1, #0x30 -	bl AllocFromHeapAtEnd -	mov r1, #0x0 -	mov r2, #0x30 -	add r4, r0, #0x0 -	bl MI_CpuFill8 -	add r0, r5, #0x0 -	bl Sav2_PlayerData_GetOptionsAddr -	str r0, [r4, #0x4] -	add r0, r5, #0x0 -	bl SavArray_PlayerParty_get -	str r0, [r4, #0x0] -	add r0, r5, #0x0 -	bl FUN_0206BB28 -	str r0, [r4, #0x1c] -	add r0, r5, #0x0 -	bl FUN_02079C70 -	str r0, [r4, #0x2c] -	mov r0, #0x1 -	strb r0, [r4, #0x11] -	ldrb r0, [r6, #0xd] -	strb r0, [r4, #0x14] -	ldr r0, [r4, #0x0] -	bl GetPartyCount -	strb r0, [r4, #0x13] -	mov r0, #0x0 -	strh r0, [r4, #0x18] -	ldrb r0, [r6, #0x9] -	strb r0, [r4, #0x12] -	add r0, r5, #0x0 -	bl FUN_0202A918 -	str r0, [r4, #0x20] -	ldr r1, _0205FBB8 ; =UNK_020F7454 -	add r0, r4, #0x0 -	bl FUN_0207B000 -	add r0, r5, #0x0 -	bl Sav2_PlayerData_GetProfileAddr -	add r1, r0, #0x0 -	add r0, r4, #0x0 -	bl FUN_0207C2A4 -	ldr r1, _0205FBBC ; =UNK_020FA6E8 -	add r0, r7, #0x0 -	add r2, r4, #0x0 -	bl FUN_020373D4 -	ldr r0, [r6, #0x14] -	str r4, [r0, #0x0] -	mov r0, #0x3 -	pop {r3-r7, pc} -	nop -_0205FBB8: .word UNK_020F7454 -_0205FBBC: .word UNK_020FA6E8 - -	thumb_func_start FUN_0205FBC0 -FUN_0205FBC0: ; 0x0205FBC0 -	push {r4, lr} -	add r4, r0, #0x0 -	add r0, r1, #0x0 -	bl FUN_0204647C -	cmp r0, #0x0 -	beq _0205FBD2 -	mov r0, #0x3 -	pop {r4, pc} -_0205FBD2: -	ldr r0, [r4, #0x14] -	ldr r0, [r0, #0x0] -	ldrb r1, [r0, #0x14] -	strb r1, [r4, #0xd] -	bl FreeToHeap -	ldr r1, [r4, #0x14] -	mov r0, #0x0 -	str r0, [r1, #0x0] -	pop {r4, pc} -	.balign 4 - -	thumb_func_start FUN_0205FBE8 -FUN_0205FBE8: ; 0x0205FBE8 -	push {r3-r5, lr} -	add r4, r0, #0x0 -	bl FUN_02046528 -	add r5, r0, #0x0 -	add r0, r4, #0x0 -	bl FUN_0204652C -	add r4, r0, #0x0 -	ldr r1, [r4, #0x4] -	cmp r1, #0x4 -	bhi _0205FC4A -	add r1, r1, r1 -	add r1, pc -	ldrh r1, [r1, #0x6] -	lsl r1, r1, #0x10 -	asr r1, r1, #0x10 -	add pc, r1 -_0205FC0C: ; jump table (using 16-bit offset) -	.short _0205FC16 - _0205FC0C - 2; case 0 -	.short _0205FC22 - _0205FC0C - 2; case 1 -	.short _0205FC2C - _0205FC0C - 2; case 2 -	.short _0205FC38 - _0205FC0C - 2; case 3 -	.short _0205FC42 - _0205FC0C - 2; case 4 -_0205FC16: -	add r1, r5, #0x0 -	mov r2, #0xb -	bl FUN_0205FA2C -	str r0, [r4, #0x4] -	b _0205FC4A -_0205FC22: -	add r1, r5, #0x0 -	bl FUN_0205FAD8 -	str r0, [r4, #0x4] -	b _0205FC4A -_0205FC2C: -	add r1, r5, #0x0 -	mov r2, #0xb -	bl FUN_0205FB34 -	str r0, [r4, #0x4] -	b _0205FC4A -_0205FC38: -	add r1, r5, #0x0 -	bl FUN_0205FBC0 -	str r0, [r4, #0x4] -	b _0205FC4A -_0205FC42: -	bl FreeToHeap -	mov r0, #0x1 -	pop {r3-r5, pc} -_0205FC4A: -	mov r0, #0x0 -	pop {r3-r5, pc} -	.balign 4 - -	thumb_func_start FUN_0205FC50 -FUN_0205FC50: ; 0x0205FC50 -	push {r3-r7, lr} -	add r5, r1, #0x0 -	add r6, r2, #0x0 -	add r7, r3, #0x0 -	bl FUN_02046528 -	str r0, [sp, #0x0] -	mov r0, #0xb -	mov r1, #0x18 -	bl AllocFromHeap -	add r4, r0, #0x0 -	mov r1, #0x0 -	mov r2, #0x18 -	bl MI_CpuFill8 -	strb r6, [r4, #0x8] -	strb r7, [r4, #0x9] -	add r0, sp, #0x8 -	ldrb r1, [r0, #0x10] -	add r2, r4, #0x0 -	strb r1, [r4, #0xa] -	ldrb r1, [r0, #0x14] -	strb r1, [r4, #0xb] -	ldrb r1, [r0, #0x18] -	strb r1, [r4, #0xc] -	ldrb r0, [r0, #0x1c] -	ldr r1, _0205FC98 ; =FUN_0205FBE8 -	strb r0, [r4, #0xd] -	ldr r0, [sp, #0x0] -	str r5, [r4, #0x14] -	ldr r0, [r0, #0x10] -	bl FUN_0204640C -	pop {r3-r7, pc} -	nop -_0205FC98: .word FUN_0205FBE8 - -	thumb_func_start FUN_0205FC9C -FUN_0205FC9C: ; 0x0205FC9C -	push {r3-r5, lr} -	add r5, r1, #0x0 -	add r4, r0, #0x0 -	ldr r0, [r5, #0xc] -	bl FUN_0203384C -	cmp r0, #0x0 -	beq _0205FCBC -	ldrh r1, [r4, #0x12] -	ldrh r2, [r4, #0x14] -	add r0, r5, #0x0 -	bl FUN_02038790 -	str r0, [r4, #0x8] -	mov r0, #0x1 -	pop {r3-r5, pc} -_0205FCBC: -	mov r0, #0x1 -	str r0, [r4, #0x0] -	mov r0, #0x2 -	pop {r3-r5, pc} - -	thumb_func_start FUN_0205FCC4 -FUN_0205FCC4: ; 0x0205FCC4 -	push {r4, lr} -	add r4, r0, #0x0 -	add r0, r1, #0x0 -	bl FUN_0204647C -	cmp r0, #0x0 -	beq _0205FCD6 -	mov r0, #0x1 -	pop {r4, pc} -_0205FCD6: -	ldr r0, [r4, #0x8] -	ldr r0, [r0, #0x20] -	str r0, [r4, #0x0] -	ldr r0, [r4, #0x8] -	bl FreeToHeap -	mov r0, #0x2 -	pop {r4, pc} -	.balign 4 - -	thumb_func_start FUN_0205FCE8 -FUN_0205FCE8: ; 0x0205FCE8 -	push {r3-r5, lr} -	add r4, r0, #0x0 -	bl FUN_02046528 -	add r5, r0, #0x0 -	add r0, r4, #0x0 -	bl FUN_0204652C -	add r4, r0, #0x0 -	ldr r1, [r4, #0x4] -	cmp r1, #0x0 -	beq _0205FD0A -	cmp r1, #0x1 -	beq _0205FD14 -	cmp r1, #0x2 -	beq _0205FD1E -	b _0205FD34 -_0205FD0A: -	add r1, r5, #0x0 -	bl FUN_0205FC9C -	str r0, [r4, #0x4] -	b _0205FD34 -_0205FD14: -	add r1, r5, #0x0 -	bl FUN_0205FCC4 -	str r0, [r4, #0x4] -	b _0205FD34 -_0205FD1E: -	ldrh r1, [r4, #0x10] -	add r0, r5, #0x0 -	bl GetVarPointer -	ldr r1, [r4, #0x0] -	strh r1, [r0, #0x0] -	add r0, r4, #0x0 -	bl FreeToHeap -	mov r0, #0x1 -	pop {r3-r5, pc} -_0205FD34: -	mov r0, #0x0 -	pop {r3-r5, pc} - -	thumb_func_start FUN_0205FD38 -FUN_0205FD38: ; 0x0205FD38 -	push {r3-r7, lr} -	add r5, r1, #0x0 -	add r6, r2, #0x0 -	add r7, r3, #0x0 -	bl FUN_02046528 -	str r0, [sp, #0x0] -	mov r0, #0xb -	mov r1, #0x18 -	bl AllocFromHeap -	add r4, r0, #0x0 -	mov r1, #0x0 -	mov r2, #0x18 -	bl MI_CpuFill8 -	strh r5, [r4, #0x12] -	strh r7, [r4, #0x14] -	ldr r0, [sp, #0x0] -	strh r6, [r4, #0x10] -	ldr r0, [r0, #0x10] -	ldr r1, _0205FD6C ; =FUN_0205FCE8 -	add r2, r4, #0x0 -	bl FUN_0204640C -	pop {r3-r7, pc} -	.balign 4 -_0205FD6C: .word FUN_0205FCE8 - -	thumb_func_start FUN_0205FD70 -FUN_0205FD70: ; 0x0205FD70 -	push {r3-r7, lr} -	add r4, r0, #0x0 -	bl FUN_02046528 -	add r6, r0, #0x0 -	add r0, r4, #0x0 -	bl FUN_0204652C -	add r5, r0, #0x0 -	bl FUN_02031190 -	mov r1, #0x1 -	sub r0, r1, r0 -	bl FUN_020316E0 -	add r7, r0, #0x0 -	bne _0205FD96 -	mov r0, #0x0 -	pop {r3-r7, pc} -_0205FD96: -	ldrh r1, [r5, #0x2] -	add r0, r6, #0x0 -	bl GetVarPointer -	add r4, r0, #0x0 -	ldrh r0, [r5, #0x0] -	cmp r0, #0x0 -	beq _0205FDB0 -	cmp r0, #0x1 -	beq _0205FDBC -	cmp r0, #0x2 -	beq _0205FDC8 -	b _0205FDD2 -_0205FDB0: -	add r0, r6, #0x0 -	add r1, r7, #0x0 -	bl MOD06_02244660 -	strh r0, [r4, #0x0] -	b _0205FDD2 -_0205FDBC: -	add r0, r6, #0x0 -	add r1, r7, #0x0 -	bl MOD06_022446BC -	strh r0, [r4, #0x0] -	b _0205FDD2 -_0205FDC8: -	add r0, r6, #0x0 -	add r1, r7, #0x0 -	bl MOD06_022446E0 -	strh r0, [r4, #0x0] -_0205FDD2: -	add r0, r5, #0x0 -	bl FreeToHeap -	mov r0, #0x1 -	pop {r3-r7, pc} - -	thumb_func_start FUN_0205FDDC -FUN_0205FDDC: ; 0x0205FDDC -	push {r3-r7, lr} -	add r5, r1, #0x0 -	add r6, r2, #0x0 -	bl FUN_02046528 -	add r7, r0, #0x0 -	mov r0, #0xb -	mov r1, #0x4 -	bl AllocFromHeap -	add r4, r0, #0x0 -	mov r1, #0x0 -	mov r2, #0x4 -	bl MI_CpuFill8 -	strh r5, [r4, #0x0] -	strh r6, [r4, #0x2] -	ldr r0, [r7, #0x10] -	ldr r1, _0205FE0C ; =FUN_0205FD70 -	add r2, r4, #0x0 -	bl FUN_0204640C -	pop {r3-r7, pc} -	nop -_0205FE0C: .word FUN_0205FD70 - -	thumb_func_start FUN_0205FE10 -FUN_0205FE10: ; 0x0205FE10 -	push {r4-r7, lr} -	sub sp, #0x14 -	str r0, [sp, #0x0] -	bl FUN_02029FC8 -	mov r1, #0x35 -	bl FUN_0202A150 -	lsl r0, r0, #0x10 -	lsr r0, r0, #0x10 -	str r0, [sp, #0x10] -	cmp r0, #0x14 -	bhs _0205FE30 -	add sp, #0x14 -	mov r0, #0x0 -	pop {r4-r7, pc} -_0205FE30: -	ldr r0, [sp, #0x0] -	bl FUN_0202A8D8 -	mov r1, #0xd -	mov r2, #0x0 -	add r4, r0, #0x0 -	bl FUN_0202A578 -	lsl r0, r0, #0x18 -	mov r1, #0x0 -	lsr r7, r0, #0x18 -	add r0, r4, #0x0 -	add r2, r1, #0x0 -	bl FUN_0202A578 -	lsl r0, r0, #0x18 -	lsr r6, r0, #0x18 -	add r0, r4, #0x0 -	mov r1, #0x1 -	mov r2, #0x0 -	bl FUN_0202A578 -	lsl r0, r0, #0x18 -	lsr r5, r0, #0x18 -	add r0, r4, #0x0 -	mov r1, #0xe -	mov r2, #0x0 -	bl FUN_0202A578 -	lsl r0, r0, #0x18 -	lsr r0, r0, #0x18 -	str r0, [sp, #0xc] -	add r0, r4, #0x0 -	mov r1, #0x2 -	mov r2, #0x0 -	bl FUN_0202A578 -	lsl r0, r0, #0x18 -	lsr r0, r0, #0x18 -	str r0, [sp, #0x8] -	add r0, r4, #0x0 -	mov r1, #0x3 -	mov r2, #0x0 -	bl FUN_0202A578 -	lsl r0, r0, #0x18 -	lsr r0, r0, #0x18 -	str r0, [sp, #0x4] -	cmp r7, #0x0 -	beq _0205FEA2 -	cmp r6, #0x0 -	beq _0205FEA2 -	cmp r5, #0x0 -	beq _0205FEA2 -	add sp, #0x14 -	mov r0, #0x0 -	pop {r4-r7, pc} -_0205FEA2: -	ldr r0, [sp, #0x0] -	bl FUN_02026CC4 -	cmp r7, #0x0 -	bne _0205FEDC -	mov r1, #0x55 -	bl FUN_02025D94 -	cmp r0, #0x0 -	beq _0205FEC6 -	add r0, r4, #0x0 -	mov r1, #0xd -	mov r2, #0x1 -	bl FUN_0202A578 -	add sp, #0x14 -	mov r0, #0x1 -	pop {r4-r7, pc} -_0205FEC6: -	ldr r0, [sp, #0xc] -	cmp r0, #0x0 -	bne _0205FED6 -	add r0, r4, #0x0 -	mov r1, #0xe -	mov r2, #0x1 -	bl FUN_0202A578 -_0205FED6: -	add sp, #0x14 -	mov r0, #0x4 -	pop {r4-r7, pc} -_0205FEDC: -	ldr r1, [sp, #0x10] -	cmp r1, #0x32 -	bhs _0205FEE8 -	add sp, #0x14 -	mov r0, #0x0 -	pop {r4-r7, pc} -_0205FEE8: -	cmp r6, #0x0 -	bne _0205FF1C -	mov r1, #0x56 -	bl FUN_02025D94 -	cmp r0, #0x0 -	beq _0205FF06 -	add r0, r4, #0x0 -	mov r1, #0x0 -	mov r2, #0x1 -	bl FUN_0202A578 -	add sp, #0x14 -	mov r0, #0x2 -	pop {r4-r7, pc} -_0205FF06: -	ldr r0, [sp, #0x8] -	cmp r0, #0x0 -	bne _0205FF16 -	add r0, r4, #0x0 -	mov r1, #0x2 -	mov r2, #0x1 -	bl FUN_0202A578 -_0205FF16: -	add sp, #0x14 -	mov r0, #0x4 -	pop {r4-r7, pc} -_0205FF1C: -	cmp r1, #0x64 -	blo _0205FF24 -	cmp r5, #0x0 -	beq _0205FF2A -_0205FF24: -	add sp, #0x14 -	mov r0, #0x0 -	pop {r4-r7, pc} -_0205FF2A: -	mov r1, #0x57 -	bl FUN_02025D94 -	cmp r0, #0x0 -	beq _0205FF44 -	mov r1, #0x1 -	add r0, r4, #0x0 -	add r2, r1, #0x0 -	bl FUN_0202A578 -	add sp, #0x14 -	mov r0, #0x3 -	pop {r4-r7, pc} -_0205FF44: -	ldr r0, [sp, #0x4] -	cmp r0, #0x0 -	bne _0205FF54 -	add r0, r4, #0x0 -	mov r1, #0x3 -	mov r2, #0x1 -	bl FUN_0202A578 -_0205FF54: -	mov r0, #0x4 -	add sp, #0x14 -	pop {r4-r7, pc} -	.balign 4 - -	thumb_func_start FUN_0205FF5C -FUN_0205FF5C: ; 0x0205FF5C -	push {r4-r7, lr} -	sub sp, #0xc -	add r4, r0, #0x0 -	bl FUN_02029FC8 -	mov r1, #0x35 -	bl FUN_0202A150 -	lsl r0, r0, #0x10 -	lsr r7, r0, #0x10 -	cmp r7, #0x14 -	bhs _0205FF7A -	add sp, #0xc -	mov r0, #0x0 -	pop {r4-r7, pc} -_0205FF7A: -	add r0, r4, #0x0 -	bl FUN_0202A8D8 -	mov r1, #0xd -	mov r2, #0x0 -	str r0, [sp, #0x8] -	bl FUN_0202A578 -	lsl r0, r0, #0x18 -	lsr r6, r0, #0x18 -	mov r1, #0x0 -	ldr r0, [sp, #0x8] -	add r2, r1, #0x0 -	bl FUN_0202A578 -	lsl r0, r0, #0x18 -	lsr r4, r0, #0x18 -	ldr r0, [sp, #0x8] -	mov r1, #0x1 -	mov r2, #0x0 -	bl FUN_0202A578 -	lsl r0, r0, #0x18 -	lsr r5, r0, #0x18 -	ldr r0, [sp, #0x8] -	mov r1, #0xe -	mov r2, #0x0 -	bl FUN_0202A578 -	lsl r0, r0, #0x18 -	lsr r0, r0, #0x18 -	str r0, [sp, #0x4] -	ldr r0, [sp, #0x8] -	mov r1, #0x2 -	mov r2, #0x0 -	bl FUN_0202A578 -	lsl r0, r0, #0x18 -	lsr r0, r0, #0x18 -	str r0, [sp, #0x0] -	ldr r0, [sp, #0x8] -	mov r1, #0x3 -	mov r2, #0x0 -	bl FUN_0202A578 -	lsl r0, r0, #0x18 -	lsr r0, r0, #0x18 -	cmp r6, #0x0 -	beq _0205FFEA -	cmp r4, #0x0 -	beq _0205FFEA -	cmp r5, #0x0 -	beq _0205FFEA -	add sp, #0xc -	mov r0, #0x0 -	pop {r4-r7, pc} -_0205FFEA: -	cmp r6, #0x0 -	bne _02060000 -	ldr r0, [sp, #0x4] -	cmp r0, #0x0 -	beq _0205FFFA -	add sp, #0xc -	mov r0, #0x4 -	pop {r4-r7, pc} -_0205FFFA: -	add sp, #0xc -	mov r0, #0x1 -	pop {r4-r7, pc} -_02060000: -	cmp r7, #0x32 -	bhs _0206000A -	add sp, #0xc -	mov r0, #0x0 -	pop {r4-r7, pc} -_0206000A: -	cmp r4, #0x0 -	bne _02060020 -	ldr r0, [sp, #0x0] -	cmp r0, #0x0 -	beq _0206001A -	add sp, #0xc -	mov r0, #0x5 -	pop {r4-r7, pc} -_0206001A: -	add sp, #0xc -	mov r0, #0x2 -	pop {r4-r7, pc} -_02060020: -	cmp r7, #0x64 -	bhs _0206002A -	add sp, #0xc -	mov r0, #0x0 -	pop {r4-r7, pc} -_0206002A: -	cmp r5, #0x0 -	beq _02060034 -	add sp, #0xc -	mov r0, #0x0 -	pop {r4-r7, pc} -_02060034: -	cmp r0, #0x0 -	beq _0206003E -	add sp, #0xc -	mov r0, #0x6 -	pop {r4-r7, pc} -_0206003E: -	mov r0, #0x3 -	add sp, #0xc -	pop {r4-r7, pc} - -	thumb_func_start FUN_02060044 -FUN_02060044: ; 0x02060044 -	add r0, #0xa8 -	ldr r0, [r0, #0x0] -	ldr r2, [r1, #0x0] -	ldrh r3, [r0, #0x24] -	add r2, r3, r2 -	strh r2, [r0, #0x24] -	ldrh r3, [r0, #0x28] -	ldr r2, [r1, #0x4] -	add r2, r3, r2 -	strh r2, [r0, #0x28] -	ldrh r2, [r0, #0x26] -	ldr r1, [r1, #0x8] -	add r1, r2, r1 -	strh r1, [r0, #0x26] -	bx lr -	.balign 4 - -	thumb_func_start FUN_02060064 -FUN_02060064: ; 0x02060064 -	ldr r1, _0206006C ; =0x02E90EDD -	mul r1, r0 -	add r0, r1, #0x1 -	bx lr -	.balign 4 -_0206006C: .word 0x02E90EDD - -	thumb_func_start FUN_02060070 -FUN_02060070: ; 0x02060070 -	ldr r1, _02060078 ; =0x5D588B65 -	mul r1, r0 -	add r0, r1, #0x1 -	bx lr -	.balign 4 -_02060078: .word 0x5D588B65 - -	thumb_func_start FUN_0206007C -FUN_0206007C: ; 0x0206007C -	push {r3-r5, lr} -	add r5, r0, #0x0 -	bl FUN_0202881C -	bl FUN_020287A4 -	bl FUN_02060070 -	add r4, r0, #0x0 -	add r0, r5, #0x0 -	bl FUN_0202A8D8 -	add r1, r4, #0x0 -	bl FUN_0202A5CC -	add r0, r4, #0x0 -	pop {r3-r5, pc} -	.balign 4 - -	thumb_func_start FUN_020600A0 -FUN_020600A0: ; 0x020600A0 -	push {r3-r6, lr} -	sub sp, #0x4 -	add r5, r0, #0x0 -	bl FUN_0202A8D8 -	add r6, r0, #0x0 -	bl FUN_0202A5D0 -	bl FUN_02060070 -	add r4, r0, #0x0 -	add r0, r6, #0x0 -	add r1, r4, #0x0 -	bl FUN_0202A5CC -	add r0, r4, #0x0 -	bl FUN_02060064 -	str r0, [sp, #0x0] -	add r0, r5, #0x0 -	bl FUN_0202A8CC -	mov r1, #0xa -	add r2, sp, #0x0 -	bl FUN_0202A2C4 -	ldr r0, [sp, #0x0] -	add sp, #0x4 -	pop {r3-r6, pc} -	.balign 4 - -	thumb_func_start FUN_020600DC -FUN_020600DC: ; 0x020600DC -	push {r3-r6, lr} -	sub sp, #0x4 -	add r6, r0, #0x0 -	bl FUN_0202A8D8 -	add r4, r0, #0x0 -	add r0, r6, #0x0 -	bl FUN_0202A8CC -	add r5, r0, #0x0 -	add r0, r4, #0x0 -	bl FUN_0202A5D0 -	bl FUN_02060064 -	mov r1, #0x0 -	str r0, [sp, #0x0] -	add r0, r5, #0x0 -	add r2, r1, #0x0 -	bl FUN_0202A240 -	add r1, r0, #0x0 -	lsl r1, r1, #0x10 -	add r0, r4, #0x0 -	lsr r1, r1, #0x10 -	mov r2, #0x0 -	bl FUN_0202A538 -	mov r1, #0x18 -	add r5, r0, #0x0 -	mul r5, r1 -	mov r4, #0x0 -	cmp r5, #0x0 -	ble _0206012E -	ldr r0, [sp, #0x0] -_02060122: -	bl FUN_02060064 -	add r4, r4, #0x1 -	str r0, [sp, #0x0] -	cmp r4, r5 -	blt _02060122 -_0206012E: -	add r0, r6, #0x0 -	bl FUN_0202A8CC -	mov r1, #0xa -	add r2, sp, #0x0 -	bl FUN_0202A2C4 -	ldr r0, [sp, #0x0] -	add sp, #0x4 -	pop {r3-r6, pc} -	.balign 4 - -	thumb_func_start FUN_02060144 -FUN_02060144: ; 0x02060144 -	ldr r0, [r0, #0x1c] -	ldr r1, [r0, #0x0] -	ldr r0, _02060158 ; =0x000001ED -	cmp r1, r0 -	bne _02060152 -	mov r0, #0x1 -	bx lr -_02060152: -	mov r0, #0x0 -	bx lr -	nop -_02060158: .word 0x000001ED diff --git a/arm9/global.inc b/arm9/global.inc index 63ab1566..a00970de 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -4887,8 +4887,8 @@  .extern CopyPlayerParty  .extern PartyHasMon  .extern SavArray_PlayerParty_get -.extern FUN_0206BB28 -.extern FUN_0206BB34 +.extern SavArray_IsNatDexEnabled +.extern Pokedex_IsNatDexEnabled  .extern FUN_0206BB48  .extern FUN_0206BB5C  .extern FUN_0206BB74 diff --git a/arm9/modules/11/asm/module_11_thumb2.s b/arm9/modules/11/asm/module_11_thumb2.s index 3e416af6..62996375 100644 --- a/arm9/modules/11/asm/module_11_thumb2.s +++ b/arm9/modules/11/asm/module_11_thumb2.s @@ -25381,7 +25381,7 @@ _0223B916:  	str r0, [sp, #0xe0]  	ldr r0, [r4]  	bl MOD11_022300D0 -	bl FUN_0206BB34 +	bl Pokedex_IsNatDexEnabled  	str r0, [sp, #0xe4]  	bl FUN_0201D658  	str r0, [r4, #0x54] diff --git a/arm9/modules/14/asm/module_14.s b/arm9/modules/14/asm/module_14.s index edbb6d86..37a18d6d 100644 --- a/arm9/modules/14/asm/module_14.s +++ b/arm9/modules/14/asm/module_14.s @@ -1925,7 +1925,7 @@ _021D84AA:  	str r1, [r4, r0]  	sub r0, #0x38  	ldr r0, [r4, r0] -	bl FUN_0206BB28 +	bl SavArray_IsNatDexEnabled  	mov r1, #0x52  	lsl r1, r1, #2  	str r0, [r4, r1] @@ -9205,7 +9205,7 @@ MOD14_021DBEAC: ; 0x021DBEAC  	mov r0, #0x47  	lsl r0, r0, #2  	ldr r0, [r6, r0] -	bl FUN_0206BB28 +	bl SavArray_IsNatDexEnabled  	ldrh r1, [r4, #4]  	bl FUN_0206BB48  	strh r0, [r4, #8] diff --git a/arm9/modules/52/src/module_52.c b/arm9/modules/52/src/module_52.c index a5b53e6c..1f74c77f 100644 --- a/arm9/modules/52/src/module_52.c +++ b/arm9/modules/52/src/module_52.c @@ -1,5 +1,6 @@  #include "module_52.h"  #include "heap.h" +#include "unk_0205FA2C.h"  extern struct Unk21DBE18 UNK_020FD144; @@ -7,7 +8,6 @@ extern struct Unk21DBE18 UNK_020F2B7C;  extern struct Unk21DBE18 UNK_020F2B8C;  extern void FUN_02015E3C(struct IGT *igt); -extern void FUN_0206007C(struct SaveBlock2 *sav2);  extern int FUN_02053678(u32 random, u32 gender, u32 param2);  extern void FUN_020250C4(void *sav_ptr, u32 heap_id, const u8 param2[], u32 param3);  extern void FUN_020377E0(struct SaveBlock2 *sav2); diff --git a/arm9/src/unk_0205FA2C.c b/arm9/src/unk_0205FA2C.c new file mode 100644 index 00000000..93bd2e4e --- /dev/null +++ b/arm9/src/unk_0205FA2C.c @@ -0,0 +1,546 @@ +#include "unk_0205FA2C.h" + +extern void *UNK_020F96DC; +extern void *UNK_020FA6E8; +extern u32 FUN_02079C70(struct SaveBlock2 *sav2); +extern void FUN_0207B000(struct UnkPlayerStruct2_0205FA2C *ptr, const u8 param1[12]); +extern void FUN_0207C2A4(struct UnkPlayerStruct2_0205FA2C *ptr, struct PlayerData *player_data); +extern u32 FUN_0203384C(u32 *param0); +extern u32 *FUN_02038790(struct UnkStruct_0204639C *param0, u16 param1, u16 param2); +extern u16 *GetVarPointer(struct UnkSavStruct80 *arg, u16); +extern u32 FUN_02031190(); +extern u32 FUN_020316E0(u32 param0); +extern u16 MOD06_02244660(struct UnkStruct_0204639C *param0, u32 param1); +extern u16 MOD06_022446BC(struct UnkStruct_0204639C *param0, u32 param1); +extern u16 MOD06_022446E0(struct UnkStruct_0204639C *param0, u32 param1); +extern void FUN_0202A5CC(u32 param0, u32 param1); +extern u32 FUN_0202A5D0(u32 param0); +extern u32 FUN_0202A150(struct UnkStruct_02029FB0 *param0, u32 param1); +extern u32 FUN_0202A8D8(struct SaveBlock2 *sav2); +extern u32 FUN_0202A578(u32 param0, u32 param1, u32 param2); +extern u32 FUN_02026CC4(struct SaveBlock2 *sav2); +extern u32 FUN_02025D94(u32 param0, u32 param1); +extern u32 FUN_0202A8CC(struct SaveBlock2 *sav2); +extern void FUN_0202A2C4(u32 param0, u32 param1, u32 *param2); +extern u32 FUN_0202A240(u32 param0, u32 param1, u32 param2); +extern int FUN_0202A538(u32 param0, u16 param1, u32 param2); + +const u8 UNK_020F7454[] = { +    0x00, +    0x01, +    0x02, +    0x04, +    0x03, +    0x05, +    0x06, +    0x07, +    0x08, +    0x00, +    0x00, +    0x00, +}; + +THUMB_FUNC u32 FUN_0205FA2C( +    struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1, u32 heap_id) +{ +    struct UnkPlayerStruct1_0205FA2C *ptr = (struct UnkPlayerStruct1_0205FA2C *)AllocFromHeapAtEnd( +        heap_id, sizeof(struct UnkPlayerStruct1_0205FA2C)); + +    struct SaveBlock2 *sav2 = (struct SaveBlock2 *)(param1->unkC); +    MI_CpuFill8(ptr, 0, sizeof(struct UnkPlayerStruct1_0205FA2C)); + +    ptr->options = Sav2_PlayerData_GetOptionsAddr(sav2); + +    ptr->player_party = SavArray_PlayerParty_get(sav2); + +    ptr->bag = Sav2_Bag_get(sav2); + +    ptr->unk21 = 0; +    ptr->unk20 = param0->unk08; +    ptr->unk32 = param0->unk0a; +    ptr->unk322 = param0->unk0b; +    ptr->unk33 = param0->unk0c; +    ptr->unk22 = param0->unk0d; + +    for (u8 i = 0; i < 6; i++) +    { +        ptr->unk2c[i] = param0->unk0e[i]; +    } + +    FUN_020373D4(param1, (u32)&UNK_020F96DC, (u32)ptr); + +    *param0->unk14 = ptr; + +    return 1; +} + +THUMB_FUNC u32 FUN_0205FAD8( +    struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1) +{ +    if (FUN_0204647C(param1)) +    { +        return 1; +    } + +    struct UnkPlayerStruct1_0205FA2C *ptr = (struct UnkPlayerStruct1_0205FA2C *)*param0->unk14; + +    u8 r1 = ptr->unk22; +    if (r1 != 6) +    { +        if (r1 == 7) +        { +            param0->unk00 = 0; +            return 4; +        } +    } +    else +    { +        param0->unk00 = 1; +        return 4; +    } + +    MI_CpuCopy8(ptr->unk2c, param0->unk0e, 6); + +    param0->unk0d = ptr->unk22; +    FreeToHeap(ptr); + +    *param0->unk14 = NULL; + +    return 2; +} + +THUMB_FUNC u32 FUN_0205FB34( +    struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1, u32 heap_id) +{ +    struct SaveBlock2 *sav2 = (struct SaveBlock2 *)(param1->unkC); + +    struct UnkPlayerStruct2_0205FA2C *ptr = (struct UnkPlayerStruct2_0205FA2C *)AllocFromHeapAtEnd( +        heap_id, sizeof(struct UnkPlayerStruct2_0205FA2C)); +    MI_CpuFill8(ptr, 0, sizeof(struct UnkPlayerStruct2_0205FA2C)); + +    ptr->options = Sav2_PlayerData_GetOptionsAddr(sav2); +    ptr->player_party = SavArray_PlayerParty_get(sav2); +    ptr->IsNatDex = SavArray_IsNatDexEnabled(sav2); +    ptr->unk2c = FUN_02079C70(sav2); + +    ptr->unk11 = 1; +    ptr->unk14 = param0->unk0d; + +    ptr->party_count = (u8)GetPartyCount(ptr->player_party); + +    ptr->unk18 = 0; +    ptr->unk12 = param0->unk09; + +    ptr->unk20 = FUN_0202A918(sav2); + +    FUN_0207B000(ptr, UNK_020F7454); + +    FUN_0207C2A4(ptr, Sav2_PlayerData_GetProfileAddr(sav2)); + +    FUN_020373D4(param1, (u32)&UNK_020FA6E8, (u32)ptr); + +    *param0->unk14 = ptr; + +    return 3; +} + +THUMB_FUNC u32 FUN_0205FBC0( +    struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1) +{ +    if (FUN_0204647C(param1)) +    { +        return 3; +    } + +    struct UnkPlayerStruct2_0205FA2C *ptr = (struct UnkPlayerStruct2_0205FA2C *)*param0->unk14; +    param0->unk0d = ptr->unk14; +    FreeToHeap(ptr); + +    *param0->unk14 = NULL; + +    return 0; +} + +THUMB_FUNC int FUN_0205FBE8(struct UnkStruct_0204639C *param0) +{ +    struct UnkStruct_0204639C *res = FUN_02046528(param0); +    struct UnkCallbackStruct1_0205FA2C *res2 = +        (struct UnkCallbackStruct1_0205FA2C *)FUN_0204652C(param0); +    switch (res2->unk04) +    { +    case 0: +        res2->unk04 = FUN_0205FA2C(res2, res, 0xb); +        break; +    case 1: +        res2->unk04 = FUN_0205FAD8(res2, res); +        break; +    case 2: +        res2->unk04 = FUN_0205FB34(res2, res, 0xb); +        break; +    case 3: +        res2->unk04 = FUN_0205FBC0(res2, res); +        break; +    case 4: +        FreeToHeap(res2); +        return 1; +    } + +    return 0; +} + +THUMB_FUNC void FUN_0205FC50(struct UnkStruct_0204639C *param0, +    void **param1, +    u8 param2, +    u8 param3, +    u8 param4, +    u8 param5, +    u8 param6, +    u8 param7) +{ +    struct UnkStruct_0204639C *res = FUN_02046528(param0); + +    struct UnkCallbackStruct1_0205FA2C *ptr = (struct UnkCallbackStruct1_0205FA2C *)AllocFromHeap( +        0xb, sizeof(struct UnkCallbackStruct1_0205FA2C)); +    MI_CpuFill8(ptr, 0, sizeof(struct UnkCallbackStruct1_0205FA2C)); + +    ptr->unk08 = param2; +    ptr->unk09 = param3; +    ptr->unk0a = param4; +    ptr->unk0b = param5; +    ptr->unk0c = param6; +    ptr->unk0d = param7; +    ptr->unk14 = param1; + +    FUN_0204640C(res->unk10, &FUN_0205FBE8, (u32 *)ptr); +} + +THUMB_FUNC u32 FUN_0205FC9C( +    struct UnkCallbackStruct2_0205FA2C *param0, struct UnkStruct_0204639C *param1) +{ +    if (FUN_0203384C(param1->unkC)) +    { + +        param0->unk08 = FUN_02038790(param1, param0->unk12, param0->unk14); +        return 1; +    } + +    param0->unk00 = 1; +    return 2; +} + +THUMB_FUNC u32 FUN_0205FCC4( +    struct UnkCallbackStruct2_0205FA2C *param0, struct UnkStruct_0204639C *param1) +{ +    if (FUN_0204647C(param1)) +    { +        return 1; +    } + +    param0->unk00 = param0->unk08[8]; +    FreeToHeap(param0->unk08); + +    return 2; +} + +THUMB_FUNC int FUN_0205FCE8(struct UnkStruct_0204639C *param0) +{ +    struct UnkStruct_0204639C *res = FUN_02046528(param0); +    struct UnkCallbackStruct2_0205FA2C *res2 = +        (struct UnkCallbackStruct2_0205FA2C *)FUN_0204652C(param0); + +    switch (res2->unk04) +    { +    case 0: +        res2->unk04 = FUN_0205FC9C(res2, res); +        break; +    case 1: +        res2->unk04 = FUN_0205FCC4(res2, res); +        break; +    case 2: +        u16 *var = GetVarPointer((struct UnkSavStruct80 *)res, res2->unk10); +        *var = (u16)res2->unk00; +        FreeToHeap(res2); + +        return 1; +    } + +    return 0; +} + +THUMB_FUNC void FUN_0205FD38(struct UnkStruct_0204639C *param0, u16 param1, u16 param2, u16 param3) +{ +    struct UnkStruct_0204639C *res = FUN_02046528(param0); +    struct UnkCallbackStruct2_0205FA2C *ptr = (struct UnkCallbackStruct2_0205FA2C *)AllocFromHeap( +        0xb, sizeof(struct UnkCallbackStruct2_0205FA2C)); +    MI_CpuFill8(ptr, 0, sizeof(struct UnkCallbackStruct2_0205FA2C)); + +    ptr->unk12 = param1; +    ptr->unk14 = param3; +    ptr->unk10 = param2; + +    FUN_0204640C(res->unk10, &FUN_0205FCE8, (u32 *)ptr); +} + +THUMB_FUNC int FUN_0205FD70(struct UnkStruct_0204639C *param0) +{ +    struct UnkStruct_0204639C *res = FUN_02046528(param0); +    u16 *res2 = (u16 *)FUN_0204652C(param0); +    u32 res3 = FUN_020316E0(1 - FUN_02031190()); +    if (res3 == 0) +    { +        return 0; +    } + +    u16 *var = GetVarPointer((struct UnkSavStruct80 *)res, res2[1]); +    switch (res2[0]) +    { +    case 0: +        *var = MOD06_02244660(res, res3); +        break; +    case 1: +        *var = MOD06_022446BC(res, res3); + +        break; +    case 2: +        *var = MOD06_022446E0(res, res3); + +        break; +    } + +    FreeToHeap(res2); + +    return 1; +} + +THUMB_FUNC void FUN_0205FDDC(struct UnkStruct_0204639C *param0, u16 param1, u16 param2) +{ +    struct UnkStruct_0204639C *res = FUN_02046528(param0); + +    u16 *ptr = AllocFromHeap(0xb, 2 * sizeof(u16)); +    MI_CpuFill8(ptr, 0, 2 * sizeof(u16)); + +    ptr[0] = param1; +    ptr[1] = param2; + +    FUN_0204640C(res->unk10, &FUN_0205FD70, (u32 *)ptr); +} + +THUMB_FUNC u32 FUN_0205FE10(struct SaveBlock2 *sav2) +{ + +    u16 res = (u16)FUN_0202A150(FUN_02029FC8(sav2), 0x35); +    if (res < 20) +    { +        return 0; +    } + +    u32 res2 = FUN_0202A8D8(sav2); + +    u8 res3 = (u8)FUN_0202A578(res2, 0xd, 0); +    u8 res4 = (u8)FUN_0202A578(res2, 0, 0); +    u8 res5 = (u8)FUN_0202A578(res2, 1, 0); + +    u8 res6 = (u8)FUN_0202A578(res2, 0xe, 0); +    u8 res7 = (u8)FUN_0202A578(res2, 2, 0); +    u8 res8 = (u8)FUN_0202A578(res2, 3, 0); + +    if (res3 != 0 && res4 != 0 && res5 != 0) +    { +        return 0; +    } + +    u32 res9 = FUN_02026CC4(sav2); +    if (res3 == 0) +    { +        if (FUN_02025D94(res9, 0x55) != 0) +        { +            FUN_0202A578(res2, 0xd, 1); +            return 1; +        } + +        if (res6 == 0) +        { +            FUN_0202A578(res2, 0xe, 1); +        } + +        return 4; +    } + +    if (res < 50) +    { +        return 0; +    } + +    if (res4 == 0) +    { +        if (FUN_02025D94(res9, 0x56) != 0) +        { +            FUN_0202A578(res2, 0, 1); +            return 2; +        } + +        if (res7 == 0) +        { +            FUN_0202A578(res2, 2, 1); +        } + +        return 4; +    } + +    if (res < 100 || res5 != 0) +    { +        return 0; +    } + +    if (FUN_02025D94(res9, 0x57) != 0) +    { +        FUN_0202A578(res2, 1, 1); +        return 3; +    } + +    if (res8 == 0) +    { +        FUN_0202A578(res2, 3, 1); +    } + +    return 4; +} + +THUMB_FUNC u32 FUN_0205FF5C(struct SaveBlock2 *sav2) +{ +    u16 res = (u16)FUN_0202A150(FUN_02029FC8(sav2), 0x35); +    if (res < 20) +    { +        return 0; +    } + +    u32 res2 = FUN_0202A8D8(sav2); + +    u8 res3 = (u8)FUN_0202A578(res2, 0xd, 0); +    u8 res4 = (u8)FUN_0202A578(res2, 0, 0); +    u8 res5 = (u8)FUN_0202A578(res2, 1, 0); + +    u8 res6 = (u8)FUN_0202A578(res2, 0xe, 0); +    u8 res7 = (u8)FUN_0202A578(res2, 2, 0); +    u8 res8 = (u8)FUN_0202A578(res2, 3, 0); + +    if (res3 != 0 && res4 != 0 && res5 != 0) +    { +        return 0; +    } + +    if (res3 == 0) +    { +        if (res6 != 0) +        { +            return 4; +        } + +        return 1; +    } + +    if (res < 50) +    { +        return 0; +    } + +    if (res4 == 0) +    { +        if (res7 != 0) +        { +            return 5; +        } + +        return 2; +    } + +    if (res < 100) +    { +        return 0; +    } + +    if (res5 != 0) +    { +        return 0; +    } + +    if (res8 != 0) +    { +        return 6; +    } + +    return 3; +} + +THUMB_FUNC void FUN_02060044(u16 **param0, u32 *param1) +{ +    u16 *ptr = param0[42]; + +    ptr[18] += param1[0]; +    ptr[20] += param1[1]; +    ptr[19] += param1[2]; +} + +THUMB_FUNC u32 FUN_02060064(u32 param0) +{ +    return param0 * 0x02E90EDD + 1; +} + +THUMB_FUNC u32 FUN_02060070(u32 param0) +{ +    return param0 * 0x5D588B65 + 1; +} + +THUMB_FUNC u32 FUN_0206007C(struct SaveBlock2 *sav2) +{ +    u32 res = FUN_02060070(FUN_020287A4(FUN_0202881C(sav2))); + +    FUN_0202A5CC(FUN_0202A8D8(sav2), res); + +    return res; +} + +THUMB_FUNC u32 FUN_020600A0(struct SaveBlock2 *sav2) +{ +    u32 res = FUN_0202A8D8(sav2); + +    u32 res2 = FUN_02060070(FUN_0202A5D0(res)); + +    FUN_0202A5CC(res, res2); +    u32 res3 = FUN_02060064(res2); + +    FUN_0202A2C4(FUN_0202A8CC(sav2), 0xa, &res3); + +    return res3; +} + +THUMB_FUNC u32 FUN_020600DC(struct SaveBlock2 *sav2) +{ +    u32 res = FUN_0202A8D8(sav2); + +    u32 res2 = FUN_0202A8CC(sav2); + +    u32 res3 = FUN_02060064(FUN_0202A5D0(res)); + +    int i = 0; +    int res4 = FUN_0202A538(res, (u16)FUN_0202A240(res2, 0, 0), 0) * 0x18; + +    for (i = 0; i < res4; i++) +    { +        res3 = FUN_02060064(res3); +    } + +    FUN_0202A2C4(FUN_0202A8CC(sav2), 0xa, &res3); + +    return res3; +} + +THUMB_FUNC BOOL FUN_02060144(u32 **param0) +{ +    if (param0[7][0] == 0x1ED) +    { +        return TRUE; +    } + +    return FALSE; +} diff --git a/arm9/src/unk_0206BB28.c b/arm9/src/unk_0206BB28.c index baaecc6a..e7c12793 100644 --- a/arm9/src/unk_0206BB28.c +++ b/arm9/src/unk_0206BB28.c @@ -6,12 +6,12 @@  #pragma thumb on -BOOL FUN_0206BB28(struct SaveBlock2 * sav2) +BOOL SavArray_IsNatDexEnabled(struct SaveBlock2 * sav2)  { -    return FUN_0206BB34(Sav2_Pokedex_get(sav2)); +    return Pokedex_IsNatDexEnabled(Sav2_Pokedex_get(sav2));  } -BOOL FUN_0206BB34(struct Pokedex * pokedex) +BOOL Pokedex_IsNatDexEnabled(struct Pokedex * pokedex)  {      return Pokedex_GetNatDexFlag(pokedex) == TRUE;  } diff --git a/include/unk_0205FA2C.h b/include/unk_0205FA2C.h new file mode 100644 index 00000000..99cf7606 --- /dev/null +++ b/include/unk_0205FA2C.h @@ -0,0 +1,120 @@ +#ifndef POKEDIAMOND_UNK_0205FA2C_H +#define POKEDIAMOND_UNK_0205FA2C_H + +#include "global.h" +#include "MI_memory.h" +#include "bag.h" +#include "heap.h" +#include "party.h" +#include "player_data.h" +#include "script.h" +#include "unk_020286F8.h" +#include "unk_02029FB0.h" +#include "unk_0202A8F4.h" +#include "unk_0204639C.h" +#include "unk_0206BB28.h" + +struct UnkPlayerStruct1_0205FA2C +{ +    /* 0x00 */ struct PlayerParty *player_party; +    /* 0x04 */ struct Bag *bag; +    u32 unk08; +    /* 0x0c */ struct Options *options; +    u32 unk10[4]; +    u8 unk20; +    u8 unk21; +    u8 unk22; +    u8 unk23; +    u32 unk24[2]; +    u8 unk2c[6]; +    u8 unk32 : 4; +    u8 unk322 : 4; +    u8 unk33; +    u32 unk34[3]; +}; + +struct UnkPlayerStruct2_0205FA2C +{ +    /* 0x00 */ struct PlayerParty *player_party; +    /* 0x04 */ struct Options *options; +    u32 unk08; +    u32 unk0c; +    u8 unk10; +    u8 unk11; +    u8 unk12; +    /* 0x04 */ u8 party_count; +    u8 unk14; +    u8 unk15[3]; +    u16 unk18; +    u16 unk1a; +    /* 0x1c */ BOOL IsNatDex; +    void *unk20; +    u32 unk24; +    u32 unk28; +    u32 unk2c; +}; + +struct UnkCallbackStruct1_0205FA2C +{ +    u32 unk00; +    u32 unk04; +    u8 unk08; +    u8 unk09; +    u8 unk0a; +    u8 unk0b; +    u8 unk0c; +    u8 unk0d; +    u8 unk0e[6]; +    void **unk14; +}; + +struct UnkCallbackStruct2_0205FA2C +{ +    u32 unk00; +    u32 unk04; +    u32 *unk08; +    u32 unk0c; +    u16 unk10; +    u16 unk12; +    u16 unk14; +}; + +THUMB_FUNC u32 FUN_0205FA2C( +    struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1, u32 heap_id); +THUMB_FUNC u32 FUN_0205FAD8( +    struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1); +THUMB_FUNC u32 FUN_0205FB34( +    struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1, u32 heap_id); +THUMB_FUNC u32 FUN_0205FBC0( +    struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1); +THUMB_FUNC int FUN_0205FBE8(struct UnkStruct_0204639C *param0); +THUMB_FUNC void FUN_0205FC50(struct UnkStruct_0204639C *param0, +    void **param1, +    u8 param2, +    u8 param3, +    u8 param4, +    u8 param5, +    u8 param6, +    u8 param7); + +THUMB_FUNC u32 FUN_0205FC9C( +    struct UnkCallbackStruct2_0205FA2C *param0, struct UnkStruct_0204639C *param1); +THUMB_FUNC u32 FUN_0205FCC4( +    struct UnkCallbackStruct2_0205FA2C *param0, struct UnkStruct_0204639C *param1); +THUMB_FUNC int FUN_0205FCE8(struct UnkStruct_0204639C *param0); +THUMB_FUNC void FUN_0205FD38(struct UnkStruct_0204639C *param0, u16 param1, u16 param2, u16 param3); + +THUMB_FUNC int FUN_0205FD70(struct UnkStruct_0204639C *param0); +THUMB_FUNC void FUN_0205FDDC(struct UnkStruct_0204639C *param0, u16 param1, u16 param2); + +THUMB_FUNC u32 FUN_0205FE10(struct SaveBlock2 *sav2); +THUMB_FUNC u32 FUN_0205FF5C(struct SaveBlock2 *sav2); +THUMB_FUNC void FUN_02060044(u16 **param0, u32 *param1); +THUMB_FUNC u32 FUN_02060064(u32 param0); +THUMB_FUNC u32 FUN_02060070(u32 param0); +THUMB_FUNC u32 FUN_0206007C(struct SaveBlock2 *sav2); +THUMB_FUNC u32 FUN_020600A0(struct SaveBlock2 *sav2); +THUMB_FUNC u32 FUN_020600DC(struct SaveBlock2 *sav2); +THUMB_FUNC BOOL FUN_02060144(u32 **param0); + +#endif // POKEDIAMOND_UNK_0205FA2C_H
\ No newline at end of file diff --git a/include/unk_0206BB28.h b/include/unk_0206BB28.h index ff60e220..44997e73 100644 --- a/include/unk_0206BB28.h +++ b/include/unk_0206BB28.h @@ -5,8 +5,8 @@  #include "pokedex.h"  #include "pokemon.h" -BOOL FUN_0206BB28(struct SaveBlock2 * sav2); -BOOL FUN_0206BB34(struct Pokedex * pokedex); +BOOL SavArray_IsNatDexEnabled(struct SaveBlock2 * sav2); +BOOL Pokedex_IsNatDexEnabled(struct Pokedex * pokedex);  u32 FUN_0206BB48(BOOL isNationalDex, u32 species);  #endif //POKEDIAMOND_UNK_0206BB28_H | 
