summaryrefslogtreecommitdiff
path: root/src/layoutDebug.S
blob: 591bfd514bca7e3205bfc4e6d464b8381ad1744a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
.text

.extern OSReport
.extern strcmp

.global RlanLoadDebugHook
.extern m2d__AnmResHandler_c__Load
RlanLoadDebugHook:
	stwu r1, -0x20(r1)
	mflr r0
	stw r0, 0x24(r1)
	stw r21, 0x1C(r1)
	stw r22, 0x18(r1)
	stw r23, 0x14(r1)
	stw r24, 0x10(r1)
	stw r25, 0xC(r1)

	mr r21, r3
	mr r22, r4
	mr r23, r5
	mr r24, r6
	mr r25, r7

	lis r3, RlanLoadStr@h
	ori r3, r3, RlanLoadStr@l
	mr r4, r29 # rlan num
	mr r5, r28 # rlan count
	mr r6, r21 # anmreshandler
	mr r7, r22 # rlan name
	mr r8, r23 # resAcc
	mr r9, r24 # layout
	crclr 4*cr1+eq
	bl OSReport

	lis r3, BreakOnRlan@h
	ori r3, r3, BreakOnRlan@l
	mr r4, r22
	bl strcmp
	cmpwi r3, 0
	bne thatsFine
	lis r3, 0xDEAD
	ori r3, r3, 0xBEEF
thatsFine:
	mr r3, r21
	mr r4, r22
	mr r5, r23
	mr r6, r24
	mr r7, r25
	bl m2d__AnmResHandler_c__Load
	mr r25, r3

#	lis r3, RlanGrpCount@h
#	ori r3, r3, RlanGrpCount@l
#	lwz r4, 0x18(r21)
#	crclr 4*cr1+eq
#	bl OSReport

	# Thing: r22
	# ID: r23
	# Count: r24
	li r23, 0
	lwz r24, 0x18(r21)
	lwz r22, 0x14(r21)
	b startGroupReportLoop
groupReportLoop:

	lis r3, RlanGroupStr@h
	ori r3, r3, RlanGroupStr@l

	mr r4, r23 # ID
	mr r5, r24 # count
	lwz r6, 0(r22) # group
	addi r7, r6, 0x18
	lwz r8, 4(r22) # animTransform

	crclr 4*cr1+eq
	bl OSReport

	addi r23, r23, 1
	addi r22, r22, 8

startGroupReportLoop:
	cmpw r23, r24
	blt groupReportLoop

	mr r3, r25

	lwz r21, 0x1C(r1)
	lwz r22, 0x18(r1)
	lwz r23, 0x14(r1)
	lwz r24, 0x10(r1)
	lwz r25, 0xC(r1)
	lwz r0, 0x24(r1)
	mtlr r0
	addi r1, r1, 0x20
	blr




.global AnmLoadDebugHook
.extern m2d__Anm_c__Load

AnmLoadDebugHook:
	stwu r1, -0x20(r1)
	mflr r0
	stw r0, 0x24(r1)
	stw r21, 0x1C(r1)
	stw r22, 0x18(r1)
	stw r23, 0x14(r1)

	mr r21, r3
	mr r22, r4
	mr r23, r5

	lis r3, AnmLoadStr@h
	ori r3, r3, AnmLoadStr@l
	mr r4, r30 # anim num
	mr r5, r29 # anim count
	lwz r6, 0(r28) # rlan ID
	mr r7, r21 # anim
	mr r8, r22 # anmreshandler
	mr r9, r23 # group name
	crclr 4*cr1+eq
	bl OSReport

	mr r3, r21
	mr r4, r22
	mr r5, r23
	bl m2d__Anm_c__Load

	lwz r21, 0x1C(r1)
	lwz r22, 0x18(r1)
	lwz r23, 0x14(r1)
	lwz r0, 0x24(r1)
	mtlr r0
	addi r1, r1, 0x20
	blr


.data
.align 4
AnmLoadStr: .string "[Anm %d/%d] Anm[%d] @ %p, ResHandler @ %p, Group: %s\n"
RlanLoadStr: .string "[Rlan %d/%d] ResHandler: %p, Rlan Name: %s, ResAcc: %p, Layout: %p\n"
#RlanGrpCount: .string "%d group(s):\n"
RlanGroupStr: .string "--[%d/%d] %p : %s - AnimTransform: %p\n"
BreakOnRlan: .string "fileSelectBase_18_DummyAnim.brlan"