add FasterReload
This commit is contained in:
parent
82a28b82e4
commit
18d90d06a2
3 changed files with 200 additions and 0 deletions
55
NTSC-J 1.0/FasterReload.txt
Normal file
55
NTSC-J 1.0/FasterReload.txt
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
$ Faster Reload (v0.1-alpha) (2022/10/31)
|
||||||
|
28400D50 00001018
|
||||||
|
017F8408 000000FF
|
||||||
|
28400D51 00001014
|
||||||
|
017F8408 00000000
|
||||||
|
E0000000 00000000
|
||||||
|
0410A7F0 496EDCD1
|
||||||
|
0410A744 496EDCE9
|
||||||
|
0410A758 496EDD45
|
||||||
|
0410A898 496EDC4C
|
||||||
|
040F9DC8 496FE780
|
||||||
|
077F840C 00000158
|
||||||
|
814D8D6C 806A006C
|
||||||
|
7C636214 916A006C
|
||||||
|
800A0070 7C0B0050
|
||||||
|
900A0068 4E800020
|
||||||
|
3D808180 A48C8404
|
||||||
|
289D03E8 880C0004
|
||||||
|
7C000379 4C461102
|
||||||
|
41820010 3800FFFF
|
||||||
|
900C0000 48000048
|
||||||
|
A01F007C B00C0000
|
||||||
|
7C002279 B00C0002
|
||||||
|
40820034 380000F0
|
||||||
|
3C608092 94035BB4
|
||||||
|
3800004C 90030834
|
||||||
|
3C008092 60005BA8
|
||||||
|
3C608099 90032354
|
||||||
|
3D6080A0 616BBE80
|
||||||
|
4BFFFF78 4A9115EC
|
||||||
|
3D808180 A18C8406
|
||||||
|
7D8C6379 40820014
|
||||||
|
3D6080A4 616B9A60
|
||||||
|
39800000 4BFFFF54
|
||||||
|
4A902F7C 3D808180
|
||||||
|
A18C8406 7D8C6379
|
||||||
|
40820014 3D6080A4
|
||||||
|
616BC8E0 39800014
|
||||||
|
4BFFFF30 4A83C0E0
|
||||||
|
3D808180 A18C8406
|
||||||
|
7D8C6379 40820040
|
||||||
|
3D808180 816C8400
|
||||||
|
39800000 4BFFFF0D
|
||||||
|
9421FFF0 90610008
|
||||||
|
386BFF94 4A8146A1
|
||||||
|
38A00000 80810008
|
||||||
|
9061000C 4A8148D9
|
||||||
|
8061000C 38210010
|
||||||
|
4A912370 4A900E6D
|
||||||
|
80AD8D6C 8005006C
|
||||||
|
3D808180 900C8400
|
||||||
|
4A912358 28000005
|
||||||
|
41820010 3C608180
|
||||||
|
3880FFFF B0838404
|
||||||
|
28000009 4A90186C
|
13
src/FasterReload.ld
Normal file
13
src/FasterReload.ld
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
/* $$ = 0; */
|
||||||
|
$$ = 0x817f840c;
|
||||||
|
|
||||||
|
$InstantReload.head = 0x817f8400;
|
||||||
|
$InstantReload.stage = 0x817f8404;
|
||||||
|
$InstantReload.stageXor = 0x817f8406;
|
||||||
|
$InstantReload.en = 0x817f8408;
|
||||||
|
|
||||||
|
$bl$.loadResource.loadParticle = 0x8010a744;
|
||||||
|
$bl$.loadResource.yoshi = 0x8010a758;
|
||||||
|
$bl$.loadResource.scenecmn = 0x8010a7f0;
|
||||||
|
$b$.loadResource.mountStageArchive = 0x8010A898;
|
||||||
|
$b$.TApplication.proc.prepare = 0x800F9DC8;
|
132
src/FasterReload.s
Normal file
132
src/FasterReload.s
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
.macro .checkStageXor reg
|
||||||
|
lis \reg, $InstantReload.stageXor@ha
|
||||||
|
lhz \reg, $InstantReload.stageXor@l(\reg)
|
||||||
|
mr. \reg, \reg
|
||||||
|
.endm
|
||||||
|
.macro li32 reg val
|
||||||
|
lis \reg, \val@h
|
||||||
|
ori \reg, \reg, \val@l
|
||||||
|
.endm
|
||||||
|
|
||||||
|
.set rNewHead, 11
|
||||||
|
.set rR3Off, 12
|
||||||
|
.set rHeap, 10
|
||||||
|
.set rSafe, 9
|
||||||
|
/**
|
||||||
|
* rNewHead: new head
|
||||||
|
* rR3Off: r3 = old head + rR3Off
|
||||||
|
* [destroyed] r0, r3, rHeap
|
||||||
|
*/
|
||||||
|
.updateHeap:
|
||||||
|
lwz rHeap, JKRHeap.sCurrentHeap$r13(r13)
|
||||||
|
lwz r3, 0x6C(rHeap)
|
||||||
|
add r3, r3, rR3Off
|
||||||
|
stw rNewHead, 0x6C(rHeap) # head
|
||||||
|
lwz r0, 0x70(rHeap) # tail
|
||||||
|
sub r0, r0, rNewHead
|
||||||
|
stw r0, 0x68(rHeap) # freeSize
|
||||||
|
blr
|
||||||
|
|
||||||
|
.loadResource.loadParticle:
|
||||||
|
lis r12, $InstantReload.stage@ha
|
||||||
|
### r4 = lastLoadedStage or -1
|
||||||
|
lhzu r4, $InstantReload.stage@l(r12)
|
||||||
|
### cr1: emitterSize == 1000
|
||||||
|
cmplwi cr1, r29, 1000
|
||||||
|
### cr0: (r0 = en ? -1 : 0)==0
|
||||||
|
lbz r0, 4(r12) # en
|
||||||
|
mr. r0, r0
|
||||||
|
#### enabled = r29==1000 && en = cr1.eq && !cr0.eq
|
||||||
|
#### cr1.eq = !en
|
||||||
|
crandc 4*cr0+eq, 4*cr1+eq, 4*cr0+eq
|
||||||
|
beq .loadResource.loadParticle.enabled
|
||||||
|
li r0, -1
|
||||||
|
stw r0, 0(r12) # lastLoadedStage, xor = -1
|
||||||
|
b .loadResource.loadParticle.fallback
|
||||||
|
.loadResource.loadParticle.enabled:
|
||||||
|
## update lastLoadedStage
|
||||||
|
### r0 = curStage
|
||||||
|
lhz r0, 0x7C(r31)
|
||||||
|
sth r0, 0(r12) # lastLoadedStage
|
||||||
|
xor. r0, r0, r4
|
||||||
|
sth r0, 2(r12) # xor
|
||||||
|
bne .loadResource.loadParticle.fallback
|
||||||
|
.loadResource.loadParticle.cached:
|
||||||
|
## update values in seg1
|
||||||
|
li r0, 240
|
||||||
|
lis r3, 0x80925BB4@ha
|
||||||
|
stwu r0, 0x80925BB4@l(r3)
|
||||||
|
li r0, 76
|
||||||
|
stw r0, 0x809263E8-0x80925BB4(r3)
|
||||||
|
li32 r0, 0x80925BA8
|
||||||
|
lis r3, 0x80992354@ha
|
||||||
|
stw r0, 0x80992354@l(r3)
|
||||||
|
## update heap
|
||||||
|
li32 rNewHead, 0x80A0BE80 # TODO
|
||||||
|
## r3 don't care
|
||||||
|
b .updateHeap
|
||||||
|
.loadResource.loadParticle.fallback:
|
||||||
|
b TMarDirector.loadParticle
|
||||||
|
|
||||||
|
.loadResource.yoshi:
|
||||||
|
.checkStageXor r12
|
||||||
|
bne .loadResource.yoshi.fallback
|
||||||
|
## update heap
|
||||||
|
li32 rNewHead, 0x80A49A60 # TODO
|
||||||
|
li rR3Off, 0
|
||||||
|
b .updateHeap
|
||||||
|
.loadResource.yoshi.fallback:
|
||||||
|
b System.SMSLoadArchive
|
||||||
|
|
||||||
|
.loadResource.scenecmn:
|
||||||
|
.checkStageXor r12
|
||||||
|
bne .loadResource.scenecmn.fallback
|
||||||
|
## update heap
|
||||||
|
li32 rNewHead, 0x80A4C8E0 # TODO
|
||||||
|
li rR3Off, 20
|
||||||
|
b .updateHeap
|
||||||
|
.loadResource.scenecmn.fallback:
|
||||||
|
b JKRDvdRipper.loadToMainRAM$2
|
||||||
|
|
||||||
|
.loadResource.mountStageArchive:
|
||||||
|
.checkStageXor r12
|
||||||
|
bne .loadResource.mountStageArchive.fallback
|
||||||
|
## update heap
|
||||||
|
### rNewHead = recordedHead
|
||||||
|
lis r12, $InstantReload.head@ha
|
||||||
|
lwz rNewHead, $InstantReload.head@l(r12)
|
||||||
|
li rR3Off, 0
|
||||||
|
bl .updateHeap
|
||||||
|
## init JKRMemArchive
|
||||||
|
stwu r1, -0x10(r1)
|
||||||
|
stw r3, 0x8(r1) # backup old head
|
||||||
|
addi r3, rNewHead, -0x6c # &JKRMemArchive = head-0x6c
|
||||||
|
bl JKRMemArchive.JKRMemArchive$0
|
||||||
|
li r5, 0
|
||||||
|
lwz r4, 0x8(r1) # restore dst = old head
|
||||||
|
stw r3, 0xC(r1) # backup return value
|
||||||
|
bl JKRMemArchive.mountFixed
|
||||||
|
lwz r3, 0xC(r1) # restore return value
|
||||||
|
addi r1, r1, 0x10
|
||||||
|
b 4+$b$.loadResource.mountStageArchive
|
||||||
|
.loadResource.mountStageArchive.fallback:
|
||||||
|
bl TApplication.mountStageArchive
|
||||||
|
### backup head
|
||||||
|
lwz r5, JKRHeap.sCurrentHeap$r13(r13)
|
||||||
|
lwz r0, 0x6C(r5)
|
||||||
|
lis r12, $InstantReload.head@ha
|
||||||
|
stw r0, $InstantReload.head@l(r12)
|
||||||
|
.loadResource.mountStageArchive.done:
|
||||||
|
b 4+$b$.loadResource.mountStageArchive
|
||||||
|
|
||||||
|
.TApplication.proc.prepare:
|
||||||
|
## r0 = this->state
|
||||||
|
cmplwi r0, 0x5
|
||||||
|
beq .proc.prepare.done
|
||||||
|
lis r3, $InstantReload.stage@ha
|
||||||
|
li r4, -1
|
||||||
|
sth r4, $InstantReload.stage@l(r3)
|
||||||
|
.proc.prepare.done:
|
||||||
|
## orig
|
||||||
|
cmplwi r0, 0x9
|
||||||
|
b 4+$b$.TApplication.proc.prepare
|
Loading…
Reference in a new issue