summaryrefslogtreecommitdiff
path: root/src/music.S
blob: 59c86a0f41962b8460f0d027e42e792251236352 (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
.text

# An Epic Music Hack

.extern SoundRelatedClass
.extern sprintf
.global HaxMusic

HaxMusic:
	cmpwi r3, 100
	bltlr

	stwu r1, -0x10(r1)
	mflr r0
	stw r0, 0x14(r1)
	stw r31, 0xC(r1)
	stw r30, 0x8(r1)

	mr r31, r3

	lis r3, SoundRelatedClass@h
	ori r3, r3, SoundRelatedClass@l
	lwz r3, 0(r3)
	lwz r30, 0x5CC(r3)
	addis r30, r30, 3

	subi r3, r30, 0x6A84
	lis r4, RegularMusic@h
	ori r4, r4, RegularMusic@l
	mr r5, r31
	bl sprintf

	subi r3, r30, 0x6A0C
	lis r4, FastMusic@h
	ori r4, r4, FastMusic@l
	mr r5, r31
	bl sprintf

	li r3, 1

	lwz r0, 0x14(r1)
	lwz r31, 0xC(r1)
	lwz r30, 0x8(r1)
	mtlr r0
	addi r1, r1, 0x10
	blr


.data
RegularMusic:	.string "stream/theme%03d.brstm"
FastMusic:		.string "stream/theme%03d_fast.brstm"